Reverting comments deleted in previous PR

Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com>
This commit is contained in:
TRodziewicz 2021-07-13 12:19:15 +02:00
parent 7871c2e736
commit 18cddc08c7
2 changed files with 14 additions and 0 deletions

View file

@ -1000,6 +1000,13 @@ psa_status_t psa_wipe_key_slot( psa_key_slot_t *slot )
{
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 );

View file

@ -412,6 +412,13 @@ psa_status_t psa_unlock_key_slot( psa_key_slot_t *slot )
return( PSA_SUCCESS );
}
/*
* 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).
*/
MBEDTLS_TEST_HOOK_TEST_ASSERT( slot->lock_count > 0 );
return( PSA_ERROR_CORRUPTION_DETECTED );
}