From: Peiwei Hu Date: Tue, 24 May 2022 15:40:12 +0000 (+0800) Subject: Fix the check of evp_pkey_ctx_set_params_strict X-Git-Tag: openssl-3.2.0-alpha1~2589 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00d5193b688019a85d1bd0196f2837a4476394bb;p=thirdparty%2Fopenssl.git Fix the check of evp_pkey_ctx_set_params_strict Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18399) --- diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 7eee218f8a7..9588a759649 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -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);