mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-03 10:13:40 +00:00
Make psa_get_and_lock_X_with_policy threadsafe
Between the call to psa_get_and_lock_key_slot and psa_unregister_read we only read the contents of a slot which we are registered to read, so no extra mutex taking is needed. Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
parent
eb1722a2b9
commit
fb792cad31
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user