From 4a23edd5fbe2a92d279dc2e4a0209434e9bbf064 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 30 Dec 2022 06:31:09 -0800 Subject: [PATCH] fix for older selftest that returns bad padding instead of salt len error --- wolfcrypt/test/test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index eaa4ea2c12..9832a05c97 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -14833,15 +14833,19 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key) (!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2)) ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, plain, plainSz, hash[0], len); + if (ret != PSS_SALTLEN_E) + ERROR_OUT(-7745, exit_rsa_pss); #elif defined(HAVE_SELFTEST) && (HAVE_SELFTEST_VERSION == 2) ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, plain, plainSz, hash[0], len, 0); + if (ret != BAD_PADDING_E) + ERROR_OUT(-7745, exit_rsa_pss); #else ret = wc_RsaPSS_CheckPadding_ex2(digest, digestSz, plain, plainSz, hash[0], len, 0, HEAP_HINT); -#endif if (ret != PSS_SALTLEN_E) ERROR_OUT(-7745, exit_rsa_pss); +#endif ret = 0; #endif /* WOLFSSL_SE050 */