| /mbedtls/tests/src/ |
| A D | threading_helpers.c | 176 (void) mutex; in mbedtls_test_mutex_usage_error() 203 mutex_functions.init(mutex); in mbedtls_test_wrap_mutex_init() 205 if (mbedtls_test_mutex_can_test(mutex)) { in mbedtls_test_wrap_mutex_init() 207 mutex->state = MUTEX_IDLE; in mbedtls_test_wrap_mutex_init() 217 if (mbedtls_test_mutex_can_test(mutex)) { in mbedtls_test_wrap_mutex_free() 220 switch (mutex->state) { in mbedtls_test_wrap_mutex_free() 240 mutex_functions.free(mutex); in mbedtls_test_wrap_mutex_free() 248 int ret = mutex_functions.lock(mutex); in mbedtls_test_wrap_mutex_lock() 252 switch (mutex->state) { in mbedtls_test_wrap_mutex_lock() 283 switch (mutex->state) { in mbedtls_test_wrap_mutex_unlock() [all …]
|
| /mbedtls/library/ |
| A D | threading.c | 55 if (mutex == NULL) { in threading_mutex_init_pthread() 65 (void) pthread_mutex_init(&mutex->mutex, NULL); in threading_mutex_init_pthread() 70 if (mutex == NULL) { in threading_mutex_free_pthread() 74 (void) pthread_mutex_destroy(&mutex->mutex); in threading_mutex_free_pthread() 79 if (mutex == NULL) { in threading_mutex_lock_pthread() 83 if (pthread_mutex_lock(&mutex->mutex) != 0) { in threading_mutex_lock_pthread() 92 if (mutex == NULL) { in threading_mutex_unlock_pthread() 96 if (pthread_mutex_unlock(&mutex->mutex) != 0) { in threading_mutex_unlock_pthread() 116 static int threading_mutex_fail(mbedtls_threading_mutex_t *mutex) in threading_mutex_fail() argument 118 ((void) mutex); in threading_mutex_fail() [all …]
|
| A D | ssl_cache.c | 32 mbedtls_mutex_init(&cache->mutex); in mbedtls_ssl_cache_init() 84 if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { in mbedtls_ssl_cache_get() 105 if (mbedtls_mutex_unlock(&cache->mutex) != 0) { in mbedtls_ssl_cache_get() 259 if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { in mbedtls_ssl_cache_set() 308 if (mbedtls_mutex_unlock(&cache->mutex) != 0) { in mbedtls_ssl_cache_set() 331 if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { in mbedtls_ssl_cache_remove() 362 if (mbedtls_mutex_unlock(&cache->mutex) != 0) { in mbedtls_ssl_cache_remove() 405 mbedtls_mutex_free(&cache->mutex); in mbedtls_ssl_cache_free()
|
| A D | entropy.c | 33 mbedtls_mutex_init(&ctx->mutex); in mbedtls_entropy_init() 71 mbedtls_mutex_free(&ctx->mutex); in mbedtls_entropy_free() 89 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_add_source() 109 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_add_source() 175 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_update_manual() 183 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_update_manual() 250 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_gather() 258 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_gather() 290 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_func() 370 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_func()
|
| A D | ssl_cookie.c | 75 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_cookie_init() 93 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ssl_cookie_free() 245 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_cookie_write() 254 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_cookie_write() 328 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_cookie_check() 340 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_cookie_check()
|
| A D | ssl_ticket.c | 41 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_ticket_init() 330 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_ticket_write() 389 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_ticket_write() 445 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_ticket_parse() 524 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_ticket_parse() 546 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ssl_ticket_free()
|
| A D | memory_buffer_alloc.c | 63 mbedtls_threading_mutex_t mutex; member 540 if (mbedtls_mutex_lock(&heap.mutex) != 0) { in buffer_alloc_calloc_mutexed() 544 if (mbedtls_mutex_unlock(&heap.mutex)) { in buffer_alloc_calloc_mutexed() 554 if (mbedtls_mutex_lock(&heap.mutex)) { in buffer_alloc_free_mutexed() 558 (void) mbedtls_mutex_unlock(&heap.mutex); in buffer_alloc_free_mutexed() 567 mbedtls_mutex_init(&heap.mutex); in mbedtls_memory_buffer_alloc_init() 599 mbedtls_mutex_free(&heap.mutex); in mbedtls_memory_buffer_alloc_free()
|
| A D | hmac_drbg.c | 108 mbedtls_mutex_init(&ctx->mutex); in mbedtls_hmac_drbg_seed_buf() 238 mbedtls_mutex_init(&ctx->mutex); in mbedtls_hmac_drbg_seed() 388 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_hmac_drbg_random() 396 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_hmac_drbg_random() 417 mbedtls_mutex_free(&ctx->mutex); in mbedtls_hmac_drbg_free()
|
| A D | ctr_drbg.c | 102 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ctr_drbg_free() 549 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ctr_drbg_seed() 703 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ctr_drbg_random() 711 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ctr_drbg_random()
|
| A D | rsa.c | 963 mbedtls_mutex_init(&ctx->mutex); in mbedtls_rsa_init() 1249 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_rsa_public() 1267 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_rsa_public() 1450 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_rsa_private() 1575 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_rsa_private() 2838 mbedtls_mutex_free(&ctx->mutex); in mbedtls_rsa_free()
|
| /mbedtls/programs/test/ |
| A D | metatest.c | 262 memset(&mutex, 0, sizeof(mutex)); in mutex_lock_not_initialized() 278 memset(&mutex, 0, sizeof(mutex)); in mutex_unlock_not_initialized() 294 memset(&mutex, 0, sizeof(mutex)); in mutex_free_not_initialized() 299 mbedtls_mutex_free(&mutex); in mutex_free_not_initialized() 308 mbedtls_mutex_init(&mutex); in mutex_double_init() 313 mbedtls_mutex_init(&mutex); in mutex_double_init() 314 mbedtls_mutex_free(&mutex); in mutex_double_init() 323 mbedtls_mutex_init(&mutex); in mutex_double_free() 324 mbedtls_mutex_free(&mutex); in mutex_double_free() 329 mbedtls_mutex_free(&mutex); in mutex_double_free() [all …]
|
| /mbedtls/include/mbedtls/ |
| A D | threading.h | 30 pthread_mutex_t MBEDTLS_PRIVATE(mutex); 81 extern void (*mbedtls_mutex_init)(mbedtls_threading_mutex_t *mutex); 82 extern void (*mbedtls_mutex_free)(mbedtls_threading_mutex_t *mutex); 83 extern int (*mbedtls_mutex_lock)(mbedtls_threading_mutex_t *mutex); 84 extern int (*mbedtls_mutex_unlock)(mbedtls_threading_mutex_t *mutex);
|
| A D | ssl_cookie.h | 59 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
| A D | ssl_cache.h | 72 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< mutex */
|
| A D | ssl_ticket.h | 82 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
| A D | hmac_drbg.h | 100 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
| A D | entropy.h | 113 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< mutex */
|
| A D | ctr_drbg.h | 214 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
| A D | rsa.h | 120 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< Thread-safety mutex. */
|
| /mbedtls/docs/architecture/psa-thread-safety/ |
| A D | psa-thread-safety.md | 11 …- Key slots are protected by a global mutex, as described in [Key store consistency and abstractio… 123 …mutex operation fails, which only happens if the mutex implementation fails, the error code `PSA_E… 148 …a thread attempts to lock a mutex while already holding it. Functions which need to be called whil… 184 The key store is protected by a single global mutex `mbedtls_threading_key_slot_mutex`. 196 ##### Locking and unlocking the mutex 208 …mutex), the thread calls `psa_finish_key_creation`. This function takes the mutex, checks that the… 209 … key creation stage, this clean-up function takes the mutex, wipes the slot, and releases the mute… 243 …mutex unlock within `psa_finish_key_creation`; it is at this point that the key becomes visible to… 245 * `psa_purge_key`, `psa_close_key` - The linearization point is the mutex unlock after wiping the s… 283 …hat run in parallel, deriving the key and copying it key into the slot is not done under any mutex. [all …]
|
| /mbedtls/tests/suites/ |
| A D | test_suite_psa_crypto_init.function | 74 mbedtls_mutex_init(&ctx->mutex);
|
| A D | test_suite_psa_crypto.function | 1380 * locks the mutex to reserve a new slot, it will return 1385 * unlocks the mutex, then relocks it to finalize key creation.
|
| /mbedtls/ |
| A D | ChangeLog | 2002 is enabled, on platforms where initializing a mutex allocates resources. 2008 enabled on platforms where freeing a mutex twice is not safe. 2011 a mutex allocates resources. 4337 result trying to unlock an unlocked mutex on invalid input (found by
|