aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/curve25519/curve25519-donna-c64.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcryptobox/curve25519/curve25519-donna-c64.c')
-rw-r--r--src/libcryptobox/curve25519/curve25519-donna-c64.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcryptobox/curve25519/curve25519-donna-c64.c b/src/libcryptobox/curve25519/curve25519-donna-c64.c
index d98c385c2..a3a78fcdb 100644
--- a/src/libcryptobox/curve25519/curve25519-donna-c64.c
+++ b/src/libcryptobox/curve25519/curve25519-donna-c64.c
@@ -480,12 +480,18 @@ static void crecip (felem out, const felem z)
int scalarmult_donna64 (u8 *mypublic, const u8 *secret, const u8 *basepoint)
{
limb bp[5], x[5], z[5], zmone[5];
- int i;
+ unsigned char e[32];
+
+ memcpy (e, secret, 32);
+ e[0] &= 248;
+ e[31] &= 127;
+ e[31] |= 64;
fexpand (bp, basepoint);
- cmult (x, z, secret, bp);
+ cmult (x, z, e, bp);
crecip (zmone, z);
fmul (z, x, zmone);
fcontract (mypublic, z);
+
return 0;
}