projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT2210: Add missing EVP_cleanup to example
[oweals/openssl.git]
/
crypto
/
bn
/
bn_gf2m.c
diff --git
a/crypto/bn/bn_gf2m.c
b/crypto/bn/bn_gf2m.c
index 2cd93ddc76cf3bdadccd5640606fa5ceb6f82ba0..b2222a06c93f868ce8b1da6f90e170c59cf997af 100644
(file)
--- a/
crypto/bn/bn_gf2m.c
+++ b/
crypto/bn/bn_gf2m.c
@@
-525,7
+525,7
@@
err:
*/
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
{
*/
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
{
- BIGNUM *b, *c
, *u, *v
, *tmp;
+ BIGNUM *b, *c
= NULL, *u = NULL, *v = NULL
, *tmp;
int ret = 0;
bn_check_top(a);
int ret = 0;
bn_check_top(a);
@@
-631,8
+631,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);
- 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);
}
}
bn_correct_top(b);
@@
-646,6
+649,8
@@
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
err:
#ifdef BN_DEBUG /* BN_CTX_end would complain about the expanded form */
bn_correct_top(c);
err:
#ifdef BN_DEBUG /* BN_CTX_end would complain about the expanded form */
bn_correct_top(c);
+ bn_correct_top(u);
+ bn_correct_top(v);
#endif
BN_CTX_end(ctx);
return ret;
#endif
BN_CTX_end(ctx);
return ret;