summaryrefslogtreecommitdiffstats
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:25:22 +0100
commit7928ee4d685b727619555bc1ec0aee805f6fc8c4 (patch)
tree7ba9d28deca810b348757d36b12d0036d363ef68
parentf1429b85c5821e55224e5878da9d0fa420a41f71 (diff)
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)
-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 fe021904cc..204e5a7a42 100644
--- a/crypto/dh/dh_key.c
+++ b/crypto/dh/dh_key.c
@@ -159,6 +159,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);