summaryrefslogtreecommitdiff
path: root/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2014-08-11 13:49:21 -0400
committerMicah Anderson <micah@riseup.net>2014-08-11 13:49:21 -0400
commit2e59f9740a29439df7c7a56cf0ae83dec3081d31 (patch)
treed5e7c4e74c9a0f1ea999327d2e68b1dd27be00e0 /src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
initial import of debian version from mentors0.6.1
Diffstat (limited to 'src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c')
-rw-r--r--src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c b/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
new file mode 100644
index 0000000..21cb2fc
--- /dev/null
+++ b/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
@@ -0,0 +1,14 @@
+#include "ge.h"
+
+void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
+{
+ fe recip;
+ fe x;
+ fe y;
+
+ fe_invert(recip,h->Z);
+ fe_mul(x,h->X,recip);
+ fe_mul(y,h->Y,recip);
+ fe_tobytes(s,y);
+ s[31] ^= fe_isnegative(x) << 7;
+}