mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00: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:
parent
a7cde5d296
commit
b489257a0b
@ -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 */
|
||||
|
@ -34,7 +34,6 @@ psa_status_t wrap_psa_cipher_encrypt(mbedtls_svc_key_id_t key,
|
||||
size_t output_size,
|
||||
size_t *output_length)
|
||||
{
|
||||
mbedtls_poison_test_hooks_setup();
|
||||
MBEDTLS_TEST_MEMORY_POISON(input, input_length);
|
||||
MBEDTLS_TEST_MEMORY_POISON(output, output_size);
|
||||
psa_status_t status = psa_cipher_encrypt(key,
|
||||
@ -46,7 +45,6 @@ psa_status_t wrap_psa_cipher_encrypt(mbedtls_svc_key_id_t key,
|
||||
output_length);
|
||||
MBEDTLS_TEST_MEMORY_UNPOISON(input, input_length);
|
||||
MBEDTLS_TEST_MEMORY_UNPOISON(output, output_size);
|
||||
mbedtls_poison_test_hooks_teardown();
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user