From ff03fd62134122884230611fffea0faa2ded736d Mon Sep 17 00:00:00 2001 From: gabor-mezei-arm Date: Mon, 28 Jun 2021 14:05:00 +0200 Subject: [PATCH] Rename function to conform to the library Signed-off-by: gabor-mezei-arm --- tests/include/test/psa_crypto_helpers.h | 2 +- tests/src/psa_crypto_helpers.c | 2 +- tests/suites/test_suite_psa_crypto.function | 37 +++++++++++-------- ..._suite_psa_crypto_slot_management.function | 6 +-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 522fbae71..8a8c37e00 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 934b76bb8..d9d841abd 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 e6d03b5ad..dce53a501 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -379,7 +379,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 ); @@ -767,9 +767,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( ) ); @@ -866,9 +866,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( ) ); @@ -925,8 +926,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 && @@ -983,8 +985,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, @@ -1042,8 +1045,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 ); @@ -1113,9 +1117,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( ) ); @@ -1279,8 +1284,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 ); @@ -5298,7 +5303,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 8a9e25a19..aa3ce28f2 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 ),