Test: Create secure client service

Secure client service is added to allow the running of secure
test suite and update the secure tests to run in this manner

Change-Id: I7c3d542ecd81fb3793c0354e6e95981c5360bae9
Signed-off-by: Ben Davis <ben.davis@arm.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
index 74f7d79..6f7dab1 100755
--- a/CommonConfig.cmake
+++ b/CommonConfig.cmake
@@ -77,7 +77,9 @@
 set (CORE_TEST_POSITIVE OFF)
 set (CORE_TEST_INTERACTIVE OFF)
 set (TFM_PARTITION_TEST_SST OFF)
+set (TEST_FRAMEWORK_S OFF)
 set (REFERENCE_PLATFORM OFF)
+set (TFM_PARTITION_TEST_SECURE_SERVICES OFF)
 
 if(${TARGET_PLATFORM} STREQUAL "AN521" OR ${TARGET_PLATFORM} STREQUAL "AN519")
 	set (REFERENCE_PLATFORM ON)
@@ -107,13 +109,13 @@
 	set(CORE_TEST_INTERACTIVE OFF)
 endif()
 
-if(CORE_TEST_INTERACTIVE)
+if (CORE_TEST_INTERACTIVE)
 	add_definitions(-DCORE_TEST_INTERACTIVE)
 	set(TEST_FRAMEWORK_NS ON)
 	set(TFM_PARTITION_TEST_CORE ON)
 endif()
 
-if(CORE_TEST_POSITIVE)
+if (CORE_TEST_POSITIVE)
 	add_definitions(-DCORE_TEST_POSITIVE)
 	set(TEST_FRAMEWORK_NS ON)
 	set(TFM_PARTITION_TEST_CORE ON)
@@ -121,7 +123,9 @@
 
 if (SERVICE_TEST_S)
 	add_definitions(-DSERVICES_TEST_S)
+	add_definitions(-DTFM_PARTITION_TEST_SECURE_SERVICES)
 	set(TEST_FRAMEWORK_S ON)
+	set(TFM_PARTITION_TEST_SECURE_SERVICES ON)
 endif()
 
 if (SERVICE_TEST_NS)
@@ -130,11 +134,11 @@
 	set(TFM_PARTITION_TEST_SST ON)
 endif()
 
-if(TEST_FRAMEWORK_S)
+if (TEST_FRAMEWORK_S)
 	add_definitions(-DTEST_FRAMEWORK_S)
 endif()
 
-if(TEST_FRAMEWORK_NS)
+if (TEST_FRAMEWORK_NS)
 	add_definitions(-DTEST_FRAMEWORK_NS)
 endif()
 
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 691c1e1..1d5bb29 100755
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -147,6 +147,12 @@
 	embedded_set_target_link_defines(TARGET ${PROJECT_NAME} DEFINES "TFM_PARTITION_TEST_SST")
 endif()
 
+if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES)
+    message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ")
+elseif (TFM_PARTITION_TEST_SECURE_SERVICES)
+    embedded_set_target_link_defines(TARGET ${PROJECT_NAME} DEFINES "TFM_PARTITION_TEST_SECURE_SERVICES")
+endif()
+
 #Set BL2 specific settings.
 if (NOT DEFINED BL2)
 	message(FATAL_ERROR "Incomplete build configuration: BL2 is undefined. ")
diff --git a/app/main_ns.c b/app/main_ns.c
index ab2175d..fd40820 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -18,6 +18,10 @@
 #ifdef TEST_FRAMEWORK_NS
 #include "test/framework/integ_test.h"
 #endif
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+#include \
+  "test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h"
+#endif
 
 #include "Driver_USART.h"
 
@@ -50,6 +54,10 @@
     LIST_SVC_TFM_PARTITION_TEST_SST
 #endif /* TFM_PARTITION_TEST_SST */
 
+#if defined(TFM_PARTITION_TEST_SECURE_SERVICES)
+    LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
 #undef X
 
 //(void *)user_function1,
diff --git a/app/tfm_integ_test.c b/app/tfm_integ_test.c
index 5bad17a..acef4d6 100644
--- a/app/tfm_integ_test.c
+++ b/app/tfm_integ_test.c
@@ -17,6 +17,11 @@
 #include "tfm_integ_test.h"
 #include "test/framework/integ_test.h"
 
+#ifdef TEST_FRAMEWORK_S
+#include \
+  "test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h"
+#endif
+
 #ifdef CORE_TEST_INTERACTIVE
 #include "test/test_services/tfm_core_test/core_test_defs.h"
 #include "test/test_services/tfm_core_test/tfm_ss_core_test_veneers.h"
@@ -371,7 +376,7 @@
 }
 #endif /* CORE_TEST_INTERACTIVE */
 
-#ifdef TEST_FRAMEWORK_NS
+#if defined(TEST_FRAMEWORK_NS) || defined(TEST_FRAMEWORK_S)
 /**
  * \brief Services test thread
  *
@@ -380,9 +385,20 @@
 void test_app(void *argument)
 {
     UNUSED_VARIABLE(argument);
-    start_integ_test();
+
+#ifdef TEST_FRAMEWORK_S
+    /* 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
     /* End of test */
     for (;;) {
     }
 }
-#endif /* TEST_FRAMEWORK_NS */
+#endif /* TEST_FRAMEWORK_NS OR TEST_FRAMEWORK_S */
diff --git a/docs/user_guides/tfm_integration_guide.md b/docs/user_guides/tfm_integration_guide.md
index 973d3f7..18d5554 100755
--- a/docs/user_guides/tfm_integration_guide.md
+++ b/docs/user_guides/tfm_integration_guide.md
@@ -84,17 +84,18 @@
 
 #### interface with non-secure world regression tests
 A non-secure application that wants to run the non-secure regression tests
-needs to call the `start_integ_test()`. This function is exported into the
-header file `integ_test.h` inside the `install` folder structure in the test
-specific files, i.e. `install/tfm/test/inc`. The non-secure regression tests are
-precompiled and delivered as a static library which is available in
-`install/tfm/test/lib`, so that the non-secure application needs to link against
-the library to be able to invoke the `start_integ_test()` function.
-The SST non-secure side regression tests rely on some OS functionality
-e.g. threads, mutexes etc. These functions comply with CMSIS RTOS2 standard and
-have been exported as thin wrappers defined in `os_wrapper.h` contained in
-`install/tfm/test/inc`. OS needs to provide the implementation of these wrappers
-to be able to run the tests.
+needs to call the `tfm_non_secure_client_run_tests()`. This function is
+exported into the header file `integ_test.h` inside the `install` folder
+structure in the test specific files, i.e. `install/tfm/test/inc`. The
+non-secure regression tests are precompiled and delivered as a static library
+which is available in `install/tfm/test/lib`, so that the non-secure
+application needs to link against the library to be able to invoke the
+`tfm_non_secure_client_run_tests()` function. The SST non-secure side
+regression tests rely on some OS functionality e.g. threads, mutexes etc.
+These functions comply with CMSIS RTOS2 standard and have been exported as
+thin wrappers defined in `os_wrapper.h` contained in `install/tfm/test/inc`.
+OS needs to provide the implementation of these wrappers to be able to run
+the tests.
 
 --------------
 
diff --git a/interface/include/tfm_ns_svc.h b/interface/include/tfm_ns_svc.h
index 2788759..178e75c 100644
--- a/interface/include/tfm_ns_svc.h
+++ b/interface/include/tfm_ns_svc.h
@@ -99,6 +99,20 @@
     X(SVC_SST_TEST_SERVICE_CLEAN, sst_test_service_svc_clean)
 
 /**
+ * \def LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
+ *
+ * \brief This is an X macro which lists
+ *        the SVC interface available for
+ *        TEST_SECURE_SERVICES partition.
+ *        The enumerator and corresponding
+ *        SVC handler function need to be
+ *        registered.
+ *
+ */
+#define LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES \
+    X(SVC_TFM_SECURE_CLIENT_RUN_TESTS, tfm_secure_client_service_svc_run_tests)
+
+/**
  * \brief Numbers associated to each SVC available
  *
  * \details Start from 1 as 0 is reserved by RTX
@@ -122,6 +136,10 @@
     LIST_SVC_TFM_PARTITION_TEST_SST
 #endif /* TFM_PARTITION_TEST_SST */
 
+#if defined(TFM_PARTITION_TEST_SECURE_SERVICES)
+    LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
 #undef X
 
     /* add all the new entries above this line */
diff --git a/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct b/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
index 39eeeae..4d9c792 100644
--- a/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
+++ b/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
@@ -73,6 +73,12 @@
     }
 #endif /* TFM_PARTITION_TEST_SST */
 
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    TFM_SP_SECURE_TEST_PARTITION +0 ALIGN 32 {
+        *tfm_secure_client_service.* (+RO)
+    }
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
     ER_TFM_DATA S_DATA_START S_DATA_SIZE {
         .ANY (+RW +ZI)
     }
@@ -125,6 +131,15 @@
     }
 #endif /* TFM_PARTITION_TEST_SST */
 
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    TFM_SP_SECURE_TEST_PARTITION_DATA +0 ALIGN 32 {
+        tfm_secure_client_service.o (+RW +ZI)
+    }
+
+    TFM_SP_SECURE_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
+    }
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
 #endif /* TFM_LVL == 1 */
 
 }
diff --git a/platform/ext/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_s.s b/platform/ext/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_s.s
index 0d1a4e2..fc80aa3 100644
--- a/platform/ext/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_s.s
+++ b/platform/ext/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_s.s
@@ -25,9 +25,7 @@
 ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
 ; </h>
 
-; NOTE: The stack size needs to be re-evaluated as soon as the new mechanism
-;       to run the secure tests, based on a test service, is introduced.
-Stack_Size      EQU     0x00002000
+Stack_Size      EQU     0x00001000
 MSP_STACK_SIZE  EQU     0x00000800
 
                 AREA    STACK, NOINIT, READWRITE, ALIGN=7
diff --git a/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct b/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
index 39eeeae..4d9c792 100644
--- a/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
+++ b/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
@@ -73,6 +73,12 @@
     }
 #endif /* TFM_PARTITION_TEST_SST */
 
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    TFM_SP_SECURE_TEST_PARTITION +0 ALIGN 32 {
+        *tfm_secure_client_service.* (+RO)
+    }
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
     ER_TFM_DATA S_DATA_START S_DATA_SIZE {
         .ANY (+RW +ZI)
     }
@@ -125,6 +131,15 @@
     }
 #endif /* TFM_PARTITION_TEST_SST */
 
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    TFM_SP_SECURE_TEST_PARTITION_DATA +0 ALIGN 32 {
+        tfm_secure_client_service.o (+RW +ZI)
+    }
+
+    TFM_SP_SECURE_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
+    }
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
 #endif /* TFM_LVL == 1 */
 
 }
diff --git a/platform/ext/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s b/platform/ext/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s
index e2e67bf..08793f6 100644
--- a/platform/ext/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s
+++ b/platform/ext/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s
@@ -25,9 +25,7 @@
 ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>

 ; </h>

 

-; NOTE: The stack size needs to be re-evaluated as soon as the new mechanism

-;       to run the secure tests, based on a test service, is introduced.

-Stack_Size      EQU     0x00002000

+Stack_Size      EQU     0x00001000

 MSP_STACK_SIZE  EQU     0x00000800

 

                 AREA    STACK, NOINIT, READWRITE, ALIGN=7

diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index e711cd0..248c8eb 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -104,6 +104,12 @@
 	embedded_set_target_link_defines(TARGET ${PROJECT_NAME} DEFINES "TFM_PARTITION_TEST_SST")
 endif()
 
+if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES)
+	message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ")
+elseif (TFM_PARTITION_TEST_SECURE_SERVICES)
+	embedded_set_target_link_defines(TARGET ${PROJECT_NAME} DEFINES "TFM_PARTITION_TEST_SECURE_SERVICES")
+endif()
+
 if (NOT DEFINED BL2)
 	message(FATAL_ERROR "Incomplete build configuration: BL2 is undefined. ")
 elseif (BL2)
diff --git a/secure_fw/core/tfm_core.c b/secure_fw/core/tfm_core.c
index 6b64ce1..3cc4f1e 100644
--- a/secure_fw/core/tfm_core.c
+++ b/secure_fw/core/tfm_core.c
@@ -14,10 +14,6 @@
 #include "secure_utilities.h"
 #include "secure_fw/spm/spm_api.h"
 
-#ifdef TEST_FRAMEWORK_S
-#include "test/framework/integ_test.h"
-#endif
-
 /*
  * Avoids the semihosting issue
  * FixMe: describe 'semihosting issue'
@@ -170,10 +166,6 @@
          */
     }
 
-#ifdef TEST_FRAMEWORK_S
-    start_integ_test();
-#endif
-
 #ifdef TFM_CORE_DEBUG
     /* Jumps to non-secure code */
     LOG_MSG("Jumping to non-secure code...");
diff --git a/secure_fw/services/tfm_partition_defs.inc b/secure_fw/services/tfm_partition_defs.inc
index ff6b689..0c6afa1 100644
--- a/secure_fw/services/tfm_partition_defs.inc
+++ b/secure_fw/services/tfm_partition_defs.inc
@@ -26,6 +26,10 @@
 #define TFM_SP_SST_TEST_PARTITION_ID (TFM_SP_BASE + 4)
 #endif /* TFM_PARTITION_TEST_SST */
 
-#define TFM_MAX_USER_PARTITIONS (5)
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+#define TFM_SP_SECURE_TEST_PARTITION_ID (TFM_SP_BASE + 5)
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
+#define TFM_MAX_USER_PARTITIONS (6)
 
 #endif /* __TFM_PARTITION_DEFS_INC__ */
diff --git a/secure_fw/services/tfm_partition_list.inc b/secure_fw/services/tfm_partition_list.inc
index 5c94cd0..223ddce 100644
--- a/secure_fw/services/tfm_partition_list.inc
+++ b/secure_fw/services/tfm_partition_list.inc
@@ -44,4 +44,10 @@
 PARTITION_ADD_INIT_FUNC(TFM_SP_SST_TEST_PARTITION, sst_test_service_init);
 #endif /* TFM_PARTITION_TEST_SST */
 
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+/******** TFM_SP_SECURE_TEST_PARTITION ********/
+PARTITION_DECLARE(TFM_SP_SECURE_TEST_PARTITION, SPM_PART_FLAG_SECURE | SPM_PART_FLAG_TRUSTED);
+PARTITION_ADD_INIT_FUNC(TFM_SP_SECURE_TEST_PARTITION, tfm_secure_client_service_init);
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
 #endif /* __TFM_PARTITION_LIST_INC__ */
diff --git a/secure_fw/services/tfm_sfid_list.inc b/secure_fw/services/tfm_sfid_list.inc
index b6b3112..83928d7 100644
--- a/secure_fw/services/tfm_sfid_list.inc
+++ b/secure_fw/services/tfm_sfid_list.inc
@@ -45,4 +45,9 @@
     {sst_test_service_sfn_clean, TFM_SST_TEST_SFN_CLEAN_SFID},
 #endif /* TFM_PARTITION_TEST_SST */
 
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+    /******** TFM_SP_SECURE_TEST_PARTITION ********/
+    {tfm_secure_client_service_sfn_run_tests, TFM_SECURE_CLIENT_SFN_RUN_TESTS_SFID},
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
 #endif /* __TFM_SFID_LIST_INC__ */
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 546b758..bd6c65d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -68,6 +68,8 @@
 				${CMAKE_CURRENT_SOURCE_DIR}/interface/include/svc_core_test_ns.h
 				${CMAKE_CURRENT_SOURCE_DIR}/suites/sst/non_secure/os_wrapper.h
 				${CMAKE_CURRENT_SOURCE_DIR}/interface/include/sst_test_service_svc.h
+				${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_sst_test_service/sst_test_service_svc.h
+				${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h
 		DESTINATION tfm/test/inc)
 
 install(TARGETS tfm_non_secure_tests
diff --git a/test/framework/integ_test.h b/test/framework/integ_test.h
index d00fa39..cac45cb 100644
--- a/test/framework/integ_test.h
+++ b/test/framework/integ_test.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -13,10 +13,17 @@
 #endif
 
 /**
- * \brief Executes integration tests.
+ * \brief Executes integration tests. To be called from appropriate
+ *        secure/non-secure service client.
  */
 void start_integ_test(void);
 
+/**
+ * \brief Service stand-in shim for non secure tests. To be called from a
+ *        non-secure client.
+ */
+void tfm_non_secure_client_run_tests(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 7cfbde2..da74723 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -52,3 +52,9 @@
     integ_test("Non-secure", test_suites,
                sizeof(test_suites)/sizeof(test_suites[0]));
 }
+
+/* Service stand-in for NS tests. To be called from a non-secure context */
+void tfm_non_secure_client_run_tests(void)
+{
+    start_integ_test();
+}
diff --git a/test/test_services/CMakeLists.inc b/test/test_services/CMakeLists.inc
index 4e042d0..9787d9e 100644
--- a/test/test_services/CMakeLists.inc
+++ b/test/test_services/CMakeLists.inc
@@ -54,6 +54,18 @@
 		)
 endif()
 
+if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES)
+	message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ")
+elseif (TFM_PARTITION_TEST_SECURE_SERVICES)
+	list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service.c"
+		"${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_veneers.c"
+		)
+
+	list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_api.c"
+		"${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_svc.c"
+		)
+endif()
+
 embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
 embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
 
diff --git a/test/test_services/tfm_secure_client_service/manifest.yaml b/test/test_services/tfm_secure_client_service/manifest.yaml
new file mode 100644
index 0000000..bd287bd
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/manifest.yaml
@@ -0,0 +1,35 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+{
+  "name": "TFM_SECURE_CLIENT",
+  "tfm_partition_name": "TFM_SP_SECURE_TEST_PARTITION",
+  "type": "TRUSTED",
+  "tfm_trusted": true,
+  "priority": "NORMAL",
+  "id": "0x00000005",
+  "entry_point": "main",
+  "stack_size": "0x2000",
+  "heap_size": "0x0400",
+  "tfm_init_symbol": "tfm_secure_client_service_init",
+  "secure_functions": [
+    {
+      "sfid": "TFM_SECURE_CLIENT_SFN_RUN_TESTS_SFID",
+      "signal": "TFM_SECURE_CLIENT_SFN_RUN_TESTS",
+      "tfm_symbol": "tfm_secure_client_service_sfn_run_tests",
+      "non_secure_clients": true,
+      "minor_version": 1,
+      "minor_policy": "strict"
+    },
+  ],
+  "source_files": [
+    "tfm_secure_client_service.c"
+  ],
+  "tfm_linker_pattern": [
+    "*tfm_secure_client_service.*"
+  ]
+}
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
new file mode 100644
index 0000000..9ce4849
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "tfm_secure_client_service.h"
+#include "test/framework/integ_test.h"
+
+/**
+ * \brief Service initialisation function. No special initialisation is
+ *        required.
+ *
+ * \return Returns error code as specified in \ref tfm_sst_err_t
+ */
+enum tfm_sst_err_t tfm_secure_client_service_init(void)
+{
+    return TFM_SST_ERR_SUCCESS;
+}
+
+int32_t tfm_secure_client_service_sfn_run_tests(void)
+{
+    start_integ_test();
+    return 0;
+}
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.h b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.h
new file mode 100644
index 0000000..d45b92a
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_SECURE_CLIENT_SERVICE_H__
+#define __TFM_SECURE_CLIENT_SERVICE_H__
+
+#include <stdint.h>
+#include "tfm_sst_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Runs the secure integration tests.
+ *
+ * \return Returns 0 on success.
+ */
+int32_t tfm_secure_client_service_sfn_run_tests(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_SECURE_CLIENT_SERVICE_H__ */
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.c
new file mode 100644
index 0000000..46f4022
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.c
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "tfm_secure_client_service_api.h"
+#include "tfm_ns_svc.h"
+
+__attribute__ ((naked))
+int32_t tfm_secure_client_run_tests(void)
+{
+    SVC(SVC_TFM_SECURE_CLIENT_RUN_TESTS);
+    __ASM("BX LR");
+}
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h
new file mode 100644
index 0000000..35e9004
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h
@@ -0,0 +1,28 @@
+/*
+ * 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/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.c
new file mode 100644
index 0000000..48f3042
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "tfm_secure_client_service_svc.h"
+#include "tfm_secure_client_service_veneers.h"
+
+int32_t tfm_secure_client_service_svc_run_tests(void)
+{
+    return tfm_secure_client_service_veneer_run_tests();
+}
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h
new file mode 100644
index 0000000..372ca18
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_SECURE_CLIENT_SERVICE_SVC_H__
+#define __TFM_SECURE_CLIENT_SERVICE_SVC_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_service_svc_run_tests(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_SECURE_CLIENT_SERVICE_SVC_H__ */
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service_veneers.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_veneers.c
new file mode 100644
index 0000000..de35464
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_veneers.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "tfm_secure_client_service_veneers.h"
+
+#include "tfm_secure_client_service.h"
+#include "secure_fw/core/tfm_secure_api.h"
+#include "secure_fw/spm/spm_partition_defs.h"
+
+__tfm_secure_gateway_attributes__
+int32_t tfm_secure_client_service_veneer_run_tests(void)
+{
+    TFM_CORE_SFN_REQUEST(TFM_SP_SECURE_TEST_PARTITION_ID,
+                         tfm_secure_client_service_sfn_run_tests,
+                         0, 0, 0, 0);
+}
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service_veneers.h b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_veneers.h
new file mode 100644
index 0000000..513d9e5
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service_veneers.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_SECURE_CLIENT_SERVICE_VENEERS_H__
+#define __TFM_SECURE_CLIENT_SERVICE_VENEERS_H__
+
+#include <stdint.h>
+#include "secure_fw/core/tfm_secure_api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Runs the secure integration tests
+ *
+ * \return Returns 0 on success
+ */
+int32_t tfm_secure_client_service_veneer_run_tests(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_SECURE_CLIENT_SERVICE_VENEERS_H__ */
diff --git a/tools/tfm_manifest_list.yaml b/tools/tfm_manifest_list.yaml
index b1aa955..3586c67 100644
--- a/tools/tfm_manifest_list.yaml
+++ b/tools/tfm_manifest_list.yaml
@@ -53,6 +53,15 @@
       "conditional": "TFM_PARTITION_TEST_SST",

       "version_major": 0,

       "version_minor": 1

+    },

+    {

+      "name": "TFM Secure Client Service",

+      "short_name": "TFM_Secure_Client",

+      "manifest": "test/test_services/tfm_secure_client_service/manifest.yaml",

+      "tfm_extensions": true,

+      "conditional": "TFM_PARTITION_TEST_SECURE_SERVICES",

+      "version_major": 0,

+      "version_minor": 1

     }

   ]

 }