psa: Use key slot type in mbedtls_psa_crypto_free()

To avoid a possible loss of precision, and to be semantically correct,
use psa_key_slot_t (which is 16 bits) instead of size_t (which is 32 or
64 bits on common platforms) in mbedtls_psa_crypto_free().
This commit is contained in:
Jaeden Amero 2018-06-26 14:00:08 +01:00 committed by itayzafrir
parent 65fb236799
commit 045bd50a78

View file

@ -2941,7 +2941,7 @@ psa_status_t psa_generate_key( psa_key_slot_t key,
void mbedtls_psa_crypto_free( void ) void mbedtls_psa_crypto_free( void )
{ {
size_t key; psa_key_slot_t key;
for( key = 1; key < PSA_KEY_SLOT_COUNT; key++ ) for( key = 1; key < PSA_KEY_SLOT_COUNT; key++ )
psa_destroy_key( key ); psa_destroy_key( key );
mbedtls_ctr_drbg_free( &global_data.ctr_drbg ); mbedtls_ctr_drbg_free( &global_data.ctr_drbg );