diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-03-20 23:50:24 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-03-24 04:44:22 +0100 |
commit | 9012ba11a920a2ce16efa09d97b8d6cd1e98826d (patch) | |
tree | 32ac7d249841095f8b1d487f4bb14bfbe511ce95 /src | |
parent | version: bump snapshot (diff) | |
download | wireguard-monolithic-historical-9012ba11a920a2ce16efa09d97b8d6cd1e98826d.tar.xz wireguard-monolithic-historical-9012ba11a920a2ce16efa09d97b8d6cd1e98826d.zip |
curve25519: 128-bit integer != x86_64
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/curve25519.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/crypto/curve25519.c b/src/crypto/curve25519.c index d9cdd8d..5412b64 100644 --- a/src/crypto/curve25519.c +++ b/src/crypto/curve25519.c @@ -475,11 +475,14 @@ static void crecip(felem out, const felem z) void curve25519(u8 mypublic[CURVE25519_POINT_SIZE], const u8 secret[CURVE25519_POINT_SIZE], const u8 basepoint[CURVE25519_POINT_SIZE]) { +#ifdef CONFIG_X86_64 if (curve25519_use_avx && irq_fpu_usable()) { kernel_fpu_begin(); curve25519_sandy2x(mypublic, secret, basepoint); kernel_fpu_end(); - } else { + } else +#endif + { limb bp[5], x[5], z[5], zmone[5]; u8 e[32]; @@ -502,11 +505,14 @@ void curve25519(u8 mypublic[CURVE25519_POINT_SIZE], const u8 secret[CURVE25519_P void curve25519_generate_public(u8 pub[CURVE25519_POINT_SIZE], const u8 secret[CURVE25519_POINT_SIZE]) { +#ifdef CONFIG_X86_64 if (curve25519_use_avx && irq_fpu_usable()) { kernel_fpu_begin(); curve25519_sandy2x_base(pub, secret); kernel_fpu_end(); - } else { + } else +#endif + { static const u8 basepoint[CURVE25519_POINT_SIZE] = { 9 }; curve25519(pub, secret, basepoint); } |