]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix null pointer check in pkey_dh_derive to ensure both keys are set
authorritoban23 <ankudutt101@gmail.com>
Wed, 13 Aug 2025 20:19:17 +0000 (01:49 +0530)
committerTodd Short <todd.short@me.com>
Fri, 22 Aug 2025 15:21:38 +0000 (11:21 -0400)
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/28259)

crypto/dh/dh_pmeth.c

index 0d9bb0dcb9ad1e384b3d0b0059e8bebc7f65dd5b..937a6bd045946fae65dab6bfbaaf29a43370a2a0 100644 (file)
@@ -408,7 +408,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
     }
     dh = (DH *)EVP_PKEY_get0_DH(ctx->pkey);
     dhpub = EVP_PKEY_get0_DH(ctx->peerkey);
-    if (dhpub == NULL) {
+    if (dhpub == NULL || dh == NULL) {
         ERR_raise(ERR_LIB_DH, DH_R_KEYS_NOT_SET);
         return 0;
     }