]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ossl_kdf_ctx_create(): Check for NULL KDF being fetched
authorTomas Mraz <tomas@openssl.org>
Tue, 29 Nov 2022 11:22:24 +0000 (12:22 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 5 Dec 2022 10:34:42 +0000 (11:34 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/19784)

crypto/hpke/hpke_util.c

index e2d28bbb58d2edca25e9853d490ea47eac95b455..0db5f9ce2f9272b77944ca54be0ae47d2a337e1f 100644 (file)
@@ -393,6 +393,10 @@ EVP_KDF_CTX *ossl_kdf_ctx_create(const char *kdfname, const char *mdname,
     EVP_KDF_CTX *kctx = NULL;
 
     kdf = EVP_KDF_fetch(libctx, kdfname, propq);
+    if (kdf == NULL) {
+        ERR_raise(ERR_LIB_CRYPTO, ERR_R_FETCH_FAILED);
+        return NULL;
+    }
     kctx = EVP_KDF_CTX_new(kdf);
     EVP_KDF_free(kdf);
     if (kctx != NULL && mdname != NULL) {