mirror of
https://github.com/openssl/openssl.git
synced 2024-12-15 06:01:37 +08:00
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)
This commit is contained in:
parent
839ffdd11c
commit
433e13455e
@ -41,6 +41,12 @@ static int evp_pkey_asym_cipher_init(EVP_PKEY_CTX *ctx, int operation,
|
||||
if (evp_pkey_ctx_is_legacy(ctx))
|
||||
goto legacy;
|
||||
|
||||
if (ctx->pkey == NULL) {
|
||||
ERR_clear_last_mark();
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_SET);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to derive the supported asym cipher from |ctx->keymgmt|.
|
||||
*/
|
||||
|
@ -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|.
|
||||
*/
|
||||
|
@ -81,6 +81,12 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
if (evp_pkey_ctx_is_legacy(locpctx))
|
||||
goto legacy;
|
||||
|
||||
if (locpctx->pkey == NULL) {
|
||||
ERR_clear_last_mark();
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_SET);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to derive the supported signature from |locpctx->keymgmt|.
|
||||
*/
|
||||
|
@ -414,6 +414,12 @@ static int evp_pkey_signature_init(EVP_PKEY_CTX *ctx, int operation,
|
||||
if (evp_pkey_ctx_is_legacy(ctx))
|
||||
goto legacy;
|
||||
|
||||
if (ctx->pkey == NULL) {
|
||||
ERR_clear_last_mark();
|
||||
ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_SET);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to derive the supported signature from |ctx->keymgmt|.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user