From 9012ba11a920a2ce16efa09d97b8d6cd1e98826d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 20 Mar 2017 23:50:24 +0100 Subject: curve25519: 128-bit integer != x86_64 --- src/crypto/curve25519.c | 10 ++++++++-- 1 file 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); } -- cgit v1.2.3-59-g8ed1b