Fix snprintf call to assume less about integral type sizes
The code only worked if psa_key_id_t (formerly psa_key_slot_t)
promoted to int and every value fit in int. Now the code only assumes
that psa_key_id_t is less wide than unsigned long, which is the case
since psa_key_id_t is a 32-bit type in our implementation.
@@ -53,7 +53,8 @@ static void key_id_to_location( const psa_key_id_t key,
size_t location_size )
{
mbedtls_snprintf( location, location_size,
- CRYPTO_STORAGE_FILE_LOCATION "psa_key_slot_%d", key );
+ CRYPTO_STORAGE_FILE_LOCATION "psa_key_slot_%lu",
+ (unsigned long) key );
}
psa_status_t psa_crypto_storage_load( const psa_key_id_t key, uint8_t *data,
