summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2016-12-22 13:51:27 +0100
committerRichard Levitte <levitte@openssl.org>2017-01-24 18:27:10 +0100
commit8957adda165f77589090627d6563796331c0c94b (patch)
treee110fde18cf49b2f0f7bd57ae36d29b9be8842d0
parentcb00d4ff17eae9c4e489409f5d12bff76c110be1 (diff)
downloadopenssl-new-8957adda165f77589090627d6563796331c0c94b.tar.gz
Fix error handling in compute_key, BN_CTX_get can return NULL
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2132) (cherry picked from commit 7928ee4d685b727619555bc1ec0aee805f6fc8c4)
-rw-r--r--crypto/dh/dh_key.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c
index 1d80fb2c5f..387558f146 100644
--- a/crypto/dh/dh_key.c
+++ b/crypto/dh/dh_key.c
@@ -223,6 +223,8 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
goto err;
BN_CTX_start(ctx);
tmp = BN_CTX_get(ctx);
+ if (tmp == NULL)
+ goto err;
if (dh->priv_key == NULL) {
DHerr(DH_F_COMPUTE_KEY, DH_R_NO_PRIVATE_VALUE);