mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Add new global mutex for PSA global_data
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@@ -112,6 +112,13 @@ extern mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex;
|
|||||||
* psa_key_slot_state_transition(), psa_register_read(), psa_unregister_read(),
|
* psa_key_slot_state_transition(), psa_register_read(), psa_unregister_read(),
|
||||||
* psa_key_slot_has_readers() and psa_wipe_key_slot(). */
|
* psa_key_slot_has_readers() and psa_wipe_key_slot(). */
|
||||||
extern mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex;
|
extern mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A mutex used to make the PSA global_data struct members thread safe.
|
||||||
|
*
|
||||||
|
* This mutex must be held when any read or write to a any of the PSA
|
||||||
|
* global_data structure members. */
|
||||||
|
extern mbedtls_threading_mutex_t mbedtls_threading_psa_globaldata_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* MBEDTLS_THREADING_C */
|
#endif /* MBEDTLS_THREADING_C */
|
||||||
|
@@ -150,6 +150,7 @@ void mbedtls_threading_set_alt(void (*mutex_init)(mbedtls_threading_mutex_t *),
|
|||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
mbedtls_mutex_init(&mbedtls_threading_key_slot_mutex);
|
mbedtls_mutex_init(&mbedtls_threading_key_slot_mutex);
|
||||||
|
mbedtls_mutex_init(&mbedtls_threading_psa_globaldata_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,6 +167,7 @@ void mbedtls_threading_free_alt(void)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
mbedtls_mutex_free(&mbedtls_threading_key_slot_mutex);
|
mbedtls_mutex_free(&mbedtls_threading_key_slot_mutex);
|
||||||
|
mbedtls_mutex_free(&mbedtls_threading_psa_globaldata_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_THREADING_ALT */
|
#endif /* MBEDTLS_THREADING_ALT */
|
||||||
@@ -184,6 +186,7 @@ mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex MUTEX_INIT;
|
|||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex MUTEX_INIT;
|
mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex MUTEX_INIT;
|
||||||
|
mbedtls_threading_mutex_t mbedtls_threading_psa_globaldata_mutex MUTEX_INIT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* MBEDTLS_THREADING_C */
|
#endif /* MBEDTLS_THREADING_C */
|
||||||
|
Reference in New Issue
Block a user