summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2018-07-06 13:16:40 +0200
committerAndy Polyakov <appro@openssl.org>2018-07-12 15:08:16 +0200
commitcc1fef6308ec6cb8ba6c00b20e4a8014d7847db2 (patch)
tree3cf9bfeac60531c614b8bbf29c975509c10b9d64
parentdcb8333087d56eef97c482aabb506b8be8299cde (diff)
bn/bn_lib.c: remove bn_check_top from bn_expand2.
Trouble is that addition is postponing expansion till carry is calculated, and if addition carries, top word can be zero, which triggers assertion in bn_check_top. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: David Benjamin <davidben@google.com> (Merged from https://github.com/openssl/openssl/pull/6662) (cherry picked from commit e42395e637c3507b80b25c7ed63236898822d2f1)
-rw-r--r--crypto/bn/bn_lib.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index c59bdb7c9e..8fa9f2f09f 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -222,8 +222,6 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
const BN_ULONG *B;
int i;
- bn_check_top(b);
-
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
@@ -298,8 +296,6 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
BIGNUM *bn_expand2(BIGNUM *b, int words)
{
- bn_check_top(b);
-
if (words > b->dmax) {
BN_ULONG *a = bn_expand_internal(b, words);
if (!a)
@@ -312,7 +308,6 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
b->dmax = words;
}
- bn_check_top(b);
return b;
}