Change behavior of psa_get_key_lifetime()
psa_get_key_lifetime() behavior changed regarding empty slots, now
it return the lifetime of and empty slots. Documentation in header
file updated accordingly.
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index ac763f9..07c1da1 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -103,10 +103,6 @@
* Applications may call this function more than once. Once a call
* succeeds, subsequent calls are guaranteed to succeed.
*
- * \note Initial lifetime value for each key slot is initiated
- * to PSA_KEY_LIFETIME_VOLATILE, user should change this value
- * before calling psa_import_key() if needed.
- *
* \retval PSA_SUCCESS
* \retval PSA_ERROR_INSUFFICIENT_MEMORY
* \retval PSA_ERROR_COMMUNICATION_FAILURE
@@ -609,9 +605,7 @@
* Success.
* \retval PSA_ERROR_INVALID_ARGUMENT
* The key slot is invalid,
- * or the key data is not correctly formatted.
- * \retval PSA_ERROR_EMPTY_SLOT
- * The key slot is not occupied.
+ * or the key data is not correctly formatted.
*/
psa_status_t psa_get_key_lifetime(psa_key_slot_t key,
psa_key_lifetime_t *lifetime);
@@ -630,11 +624,9 @@
* \retval PSA_ERROR_INVALID_ARGUMENT
* The key slot is invalid,
* or the key data is not correctly formatted.
- * \retval PSA_ERROR_EMPTY_SLOT
- * The key slot is not occupied.
*/
psa_status_t psa_set_key_lifetime(psa_key_slot_t key,
- const psa_key_lifetime_t lifetime);
+ psa_key_lifetime_t lifetime);
/**@}*/
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 152fb17..fef0539 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1274,9 +1274,6 @@
return( PSA_ERROR_INVALID_ARGUMENT );
slot = &global_data.key_slots[key];
-
- if( slot->type == PSA_KEY_TYPE_NONE )
- return( PSA_ERROR_EMPTY_SLOT );
*lifetime = slot->lifetime;