From 73feaf2682b63b7c405c0360c26f3e066c2f465a Mon Sep 17 00:00:00 2001 From: Ryan Everett Date: Wed, 14 Feb 2024 11:36:41 +0000 Subject: [PATCH] Comment on locking strategy in psa_fail_key_creation Signed-off-by: Ryan Everett --- library/psa_crypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 5300126c36..67f6eac6f0 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1900,6 +1900,9 @@ static void psa_fail_key_creation(psa_key_slot_t *slot, } #if defined(MBEDTLS_THREADING_C) + /* If the lock operation fails we still wipe the slot. + * Operations will no longer work after a failed lock, + * but we still need to wipe the slot of confidential data. */ mbedtls_mutex_lock(&mbedtls_threading_key_slot_mutex); #endif