summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_gf2m.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2012-03-29 21:35:28 +0000
committerAndy Polyakov <appro@openssl.org>2012-03-29 21:35:28 +0000
commit4736eab947b470a5b6522da2c8f6bf485e363e52 (patch)
tree38eb68a526a21079aff338a6f27e7542ca8d852e /crypto/bn/bn_gf2m.c
parent23a05fa0c146b99731b0e83f3928066536c4b1e0 (diff)
bn/bn_gf2m.c: make new BN_GF2m_mod_inv work with BN_DEBUG_RAND.
Diffstat (limited to 'crypto/bn/bn_gf2m.c')
-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 0bfb56971e..e54a701166 100644
--- a/crypto/bn/bn_gf2m.c
+++ b/crypto/bn/bn_gf2m.c
@@ -631,8 +631,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 u;
+ int utop = (ubits-1)/BN_BITS2;
+
+ while ((u=udp[utop])==0 && utop) utop--;
+ ubits = utop*BN_BITS2 + BN_num_bits_word(u);
}
}
bn_correct_top(b);