mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-28 20:59:57 +01:00
Merge pull request #9497 from douzzer/20251206-old-fips-test_wc_RsaPublicEncryptDecrypt
20251206-old-fips-test_wc_RsaPublicEncryptDecrypt
This commit is contained in:
@@ -785,18 +785,15 @@ int test_wc_RsaPublicEncryptDecrypt(void)
|
||||
WC_DECLARE_VAR(in, byte, TEST_STRING_SZ, NULL);
|
||||
WC_DECLARE_VAR(plain, byte, TEST_STRING_SZ, NULL);
|
||||
WC_DECLARE_VAR(cipher, byte, TEST_RSA_BYTES, NULL);
|
||||
WC_DECLARE_VAR(shortPlain, byte, TEST_STRING_SZ - 4, NULL);
|
||||
|
||||
WC_ALLOC_VAR(in, byte, TEST_STRING_SZ, NULL);
|
||||
WC_ALLOC_VAR(plain, byte, TEST_STRING_SZ, NULL);
|
||||
WC_ALLOC_VAR(cipher, byte, TEST_RSA_BYTES, NULL);
|
||||
WC_ALLOC_VAR(shortPlain, byte, TEST_STRING_SZ - 4, NULL);
|
||||
|
||||
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
|
||||
ExpectNotNull(in);
|
||||
ExpectNotNull(plain);
|
||||
ExpectNotNull(cipher);
|
||||
ExpectNotNull(shortPlain);
|
||||
#endif
|
||||
ExpectNotNull(XMEMCPY(in, inStr, inLen));
|
||||
|
||||
@@ -823,11 +820,20 @@ int test_wc_RsaPublicEncryptDecrypt(void)
|
||||
ExpectIntEQ(XMEMCMP(plain, inStr, plainLen), 0);
|
||||
/* Pass bad args - tested in another testing function.*/
|
||||
|
||||
/* Test for when plain length is less than required. */
|
||||
ExpectIntEQ(wc_RsaPrivateDecrypt(cipher, cipherLenResult, shortPlain,
|
||||
TEST_STRING_SZ - 4, &key), RSA_BUFFER_E);
|
||||
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0))
|
||||
{
|
||||
WC_DECLARE_VAR(shortPlain, byte, TEST_STRING_SZ - 4, NULL);
|
||||
WC_ALLOC_VAR(shortPlain, byte, TEST_STRING_SZ - 4, NULL);
|
||||
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
|
||||
ExpectNotNull(shortPlain);
|
||||
#endif
|
||||
/* Test for when plain length is less than required. */
|
||||
ExpectIntEQ(wc_RsaPrivateDecrypt(cipher, cipherLenResult, shortPlain,
|
||||
TEST_STRING_SZ - 4, &key), RSA_BUFFER_E);
|
||||
WC_FREE_VAR(shortPlain, NULL);
|
||||
}
|
||||
#endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
|
||||
|
||||
WC_FREE_VAR(shortPlain, NULL);
|
||||
WC_FREE_VAR(in, NULL);
|
||||
WC_FREE_VAR(plain, NULL);
|
||||
WC_FREE_VAR(cipher, NULL);
|
||||
|
||||
Reference in New Issue
Block a user