1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-11-21 12:40:51 +03:00

Move test hook setup and teardown to helpers.c

Setup and teardown test hooks during full test platform setup.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann
2023-12-14 14:17:04 +00:00
parent a7cde5d296
commit b489257a0b
2 changed files with 12 additions and 2 deletions

View File

@@ -13,6 +13,10 @@
#include <test/psa_crypto_helpers.h>
#endif
#if defined(MBEDTLS_TEST_HOOKS)
#include <test/psa_memory_poisoning_wrappers.h>
#endif
/*----------------------------------------------------------------------------*/
/* Static global variables */
@@ -29,6 +33,10 @@ int mbedtls_test_platform_setup(void)
{
int ret = 0;
#if defined(MBEDTLS_TEST_HOOKS) && defined(MBEDTLS_TEST_MEMORY_CAN_POISON)
mbedtls_poison_test_hooks_setup();
#endif
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
/* Make sure that injected entropy is present. Otherwise
* psa_crypto_init() will fail. This is not necessary for test suites
@@ -49,6 +57,10 @@ int mbedtls_test_platform_setup(void)
void mbedtls_test_platform_teardown(void)
{
#if defined(MBEDTLS_TEST_HOOKS) && defined(MBEDTLS_TEST_MEMORY_CAN_POISON)
mbedtls_poison_test_hooks_teardown();
#endif
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_teardown(&platform_ctx);
#endif /* MBEDTLS_PLATFORM_C */