rsa_cms_verify: Avoid negative return with missing pss parameters
authorTomas Mraz <tomas@openssl.org>
Fri, 2 Jul 2021 13:29:13 +0000 (15:29 +0200)
committerPauli <pauli@openssl.org>
Tue, 6 Jul 2021 00:08:08 +0000 (10:08 +1000)
Fixes #15984

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15985)

crypto/cms/cms_rsa.c

index b9e895aed4f0b4d8e76a4a7886d7d2ed0d2aa9cf..20ed8169183a745827727c3a069944b2de0a2af9 100644 (file)
@@ -222,7 +222,7 @@ static int rsa_cms_verify(CMS_SignerInfo *si)
     CMS_SignerInfo_get0_algs(si, NULL, NULL, NULL, &alg);
     nid = OBJ_obj2nid(alg->algorithm);
     if (nid == EVP_PKEY_RSA_PSS)
-        return ossl_rsa_pss_to_ctx(NULL, pkctx, alg, NULL);
+        return ossl_rsa_pss_to_ctx(NULL, pkctx, alg, NULL) > 0;
     /* Only PSS allowed for PSS keys */
     if (EVP_PKEY_is_a(pkey, "RSA-PSS")) {
         ERR_raise(ERR_LIB_RSA, RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE);