Remove the manually written poisoning wrapper

This fixes the build with ASan + MBEDTLS_TEST_HOOKS.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2024-01-04 17:11:54 +01:00
parent 90d14d7fc2
commit 8e7960b685
2 changed files with 5 additions and 34 deletions

View File

@ -1,8 +1,11 @@
/** Memory poisoning wrappers for PSA functions.
/** Support for memory poisoning wrappers for PSA functions.
*
* These wrappers poison the input and output buffers of each function
* The wrappers poison the input and output buffers of each function
* before calling it, to ensure that it does not access the buffers
* except by calling the approved buffer-copying functions.
*
* This header declares support functions. The wrappers themselves are
* decalred in the automatically generated file `test/psa_test_wrappers.h`.
*/
/*
* Copyright The Mbed TLS Contributors
@ -32,16 +35,6 @@ void mbedtls_poison_test_hooks_setup(void);
*/
void mbedtls_poison_test_hooks_teardown(void);
psa_status_t wrap_psa_cipher_encrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
const uint8_t *input,
size_t input_length,
uint8_t *output,
size_t output_size,
size_t *output_length);
#define psa_cipher_encrypt(...) wrap_psa_cipher_encrypt(__VA_ARGS__)
#endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_TEST_MEMORY_CAN_POISON */
#endif /* PSA_MEMORY_POISONING_WRAPPERS_H */

View File

@ -27,27 +27,5 @@ void mbedtls_poison_test_hooks_teardown(void)
psa_output_post_copy_hook = NULL;
}
psa_status_t wrap_psa_cipher_encrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
const uint8_t *input,
size_t input_length,
uint8_t *output,
size_t output_size,
size_t *output_length)
{
MBEDTLS_TEST_MEMORY_POISON(input, input_length);
MBEDTLS_TEST_MEMORY_POISON(output, output_size);
psa_status_t status = psa_cipher_encrypt(key,
alg,
input,
input_length,
output,
output_size,
output_length);
MBEDTLS_TEST_MEMORY_UNPOISON(input, input_length);
MBEDTLS_TEST_MEMORY_UNPOISON(output, output_size);
return status;
}
#endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_PSA_CRYPTO_C &&
MBEDTLS_TEST_MEMORY_CAN_POISON */