1 /** Helper functions for memory poisoning in tests. 2 */ 3 /* 4 * Copyright The Mbed TLS Contributors 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 6 */ 7 #include "test/memory.h" 8 9 #include "psa_crypto_invasive.h" 10 11 #if defined(MBEDTLS_TEST_HOOKS) && defined(MBEDTLS_PSA_CRYPTO_C) \ 12 && defined(MBEDTLS_TEST_MEMORY_CAN_POISON) 13 mbedtls_poison_test_hooks_setup(void)14void mbedtls_poison_test_hooks_setup(void) 15 { 16 psa_input_pre_copy_hook = mbedtls_test_memory_unpoison; 17 psa_input_post_copy_hook = mbedtls_test_memory_poison; 18 psa_output_pre_copy_hook = mbedtls_test_memory_unpoison; 19 psa_output_post_copy_hook = mbedtls_test_memory_poison; 20 } 21 mbedtls_poison_test_hooks_teardown(void)22void mbedtls_poison_test_hooks_teardown(void) 23 { 24 psa_input_pre_copy_hook = NULL; 25 psa_input_post_copy_hook = NULL; 26 psa_output_pre_copy_hook = NULL; 27 psa_output_post_copy_hook = NULL; 28 } 29 30 #endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_PSA_CRYPTO_C && 31 MBEDTLS_TEST_MEMORY_CAN_POISON */ 32