Reject invalid key ids/lifetimes in attribute-based creation
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index a43ccaf..efec00b 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1284,7 +1284,13 @@
return( status );
slot->lifetime = attributes->lifetime;
if( attributes->lifetime != PSA_KEY_LIFETIME_VOLATILE )
+ {
+ status = psa_validate_persistent_key_parameters( attributes->lifetime,
+ attributes->id );
+ if( status != PSA_SUCCESS )
+ return( status );
slot->persistent_storage_id = attributes->id;
+ }
slot->type = attributes->type;
return( status );