]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix the check of evp_pkey_ctx_set_params_strict
authorPeiwei Hu <jlu.hpw@foxmail.com>
Tue, 24 May 2022 15:40:12 +0000 (23:40 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 2 Jun 2022 09:06:41 +0000 (11:06 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18399)

crypto/rsa/rsa_lib.c

index 7eee218f8a776035c1e9d855ab1707ccbe01c1da..9588a7596491f90e9aeb91913ec5d6c45ba2fa46 100644 (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);