From 291267f4866c87e8e79e31453775cbebcb0f20c3 Mon Sep 17 00:00:00 2001 From: Ryan Everett Date: Wed, 14 Feb 2024 15:59:15 +0000 Subject: [PATCH] Make restartable signature verifications thread-safe We copy the key from a slot to the operation object in _start. _complete and _abort do not access any key slots, instead using the local copy. Concurrently using the same operation object is not thread-safe. Signed-off-by: Ryan Everett --- library/psa_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 0a221d155d..66af7cf727 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -3516,7 +3516,7 @@ psa_status_t psa_verify_hash_start( psa_verify_hash_abort_internal(operation); } - unlock_status = psa_unregister_read(slot); + unlock_status = psa_unregister_read_under_mutex(slot); if (unlock_status != PSA_SUCCESS) { operation->error_occurred = 1;