Update mbedtls_psa_get_stats

Uses readers to report "locked_slots",
and slot state empty to report "empty_slots".

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
Ryan Everett 2024-01-04 12:13:45 +00:00
parent 6cd2b8db96
commit 6a9c14b918

View file

@ -579,10 +579,10 @@ void mbedtls_psa_get_stats(mbedtls_psa_stats_t *stats)
for (slot_idx = 0; slot_idx < MBEDTLS_PSA_KEY_SLOT_COUNT; slot_idx++) {
const psa_key_slot_t *slot = &global_data.key_slots[slot_idx];
if (psa_is_key_slot_locked(slot)) {
if (psa_key_slot_has_readers(slot)) {
++stats->locked_slots;
}
if (!psa_is_key_slot_occupied(slot)) {
if (slot->state == PSA_SLOT_EMPTY) {
++stats->empty_slots;
continue;
}