summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2012-03-30 17:41:00 +0000
committerAndy Polyakov <appro@openssl.org>2012-03-30 17:41:00 +0000
commit265863c6a45273ad175f59b160aba8f5f3475458 (patch)
tree850a92914d0709dae71894bb30922f67a161769b /crypto/bn
parent2fee1e06661e26518fab28b1745f5556c2b80f67 (diff)
bn/bn_gf2m.c: make new BN_GF2m_mod_inv work with BN_DEBUG_RAND [from HEAD].
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_gf2m.c7
1 files changed, 5 insertions, 2 deletions
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);