Skip to content

Commit

Permalink
check a for 0 in Legendre
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Dec 10, 2019
1 parent 7417867 commit d7b8192
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libi2pd/Elligator.cpp
Expand Up @@ -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))
Expand Down

0 comments on commit d7b8192

Please sign in to comment.