mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 13:55:35 +00:00
Fix mbedtls_psa_get_stats for keys with fancy lifetimes
mbedtls_psa_get_stats() was written back before lifetimes were structured as persistence and location. Fix its classification of volatile external keys and internal keys with a non-default persistence. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
7aa260d481
commit
7934b3f9f9
|
@ -556,16 +556,17 @@ void mbedtls_psa_get_stats( mbedtls_psa_stats_t *stats )
|
||||||
++stats->empty_slots;
|
++stats->empty_slots;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( slot->attr.lifetime == PSA_KEY_LIFETIME_VOLATILE )
|
if( PSA_KEY_LIFETIME_IS_VOLATILE( slot->attr.lifetime ) )
|
||||||
++stats->volatile_slots;
|
++stats->volatile_slots;
|
||||||
else if( slot->attr.lifetime == PSA_KEY_LIFETIME_PERSISTENT )
|
else
|
||||||
{
|
{
|
||||||
psa_key_id_t id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( slot->attr.id );
|
psa_key_id_t id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( slot->attr.id );
|
||||||
++stats->persistent_slots;
|
++stats->persistent_slots;
|
||||||
if( id > stats->max_open_internal_key_id )
|
if( id > stats->max_open_internal_key_id )
|
||||||
stats->max_open_internal_key_id = id;
|
stats->max_open_internal_key_id = id;
|
||||||
}
|
}
|
||||||
else
|
if( PSA_KEY_LIFETIME_GET_LOCATION( slot->attr.lifetime ) !=
|
||||||
|
PSA_KEY_LOCATION_LOCAL_STORAGE )
|
||||||
{
|
{
|
||||||
psa_key_id_t id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( slot->attr.id );
|
psa_key_id_t id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( slot->attr.id );
|
||||||
++stats->external_slots;
|
++stats->external_slots;
|
||||||
|
|
Loading…
Reference in a new issue