bn/bn_gf2m.c: make new BN_GF2m_mod_inv work with BN_DEBUG_RAND [from HEAD].

This commit is contained in:
Andy Polyakov 2012-03-30 17:40:52 +00:00
parent 418044cbab
commit 0a5575f3f6

View file

@ -628,8 +628,11 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
} }
if (ubits==vbits) if (ubits==vbits)
{ {
bn_correct_top(u); BN_ULONG ul;
ubits = BN_num_bits(u); int utop = (ubits-1)/BN_BITS2;
while ((ul=udp[utop])==0 && utop) utop--;
ubits = utop*BN_BITS2 + BN_num_bits_word(ul);
} }
} }
bn_correct_top(b); bn_correct_top(b);