X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fbn%2Fbn_gf2m.c;h=8a4dc20ad980d9b3bf9849bef739e0cedc3fcb7c;hb=265863c6a45273ad175f59b160aba8f5f3475458;hp=08ab9fd22743578607119fa53fcb45c08b97fe5b;hpb=2fee1e06661e26518fab28b1745f5556c2b80f67;p=oweals%2Fopenssl.git diff --git a/crypto/bn/bn_gf2m.c b/crypto/bn/bn_gf2m.c index 08ab9fd227..8a4dc20ad9 100644 --- a/crypto/bn/bn_gf2m.c +++ b/crypto/bn/bn_gf2m.c @@ -628,8 +628,11 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) } if (ubits==vbits) { - bn_correct_top(u); - ubits = BN_num_bits(u); + BN_ULONG ul; + 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);