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 | 9a21a03d6871292dce9115fac715b9fe85734cf7 (patch) | |
tree | c9c9384a606736ae23854d3af8fb0a8faeb1091e | |
parent | 34ed38dac79bbd8a80fd73857d045504e25081bb (diff) |
curve25519: 128-bit integer != x86_64
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-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); } |