summaryrefslogtreecommitdiff
path: root/ext/ed25519-amd64-asm/fe25519_pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ed25519-amd64-asm/fe25519_pack.c')
-rw-r--r--ext/ed25519-amd64-asm/fe25519_pack.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/ed25519-amd64-asm/fe25519_pack.c b/ext/ed25519-amd64-asm/fe25519_pack.c
new file mode 100644
index 00000000..caf51853
--- /dev/null
+++ b/ext/ed25519-amd64-asm/fe25519_pack.c
@@ -0,0 +1,13 @@
+#include "fe25519.h"
+
+/* Assumes input x being reduced below 2^255 */
+void fe25519_pack(unsigned char r[32], const fe25519 *x)
+{
+ int i;
+ fe25519 t;
+ t = *x;
+ fe25519_freeze(&t);
+ /* assuming little-endian */
+ for(i=0;i<32;i++) r[i] = i[(unsigned char *)&t.v];
+}
+