summaryrefslogtreecommitdiffstats
path: root/crypto/evp/kem.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-10-01 15:02:15 +0200
committerRichard Levitte <levitte@openssl.org>2021-10-27 12:41:14 +0200
commit433e13455ede1a39d415b690b8a564b4f36b8dee (patch)
treeee74701f159af44158cbe6ab466133438febec55 /crypto/evp/kem.c
parent839ffdd11cd48d329a1d89565d62e0be082f9d08 (diff)
EVP: For all operations that use an EVP_PKEY, check that there is one
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16725)
Diffstat (limited to 'crypto/evp/kem.c')
-rw-r--r--crypto/evp/kem.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/evp/kem.c b/crypto/evp/kem.c
index d5bdc6290a..6ba598eb98 100644
--- a/crypto/evp/kem.c
+++ b/crypto/evp/kem.c
@@ -36,6 +36,11 @@ static int evp_kem_init(EVP_PKEY_CTX *ctx, int operation,
evp_pkey_ctx_free_old_ops(ctx);
ctx->operation = operation;
+ if (ctx->pkey == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_SET);
+ goto err;
+ }
+
/*
* Try to derive the supported kem from |ctx->keymgmt|.
*/