From 0540fe74e3ac2ed08fd628e7a79ebbab547065c3 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Thu, 27 Jul 2023 14:17:27 +0100 Subject: [PATCH] Fix code style Signed-off-by: Tom Cosgrove --- tests/suites/test_suite_aria.function | 16 ++-- tests/suites/test_suite_asn1write.function | 8 +- tests/suites/test_suite_bignum_core.function | 5 +- tests/suites/test_suite_bignum_mod.function | 2 +- .../suites/test_suite_bignum_mod_raw.function | 4 +- .../suites/test_suite_bignum_random.function | 12 +-- tests/suites/test_suite_chacha20.function | 6 +- tests/suites/test_suite_ecp.function | 8 +- tests/suites/test_suite_hkdf.function | 2 +- tests/suites/test_suite_lmots.function | 4 +- tests/suites/test_suite_lms.function | 4 +- tests/suites/test_suite_mps.function | 4 +- tests/suites/test_suite_pkcs12.function | 2 +- tests/suites/test_suite_pkwrite.function | 4 +- tests/suites/test_suite_poly1305.function | 8 +- tests/suites/test_suite_psa_crypto.function | 78 +++++++++---------- ..._suite_psa_crypto_driver_wrappers.function | 54 ++++++------- .../test_suite_psa_crypto_hash.function | 6 +- .../test_suite_psa_crypto_pake.function | 2 +- ...t_suite_psa_crypto_persistent_key.function | 4 +- ...st_suite_psa_crypto_se_driver_hal.function | 2 +- ..._suite_psa_crypto_slot_management.function | 16 ++-- ...t_suite_psa_crypto_storage_format.function | 4 +- tests/suites/test_suite_psa_its.function | 4 +- tests/suites/test_suite_ssl.function | 52 ++++++------- 25 files changed, 156 insertions(+), 155 deletions(-) diff --git a/tests/suites/test_suite_aria.function b/tests/suites/test_suite_aria.function index daac983189..579dddf3bb 100644 --- a/tests/suites/test_suite_aria.function +++ b/tests/suites/test_suite_aria.function @@ -78,7 +78,7 @@ void aria_encrypt_ecb(data_t *key_str, data_t *src_str, } TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); } exit: @@ -106,7 +106,7 @@ void aria_decrypt_ecb(data_t *key_str, data_t *src_str, } TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); } exit: @@ -131,7 +131,7 @@ void aria_encrypt_cbc(data_t *key_str, data_t *iv_str, output) == cbc_result); if (cbc_result == 0) { TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); } exit: @@ -156,7 +156,7 @@ void aria_decrypt_cbc(data_t *key_str, data_t *iv_str, output) == cbc_result); if (cbc_result == 0) { TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); } exit: @@ -183,7 +183,7 @@ void aria_encrypt_cfb128(data_t *key_str, data_t *iv_str, == result); TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); exit: mbedtls_aria_free(&ctx); @@ -209,7 +209,7 @@ void aria_decrypt_cfb128(data_t *key_str, data_t *iv_str, == result); TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); exit: mbedtls_aria_free(&ctx); @@ -235,7 +235,7 @@ void aria_encrypt_ctr(data_t *key_str, data_t *iv_str, == result); TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); exit: mbedtls_aria_free(&ctx); @@ -261,7 +261,7 @@ void aria_decrypt_ctr(data_t *key_str, data_t *iv_str, == result); TEST_MEMORY_COMPARE(output, expected_output->len, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); exit: mbedtls_aria_free(&ctx); diff --git a/tests/suites/test_suite_asn1write.function b/tests/suites/test_suite_asn1write.function index f92c751ebd..a7330d0892 100644 --- a/tests/suites/test_suite_asn1write.function +++ b/tests/suites/test_suite_asn1write.function @@ -38,7 +38,7 @@ int generic_write_finish_step(generic_write_data_t *data, TEST_ASSERT(data->p >= data->start); TEST_ASSERT(data->p <= data->end); TEST_MEMORY_COMPARE(data->p, (size_t) (data->end - data->p), - expected->x, expected->len); + expected->x, expected->len); } ok = 1; @@ -441,7 +441,7 @@ void test_asn1_write_bitstrings(data_t *bitstring, int bits, TEST_EQUAL(mbedtls_asn1_get_bitstring(&data.p, data.end, &read), 0); TEST_MEMORY_COMPARE(read.p, read.len, - masked_bitstring, byte_length); + masked_bitstring, byte_length); TEST_EQUAL(read.unused_bits, 8 * byte_length - value_bits); } #endif /* MBEDTLS_ASN1_PARSE_C */ @@ -546,7 +546,7 @@ void store_named_data_val_found(int old_len, int new_len) if (new_val != NULL) { TEST_MEMORY_COMPARE(found->val.p, found->val.len, - new_val, (size_t) new_len); + new_val, (size_t) new_len); } if (new_len == 0) { TEST_ASSERT(found->val.p == NULL); @@ -588,7 +588,7 @@ void store_named_data_val_new(int new_len, int set_new_val) } else { TEST_ASSERT(found->val.p != new_val); TEST_MEMORY_COMPARE(found->val.p, found->val.len, - new_val, (size_t) new_len); + new_val, (size_t) new_len); } exit: diff --git a/tests/suites/test_suite_bignum_core.function b/tests/suites/test_suite_bignum_core.function index 79f540bcbe..3ede6b208d 100644 --- a/tests/suites/test_suite_bignum_core.function +++ b/tests/suites/test_suite_bignum_core.function @@ -1047,7 +1047,7 @@ void mpi_core_ct_uint_table_lookup(int bitlen, int window_size) TEST_CF_PUBLIC(dest, limbs * sizeof(*dest)); TEST_CF_PUBLIC(table, count * limbs * sizeof(*table)); TEST_MEMORY_COMPARE(dest, limbs * sizeof(*dest), - current, limbs * sizeof(*current)); + current, limbs * sizeof(*current)); TEST_CF_PUBLIC(&i, sizeof(i)); } @@ -1280,7 +1280,8 @@ void mpi_core_sub_int(char *input_A, char *input_B, TEST_CALLOC(R, limbs); #define TEST_COMPARE_CORE_MPIS(A, B, limbs) \ - TEST_MEMORY_COMPARE(A, (limbs) * sizeof(mbedtls_mpi_uint), B, (limbs) * sizeof(mbedtls_mpi_uint)) + TEST_MEMORY_COMPARE(A, (limbs) * sizeof(mbedtls_mpi_uint), \ + B, (limbs) * sizeof(mbedtls_mpi_uint)) /* 1. R = A - b. Result and borrow should be correct */ TEST_EQUAL(mbedtls_mpi_core_sub_int(R, A, B[0], limbs), borrow); diff --git a/tests/suites/test_suite_bignum_mod.function b/tests/suites/test_suite_bignum_mod.function index 10deffa974..70152845b6 100644 --- a/tests/suites/test_suite_bignum_mod.function +++ b/tests/suites/test_suite_bignum_mod.function @@ -8,7 +8,7 @@ #define TEST_COMPARE_MPI_RESIDUES(a, b) \ TEST_MEMORY_COMPARE((a).p, (a).limbs * sizeof(mbedtls_mpi_uint), \ - (b).p, (b).limbs * sizeof(mbedtls_mpi_uint)) + (b).p, (b).limbs * sizeof(mbedtls_mpi_uint)) static int test_read_residue(mbedtls_mpi_mod_residue *r, const mbedtls_mpi_mod_modulus *m, diff --git a/tests/suites/test_suite_bignum_mod_raw.function b/tests/suites/test_suite_bignum_mod_raw.function index 3a4d4416df..6b953f5713 100644 --- a/tests/suites/test_suite_bignum_mod_raw.function +++ b/tests/suites/test_suite_bignum_mod_raw.function @@ -648,7 +648,7 @@ void mpi_mod_raw_canonical_to_modulus_rep(const char *input_N, int rep, TEST_EQUAL(0, mbedtls_mpi_mod_raw_canonical_to_modulus_rep(A, &N)); TEST_MEMORY_COMPARE(A, A_limbs * sizeof(mbedtls_mpi_uint), - X, X_limbs * sizeof(mbedtls_mpi_uint)); + X, X_limbs * sizeof(mbedtls_mpi_uint)); exit: mbedtls_test_mpi_mod_modulus_free_with_limbs(&N); @@ -675,7 +675,7 @@ void mpi_mod_raw_modulus_to_canonical_rep(const char *input_N, int rep, TEST_EQUAL(0, mbedtls_mpi_mod_raw_modulus_to_canonical_rep(A, &N)); TEST_MEMORY_COMPARE(A, A_limbs * sizeof(mbedtls_mpi_uint), - X, X_limbs * sizeof(mbedtls_mpi_uint)); + X, X_limbs * sizeof(mbedtls_mpi_uint)); exit: mbedtls_test_mpi_mod_modulus_free_with_limbs(&N); diff --git a/tests/suites/test_suite_bignum_random.function b/tests/suites/test_suite_bignum_random.function index f7025d4d50..9ea773c4e3 100644 --- a/tests/suites/test_suite_bignum_random.function +++ b/tests/suites/test_suite_bignum_random.function @@ -175,7 +175,7 @@ void mpi_legacy_random_values(int min, char *max_hex) TEST_EQUAL(core_ret, legacy_ret); if (core_ret == 0) { TEST_MEMORY_COMPARE(R_core, limbs * ciL, - R_legacy.p, R_legacy.n * ciL); + R_legacy.p, R_legacy.n * ciL); } /* Also check that they have consumed the RNG in the same way. */ @@ -183,7 +183,7 @@ void mpi_legacy_random_values(int min, char *max_hex) * the structure! If this is a problem in practice, change to a * field-by-field comparison. */ TEST_MEMORY_COMPARE(&rnd_core, sizeof(rnd_core), - &rnd_legacy, sizeof(rnd_legacy)); + &rnd_legacy, sizeof(rnd_legacy)); exit: mbedtls_mpi_free(&max_legacy); @@ -238,11 +238,11 @@ void mpi_mod_random_values(int min, char *max_hex, int rep) TEST_EQUAL(mbedtls_mpi_mod_raw_modulus_to_canonical_rep(R_mod_raw, &N), 0); TEST_MEMORY_COMPARE(R_core, N.limbs * ciL, - R_mod_raw, N.limbs * ciL); + R_mod_raw, N.limbs * ciL); TEST_EQUAL(mbedtls_mpi_mod_raw_modulus_to_canonical_rep(R_mod_digits, &N), 0); TEST_MEMORY_COMPARE(R_core, N.limbs * ciL, - R_mod_digits, N.limbs * ciL); + R_mod_digits, N.limbs * ciL); } /* Also check that they have consumed the RNG in the same way. */ @@ -250,9 +250,9 @@ void mpi_mod_random_values(int min, char *max_hex, int rep) * the structure! If this is a problem in practice, change to a * field-by-field comparison. */ TEST_MEMORY_COMPARE(&rnd_core, sizeof(rnd_core), - &rnd_mod_raw, sizeof(rnd_mod_raw)); + &rnd_mod_raw, sizeof(rnd_mod_raw)); TEST_MEMORY_COMPARE(&rnd_core, sizeof(rnd_core), - &rnd_mod, sizeof(rnd_mod)); + &rnd_mod, sizeof(rnd_mod)); exit: mbedtls_test_mpi_mod_modulus_free_with_limbs(&N); diff --git a/tests/suites/test_suite_chacha20.function b/tests/suites/test_suite_chacha20.function index a638213ff4..d6b67e12f2 100644 --- a/tests/suites/test_suite_chacha20.function +++ b/tests/suites/test_suite_chacha20.function @@ -30,7 +30,7 @@ void chacha20_crypt(data_t *key_str, output) == 0); TEST_MEMORY_COMPARE(output, expected_output_str->len, - expected_output_str->x, expected_output_str->len); + expected_output_str->x, expected_output_str->len); /* * Test the streaming API @@ -45,7 +45,7 @@ void chacha20_crypt(data_t *key_str, TEST_ASSERT(mbedtls_chacha20_update(&ctx, src_str->len, src_str->x, output) == 0); TEST_MEMORY_COMPARE(output, expected_output_str->len, - expected_output_str->x, expected_output_str->len); + expected_output_str->x, expected_output_str->len); /* * Test the streaming API again, piecewise @@ -61,7 +61,7 @@ void chacha20_crypt(data_t *key_str, src_str->x + 1, output + 1) == 0); TEST_MEMORY_COMPARE(output, expected_output_str->len, - expected_output_str->x, expected_output_str->len); + expected_output_str->x, expected_output_str->len); mbedtls_chacha20_free(&ctx); } diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index 93138bdc65..8a1a23343f 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -539,7 +539,7 @@ void ecp_muladd(int id, TEST_ASSERT(len <= MBEDTLS_ECP_MAX_PT_LEN); TEST_MEMORY_COMPARE(expected_result->x, expected_result->len, - actual_result, len); + actual_result, len); exit: mbedtls_ecp_group_free(&grp); @@ -1062,7 +1062,7 @@ void mbedtls_ecp_read_key(int grp_id, data_t *in_key, int expected, int canonica TEST_ASSERT(ret == 0); TEST_MEMORY_COMPARE(in_key->x, in_key->len, - buf, in_key->len); + buf, in_key->len); } else { unsigned char export1[MBEDTLS_ECP_MAX_BYTES]; unsigned char export2[MBEDTLS_ECP_MAX_BYTES]; @@ -1077,7 +1077,7 @@ void mbedtls_ecp_read_key(int grp_id, data_t *in_key, int expected, int canonica TEST_ASSERT(ret == 0); TEST_MEMORY_COMPARE(export1, in_key->len, - export2, in_key->len); + export2, in_key->len); } } @@ -1124,7 +1124,7 @@ void genkey_mx_known_answer(int bits, data_t *seed, data_t *expected) * - Other bits must be random (by testing with different RNG outputs, * we validate that those bits are indeed influenced by the RNG). */ TEST_MEMORY_COMPARE(expected->x, expected->len, - actual, expected->len); + actual, expected->len); } exit: diff --git a/tests/suites/test_suite_hkdf.function b/tests/suites/test_suite_hkdf.function index b3ccfb030f..becf672778 100644 --- a/tests/suites/test_suite_hkdf.function +++ b/tests/suites/test_suite_hkdf.function @@ -27,7 +27,7 @@ void test_hkdf(int md_alg, data_t *ikm, data_t *salt, data_t *info, TEST_ASSERT(ret == 0); TEST_MEMORY_COMPARE(okm, expected_okm->len, - expected_okm->x, expected_okm->len); + expected_okm->x, expected_okm->len); exit: MD_PSA_DONE(); diff --git a/tests/suites/test_suite_lmots.function b/tests/suites/test_suite_lmots.function index e991672a7f..293287aab9 100644 --- a/tests/suites/test_suite_lmots.function +++ b/tests/suites/test_suite_lmots.function @@ -163,7 +163,7 @@ void lmots_import_export_test(data_t *pub_key, int expected_import_rc) TEST_EQUAL(exported_pub_key_size, MBEDTLS_LMOTS_PUBLIC_KEY_LEN(MBEDTLS_LMOTS_SHA256_N32_W8)); TEST_MEMORY_COMPARE(pub_key->x, pub_key->len, - exported_pub_key, exported_pub_key_size); + exported_pub_key, exported_pub_key_size); mbedtls_free(exported_pub_key); exported_pub_key = NULL; @@ -184,7 +184,7 @@ void lmots_import_export_test(data_t *pub_key, int expected_import_rc) &exported_pub_key_size), 0); TEST_MEMORY_COMPARE(pub_key->x, pub_key->len, - exported_pub_key, exported_pub_key_size); + exported_pub_key, exported_pub_key_size); mbedtls_free(exported_pub_key); exported_pub_key = NULL; } diff --git a/tests/suites/test_suite_lms.function b/tests/suites/test_suite_lms.function index f6f4685c8c..7116f61810 100644 --- a/tests/suites/test_suite_lms.function +++ b/tests/suites/test_suite_lms.function @@ -165,7 +165,7 @@ void lms_import_export_test(data_t *pub_key, int expected_import_rc) TEST_EQUAL(exported_pub_key_size, MBEDTLS_LMS_PUBLIC_KEY_LEN(MBEDTLS_LMS_SHA256_M32_H10)); TEST_MEMORY_COMPARE(pub_key->x, pub_key->len, - exported_pub_key, exported_pub_key_size); + exported_pub_key, exported_pub_key_size); mbedtls_free(exported_pub_key); exported_pub_key = NULL; @@ -186,7 +186,7 @@ void lms_import_export_test(data_t *pub_key, int expected_import_rc) &exported_pub_key_size), 0); TEST_MEMORY_COMPARE(pub_key->x, pub_key->len, - exported_pub_key, exported_pub_key_size); + exported_pub_key, exported_pub_key_size); mbedtls_free(exported_pub_key); exported_pub_key = NULL; } diff --git a/tests/suites/test_suite_mps.function b/tests/suites/test_suite_mps.function index 7d48452251..0b8434b7c1 100644 --- a/tests/suites/test_suite_mps.function +++ b/tests/suites/test_suite_mps.function @@ -611,8 +611,8 @@ void mbedtls_mps_reader_reclaim_data_left(int option) TEST_ASSERT(mbedtls_mps_reader_get(&rd, sizeof(buf) / 2, &tmp, NULL) == 0); TEST_MEMORY_COMPARE(tmp, sizeof(buf) / 2, - buf + sizeof(buf) / 2, - sizeof(buf) / 2); + buf + sizeof(buf) / 2, + sizeof(buf) / 2); break; default: diff --git a/tests/suites/test_suite_pkcs12.function b/tests/suites/test_suite_pkcs12.function index 46d683af21..2c93c1380a 100644 --- a/tests/suites/test_suite_pkcs12.function +++ b/tests/suites/test_suite_pkcs12.function @@ -60,7 +60,7 @@ void pkcs12_derive_key(int md_type, int key_size_arg, if (expected_status == 0) { TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output_data, key_size); + output_data, key_size); } exit: diff --git a/tests/suites/test_suite_pkwrite.function b/tests/suites/test_suite_pkwrite.function index 8176b6dfe6..e1be52ef4e 100644 --- a/tests/suites/test_suite_pkwrite.function +++ b/tests/suites/test_suite_pkwrite.function @@ -191,7 +191,7 @@ void pk_write_public_from_private(char *priv_key_file, char *pub_key_file) derived_key_len), pub_key_len); TEST_MEMORY_COMPARE(derived_key_raw, derived_key_len, - pub_key_raw, pub_key_len); + pub_key_raw, pub_key_len); #if defined(MBEDTLS_USE_PSA_CRYPTO) mbedtls_platform_zeroize(derived_key_raw, sizeof(derived_key_raw)); @@ -204,7 +204,7 @@ void pk_write_public_from_private(char *priv_key_file, char *pub_key_file) derived_key_len), pub_key_len); TEST_MEMORY_COMPARE(derived_key_raw, derived_key_len, - pub_key_raw, pub_key_len); + pub_key_raw, pub_key_len); #endif /* MBEDTLS_USE_PSA_CRYPTO */ exit: diff --git a/tests/suites/test_suite_poly1305.function b/tests/suites/test_suite_poly1305.function index 07cc93bb74..dbf817e916 100644 --- a/tests/suites/test_suite_poly1305.function +++ b/tests/suites/test_suite_poly1305.function @@ -23,7 +23,7 @@ void mbedtls_poly1305(data_t *key, data_t *expected_mac, data_t *src_str) src_str->len, mac) == 0); TEST_MEMORY_COMPARE(mac, expected_mac->len, - expected_mac->x, expected_mac->len); + expected_mac->x, expected_mac->len); /* * Test the streaming API @@ -37,7 +37,7 @@ void mbedtls_poly1305(data_t *key, data_t *expected_mac, data_t *src_str) TEST_ASSERT(mbedtls_poly1305_finish(&ctx, mac) == 0); TEST_MEMORY_COMPARE(mac, expected_mac->len, - expected_mac->x, expected_mac->len); + expected_mac->x, expected_mac->len); /* * Test the streaming API again, piecewise @@ -54,7 +54,7 @@ void mbedtls_poly1305(data_t *key, data_t *expected_mac, data_t *src_str) TEST_ASSERT(mbedtls_poly1305_finish(&ctx, mac) == 0); TEST_MEMORY_COMPARE(mac, expected_mac->len, - expected_mac->x, expected_mac->len); + expected_mac->x, expected_mac->len); } /* @@ -70,7 +70,7 @@ void mbedtls_poly1305(data_t *key, data_t *expected_mac, data_t *src_str) TEST_ASSERT(mbedtls_poly1305_finish(&ctx, mac) == 0); TEST_MEMORY_COMPARE(mac, expected_mac->len, - expected_mac->x, expected_mac->len); + expected_mac->x, expected_mac->len); } mbedtls_poly1305_free(&ctx); diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index a58e48be65..2182ad010e 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -584,7 +584,7 @@ static int aead_multipart_internal_func(int key_type_arg, data_t *key_data, TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output_data, output_length); + output_data, output_length); test_ok = 1; @@ -693,7 +693,7 @@ static int mac_multipart_internal_func(int key_type_arg, data_t *key_data, PSA_MAC_MAX_SIZE, &mac_len)); TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - mac, mac_len); + mac, mac_len); } test_ok = 1; @@ -1584,7 +1584,7 @@ void import_export(data_t *data, export_size, &reexported_length)); TEST_MEMORY_COMPARE(exported, exported_length, - reexported, reexported_length); + reexported, reexported_length); PSA_ASSERT(psa_destroy_key(key2)); } TEST_LE_U(exported_length, @@ -1658,7 +1658,7 @@ void import_export_public_key(data_t *data, TEST_LE_U(expected_public_key->len, PSA_EXPORT_PUBLIC_KEY_MAX_SIZE); TEST_MEMORY_COMPARE(expected_public_key->x, expected_public_key->len, - exported, exported_length); + exported, exported_length); } exit: /* @@ -2502,7 +2502,7 @@ void copy_success(int source_usage_arg, PSA_ASSERT(psa_export_key(target_key, export_buffer, material->len, &length)); TEST_MEMORY_COMPARE(material->x, material->len, - export_buffer, length); + export_buffer, length); } if (!psa_key_lifetime_is_external(target_lifetime)) { @@ -2761,7 +2761,7 @@ void hash_compute_compare(int alg_arg, data_t *input, &output_length)); TEST_EQUAL(output_length, PSA_HASH_LENGTH(alg)); TEST_MEMORY_COMPARE(output, output_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); /* Compute with tight buffer, multi-part */ PSA_ASSERT(psa_hash_setup(&operation, alg)); @@ -2771,7 +2771,7 @@ void hash_compute_compare(int alg_arg, data_t *input, &output_length)); TEST_EQUAL(output_length, PSA_HASH_LENGTH(alg)); TEST_MEMORY_COMPARE(output, output_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); /* Compute with larger buffer, one-shot */ PSA_ASSERT(psa_hash_compute(alg, input->x, input->len, @@ -2779,7 +2779,7 @@ void hash_compute_compare(int alg_arg, data_t *input, &output_length)); TEST_EQUAL(output_length, PSA_HASH_LENGTH(alg)); TEST_MEMORY_COMPARE(output, output_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); /* Compute with larger buffer, multi-part */ PSA_ASSERT(psa_hash_setup(&operation, alg)); @@ -2788,7 +2788,7 @@ void hash_compute_compare(int alg_arg, data_t *input, sizeof(output), &output_length)); TEST_EQUAL(output_length, PSA_HASH_LENGTH(alg)); TEST_MEMORY_COMPARE(output, output_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); /* Compare with correct hash, one-shot */ PSA_ASSERT(psa_hash_compare(alg, input->x, input->len, @@ -3393,7 +3393,7 @@ void mac_sign(int key_type_arg, expected_status); if (expected_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_mac->x, expected_mac->len, - actual_mac, mac_length); + actual_mac, mac_length); } if (output_size > 0) { @@ -3412,7 +3412,7 @@ void mac_sign(int key_type_arg, if (expected_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_mac->x, expected_mac->len, - actual_mac, mac_length); + actual_mac, mac_length); } mbedtls_free(actual_mac); actual_mac = NULL; @@ -3963,7 +3963,7 @@ void cipher_alg_without_iv(int alg_arg, int key_type_arg, data_t *key_data, &length)); output_length += length; TEST_MEMORY_COMPARE(ciphertext->x, ciphertext->len, - output, output_length); + output, output_length); /* Multipart encryption */ PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg)); @@ -3981,7 +3981,7 @@ void cipher_alg_without_iv(int alg_arg, int key_type_arg, data_t *key_data, &length)); output_length += length; TEST_MEMORY_COMPARE(plaintext->x, plaintext->len, - output, output_length); + output, output_length); /* One-shot encryption */ output_length = ~0; @@ -3989,7 +3989,7 @@ void cipher_alg_without_iv(int alg_arg, int key_type_arg, data_t *key_data, output, output_buffer_size, &output_length)); TEST_MEMORY_COMPARE(ciphertext->x, ciphertext->len, - output, output_length); + output, output_length); /* One-shot decryption */ output_length = ~0; @@ -3997,7 +3997,7 @@ void cipher_alg_without_iv(int alg_arg, int key_type_arg, data_t *key_data, output, output_buffer_size, &output_length)); TEST_MEMORY_COMPARE(plaintext->x, plaintext->len, - output, output_length); + output, output_length); exit: PSA_ASSERT(psa_cipher_abort(&operation)); @@ -4117,7 +4117,7 @@ void cipher_encrypt_validation(int alg_arg, PSA_ASSERT(psa_cipher_abort(&operation)); TEST_MEMORY_COMPARE(output1 + iv_size, output1_length - iv_size, - output2, output2_length); + output2, output2_length); exit: psa_cipher_abort(&operation); @@ -4216,7 +4216,7 @@ void cipher_encrypt_multipart(int alg_arg, int key_type_arg, PSA_ASSERT(psa_cipher_abort(&operation)); TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output, total_output_length); + output, total_output_length); } exit: @@ -4316,7 +4316,7 @@ void cipher_decrypt_multipart(int alg_arg, int key_type_arg, PSA_ASSERT(psa_cipher_abort(&operation)); TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output, total_output_length); + output, total_output_length); } exit: @@ -4473,7 +4473,7 @@ void cipher_decrypt(int alg_arg, PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(input_buffer_size)); TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output, output_length); + output, output_length); exit: mbedtls_free(input); mbedtls_free(output); @@ -4765,7 +4765,7 @@ void aead_encrypt_decrypt(int key_type_arg, data_t *key_data, expected_result); TEST_MEMORY_COMPARE(input_data->x, input_data->len, - output_data2, output_length2); + output_data2, output_length2); } exit: @@ -4832,7 +4832,7 @@ void aead_encrypt(int key_type_arg, data_t *key_data, PSA_ASSERT(status); TEST_MEMORY_COMPARE(expected_result->x, expected_result->len, - output_data, output_length); + output_data, output_length); exit: psa_destroy_key(key); @@ -4905,7 +4905,7 @@ void aead_decrypt(int key_type_arg, data_t *key_data, if (expected_result == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_data->x, expected_data->len, - output_data, output_length); + output_data, output_length); } exit: @@ -6492,7 +6492,7 @@ void sign_hash_deterministic(int key_type_arg, data_t *key_data, &signature_length)); /* Verify that the signature is what is expected. */ TEST_MEMORY_COMPARE(output_data->x, output_data->len, - signature, signature_length); + signature, signature_length); exit: /* @@ -6615,7 +6615,7 @@ void sign_hash_interruptible(int key_type_arg, data_t *key_data, /* Verify that the signature is what is expected. */ TEST_MEMORY_COMPARE(output_data->x, output_data->len, - signature, signature_length); + signature, signature_length); PSA_ASSERT(psa_sign_hash_abort(&operation)); @@ -7913,7 +7913,7 @@ void sign_message_deterministic(int key_type_arg, &signature_length)); TEST_MEMORY_COMPARE(output_data->x, output_data->len, - signature, signature_length); + signature, signature_length); exit: psa_reset_key_attributes(&attributes); @@ -8251,7 +8251,7 @@ void asymmetric_encrypt_decrypt(int key_type_arg, output2, output2_size, &output2_length)); TEST_MEMORY_COMPARE(input_data->x, input_data->len, - output2, output2_length); + output2, output2_length); exit: /* @@ -8308,7 +8308,7 @@ void asymmetric_decrypt(int key_type_arg, output_size, &output_length)); TEST_MEMORY_COMPARE(expected_data->x, expected_data->len, - output, output_length); + output, output_length); /* If the label is empty, the test framework puts a non-null pointer * in label->x. Test that a null pointer works as well. */ @@ -8324,7 +8324,7 @@ void asymmetric_decrypt(int key_type_arg, output_size, &output_length)); TEST_MEMORY_COMPARE(expected_data->x, expected_data->len, - output, output_length); + output, output_length); } exit: @@ -8893,7 +8893,7 @@ void derive_output(int alg_arg, PSA_ASSERT(status); if (output_sizes[i] != 0) { TEST_MEMORY_COMPARE(output_buffer, output_sizes[i], - expected_outputs[i], output_sizes[i]); + expected_outputs[i], output_sizes[i]); } /* Check the operation status. */ expected_capacity -= output_sizes[i]; @@ -9016,7 +9016,7 @@ void derive_ecjpake_to_pms(data_t *input, int expected_input_status_arg, TEST_EQUAL(status, expected_output_status); if (expected_output->len != 0 && expected_output_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(output_buffer, expected_output->len, expected_output->x, - expected_output->len); + expected_output->len); } exit: @@ -9168,7 +9168,7 @@ void derive_key_export(int alg_arg, /* Compare the outputs from the two runs. */ TEST_MEMORY_COMPARE(output_buffer, bytes1 + bytes2, - export_buffer, capacity); + export_buffer, capacity); exit: mbedtls_free(output_buffer); @@ -9229,7 +9229,7 @@ void derive_key_type(int alg_arg, export_buffer, export_buffer_size, &export_length)); TEST_MEMORY_COMPARE(export_buffer, export_length, - expected_export->x, expected_export->len); + expected_export->x, expected_export->len); exit: mbedtls_free(export_buffer); @@ -9379,7 +9379,7 @@ void raw_key_agreement(int alg_arg, output, expected_output->len, &output_length)); TEST_MEMORY_COMPARE(output, output_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); mbedtls_free(output); output = NULL; output_length = ~0; @@ -9391,7 +9391,7 @@ void raw_key_agreement(int alg_arg, output, expected_output->len + 1, &output_length)); TEST_MEMORY_COMPARE(output, output_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); mbedtls_free(output); output = NULL; output_length = ~0; @@ -9487,7 +9487,7 @@ void key_agreement_output(int alg_arg, uint8_t *actual_output = NULL; TEST_CALLOC(actual_output, MAX(expected_output1->len, - expected_output2->len)); + expected_output2->len)); PSA_ASSERT(psa_crypto_init()); @@ -9514,13 +9514,13 @@ void key_agreement_output(int alg_arg, actual_output, expected_output1->len)); TEST_MEMORY_COMPARE(actual_output, expected_output1->len, - expected_output1->x, expected_output1->len); + expected_output1->x, expected_output1->len); if (expected_output2->len != 0) { PSA_ASSERT(psa_key_derivation_output_bytes(&operation, actual_output, expected_output2->len)); TEST_MEMORY_COMPARE(actual_output, expected_output2->len, - expected_output2->x, expected_output2->len); + expected_output2->x, expected_output2->len); } exit: @@ -9834,7 +9834,7 @@ void persistent_key_load_key_from_storage(data_t *data, &first_exported_length)); if (generation_method == IMPORT_KEY) { TEST_MEMORY_COMPARE(data->x, data->len, - first_export, first_exported_length); + first_export, first_exported_length); } } @@ -9861,7 +9861,7 @@ void persistent_key_load_key_from_storage(data_t *data, second_export, export_size, &second_exported_length)); TEST_MEMORY_COMPARE(first_export, first_exported_length, - second_export, second_exported_length); + second_export, second_exported_length); } /* Do something with the key according to its type and permitted usage. */ diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.function b/tests/suites/test_suite_psa_crypto_driver_wrappers.function index 8cf076a23c..98a7662942 100644 --- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function +++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function @@ -461,7 +461,7 @@ static int sanity_check_rsa_encryption_result( TEST_EQUAL(buf[1], 0x02); TEST_EQUAL(buf[length - input_data->len - 1], 0x00); TEST_MEMORY_COMPARE(buf + length - input_data->len, input_data->len, - input_data->x, input_data->len); + input_data->x, input_data->len); } else if (PSA_ALG_IS_RSA_OAEP(alg)) { TEST_EQUAL(buf[0], 0x00); /* The rest is too hard to check */ @@ -547,7 +547,7 @@ void sign_hash(int key_type_arg, TEST_EQUAL(actual_status, expected_status); if (expected_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(signature, signature_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); } TEST_EQUAL(mbedtls_test_driver_signature_sign_hooks.hits, 1); @@ -674,7 +674,7 @@ void sign_message(int key_type_arg, TEST_EQUAL(actual_status, expected_status); if (expected_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(signature, signature_length, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); } /* In the builtin algorithm the driver is called twice. */ TEST_EQUAL(mbedtls_test_driver_signature_sign_hooks.hits, @@ -796,7 +796,7 @@ void generate_ec_key(int force_status_arg, if (fake_output->len > 0) { TEST_MEMORY_COMPARE(actual_output, actual_output_length, - expected_output, expected_output_length); + expected_output, expected_output_length); } else { size_t zeroes = 0; for (size_t i = 0; i < sizeof(actual_output); i++) { @@ -928,7 +928,7 @@ void export_key(int force_status_arg, if (actual_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(actual_output, actual_output_length, - expected_output_ptr, expected_output_length); + expected_output_ptr, expected_output_length); } exit: psa_reset_key_attributes(&attributes); @@ -1007,7 +1007,7 @@ void key_agreement(int alg_arg, if (actual_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(actual_output, actual_output_length, - expected_output_ptr, expected_output_length); + expected_output_ptr, expected_output_length); } mbedtls_free(actual_output); actual_output = NULL; @@ -1094,7 +1094,7 @@ void cipher_encrypt_validation(int alg_arg, // driver function should've been called as part of the finish() core routine TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0); TEST_MEMORY_COMPARE(output1 + iv_size, output1_length - iv_size, - output2, output2_length); + output2, output2_length); exit: psa_cipher_abort(&operation); @@ -1222,7 +1222,7 @@ void cipher_encrypt_multipart(int alg_arg, TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0); TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output, total_output_length); + output, total_output_length); } exit: @@ -1351,7 +1351,7 @@ void cipher_decrypt_multipart(int alg_arg, TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0); TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output, total_output_length); + output, total_output_length); } exit: @@ -1423,7 +1423,7 @@ void cipher_decrypt(int alg_arg, if (expected_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_output->x, expected_output->len, - output, output_length); + output, output_length); } exit: @@ -1708,7 +1708,7 @@ void aead_encrypt(int key_type_arg, data_t *key_data, if (status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_result->x, expected_result->len, - output_data, output_length); + output_data, output_length); } exit: @@ -1771,7 +1771,7 @@ void aead_decrypt(int key_type_arg, data_t *key_data, if (status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_data->x, expected_data->len, - output_data, output_length); + output_data, output_length); } exit: @@ -1840,7 +1840,7 @@ void mac_sign(int key_type_arg, if (forced_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_mac->x, expected_mac->len, - actual_mac, mac_length); + actual_mac, mac_length); } mbedtls_free(actual_mac); @@ -1958,7 +1958,7 @@ void mac_sign_multipart(int key_type_arg, if (forced_status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(expected_mac->x, expected_mac->len, - actual_mac, mac_length); + actual_mac, mac_length); } mbedtls_free(actual_mac); @@ -2160,7 +2160,7 @@ void builtin_key_export(int builtin_key_id_arg, PSA_ASSERT(actual_status); TEST_EQUAL(output_size, expected_output->len); TEST_MEMORY_COMPARE(output_buffer, output_size, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); PSA_ASSERT(psa_get_key_attributes(key, &attributes)); TEST_EQUAL(psa_get_key_bits(&attributes), builtin_key_bits); @@ -2211,7 +2211,7 @@ void builtin_pubkey_export(int builtin_key_id_arg, PSA_ASSERT(actual_status); TEST_EQUAL(output_size, expected_output->len); TEST_MEMORY_COMPARE(output_buffer, output_size, - expected_output->x, expected_output->len); + expected_output->x, expected_output->len); PSA_ASSERT(psa_get_key_attributes(key, &attributes)); TEST_EQUAL(psa_get_key_bits(&attributes), builtin_key_bits); @@ -2561,7 +2561,7 @@ void asymmetric_encrypt_decrypt(int alg_arg, if (expected_status_encrypt == PSA_SUCCESS) { if (fake_output_encrypt->len > 0) { TEST_MEMORY_COMPARE(fake_output_encrypt->x, fake_output_encrypt->len, - output, output_length); + output, output_length); } else { mbedtls_test_driver_asymmetric_encryption_hooks.forced_status = forced_status_decrypt; @@ -2588,10 +2588,10 @@ void asymmetric_encrypt_decrypt(int alg_arg, if (expected_status_decrypt == PSA_SUCCESS) { if (fake_output_decrypt->len > 0) { TEST_MEMORY_COMPARE(fake_output_decrypt->x, fake_output_decrypt->len, - output2, output2_length); + output2, output2_length); } else { TEST_MEMORY_COMPARE(input_data->x, input_data->len, - output2, output2_length); + output2, output2_length); } } } @@ -2665,7 +2665,7 @@ void asymmetric_decrypt(int alg_arg, if (expected_status_decrypt == PSA_SUCCESS) { TEST_EQUAL(output_length, expected_output_data->len); TEST_MEMORY_COMPARE(expected_output_data->x, expected_output_data->len, - output, output_length); + output, output_length); } exit: /* @@ -2739,7 +2739,7 @@ void asymmetric_encrypt(int alg_arg, if (fake_output_encrypt->len > 0) { TEST_EQUAL(fake_output_encrypt->len, output_length); TEST_MEMORY_COMPARE(fake_output_encrypt->x, fake_output_encrypt->len, - output, output_length); + output, output_length); } else { /* Perform sanity checks on the output */ #if PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY @@ -2874,7 +2874,7 @@ void aead_encrypt_setup(int key_type_arg, data_t *key_data, /* Compare output_data and expected_ciphertext */ TEST_MEMORY_COMPARE(expected_ciphertext->x, expected_ciphertext->len, - output_data, output_length + finish_output_length); + output_data, output_length + finish_output_length); /* Compare tag and expected_tag */ TEST_MEMORY_COMPARE(expected_tag->x, expected_tag->len, tag_buffer, tag_length); @@ -2980,7 +2980,7 @@ void aead_decrypt_setup(int key_type_arg, data_t *key_data, forced_status == PSA_SUCCESS ? 1 : 0); TEST_MEMORY_COMPARE(expected_result->x, expected_result->len, - output_data, output_length + verify_output_length); + output_data, output_length + verify_output_length); } exit: @@ -3017,13 +3017,13 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st int in_driver = (forced_status_setup_arg == PSA_SUCCESS); TEST_CALLOC(input_buffer, - PSA_PAKE_INPUT_SIZE(PSA_ALG_JPAKE, primitive, - PSA_PAKE_STEP_KEY_SHARE)); + PSA_PAKE_INPUT_SIZE(PSA_ALG_JPAKE, primitive, + PSA_PAKE_STEP_KEY_SHARE)); memset(input_buffer, 0xAA, size_key_share); TEST_CALLOC(output_buffer, - PSA_PAKE_INPUT_SIZE(PSA_ALG_JPAKE, primitive, - PSA_PAKE_STEP_KEY_SHARE)); + PSA_PAKE_INPUT_SIZE(PSA_ALG_JPAKE, primitive, + PSA_PAKE_STEP_KEY_SHARE)); memset(output_buffer, 0x55, output_size); PSA_INIT(); diff --git a/tests/suites/test_suite_psa_crypto_hash.function b/tests/suites/test_suite_psa_crypto_hash.function index 28b556c4ff..0405c1de9e 100644 --- a/tests/suites/test_suite_psa_crypto_hash.function +++ b/tests/suites/test_suite_psa_crypto_hash.function @@ -26,7 +26,7 @@ void hash_finish(int alg_arg, data_t *input, data_t *expected_hash) actual_hash, sizeof(actual_hash), &actual_hash_length)); TEST_MEMORY_COMPARE(expected_hash->x, expected_hash->len, - actual_hash, actual_hash_length); + actual_hash, actual_hash_length); exit: psa_hash_abort(&operation); @@ -84,13 +84,13 @@ void hash_multi_part(int alg_arg, data_t *input, data_t *expected_hash) actual_hash, sizeof(actual_hash), &actual_hash_length)); TEST_MEMORY_COMPARE(expected_hash->x, expected_hash->len, - actual_hash, actual_hash_length); + actual_hash, actual_hash_length); PSA_ASSERT(psa_hash_finish(&operation2, actual_hash, sizeof(actual_hash), &actual_hash_length)); TEST_MEMORY_COMPARE(expected_hash->x, expected_hash->len, - actual_hash, actual_hash_length); + actual_hash, actual_hash_length); } while (len++ != input->len); exit: diff --git a/tests/suites/test_suite_psa_crypto_pake.function b/tests/suites/test_suite_psa_crypto_pake.function index e4313ab2f3..96c119592d 100644 --- a/tests/suites/test_suite_psa_crypto_pake.function +++ b/tests/suites/test_suite_psa_crypto_pake.function @@ -1065,7 +1065,7 @@ void pake_input_getters_cipher_suite() PSA_SUCCESS); TEST_MEMORY_COMPARE(&cipher_suite_ret, sizeof(cipher_suite_ret), - &cipher_suite, sizeof(cipher_suite)); + &cipher_suite, sizeof(cipher_suite)); exit: PSA_ASSERT(psa_pake_abort(&operation)); diff --git a/tests/suites/test_suite_psa_crypto_persistent_key.function b/tests/suites/test_suite_psa_crypto_persistent_key.function index 416fed9cce..a48114ff64 100644 --- a/tests/suites/test_suite_psa_crypto_persistent_key.function +++ b/tests/suites/test_suite_psa_crypto_persistent_key.function @@ -67,7 +67,7 @@ void format_storage_data_check(data_t *key_data, file_data); TEST_MEMORY_COMPARE(expected_file_data->x, expected_file_data->len, - file_data, file_data_length); + file_data, file_data_length); exit: mbedtls_free(file_data); @@ -112,7 +112,7 @@ void parse_storage_data_check(data_t *file_data, TEST_EQUAL(psa_get_key_enrollment_algorithm(&attributes), (uint32_t) expected_key_alg2); TEST_MEMORY_COMPARE(expected_key_data->x, expected_key_data->len, - key_data, key_data_length); + key_data, key_data_length); exit: mbedtls_free(key_data); 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 68f6ee83d3..979db5947d 100644 --- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function +++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function @@ -966,7 +966,7 @@ void key_creation_import_export(int lifetime_arg, int min_slot, int restart) exported, sizeof(exported), &exported_length)); TEST_MEMORY_COMPARE(key_material, sizeof(key_material), - exported, exported_length); + exported, exported_length); PSA_ASSERT(psa_destroy_key(returned_id)); if (!check_persistent_data(location, diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index e25d1e8cff..a8fe46f5f4 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -308,7 +308,7 @@ void persistent_slot_lifecycle(int lifetime_arg, int owner_id_arg, int id_arg, PSA_ASSERT(psa_export_key(id, reexported, key_data->len, &reexported_length)); TEST_MEMORY_COMPARE(key_data->x, key_data->len, - reexported, reexported_length); + reexported, reexported_length); } else { TEST_EQUAL(psa_export_key(id, reexported, key_data->len, &reexported_length), @@ -403,7 +403,7 @@ void create_existent(int lifetime_arg, int owner_id_arg, int id_arg, reexported, sizeof(reexported), &reexported_length)); TEST_MEMORY_COMPARE(material1, sizeof(material1), - reexported, reexported_length); + reexported, reexported_length); PSA_ASSERT(psa_close_key(id)); @@ -579,7 +579,7 @@ void copy_across_lifetimes(int source_lifetime_arg, int source_owner_id_arg, PSA_ASSERT(psa_export_key(returned_target_id, export_buffer, material->len, &length)); TEST_MEMORY_COMPARE(material->x, material->len, - export_buffer, length); + export_buffer, length); } else { size_t length; /* Check that the key is actually non-exportable. */ @@ -693,7 +693,7 @@ void copy_to_occupied(int source_lifetime_arg, int source_id_arg, PSA_ASSERT(psa_export_key(returned_target_id, export_buffer, target_material->len, &length)); TEST_MEMORY_COMPARE(target_material->x, target_material->len, - export_buffer, length); + export_buffer, length); } PSA_ASSERT(psa_destroy_key(returned_source_id)); @@ -841,7 +841,7 @@ void many_transient_keys(int max_keys_arg) exported, sizeof(exported), &exported_length)); TEST_MEMORY_COMPARE(exported, exported_length, - (uint8_t *) &i, sizeof(i)); + (uint8_t *) &i, sizeof(i)); } PSA_ASSERT(psa_close_key(keys[i - 1])); @@ -918,7 +918,7 @@ void key_slot_eviction_to_import_new_key(int lifetime_arg) exported, sizeof(exported), &exported_length)); TEST_MEMORY_COMPARE(exported, exported_length, - (uint8_t *) &i, sizeof(i)); + (uint8_t *) &i, sizeof(i)); PSA_ASSERT(psa_destroy_key(key)); } @@ -1017,7 +1017,7 @@ void non_reusable_key_slots_integrity_in_case_of_key_slot_starvation() exported, sizeof(exported), &exported_length)); TEST_MEMORY_COMPARE(exported, exported_length, - (uint8_t *) &i, sizeof(i)); + (uint8_t *) &i, sizeof(i)); PSA_ASSERT(psa_destroy_key(keys[i])); } @@ -1029,7 +1029,7 @@ void non_reusable_key_slots_integrity_in_case_of_key_slot_starvation() PSA_ASSERT(psa_export_key(persistent_key, exported, sizeof(exported), &exported_length)); TEST_MEMORY_COMPARE(exported, exported_length, - (uint8_t *) &persistent_key, sizeof(persistent_key)); + (uint8_t *) &persistent_key, sizeof(persistent_key)); exit: /* * Key attributes may have been returned by psa_get_key_attributes() diff --git a/tests/suites/test_suite_psa_crypto_storage_format.function b/tests/suites/test_suite_psa_crypto_storage_format.function index 9f67f48686..116f4cd53e 100644 --- a/tests/suites/test_suite_psa_crypto_storage_format.function +++ b/tests/suites/test_suite_psa_crypto_storage_format.function @@ -40,7 +40,7 @@ static int test_written_key(const psa_key_attributes_t *attributes, PSA_ASSERT(psa_its_get(uid, 0, storage_info.size, actual_representation, &length)); TEST_MEMORY_COMPARE(expected_representation->x, expected_representation->len, - actual_representation, length); + actual_representation, length); ok = 1; @@ -264,7 +264,7 @@ static int test_read_key(const psa_key_attributes_t *expected_attributes, exported_material, expected_material->len, &length)); TEST_MEMORY_COMPARE(expected_material->x, expected_material->len, - exported_material, length); + exported_material, length); } if ((flags & TEST_FLAG_EXERCISE) && can_exercise(&actual_attributes)) { diff --git a/tests/suites/test_suite_psa_its.function b/tests/suites/test_suite_psa_its.function index aeb413c93a..cb11f189a3 100644 --- a/tests/suites/test_suite_psa_its.function +++ b/tests/suites/test_suite_psa_its.function @@ -168,7 +168,7 @@ void set_multiple(int first_id, int count) "Content of file 0x%08lx", (unsigned long) uid); PSA_ASSERT(psa_its_get(uid, 0, sizeof(stored), retrieved, &ret_len)); TEST_MEMORY_COMPARE(retrieved, ret_len, - stored, sizeof(stored)); + stored, sizeof(stored)); PSA_ASSERT(psa_its_remove(uid)); TEST_ASSERT(psa_its_get(uid, 0, 0, NULL, NULL) == PSA_ERROR_DOES_NOT_EXIST); @@ -224,7 +224,7 @@ void get_at(int uid_arg, data_t *data, TEST_ASSERT(status == (psa_status_t) expected_status); if (status == PSA_SUCCESS) { TEST_MEMORY_COMPARE(data->x + offset, (size_t) length_arg, - buffer, ret_len); + buffer, ret_len); } for (i = 0; i < 16; i++) { TEST_ASSERT(trailer[i] == '-'); diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index b2a075b64e..915d104350 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -1729,7 +1729,7 @@ void ssl_tls13_hkdf_expand_label(int hash_alg, dst, desired_length) == 0); TEST_MEMORY_COMPARE(dst, (size_t) desired_length, - expected->x, (size_t) expected->len); + expected->x, (size_t) expected->len); exit: PSA_DONE(); @@ -1769,21 +1769,21 @@ void ssl_tls13_traffic_key_generation(int hash_alg, &keys) == 0); TEST_MEMORY_COMPARE(keys.client_write_key, - keys.key_len, - expected_client_write_key->x, - (size_t) desired_key_len); + keys.key_len, + expected_client_write_key->x, + (size_t) desired_key_len); TEST_MEMORY_COMPARE(keys.server_write_key, - keys.key_len, - expected_server_write_key->x, - (size_t) desired_key_len); + keys.key_len, + expected_server_write_key->x, + (size_t) desired_key_len); TEST_MEMORY_COMPARE(keys.client_write_iv, - keys.iv_len, - expected_client_write_iv->x, - (size_t) desired_iv_len); + keys.iv_len, + expected_client_write_iv->x, + (size_t) desired_iv_len); TEST_MEMORY_COMPARE(keys.server_write_iv, - keys.iv_len, - expected_server_write_iv->x, - (size_t) desired_iv_len); + keys.iv_len, + expected_server_write_iv->x, + (size_t) desired_iv_len); exit: PSA_DONE(); @@ -1828,7 +1828,7 @@ void ssl_tls13_derive_secret(int hash_alg, dst, desired_length) == 0); TEST_MEMORY_COMPARE(dst, desired_length, - expected->x, desired_length); + expected->x, desired_length); exit: PSA_DONE(); @@ -1860,9 +1860,9 @@ void ssl_tls13_derive_early_secrets(int hash_alg, &secrets) == 0); TEST_MEMORY_COMPARE(secrets.client_early_traffic_secret, hash_len, - traffic_expected->x, traffic_expected->len); + traffic_expected->x, traffic_expected->len); TEST_MEMORY_COMPARE(secrets.early_exporter_master_secret, hash_len, - exporter_expected->x, exporter_expected->len); + exporter_expected->x, exporter_expected->len); exit: PSA_DONE(); @@ -1894,9 +1894,9 @@ void ssl_tls13_derive_handshake_secrets(int hash_alg, &secrets) == 0); TEST_MEMORY_COMPARE(secrets.client_handshake_traffic_secret, hash_len, - client_expected->x, client_expected->len); + client_expected->x, client_expected->len); TEST_MEMORY_COMPARE(secrets.server_handshake_traffic_secret, hash_len, - server_expected->x, server_expected->len); + server_expected->x, server_expected->len); exit: PSA_DONE(); @@ -1930,11 +1930,11 @@ void ssl_tls13_derive_application_secrets(int hash_alg, &secrets) == 0); TEST_MEMORY_COMPARE(secrets.client_application_traffic_secret_N, hash_len, - client_expected->x, client_expected->len); + client_expected->x, client_expected->len); TEST_MEMORY_COMPARE(secrets.server_application_traffic_secret_N, hash_len, - server_expected->x, server_expected->len); + server_expected->x, server_expected->len); TEST_MEMORY_COMPARE(secrets.exporter_master_secret, hash_len, - exporter_expected->x, exporter_expected->len); + exporter_expected->x, exporter_expected->len); exit: PSA_DONE(); @@ -1964,7 +1964,7 @@ void ssl_tls13_derive_resumption_secrets(int hash_alg, &secrets) == 0); TEST_MEMORY_COMPARE(secrets.resumption_master_secret, hash_len, - resumption_expected->x, resumption_expected->len); + resumption_expected->x, resumption_expected->len); exit: PSA_DONE(); @@ -1998,7 +1998,7 @@ void ssl_tls13_create_psk_binder(int hash_alg, binder) == 0); TEST_MEMORY_COMPARE(binder, hash_len, - binder_expected->x, binder_expected->len); + binder_expected->x, binder_expected->len); exit: PSA_DONE(); @@ -2091,12 +2091,12 @@ void ssl_tls13_record_protection(int ciphersuite, if (padding_used == MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY) { TEST_MEMORY_COMPARE(rec.buf + rec.data_offset, rec.data_len, - ciphertext->x, ciphertext->len); + ciphertext->x, ciphertext->len); } TEST_ASSERT(mbedtls_ssl_decrypt_buf(NULL, &transform_recv, &rec) == 0); TEST_MEMORY_COMPARE(rec.buf + rec.data_offset, rec.data_len, - plaintext->x, plaintext->len); + plaintext->x, plaintext->len); exit: mbedtls_free(buf); @@ -2123,7 +2123,7 @@ void ssl_tls13_key_evolution(int hash_alg, secret_new) == 0); TEST_MEMORY_COMPARE(secret_new, (size_t) expected->len, - expected->x, (size_t) expected->len); + expected->x, (size_t) expected->len); exit: PSA_DONE();