summaryrefslogtreecommitdiff
path: root/ext/ed25519-amd64-asm/ge25519_pack.c
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2018-03-13 06:51:17 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2018-03-13 06:51:17 -0700
commitbeb170e4fb4a42cf3770a731f222a63f0bdfe0f3 (patch)
tree11cde6c7374affaaf88a3eed48bd0018d6268fc4 /ext/ed25519-amd64-asm/ge25519_pack.c
parenta59912f3afa7627f3da79804a9be693a7d314ebc (diff)
downloadinfinitytier-beb170e4fb4a42cf3770a731f222a63f0bdfe0f3.tar.gz
infinitytier-beb170e4fb4a42cf3770a731f222a63f0bdfe0f3.zip
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.
Diffstat (limited to 'ext/ed25519-amd64-asm/ge25519_pack.c')
-rw-r--r--ext/ed25519-amd64-asm/ge25519_pack.c13
1 files changed, 13 insertions, 0 deletions
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;
+}