/mbedtls-latest/tests/src/ |
D | threading_helpers.c | 173 static void mbedtls_test_mutex_usage_error(mbedtls_threading_mutex_t *mutex, in mbedtls_test_mutex_usage_error() argument 176 (void) mutex; in mbedtls_test_mutex_usage_error() 186 static int mbedtls_test_mutex_can_test(mbedtls_threading_mutex_t *mutex) in mbedtls_test_mutex_can_test() argument 194 if (mutex == mbedtls_test_get_info_mutex()) { in mbedtls_test_mutex_can_test() 201 static void mbedtls_test_wrap_mutex_init(mbedtls_threading_mutex_t *mutex) in mbedtls_test_wrap_mutex_init() argument 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() 215 static void mbedtls_test_wrap_mutex_free(mbedtls_threading_mutex_t *mutex) in mbedtls_test_wrap_mutex_free() argument 217 if (mbedtls_test_mutex_can_test(mutex)) { in mbedtls_test_wrap_mutex_free() [all …]
|
/mbedtls-latest/library/ |
D | threading.c | 53 static void threading_mutex_init_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_init_pthread() argument 55 if (mutex == NULL) { in threading_mutex_init_pthread() 65 (void) pthread_mutex_init(&mutex->mutex, NULL); in threading_mutex_init_pthread() 68 static void threading_mutex_free_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_free_pthread() argument 70 if (mutex == NULL) { in threading_mutex_free_pthread() 74 (void) pthread_mutex_destroy(&mutex->mutex); in threading_mutex_free_pthread() 77 static int threading_mutex_lock_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_lock_pthread() argument 79 if (mutex == NULL) { in threading_mutex_lock_pthread() 83 if (pthread_mutex_lock(&mutex->mutex) != 0) { in threading_mutex_lock_pthread() 90 static int threading_mutex_unlock_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_unlock_pthread() argument [all …]
|
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()
|
D | entropy.c | 33 mbedtls_mutex_init(&ctx->mutex); in mbedtls_entropy_init() 75 mbedtls_mutex_free(&ctx->mutex); in mbedtls_entropy_free() 93 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_add_source() 113 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_add_source() 179 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_update_manual() 187 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_update_manual() 254 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_gather() 262 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_gather() 294 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_func() 374 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_func()
|
D | ssl_cookie.c | 75 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_cookie_init() 97 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ssl_cookie_free() 249 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_cookie_write() 258 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_cookie_write() 332 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_cookie_check() 344 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_cookie_check()
|
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() 550 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ssl_ticket_free()
|
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()
|
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()
|
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()
|
D | rsa.c | 964 mbedtls_mutex_init(&ctx->mutex); in mbedtls_rsa_init() 1250 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_rsa_public() 1268 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_rsa_public() 1451 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_rsa_private() 1576 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_rsa_private() 2839 mbedtls_mutex_free(&ctx->mutex); in mbedtls_rsa_free()
|
/mbedtls-latest/programs/test/ |
D | metatest.c | 261 mbedtls_threading_mutex_t mutex; in mutex_lock_not_initialized() local 262 memset(&mutex, 0, sizeof(mutex)); in mutex_lock_not_initialized() 267 TEST_ASSERT(mbedtls_mutex_lock(&mutex) == 0); in mutex_lock_not_initialized() 277 mbedtls_threading_mutex_t mutex; in mutex_unlock_not_initialized() local 278 memset(&mutex, 0, sizeof(mutex)); in mutex_unlock_not_initialized() 283 TEST_ASSERT(mbedtls_mutex_unlock(&mutex) == 0); in mutex_unlock_not_initialized() 293 mbedtls_threading_mutex_t mutex; in mutex_free_not_initialized() local 294 memset(&mutex, 0, sizeof(mutex)); in mutex_free_not_initialized() 299 mbedtls_mutex_free(&mutex); in mutex_free_not_initialized() 307 mbedtls_threading_mutex_t mutex; in mutex_double_init() local [all …]
|
/mbedtls-latest/include/mbedtls/ |
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);
|
D | ssl_cookie.h | 59 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
D | ssl_cache.h | 72 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< mutex */
|
D | ssl_ticket.h | 82 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
D | hmac_drbg.h | 100 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
D | entropy.h | 114 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< mutex */
|
D | ctr_drbg.h | 229 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
|
D | rsa.h | 120 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< Thread-safety mutex. */
|
/mbedtls-latest/docs/architecture/psa-thread-safety/ |
D | psa-thread-safety.md | 11 …- Key slots are protected by a global mutex, as described in [Key store consistency and abstractio… 78 …SA functions from a single thread, or which protect all PSA calls using a mutex, are not affected … 123 …mutex operation fails, which only happens if the mutex implementation fails, the error code `PSA_E… 139 We have added a mutex `mbedtls_threading_psa_globaldata_mutex` defined in `include/mbedtls/threadin… 143 …ldata_mutex`. The RNG fields within this struct are not protected by this mutex, and are not alway… 144 …escribed in [Key slots](#key-slots), `key_slots_initialized` is protected by the global data mutex. 148 …a thread attempts to lock a mutex while already holding it. Functions which need to be called whil… 150 …ticular, they must not start expensive operations (eg. doing cryptography) while holding the mutex. 184 The key store is protected by a single global mutex `mbedtls_threading_key_slot_mutex`. 186 …hile the mutex is held; there is a convenience function `psa_unregister_read_under_mutex` which wr… [all …]
|
/mbedtls-latest/tests/suites/ |
D | test_suite_psa_crypto_init.function | 91 mbedtls_mutex_init(&ctx->mutex);
|
D | test_suite_psa_crypto.function | 1359 * locks the mutex to reserve a new slot, it will return 1364 * unlocks the mutex, then relocks it to finalize key creation.
|
/mbedtls-latest/docs/architecture/ |
D | psa-keystore-design.md | 53 …key store was not thread-safe.) The lock is controlled by a single global mutex `mbedtls_threading…
|
/mbedtls-latest/ |
D | ChangeLog | 2197 is enabled, on platforms where initializing a mutex allocates resources. 2203 enabled on platforms where freeing a mutex twice is not safe. 2206 a mutex allocates resources. 4532 result trying to unlock an unlocked mutex on invalid input (found by
|