Submitted by: emmanuel.azencot@bull.net
Reviewed by: steve

Prevent infinite loop in BN_GF2m_mod_inv().
This commit is contained in:
Dr. Stephen Henson 2011-06-22 15:24:05 +00:00
parent b507284c7e
commit 8038e7e44c

View File

@ -548,6 +548,7 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
{ {
while (!BN_is_odd(u)) while (!BN_is_odd(u))
{ {
if (BN_is_zero(u)) goto err;
if (!BN_rshift1(u, u)) goto err; if (!BN_rshift1(u, u)) goto err;
if (BN_is_odd(b)) if (BN_is_odd(b))
{ {