Check the return from EVP_PKEY_get0_DH()
authorMatt Caswell <matt@openssl.org>
Tue, 17 Apr 2018 10:32:20 +0000 (11:32 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 18 Apr 2018 07:20:13 +0000 (08:20 +0100)
Fixes #5934

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5993)

ssl/statem/statem_srvr.c

index c7cd9eb662d444496368905542942adcfb1a7850..f216db76c60b8df19c24627280b9b12dbe50b293 100644 (file)
@@ -1698,6 +1698,12 @@ int tls_construct_server_key_exchange(SSL *s)
         }
 
         dh = EVP_PKEY_get0_DH(s->s3->tmp.pkey);
+        if (dh == NULL) {
+            al = SSL_AD_INTERNAL_ERROR;
+            SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE,
+                   ERR_R_INTERNAL_ERROR);
+            goto err;
+        }
 
         EVP_PKEY_free(pkdh);
         pkdh = NULL;