Browse Source

check a for 0 in Legendre

pull/1491/head
orignal 5 years ago
parent
commit
d7b819267f
  1. 3
      libi2pd/Elligator.cpp

3
libi2pd/Elligator.cpp

@ -160,7 +160,8 @@ namespace crypto @@ -160,7 +160,8 @@ namespace crypto
int Elligator2::Legendre (const BIGNUM * a, BN_CTX * ctx) const
{
// assume a < p, so don't check for a % p = 0
// assume a < p, so don't check for a % p = 0, but a = 0 only
if (BN_is_zero(a)) return 0;
BIGNUM * r = BN_CTX_get (ctx);
BN_mod_exp (r, a, p12, p, ctx); // r = a^((p-1)/2) mod p
if (BN_is_word(r, 1))

Loading…
Cancel
Save