psa_get_and_lock_key_slot() function
Get the description of a key given its identifier and lock it. The descriptions of volatile keys and loaded persistent keys are stored in key slots. This function returns a pointer to the key slot containing the description of a key given its identifier. In case of a persistent key, the function loads the description of the key into a key slot if not already done. On success, the returned key slot has been registered for reading. 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.
Arguments
key
Key identifier to query.
p_slot
On success, `*p_slot` contains a pointer to the key slot containing the description of the key identified by \p key.
Return value
#PSA_SUCCESS \p *p_slot contains a pointer to the key slot containing the description of the key identified by \p key. The key slot counter has been incremented. #PSA_ERROR_BAD_STATE The library has not been initialized. #PSA_ERROR_INVALID_HANDLE \p key is not a valid key identifier. #PSA_ERROR_INSUFFICIENT_MEMORY \p key is a persistent key identifier. The implementation does not have sufficient resources to load the persistent key. This can be due to a lack of empty key slot, or available memory. #PSA_ERROR_DOES_NOT_EXIST There is no key with key identifier \p key. #PSA_ERROR_CORRUPTION_DETECTED \emptydescription #PSA_ERROR_STORAGE_FAILURE \emptydescription #PSA_ERROR_DATA_CORRUPT \emptydescription