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>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index e6d3851..e3b2be6 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -936,7 +936,7 @@
error:
*p_slot = NULL;
- psa_unregister_read(slot);
+ psa_unregister_read_under_mutex(slot);
return status;
}
@@ -968,7 +968,7 @@
}
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;
}