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.
diff --git a/library/psa_crypto_storage_file.c b/library/psa_crypto_storage_file.c
index 95857fa..87420be 100644
--- a/library/psa_crypto_storage_file.c
+++ b/library/psa_crypto_storage_file.c
@@ -53,7 +53,8 @@
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,