From beb170e4fb4a42cf3770a731f222a63f0bdfe0f3 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 13 Mar 2018 06:51:17 -0700 Subject: Use X64 ASM ed25519 signatures on Linux/x64, which are about 10X faster. Will matter a lot for network controllers, not so much for other things. --- ext/ed25519-amd64-asm/ge25519_pack.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ext/ed25519-amd64-asm/ge25519_pack.c (limited to 'ext/ed25519-amd64-asm/ge25519_pack.c') diff --git a/ext/ed25519-amd64-asm/ge25519_pack.c b/ext/ed25519-amd64-asm/ge25519_pack.c new file mode 100644 index 00000000..f289fe57 --- /dev/null +++ b/ext/ed25519-amd64-asm/ge25519_pack.c @@ -0,0 +1,13 @@ +#include "fe25519.h" +#include "sc25519.h" +#include "ge25519.h" + +void ge25519_pack(unsigned char r[32], const ge25519_p3 *p) +{ + fe25519 tx, ty, zi; + fe25519_invert(&zi, &p->z); + fe25519_mul(&tx, &p->x, &zi); + fe25519_mul(&ty, &p->y, &zi); + fe25519_pack(r, &ty); + r[31] ^= fe25519_getparity(&tx) << 7; +} -- cgit v1.2.3