Merge pull request #8693 from Ryan-Everett-arm/implement-key-slot-mutex

Implement the key slot mutex
This commit is contained in:
Janos Follath 2024-01-19 20:49:18 +00:00 committed by GitHub
commit fb12d9204d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 42 additions and 0 deletions

View file

@ -100,6 +100,20 @@ extern mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex;
extern mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex;
#endif /* MBEDTLS_HAVE_TIME_DATE && !MBEDTLS_PLATFORM_GMTIME_R_ALT */
#if defined(MBEDTLS_PSA_CRYPTO_C)
/*
* A mutex used to make the PSA subsystem thread safe.
*
* key_slot_mutex protects the registered_readers and
* state variable for all key slots in &global_data.key_slots.
*
* This mutex must be held when any read from or write to a state or
* registered_readers field is performed, i.e. when calling functions:
* psa_key_slot_state_transition(), psa_register_read(), psa_unregister_read(),
* psa_key_slot_has_readers() and psa_wipe_key_slot(). */
extern mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex;
#endif
#endif /* MBEDTLS_THREADING_C */
#ifdef __cplusplus

View file

@ -279,6 +279,11 @@
* to read from a resource. */
#define PSA_ERROR_INSUFFICIENT_DATA ((psa_status_t)-143)
/** This can be returned if a function can no longer operate correctly.
* For example, if an essential initialization operation failed or
* a mutex operation failed. */
#define PSA_ERROR_SERVICE_FAILURE ((psa_status_t)-144)
/** The key identifier is not valid. See also :ref:\`key-handles\`.
*/
#define PSA_ERROR_INVALID_HANDLE ((psa_status_t)-136)