Increment the test step number when invalidating a key

This makes failure messages easier to understand.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-02-14 23:45:48 +01:00
parent 65048ad648
commit 6e0d5bd00d
2 changed files with 6 additions and 0 deletions

View File

@ -1467,6 +1467,7 @@ void register_key_smoke_test( int lifetime_arg,
( validate > 0 ? PSA_SUCCESS : PSA_ERROR_NOT_PERMITTED );
}
mbedtls_test_set_step( 1 );
PSA_ASSERT( psa_register_se_driver( MIN_DRIVER_LOCATION, &driver ) );
PSA_ASSERT( psa_crypto_init( ) );
@ -1496,6 +1497,7 @@ void register_key_smoke_test( int lifetime_arg,
PSA_ASSERT( psa_purge_key( id ) );
/* Restart and try again. */
mbedtls_test_set_step( 2 );
PSA_SESSION_DONE( );
PSA_ASSERT( psa_register_se_driver( location, &driver ) );
PSA_ASSERT( psa_crypto_init( ) );

View File

@ -123,6 +123,7 @@ void transient_slot_lifecycle( int owner_id_arg,
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
mbedtls_test_set_step( 1 );
PSA_ASSERT( psa_crypto_init( ) );
/* Import a key. */
@ -169,6 +170,7 @@ void transient_slot_lifecycle( int owner_id_arg,
psa_reset_key_attributes( &attributes );
/* Do something that invalidates the key. */
mbedtls_test_set_step( 2 );
if( ! invalidate_key( invalidate_method, key ) )
goto exit;
if( ! invalidate_psa( invalidate_method ) )
@ -218,6 +220,7 @@ void persistent_slot_lifecycle( int lifetime_arg, int owner_id_arg, int id_arg,
TEST_USES_KEY_ID( id );
mbedtls_test_set_step( 1 );
PSA_ASSERT( psa_crypto_init( ) );
psa_set_key_id( &attributes, id );
@ -267,6 +270,7 @@ void persistent_slot_lifecycle( int lifetime_arg, int owner_id_arg, int id_arg,
* Do something that wipes key data in volatile memory or destroy the
* key.
*/
mbedtls_test_set_step( 2 );
if( ! invalidate_key( invalidate_method, id ) )
goto exit;
if( ! invalidate_psa( invalidate_method ) )