From 6e0d5bd00d84944a66353c26cc80b4cce7559337 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sun, 14 Feb 2021 23:45:48 +0100 Subject: [PATCH] Increment the test step number when invalidating a key This makes failure messages easier to understand. Signed-off-by: Gilles Peskine --- tests/suites/test_suite_psa_crypto_se_driver_hal.function | 2 ++ tests/suites/test_suite_psa_crypto_slot_management.function | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.function b/tests/suites/test_suite_psa_crypto_se_driver_hal.function index 11b8866a6..79d658fd0 100644 --- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function +++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function @@ -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( ) ); diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index 7d3c7a838..bafb7d8bf 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -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 ) )