Don't declare WC_ALLOC_DO_ON_FAILURE by default

This commit is contained in:
Juliusz Sosinowicz
2026-03-06 10:15:48 +01:00
parent 80938758ac
commit 5f4d499df0
5 changed files with 15 additions and 7 deletions
+2
View File
@@ -34,6 +34,8 @@
#include <tests/api/api.h>
#include <tests/api/test_aes.h>
#define WC_ALLOC_DO_ON_FAILURE() WC_DO_NOTHING
/*******************************************************************************
* AES
******************************************************************************/
+9 -4
View File
@@ -334,8 +334,10 @@ int test_wc_Chacha_Process_Chunking(void)
0x0c, 0xb3, 0xc9, 0x39, 0x0f, 0x1f, 0x51, 0x9d
};
WC_ALLOC_VAR(plain, byte, CHACHA_LEN, NULL);
WC_ALLOC_VAR(cipher, byte, CHACHA_LEN, NULL);
WC_ALLOC_VAR_EX(plain, byte, CHACHA_LEN, NULL, DYNAMIC_TYPE_TMP_BUFFER,
ExpectNotNull(plain); goto cleanup);
WC_ALLOC_VAR_EX(cipher, byte, CHACHA_LEN, NULL, DYNAMIC_TYPE_TMP_BUFFER,
ExpectNotNull(cipher); goto cleanup);
XMEMSET(plain, 0xa5, CHACHA_LEN);
for (i = 0; i < (int)sizeof(key); i++) {
@@ -360,8 +362,11 @@ int test_wc_Chacha_Process_Chunking(void)
ExpectBufEQ(cipher, expected, (int)sizeof(expected));
}
WC_FREE_VAR(plain, NULL);
WC_FREE_VAR(cipher, NULL);
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
cleanup:
#endif
WC_FREE_VAR_EX(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
WC_FREE_VAR_EX(cipher, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
return EXPECT_RESULT();
} /* END test_wc_Chacha_Process */
+2
View File
@@ -33,6 +33,8 @@
#include <tests/api/api.h>
#include <tests/api/test_rsa.h>
#define WC_ALLOC_DO_ON_FAILURE() WC_DO_NOTHING
/*
* Testing wc_Init RsaKey()
*/
+2
View File
@@ -1872,6 +1872,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t nist_sp80056c_twostep_cmac(void)
}
#endif
#define WC_ALLOC_DO_ON_FAILURE() WC_DO_NOTHING
#ifdef TEST_ALWAYS_RUN_TO_END
#define TEST_FAIL(msg, retval) do { last_failed_test_ret = (retval); wc_test_render_error_message(msg, retval); } while (0)
#elif !defined(TEST_FAIL)
-3
View File
@@ -808,9 +808,6 @@ enum {
#include <wolfssl/wolfcrypt/memory.h>
/* declare/free variable handling for async and smallstack */
#ifndef WC_ALLOC_DO_ON_FAILURE
#define WC_ALLOC_DO_ON_FAILURE() WC_DO_NOTHING
#endif
#define WC_DECLARE_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \
VAR_TYPE* VAR_NAME[VAR_ITEMS] = { NULL, }; \