Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Mbed-TLS/mbedtls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Everett <ryan.everett@arm.com>2024-01-08 14:13:03 +0300
committerRyan Everett <ryan.everett@arm.com>2024-01-18 13:54:42 +0300
commitfb02d57de790dc4cc27b5f9a43c4433c13a5ed60 (patch)
tree3730834a6d53bfdb264d24dfc3090029d706c206
parent0e3b677cf4600bec736020715f85909f4534c5dd (diff)
Document the thread safety of the primitive key slot functions
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
-rw-r--r--library/psa_crypto_core.h4
-rw-r--r--library/psa_crypto_slot_management.h10
2 files changed, 12 insertions, 2 deletions
diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h
index 1edd63e256..7b167248e8 100644
--- a/library/psa_crypto_core.h
+++ b/library/psa_crypto_core.h
@@ -117,6 +117,8 @@ typedef struct {
0)
/** 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.
*
@@ -195,6 +197,8 @@ static inline psa_key_slot_number_t psa_key_slot_get_slot_number(
*
* Persistent storage is not affected.
* 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.
*
diff --git a/library/psa_crypto_slot_management.h b/library/psa_crypto_slot_management.h
index 01778f899e..fc46257f21 100644
--- a/library/psa_crypto_slot_management.h
+++ b/library/psa_crypto_slot_management.h
@@ -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
* unchanged.
*
+ * If multi-threading is enabled, the caller must hold the
+ * global key slot mutex.
+ *
* \param[in] slot The key slot.
* \param[in] expected_state The current 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.
*
* 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.
*
* \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.
* If the state of the slot is PSA_SLOT_PENDING_DELETION,
* 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
* a NULL input pointer is valid, and the function returns