Document the thread safety of the primitive key slot functions

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
Ryan Everett 2024-01-08 11:13:03 +00:00
parent 0e3b677cf4
commit fb02d57de7
2 changed files with 12 additions and 2 deletions

View File

@ -117,6 +117,8 @@ typedef struct {
0) 0)
/** Test whether a key slot has any registered readers. /** Test whether a key slot has any registered readers.
* If multi-threading is enabled, the caller must hold the
* global key slot mutex.
* *
* \param[in] slot The key slot to test. * \param[in] slot The key slot to test.
* *
@ -195,6 +197,8 @@ static inline psa_key_slot_number_t psa_key_slot_get_slot_number(
* *
* Persistent storage is not affected. * Persistent storage is not affected.
* Sets the slot's state to PSA_SLOT_EMPTY. * Sets the slot's state to PSA_SLOT_EMPTY.
* If multi-threading is enabled, the caller must hold the
* global key slot mutex.
* *
* \param[in,out] slot The key slot to wipe. * \param[in,out] slot The key slot to wipe.
* *

View File

@ -134,6 +134,9 @@ psa_status_t psa_reserve_free_key_slot(psa_key_id_t *volatile_key_id,
* new state. If the state of the slot was not expected_state, the state is * new state. If the state of the slot was not expected_state, the state is
* unchanged. * unchanged.
* *
* If multi-threading is enabled, the caller must hold the
* global key slot mutex.
*
* \param[in] slot The key slot. * \param[in] slot The key slot.
* \param[in] expected_state The current state of the slot. * \param[in] expected_state The current state of the slot.
* \param[in] new_state The new state of the slot. * \param[in] new_state The new state of the slot.
@ -157,7 +160,8 @@ static inline psa_status_t psa_key_slot_state_transition(
/** Register as a reader of a key slot. /** Register as a reader of a key slot.
* *
* This function increments the key slot registered reader counter by one. * This function increments the key slot registered reader counter by one.
* * If multi-threading is enabled, the caller must hold the
* global key slot mutex.
* \param[in] slot The key slot. * \param[in] slot The key slot.
* *
* \retval #PSA_SUCCESS * \retval #PSA_SUCCESS
@ -182,7 +186,9 @@ static inline psa_status_t psa_register_read(psa_key_slot_t *slot)
* This function decrements the key slot registered reader counter by one. * This function decrements the key slot registered reader counter by one.
* If the state of the slot is PSA_SLOT_PENDING_DELETION, * If the state of the slot is PSA_SLOT_PENDING_DELETION,
* and there is only one registered reader (the caller), * and there is only one registered reader (the caller),
* this function will call psa_wipe_key_slot(). * this function will call psa_wipe_slot().
* If multi-threading is enabled, the caller must hold the
* global key slot mutex.
* *
* \note To ease the handling of errors in retrieving a key slot * \note To ease the handling of errors in retrieving a key slot
* a NULL input pointer is valid, and the function returns * a NULL input pointer is valid, and the function returns