summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-09-14 13:27:59 +0100
committerMatt Caswell <matt@openssl.org>2016-09-21 13:35:11 +0100
commitd0cbaa2f3a36a3359ee979f0262f0ff514630509 (patch)
tree597d4f8b5f8cdd62e4c74058481d2b777ff50318 /crypto
parenta5e55f62975c0f978eb348763a1de0cd923f0d77 (diff)
downloadopenssl-new-d0cbaa2f3a36a3359ee979f0262f0ff514630509.tar.gz
Fix a missing NULL check in dsa_builtin_paramgen
We should check the last BN_CTX_get() call to ensure that it isn't NULL before we try and use any of the allocated BIGNUMs. Issue reported by Shi Lei. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 1ff7425d6130380bb00d3e64739633a4b21b11a3)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/dsa/dsa_gen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c
index f6de68488c..1fce0f81c2 100644
--- a/crypto/dsa/dsa_gen.c
+++ b/crypto/dsa/dsa_gen.c
@@ -185,6 +185,9 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
p = BN_CTX_get(ctx);
test = BN_CTX_get(ctx);
+ if (test == NULL)
+ goto err;
+
if (!BN_lshift(test, BN_value_one(), bits - 1))
goto err;