aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalint Dobszay <balint.dobszay@arm.com>2020-11-23 18:23:57 +0100
committerGyorgy Szing <Gyorgy.Szing@arm.com>2020-11-27 16:47:04 +0100
commit72c3f04be724f1df015f0b65c8e48d2c18bcd54e (patch)
tree46f68a6cac5b3432e9ee769cc29a1e6b89e2d872
parentb1d5d5fb914246999f37b12841da67a27babeef6 (diff)
downloadtrusted-services-72c3f04be724f1df015f0b65c8e48d2c18bcd54e.tar.gz
Add secure storage service and demo deployments
Change-Id: Ie321a3faca1a57fbfbd7709fa3f2e983e002f0b3 Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
-rw-r--r--deployments/secure-storage/opteesp/.gitignore1
-rw-r--r--deployments/secure-storage/opteesp/CMakeLists.txt100
-rw-r--r--deployments/secure-storage/opteesp/optee_sp_user_defines.h21
-rw-r--r--deployments/secure-storage/opteesp/sp.c65
-rw-r--r--deployments/secure-storage/opteesp/sp.h18
-rw-r--r--deployments/sfs-demo/opteesp/.gitignore1
-rw-r--r--deployments/sfs-demo/opteesp/CMakeLists.txt92
-rw-r--r--deployments/sfs-demo/opteesp/optee_sp_user_defines.h21
-rw-r--r--deployments/sfs-demo/opteesp/sp.c189
-rw-r--r--deployments/sfs-demo/opteesp/sp.h18
-rw-r--r--tools/b-test/test_data.yaml11
11 files changed, 537 insertions, 0 deletions
diff --git a/deployments/secure-storage/opteesp/.gitignore b/deployments/secure-storage/opteesp/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/deployments/secure-storage/opteesp/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/deployments/secure-storage/opteesp/CMakeLists.txt b/deployments/secure-storage/opteesp/CMakeLists.txt
new file mode 100644
index 0000000..6394bfe
--- /dev/null
+++ b/deployments/secure-storage/opteesp/CMakeLists.txt
@@ -0,0 +1,100 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.16)
+include(../../deployment.cmake REQUIRED)
+
+#-------------------------------------------------------------------------------
+# The CMakeLists.txt for building the secure-storage deployment for opteesp
+#
+# Builds the secure storage service provider for running in an SEL0 secure
+# partition hosted by OPTEE in the role of SPM.
+#-------------------------------------------------------------------------------
+include(${TS_ROOT}/environments/opteesp/env.cmake)
+project(trusted-services LANGUAGES C ASM)
+add_executable(secure-storage)
+target_include_directories(secure-storage PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
+set(SP_UUID "dc1eef48-b17a-4ccf-ac8b-dfcff7711b14")
+
+
+# Include SP DEV KIT interface
+set(SP_DEV_KIT_INC_DIR ${CMAKE_CURRENT_LIST_DIR})
+list(APPEND CMAKE_MODULE_PATH "${TS_ROOT}/external/Spdevkit")
+find_package(Spdevkit COMPONENTS SP_HEADER interface)
+
+sp_dev_kit_configure_linking(TARGET secure-storage DEFINES ARM64=1)
+target_link_libraries(secure-storage ${SP_DEV_KIT_LIBRARIES})
+
+add_components(TARGET "secure-storage"
+ BASE_DIR ${TS_ROOT}
+ COMPONENTS
+ components/messaging/ffa/libsp
+ components/rpc/ffarpc/endpoint
+ components/rpc/common/interface
+ components/service/common/provider
+ components/service/secure_storage/provider/secure_flash_store
+ components/service/secure_storage/provider/secure_flash_store/flash_fs
+ components/service/secure_storage/provider/secure_flash_store/flash
+ protocols/rpc/common/packed-c
+ protocols/service/secure_storage/packed-c
+ environments/opteesp
+)
+
+target_sources(secure-storage PRIVATE
+ sp.c
+)
+
+target_compile_definitions(secure-storage PRIVATE
+ ARM64=1
+)
+
+target_include_directories(secure-storage PRIVATE
+ ${TS_ROOT}
+ ${TS_ROOT}/components
+ ${TS_ROOT}/deployments/secure-storage/opteesp
+)
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(secure-storage PRIVATE
+ -fdiagnostics-show-option
+ -fpic
+ -gdwarf-2
+ -mstrict-align
+ -O0
+ -std=gnu99
+ )
+
+ # Options for GCC that control linking
+ target_link_options(secure-storage PRIVATE
+ -e __sp_entry
+ -fno-lto
+ -nostdlib
+ -pie
+ -zmax-page-size=4096
+ )
+ # Options directly for LD, these are not understood by GCC
+ target_link_options(secure-storage PRIVATE
+ -Wl,--as-needed
+ -Wl,--sort-section=alignment
+ # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
+ )
+endif()
+
+compiler_generate_stripped_elf(TARGET secure-storage NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
+
+######################################## install
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
+endif()
+install(TARGETS secure-storage
+ PUBLIC_HEADER DESTINATION include
+ RUNTIME DESTINATION bin
+ )
+install(FILES ${STRIPPED_ELF} DESTINATION bin)
+
+set(EXPORT_SP_NAME "secure-storage")
+set(EXPORT_SP_UUID ${SP_UUID})
+include(${TS_ROOT}/environments/opteesp/ExportSp.cmake)
diff --git a/deployments/secure-storage/opteesp/optee_sp_user_defines.h b/deployments/secure-storage/opteesp/optee_sp_user_defines.h
new file mode 100644
index 0000000..e773055
--- /dev/null
+++ b/deployments/secure-storage/opteesp/optee_sp_user_defines.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SP_HEADER_DEFINES_H
+#define SP_HEADER_DEFINES_H
+
+/* To get UUID definition */
+#include "sp.h"
+
+#define OPTEE_SP_FLAGS 0
+
+/* Provisioned stack size */
+#define OPTEE_SP_STACK_SIZE (64 * 1024)
+
+/* Provisioned heap size */
+#define OPTEE_SP_HEAP_SIZE (32 * 1024)
+
+#endif /* SP_HEADER_DEFINES_H */
diff --git a/deployments/secure-storage/opteesp/sp.c b/deployments/secure-storage/opteesp/sp.c
new file mode 100644
index 0000000..d04dbb2
--- /dev/null
+++ b/deployments/secure-storage/opteesp/sp.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "sp.h"
+#include <ffa_api.h>
+#include <components/rpc/common/endpoint/call_ep.h>
+#include <components/rpc/ffarpc/endpoint/ffarpc_call_ep.h>
+#include <components/service/secure_storage/provider/secure_flash_store/sfs_provider.h>
+#include <components/service/common/provider/service_provider.h>
+#include <sp_api.h>
+#include <sp_rxtx.h>
+#include <trace.h>
+
+uint16_t own_id = 0;
+static uint8_t tx_buffer[4096] __aligned(4096);
+static uint8_t rx_buffer[4096] __aligned(4096);
+
+void sp_main(struct ffa_init_info *init_info)
+{
+ ffa_result ffa_res;
+ sp_result sp_res;
+ struct call_ep *sfs_ep;
+ struct ffa_call_ep ffa_call_ep;
+ struct ffa_direct_msg req_msg;
+ struct ffa_direct_msg resp_msg;
+ struct sfs_provider sfs_provider;
+
+ /* Boot */
+ (void) init_info;
+
+ ffa_res = ffa_id_get(&own_id);
+ if (ffa_res != FFA_OK) {
+ EMSG("id get error: %d", ffa_res);
+ }
+
+ sp_res = sp_rxtx_buffer_map(tx_buffer, rx_buffer, sizeof(rx_buffer));
+ if (sp_res != SP_RESULT_OK) {
+ EMSG("rxtx map error: %d", sp_res);
+ }
+
+ sfs_ep = sfs_provider_init(&sfs_provider);
+ ffa_call_ep_init(&ffa_call_ep, sfs_ep);
+
+ /* End of boot phase */
+ ffa_msg_wait(&req_msg);
+
+ while (1) {
+ if (req_msg.function_id == FFA_MSG_SEND_DIRECT_REQ_32) {
+ ffa_call_ep_receive(&ffa_call_ep, &req_msg, &resp_msg);
+
+ ffa_msg_send_direct_resp(req_msg.destination_id,
+ req_msg.source_id, resp_msg.args[0], resp_msg.args[1],
+ resp_msg.args[2], resp_msg.args[3], resp_msg.args[4],
+ &req_msg);
+ }
+ }
+}
+
+void sp_interrupt_handler(uint32_t interrupt_id)
+{
+ (void)interrupt_id;
+}
diff --git a/deployments/secure-storage/opteesp/sp.h b/deployments/secure-storage/opteesp/sp.h
new file mode 100644
index 0000000..299c95e
--- /dev/null
+++ b/deployments/secure-storage/opteesp/sp.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SP_H
+#define SP_H
+
+#define OPTEE_SP_UUID \
+ { 0xdc1eef48, 0xb17a, 0x4ccf, \
+ { 0xac, 0x8b, 0xdf, 0xcf, 0xf7, 0x71, 0x1b, 0x14 } }
+
+#define SP_UUID_BYTES \
+ { 0xdc, 0x1e, 0xef, 0x48, 0xb1, 0x7a, 0x4c, 0xcf, \
+ 0xac, 0x8b, 0xdf, 0xcf, 0xf7, 0x71, 0x1b, 0x14, }
+
+#endif /* SP_H */
diff --git a/deployments/sfs-demo/opteesp/.gitignore b/deployments/sfs-demo/opteesp/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/deployments/sfs-demo/opteesp/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/deployments/sfs-demo/opteesp/CMakeLists.txt b/deployments/sfs-demo/opteesp/CMakeLists.txt
new file mode 100644
index 0000000..d3a7d15
--- /dev/null
+++ b/deployments/sfs-demo/opteesp/CMakeLists.txt
@@ -0,0 +1,92 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.16)
+include(../../deployment.cmake REQUIRED)
+
+#-------------------------------------------------------------------------------
+# The CMakeLists.txt for building the sfs-demo deployment for opteesp
+#
+# Used for building a demo sp that acts as a client of the secure storage
+# service, deployed in another sp.
+#-------------------------------------------------------------------------------
+include(${TS_ROOT}/environments/opteesp/env.cmake)
+project(trusted-services LANGUAGES C ASM)
+add_executable(sfs-demo)
+set(SP_UUID "01109cf8-e5ca-446f-9b55-f3cdc65110c8")
+
+
+# Include SP DEV KIT interface
+set(SP_DEV_KIT_INC_DIR ${CMAKE_CURRENT_LIST_DIR})
+list(APPEND CMAKE_MODULE_PATH "${TS_ROOT}/external/Spdevkit")
+find_package(Spdevkit REQUIRED)
+sp_dev_kit_configure_linking(TARGET sfs-demo DEFINES ARM64=1)
+target_link_libraries(sfs-demo ${SP_DEV_KIT_LIBRARIES})
+
+
+add_components(TARGET "sfs-demo"
+ BASE_DIR ${TS_ROOT}
+ COMPONENTS
+ components/messaging/ffa/libsp
+ components/rpc/common/interface
+ components/rpc/common/caller
+ components/rpc/ffarpc/caller/sp
+ components/service/common
+ components/service/secure_storage/client/psa
+ protocols/rpc/common/packed-c
+ protocols/service/secure_storage/packed-c
+ environments/opteesp
+)
+
+target_sources(sfs-demo PRIVATE
+ sp.c
+)
+
+target_compile_definitions(sfs-demo PRIVATE
+ ARM64=1
+)
+
+target_include_directories(sfs-demo PRIVATE
+ ${TS_ROOT}
+ ${TS_ROOT}/components
+ ${TS_ROOT}/deployments/sfs-demo/opteesp
+)
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(sfs-demo PRIVATE
+ -fdiagnostics-show-option
+ -fpic
+ -gdwarf-2
+ -mstrict-align
+ -O0
+ -std=gnu99
+ )
+
+ # Options for GCC that control linking
+ target_link_options(sfs-demo PRIVATE
+ -e __sp_entry
+ -fno-lto
+ -nostdlib
+ -pie
+ -zmax-page-size=4096
+ )
+ # Options directly for LD, these are not understood by GCC
+ target_link_options(sfs-demo PRIVATE
+ -Wl,--as-needed
+ -Wl,--sort-section=alignment
+ # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
+ )
+endif()
+
+compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
+
+######################################## install
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
+endif()
+#TODO: API header, protobuf files?
+install(TARGETS sfs-demo DESTINATION bin)
+install(FILES ${STRIPPED_ELF} DESTINATION bin)
diff --git a/deployments/sfs-demo/opteesp/optee_sp_user_defines.h b/deployments/sfs-demo/opteesp/optee_sp_user_defines.h
new file mode 100644
index 0000000..e773055
--- /dev/null
+++ b/deployments/sfs-demo/opteesp/optee_sp_user_defines.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SP_HEADER_DEFINES_H
+#define SP_HEADER_DEFINES_H
+
+/* To get UUID definition */
+#include "sp.h"
+
+#define OPTEE_SP_FLAGS 0
+
+/* Provisioned stack size */
+#define OPTEE_SP_STACK_SIZE (64 * 1024)
+
+/* Provisioned heap size */
+#define OPTEE_SP_HEAP_SIZE (32 * 1024)
+
+#endif /* SP_HEADER_DEFINES_H */
diff --git a/deployments/sfs-demo/opteesp/sp.c b/deployments/sfs-demo/opteesp/sp.c
new file mode 100644
index 0000000..eec703f
--- /dev/null
+++ b/deployments/sfs-demo/opteesp/sp.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "sp.h"
+#include <ffa_api.h>
+#include <components/rpc/ffarpc/caller/sp/ffarpc_caller.h>
+#include <components/service/secure_storage/client/psa/its/its_client.h>
+#include <psa/internal_trusted_storage.h>
+#include <sp_api.h>
+#include <sp_rxtx.h>
+#include <trace.h>
+#include <string.h>
+
+// #define SP_ITS_UUID_BYTES \
+// { 0xdc, 0x1e, 0xef, 0x48, 0xb1, 0x7a, 0x4c, 0xcf, \
+// 0xac, 0x8b, 0xdf, 0xcf, 0xf7, 0x71, 0x1b, 0x14, }
+
+#define SP_ITS_UUID_BYTES \
+ { 0x48, 0xef, 0x1e, 0xdc, 0x7a, 0xb1, 0xcf, 0x4c, \
+ 0xac, 0x8b, 0xdf, 0xcf, 0xf7, 0x71, 0x1b, 0x14, }
+
+uint16_t own_id = 0;
+static uint8_t tx_buffer[4096] __aligned(4096);
+static uint8_t rx_buffer[4096] __aligned(4096);
+static const uint8_t its_uuid[] = SP_ITS_UUID_BYTES;
+
+static const psa_storage_uid_t test_data_uid = 0x12345678;
+static const uint8_t test_data[] = {
+ 0xc3, 0xe2, 0xf8, 0x1c, 0xe0, 0x87, 0x8a, 0x14, 0xbf, 0x59, 0xa3, 0xff,
+ 0x96, 0x50, 0x25, 0x95, 0x76, 0xdc, 0xbe, 0xe6, 0x45, 0x45, 0x1d, 0x1b,
+ 0x34, 0x6a, 0xa1, 0x1c, 0xba, 0x24, 0xa9, 0x82, 0xf1, 0x03, 0x30, 0x9b,
+ 0x7d, 0xf6, 0x30, 0x88, 0xc2, 0xfb, 0xd7, 0x43, 0xfa, 0x82, 0x7c, 0x30,
+ 0x49, 0x71, 0xcb, 0xe6, 0xf8, 0x18, 0xb9, 0xfc, 0x61, 0x92, 0x8c, 0x86,
+ 0x01, 0x3a, 0x4a, 0xba, 0x88, 0x58, 0x63, 0x27, 0x9a, 0x47, 0xd3, 0x10,
+ 0xbf, 0x80, 0x70, 0x19, 0xab, 0xc3, 0x88, 0xdb, 0xc3, 0x0c, 0x6e, 0xe5,
+ 0xb1, 0xed, 0x9f, 0x47, 0xd4, 0x02, 0xa3, 0xb5, 0xb5, 0x7a, 0x20, 0x48,
+ 0xd5, 0x78, 0x95, 0x7d, 0xb8, 0x33, 0xb0, 0xad, 0x4a, 0x17, 0x5a, 0xff,
+ 0xd0, 0x12, 0x32, 0x84, 0x9a, 0xa3, 0x98, 0xd9, 0x26, 0x47, 0x55, 0xb7,
+ 0x31, 0x96, 0x1f, 0x89, 0xd7, 0xe1, 0x01, 0x5a, 0x71, 0x6d, 0xc1, 0xe2,
+ 0x26, 0x98, 0x12, 0x71, 0x4f, 0xa1, 0xdb, 0x50, 0xc4, 0xc6, 0x2f, 0xed,
+ 0x5b, 0xf1, 0x52, 0x97, 0x8e, 0xdb, 0xeb, 0x56, 0x41, 0xf5, 0x9c, 0xbf,
+ 0x6c, 0xe2, 0x1b, 0x14, 0x23, 0xb6, 0x1d, 0x68, 0x0b, 0x70, 0xa4, 0xc8,
+ 0x70, 0x9f, 0x0a, 0x65, 0x83, 0x27, 0xd5, 0xbb, 0x4b, 0x7d, 0x55, 0x25,
+ 0xe1, 0x9a, 0xaa, 0x10, 0x5c, 0x49, 0x8f, 0x0f, 0xee, 0x61, 0x49, 0x70,
+ 0xee, 0x55, 0x46, 0xec, 0x8b, 0x52, 0xf6, 0x65, 0x28, 0x7f, 0x56, 0x7a,
+ 0xe2, 0xb3, 0xd2, 0xbf, 0xc3, 0x0c, 0x06, 0x8e, 0x5f, 0xdc, 0xd3, 0x1f,
+ 0x85, 0x74, 0x38, 0x96, 0x5e, 0x1b, 0xe5, 0xa0, 0xc0, 0xfb, 0x90, 0xb7,
+ 0x14, 0x16, 0x1b, 0xbe, 0xd8, 0x5c, 0x8e, 0xcc, 0x74, 0x71, 0x8c, 0x34,
+ 0xc0, 0xbc, 0x24, 0xf5, 0xb9, 0x9b, 0xa1, 0x59, 0xe8, 0x54, 0xd0, 0xe9,
+ 0x01, 0xa9, 0x6e, 0x27,
+};
+static const size_t test_data_size = sizeof(test_data);
+static uint8_t check_data[256] = { 0 };
+static size_t check_data_size = 0;
+
+static void run_its_test(void)
+{
+ psa_status_t its_status;
+ struct psa_storage_info_t info;
+
+ /* Write data */
+ its_status = psa_its_set(test_data_uid, test_data_size, test_data,
+ PSA_STORAGE_FLAG_NONE);
+
+ if (its_status != PSA_SUCCESS) {
+ EMSG("Error: %d", its_status);
+ }
+
+ /* Read back and compare */
+ its_status = psa_its_get(test_data_uid, 0, test_data_size,
+ check_data, &check_data_size);
+
+ if (its_status != PSA_SUCCESS || check_data_size != test_data_size) {
+ EMSG("Error: %d", its_status);
+ }
+
+ if(memcmp(test_data, check_data, test_data_size)) {
+ EMSG("Data check failed");
+ }
+
+ memset(check_data, 0, test_data_size);
+
+ /* Get info of entry */
+ psa_its_get_info(test_data_uid, &info);
+ if (its_status != PSA_SUCCESS) {
+ EMSG("Error: %d", its_status);
+ }
+
+ /* Write data with new uid */
+ its_status = psa_its_set(test_data_uid + 1, test_data_size, test_data,
+ PSA_STORAGE_FLAG_NONE);
+
+ if (its_status != PSA_SUCCESS) {
+ EMSG("Error: %d", its_status);
+ }
+
+ /* Read back and compare */
+ its_status = psa_its_get(test_data_uid + 1, 0, test_data_size,
+ check_data, &check_data_size);
+
+ if (its_status != PSA_SUCCESS || check_data_size != test_data_size) {
+ EMSG("Error: %d", its_status);
+ }
+
+ if(memcmp(test_data, check_data, test_data_size)) {
+ EMSG("Data check failed");
+ }
+
+ /* Delete entry */
+ its_status = psa_its_remove(test_data_uid + 1);
+ if (its_status != PSA_SUCCESS) {
+ EMSG("Error: %d", its_status);
+ }
+
+ /* Check if really deleted */
+ its_status = psa_its_get(test_data_uid + 1, 0, test_data_size,
+ check_data, &check_data_size);
+
+ if (its_status != PSA_ERROR_DOES_NOT_EXIST) {
+ EMSG("Error: %d", its_status);
+ }
+
+ IMSG("ITS test done");
+}
+
+void __noreturn sp_main(struct ffa_init_info *init_info) {
+
+ ffa_result ffa_res;
+ sp_result sp_res;
+ struct ffa_direct_msg req_msg;
+ struct rpc_caller *caller;
+ struct ffarpc_caller ffa_caller;
+ uint16_t sp_ids[3];
+ uint32_t sp_id_cnt = 0;
+
+ /* Boot */
+ (void) init_info;
+ IMSG("Test SP started");
+
+ sp_res = sp_rxtx_buffer_map(tx_buffer, rx_buffer, sizeof(rx_buffer));
+ if (sp_res != SP_RESULT_OK) {
+ goto err;
+ }
+
+ ffa_res = ffa_id_get(&own_id);
+ if (ffa_res != FFA_OK) {
+ goto err;
+ }
+ IMSG("Test SP ID: 0x%x", own_id);
+
+ caller = ffarpc_caller_init(&ffa_caller);
+ sp_id_cnt = ffarpc_caller_discover(its_uuid, sp_ids, 3);
+
+ if (sp_id_cnt == 0) {
+ EMSG("Error: %d", sp_id_cnt);
+ goto err;
+ }
+ IMSG("ITS SP ID: 0x%x", sp_ids[0]);
+
+ if (ffarpc_caller_open(&ffa_caller, sp_ids[0])) {
+ goto err;
+ }
+
+ psa_its_client_init(caller);
+
+ /*
+ * This is not thorough testing of the ITS SP!
+ * Only some basic functionality checks.
+ */
+ run_its_test();
+
+ if (ffarpc_caller_close(&ffa_caller)) {
+ goto err;
+ }
+
+ /* End of boot phase */
+ ffa_msg_wait(&req_msg);
+
+err:
+ EMSG("Test SP error");
+ while (1) {}
+}
+
+void sp_interrupt_handler(uint32_t interrupt_id) {
+ (void)interrupt_id;
+}
diff --git a/deployments/sfs-demo/opteesp/sp.h b/deployments/sfs-demo/opteesp/sp.h
new file mode 100644
index 0000000..2b66c1c
--- /dev/null
+++ b/deployments/sfs-demo/opteesp/sp.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SP_H
+#define SP_H
+
+#define OPTEE_SP_UUID \
+ { 0x01109cf8, 0xe5ca, 0x446f, \
+ { 0x9b, 0x55, 0xf3, 0xcd, 0xc6, 0x51, 0x10, 0xc8 } }
+
+#define SP_UUID_BYTES \
+ { 0x01, 0x10, 0x9c, 0xf8, 0xe5, 0xca, 0x44, 0x6f, \
+ 0x9b, 0x55, 0xf3, 0xcd, 0xc6, 0x51, 0x10, 0xc8, }
+
+#endif /* SP_H */
diff --git a/tools/b-test/test_data.yaml b/tools/b-test/test_data.yaml
index f21947e..22ccc86 100644
--- a/tools/b-test/test_data.yaml
+++ b/tools/b-test/test_data.yaml
@@ -23,3 +23,14 @@ data:
params:
- "-GUnix Makefiles"
- "-DSP_DEV_KIT_DIR=$SP_DEV_KIT_DIR"
+ - name: "secure-storage-optee-arm"
+ src: "$TS_ROOT/deployments/secure-storage/opteesp"
+ params:
+ - "-GUnix Makefiles"
+ - "-DSP_DEV_KIT_DIR=$SP_DEV_KIT_DIR"
+ - "-DCMAKE_VERBOSE_MAKEFILE=y"
+ - name: "sfs-demo-optee-arm"
+ src: "$TS_ROOT/deployments/sfs-demo/opteesp"
+ params:
+ - "-GUnix Makefiles"
+ - "-DSP_DEV_KIT_DIR=$SP_DEV_KIT_DIR"