quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

psa_memory_poisoning_wrappers.c (974B)


      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 #include <test/psa_memory_poisoning_wrappers.h>
      9 
     10 #include "psa_crypto_invasive.h"
     11 
     12 #if defined(MBEDTLS_TEST_HOOKS)  && defined(MBEDTLS_PSA_CRYPTO_C) \
     13     && defined(MBEDTLS_TEST_MEMORY_CAN_POISON)
     14 
     15 void mbedtls_poison_test_hooks_setup(void)
     16 {
     17     psa_input_pre_copy_hook = mbedtls_test_memory_unpoison;
     18     psa_input_post_copy_hook = mbedtls_test_memory_poison;
     19     psa_output_pre_copy_hook = mbedtls_test_memory_unpoison;
     20     psa_output_post_copy_hook = mbedtls_test_memory_poison;
     21 }
     22 
     23 void mbedtls_poison_test_hooks_teardown(void)
     24 {
     25     psa_input_pre_copy_hook = NULL;
     26     psa_input_post_copy_hook = NULL;
     27     psa_output_pre_copy_hook = NULL;
     28     psa_output_post_copy_hook = NULL;
     29 }
     30 
     31 #endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_PSA_CRYPTO_C &&
     32           MBEDTLS_TEST_MEMORY_CAN_POISON */