Fix the check of evp_pkey_ctx_set_params_strict

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18399)
This commit is contained in:
Peiwei Hu 2022-05-24 23:40:12 +08:00 committed by Tomas Mraz
parent 7263a7fc3d
commit 00d5193b68

View File

@ -1084,6 +1084,7 @@ int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md)
int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label, int llen)
{
OSSL_PARAM rsa_params[2], *p = rsa_params;
int ret;
if (ctx == NULL || !EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx)) {
ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
@ -1100,8 +1101,9 @@ int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label, int llen)
(void *)label, (size_t)llen);
*p++ = OSSL_PARAM_construct_end();
if (!evp_pkey_ctx_set_params_strict(ctx, rsa_params))
return 0;
ret = evp_pkey_ctx_set_params_strict(ctx, rsa_params);
if (ret <= 0)
return ret;
/* Ownership is supposed to be transferred to the callee. */
OPENSSL_free(label);