diff --git a/library/psa_crypto.c b/library/psa_crypto.c index a8f36745c..3574b9842 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1002,10 +1002,11 @@ psa_status_t psa_wipe_key_slot( psa_key_slot_t *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). + * do our best to report an unexpected lock counter. Assert with + * MBEDTLS_TEST_HOOK_TEST_ASSERT that the lock counter is equal to one: + * if the MBEDTLS_TEST_HOOKS configuration option is enabled and the + * function is called as part of the execution of a test suite, the + * execution of the test suite is stopped in error if the assertion fails. */ if( slot->lock_count != 1 ) { diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c index 49e6b873b..a5c43b1b2 100644 --- a/library/psa_crypto_slot_management.c +++ b/library/psa_crypto_slot_management.c @@ -414,10 +414,11 @@ psa_status_t psa_unlock_key_slot( psa_key_slot_t *slot ) /* * As the return error code may not be handled in case of multiple errors, - * do our best to report if the lock counter is equal to zero: if available - * call MBEDTLS_TEST_HOOK_TEST_ASSERT that may terminate execution (if called - * as part of the execution of a unit test suite this will stop the test - * suite execution). + * do our best to report if the lock counter is equal to zero. Assert with + * MBEDTLS_TEST_HOOK_TEST_ASSERT that the lock counter is strictly greater + * than zero: if the MBEDTLS_TEST_HOOKS configuration option is enabled and + * the function is called as part of the execution of a test suite, the + * execution of the test suite is stopped in error if the assertion fails. */ MBEDTLS_TEST_HOOK_TEST_ASSERT( slot->lock_count > 0 ); return( PSA_ERROR_CORRUPTION_DETECTED );