Reverting comments deleted in previous PR
Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 8312c07..a8f3674 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1000,6 +1000,13 @@
{
psa_status_t status = psa_remove_key_data_from_memory( slot );
+ /*
+ * As the return error code may not be handled in case of multiple errors,
+ * do our best to report an unexpected lock counter: if available call
+ * MBEDTLS_TEST_HOOK_TEST_ASSERT that may terminate execution (if called as
+ * part of the execution of a test suite this will stop the test suite
+ * execution).
+ */
if( slot->lock_count != 1 )
{
MBEDTLS_TEST_HOOK_TEST_ASSERT( slot->lock_count == 1 );