diff --git a/library/psa_crypto_storage.c b/library/psa_crypto_storage.c index e48bc282f8..46d0b65182 100644 --- a/library/psa_crypto_storage.c +++ b/library/psa_crypto_storage.c @@ -67,8 +67,9 @@ static psa_storage_uid_t psa_its_identifier_of_slot( mbedtls_svc_key_id_t key ) * owner values are nonzero (as they are on a PSA platform), * no key file will ever have a value less than 0x100000000, so * the whole range 0..0xffffffff is available for non-key files. */ - uint32_t unsigned_owner = (uint32_t) key.owner; - return( (uint64_t) unsigned_owner << 32 | key.key_id ); + uint32_t unsigned_owner_id = MBEDTLS_SVC_KEY_ID_GET_OWNER_ID( key ); + return( ( (uint64_t) unsigned_owner_id << 32 ) | + MBEDTLS_SVC_KEY_ID_GET_KEY_ID( key ) ); #else /* Use the key id directly as a file name. * psa_is_key_id_valid() in psa_crypto_slot_management.c