From 9e12f8f425a9b38ec47f67868b1411b4756755ab Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Fri, 13 Nov 2020 09:46:44 +0100 Subject: [PATCH] tests: psa crypto: Fix lifetime_is_secure_element() Signed-off-by: Ronald Cron --- tests/suites/test_suite_psa_crypto.function | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 82797681e..b03df3d4b 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -108,12 +108,10 @@ static const size_t INVALID_EXPORT_LENGTH = ~0U; #endif #if defined(MBEDTLS_PSA_CRYPTO_SE_C) -int lifetime_is_secure_element( psa_key_lifetime_t lifetime ) +int lifetime_is_dynamic_secure_element( psa_key_lifetime_t lifetime ) { - /* At the moment, anything that isn't a built-in lifetime is either - * a secure element or unassigned. */ - return( ( ! PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) ) && - lifetime != PSA_KEY_LIFETIME_PERSISTENT ); + return( PSA_KEY_LIFETIME_GET_LOCATION( lifetime ) != + PSA_KEY_LOCATION_LOCAL_STORAGE ); } #else int lifetime_is_secure_element( psa_key_lifetime_t lifetime ) @@ -263,7 +261,7 @@ int check_key_attributes_sanity( mbedtls_svc_key_id_t key ) /* randomly-generated 64-bit constant, should never appear in test data */ psa_key_slot_number_t slot_number = 0xec94d4a5058a1a21; psa_status_t status = psa_get_key_slot_number( &attributes, &slot_number ); - if( lifetime_is_secure_element( lifetime ) ) + if( lifetime_is_dynamic_secure_element( lifetime ) ) { /* Mbed Crypto currently always exposes the slot number to * applications. This is not mandated by the PSA specification