From 0510f79265bf18fea5f13c1391a12397339db8b7 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Tue, 29 Nov 2022 12:22:24 +0100 Subject: [PATCH] ossl_kdf_ctx_create(): Check for NULL KDF being fetched Reviewed-by: Matt Caswell Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/19784) --- crypto/hpke/hpke_util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crypto/hpke/hpke_util.c b/crypto/hpke/hpke_util.c index e2d28bbb58d..0db5f9ce2f9 100644 --- a/crypto/hpke/hpke_util.c +++ b/crypto/hpke/hpke_util.c @@ -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) { -- 2.47.3