Merge pull request #8833 from Ryan-Everett-arm/threadsafe-multiparts

Make multi-part operations thread-safe
This commit is contained in:
Paul Elliott 2024-02-24 10:29:20 +00:00 committed by GitHub
commit 5a4a6e44ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2565,7 +2565,7 @@ exit:
psa_mac_abort(operation); psa_mac_abort(operation);
} }
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
return (status == PSA_SUCCESS) ? unlock_status : status; return (status == PSA_SUCCESS) ? unlock_status : status;
} }
@ -3371,7 +3371,7 @@ exit:
psa_sign_hash_abort_internal(operation); psa_sign_hash_abort_internal(operation);
} }
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
if (unlock_status != PSA_SUCCESS) { if (unlock_status != PSA_SUCCESS) {
operation->error_occurred = 1; operation->error_occurred = 1;
@ -3516,7 +3516,7 @@ psa_status_t psa_verify_hash_start(
psa_verify_hash_abort_internal(operation); 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) { if (unlock_status != PSA_SUCCESS) {
operation->error_occurred = 1; operation->error_occurred = 1;
@ -4088,7 +4088,7 @@ exit:
psa_cipher_abort(operation); psa_cipher_abort(operation);
} }
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
return (status == PSA_SUCCESS) ? unlock_status : status; return (status == PSA_SUCCESS) ? unlock_status : status;
} }
@ -4687,7 +4687,7 @@ static psa_status_t psa_aead_setup(psa_aead_operation_t *operation,
operation->key_type = psa_get_key_type(&attributes); operation->key_type = psa_get_key_type(&attributes);
exit: exit:
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
if (status == PSA_SUCCESS) { if (status == PSA_SUCCESS) {
status = unlock_status; status = unlock_status;
@ -7061,7 +7061,7 @@ psa_status_t psa_key_derivation_input_key(
slot->key.data, slot->key.data,
slot->key.bytes); slot->key.bytes);
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
return (status == PSA_SUCCESS) ? unlock_status : status; return (status == PSA_SUCCESS) ? unlock_status : status;
} }
@ -7218,7 +7218,7 @@ psa_status_t psa_key_derivation_key_agreement(psa_key_derivation_operation_t *op
} }
} }
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
return (status == PSA_SUCCESS) ? unlock_status : status; return (status == PSA_SUCCESS) ? unlock_status : status;
} }
@ -7953,7 +7953,7 @@ exit:
if (status != PSA_SUCCESS) { if (status != PSA_SUCCESS) {
psa_pake_abort(operation); psa_pake_abort(operation);
} }
unlock_status = psa_unregister_read(slot); unlock_status = psa_unregister_read_under_mutex(slot);
return (status == PSA_SUCCESS) ? unlock_status : status; return (status == PSA_SUCCESS) ? unlock_status : status;
} }