App: SPE uses string.h mem* API
TFM supports mem* API in string.h now, deprecate legacy tfm_mem* API.
Signed-off-by: Ken Liu <Ken.Liu@arm.com>
Change-Id: I1fa4673d34683489673018579de4813fb830599b
diff --git a/test/secure_fw/suites/crypto/crypto_tests_common.c b/test/secure_fw/suites/crypto/crypto_tests_common.c
index 49d4d5e..c82a635 100644
--- a/test/secure_fw/suites/crypto/crypto_tests_common.c
+++ b/test/secure_fw/suites/crypto/crypto_tests_common.c
@@ -5,12 +5,7 @@
*
*/
-#if DOMAIN_NS == 1
#include <string.h>
-#else
-#include "tfm_memory_utils.h"
-#endif
-
#include <stdbool.h>
#include "crypto_tests_common.h"
@@ -95,18 +90,6 @@
ret->val = TEST_PASSED;
}
-static inline int compare_buffers(const uint8_t *p1,
- const uint8_t *p2,
- size_t comp_size)
-{
-#if DOMAIN_NS == 1U
- /* Check that the decrypted data is the same as the original data */
- return memcmp(p1, p2, comp_size);
-#else
- return tfm_memcmp(p1, p2, comp_size);
-#endif
-}
-
#define CIPHER_TEST_KEY_ID (0x1)
void psa_cipher_padded_modes_test(const psa_key_type_t key_type,
@@ -377,7 +360,7 @@
}
/* Check that the plain text matches the decrypted data */
- comp_result = compare_buffers(plain_text, decrypted_data, len);
+ comp_result = memcmp(plain_text, decrypted_data, len);
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
goto destroy_key;
@@ -601,9 +584,9 @@
total_output_length += output_length;
/* Compare encrypted data produced with single-shot and multipart APIs */
- comp_result = compare_buffers(chacha20_testCiphertext_expected,
- chacha20_testCiphertext,
- total_output_length);
+ comp_result = memcmp(chacha20_testCiphertext_expected,
+ chacha20_testCiphertext,
+ total_output_length);
if (comp_result != 0) {
TEST_FAIL("Single-shot crypt doesn't match with multipart crypt");
goto destroy_key;
@@ -680,9 +663,9 @@
}
/* Check that the plain text matches the decrypted data */
- comp_result = compare_buffers(chacha20_testPlaintext,
- chacha20_testDecryptedtext,
- sizeof(chacha20_testPlaintext));
+ comp_result = memcmp(chacha20_testPlaintext,
+ chacha20_testDecryptedtext,
+ sizeof(chacha20_testPlaintext));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
}
@@ -832,16 +815,15 @@
total_output_length += output_length;
/* Compare encrypted data produced with single-shot and multipart APIs */
- comp_result = compare_buffers(chacha20poly1305_testCiphertext_expected,
- chacha20_testCiphertext,
- total_output_length);
+ comp_result = memcmp(chacha20poly1305_testCiphertext_expected,
+ chacha20_testCiphertext,
+ total_output_length);
if (comp_result != 0) {
TEST_FAIL("Encrypted data does not match reference data");
goto destroy_key;
}
- comp_result = compare_buffers(chacha20poly1305_testTag_expected,
- tag, tag_length);
+ comp_result = memcmp(chacha20poly1305_testTag_expected, tag, tag_length);
if (comp_result != 0) {
TEST_FAIL("Computed tag does not match reference data");
goto destroy_key;
@@ -939,9 +921,9 @@
}
/* Check that the plain text matches the decrypted data */
- comp_result = compare_buffers(chacha20_testPlaintext,
- chacha20_testDecryptedtext,
- sizeof(chacha20_testPlaintext));
+ comp_result = memcmp(chacha20_testPlaintext,
+ chacha20_testDecryptedtext,
+ sizeof(chacha20_testPlaintext));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
}
@@ -1052,7 +1034,7 @@
memcpy(encrypted_data_single_shot, &input.encrypted_data_pad[iv_length],
output_length-iv_length);
#else
- tfm_memcpy(encrypted_data_single_shot, &input.encrypted_data_pad[iv_length],
+ memcpy(encrypted_data_single_shot, &input.encrypted_data_pad[iv_length],
output_length-iv_length);
#endif
@@ -1077,22 +1059,18 @@
}
/* Check that the plain text matches the decrypted data */
- comp_result = compare_buffers(plain_text, decrypted_data,
- sizeof(plain_text));
+ comp_result = memcmp(plain_text, decrypted_data, sizeof(plain_text));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
goto destroy_key;
}
/* Clear inputs/outputs before moving to multipart tests */
-#if DOMAIN_NS == 1U
+
/* Clear intermediate buffers for additional single-shot API tests */
memset(input.encrypted_data_pad, 0, sizeof(input.encrypted_data_pad));
memset(decrypted_data, 0, sizeof(decrypted_data));
-#else
- tfm_memset(input.encrypted_data_pad, 0, sizeof(input.encrypted_data_pad));
- tfm_memset(decrypted_data, 0, sizeof(decrypted_data));
-#endif
+
/* Replicate the same test as above, but now using the multipart APIs */
/* Setup the encryption object */
@@ -1168,9 +1146,9 @@
total_output_length += output_length;
/* Compare encrypted data produced with single-shot and multipart APIs */
- comp_result = compare_buffers(encrypted_data_single_shot,
- input.encrypted_data,
- total_output_length);
+ comp_result = memcmp(encrypted_data_single_shot,
+ input.encrypted_data,
+ total_output_length);
if (comp_result != 0) {
TEST_FAIL("Single-shot crypt doesn't match with multipart crypt");
goto destroy_key;
@@ -1249,8 +1227,7 @@
}
/* Check that the plain text matches the decrypted data */
- comp_result = compare_buffers(plain_text, decrypted_data,
- sizeof(plain_text));
+ comp_result = memcmp(plain_text, decrypted_data, sizeof(plain_text));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
}
@@ -1294,7 +1271,7 @@
/* Fill the key data */
(void)memset(data, 'A', key_size);
#else
- (void)tfm_memset(data, 'A', key_size);
+ (void)memset(data, 'A', key_size);
#endif
/* Import a key */
@@ -1725,9 +1702,9 @@
if (key_type == PSA_KEY_TYPE_CHACHA20) {
/* Check that the decrypted data is the same as the original data */
- comp_result = compare_buffers(encrypted_data,
- chacha20_poly1305_ref_encrypted,
- sizeof(encrypted_data));
+ comp_result = memcmp(encrypted_data,
+ chacha20_poly1305_ref_encrypted,
+ sizeof(encrypted_data));
if (comp_result != 0) {
TEST_FAIL("Encrypted data does not match reference data");
goto destroy_key_aead;
@@ -1760,8 +1737,7 @@
}
/* Check that the decrypted data is the same as the original data */
- comp_result = compare_buffers(plain_text, decrypted_data,
- sizeof(plain_text));
+ comp_result = memcmp(plain_text, decrypted_data, sizeof(plain_text));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
goto destroy_key_aead;
@@ -1984,8 +1960,7 @@
}
/* Check that the decrypted data is the same as the original data */
- comp_result = compare_buffers(plain_text, decrypted_data,
- sizeof(plain_text));
+ comp_result = memcmp(plain_text, decrypted_data, sizeof(plain_text));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
}
@@ -2262,7 +2237,7 @@
}
/* Check that the exported key is the same as the imported one */
- comp_result = compare_buffers(data_out, data, sizeof(data));
+ comp_result = memcmp(data_out, data, sizeof(data));
if (comp_result != 0) {
TEST_FAIL("Exported key does not match the imported key");
return;
@@ -2376,15 +2351,9 @@
psa_key_type_t key_type;
/* Prepare the parameters */
-#if DOMAIN_NS == 1U
memset(key_deriv_secret, counter, KEY_DERIV_SECRET_LEN);
memset(key_deriv_label_info, counter++, KEY_DERIV_LABEL_INFO_LEN);
memset(key_deriv_seed_salt, counter++, KEY_DERIV_SEED_SALT_LEN);
-#else
- tfm_memset(key_deriv_secret, counter, KEY_DERIV_SECRET_LEN);
- tfm_memset(key_deriv_label_info, counter++, KEY_DERIV_LABEL_INFO_LEN);
- tfm_memset(key_deriv_seed_salt, counter++, KEY_DERIV_SEED_SALT_LEN);
-#endif
deriv_ops = psa_key_derivation_operation_init();
@@ -2615,8 +2584,7 @@
}
/* Check that the plain text matches the decrypted data */
- comp_result = compare_buffers(plain_text, decrypted_data,
- sizeof(plain_text));
+ comp_result = memcmp(plain_text, decrypted_data, sizeof(plain_text));
if (comp_result != 0) {
TEST_FAIL("Decrypted data doesn't match with plain text");
goto destroy_key;
diff --git a/test/secure_fw/suites/fpu/fpu_tests_common.c b/test/secure_fw/suites/fpu/fpu_tests_common.c
index e31ae4e..1e22322 100644
--- a/test/secure_fw/suites/fpu/fpu_tests_common.c
+++ b/test/secure_fw/suites/fpu/fpu_tests_common.c
@@ -8,11 +8,8 @@
#include <stdbool.h>
#include "fpu_tests_common.h"
#include "psa_manifest/sid.h"
-#if DOMAIN_NS == 1
#include <string.h>
-#else
-#include "tfm_memory_utils.h"
-#endif
+
/**
* Change FP registers.
@@ -111,12 +108,7 @@
:"memory"
);
-#if DOMAIN_NS == 1
- if (!memcmp(fp_buffer, fp_expect, FP_BUF_SIZE))
-#else
- if (!tfm_memcmp(fp_buffer, fp_expect, FP_BUF_SIZE))
-#endif
- {
+ if (!memcmp(fp_buffer, fp_expect, FP_BUF_SIZE)) {
return true;
}
@@ -188,7 +180,7 @@
#if DOMAIN_NS == 1
if (!memcmp(fp_buffer, fp_expect, FP_BUF_SIZE))
#else
- if (!tfm_memcmp(fp_buffer, fp_expect, FP_BUF_SIZE))
+ if (!memcmp(fp_buffer, fp_expect, FP_BUF_SIZE))
#endif
{
return true;
diff --git a/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c b/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c
index 6270e45..60fa58d 100644
--- a/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c
+++ b/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c
@@ -6,13 +6,13 @@
*/
#include <stdbool.h>
+#include <string.h>
#include "psa/client.h"
#include "psa/service.h"
#include "psa_manifest/tfm_fpu_service_test.h"
#include "tfm_api.h"
#include "tfm_hal_isolation.h"
#include "tfm_secure_api.h"
-#include "tfm_memory_utils.h"
#include "tfm_sp_log.h"
#include "tfm_plat_test.h"
#include "device_definition.h"
@@ -89,7 +89,7 @@
:"memory"
);
- if (!tfm_memcmp(fp_buffer, fp_expect, FP_BUF_SIZE)) {
+ if (!memcmp(fp_buffer, fp_expect, FP_BUF_SIZE)) {
return true;
}
@@ -301,7 +301,7 @@
:"memory"
);
- if (!tfm_memcmp(fp_buffer, fp_expect, FP_BUF_SIZE)) {
+ if (!memcmp(fp_buffer, fp_expect, FP_BUF_SIZE)) {
return true;
}
diff --git a/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c b/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
index 3a4859d..05891c6 100644
--- a/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
+++ b/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
@@ -5,11 +5,7 @@
*
*/
-#if DOMAIN_NS == 1
#include <string.h>
-#else
-#include "tfm_memory_utils.h"
-#endif
#include "fwu_tests_common.h"
#include "region_defs.h"
diff --git a/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c b/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c
index 35ffc59..6bacc44 100644
--- a/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c
+++ b/test/secure_fw/suites/fwu/mcuboot/secure/psa_fwu_s_interface_testsuite.c
@@ -5,12 +5,10 @@
*
*/
-
#include "fwu_s_tests.h"
#include "psa/update.h"
#include "test_framework_helpers.h"
#include "../fwu_tests_common.h"
-#include "tfm_memory_utils.h"
static struct test_t psa_fwu_s_tests[] = {
{&tfm_fwu_test_common_001, "TFM_S_FWU_TEST_1001",
diff --git a/test/secure_fw/suites/its/its_tests_common.c b/test/secure_fw/suites/its/its_tests_common.c
index 3048ff6..73963cc 100644
--- a/test/secure_fw/suites/its/its_tests_common.c
+++ b/test/secure_fw/suites/its/its_tests_common.c
@@ -7,11 +7,7 @@
#include "its_tests_common.h"
#include "psa/internal_trusted_storage.h"
-#if DOMAIN_NS == 1
#include <string.h>
-#else
-#include "tfm_memory_utils.h"
-#endif
#define TEST_019_CYCLES 3U
@@ -147,13 +143,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Check that write once data has not changed */
comp_result = memcmp(read_data, WRITE_ONCE_RESULT_DATA, sizeof(read_data));
-#else
- comp_result = tfm_memcmp(read_data, WRITE_ONCE_RESULT_DATA,
- sizeof(read_data));
-#endif
if (comp_result != 0) {
TEST_FAIL("Write once data should not have changed");
return;
@@ -199,7 +190,7 @@
/* Check that the data is correct, including no illegal pre- or post-data */
comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
#else
- comp_result = tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data));
+ comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to result data");
@@ -212,12 +203,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Reset read data */
memcpy(read_data, READ_DATA, sizeof(read_data));
-#else
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
-#endif
/* Read from offset 2 to 2 bytes before end of the data */
offset = 2;
@@ -234,7 +221,7 @@
/* Check that the correct data was read */
comp_result = memcmp(p_read_data, "____", HALF_PADDING_SIZE);
#else
- comp_result = tfm_memcmp(p_read_data, "____", HALF_PADDING_SIZE);
+ comp_result = memcmp(p_read_data, "____", HALF_PADDING_SIZE);
#endif
if (comp_result != 0) {
TEST_FAIL("Read data contains illegal pre-data");
@@ -243,11 +230,7 @@
p_read_data += HALF_PADDING_SIZE;
-#if DOMAIN_NS == 1U
comp_result = memcmp(p_read_data, write_data + offset, data_len);
-#else
- comp_result = tfm_memcmp(p_read_data, write_data + offset, data_len);
-#endif
if (comp_result != 0) {
TEST_FAIL("Read data incorrect");
return;
@@ -258,7 +241,7 @@
#if DOMAIN_NS == 1U
comp_result = memcmp(p_read_data, "____", HALF_PADDING_SIZE);
#else
- comp_result = tfm_memcmp(p_read_data, "____", HALF_PADDING_SIZE);
+ comp_result = memcmp(p_read_data, "____", HALF_PADDING_SIZE);
#endif
if (comp_result != 0) {
TEST_FAIL("Read data contains illegal post-data");
@@ -302,12 +285,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Check that the read data is unchanged */
comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
-#else
- comp_result = tfm_memcmp(read_data, READ_DATA, sizeof(read_data));
-#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
@@ -334,7 +313,7 @@
/* Check that the read data is unchanged */
comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
#else
- comp_result = tfm_memcmp(read_data, READ_DATA, sizeof(read_data));
+ comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to original read data");
@@ -375,12 +354,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Check that the read data is unchanged */
comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
-#else
- comp_result = tfm_memcmp(read_data, READ_DATA, sizeof(read_data));
-#endif
if (comp_result != 0) {
TEST_FAIL("Read data not equal to original read data");
return;
@@ -398,7 +373,7 @@
/* Check that the read data is unchanged */
comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
#else
- comp_result = tfm_memcmp(read_data, READ_DATA, sizeof(read_data));
+ comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
#endif
if (comp_result != 0) {
TEST_FAIL("Read data not equal to original read data");
@@ -438,12 +413,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Check that the read data is unchanged */
comp_result = memcmp(read_data, READ_DATA, sizeof(read_data));
-#else
- comp_result = tfm_memcmp(read_data, READ_DATA, sizeof(read_data));
-#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
@@ -470,7 +441,7 @@
/* Check that the read data is changed */
comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
#else
- comp_result = tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data));
+ comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to newly read data");
@@ -480,12 +451,8 @@
/* Get with offset + data length greater than UID's length, but individually
* valid
*/
-#if DOMAIN_NS == 1U
/* Reset read_data to original READ_DATA */
memcpy(read_data, READ_DATA, sizeof(read_data));
-#else
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
-#endif
read_len = write_len;
offset = 1;
@@ -508,7 +475,7 @@
/* Check that the read data is changed */
comp_result = memcmp(read_data, OFFSET_RESULT_DATA, sizeof(read_data));
#else
- comp_result = tfm_memcmp(read_data, OFFSET_RESULT_DATA, sizeof(read_data));
+ comp_result = memcmp(read_data, OFFSET_RESULT_DATA, sizeof(read_data));
#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to newly read data starting at "
@@ -817,11 +784,7 @@
return;
}
-#if DOMAIN_NS == 1U
comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
-#else
- comp_result = tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data));
-#endif
if (comp_result != 0) {
TEST_FAIL("Read buffer has incorrect data");
return;
@@ -875,7 +838,7 @@
#if DOMAIN_NS == 1U
comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
#else
- comp_result = tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data));
+ comp_result = memcmp(read_data, RESULT_DATA, sizeof(read_data));
#endif
if (comp_result != 0) {
TEST_FAIL("Read buffer has incorrect data");
@@ -933,12 +896,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Check that get returns the last data to be set */
comp_result = memcmp(read_data, write_data_3, sizeof(write_data_3));
-#else
- comp_result = tfm_memcmp(read_data, write_data_3, sizeof(write_data_3));
-#endif
if (comp_result != 0) {
TEST_FAIL("Read buffer has incorrect data");
return;
@@ -983,7 +942,7 @@
#if DOMAIN_NS == 1U
memset(read_asset_data, 0x00, sizeof(read_asset_data));
#else
- tfm_memset(read_asset_data, 0x00, sizeof(read_asset_data));
+ memset(read_asset_data, 0x00, sizeof(read_asset_data));
#endif
/* Set with data and no flags and a valid UID */
@@ -1022,12 +981,8 @@
return;
}
-#if DOMAIN_NS == 1U
/* Check that get returns the last data which was set */
comp_result = memcmp(read_asset_data, write_asset_data, data_size);
-#else
- comp_result = tfm_memcmp(read_asset_data, write_asset_data, data_size);
-#endif
if (comp_result != 0) {
TEST_FAIL("Read data should be equal to original write data");
return;
diff --git a/test/secure_fw/suites/its/secure/psa_its_s_interface_testsuite.c b/test/secure_fw/suites/its/secure/psa_its_s_interface_testsuite.c
index eb8039f..dde8d1f 100644
--- a/test/secure_fw/suites/its/secure/psa_its_s_interface_testsuite.c
+++ b/test/secure_fw/suites/its/secure/psa_its_s_interface_testsuite.c
@@ -4,13 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-
+#include <string.h>
#include "its_s_tests.h"
#include "psa/internal_trusted_storage.h"
#include "test_framework_helpers.h"
#include "tfm_secure_client_2_api.h"
#include "../its_tests_common.h"
-#include "tfm_memory_utils.h"
/* UID to test partition access control */
#define TEST_UID_ACCESS_CONTROL 42U
@@ -159,7 +158,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -175,7 +174,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
diff --git a/test/secure_fw/suites/its/secure/psa_its_s_reliability_testsuite.c b/test/secure_fw/suites/its/secure/psa_its_s_reliability_testsuite.c
index bd385d4..1a67529 100644
--- a/test/secure_fw/suites/its/secure/psa_its_s_reliability_testsuite.c
+++ b/test/secure_fw/suites/its/secure/psa_its_s_reliability_testsuite.c
@@ -4,11 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-
+#include <string.h>
#include "its_s_tests.h"
#include "psa/internal_trusted_storage.h"
#include "test_framework_helpers.h"
-#include "tfm_memory_utils.h"
/* Test UIDs */
#define TEST_UID 2UL /* UID 1 cannot be used as it references a write once
@@ -86,13 +85,13 @@
}
/* Check that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
/* Set the original data into read buffer */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
}
TEST_LOG("\n");
@@ -144,7 +143,7 @@
}
/* Check that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
@@ -157,7 +156,7 @@
}
/* Set the original data into read buffer */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
}
TEST_LOG("\n");
diff --git a/test/secure_fw/suites/ps/secure/ps_rollback_protection_testsuite.c b/test/secure_fw/suites/ps/secure/ps_rollback_protection_testsuite.c
index 7e0fc18..2d37b64 100644
--- a/test/secure_fw/suites/ps/secure/ps_rollback_protection_testsuite.c
+++ b/test/secure_fw/suites/ps/secure/ps_rollback_protection_testsuite.c
@@ -8,11 +8,11 @@
#include "ps_tests.h"
#include <stdio.h>
+#include <string.h>
#include "nv_counters/ps_nv_counters.h"
#include "test_ps_nv_counters.h"
#include "psa/protected_storage.h"
-#include "tfm_memory_utils.h"
#include "s_test_helpers.h"
/* This include is required to expose the ps_system_prepare function, via the
@@ -200,7 +200,7 @@
}
/* Checks that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
@@ -365,7 +365,7 @@
}
/* Checks that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
@@ -435,7 +435,7 @@
}
/* Checks that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
@@ -510,7 +510,7 @@
}
/* Checks that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
@@ -588,7 +588,7 @@
}
/* Checks that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
diff --git a/test/secure_fw/suites/ps/secure/psa_ps_s_interface_testsuite.c b/test/secure_fw/suites/ps/secure/psa_ps_s_interface_testsuite.c
index 3ec8c55..a76d557 100644
--- a/test/secure_fw/suites/ps/secure/psa_ps_s_interface_testsuite.c
+++ b/test/secure_fw/suites/ps/secure/psa_ps_s_interface_testsuite.c
@@ -8,9 +8,9 @@
#include "ps_tests.h"
#include <stdio.h>
+#include <string.h>
#include "s_test_helpers.h"
-#include "tfm_memory_utils.h"
#include "psa/protected_storage.h"
#include "test_framework_helpers.h"
@@ -311,7 +311,7 @@
}
/* Check that write once data has not changed */
- if (tfm_memcmp(read_data, WRITE_ONCE_RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, WRITE_ONCE_RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Write once data should not have changed");
return;
}
@@ -351,13 +351,13 @@
}
/* Check that the data is correct, including no illegal pre- or post-data */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to result data");
return;
}
/* Reset read data */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
/* Read from offset 2 to 2 bytes before end of the data */
offset = 2;
@@ -371,21 +371,21 @@
}
/* Check that the correct data was read */
- if (tfm_memcmp(p_read_data, "____", HALF_PADDING_SIZE) != 0) {
+ if (memcmp(p_read_data, "____", HALF_PADDING_SIZE) != 0) {
TEST_FAIL("Read data contains illegal pre-data");
return;
}
p_read_data += HALF_PADDING_SIZE;
- if (tfm_memcmp(p_read_data, write_data + offset, data_len) != 0) {
+ if (memcmp(p_read_data, write_data + offset, data_len) != 0) {
TEST_FAIL("Read data incorrect");
return;
}
p_read_data += data_len;
- if (tfm_memcmp(p_read_data, "____", HALF_PADDING_SIZE) != 0) {
+ if (memcmp(p_read_data, "____", HALF_PADDING_SIZE) != 0) {
TEST_FAIL("Read data contains illegal post-data");
return;
}
@@ -432,7 +432,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -448,7 +448,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -486,7 +486,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data not equal to original read data");
return;
}
@@ -500,7 +500,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data not equal to original read data");
return;
}
@@ -545,7 +545,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -568,7 +568,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -580,7 +580,7 @@
offset = 1;
/* Reset read_data to original READ_DATA */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
status = psa_ps_get(uid, offset, read_len, read_data + HALF_PADDING_SIZE,
&read_data_len);
@@ -597,7 +597,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, OFFSET_RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, OFFSET_RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -608,7 +608,7 @@
offset = INVALID_OFFSET;
/* Reset read_data to original READ_DATA */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
/* A parameter with a buffer pointer where its data length is longer than
* maximum permitted, it is treated as a secure violation.
@@ -625,7 +625,7 @@
}
/* Check that the read data is unchanged */
- if (tfm_memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read data should be equal to original read data");
return;
}
@@ -998,7 +998,7 @@
return;
}
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read buffer has incorrect data");
return;
}
@@ -1048,7 +1048,7 @@
++offset;
}
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("Read buffer has incorrect data");
return;
}
@@ -1107,7 +1107,7 @@
}
/* Check that get returns the last data to be set */
- if (tfm_memcmp(read_data, write_data_3, sizeof(write_data_3)) != 0) {
+ if (memcmp(read_data, write_data_3, sizeof(write_data_3)) != 0) {
TEST_FAIL("Read buffer has incorrect data");
return;
}
@@ -1163,7 +1163,7 @@
psa_storage_uid_t uid = test_uid[cycle];
struct psa_storage_info_t info = {0};
- tfm_memset(read_asset_data, 0x00, sizeof(read_asset_data));
+ memset(read_asset_data, 0x00, sizeof(read_asset_data));
/* Set with data and no flags and a valid UID */
status = psa_ps_set(uid,
@@ -1202,7 +1202,7 @@
}
/* Check that thread's UID data has not been modified */
- if (tfm_memcmp(read_asset_data, write_asset_data, data_size) != 0) {
+ if (memcmp(read_asset_data, write_asset_data, data_size) != 0) {
TEST_FAIL("Read data should be equal to original write data");
return;
}
diff --git a/test/secure_fw/suites/ps/secure/psa_ps_s_reliability_testsuite.c b/test/secure_fw/suites/ps/secure/psa_ps_s_reliability_testsuite.c
index 605e521..481a7a1 100644
--- a/test/secure_fw/suites/ps/secure/psa_ps_s_reliability_testsuite.c
+++ b/test/secure_fw/suites/ps/secure/psa_ps_s_reliability_testsuite.c
@@ -8,9 +8,9 @@
#include "ps_tests.h"
#include <stdio.h>
+#include <string.h>
#include "psa/protected_storage.h"
-#include "tfm_memory_utils.h"
#include "s_test_helpers.h"
#include "test_framework_helpers.h"
@@ -85,13 +85,13 @@
}
/* Check that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
/* Set the original data into read buffer */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
}
TEST_LOG("\n");
@@ -141,7 +141,7 @@
}
/* Check that the data has not changed */
- if (tfm_memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
+ if (memcmp(read_data, RESULT_DATA, sizeof(read_data)) != 0) {
TEST_FAIL("The data should not have changed");
return;
}
@@ -154,7 +154,7 @@
}
/* Set the original data into read buffer */
- tfm_memcpy(read_data, READ_DATA, sizeof(read_data));
+ memcpy(read_data, READ_DATA, sizeof(read_data));
}
TEST_LOG("\n");