Test: Remove Library Model codes
Library Model is deprecated, so remove the related codes in test repo.
- Remove core test since it is Library Model specific.
Signed-off-by: Summer Qin <summer.qin@arm.com>
Change-Id: I5790aa311248b9f0bf4fc3641f29127955a5dd92
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 44d4d15..e7d0cdf 100755
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -70,7 +70,6 @@
target_compile_definitions(tfm_ns_interface
INTERFACE
- TFM_PSA_API
$<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC>
$<$<BOOL:${TFM_NS_MANAGE_NSID}>:TFM_NS_MANAGE_NSID>
$<$<BOOL:${TEST_NS_MANAGE_NSID}>:TEST_NS_MANAGE_NSID>
diff --git a/app/test_app.c b/app/test_app.c
index 93cbd54..1efc45f 100644
--- a/app/test_app.c
+++ b/app/test_app.c
@@ -12,12 +12,6 @@
#include "test_framework_integ_test.h"
#endif
-#if defined(TEST_FRAMEWORK_S) && defined(TFM_LIB_MODEL)
-/* Function tfm_secure_client_run_tests() which is declared in
- * tfm_secure_client_service_api.h is only required in NS for Library mode. */
-#include "tfm_secure_client_service_api.h"
-#endif
-
#if PSA_API_TEST_NS
/**
* \brief This symbol is the entry point provided by the PSA API compliance
@@ -35,15 +29,6 @@
{
UNUSED_VARIABLE(argument);
-#if defined(TEST_FRAMEWORK_S) && defined(TFM_LIB_MODEL)
- /* FIXME: The non-secure audit log test currently relies on the fact that
- * the audit log secure test is run first. However the Non-secure tests
- * represent simpler and more common test cases which would make more sense
- * to be run first. Therefore if this dependency is removed the execution
- * order of these test classes should be reversed. */
- tfm_secure_client_run_tests();
-#endif
-
#ifdef TEST_FRAMEWORK_NS
tfm_non_secure_client_run_tests();
#endif
diff --git a/docs/tfm_test_suites_addition.rst b/docs/tfm_test_suites_addition.rst
index 99929c5..575e6e2 100644
--- a/docs/tfm_test_suites_addition.rst
+++ b/docs/tfm_test_suites_addition.rst
@@ -112,7 +112,7 @@
#. TF-M partitions configurations like ``TFM_PARTITION_CRYPTO``,
``TFM_PARTITION_INITIAL_ATTESTATION``, etc.
- #. TF-M build mode configuration like ``TFM_LIB_MODEL``.
+ #. TF-M build mode configuration like ``CONFIG_TFM_SPM_BACKEND``.
#. TF-M other configurations like ``TFM_PARTITION_FIRMWARE_UPDATE``, etc.
#. ``tf-m-tests/config/default_ns_test_config.cmake`` or
diff --git a/test/config/check_config.cmake b/test/config/check_config.cmake
index efe10ac..96857ce 100644
--- a/test/config/check_config.cmake
+++ b/test/config/check_config.cmake
@@ -14,7 +14,6 @@
TEST_S;
TEST_NS_ATTESTATION;
TEST_NS_AUDIT;
- TEST_NS_CORE;
TEST_NS_CRYPTO;
TEST_NS_ITS;
TEST_NS_QCBOR;
@@ -52,7 +51,7 @@
tfm_invalid_config(NOT TFM_PARTITION_FIRMWARE_UPDATE AND (TEST_NS_FWU OR TEST_S_FWU))
tfm_invalid_config(NOT TFM_PARTITION_AUDIT_LOG AND (TEST_NS_AUDIT OR TEST_S_AUDIT))
-tfm_invalid_config((TEST_NS_IPC OR TEST_S_IPC OR TEST_NS_CORE) AND CONFIG_TFM_SPM_BACKEND_SFN)
+tfm_invalid_config((TEST_NS_IPC OR TEST_S_IPC) AND CONFIG_TFM_SPM_BACKEND_SFN)
tfm_invalid_config(TEST_S_SFN_BACKEND AND CONFIG_TFM_SPM_BACKEND_IPC)
tfm_invalid_config(CONFIG_TFM_FLOAT_ABI STREQUAL "soft" AND (TEST_S_FPU OR TEST_NS_FPU))
diff --git a/test/config/default_ns_test_config.cmake b/test/config/default_ns_test_config.cmake
index 29b7925..fcbef75 100644
--- a/test/config/default_ns_test_config.cmake
+++ b/test/config/default_ns_test_config.cmake
@@ -28,4 +28,3 @@
set(TEST_NS_FPU OFF CACHE BOOL "Whether to build NS regression FPU tests")
set(TEST_NS_IPC OFF CACHE BOOL "Whether to build NS regression IPC tests")
set(TEST_NS_SFN_BACKEND OFF CACHE BOOL "Whether to build NS regression SFN backend tests")
-set(TEST_NS_CORE OFF CACHE BOOL "Whether to build NS regression Core tests")
diff --git a/test/config/default_test_config.cmake b/test/config/default_test_config.cmake
index 599d9ab..a6c64bf 100644
--- a/test/config/default_test_config.cmake
+++ b/test/config/default_test_config.cmake
@@ -15,7 +15,6 @@
set(TEST_NS_T_COSE OFF CACHE BOOL "Whether to build NS regression t_cose tests")
set(TEST_NS_QCBOR OFF CACHE BOOL "Whether to build NS regression QCBOR tests")
set(TEST_NS_AUDIT OFF CACHE BOOL "Whether to build NS regression Audit log tests")
-set(TEST_NS_CORE OFF CACHE BOOL "Whether to build NS regression Core tests")
set(TEST_NS_CRYPTO OFF CACHE BOOL "Whether to build NS regression Crypto tests")
set(TEST_NS_ITS OFF CACHE BOOL "Whether to build NS regression ITS tests")
set(TEST_NS_PS OFF CACHE BOOL "Whether to build NS regression PS tests")
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.c b/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.c
index 9925154..cdd15f1 100644
--- a/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.c
+++ b/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.c
@@ -9,12 +9,8 @@
#include "psa/internal_trusted_storage.h"
#include "psa/crypto.h"
-#ifdef TFM_PSA_API
#include "psa/service.h"
#include "psa_manifest/tfm_secure_client_2.h"
-#else
-#include "psa/client.h"
-#endif
#ifdef TFM_IPC_ISOLATION_3_RETRIEVE_APP_MEM
/* Define the global variable for the TFM_SECURE_CLIENT_2_SID service. */
@@ -120,7 +116,6 @@
}
}
-#ifdef TFM_PSA_API
#define SECURE_CLIENT_2_MAX_ARG_LEN 8U
static psa_status_t tfm_secure_client_2_handle_msg(const psa_msg_t *msg)
@@ -170,26 +165,3 @@
}
#endif /* TFM_SP_SECURE_CLIENT_2_MODEL_IPC == 1 */
-
-#else /* TFM_PSA_API */
-psa_status_t tfm_secure_client_2_init(void)
-{
- return PSA_SUCCESS;
-}
-
-psa_status_t tfm_secure_client_2_call(psa_invec *in_vec, size_t in_len,
- psa_outvec *out_vec, size_t out_len)
-{
- int32_t id;
-
- (void)out_vec;
-
- if (in_len != 2 || out_len != 0 || in_vec[0].len != sizeof(id)) {
- return PSA_ERROR_PROGRAMMER_ERROR;
- }
-
- id = *((int32_t *)in_vec[0].base);
-
- return secure_client_2_dispatch(id, in_vec[1].base, in_vec[1].len);
-}
-#endif /* TFM_PSA_API */
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.yaml b/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.yaml
index 8fa6e0c..50167d1 100644
--- a/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.yaml
+++ b/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2.yaml
@@ -13,15 +13,6 @@
"priority": "NORMAL",
"entry_point": "tfm_secure_client_2_init",
"stack_size": "0x300",
- "secure_functions": [
- {
- "name": "TFM_SECURE_CLIENT_2_CALL",
- "signal": "TFM_SECURE_CLIENT_2_CALL",
- "non_secure_clients": false,
- "version": 1,
- "version_policy": "STRICT"
- },
- ],
"services": [
{
"name": "TFM_SECURE_CLIENT_2",
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2_api.c b/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2_api.c
index b0701ad..279d814 100644
--- a/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2_api.c
+++ b/test/secure_fw/common_test_services/tfm_secure_client_2/tfm_secure_client_2_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,17 +8,12 @@
#include "tfm_secure_client_2_api.h"
#include "psa/client.h"
-#ifdef TFM_PSA_API
#include "psa_manifest/sid.h"
-#else
-#include "tfm_veneers.h"
-#endif
__attribute__((section("SFN")))
psa_status_t tfm_secure_client_2_call_test(int32_t id, const void *arg,
size_t arg_len)
{
-#ifdef TFM_PSA_API
psa_handle_t handle;
psa_status_t status;
psa_invec in_vec[] = {
@@ -35,13 +30,4 @@
psa_close(handle);
return status;
-#else
- /* Pack the ID in the invec */
- psa_invec in_vec[] = {
- { .base = &id, .len = sizeof(id) },
- { .base = arg, .len = arg_len },
- };
-
- return tfm_secure_client_2_call_veneer(in_vec, 2, NULL, 0);
-#endif
}
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.c b/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.c
index 3034f0c..489bca1 100644
--- a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.c
+++ b/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.c
@@ -7,10 +7,8 @@
#include "tfm_secure_client_service.h"
#include "test_framework_integ_test.h"
-#ifdef TFM_PSA_API
#include "psa/service.h"
#include "psa_manifest/tfm_secure_client_service.h"
-#endif
/**
* \brief Service initialisation function. No special initialisation is
* required.
@@ -19,7 +17,6 @@
*/
int32_t tfm_secure_client_service_init(void)
{
-#ifdef TFM_PSA_API
tfm_secure_client_service_sfn_run_tests();
#if TFM_SP_SECURE_TEST_PARTITION_MODEL_IPC == 1
@@ -29,7 +26,6 @@
psa_panic();
}
#endif /* TFM_SP_SECURE_TEST_PARTITION_MODEL_IPC == 1 */
-#endif
return 0;
}
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.yaml b/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.yaml
index d12ca3a..2afd802 100644
--- a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.yaml
+++ b/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service.yaml
@@ -20,15 +20,6 @@
"permission": "READ-WRITE"
}
],
- "secure_functions": [
- {
- "name": "TFM_SECURE_CLIENT_SFN_RUN_TESTS",
- "signal": "TFM_SECURE_CLIENT_SERVICE_SFN_RUN_TESTS",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- ],
"services": [
{
"name": "TFM_SECURE_CLIENT_SRV_DUMMY",
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service_api.c b/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service_api.c
deleted file mode 100644
index 6e1eb52..0000000
--- a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service_api.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "tfm_secure_client_service_api.h"
-#include "tfm_veneers.h"
-
-int32_t tfm_secure_client_run_tests(void)
-{
-#ifndef TFM_PSA_API
- tfm_secure_client_service_sfn_run_tests_veneer(NULL, 0, NULL, 0);
-#endif
-
- return 0;
-}
diff --git a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service_api.h b/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service_api.h
deleted file mode 100644
index 35e9004..0000000
--- a/test/secure_fw/common_test_services/tfm_secure_client_service/tfm_secure_client_service_api.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SECURE_CLIENT_SERVICE_API_H__
-#define __TFM_SECURE_CLIENT_SERVICE_API_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Runs the secure integration tests.
- *
- * \return Returns 0 on success
- */
-int32_t tfm_secure_client_run_tests(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_SECURE_CLIENT_SERVICE_API_H__ */
diff --git a/test/secure_fw/non_secure_suites.c b/test/secure_fw/non_secure_suites.c
index 75c19d5..484697f 100644
--- a/test/secure_fw/non_secure_suites.c
+++ b/test/secure_fw/non_secure_suites.c
@@ -36,16 +36,13 @@
#ifdef TEST_NS_PLATFORM
#include "platform_ns_tests.h"
#endif
-#ifdef TEST_NS_CORE
-#include "core_ns_tests.h"
-#endif
#ifdef TEST_NS_IPC
#include "ipc_ns_tests.h"
#else
#ifdef TEST_NS_AUDIT
#include "audit_ns_tests.h"
#endif
-#endif /* TFM_PSA_API */
+#endif /* TEST_NS_IPC */
#ifdef TEST_NS_MULTI_CORE
#include "multi_core_ns_test.h"
#endif /* TEST_NS_MULTI_CORE */
@@ -70,11 +67,6 @@
static struct test_suite_t test_suites[] = {
/* List test cases which are compliant with level 1 isolation */
-#ifdef TEST_NS_CORE
- /* Non-secure core test cases */
- {®ister_testsuite_ns_core_positive, 0, 0, 0},
-#endif
-
#ifdef TEST_NS_IPC
/* Non-secure IPC test cases */
{®ister_testsuite_ns_ipc_interface, 0, 0, 0},
diff --git a/test/secure_fw/secure_tests.cmake b/test/secure_fw/secure_tests.cmake
index 74a4431..b608a7f 100644
--- a/test/secure_fw/secure_tests.cmake
+++ b/test/secure_fw/secure_tests.cmake
@@ -21,7 +21,6 @@
# Test services are also required by some NS regression tests.
# Include test services at first no matter whether secure tests are enabled.
-add_subdirectory(suites/core/service ${CMAKE_BINARY_DIR}/tf-m-tests/core_srv)
add_subdirectory(suites/spm/ipc/service ${CMAKE_BINARY_DIR}/tf-m-tests/ipc_srv)
add_subdirectory(suites/spm/sfn/service ${CMAKE_BINARY_DIR}/tf-m-tests/sfn_srv)
add_subdirectory(suites/spm/irq/service ${CMAKE_BINARY_DIR}/tf-m-tests/irq_srv)
diff --git a/test/secure_fw/suites/CMakeLists.txt b/test/secure_fw/suites/CMakeLists.txt
index c6f8d97..8795e4a 100644
--- a/test/secure_fw/suites/CMakeLists.txt
+++ b/test/secure_fw/suites/CMakeLists.txt
@@ -69,7 +69,6 @@
# Secure test suite library targets shall already be added in secure_tests.cmake
add_subdirectory(attestation)
add_subdirectory(audit)
-add_subdirectory(core)
add_subdirectory(crypto)
add_subdirectory(extra)
add_subdirectory(its)
diff --git a/test/secure_fw/suites/core/CMakeLists.txt b/test/secure_fw/suites/core/CMakeLists.txt
deleted file mode 100644
index cf5eec5..0000000
--- a/test/secure_fw/suites/core/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-cmake_policy(SET CMP0079 NEW)
-
-if (NOT TEST_NS_CORE)
- return()
-endif()
-
-####################### Non Secure #############################################
-
-add_library(tfm_test_suite_core_ns STATIC EXCLUDE_FROM_ALL)
-
-target_sources(tfm_test_suite_core_ns
- PRIVATE
- non_secure/core_ns_positive_testsuite.c
- non_secure/core_test_api.c
-)
-
-target_include_directories(tfm_test_suite_core_ns
- PUBLIC
- non_secure
-)
-
-target_compile_definitions(tfm_test_suite_core_ns
- PRIVATE
- DOMAIN_NS=1
- INTERFACE
- TEST_NS_CORE
-)
-
-target_link_libraries(tfm_test_suite_core_ns
- PRIVATE
- tfm_test_framework_ns
- CMSIS_5_tfm_ns
- tfm_partition_defs
- platform_ns
- tfm_psa_rot_partition_core_test_defs
-)
-
-target_link_libraries(tfm_ns_tests
- INTERFACE
- tfm_test_suite_core_ns
-)
diff --git a/test/secure_fw/suites/core/non_secure/core_ns_positive_testsuite.c b/test/secure_fw/suites/core/non_secure/core_ns_positive_testsuite.c
deleted file mode 100644
index e4cdea7..0000000
--- a/test/secure_fw/suites/core/non_secure/core_ns_positive_testsuite.c
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
- * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include "core_ns_tests.h"
-#include "cmsis.h"
-#include "tfm_api.h"
-#include "tfm_plat_test.h"
-#include "core_test_api.h"
-#include "core_test_defs.h"
-#ifdef TFM_PSA_API
-#include "psa_manifest/sid.h"
-#else /* TFM_PSA_API */
-#include "tfm_veneers.h"
-#endif /* TFM_PSA_API */
-
-/* Define test suite for core tests */
-/* List of tests */
-
-#define TOSTRING(x) #x
-#define CORE_TEST_DESCRIPTION(number, fn, description) \
- {fn, "TFM_NS_CORE_TEST_"TOSTRING(number),\
- description}
-
-#ifndef TFM_PSA_API
-static void tfm_core_test_get_caller_client_id(struct test_result_t *ret);
-#endif /* TFM_PSA_API */
-static void tfm_core_test_ns_thread(struct test_result_t *ret);
-static void tfm_core_test_check_init(struct test_result_t *ret);
-#ifdef ENABLE_TFM_CORE_RECURSION_TESTS
-static void tfm_core_test_recursion(struct test_result_t *ret);
-#endif
-static void tfm_core_test_buffer_check(struct test_result_t *ret);
-static void tfm_core_test_ss_to_ss(struct test_result_t *ret);
-static void tfm_core_test_ss_to_ss_buffer(struct test_result_t *ret);
-static void tfm_core_test_iovec_sanitization(struct test_result_t *ret);
-static void tfm_core_test_outvec_write(struct test_result_t *ret);
-
-static struct test_t core_tests[] = {
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_NS_THREAD, tfm_core_test_ns_thread,
- "Test service request from NS thread mode"),
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_CHECK_INIT, tfm_core_test_check_init,
- "Test the success of service init"),
-#ifdef ENABLE_TFM_CORE_RECURSION_TESTS
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_RECURSION, tfm_core_test_recursion,
- "Test direct recursion of secure services"),
-#endif
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_BUFFER_CHECK, tfm_core_test_buffer_check,
- "Test secure service buffer accesses"),
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_SS_TO_SS, tfm_core_test_ss_to_ss,
- "Test secure service to service call"),
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_SS_TO_SS_BUFFER,
- tfm_core_test_ss_to_ss_buffer,
- "Test secure service to service call with buffer handling"),
-#ifndef TFM_PSA_API
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_GET_CALLER_CLIENT_ID,
- tfm_core_test_get_caller_client_id,
- "Test get caller client ID function"),
-#endif /* TFM_PSA_API */
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_IOVEC_SANITIZATION,
- tfm_core_test_iovec_sanitization,
- "Test service parameter sanitization"),
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_OUTVEC_WRITE,
- tfm_core_test_outvec_write,
- "Test outvec write"),
-};
-
-void register_testsuite_ns_core_positive(struct test_suite_t *p_test_suite)
-{
- uint32_t list_size;
-
- list_size = (sizeof(core_tests) / sizeof(core_tests[0]));
-
- set_testsuite("Core non-secure positive tests (TFM_NS_CORE_TEST_1XXX)",
- core_tests, list_size, p_test_suite);
-}
-
-#ifdef TFM_PSA_API
-static psa_status_t psa_test_common(uint32_t sid, uint32_t version,
- const psa_invec *in_vecs, size_t in_len,
- psa_outvec *out_vecs, size_t out_len)
-{
- psa_handle_t handle;
- psa_status_t status;
-
- handle = psa_connect(sid, version);
- if (handle <= 0) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- status = psa_call(handle, PSA_IPC_CALL, in_vecs, in_len, out_vecs, out_len);
- if (status < 0) {
- status = CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR;
- }
-
- psa_close(handle);
- return status;
-}
-#endif /* TFM_PSA_API */
-
-static void tfm_core_test_ns_thread(struct test_result_t *ret)
-{
- int32_t err;
-#ifndef TFM_PSA_API
- int32_t test_case_id = CORE_TEST_ID_NS_THREAD;
- psa_invec in_vec[] = { {&test_case_id, sizeof(int32_t)} };
-
- err = tfm_spm_core_test_sfn_veneer(in_vec, 1, NULL, 0);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_NS_THREAD_SID,
- SPM_CORE_TEST_NS_THREAD_VERSION,
- NULL, 0, NULL, 0);
-#endif /* TFM_PSA_API */
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("Secure function call from thread mode should be successful");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-static void empty_iovecs(psa_invec invec[], psa_outvec outvec[])
-{
- int i = 0;
-
- for (i = 0; i < PSA_MAX_IOVEC; ++i) {
- invec[i].len = 0;
- invec[i].base = NULL;
- outvec[i].len = 0;
- outvec[i].base = NULL;
- }
-}
-
-static void full_iovecs(psa_invec invec[], psa_outvec outvec[])
-{
- int i = 0;
-
- for (i = 0; i < PSA_MAX_IOVEC; ++i) {
- invec[i].len = sizeof(psa_invec);
- invec[i].base = invec + i;
- outvec[i].len = PSA_MAX_IOVEC * sizeof(psa_outvec);
- outvec[i].base = outvec;
- }
-}
-
-static void tfm_core_test_iovec_sanitization(struct test_result_t *ret)
-{
- int32_t err;
- psa_invec in_vec[PSA_MAX_IOVEC] = {
- {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0} };
- psa_outvec out_vec[PSA_MAX_IOVEC] = {
- {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0} };
-
-#ifndef TFM_PSA_API
- struct tfm_core_test_call_args_t args = {NULL, 0, NULL, 0};
-#endif /* TFM_PSA_API */
-
- /* Check a few valid cases */
-
- /* Execute a call with valid iovecs (empty) */
- empty_iovecs(in_vec, out_vec);
-
-#ifndef TFM_PSA_API
- args.in_vec = NULL;
- args.in_len = 0;
- args.out_vec = NULL;
- args.out_len = 0;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- NULL, 0, NULL, 0);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL("iovec sanitization failed on empty vectors.");
- return;
- }
-
- /* Execute a call with valid iovecs (full) */
- full_iovecs(in_vec, out_vec);
-#ifndef TFM_PSA_API
- args.in_vec = in_vec;
- args.in_len = 2;
- args.out_vec = out_vec;
- args.out_len = PSA_MAX_IOVEC - args.in_len;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- in_vec, 2, out_vec, 2);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL("iovec sanitization failed on full vectors.");
- return;
- }
-
- /* Execute a call with valid iovecs (different number of vectors) */
- full_iovecs(in_vec, out_vec);
-#ifndef TFM_PSA_API
- args.in_vec = in_vec;
- args.in_len = 2;
- args.out_vec = out_vec;
- args.out_len = 1;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- in_vec, 2, out_vec, 1);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL(
- "iovec sanitization failed on valid, partially full vectors.");
- return;
- }
-
- /* Check some further valid cases to be sure that checks happen only iovecs
- * that specified valid by the parameters
- */
-
- /* Execute a call with base = 0 in single vector in outvec that is out of
- * range
- */
- full_iovecs(in_vec, out_vec);
- out_vec[1].base = NULL;
-#ifndef TFM_PSA_API
- args.in_vec = in_vec;
- args.in_len = 2;
- args.out_vec = out_vec;
- args.out_len = 1;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- in_vec, 2, out_vec, 1);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL("content of an outvec out of range should not be checked");
- return;
- }
-
- /* Execute a call with len = 0 in single vector in invec that is out of
- * range
- */
- full_iovecs(in_vec, out_vec);
- in_vec[2].len = 0;
-#ifndef TFM_PSA_API
- args.in_vec = in_vec;
- args.in_len = 2;
- args.out_vec = out_vec;
- args.out_len = 1;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- in_vec, 2, out_vec, 1);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL("content of an outvec out of range should not be checked");
- return;
- }
-
- /* Execute a call with len = 0 in single vector in invec */
- full_iovecs(in_vec, out_vec);
- in_vec[1].len = 0;
- in_vec[1].base = NULL;
-#ifndef TFM_PSA_API
- args.in_vec = in_vec;
- args.in_len = 2;
- args.out_vec = out_vec;
- args.out_len = 2;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- in_vec, 2, out_vec, 2);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL("If the len of an invec is 0, the base should be ignored");
- return;
- }
-
- /* Execute a call with len = 0 in single vector in outvec */
- full_iovecs(in_vec, out_vec);
- out_vec[1].len = 0;
- out_vec[1].base = NULL;
-#ifndef TFM_PSA_API
- args.in_vec = in_vec;
- args.in_len = 2;
- args.out_vec = out_vec;
- args.out_len = 2;
- err = tfm_core_test_call(tfm_spm_core_test_2_slave_service_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- in_vec, 2, out_vec, 2);
-#endif /* TFM_PSA_API */
- if (err != CORE_TEST_ERRNO_SUCCESS_2) {
- TEST_FAIL("If the len of an outvec is 0, the base should be ignored");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-static void tfm_core_test_outvec_write(struct test_result_t *ret)
-{
- int32_t err;
- int i;
- uint8_t in_buf_0[] = {0, 1, 2, 3, 4};
- uint8_t in_buf_1[] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89};
- uint8_t out_buf_0[sizeof(in_buf_0)];
- uint8_t out_buf_1[sizeof(in_buf_1)];
-
- psa_invec in_vec[PSA_MAX_IOVEC] = { {in_buf_0, sizeof(in_buf_0)},
- {in_buf_1, sizeof(in_buf_1)} };
- psa_outvec out_vec[PSA_MAX_IOVEC] = { {out_buf_0, sizeof(out_buf_0) },
- {out_buf_1, sizeof(out_buf_1)} };
-#ifndef TFM_PSA_API
- int32_t test_case_id = CORE_TEST_ID_OUTVEC_WRITE;
- struct tfm_core_test_call_args_t args1 = {in_vec, 2, out_vec, 2};
- struct tfm_core_test_call_args_t args2 = {in_vec, 1, NULL, 0};
-
- err = tfm_core_test_call(tfm_spm_core_test_2_get_every_second_byte_veneer,
- &args1);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SID,
- SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_VERSION,
- in_vec, 2, out_vec, 2);
-#endif /* TFM_PSA_API */
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("call to secure function should be successful");
- return;
- }
-
- if (out_vec[0].len != sizeof(in_buf_0)/2 ||
- out_vec[1].len != sizeof(in_buf_1)/2) {
- TEST_FAIL("Number of elements in outvec is not set properly");
- return;
- }
- for (i = 1; i < sizeof(in_buf_0); i += 2) {
- if (((uint8_t *)out_vec[0].base)[i/2] != in_buf_0[i]) {
- TEST_FAIL("result is not correct");
- return;
- }
- }
- for (i = 1; i < sizeof(in_buf_1); i += 2) {
- if (((uint8_t *)out_vec[1].base)[i/2] != in_buf_1[i]) {
- TEST_FAIL("result is not correct");
- return;
- }
- }
-
- /* do the same test on the secure side */
-#ifndef TFM_PSA_API
- in_vec[0].base = &test_case_id;
- in_vec[0].len = sizeof(int32_t);
- err = tfm_core_test_call(tfm_spm_core_test_sfn_veneer, &args2);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_OUTVEC_WRITE_SID,
- SPM_CORE_TEST_OUTVEC_WRITE_VERSION,
- in_vec, 0, out_vec, 0);
-#endif /* TFM_PSA_API */
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("Failed to execute secure side test");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-/*
- * \brief Tests whether the initialisation of the service was successful.
- *
- */
-static void tfm_core_test_check_init(struct test_result_t *ret)
-{
- int32_t err;
-#ifndef TFM_PSA_API
- struct tfm_core_test_call_args_t args = {NULL, 0, NULL, 0};
-
- err = tfm_core_test_call(tfm_spm_core_test_sfn_init_success_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_INIT_SUCCESS_SID,
- SPM_CORE_TEST_INIT_SUCCESS_VERSION,
- NULL, 0, NULL, 0);
-#endif /* TFM_PSA_API */
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("Failed to initialise test service.");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-#ifdef ENABLE_TFM_CORE_RECURSION_TESTS
-/**
- * \brief Tests what happens when a service calls itself directly
- */
-static void tfm_core_test_recursion(struct test_result_t *ret)
-{
- /*
- * TODO
- * Recursive calls will trigger a fatal error. Current test framework cannot
- * recover from that error.
- * Leave a test case stub here for further implementation.
- */
- TEST_FAIL("The test case is not implemented yet.");
-}
-#endif
-
-static void tfm_core_test_buffer_check(struct test_result_t *ret)
-{
- int32_t res, i;
-
- uint32_t inbuf[] = {1, 2, 3, 4, 0xAAAFFF, 0xFFFFFFFF};
- uint32_t outbuf[16] = {0};
- int32_t result = 1;
- psa_invec in_vec[] = { {inbuf, sizeof(inbuf)} };
- psa_outvec outvec[] = { {outbuf, sizeof(outbuf)},
- {&result, sizeof(int32_t)} };
-#ifndef TFM_PSA_API
- struct tfm_core_test_call_args_t args = {in_vec, 1, outvec, 2};
-
- res = tfm_core_test_call(tfm_spm_core_test_2_sfn_invert_veneer, &args);
-#else /* TFM_PSA_API */
- res = psa_test_common(SPM_CORE_TEST_2_INVERT_SID,
- SPM_CORE_TEST_2_INVERT_VERSION,
- in_vec, 1, outvec, 2);
-#endif /* TFM_PSA_API */
- if (res != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("Call to secure service should be successful.");
- return;
- }
- if (result == 0) {
- for (i = 0; i < sizeof(inbuf) >> 2; i++) {
- if (outbuf[i] != ~inbuf[i]) {
- TEST_FAIL("Secure function failed to modify buffer.");
- return;
- }
- }
- for (; i < sizeof(outbuf) >> 2; i++) {
- if (outbuf[i] != 0) {
- TEST_FAIL("Secure function buffer access overflow.");
- return;
- }
- }
- } else {
- TEST_FAIL("Secure service returned error.");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-static void tfm_core_test_ss_to_ss(struct test_result_t *ret)
-{
- int32_t err;
-
-#ifndef TFM_PSA_API
- int32_t test_case_id = CORE_TEST_ID_SS_TO_SS;
- psa_invec in_vec[] = { {&test_case_id, sizeof(int32_t)} };
- struct tfm_core_test_call_args_t args = {in_vec, 1, NULL, 0};
-
- err = tfm_core_test_call(tfm_spm_core_test_sfn_veneer, &args);
-#else /* TFM_PSA_API */
- err = psa_test_common(SPM_CORE_TEST_SS_TO_SS_SID,
- SPM_CORE_TEST_SS_TO_SS_VERSION,
- NULL, 0, NULL, 0);
-#endif /* TFM_PSA_API */
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("The internal service call failed.");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-static void tfm_core_test_ss_to_ss_buffer(struct test_result_t *ret)
-{
- int32_t res, i;
-
- uint32_t inbuf[] = {1, 2, 3, 4, 0xAAAFFF, 0xFFFFFFFF};
- uint32_t outbuf[16] = {0};
- int32_t len = (int32_t)sizeof(inbuf) >> 2;
- psa_outvec out_vec[] = { {outbuf, sizeof(outbuf)} };
-#ifndef TFM_PSA_API
- int32_t test_case_id = CORE_TEST_ID_SS_TO_SS_BUFFER;
- psa_invec in_vec[] = { {&test_case_id, sizeof(int32_t)},
- {inbuf, sizeof(inbuf)},
- {&len, sizeof(int32_t)} };
- struct tfm_core_test_call_args_t args = {in_vec, 3, out_vec, 1};
-
- res = tfm_core_test_call(tfm_spm_core_test_sfn_veneer, &args);
-#else /* TFM_PSA_API */
- psa_invec in_vec[] = {{inbuf, sizeof(inbuf)},
- {&len, sizeof(int32_t)} };
-
- res = psa_test_common(SPM_CORE_TEST_SS_TO_SS_BUFFER_SID,
- SPM_CORE_TEST_SS_TO_SS_BUFFER_VERSION,
- in_vec, 2, out_vec, 1);
-#endif /* TFM_PSA_API */
- switch (res) {
- case CORE_TEST_ERRNO_SUCCESS:
- for (i = 0; i < sizeof(inbuf) >> 2; i++) {
- if (outbuf[i] != ~inbuf[i]) {
- TEST_FAIL("Secure function failed to modify buffer.");
- return;
- }
- }
- for (; i < sizeof(outbuf) >> 2; i++) {
- if (outbuf[i] != 0) {
- TEST_FAIL("Secure function buffer access overflow.");
- return;
- }
- }
- ret->val = TEST_PASSED;
- return;
- case CORE_TEST_ERRNO_INVALID_BUFFER:
- TEST_FAIL("NS buffer rejected by TF-M core.");
- return;
- case CORE_TEST_ERRNO_SLAVE_SP_CALL_FAILURE:
- TEST_FAIL("Slave service call failed.");
- return;
- case CORE_TEST_ERRNO_SLAVE_SP_BUFFER_FAILURE:
- TEST_FAIL("Slave secure function failed to modify buffer.");
- return;
- default:
- TEST_FAIL("Secure service returned error.");
- return;
- }
-}
-
-#ifndef TFM_PSA_API
-static void tfm_core_test_get_caller_client_id(struct test_result_t *ret)
-{
- int32_t err;
- int32_t test_case_id = CORE_TEST_ID_GET_CALLER_CLIENT_ID;
- psa_invec in_vec[] = { {&test_case_id, sizeof(int32_t)} };
- struct tfm_core_test_call_args_t args = {in_vec, 1, NULL, 0};
-
- err = tfm_core_test_call(tfm_spm_core_test_sfn_veneer, &args);
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- TEST_FAIL("The internal service call failed.");
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-#endif /* TFM_PSA_API */
diff --git a/test/secure_fw/suites/core/non_secure/core_ns_tests.h b/test/secure_fw/suites/core/non_secure/core_ns_tests.h
deleted file mode 100644
index 08a3fc9..0000000
--- a/test/secure_fw/suites/core/non_secure/core_ns_tests.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __CORE_NS_TESTS_H__
-#define __CORE_NS_TESTS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "test_framework.h"
-
-/**
- * \brief Register testsuite for the core positive tests.
- *
- * \param[in] p_test_suite The test suite to be executed.
- */
-void register_testsuite_ns_core_positive(struct test_suite_t *p_test_suite);
-
-/**
- * \brief Register testsuite for the core interactive tests.
- *
- * \param[in] p_test_suite The test suite to be executed.
- */
-void register_testsuite_ns_core_interactive(struct test_suite_t *p_test_suite);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CORE_NS_TESTS_H__ */
diff --git a/test/secure_fw/suites/core/non_secure/core_test_api.c b/test/secure_fw/suites/core/non_secure/core_test_api.c
deleted file mode 100644
index 7a7aa0b..0000000
--- a/test/secure_fw/suites/core/non_secure/core_test_api.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "core_test_api.h"
-#include "core_test_defs.h"
-
-int32_t tfm_core_test_call(int32_t (*fn_ptr)(struct psa_invec*, size_t,
- struct psa_outvec*, size_t),
- struct tfm_core_test_call_args_t *args)
-{
- return fn_ptr(args->in_vec, args->in_len,
- args->out_vec, args->out_len);
-}
diff --git a/test/secure_fw/suites/core/non_secure/core_test_api.h b/test/secure_fw/suites/core/non_secure/core_test_api.h
deleted file mode 100644
index eaa8b44..0000000
--- a/test/secure_fw/suites/core/non_secure/core_test_api.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __CORE_TEST_API_H__
-#define __CORE_TEST_API_H__
-
-#include <stdio.h>
-#include "cmsis_compiler.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief This structure is to pass iovec arguments to the tfm_core_test_call
- * function.
- */
-struct tfm_core_test_call_args_t {
- struct psa_invec *in_vec; /*!< Array of psa_invec objects */
- size_t in_len; /*!< Number psa_invec objects in in_vec */
- struct psa_outvec *out_vec; /*!< Array of psa_outvec objects */
- size_t out_len; /*!< Number psa_outvec objects in out_vec */
-};
-
-/**
- * \brief Calls the secure function provided in \c fn_ptr
- *
- * \param[in] fn_ptr Secure function to be called.
- * \param[in] args Arguments for fn_ptr.
- *
- * \return Returns value depending on fn_ptr.
- */
-int32_t tfm_core_test_call(int32_t (*fn_ptr)(),
- struct tfm_core_test_call_args_t *args);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CORE_TEST_API_H__ */
diff --git a/test/secure_fw/suites/core/service/CMakeLists.txt b/test/secure_fw/suites/core/service/CMakeLists.txt
deleted file mode 100644
index 20af676..0000000
--- a/test/secure_fw/suites/core/service/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2022, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-if (NOT TEST_NS_CORE)
- return()
-endif()
-
-add_subdirectory(tfm_core_test)
-add_subdirectory(tfm_core_test_2)
diff --git a/test/secure_fw/suites/core/service/tfm_core_test/CMakeLists.txt b/test/secure_fw/suites/core/service/tfm_core_test/CMakeLists.txt
deleted file mode 100644
index 67ed5dd..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-cmake_policy(SET CMP0079 NEW)
-
-add_library(tfm_psa_rot_partition_core_test STATIC)
-
-target_sources(tfm_psa_rot_partition_core_test
- PRIVATE
- tfm_ss_core_test.c
-)
-
-# The generated sources
-target_sources(tfm_psa_rot_partition_core_test
- PRIVATE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test/auto_generated/intermedia_tfm_ss_core_test.c
-)
-
-target_sources(tfm_partitions
- INTERFACE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test/auto_generated/load_info_tfm_ss_core_test.c
-)
-
-# Set include directory
-target_include_directories(tfm_psa_rot_partition_core_test
- PUBLIC
- .
- PRIVATE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test
-)
-
-target_include_directories(tfm_partitions
- INTERFACE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test
-)
-
-target_link_libraries(tfm_psa_rot_partition_core_test
- PRIVATE
- tfm_sprt
- platform_s
-)
-
-target_link_libraries(tfm_spm
- PRIVATE
- tfm_psa_rot_partition_core_test
-)
-
-# header files included by other libraries
-add_library(tfm_psa_rot_partition_core_test_defs INTERFACE)
-
-target_include_directories(tfm_psa_rot_partition_core_test_defs
- INTERFACE
- .
-)
-
-############################ Partition Defs ####################################
-
-target_link_libraries(tfm_partitions
- INTERFACE
- tfm_psa_rot_partition_core_test
-)
-
-target_compile_definitions(tfm_partition_defs
- INTERFACE
- TFM_PARTITION_TEST_CORE
-)
diff --git a/test/secure_fw/suites/core/service/tfm_core_test/core_test_defs.h b/test/secure_fw/suites/core/service/tfm_core_test/core_test_defs.h
deleted file mode 100644
index 2e57440..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test/core_test_defs.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __CORE_TEST_DEFS_H__
-#define __CORE_TEST_DEFS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-#include <limits.h>
-#include "tfm_api.h"
-
-/* These definitions are used in symbols, only digits are permitted */
-#define CORE_TEST_ID_NS_THREAD 1001
-#define CORE_TEST_ID_CHECK_INIT 1003
-#define CORE_TEST_ID_RECURSION 1004
-#define CORE_TEST_ID_BUFFER_CHECK 1007
-#define CORE_TEST_ID_SS_TO_SS 1008
-#define CORE_TEST_ID_SS_TO_SS_BUFFER 1010
-#define CORE_TEST_ID_GET_CALLER_CLIENT_ID 1013
-#define CORE_TEST_ID_IOVEC_SANITIZATION 1014
-#define CORE_TEST_ID_OUTVEC_WRITE 1015
-#define CORE_TEST_ID_SECURE_IRQ 1016
-
-/* Use lower 16 bits in return value for error code, upper 16 for line number
- * in test service
- */
-#define CORE_TEST_RETURN_ERROR(x) return (((__LINE__) << 16) | x)
-#define CORE_TEST_ERROR_GET_EXTRA(x) (x >> 16)
-#define CORE_TEST_ERROR_GET_CODE(x) (x & 0xFFFF)
-
-enum core_test_errno_t {
- CORE_TEST_ERRNO_TEST_NOT_SUPPORTED = -12,
- CORE_TEST_ERRNO_SP_NOT_INITED = -11,
- CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR = -10,
- CORE_TEST_ERRNO_SP_RECURSION_NOT_REJECTED = -9,
- CORE_TEST_ERRNO_INVALID_BUFFER = -8,
- CORE_TEST_ERRNO_SLAVE_SP_CALL_FAILURE = -7,
- CORE_TEST_ERRNO_SLAVE_SP_BUFFER_FAILURE = -6,
- CORE_TEST_ERRNO_FIRST_CALL_FAILED = -5,
- CORE_TEST_ERRNO_SECOND_CALL_FAILED = -4,
- CORE_TEST_ERRNO_TEST_FAULT = -3,
- CORE_TEST_ERRNO_INVALID_TEST_ID = -2,
- CORE_TEST_ERRNO_INVALID_PARAMETER = -1,
-
- CORE_TEST_ERRNO_SUCCESS = 0,
-
- CORE_TEST_ERRNO_SUCCESS_2 = 1,
-
- /* Following entry is only to ensure the error code of int size */
- CORE_TEST_ERRNO_FORCE_INT_SIZE = INT_MAX
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CORE_TEST_DEFS_H__ */
diff --git a/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.c b/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.c
deleted file mode 100644
index 377d5a2..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stddef.h>
-#include "core_test_defs.h"
-#include "tfm_ss_core_test.h"
-#include "tfm_veneers.h"
-#include "tfm_secure_api.h"
-#include "psa/service.h"
-#include "tfm_plat_test.h"
-#include "psa_manifest/pid.h"
-#include "psa_manifest/tfm_ss_core_test.h"
-#ifdef TFM_PSA_API
-#include "psa_manifest/sid.h"
-#endif
-
-static int32_t partition_init_done;
-
-#define INVALID_NS_CLIENT_ID 0x49abcdef
-#define EXPECTED_NS_CLIENT_ID (-1)
-
-#ifndef TFM_PSA_API
-/* Don't initialise caller_partition_id_zi and expect it to be linked in the
- * zero-initialised data area
- */
-static int32_t caller_client_id_zi;
-
-/* Initialise caller_partition_id_rw and expect it to be linked in the
- * read-write data area
- */
-static int32_t caller_client_id_rw = INVALID_NS_CLIENT_ID;
-
-static int32_t* invalid_addresses [] = {(int32_t*)0x0, (int32_t*)0xFFF12000};
-#else /* !defined(TFM_PSA_API) */
-
-static psa_status_t psa_test_common(uint32_t sid, uint32_t version,
- const psa_invec *in_vecs, size_t in_len,
- psa_outvec *out_vecs, size_t out_len)
-{
- psa_handle_t handle;
- psa_status_t status;
-
- handle = psa_connect(sid, version);
- if (handle <= 0) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- status = psa_call(handle, PSA_IPC_CALL, in_vecs, in_len, out_vecs, out_len);
- if (status < 0) {
- status = CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR;
- }
-
- psa_close(handle);
- return status;
-}
-#endif /* !defined(TFM_PSA_API) */
-
-psa_status_t spm_core_test_sfn_init_success(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len)
-{
- if ((in_len != 0) || (out_len != 0)) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- if (partition_init_done) {
- return CORE_TEST_ERRNO_SUCCESS;
- } else {
- return CORE_TEST_ERRNO_SP_NOT_INITED;
- }
-}
-
-#ifndef TFM_PSA_API
-psa_status_t spm_core_test_sfn_direct_recursion(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len)
-{
- uint32_t depth;
- struct psa_invec new_vec = {NULL, sizeof(uint32_t)};
-
- if ((in_len != 1) || (out_len != 0) ||
- (in_vec[0].len != sizeof(uint32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- depth = *((uint32_t *)in_vec[0].base);
-
- if (depth != 0) {
- /* Protect against scenario where TF-M core fails to block recursion */
- return CORE_TEST_ERRNO_SP_RECURSION_NOT_REJECTED;
- }
- /* Call to the same service again, should be rejected */
- depth += 1;
- new_vec.base = &depth;
- int32_t ret = tfm_spm_core_test_sfn_direct_recursion_veneer(&new_vec,
- 1, NULL, 0);
-
- if (ret == CORE_TEST_ERRNO_SUCCESS) {
- /* This is an unexpected return value */
- return CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR;
- } else if (ret == CORE_TEST_ERRNO_SP_RECURSION_NOT_REJECTED) {
- /* This means that service was started in recursion */
- return CORE_TEST_ERRNO_SP_RECURSION_NOT_REJECTED;
- } else {
- return CORE_TEST_ERRNO_SUCCESS;
- }
-}
-#endif /* !defined(TFM_PSA_API) */
-
-#define SS_BUFFER_LEN 16
-
-static psa_status_t test_ss_to_ss_buffer(uint32_t *in_ptr, uint32_t *out_ptr,
- int32_t len)
-{
- int32_t i;
- /* Service internal buffer */
- uint32_t ss_buffer[SS_BUFFER_LEN] = {0};
- uint32_t slave_buffer [len];
- int32_t result;
- int32_t *result_ptr = &result;
- int32_t res;
- psa_invec in_vec[] = { {slave_buffer, len*sizeof(uint32_t)} };
- psa_outvec outvec[] = { {slave_buffer, len*sizeof(uint32_t)},
- {result_ptr, sizeof(int32_t)} };
-
- if (len > SS_BUFFER_LEN) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- for (i = 0; i < len; i++) {
- ss_buffer[i] = in_ptr[i];
- }
-
- for (i = 0; i < len; i++) {
- slave_buffer[i] = ss_buffer[i];
- }
-
- /* Call internal service with buffer handling */
-
-#ifdef TFM_PSA_API
- res = psa_test_common(SPM_CORE_TEST_2_INVERT_SID,
- SPM_CORE_TEST_2_INVERT_VERSION,
- in_vec, 1, outvec, 2);
-#else /* defined(TFM_PSA_API) */
- res = tfm_spm_core_test_2_sfn_invert_veneer(in_vec, 1, outvec, 2);
-#endif /* defined(TFM_PSA_API) */
-
- if (res != CORE_TEST_ERRNO_SUCCESS) {
- return CORE_TEST_ERRNO_SLAVE_SP_CALL_FAILURE;
- }
-
- for (i = 0; i < len; i++) {
- if (slave_buffer[i] != ~ss_buffer[i]) {
- return CORE_TEST_ERRNO_SLAVE_SP_BUFFER_FAILURE;
- }
- ss_buffer[i] = slave_buffer[i];
- }
-
- for (i = 0; i < len; i++) {
- out_ptr[i] = ss_buffer[i];
- }
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-static psa_status_t test_outvec_write(void)
-{
- int32_t err;
- int i;
- uint8_t data_buf [36]; /* (6 + 12) * 2 = 36 plus some alignment */
- uint8_t *data_buf_ptr = data_buf;
- psa_invec in_vec [2];
- psa_outvec out_vec [2];
- uint8_t *in_buf_0;
- uint8_t *in_buf_1;
- uint8_t *out_buf_0;
- uint8_t *out_buf_1;
-
- in_buf_0 = data_buf_ptr;
- for (i = 0; i < 5; ++i, ++data_buf_ptr)
- {
- *data_buf_ptr = i;
- }
- in_vec[0].base = in_buf_0;
- in_vec[0].len = data_buf_ptr - in_buf_0;
-
- in_buf_1 = data_buf_ptr;
- *(data_buf_ptr++) = 1;
- *(data_buf_ptr++) = 1;
- for (i = 2; i < 11; ++i, ++data_buf_ptr)
- {
- *data_buf_ptr = *(data_buf_ptr-1) + *(data_buf_ptr-2);
- }
- in_vec[1].base = in_buf_1;
- in_vec[1].len = data_buf_ptr - in_buf_1;
-
- out_buf_0 = data_buf_ptr;
- data_buf_ptr += in_vec[0].len;
- out_vec[0].base = out_buf_0;
- out_vec[0].len = data_buf_ptr - out_buf_0;
-
- out_buf_1 = data_buf_ptr;
- data_buf_ptr += in_vec[1].len;
- out_vec[1].base = out_buf_1;
- out_vec[1].len = data_buf_ptr - out_buf_1;
-
-#ifdef TFM_PSA_API
- err = psa_test_common(SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SID,
- SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_VERSION,
- in_vec, 2, out_vec, 2);
-#else /* defined(TFM_PSA_API) */
- err = tfm_spm_core_test_2_get_every_second_byte_veneer(in_vec, 2,
- out_vec, 2);
-#endif /* defined(TFM_PSA_API) */
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- if (out_vec[0].len != in_vec[0].len/2 ||
- out_vec[1].len != in_vec[1].len/2) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
- for (i = 1; i < sizeof(in_buf_0); i += 2) {
- if (((uint8_t *)out_vec[0].base)[i/2] != in_buf_0[i]) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
- }
- for (i = 1; i < sizeof(in_buf_1); i += 2) {
- if (((uint8_t *)out_vec[1].base)[i/2] != in_buf_1[i]) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
- }
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-static psa_status_t test_ss_to_ss(void)
-{
- int32_t ret;
- /* Call to a different service, should be successful */
-#ifdef TFM_PSA_API
- ret = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
- SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION,
- NULL, 0, NULL, 0);
-#else /* defined(TFM_PSA_API) */
- ret = tfm_spm_core_test_2_slave_service_veneer(NULL, 0, NULL, 0);
-#endif /* defined(TFM_PSA_API) */
- if (ret == CORE_TEST_ERRNO_SUCCESS_2) {
- return CORE_TEST_ERRNO_SUCCESS;
- } else {
- return CORE_TEST_ERRNO_SLAVE_SP_CALL_FAILURE;
- }
-}
-
-#ifndef TFM_PSA_API
-static psa_status_t test_get_caller_client_id(void)
-{
- /* Call to a special service that checks the caller service ID */
- size_t i;
- int32_t ret;
- int32_t caller_client_id_stack = INVALID_NS_CLIENT_ID;
-
- caller_client_id_zi = INVALID_NS_CLIENT_ID;
-
- ret = tfm_spm_core_test_2_check_caller_client_id_veneer(NULL, 0, NULL, 0);
- if (ret != CORE_TEST_ERRNO_SUCCESS) {
- return CORE_TEST_ERRNO_SLAVE_SP_CALL_FAILURE;
- }
-
- /* test with invalid output pointers */
- for (i = 0; i < sizeof(invalid_addresses)/sizeof(invalid_addresses[0]); ++i)
- {
- ret = tfm_core_get_caller_client_id(invalid_addresses[i]);
- if (ret == TFM_SUCCESS) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
- }
-
- /* test with valid output pointers */
- ret = tfm_core_get_caller_client_id(&caller_client_id_zi);
- if (ret != TFM_SUCCESS || caller_client_id_zi != EXPECTED_NS_CLIENT_ID) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- ret = tfm_core_get_caller_client_id(&caller_client_id_rw);
- if (ret != TFM_SUCCESS || caller_client_id_rw != EXPECTED_NS_CLIENT_ID) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- ret = tfm_core_get_caller_client_id(&caller_client_id_stack);
- if (ret != TFM_SUCCESS ||
- caller_client_id_stack != EXPECTED_NS_CLIENT_ID) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-#endif /* !defined(TFM_PSA_API) */
-
-#ifndef TFM_PSA_API
-psa_status_t spm_core_test_sfn(struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len)
-{
- uint32_t tc;
- int32_t arg1;
- int32_t arg2;
- int32_t arg3;
-
- if ((in_len < 1) || (in_vec[0].len != sizeof(uint32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- tc = *((uint32_t *)in_vec[0].base);
-
- switch (tc) {
- case CORE_TEST_ID_SS_TO_SS:
- return test_ss_to_ss();
- case CORE_TEST_ID_SS_TO_SS_BUFFER:
- if ((in_len != 3) || (out_len != 1) ||
- (in_vec[2].len != sizeof(int32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- arg3 = *((int32_t *)in_vec[2].base);
- if ((in_vec[1].len < arg3*sizeof(int32_t)) ||
- (out_vec[0].len < arg3*sizeof(int32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- arg1 = (int32_t)in_vec[1].base;
- arg2 = (int32_t)out_vec[0].base;
- return test_ss_to_ss_buffer((uint32_t *)arg1, (uint32_t *)arg2, arg3);
- case CORE_TEST_ID_OUTVEC_WRITE:
- return test_outvec_write();
- case CORE_TEST_ID_GET_CALLER_CLIENT_ID:
- return test_get_caller_client_id();
- case CORE_TEST_ID_NS_THREAD:
- /* dummy service call is enough */
- return CORE_TEST_ERRNO_SUCCESS;
- default:
- return CORE_TEST_ERRNO_INVALID_TEST_ID;
- }
-}
-
-#else /* !defined(TFM_PSA_API) */
-
-#define SS_TO_SS_BUFFER_SIZE (16*4)
-
-typedef psa_status_t (*core_test_func_t)(psa_msg_t *msg);
-
-static psa_status_t tfm_core_test_sfn_wrap_init_success(psa_msg_t *msg)
-{
- return spm_core_test_sfn_init_success(NULL, 0, NULL, 0);
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_direct_recursion(psa_msg_t *msg)
-{
- return CORE_TEST_ERRNO_TEST_FAULT;
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_ss_to_ss(psa_msg_t *msg)
-{
- return test_ss_to_ss();
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_ss_to_ss_buffer(psa_msg_t *msg)
-{
- size_t num;
- uint32_t inbuf[SS_TO_SS_BUFFER_SIZE/sizeof(uint32_t)] = {0};
- uint32_t outbuf[SS_TO_SS_BUFFER_SIZE/sizeof(uint32_t)] = {0};
- uint32_t len;
- psa_status_t res;
-
- if ((msg->in_size[0] > SS_TO_SS_BUFFER_SIZE) ||
- (msg->in_size[1] != sizeof(int32_t)) ||
- (msg->out_size[0] > SS_TO_SS_BUFFER_SIZE)) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- num = psa_read(msg->handle, 0, inbuf, msg->in_size[0]);
- if (num != msg->in_size[0]) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- num = psa_read(msg->handle, 1, &len, sizeof(int32_t));
- if (num != sizeof(int32_t)) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- if (len > SS_TO_SS_BUFFER_SIZE) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- res = test_ss_to_ss_buffer(inbuf, outbuf, len);
- if (res < 0) {
- return res;
- }
-
- psa_write(msg->handle, 0, outbuf, len * sizeof(uint32_t));
-
- return res;
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_outvec_write(psa_msg_t *msg)
-{
- return test_outvec_write();
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_get_caller_client_id(psa_msg_t *msg)
-{
- return CORE_TEST_ERRNO_TEST_NOT_SUPPORTED;
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_ns_thread(psa_msg_t *msg)
-{
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-static void core_test_signal_handle(psa_signal_t signal, core_test_func_t pfn)
-{
- psa_msg_t msg;
- psa_status_t status;
-
- status = psa_get(signal, &msg);
- if (status) {
- return;
- }
-
- switch (msg.type) {
- case PSA_IPC_CONNECT:
- psa_reply(msg.handle, PSA_SUCCESS);
- break;
- case PSA_IPC_CALL:
- status = pfn(&msg);
- psa_reply(msg.handle, status);
- break;
- case PSA_IPC_DISCONNECT:
- psa_reply(msg.handle, PSA_SUCCESS);
- break;
- default:
- break;
- }
-}
-#endif /* !defined(TFM_PSA_API) */
-
-psa_status_t core_test_init(void)
-{
-#ifdef TFM_PSA_API
- psa_signal_t signals = 0;
-#endif /* defined(TFM_PSA_API) */
-
- partition_init_done = 1;
-
-#ifdef TFM_PSA_API
- while (1) {
- signals = psa_wait(PSA_WAIT_ANY, PSA_BLOCK);
- if (signals & SPM_CORE_TEST_INIT_SUCCESS_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_INIT_SUCCESS_SIGNAL,
- tfm_core_test_sfn_wrap_init_success);
- } else if (signals & SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL,
- tfm_core_test_sfn_wrap_direct_recursion);
- } else if (signals & SPM_CORE_TEST_SS_TO_SS_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_SS_TO_SS_SIGNAL,
- tfm_core_test_sfn_wrap_ss_to_ss);
- } else if (signals & SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL,
- tfm_core_test_sfn_wrap_ss_to_ss_buffer);
- } else if (signals & SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL,
- tfm_core_test_sfn_wrap_outvec_write);
- } else if (signals & SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL,
- tfm_core_test_sfn_wrap_get_caller_client_id);
- } else if (signals & SPM_CORE_TEST_NS_THREAD_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_NS_THREAD_SIGNAL,
- tfm_core_test_sfn_wrap_ns_thread);
- } else {
- ; /* do nothing */
- }
- }
-#else
- return CORE_TEST_ERRNO_SUCCESS;
-#endif /* defined(TFM_PSA_API) */
-}
diff --git a/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.h b/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.h
deleted file mode 100644
index eb9598f..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SS_CORE_TEST_H__
-#define __TFM_SS_CORE_TEST_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-#include <limits.h>
-#include "tfm_api.h"
-
-/**
- * \brief Tests whether the initialisation of the service was successful.
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * The function expects 0 in_vec objects.
- * The function expects 0 out_vec objects.
- *
- * \return Returns \ref CORE_TEST_ERRNO_SUCCESS on success, and
- * \ref CORE_TEST_ERRNO_SP_NOT_INITED on failure.
- */
-psa_status_t spm_core_test_sfn_init_success(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len);
-
-/**
- * \brief Tests what happens when a service calls itself directly.
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * The function expects 1 in_vec object:
- * in_vec[0].base: A buffer containing a pointer to an uint32_t value
- * containing the current depth of the call (the value of the
- * depth is 0 when first called).
- * in_vec[0].len: The size of a pointer in bytes.
-
- * The function expects 0 out_vec objects.
- *
- * \return Returns \ref CORE_TEST_ERRNO_SUCCESS.
- */
-psa_status_t spm_core_test_sfn_direct_recursion(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len);
-
-/**
- * \brief Entry point for multiple test cases to be executed on the secure side.
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * The function expects at least 1 in_vec object:
- *
- * in_vec[0].base: A buffer containing a pointer to an uint32_t value
- * containing the testcase id to be executed.
- * in_vec[0].len: The size of a pointer in bytes.
- *
- * The number of expected additional in_vecs and out_vecs is dependent on the id
- * of the test case. For details see the function implementation.
- *
- * \return Can return various error codes.
- */
-psa_status_t spm_core_test_sfn(struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_SS_CORE_TEST_H__ */
diff --git a/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.yaml b/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.yaml
deleted file mode 100644
index 6396f91..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test/tfm_ss_core_test.yaml
+++ /dev/null
@@ -1,94 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2021, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-{
- "psa_framework_version": 1.0,
- "name": "TFM_SP_CORE_TEST",
- "type": "PSA-ROT",
- "priority": "NORMAL",
- "entry_point": "core_test_init",
- "stack_size": "0x0380",
- "secure_functions": [
- {
- "name": "TFM_CORE_TEST_SFN",
- "signal": "SPM_CORE_TEST_SFN",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "TFM_CORE_TEST_SFN_INIT_SUCCESS",
- "signal": "SPM_CORE_TEST_SFN_INIT_SUCCESS",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "TFM_CORE_TEST_SFN_DIRECT_RECURSION",
- "signal": "SPM_CORE_TEST_SFN_DIRECT_RECURSION",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- }
- ],
- "services": [
- {
- "name": "SPM_CORE_TEST_INIT_SUCCESS",
- "sid": "0x0000F020",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_DIRECT_RECURSION",
- "sid": "0x0000F021",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_SS_TO_SS",
- "sid": "0x0000F024",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_SS_TO_SS_BUFFER",
- "sid": "0x0000F025",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_OUTVEC_WRITE",
- "sid": "0x0000F026",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_GET_CALLER_CLIENT_ID",
- "sid": "0x0000F027",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_NS_THREAD",
- "sid": "0x0000F028",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- }
- ],
- "dependencies": [
- "SPM_CORE_TEST_2_INVERT",
- "SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE",
- "SPM_CORE_TEST_2_SLAVE_SERVICE"
- ]
-}
diff --git a/test/secure_fw/suites/core/service/tfm_core_test_2/CMakeLists.txt b/test/secure_fw/suites/core/service/tfm_core_test_2/CMakeLists.txt
deleted file mode 100644
index 5bdbb03..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test_2/CMakeLists.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-cmake_policy(SET CMP0079 NEW)
-
-add_library(tfm_app_rot_partition_core_test_2 STATIC)
-
-target_sources(tfm_app_rot_partition_core_test_2
- PRIVATE
- tfm_ss_core_test_2.c
-)
-
-# The generated sources
-target_sources(tfm_app_rot_partition_core_test_2
- PRIVATE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test_2/auto_generated/intermedia_tfm_ss_core_test_2.c
-)
-
-target_sources(tfm_partitions
- INTERFACE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test_2/auto_generated/load_info_tfm_ss_core_test_2.c
-)
-
-# Set include directory
-target_include_directories(tfm_app_rot_partition_core_test_2
- PUBLIC
- .
- PRIVATE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test_2
-)
-
-target_include_directories(tfm_partitions
- INTERFACE
- ${CMAKE_BINARY_DIR}/generated/secure_fw/test_services/tfm_core_test_2
-)
-
-target_link_libraries(tfm_app_rot_partition_core_test_2
- PRIVATE
- tfm_sprt
- platform_s
- tfm_psa_rot_partition_core_test
-)
-
-target_link_libraries(tfm_spm
- PRIVATE
- tfm_app_rot_partition_core_test_2
-)
-
-############################ Partition Defs ####################################
-
-target_link_libraries(tfm_partitions
- INTERFACE
- tfm_app_rot_partition_core_test_2
-)
-
-target_compile_definitions(tfm_partition_defs
- INTERFACE
- TFM_PARTITION_TEST_CORE
-)
diff --git a/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.c b/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.c
deleted file mode 100644
index b9b6609..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stddef.h>
-#include "core_test_defs.h"
-#include "tfm_ss_core_test_2.h"
-#include "tfm_secure_api.h"
-#include "psa/service.h"
-#include "psa_manifest/pid.h"
-#include "psa_manifest/tfm_ss_core_test_2.h"
-
-#define INVALID_NS_CLIENT_ID 0x49abcdef
-#define INVERT_BUFFER_SIZE (16*4)
-
-#ifndef TFM_PSA_API
-/* Don't initialise caller_partition_id_zi and expect it to be linked in the
- * zero-initialised data area
- */
-static int32_t caller_client_id_zi;
-
-/* Initialise caller_partition_id_rw and expect it to be linked in the
- * read-write data area
- */
-static int32_t caller_client_id_rw = INVALID_NS_CLIENT_ID;
-
-static int32_t* invalid_addresses [] = {(int32_t*)0x0, (int32_t*)0xFFF12000};
-#endif /* !defined(TFM_PSA_API) */
-
-psa_status_t spm_core_test_2_slave_service(struct psa_invec *in_vec,
- size_t in_len,
- struct psa_outvec *out_vec,
- size_t out_len)
-{
- /* This function doesn't do any sanity check on the input parameters, nor
- * makes any expectation of them, always returns successfully, with a
- * non-zero return value.
- * This is to test the parameter sanitization mechanisms implemented in SPM,
- * and the handling of non-zero success codes.
- */
-
- return CORE_TEST_ERRNO_SUCCESS_2;
-}
-
-#ifndef TFM_PSA_API
-psa_status_t spm_core_test_2_check_caller_client_id(struct psa_invec *in_vec,
- size_t in_len,
- struct psa_outvec *out_vec,
- size_t out_len)
-{
- size_t i;
- int32_t caller_client_id_stack = INVALID_NS_CLIENT_ID;
- int32_t ret;
-
- caller_client_id_zi = INVALID_NS_CLIENT_ID;
-
- /* test with invalid output pointers */
- for (i = 0; i < sizeof(invalid_addresses)/sizeof(invalid_addresses[0]); ++i)
- {
- ret = tfm_core_get_caller_client_id(invalid_addresses[i]);
- if (ret == TFM_SUCCESS) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
- }
-
- /* test with valid output pointers */
- ret = tfm_core_get_caller_client_id(&caller_client_id_zi);
- if (ret != TFM_SUCCESS || caller_client_id_zi != TFM_SP_CORE_TEST) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- ret = tfm_core_get_caller_client_id(&caller_client_id_rw);
- if (ret != TFM_SUCCESS || caller_client_id_rw != TFM_SP_CORE_TEST) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- ret = tfm_core_get_caller_client_id(&caller_client_id_stack);
- if (ret != TFM_SUCCESS ||
- caller_client_id_stack != TFM_SP_CORE_TEST) {
- return CORE_TEST_ERRNO_TEST_FAULT;
- }
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
-#endif /* !defined(TFM_PSA_API) */
-
-psa_status_t spm_core_test_2_get_every_second_byte_internal(
- const uint8_t *inbuf,
- uint8_t *outbuf,
- size_t in_size,
- size_t *out_size)
-{
- int j;
-
- if (in_size/2 > *out_size) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- for (j = 1; j < in_size; j += 2) {
- outbuf[j/2] = inbuf[j];
- }
- *out_size = in_size/2;
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-psa_status_t spm_core_test_2_get_every_second_byte(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len)
-{
- int i;
- psa_status_t res;
-
- if (in_len != out_len) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- for (i = 0; i < in_len; ++i) {
- res = spm_core_test_2_get_every_second_byte_internal(
- in_vec[i].base, out_vec[i].base,
- in_vec[i].len, &out_vec[i].len);
- if (res < 0) {
- return res;
- }
- }
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-/* Invert function */
-#define SFN_INVERT_MAX_LEN 128
-static psa_status_t spm_core_test_2_sfn_invert_internal(uint32_t *in_ptr,
- uint32_t *out_ptr,
- int32_t *res_ptr,
- int32_t len)
-{
- int32_t i;
- static uint32_t invert_buffer[SFN_INVERT_MAX_LEN];
-
- *res_ptr = -1;
-
- if (len > SFN_INVERT_MAX_LEN) {
- return CORE_TEST_ERRNO_INVALID_BUFFER;
- }
-
- for (i = 0; i < len; i++) {
- invert_buffer[i] = in_ptr[i];
- }
- for (i = 0; i < len; i++) {
- invert_buffer[i] = ~invert_buffer[i];
- }
- for (i = 0; i < len; i++) {
- out_ptr[i] = invert_buffer[i];
- }
-
- *res_ptr = 0;
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-psa_status_t spm_core_test_2_sfn_invert(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len)
-{
- int32_t len;
- uint32_t *in_ptr;
- uint32_t *out_ptr;
- int32_t *res_ptr;
-
- if ((in_len != 1) || (out_len != 2)) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- if ((out_vec[0].len < in_vec[0].len) || (in_vec[0].len%4 != 0) ||
- (out_vec[1].len < sizeof(int32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- len = in_vec[0].len / 4;
-
- in_ptr = (uint32_t *)in_vec[0].base;
- out_ptr = (uint32_t *)out_vec[0].base;
- res_ptr = (int32_t *)out_vec[1].base;
-
- return spm_core_test_2_sfn_invert_internal(in_ptr, out_ptr, res_ptr, len);
-}
-
-#ifdef TFM_PSA_API
-
-typedef psa_status_t (*core_test_2_func_t)(psa_msg_t *msg);
-
-static void core_test_2_signal_handle(psa_signal_t signal,
- core_test_2_func_t pfn)
-{
- psa_msg_t msg;
- psa_status_t status;
-
- status = psa_get(signal, &msg);
- if (status) {
- return;
- }
-
- switch (msg.type) {
- case PSA_IPC_CONNECT:
- psa_reply(msg.handle, PSA_SUCCESS);
- break;
- case PSA_IPC_CALL:
- status = pfn(&msg);
- psa_reply(msg.handle, status);
- break;
- case PSA_IPC_DISCONNECT:
- psa_reply(msg.handle, PSA_SUCCESS);
- break;
- default:
- break;
- }
-}
-
-psa_status_t spm_core_test_2_wrap_slave_service(psa_msg_t *msg)
-{
- return spm_core_test_2_slave_service(NULL, 0, NULL, 0);
-}
-
-psa_status_t spm_core_test_2_wrap_check_caller_client_id(psa_msg_t *msg)
-{
- return CORE_TEST_ERRNO_TEST_NOT_SUPPORTED;
-}
-
-psa_status_t spm_core_test_2_wrap_get_every_second_byte(psa_msg_t *msg)
-{
- uint32_t inbuf[INVERT_BUFFER_SIZE/sizeof(uint32_t)] = {0};
- uint32_t outbuf[INVERT_BUFFER_SIZE/sizeof(uint32_t)] = {0};
-
- int i;
- size_t num;
- size_t out_len;
- psa_status_t res;
-
- for (i = 0; i < PSA_MAX_IOVEC; ++i) {
- if (msg->in_size[i] > INVERT_BUFFER_SIZE) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- if (msg->in_size[i] == 0) {
- continue;
- }
-
- num = psa_read(msg->handle, i, inbuf, msg->in_size[i]);
- if (num != msg->in_size[i]) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- out_len = msg->out_size[i];
-
- res = spm_core_test_2_get_every_second_byte_internal((uint8_t *)inbuf,
- (uint8_t *)outbuf, msg->in_size[i], &out_len);
- if (res < 0) {
- return res;
- }
-
- psa_write(msg->handle, i, outbuf, out_len);
- }
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-psa_status_t spm_core_test_2_wrap_sfn_invert(psa_msg_t *msg)
-{
- uint32_t inbuf[INVERT_BUFFER_SIZE/sizeof(uint32_t)] = {0};
- uint32_t outbuf[INVERT_BUFFER_SIZE/sizeof(uint32_t)] = {0};
- size_t num;
- int32_t res_ptr;
- psa_status_t ret;
-
- if ((msg->out_size[0] < msg->in_size[0]) ||
- (msg->in_size[0] > INVERT_BUFFER_SIZE) ||
- (msg->in_size[0]%4 != 0) ||
- (msg->out_size[1] < sizeof(int32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- num = psa_read(msg->handle, 0, inbuf, msg->in_size[0]);
- if (num != msg->in_size[0]) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
-
- ret = spm_core_test_2_sfn_invert_internal(inbuf, outbuf,
- &res_ptr, msg->in_size[0] / 4);
- if (ret < 0) {
- return ret;
- }
-
- psa_write(msg->handle, 0, outbuf, msg->in_size[0]);
- psa_write(msg->handle, 1, &res_ptr, sizeof(int32_t));
-
- return ret;
-}
-#endif /* defined(TFM_PSA_API) */
-
-/* FIXME: Add a testcase to test that a failed init makes the secure partition
- * closed, and none of its functions can be called.
- * A new test service for this purpose is to be added.
- */
-psa_status_t core_test_2_init(void)
-{
-#ifdef TFM_PSA_API
- psa_signal_t signals = 0;
-
- while (1) {
- signals = psa_wait(PSA_WAIT_ANY, PSA_BLOCK);
- if (signals & SPM_CORE_TEST_2_SLAVE_SERVICE_SIGNAL) {
- core_test_2_signal_handle(SPM_CORE_TEST_2_SLAVE_SERVICE_SIGNAL,
- spm_core_test_2_wrap_slave_service);
- } else if (signals & SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID_SIGNAL) {
- core_test_2_signal_handle(
- SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID_SIGNAL,
- spm_core_test_2_wrap_check_caller_client_id);
- } else if (signals & SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SIGNAL) {
- core_test_2_signal_handle(
- SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SIGNAL,
- spm_core_test_2_wrap_get_every_second_byte);
- } else if (signals & SPM_CORE_TEST_2_INVERT_SIGNAL) {
- core_test_2_signal_handle(SPM_CORE_TEST_2_INVERT_SIGNAL,
- spm_core_test_2_wrap_sfn_invert);
- } else {
- ; /* do nothing */
- }
- }
-#else
- return CORE_TEST_ERRNO_SUCCESS;
-#endif /* defined(TFM_PSA_API) */
-}
diff --git a/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.h b/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.h
deleted file mode 100644
index 44b12df..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SS_CORE_TEST_2_H__
-#define __TFM_SS_CORE_TEST_2_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-#include <limits.h>
-
-#include "tfm_api.h"
-
-/**
- * \brief A minimal test service to be called from another service.
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * The function expects 0 in_vec objects.
- * The function expects 0 out_vec objects.
- *
- * \return Returns \ref TFM_SUCCESS.
- */
-psa_status_t spm_core_test_2_slave_service(
- struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len);
-
-
-/**
- * \brief Bitwise inverts the buffer received as input.
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * The function expects 2 in_vec objects:
- * in_vec[0].base: A pointer to the buffer containing the data to be inverted
- * in_vec[0].len: The length of the buffer
- * in_vec[1].base: A pointer to an int32_t object
- * in_vec[1].len: The size of int32_t object
- *
- * The function expects 1 out_vec object:
- * out_vec[0].base: A pointer to the buffer to put the result to
- * out_vec[0].len: The length of the buffer
- *
- * \return Returns \ref TFM_SUCCESS on success, TFM_PARTITION_BUSY otherwise.
- */
-psa_status_t spm_core_test_2_sfn_invert(struct psa_invec *in_vec, size_t in_len,
- struct psa_outvec *out_vec, size_t out_len);
-
-/**
- * \brief A minimal test secure function to be called from another partition.
- *
- * Checks the functionality of querying the client ID of the caller service.
- *
- * \param[in] in_vec Array of psa_invec objects
- * \param[in] in_len Number psa_invec objects in in_vec
- * \param[in] out_vec Array of psa_outvec objects
- * \param[in] out_len Number psa_outvec objects in out_vec
- *
- * The function expects 0 in_vec objects.
- * The function expects 0 out_vec objects.
- *
- * \return Returns \ref TFM_SUCCESS on success, \ref CORE_TEST_ERRNO_TEST_FAULT
- * othervise.
- */
- psa_status_t spm_core_test_2_check_caller_client_id(
- struct psa_invec *in_vec, size_t in_len, struct psa_outvec *out_vec,
- size_t out_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_SS_CORE_TEST_2_H__ */
diff --git a/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.yaml b/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.yaml
deleted file mode 100644
index 56c1073..0000000
--- a/test/secure_fw/suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.yaml
+++ /dev/null
@@ -1,75 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-{
- "psa_framework_version": 1.0,
- "name": "TFM_SP_CORE_TEST_2",
- "type": "APPLICATION-ROT",
- "priority": "NORMAL",
- "entry_point": "core_test_2_init",
- "stack_size": "0x0280",
- "secure_functions": [
- {
- "name": "TFM_CORE_TEST_2_SFN_SLAVE_SERVICE",
- "signal": "SPM_CORE_TEST_2_SLAVE_SERVICE",
- "non_secure_clients": false,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "TFM_CORE_TEST_2_SFN_INVERT",
- "signal": "SPM_CORE_TEST_2_SFN_INVERT",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "TFM_CORE_TEST_2_SFN_CHECK_CALLER_CLIENT_ID",
- "signal": "SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "TFM_CORE_TEST_2_SFN_GET_EVERY_SECOND_BYTE",
- "signal": "SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- }
- ],
- "services": [
- {
- "name": "SPM_CORE_TEST_2_SLAVE_SERVICE",
- "sid": "0x0000F040",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID",
- "sid": "0x0000F041",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE",
- "sid": "0x0000F042",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_2_INVERT",
- "sid": "0x0000F043",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- }
- ]
-}
diff --git a/test/secure_fw/suites/fpu/fpu_tests_common.h b/test/secure_fw/suites/fpu/fpu_tests_common.h
index c9428f9..5cfc8b8 100644
--- a/test/secure_fw/suites/fpu/fpu_tests_common.h
+++ b/test/secure_fw/suites/fpu/fpu_tests_common.h
@@ -16,9 +16,7 @@
#include "psa/client.h"
#include "tfm_peripherals_def.h"
#include "test_framework_helpers.h"
-#ifdef TFM_PSA_API
#include "psa_manifest/sid.h"
-#endif
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
diff --git a/test/secure_fw/suites/fwu/mcuboot/CMakeLists.txt b/test/secure_fw/suites/fwu/mcuboot/CMakeLists.txt
index 26d97c6..4d6d513 100644
--- a/test/secure_fw/suites/fwu/mcuboot/CMakeLists.txt
+++ b/test/secure_fw/suites/fwu/mcuboot/CMakeLists.txt
@@ -34,7 +34,6 @@
target_compile_definitions(tfm_test_suite_fwu_ns
PRIVATE
DOMAIN_NS=1
- TFM_PSA_API
$<$<BOOL:${TFM_FWU_TEST_WRITE_WITH_NULL}>:TFM_FWU_TEST_WRITE_WITH_NULL>
$<$<BOOL:${TFM_FWU_TEST_REQUEST_REBOOT}>:TFM_FWU_TEST_REQUEST_REBOOT>
$<$<BOOL:${TFM_FWU_TEST_QUERY_WITH_NULL}>:TFM_FWU_TEST_QUERY_WITH_NULL>
@@ -71,7 +70,6 @@
target_compile_definitions(tfm_test_suite_fwu_s
PRIVATE
- TFM_PSA_API
$<$<BOOL:${TFM_FWU_TEST_WRITE_WITH_NULL}>:TFM_FWU_TEST_WRITE_WITH_NULL>
$<$<BOOL:${TFM_FWU_TEST_REQUEST_REBOOT}>:TFM_FWU_TEST_REQUEST_REBOOT>
$<$<BOOL:${TFM_FWU_TEST_QUERY_WITH_NULL}>:TFM_FWU_TEST_QUERY_WITH_NULL>
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 05891c6..cbf5f85 100644
--- a/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
+++ b/test/secure_fw/suites/fwu/mcuboot/fwu_tests_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -1060,7 +1060,6 @@
}
#endif
-#ifdef TFM_PSA_API
void tfm_fwu_test_common_016(struct test_result_t *ret)
{
psa_status_t status;
@@ -1085,4 +1084,3 @@
}
ret->val = TEST_PASSED;
}
-#endif
diff --git a/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c b/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c
index a5e7014..11d8ac6 100644
--- a/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c
+++ b/test/secure_fw/suites/fwu/mcuboot/non_secure/psa_fwu_ns_interface_testsuite.c
@@ -48,10 +48,8 @@
{&tfm_fwu_test_common_015, "TFM_NS_FWU_TEST_1015",
"Image update with dependency, new image is required"},
#endif
-#ifdef TFM_PSA_API
{&tfm_fwu_test_common_016, "TFM_NS_FWU_TEST_1016",
"psa_fwu_write boundary test"},
-#endif
};
void register_testsuite_ns_psa_fwu_interface(struct test_suite_t *p_test_suite)
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 6bacc44..c96bab1 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
@@ -49,10 +49,8 @@
{&tfm_fwu_test_common_015, "TFM_S_FWU_TEST_1015",
"Image update with dependency, new image is required"},
#endif
-#ifdef TFM_PSA_API
{&tfm_fwu_test_common_016, "TFM_S_FWU_TEST_1016",
"psa_fwu_write boundary test"},
-#endif
};
void register_testsuite_s_psa_fwu_interface(struct test_suite_t *p_test_suite)
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 dde8d1f..4dd7e26 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -88,28 +88,6 @@
*/
static void tfm_its_test_1020(struct test_result_t *ret)
{
-#ifndef TFM_PSA_API
- psa_status_t status;
- const psa_storage_uid_t uid = TEST_UID_1;
- const psa_storage_create_flags_t flags = PSA_STORAGE_FLAG_NONE;
- const size_t data_len = INVALID_DATA_LEN;
- const uint8_t write_data[] = WRITE_DATA;
-
- /* A parameter with a buffer pointer where its data length is longer than
- * maximum permitted, it is treated as a secure violation.
- * TF-M framework rejects the request with a proper error code.
- * The ITS secure PSA implementation returns
- * PSA_ERROR_INVALID_ARGUMENT in that case.
- */
-
- /* Set with data length longer than the maximum supported */
- status = psa_its_set(uid, data_len, write_data, flags);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Set should not succeed with invalid data length");
- return;
- }
-
-#endif
ret->val = TEST_PASSED;
}
@@ -122,71 +100,6 @@
*/
static void tfm_its_test_1021(struct test_result_t *ret)
{
-#ifndef TFM_PSA_API
- psa_status_t status;
- const psa_storage_uid_t uid = TEST_UID_2;
- const psa_storage_create_flags_t flags = PSA_STORAGE_FLAG_NONE;
- const size_t write_len = WRITE_DATA_SIZE;
- size_t read_len;
- size_t offset;
- const uint8_t write_data[] = WRITE_DATA;
- uint8_t read_data[] = READ_DATA;
- size_t read_data_length = 0;
-
- status = psa_its_set(uid, write_len, write_data, flags);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Set should not fail");
- return;
- }
-
- /* Get with data length and offset set to invalid values */
- read_len = INVALID_DATA_LEN;
- offset = INVALID_OFFSET;
-
- /* A parameter with a buffer pointer where its data length is longer than
- * maximum permitted, it is treated as a secure violation.
- * TF-M framework rejects the request with a proper error code.
- * The ITS secure PSA implementation returns
- * PSA_ERROR_INVALID_ARGUMENT in that case.
- */
-
- status = psa_its_get(uid, offset, read_len, read_data + HALF_PADDING_SIZE,
- &read_data_length);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Get should not succeed with invalid arguments");
- return;
- }
-
- /* Check that the read data is unchanged */
- if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
- TEST_FAIL("Read data should be equal to original read data");
- return;
- }
-
- read_len = 1;
- offset = 0;
-
- status = psa_its_get(uid, offset, read_len, read_data + HALF_PADDING_SIZE,
- NULL);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Get should not succeed with invalid arguments");
- return;
- }
-
- /* Check that the read data is unchanged */
- if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
- TEST_FAIL("Read data should be equal to original read data");
- return;
- }
-
- /* Call remove to clean up storage for the next test */
- status = psa_its_remove(uid);
- if (status != PSA_SUCCESS) {
- TEST_FAIL("Remove should not fail with valid UID");
- return;
- }
-
-#endif
ret->val = TEST_PASSED;
}
@@ -216,15 +129,6 @@
* PSA_ERROR_INVALID_ARGUMENT in that case.
*/
- /* Get info with NULL info pointer */
-#ifndef TFM_PSA_API
- status = psa_its_get_info(uid, NULL);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Get info should not succeed with NULL info pointer");
- return;
- }
-#endif
-
/* Call remove to clean up storage for the next test */
status = psa_its_remove(uid);
if (status != PSA_SUCCESS) {
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 a76d557..5471531 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -254,28 +254,6 @@
*/
static void tfm_ps_test_1004(struct test_result_t *ret)
{
-#ifndef TFM_PSA_API
- psa_status_t status;
- const psa_storage_uid_t uid = TEST_UID_1;
- const psa_storage_create_flags_t flags = PSA_STORAGE_FLAG_NONE;
- const uint32_t data_len = INVALID_DATA_LEN;
- const uint8_t write_data[] = WRITE_DATA;
-
- /* A parameter with a buffer pointer where its data length is longer than
- * maximum permitted, it is treated as a secure violation.
- * TF-M framework rejects the request with a proper error code.
- * The PS secure PSA PS implementation returns
- * PSA_ERROR_INVALID_ARGUMENT in that case.
- */
-
- /* Set with data length longer than the maximum supported */
- status = psa_ps_set(uid, data_len, write_data, flags);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Set should not succeed with invalid data length");
- return;
- }
-
-#endif
ret->val = TEST_PASSED;
}
@@ -602,35 +580,6 @@
return;
}
-#ifndef TFM_PSA_API
- /* Get with data length and offset set to invalid values */
- read_len = INVALID_DATA_LEN;
- offset = INVALID_OFFSET;
-
- /* Reset read_data to original 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.
- * TF-M framework rejects the request with a proper error code.
- * The PS secure PSA PS implementation returns
- * PSA_ERROR_INVALID_ARGUMENT in that case.
- */
-
- status = psa_ps_get(uid, offset, read_len, read_data + HALF_PADDING_SIZE,
- &read_data_len);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Get should not succeed with invalid arguments");
- return;
- }
-
- /* Check that the read data is unchanged */
- if (memcmp(read_data, READ_DATA, sizeof(read_data)) != 0) {
- TEST_FAIL("Read data should be equal to original read data");
- return;
- }
-#endif
-
/* Call remove to clean up storage for the next test */
status = psa_ps_remove(uid);
if (status != PSA_SUCCESS) {
@@ -835,15 +784,6 @@
* PSA_ERROR_GENERIC_ERROR in that case.
*/
- /* Get info with NULL info pointer */
-#ifndef TFM_PSA_API
- status = psa_ps_get_info(uid, NULL);
- if (status != PSA_ERROR_INVALID_ARGUMENT) {
- TEST_FAIL("Get info should not succeed with NULL info pointer");
- return;
- }
-#endif
-
/* Call remove to clean up storage for the next test */
status = psa_ps_remove(uid);
if (status != PSA_SUCCESS) {
diff --git a/test/secure_fw/suites/ps/service/tfm_ps_test_service.c b/test/secure_fw/suites/ps/service/tfm_ps_test_service.c
index 18c9d4b..a17a9a4 100644
--- a/test/secure_fw/suites/ps/service/tfm_ps_test_service.c
+++ b/test/secure_fw/suites/ps/service/tfm_ps_test_service.c
@@ -5,12 +5,8 @@
*
*/
-#ifdef TFM_PSA_API
#include "psa/service.h"
#include "psa_manifest/tfm_ps_test_service.h"
-#else
-#include "psa/client.h"
-#endif
#include "ps_object_system.h"
@@ -25,7 +21,6 @@
return ps_system_prepare();
}
-#ifdef TFM_PSA_API
static psa_status_t tfm_ps_test_handle_msg(const psa_msg_t *msg)
{
psa_status_t status = PSA_ERROR_PROGRAMMER_ERROR;
@@ -59,9 +54,3 @@
return PSA_SUCCESS;
}
#endif /* TFM_SP_PS_TEST_MODEL_SFN == 1 */
-#else /* TFM_PSA_API */
-psa_status_t tfm_ps_test_init(void)
-{
- return PSA_SUCCESS;
-}
-#endif /* TFM_PSA_API */
diff --git a/test/secure_fw/suites/ps/service/tfm_ps_test_service_api.c b/test/secure_fw/suites/ps/service/tfm_ps_test_service_api.c
index 4e5adc8..8f0a189 100644
--- a/test/secure_fw/suites/ps/service/tfm_ps_test_service_api.c
+++ b/test/secure_fw/suites/ps/service/tfm_ps_test_service_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -7,17 +7,12 @@
#include "tfm_ps_test_service_api.h"
-#ifdef TFM_PSA_API
#include "psa/client.h"
#include "psa_manifest/sid.h"
-#else
-#include "tfm_veneers.h"
-#endif
__attribute__((section("SFN")))
psa_status_t tfm_ps_test_system_prepare(void)
{
-#ifdef TFM_PSA_API
psa_handle_t handle;
psa_status_t status;
@@ -31,7 +26,4 @@
psa_close(handle);
return status;
-#else
- return tfm_ps_test_prepare_veneer(NULL, 0, NULL, 0);
-#endif
}
diff --git a/test/secure_fw/tfm_test_manifest_list.yaml b/test/secure_fw/tfm_test_manifest_list.yaml
index 95e6cb6..f85837f 100644
--- a/test/secure_fw/tfm_test_manifest_list.yaml
+++ b/test/secure_fw/tfm_test_manifest_list.yaml
@@ -14,34 +14,6 @@
"version_minor": 1,
"manifest_list": [
{
- "description": "TFM Core Test Partition",
- "manifest": "suites/core/service/tfm_core_test/tfm_ss_core_test.yaml",
- "output_path": "secure_fw/test_services/tfm_core_test",
- "conditional": "TEST_NS_CORE",
- "version_major": 0,
- "version_minor": 1,
- "pid": 3000,
- "linker_pattern": {
- "library_list": [
- "*tfm_*partition_core_test.*"
- ]
- }
- },
- {
- "description": "TFM Core Test Partition 2",
- "manifest": "suites/core/service/tfm_core_test_2/tfm_ss_core_test_2.yaml",
- "output_path": "secure_fw/test_services/tfm_core_test_2",
- "conditional": "TEST_NS_CORE",
- "version_major": 0,
- "version_minor": 1,
- "pid": 3001,
- "linker_pattern": {
- "library_list": [
- "*tfm_*partition_core_test_2.*"
- ]
- }
- },
- {
"description": "TFM Secure Client Partition",
"manifest": "common_test_services/tfm_secure_client_service/tfm_secure_client_service.yaml",
"output_path": "secure_fw/test_services/tfm_secure_client_service",