Remove _Thread_local variable for 2.28

We do not intend to support multithreaded testing in 2.28, so
introducing a C11 feature here is an unnecessary burden.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2024-01-23 15:35:20 +00:00
parent e7bfbc27bf
commit 7dfb6121fc
2 changed files with 6 additions and 9 deletions

View File

@ -21,12 +21,9 @@
* memory as poisoned, which can be used to enforce some memory access * memory as poisoned, which can be used to enforce some memory access
* policies. * policies.
* *
* Support for the C11 thread_local keyword is also required.
*
* Currently, only Asan (Address Sanitizer) is supported. * Currently, only Asan (Address Sanitizer) is supported.
*/ */
#if defined(MBEDTLS_TEST_HAVE_ASAN) && \ #if defined(MBEDTLS_TEST_HAVE_ASAN)
(__STDC_VERSION__ >= 201112L)
# define MBEDTLS_TEST_MEMORY_CAN_POISON # define MBEDTLS_TEST_MEMORY_CAN_POISON
#endif #endif
@ -64,11 +61,11 @@
#if defined(MBEDTLS_TEST_MEMORY_CAN_POISON) #if defined(MBEDTLS_TEST_MEMORY_CAN_POISON)
/** Thread-local variable used to enable memory poisoning. This is set and /** Variable used to enable memory poisoning. This is set and unset in the
* unset in the test wrappers so that calls to PSA functions from the library * test wrappers so that calls to PSA functions from the library do not
* do not poison memory. * poison memory.
*/ */
extern _Thread_local unsigned int mbedtls_test_memory_poisoning_count; extern unsigned int mbedtls_test_memory_poisoning_count;
/** Poison a memory area so that any attempt to read or write from it will /** Poison a memory area so that any attempt to read or write from it will
* cause a runtime failure. * cause a runtime failure.

View File

@ -20,7 +20,7 @@
#if defined(MBEDTLS_TEST_MEMORY_CAN_POISON) #if defined(MBEDTLS_TEST_MEMORY_CAN_POISON)
_Thread_local unsigned int mbedtls_test_memory_poisoning_count = 0; unsigned int mbedtls_test_memory_poisoning_count = 0;
static void align_for_asan(const unsigned char **p_ptr, size_t *p_size) static void align_for_asan(const unsigned char **p_ptr, size_t *p_size)
{ {