summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-08-11 12:51:15 +0200
committerMatt Caswell <matt@openssl.org>2023-08-14 15:32:06 +0200
commit69b9a992961c27ac6d0f0bec259806ac953a81d4 (patch)
treebd2d6f991cf3efd0334826ba9aeba9c87a0edf53 /crypto/bn
parentMinor fixes (diff)
downloadopenssl-69b9a992961c27ac6d0f0bec259806ac953a81d4.tar.xz
openssl-69b9a992961c27ac6d0f0bec259806ac953a81d4.zip
Don't call ossl_assert on the result of bn_wexpand
bn_wexpand can fail as the result of a memory allocation failure. We should not be calling ossl_assert() on its result because it can fail in normal operation. Found via the reproducible error injection in #21668 Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/21725)
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index e810647f57..1b8d47a281 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -504,7 +504,7 @@ static BIGNUM *bin2bn(const unsigned char *s, int len, BIGNUM *ret,
return ret;
}
n = ((len - 1) / BN_BYTES) + 1; /* Number of resulting bignum chunks */
- if (!ossl_assert(bn_wexpand(ret, (int)n) != NULL)) {
+ if (bn_wexpand(ret, (int)n) == NULL) {
BN_free(bn);
return NULL;
}