Clarify which unregister operation needs to be used
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
parent
91ce792253
commit
93cea578b9
2 changed files with 17 additions and 5 deletions
|
@ -909,8 +909,13 @@ static psa_status_t psa_restrict_key_policy(
|
||||||
* into a key slot if not already done.
|
* into a key slot if not already done.
|
||||||
*
|
*
|
||||||
* On success, the returned key slot has been registered for reading.
|
* On success, the returned key slot has been registered for reading.
|
||||||
* It is the responsibility of the caller to call psa_unregister_read(slot)
|
* It is the responsibility of the caller to then unregister
|
||||||
* when they have finished reading the contents of the slot.
|
* once they have finished reading the contents of the slot.
|
||||||
|
* The caller unregisters by calling psa_unregister_read() or
|
||||||
|
* psa_unregister_read_under_mutex(). psa_unregister_read() must be called
|
||||||
|
* if and only if the caller already holds the global key slot mutex
|
||||||
|
* (when mutexes are enabled). psa_unregister_read_under_mutex() encapsulates
|
||||||
|
* the unregister with mutex lock and unlock operations.
|
||||||
*/
|
*/
|
||||||
static psa_status_t psa_get_and_lock_key_slot_with_policy(
|
static psa_status_t psa_get_and_lock_key_slot_with_policy(
|
||||||
mbedtls_svc_key_id_t key,
|
mbedtls_svc_key_id_t key,
|
||||||
|
@ -970,8 +975,13 @@ error:
|
||||||
* for a cryptographic operation.
|
* for a cryptographic operation.
|
||||||
*
|
*
|
||||||
* On success, the returned key slot has been registered for reading.
|
* On success, the returned key slot has been registered for reading.
|
||||||
* It is the responsibility of the caller to call psa_unregister_read(slot)
|
* It is the responsibility of the caller to then unregister
|
||||||
* when they have finished reading the contents of the slot.
|
* once they have finished reading the contents of the slot.
|
||||||
|
* The caller unregisters by calling psa_unregister_read() or
|
||||||
|
* psa_unregister_read_under_mutex(). psa_unregister_read() must be called
|
||||||
|
* if and only if the caller already holds the global key slot mutex
|
||||||
|
* (when mutexes are enabled). psa_unregister_read_under_mutex() encapsulates
|
||||||
|
* psa_unregister_read() with mutex lock and unlock operations.
|
||||||
*/
|
*/
|
||||||
static psa_status_t psa_get_and_lock_transparent_key_slot_with_policy(
|
static psa_status_t psa_get_and_lock_transparent_key_slot_with_policy(
|
||||||
mbedtls_svc_key_id_t key,
|
mbedtls_svc_key_id_t key,
|
||||||
|
|
|
@ -89,7 +89,9 @@ typedef struct {
|
||||||
* A function must call psa_register_read(slot) before reading the current
|
* A function must call psa_register_read(slot) before reading the current
|
||||||
* contents of the slot for an operation.
|
* contents of the slot for an operation.
|
||||||
* They then must call psa_unregister_read(slot) once they have finished
|
* They then must call psa_unregister_read(slot) once they have finished
|
||||||
* reading the current contents of the slot.
|
* reading the current contents of the slot. If the key slot mutex is not
|
||||||
|
* held (when mutexes are enabled), this call must be done via a call to
|
||||||
|
* psa_unregister_read_under_mutex(slot).
|
||||||
* A function must call psa_key_slot_has_readers(slot) to check if
|
* A function must call psa_key_slot_has_readers(slot) to check if
|
||||||
* the slot is in use for reading.
|
* the slot is in use for reading.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue