aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2008-06-23 20:46:24 +0000
committerBodo Möller <bodo@openssl.org>2008-06-23 20:46:24 +0000
commit8228fd89fc63ea766529075ac25628c47d4d5546 (patch)
treed722c78363efaea355a99af41fec28ce563ec18e
parent869eb9e767a4b7902e0e481c2a3f55504be48f56 (diff)
downloadopenssl-8228fd89fc63ea766529075ac25628c47d4d5546.zip
openssl-8228fd89fc63ea766529075ac25628c47d4d5546.tar.gz
openssl-8228fd89fc63ea766529075ac25628c47d4d5546.tar.bz2
avoid potential infinite loop in final reduction round of BN_GF2m_mod_arr()
Submitted by: Huang Ying Reviewed by: Douglas Stebila
-rw-r--r--CHANGES6
-rw-r--r--crypto/bn/bn_gf2m.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index b0359e5..f2e4487 100644
--- a/CHANGES
+++ b/CHANGES
@@ -702,12 +702,16 @@
Changes between 0.9.8h and 0.9.8i [xx XXX xxxx]
+ *) Fix BN_GF2m_mod_arr() top-bit cleanup code.
+ [Huang Ying]
+
*) Expand ENGINE to support engine supplied SSL client certificate functions.
This work was sponsored by Logica.
[Steve Henson]
- *) Add CryptoAPI ENGINE to support use of RSA and DSA keys held in Windows keystores. Support for SSL/TLS client authentication too.
+ *) Add CryptoAPI ENGINE to support use of RSA and DSA keys held in Windows
+ keystores. Support for SSL/TLS client authentication too.
Not compiled unless enable-capieng specified to Configure.
This work was sponsored by Logica.
diff --git a/crypto/bn/bn_gf2m.c b/crypto/bn/bn_gf2m.c
index be409e1..f7551da 100644
--- a/crypto/bn/bn_gf2m.c
+++ b/crypto/bn/bn_gf2m.c
@@ -322,7 +322,11 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
if (zz == 0) break;
d1 = BN_BITS2 - d0;
- if (d0) z[dN] = (z[dN] << d1) >> d1; /* clear up the top d1 bits */
+ /* clear up the top d1 bits */
+ if (d0)
+ z[dN] = (z[dN] << d1) >> d1;
+ else
+ z[dN] = 0;
z[0] ^= zz; /* reduction t^0 component */
for (k = 1; p[k] != 0; k++)