Refactor lifetime checking to reflect split in location and persistence

Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c
index 6cd6a11..193959a 100644
--- a/library/psa_crypto_slot_management.c
+++ b/library/psa_crypto_slot_management.c
@@ -200,7 +200,10 @@
     }
     else
 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
-    if( lifetime != PSA_KEY_LIFETIME_PERSISTENT )
+    if( ( PSA_KEY_LIFETIME_GET_LOCATION( lifetime )
+            != PSA_KEY_LOCATION_LOCAL_STORAGE ) ||
+        ( PSA_KEY_LIFETIME_GET_PERSISTENCE( lifetime )
+            != PSA_KEY_PERSISTENCE_DEFAULT ) )
         return( PSA_ERROR_INVALID_ARGUMENT );
 
 #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)