diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c18098..6476729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * Fix basepoint for Ed448 +* Enable 64-bit Curve25519 implementation + ## 0.15 * Fix serialization of DH and ECDH diff --git a/cbits/curve25519/curve25519-donna-c64.c b/cbits/curve25519/curve25519-donna-c64.c index 9ebd8a1..adcf57c 100644 --- a/cbits/curve25519/curve25519-donna-c64.c +++ b/cbits/curve25519/curve25519-donna-c64.c @@ -427,10 +427,8 @@ crecip(felem out, const felem z) { /* 2^255 - 21 */ fmul(out, t0, a); } -int curve25519_donna(u8 *, const u8 *, const u8 *); - int -curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint) { +cryptonite_curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint) { limb bp[5], x[5], z[5], zmone[5]; uint8_t e[32]; int i; diff --git a/cryptonite.cabal b/cryptonite.cabal index 0b03d6c..1cb1c10 100644 --- a/cryptonite.cabal +++ b/cryptonite.cabal @@ -199,7 +199,6 @@ Library , cbits/cryptonite_salsa.c , cbits/cryptonite_rc4.c , cbits/cryptonite_cpu.c - , cbits/curve25519/curve25519-donna.c , cbits/ed25519/ed25519.c , cbits/ed448/x448.c , cbits/p256/p256.c @@ -225,6 +224,11 @@ Library , cbits/cryptonite_scrypt.c include-dirs: cbits cbits/ed25519 + if arch(x86_64) + C-sources: cbits/curve25519/curve25519-donna-c64.c + else + C-sources: cbits/curve25519/curve25519-donna.c + -- FIXME armel or mispel is also little endian. -- might be a good idea to also add a runtime autodetect mode. -- ARCH_ENDIAN_UNKNOWN