Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Threading abstraction layer |
| 3 | * |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 4 | * Copyright The Mbed TLS Contributors |
Dave Rodgman | 16799db | 2023-11-02 19:47:20 +0000 | [diff] [blame] | 5 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
Andres Amaya Garcia | e9b10b2 | 2018-09-05 11:25:30 +0100 | [diff] [blame] | 8 | /* |
Hanno Becker | 48a816f | 2018-09-05 15:22:22 +0100 | [diff] [blame] | 9 | * Ensure gmtime_r is available even with -std=c99; must be defined before |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 10 | * mbedtls_config.h, which pulls in glibc's features.h. Harmless on other platforms. |
Andres Amaya Garcia | e9b10b2 | 2018-09-05 11:25:30 +0100 | [diff] [blame] | 11 | */ |
Andres Amaya Garcia | 94b540a | 2018-09-05 12:27:32 +0100 | [diff] [blame] | 12 | #if !defined(_POSIX_C_SOURCE) |
Andres Amaya Garcia | e9b10b2 | 2018-09-05 11:25:30 +0100 | [diff] [blame] | 13 | #define _POSIX_C_SOURCE 200112L |
Andres Amaya Garcia | 94b540a | 2018-09-05 12:27:32 +0100 | [diff] [blame] | 14 | #endif |
Andres Amaya Garcia | e9b10b2 | 2018-09-05 11:25:30 +0100 | [diff] [blame] | 15 | |
Gilles Peskine | db09ef6 | 2020-06-03 01:43:33 +0200 | [diff] [blame] | 16 | #include "common.h" |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 17 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 18 | #if defined(MBEDTLS_THREADING_C) |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 19 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 20 | #include "mbedtls/threading.h" |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 21 | |
Hanno Becker | 6a73978 | 2018-09-05 15:06:19 +0100 | [diff] [blame] | 22 | #if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_PLATFORM_GMTIME_R_ALT) |
Hanno Becker | 323d801 | 2018-09-06 11:30:57 +0100 | [diff] [blame] | 23 | |
Hanno Becker | cfeb70c | 2018-09-05 13:50:22 +0100 | [diff] [blame] | 24 | #if !defined(_WIN32) && (defined(unix) || \ |
Andres Amaya Garcia | 433f911 | 2018-09-05 12:01:57 +0100 | [diff] [blame] | 25 | defined(__unix) || defined(__unix__) || (defined(__APPLE__) && \ |
| 26 | defined(__MACH__))) |
Andres Amaya Garcia | ce6eebb | 2018-08-07 20:26:55 +0100 | [diff] [blame] | 27 | #include <unistd.h> |
Hanno Becker | 323d801 | 2018-09-06 11:30:57 +0100 | [diff] [blame] | 28 | #endif /* !_WIN32 && (unix || __unix || __unix__ || |
| 29 | * (__APPLE__ && __MACH__)) */ |
| 30 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 31 | #if !((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) || \ |
| 32 | (defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ |
| 33 | _POSIX_THREAD_SAFE_FUNCTIONS >= 200112L)) |
Andres Amaya Garcia | ca04a01 | 2018-09-05 11:43:57 +0100 | [diff] [blame] | 34 | /* |
| 35 | * This is a convenience shorthand macro to avoid checking the long |
| 36 | * preprocessor conditions above. Ideally, we could expose this macro in |
Hanno Becker | 7dd82b4 | 2018-09-05 16:25:50 +0100 | [diff] [blame] | 37 | * platform_util.h and simply use it in platform_util.c, threading.c and |
Andres Amaya Garcia | ca04a01 | 2018-09-05 11:43:57 +0100 | [diff] [blame] | 38 | * threading.h. However, this macro is not part of the Mbed TLS public API, so |
Andres Amaya Garcia | 3c9733a | 2018-09-05 11:52:07 +0100 | [diff] [blame] | 39 | * we keep it private by only defining it in this file |
Andres Amaya Garcia | ca04a01 | 2018-09-05 11:43:57 +0100 | [diff] [blame] | 40 | */ |
Hanno Becker | f5106d5 | 2018-09-06 12:09:56 +0100 | [diff] [blame] | 41 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 42 | #if !(defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)) |
Andres Amaya Garcia | d717743 | 2018-08-08 09:41:17 +0100 | [diff] [blame] | 43 | #define THREADING_USE_GMTIME |
Hanno Becker | f5106d5 | 2018-09-06 12:09:56 +0100 | [diff] [blame] | 44 | #endif /* ! ( defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) ) */ |
| 45 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 46 | #endif /* !( ( defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L ) || \ |
| 47 | ( defined(_POSIX_THREAD_SAFE_FUNCTIONS ) && \ |
Chris Jones | d460323 | 2020-11-12 17:10:36 +0000 | [diff] [blame] | 48 | _POSIX_THREAD_SAFE_FUNCTIONS >= 200112L ) ) */ |
Hanno Becker | 323d801 | 2018-09-06 11:30:57 +0100 | [diff] [blame] | 49 | |
Hanno Becker | 6a73978 | 2018-09-05 15:06:19 +0100 | [diff] [blame] | 50 | #endif /* MBEDTLS_HAVE_TIME_DATE && !MBEDTLS_PLATFORM_GMTIME_R_ALT */ |
Andres Amaya Garcia | ce6eebb | 2018-08-07 20:26:55 +0100 | [diff] [blame] | 51 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 52 | #if defined(MBEDTLS_THREADING_PTHREAD) |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 53 | static void threading_mutex_init_pthread(mbedtls_threading_mutex_t *mutex) |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 54 | { |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 55 | if (mutex == NULL) { |
Manuel Pégourié-Gonnard | 1e2eae0 | 2015-04-29 01:26:03 +0200 | [diff] [blame] | 56 | return; |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 57 | } |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 58 | |
Paul Elliott | 5fa986c | 2023-11-10 14:05:09 +0000 | [diff] [blame] | 59 | /* One problem here is that calling lock on a pthread mutex without first |
| 60 | * having initialised it is undefined behaviour. Obviously we cannot check |
| 61 | * this here in a thread safe manner without a significant performance |
Paul Elliott | 8c6d332 | 2023-11-23 18:53:13 +0000 | [diff] [blame] | 62 | * hit, so state transitions are checked in tests only via the state |
| 63 | * variable. Please make sure any new mutex that gets added is exercised in |
David Horstmann | dcf42a0 | 2024-11-08 14:40:12 +0000 | [diff] [blame] | 64 | * tests; see framework/tests/src/threading_helpers.c for more details. */ |
Paul Elliott | 5fa986c | 2023-11-10 14:05:09 +0000 | [diff] [blame] | 65 | (void) pthread_mutex_init(&mutex->mutex, NULL); |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 66 | } |
| 67 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 68 | static void threading_mutex_free_pthread(mbedtls_threading_mutex_t *mutex) |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 69 | { |
Paul Elliott | 5fa986c | 2023-11-10 14:05:09 +0000 | [diff] [blame] | 70 | if (mutex == NULL) { |
Manuel Pégourié-Gonnard | 1e2eae0 | 2015-04-29 01:26:03 +0200 | [diff] [blame] | 71 | return; |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 72 | } |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 73 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 74 | (void) pthread_mutex_destroy(&mutex->mutex); |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 75 | } |
| 76 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 77 | static int threading_mutex_lock_pthread(mbedtls_threading_mutex_t *mutex) |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 78 | { |
Paul Elliott | 5fa986c | 2023-11-10 14:05:09 +0000 | [diff] [blame] | 79 | if (mutex == NULL) { |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 80 | return MBEDTLS_ERR_THREADING_BAD_INPUT_DATA; |
| 81 | } |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 82 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 83 | if (pthread_mutex_lock(&mutex->mutex) != 0) { |
| 84 | return MBEDTLS_ERR_THREADING_MUTEX_ERROR; |
| 85 | } |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 86 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 87 | return 0; |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 88 | } |
| 89 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 90 | static int threading_mutex_unlock_pthread(mbedtls_threading_mutex_t *mutex) |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 91 | { |
Paul Elliott | 5fa986c | 2023-11-10 14:05:09 +0000 | [diff] [blame] | 92 | if (mutex == NULL) { |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 93 | return MBEDTLS_ERR_THREADING_BAD_INPUT_DATA; |
| 94 | } |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 95 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 96 | if (pthread_mutex_unlock(&mutex->mutex) != 0) { |
| 97 | return MBEDTLS_ERR_THREADING_MUTEX_ERROR; |
| 98 | } |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 99 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 100 | return 0; |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 101 | } |
| 102 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 103 | void (*mbedtls_mutex_init)(mbedtls_threading_mutex_t *) = threading_mutex_init_pthread; |
| 104 | void (*mbedtls_mutex_free)(mbedtls_threading_mutex_t *) = threading_mutex_free_pthread; |
| 105 | int (*mbedtls_mutex_lock)(mbedtls_threading_mutex_t *) = threading_mutex_lock_pthread; |
| 106 | int (*mbedtls_mutex_unlock)(mbedtls_threading_mutex_t *) = threading_mutex_unlock_pthread; |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 107 | |
| 108 | /* |
Artur Allmann | 3f39615 | 2022-03-21 16:11:35 +0200 | [diff] [blame] | 109 | * With pthreads we can statically initialize mutexes |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 110 | */ |
| 111 | #define MUTEX_INIT = { PTHREAD_MUTEX_INITIALIZER, 1 } |
| 112 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 113 | #endif /* MBEDTLS_THREADING_PTHREAD */ |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 114 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 115 | #if defined(MBEDTLS_THREADING_ALT) |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 116 | static int threading_mutex_fail(mbedtls_threading_mutex_t *mutex) |
Paul Bakker | c78c842 | 2013-12-31 11:55:27 +0100 | [diff] [blame] | 117 | { |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 118 | ((void) mutex); |
| 119 | return MBEDTLS_ERR_THREADING_BAD_INPUT_DATA; |
Paul Bakker | c78c842 | 2013-12-31 11:55:27 +0100 | [diff] [blame] | 120 | } |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 121 | static void threading_mutex_dummy(mbedtls_threading_mutex_t *mutex) |
Manuel Pégourié-Gonnard | 1e2eae0 | 2015-04-29 01:26:03 +0200 | [diff] [blame] | 122 | { |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 123 | ((void) mutex); |
Manuel Pégourié-Gonnard | 1e2eae0 | 2015-04-29 01:26:03 +0200 | [diff] [blame] | 124 | return; |
| 125 | } |
Paul Bakker | c78c842 | 2013-12-31 11:55:27 +0100 | [diff] [blame] | 126 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 127 | void (*mbedtls_mutex_init)(mbedtls_threading_mutex_t *) = threading_mutex_dummy; |
| 128 | void (*mbedtls_mutex_free)(mbedtls_threading_mutex_t *) = threading_mutex_dummy; |
| 129 | int (*mbedtls_mutex_lock)(mbedtls_threading_mutex_t *) = threading_mutex_fail; |
| 130 | int (*mbedtls_mutex_unlock)(mbedtls_threading_mutex_t *) = threading_mutex_fail; |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 131 | |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 132 | /* |
| 133 | * Set functions pointers and initialize global mutexes |
| 134 | */ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 135 | void mbedtls_threading_set_alt(void (*mutex_init)(mbedtls_threading_mutex_t *), |
| 136 | void (*mutex_free)(mbedtls_threading_mutex_t *), |
| 137 | int (*mutex_lock)(mbedtls_threading_mutex_t *), |
| 138 | int (*mutex_unlock)(mbedtls_threading_mutex_t *)) |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 139 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 140 | mbedtls_mutex_init = mutex_init; |
| 141 | mbedtls_mutex_free = mutex_free; |
| 142 | mbedtls_mutex_lock = mutex_lock; |
| 143 | mbedtls_mutex_unlock = mutex_unlock; |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 144 | |
Gergely Budai | 13f7fb3 | 2017-08-23 14:23:58 +0200 | [diff] [blame] | 145 | #if defined(MBEDTLS_FS_IO) |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 146 | mbedtls_mutex_init(&mbedtls_threading_readdir_mutex); |
Gergely Budai | 13f7fb3 | 2017-08-23 14:23:58 +0200 | [diff] [blame] | 147 | #endif |
Andres Amaya Garcia | d717743 | 2018-08-08 09:41:17 +0100 | [diff] [blame] | 148 | #if defined(THREADING_USE_GMTIME) |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 149 | mbedtls_mutex_init(&mbedtls_threading_gmtime_mutex); |
Andres Amaya Garcia | ce6eebb | 2018-08-07 20:26:55 +0100 | [diff] [blame] | 150 | #endif |
Ryan Everett | 558da2f | 2024-01-19 12:59:28 +0000 | [diff] [blame] | 151 | #if defined(MBEDTLS_PSA_CRYPTO_C) |
Ryan Everett | 63952b7 | 2024-01-19 13:45:19 +0000 | [diff] [blame] | 152 | mbedtls_mutex_init(&mbedtls_threading_key_slot_mutex); |
Paul Elliott | 077fd87 | 2024-02-22 16:55:03 +0000 | [diff] [blame] | 153 | mbedtls_mutex_init(&mbedtls_threading_psa_globaldata_mutex); |
Paul Elliott | b8e38e0 | 2024-03-11 12:09:49 +0000 | [diff] [blame] | 154 | mbedtls_mutex_init(&mbedtls_threading_psa_rngdata_mutex); |
Ryan Everett | 558da2f | 2024-01-19 12:59:28 +0000 | [diff] [blame] | 155 | #endif |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | /* |
| 159 | * Free global mutexes |
| 160 | */ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 161 | void mbedtls_threading_free_alt(void) |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 162 | { |
Gergely Budai | 13f7fb3 | 2017-08-23 14:23:58 +0200 | [diff] [blame] | 163 | #if defined(MBEDTLS_FS_IO) |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 164 | mbedtls_mutex_free(&mbedtls_threading_readdir_mutex); |
Gergely Budai | 13f7fb3 | 2017-08-23 14:23:58 +0200 | [diff] [blame] | 165 | #endif |
Andres Amaya Garcia | d717743 | 2018-08-08 09:41:17 +0100 | [diff] [blame] | 166 | #if defined(THREADING_USE_GMTIME) |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 167 | mbedtls_mutex_free(&mbedtls_threading_gmtime_mutex); |
Andres Amaya Garcia | ce6eebb | 2018-08-07 20:26:55 +0100 | [diff] [blame] | 168 | #endif |
Ryan Everett | 558da2f | 2024-01-19 12:59:28 +0000 | [diff] [blame] | 169 | #if defined(MBEDTLS_PSA_CRYPTO_C) |
| 170 | mbedtls_mutex_free(&mbedtls_threading_key_slot_mutex); |
Paul Elliott | 077fd87 | 2024-02-22 16:55:03 +0000 | [diff] [blame] | 171 | mbedtls_mutex_free(&mbedtls_threading_psa_globaldata_mutex); |
Paul Elliott | b8e38e0 | 2024-03-11 12:09:49 +0000 | [diff] [blame] | 172 | mbedtls_mutex_free(&mbedtls_threading_psa_rngdata_mutex); |
Ryan Everett | 558da2f | 2024-01-19 12:59:28 +0000 | [diff] [blame] | 173 | #endif |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 174 | } |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 175 | #endif /* MBEDTLS_THREADING_ALT */ |
Paul Bakker | 2466d93 | 2013-09-28 14:40:38 +0200 | [diff] [blame] | 176 | |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 177 | /* |
| 178 | * Define global mutexes |
| 179 | */ |
| 180 | #ifndef MUTEX_INIT |
| 181 | #define MUTEX_INIT |
| 182 | #endif |
Gergely Budai | 13f7fb3 | 2017-08-23 14:23:58 +0200 | [diff] [blame] | 183 | #if defined(MBEDTLS_FS_IO) |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 184 | mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex MUTEX_INIT; |
Gergely Budai | 13f7fb3 | 2017-08-23 14:23:58 +0200 | [diff] [blame] | 185 | #endif |
Andres Amaya Garcia | d717743 | 2018-08-08 09:41:17 +0100 | [diff] [blame] | 186 | #if defined(THREADING_USE_GMTIME) |
Andres Amaya Garcia | ce6eebb | 2018-08-07 20:26:55 +0100 | [diff] [blame] | 187 | mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex MUTEX_INIT; |
| 188 | #endif |
Ryan Everett | 558da2f | 2024-01-19 12:59:28 +0000 | [diff] [blame] | 189 | #if defined(MBEDTLS_PSA_CRYPTO_C) |
| 190 | mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex MUTEX_INIT; |
Paul Elliott | 077fd87 | 2024-02-22 16:55:03 +0000 | [diff] [blame] | 191 | mbedtls_threading_mutex_t mbedtls_threading_psa_globaldata_mutex MUTEX_INIT; |
Paul Elliott | b8e38e0 | 2024-03-11 12:09:49 +0000 | [diff] [blame] | 192 | mbedtls_threading_mutex_t mbedtls_threading_psa_rngdata_mutex MUTEX_INIT; |
Ryan Everett | 558da2f | 2024-01-19 12:59:28 +0000 | [diff] [blame] | 193 | #endif |
Manuel Pégourié-Gonnard | 944cfe8 | 2015-05-27 20:07:18 +0200 | [diff] [blame] | 194 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 195 | #endif /* MBEDTLS_THREADING_C */ |