diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 522fbae71f..8a8c37e008 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -192,7 +192,7 @@ psa_status_t mbedtls_test_record_status( psa_status_t status, * permissions of other usage policies * (like PSA_KEY_USAGE_SIGN_HASH involves PSA_KEY_USAGE_SIGN_MESSGAE). */ -psa_key_usage_t update_key_usage_flags( psa_key_usage_t usage_flags ); +psa_key_usage_t mbedtls_test_update_key_usage_flags( psa_key_usage_t usage_flags ); /** Skip a test case if the given key is a 192 bits AES key and the AES * implementation is at least partially provided by an accelerator or diff --git a/tests/src/psa_crypto_helpers.c b/tests/src/psa_crypto_helpers.c index 934b76bb84..d9d841abd5 100644 --- a/tests/src/psa_crypto_helpers.c +++ b/tests/src/psa_crypto_helpers.c @@ -114,7 +114,7 @@ psa_status_t mbedtls_test_record_status( psa_status_t status, } #endif /* defined(RECORD_PSA_STATUS_COVERAGE_LOG) */ -psa_key_usage_t update_key_usage_flags( psa_key_usage_t usage_flags ) +psa_key_usage_t mbedtls_test_update_key_usage_flags( psa_key_usage_t usage_flags ) { psa_key_usage_t updated_usage = usage_flags; diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index eee4334052..c5fa389c3e 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -323,7 +323,7 @@ void import_with_policy( int type_arg, PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) ); TEST_EQUAL( psa_get_key_type( &got_attributes ), type ); TEST_EQUAL( psa_get_key_usage_flags( &got_attributes ), - update_key_usage_flags( usage ) ); + mbedtls_test_update_key_usage_flags( usage ) ); TEST_EQUAL( psa_get_key_algorithm( &got_attributes ), alg ); ASSERT_NO_SLOT_NUMBER( &got_attributes ); @@ -711,9 +711,9 @@ void effective_key_attributes( int type_arg, int expected_type_arg, psa_key_usage_t expected_usage = expected_usage_arg; psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; - /* Check if all extended usage flags are deployed + /* Check if all implicit usage flags are deployed in the expected usage flags. */ - TEST_EQUAL( expected_usage, update_key_usage_flags( usage ) ); + TEST_EQUAL( expected_usage, mbedtls_test_update_key_usage_flags( usage ) ); PSA_ASSERT( psa_crypto_init( ) ); @@ -810,9 +810,10 @@ void mac_key_policy( int policy_usage_arg, psa_status_t expected_status = expected_status_arg; unsigned char mac[PSA_MAC_MAX_SIZE]; - /* Check if all extended usage flags are deployed + /* Check if all implicit usage flags are deployed in the expected usage flags. */ - TEST_EQUAL( expected_usage, update_key_usage_flags( policy_usage ) ); + TEST_EQUAL( expected_usage, + mbedtls_test_update_key_usage_flags( policy_usage ) ); PSA_ASSERT( psa_crypto_init( ) ); @@ -869,8 +870,9 @@ void cipher_key_policy( int policy_usage_arg, PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &key ) ); - /* Check if no key usage extension is done */ - TEST_EQUAL( policy_usage, update_key_usage_flags( policy_usage ) ); + /* Check if no key usage flag implication is done */ + TEST_EQUAL( policy_usage, + mbedtls_test_update_key_usage_flags( policy_usage ) ); status = psa_cipher_encrypt_setup( &operation, key, exercise_alg ); if( policy_alg == exercise_alg && @@ -927,8 +929,9 @@ void aead_key_policy( int policy_usage_arg, PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &key ) ); - /* Check if no key usage extension is done */ - TEST_EQUAL( policy_usage, update_key_usage_flags( policy_usage ) ); + /* Check if no key usage implication is done */ + TEST_EQUAL( policy_usage, + mbedtls_test_update_key_usage_flags( policy_usage ) ); status = psa_aead_encrypt( key, exercise_alg, nonce, nonce_length, @@ -986,8 +989,9 @@ void asymmetric_encryption_key_policy( int policy_usage_arg, PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &key ) ); - /* Check if no key usage extension is done */ - TEST_EQUAL( policy_usage, update_key_usage_flags( policy_usage ) ); + /* Check if no key usage implication is done */ + TEST_EQUAL( policy_usage, + mbedtls_test_update_key_usage_flags( policy_usage ) ); PSA_ASSERT( psa_get_key_attributes( key, &attributes ) ); key_bits = psa_get_key_bits( &attributes ); @@ -1057,9 +1061,10 @@ void asymmetric_signature_key_policy( int policy_usage_arg, unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = {0}; size_t signature_length; - /* Check if all extended usage flags are deployed + /* Check if all implicit usage flags are deployed in the expected usage flags. */ - TEST_EQUAL( expected_usage, update_key_usage_flags( policy_usage ) ); + TEST_EQUAL( expected_usage, + mbedtls_test_update_key_usage_flags( policy_usage ) ); PSA_ASSERT( psa_crypto_init( ) ); @@ -1223,8 +1228,8 @@ void key_policy_alg2( int key_type_arg, data_t *key_data, PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &key ) ); - /* Update the usage flags to obtain extended usage flags */ - usage = update_key_usage_flags( usage ); + /* Update the usage flags to obtain implicit usage flags */ + usage = mbedtls_test_update_key_usage_flags( usage ); PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) ); TEST_EQUAL( psa_get_key_usage_flags( &got_attributes ), usage ); TEST_EQUAL( psa_get_key_algorithm( &got_attributes ), alg ); @@ -5250,7 +5255,7 @@ void persistent_key_load_key_from_storage( data_t *data, TEST_EQUAL( psa_get_key_type( &attributes ), type ); TEST_EQUAL( psa_get_key_bits( &attributes ), bits ); TEST_EQUAL( psa_get_key_usage_flags( &attributes ), - update_key_usage_flags( usage_flags ) ); + mbedtls_test_update_key_usage_flags( usage_flags ) ); TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg ); /* Export the key again if permitted by the key policy. */ diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index 8a9e25a194..aa3ce28f24 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -243,7 +243,7 @@ void persistent_slot_lifecycle( int lifetime_arg, int owner_id_arg, int id_arg, TEST_ASSERT( mbedtls_svc_key_id_equal( psa_get_key_id( &attributes ), id ) ); TEST_EQUAL( psa_get_key_usage_flags( &attributes ), - update_key_usage_flags( usage_flags ) ); + mbedtls_test_update_key_usage_flags( usage_flags ) ); TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg ); TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ), alg2 ); TEST_EQUAL( psa_get_key_type( &attributes ), type ); @@ -263,7 +263,7 @@ void persistent_slot_lifecycle( int lifetime_arg, int owner_id_arg, int id_arg, TEST_ASSERT( mbedtls_svc_key_id_equal( psa_get_key_id( &attributes ), id ) ); TEST_EQUAL( psa_get_key_usage_flags( &attributes ), - update_key_usage_flags( usage_flags ) ); + mbedtls_test_update_key_usage_flags( usage_flags ) ); TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg ); TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ), alg2 ); TEST_EQUAL( psa_get_key_type( &attributes ), type ); @@ -296,7 +296,7 @@ void persistent_slot_lifecycle( int lifetime_arg, int owner_id_arg, int id_arg, psa_get_key_id( &attributes ), psa_get_key_id( &read_attributes ) ) ); TEST_EQUAL( psa_get_key_usage_flags( &attributes ), - update_key_usage_flags( usage_flags ) ); + mbedtls_test_update_key_usage_flags( usage_flags ) ); TEST_EQUAL( psa_get_key_algorithm( &attributes ), psa_get_key_algorithm( &read_attributes ) ); TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ),