diff --git a/library/psa_crypto.c b/library/psa_crypto.c index e6d3851ba8..e3b2be6fe4 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -936,7 +936,7 @@ static psa_status_t psa_get_and_lock_key_slot_with_policy( error: *p_slot = NULL; - psa_unregister_read(slot); + psa_unregister_read_under_mutex(slot); return status; } @@ -968,7 +968,7 @@ static psa_status_t psa_get_and_lock_transparent_key_slot_with_policy( } if (psa_key_lifetime_is_external((*p_slot)->attr.lifetime)) { - psa_unregister_read(*p_slot); + psa_unregister_read_under_mutex(*p_slot); *p_slot = NULL; return PSA_ERROR_NOT_SUPPORTED; }