From 231f15ba11131e8b2d8701ba55a55ab49a0537be Mon Sep 17 00:00:00 2001 From: Ryan Everett Date: Mon, 29 Apr 2024 18:26:19 +0100 Subject: [PATCH] Explicitly document return behaviour A bug existed previously where this guarantee was not met, causing some issues in multi-threaded code. Signed-off-by: Ryan Everett --- library/psa_crypto_slot_management.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/psa_crypto_slot_management.h b/library/psa_crypto_slot_management.h index bcfc9d8adc..a84be7d837 100644 --- a/library/psa_crypto_slot_management.h +++ b/library/psa_crypto_slot_management.h @@ -58,6 +58,9 @@ static inline int psa_key_id_is_volatile(psa_key_id_t key_id) * It is the responsibility of the caller to call psa_unregister_read(slot) * when they have finished reading the contents of the slot. * + * On failure, `*p_slot` is set to NULL. This ensures that it is always valid + * to call psa_unregister_read on the returned slot. + * * \param key Key identifier to query. * \param[out] p_slot On success, `*p_slot` contains a pointer to the * key slot containing the description of the key