psa: slot mgmt: Simplify psa_validate_key_id
Special handling of volatile key identifiers is not
needed eventually, they can be handled just as
key identifier in the vendor range.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 4384a43..61f0ad4 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1870,7 +1870,7 @@
}
else
{
- status = psa_validate_key_id( psa_get_key_id( attributes ), 0, 0 );
+ status = psa_validate_key_id( psa_get_key_id( attributes ), 0 );
if( status != PSA_SUCCESS )
return( status );
}
diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c
index 9075beb..d8a3ca8 100644
--- a/library/psa_crypto_slot_management.c
+++ b/library/psa_crypto_slot_management.c
@@ -52,7 +52,7 @@
static psa_global_data_t global_data;
psa_status_t psa_validate_key_id(
- mbedtls_svc_key_id_t key, int vendor_ok, int volatile_ok )
+ mbedtls_svc_key_id_t key, int vendor_ok )
{
psa_key_id_t key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( key );
@@ -62,12 +62,7 @@
if( vendor_ok &&
( PSA_KEY_ID_VENDOR_MIN <= key_id ) &&
- ( key_id < PSA_KEY_ID_VOLATILE_MIN ) )
- return( PSA_SUCCESS );
-
- if( volatile_ok &&
- ( PSA_KEY_ID_VOLATILE_MIN <= key_id ) &&
- ( key_id <= PSA_KEY_ID_VOLATILE_MAX ) )
+ ( key_id <= PSA_KEY_ID_VENDOR_MAX ) )
return( PSA_SUCCESS );
return( PSA_ERROR_INVALID_HANDLE );
@@ -122,7 +117,7 @@
}
else
{
- status = psa_validate_key_id( key, 1, 1 );
+ status = psa_validate_key_id( key, 1 );
if( status != PSA_SUCCESS )
return( status );
diff --git a/library/psa_crypto_slot_management.h b/library/psa_crypto_slot_management.h
index 8d3c384..75ce0ac 100644
--- a/library/psa_crypto_slot_management.h
+++ b/library/psa_crypto_slot_management.h
@@ -212,13 +212,10 @@
* \param[in] vendor_ok Non-zero to indicate that key identifiers in the
* vendor range are allowed, volatile key identifiers
* excepted \c 0 otherwise.
- * \param[in] volatile_ok Non-zero to indicate that volatile key identifiers
- * are allowed \c 0 otherwise.
*
* \retval #PSA_SUCCESS The identifier is valid.
* \retval #PSA_ERROR_INVALID_ARGUMENT The key identifier is not valid.
*/
-psa_status_t psa_validate_key_id(
- mbedtls_svc_key_id_t key, int vendor_ok, int volatile_ok );
+psa_status_t psa_validate_key_id( mbedtls_svc_key_id_t key, int vendor_ok );
#endif /* PSA_CRYPTO_SLOT_MANAGEMENT_H */