summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_x931p.c
diff options
context:
space:
mode:
authorAgustin Gianni <agustingianni@gmail.com>2021-01-08 16:04:05 +0100
committerTomas Mraz <tmraz@fedoraproject.org>2021-01-13 10:35:27 +0100
commit48116c2d0fbb1db875e2bc703c08089bf3c5c5c3 (patch)
treeb9e4c9474bb26c9f32db06c3ffbf5ae6164b0f29 /crypto/bn/bn_x931p.c
parent1dccccf33351a732dac3c700b2de05d34f708e33 (diff)
Fix incorrect use of BN_CTX API
In some edge cases BN_CTX_end was being called without first calling BN_CTX_start. This creates a situation where the state of the big number allocator is corrupted and may lead to crashes. Fixes #13812 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13813)
Diffstat (limited to 'crypto/bn/bn_x931p.c')
-rw-r--r--crypto/bn/bn_x931p.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bn/bn_x931p.c b/crypto/bn/bn_x931p.c
index 1e4d4991b2..bca7c9788e 100644
--- a/crypto/bn/bn_x931p.c
+++ b/crypto/bn/bn_x931p.c
@@ -174,7 +174,7 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx)
* exceeded.
*/
if (!BN_priv_rand_ex(Xp, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY, ctx))
- goto err;
+ return 0;
BN_CTX_start(ctx);
t = BN_CTX_get(ctx);