Home
last modified time | relevance | path

Searched refs:mutex (Results 1 – 20 of 20) sorted by relevance

/mbedtls-3.5.0/tests/src/
Dthreading_helpers.c99 static void mbedtls_test_mutex_usage_error(mbedtls_threading_mutex_t *mutex, in mbedtls_test_mutex_usage_error() argument
102 (void) mutex; in mbedtls_test_mutex_usage_error()
113 static void mbedtls_test_wrap_mutex_init(mbedtls_threading_mutex_t *mutex) in mbedtls_test_wrap_mutex_init() argument
115 mutex_functions.init(mutex); in mbedtls_test_wrap_mutex_init()
116 if (mutex->is_valid) { in mbedtls_test_wrap_mutex_init()
121 static void mbedtls_test_wrap_mutex_free(mbedtls_threading_mutex_t *mutex) in mbedtls_test_wrap_mutex_free() argument
123 switch (mutex->is_valid) { in mbedtls_test_wrap_mutex_free()
125 mbedtls_test_mutex_usage_error(mutex, "free without init or double free"); in mbedtls_test_wrap_mutex_free()
132 mbedtls_test_mutex_usage_error(mutex, "free without unlock"); in mbedtls_test_wrap_mutex_free()
135 mbedtls_test_mutex_usage_error(mutex, "corrupted state"); in mbedtls_test_wrap_mutex_free()
[all …]
/mbedtls-3.5.0/library/
Dthreading.c65 static void threading_mutex_init_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_init_pthread() argument
67 if (mutex == NULL) { in threading_mutex_init_pthread()
77 mutex->is_valid = pthread_mutex_init(&mutex->mutex, NULL) == 0; in threading_mutex_init_pthread()
80 static void threading_mutex_free_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_free_pthread() argument
82 if (mutex == NULL || !mutex->is_valid) { in threading_mutex_free_pthread()
86 (void) pthread_mutex_destroy(&mutex->mutex); in threading_mutex_free_pthread()
87 mutex->is_valid = 0; in threading_mutex_free_pthread()
90 static int threading_mutex_lock_pthread(mbedtls_threading_mutex_t *mutex) in threading_mutex_lock_pthread() argument
92 if (mutex == NULL || !mutex->is_valid) { in threading_mutex_lock_pthread()
96 if (pthread_mutex_lock(&mutex->mutex) != 0) { in threading_mutex_lock_pthread()
[all …]
Dssl_cache.c43 mbedtls_mutex_init(&cache->mutex); in mbedtls_ssl_cache_init()
95 if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { in mbedtls_ssl_cache_get()
116 if (mbedtls_mutex_unlock(&cache->mutex) != 0) { in mbedtls_ssl_cache_get()
270 if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { in mbedtls_ssl_cache_set()
320 if (mbedtls_mutex_unlock(&cache->mutex) != 0) { in mbedtls_ssl_cache_set()
344 if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { in mbedtls_ssl_cache_remove()
375 if (mbedtls_mutex_unlock(&cache->mutex) != 0) { in mbedtls_ssl_cache_remove()
418 mbedtls_mutex_free(&cache->mutex); in mbedtls_ssl_cache_free()
Dentropy.c48 mbedtls_mutex_init(&ctx->mutex); in mbedtls_entropy_init()
90 mbedtls_mutex_free(&ctx->mutex); in mbedtls_entropy_free()
112 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_add_source()
132 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_add_source()
210 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_update_manual()
218 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_update_manual()
285 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_gather()
293 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_gather()
325 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_entropy_func()
426 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_entropy_func()
Dssl_cookie.c82 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_cookie_init()
100 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ssl_cookie_free()
252 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_cookie_write()
261 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_cookie_write()
335 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_cookie_check()
347 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_cookie_check()
Dssl_ticket.c47 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_ticket_init()
329 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_ticket_write()
388 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_ticket_write()
444 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ssl_ticket_parse()
518 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ssl_ticket_parse()
540 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ssl_ticket_free()
Dmemory_buffer_alloc.c75 mbedtls_threading_mutex_t mutex; member
552 if (mbedtls_mutex_lock(&heap.mutex) != 0) { in buffer_alloc_calloc_mutexed()
556 if (mbedtls_mutex_unlock(&heap.mutex)) { in buffer_alloc_calloc_mutexed()
566 if (mbedtls_mutex_lock(&heap.mutex)) { in buffer_alloc_free_mutexed()
570 (void) mbedtls_mutex_unlock(&heap.mutex); in buffer_alloc_free_mutexed()
579 mbedtls_mutex_init(&heap.mutex); in mbedtls_memory_buffer_alloc_init()
611 mbedtls_mutex_free(&heap.mutex); in mbedtls_memory_buffer_alloc_free()
Dhmac_drbg.c120 mbedtls_mutex_init(&ctx->mutex); in mbedtls_hmac_drbg_seed_buf()
250 mbedtls_mutex_init(&ctx->mutex); in mbedtls_hmac_drbg_seed()
400 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_hmac_drbg_random()
408 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_hmac_drbg_random()
429 mbedtls_mutex_free(&ctx->mutex); in mbedtls_hmac_drbg_free()
Dctr_drbg.c68 mbedtls_mutex_free(&ctx->mutex); in mbedtls_ctr_drbg_free()
444 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ctr_drbg_seed()
580 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ctr_drbg_random()
588 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ctr_drbg_random()
Drsa.c465 mbedtls_mutex_init(&ctx->mutex); in mbedtls_rsa_init()
739 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_rsa_public()
757 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_rsa_public()
910 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_rsa_private()
1042 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_rsa_private()
2352 mbedtls_mutex_free(&ctx->mutex); in mbedtls_rsa_free()
/mbedtls-3.5.0/include/mbedtls/
Dthreading.h42 pthread_mutex_t MBEDTLS_PRIVATE(mutex);
89 extern void (*mbedtls_mutex_init)(mbedtls_threading_mutex_t *mutex);
90 extern void (*mbedtls_mutex_free)(mbedtls_threading_mutex_t *mutex);
91 extern int (*mbedtls_mutex_lock)(mbedtls_threading_mutex_t *mutex);
92 extern int (*mbedtls_mutex_unlock)(mbedtls_threading_mutex_t *mutex);
Dssl_cookie.h71 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
Dssl_cache.h84 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< mutex */
Dssl_ticket.h90 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
Dhmac_drbg.h112 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
Dentropy.h131 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< mutex */
Dctr_drbg.h210 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
Drsa.h126 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex); /*!< Thread-safety mutex. */
/mbedtls-3.5.0/tests/suites/
Dtest_suite_psa_crypto_init.function73 mbedtls_mutex_init(&ctx->mutex);
/mbedtls-3.5.0/
DChangeLog1421 is enabled, on platforms where initializing a mutex allocates resources.
1427 enabled on platforms where freeing a mutex twice is not safe.
1430 a mutex allocates resources.
3756 result trying to unlock an unlocked mutex on invalid input (found by