Build: Convert secure_fw dir to modern cmake
Rewrite cmake files inside the secure_fw directory. Removed generated
files as they are now generated into the build tree. Alter header
includes where include paths have changed.
WARNING: This change will not build in isolation, it requires _all_
other cmake changes to successfully build. It is split out only for
clarity of changes.
Change-Id: Ib1b13c9b69f2fcb1ff354ed6b5e5b717a207e3b8
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/secure_fw/partitions/audit_logging/CMakeLists.inc b/secure_fw/partitions/audit_logging/CMakeLists.inc
deleted file mode 100644
index 2f83b68..0000000
--- a/secure_fw/partitions/audit_logging/CMakeLists.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "audit_logging" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(AUDIT_LOGGING_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-if (NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-set (AUDIT_LOGGING_C_SRC
- "${AUDIT_LOGGING_DIR}/tfm_audit_secure_api.c"
- "${AUDIT_LOGGING_DIR}/audit_core.c"
-)
-
-#Append all our source files to global lists.
-list(APPEND ALL_SRC_C ${AUDIT_LOGGING_C_SRC})
-unset(AUDIT_LOGGING_C_SRC)
-
-#Setting include directories
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/common ABSOLUTE)
diff --git a/secure_fw/partitions/audit_logging/CMakeLists.txt b/secure_fw/partitions/audit_logging/CMakeLists.txt
index 70a60b0..b0cc32d 100644
--- a/secure_fw/partitions/audit_logging/CMakeLists.txt
+++ b/secure_fw/partitions/audit_logging/CMakeLists.txt
@@ -1,44 +1,63 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
-
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
-
-###Some project global settings
-set (AUDIT_LOGGING_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${AUDIT_LOGGING_DIR}/../../.." ABSOLUTE)
-
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_audit LANGUAGES ASM C)
-embedded_project_fixup()
-
-###Get the definition of what files we need to build
-include(CMakeLists.inc)
-
-if (NOT DEFINED TFM_LVL)
- message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ")
+if (NOT TFM_PARTITION_AUDIT_LOG)
+ return()
endif()
-#Specify what we build (for the audit logging service, build as a static library)
-add_library(tfm_audit STATIC ${ALL_SRC_ASM} ${ALL_SRC_C})
-embedded_set_target_compile_defines(TARGET tfm_audit LANGUAGE C DEFINES __thumb2__ TFM_LVL=${TFM_LVL})
-
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_audit LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
+#TODO AUDIT should support IPC
+if(TFM_PSA_API)
+ return()
endif()
-#Set common compiler and linker flags
-config_setting_shared_compiler_flags(tfm_audit)
-config_setting_shared_linker_flags(tfm_audit)
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0079 NEW)
-embedded_project_end(tfm_audit)
+add_library(tfm_partition_audit STATIC)
+
+target_sources(tfm_partition_audit
+ PRIVATE
+ audit_core.c
+)
+
+target_include_directories(tfm_partition_audit
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_audit
+ PRIVATE
+ platform_s
+ tfm_secure_api
+ psa_interface
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_audit_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_audit_secure_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_audit
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_AUDIT_LOG
+)
diff --git a/secure_fw/partitions/crypto/CMakeLists.inc b/secure_fw/partitions/crypto/CMakeLists.inc
deleted file mode 100644
index 7c1b880..0000000
--- a/secure_fw/partitions/crypto/CMakeLists.inc
+++ /dev/null
@@ -1,141 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "crypto" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# MBEDCRYPTO_INSTALL_DIR - directory where mbed-crypto headers and libraries can be found. Needed only when using CRYPTO_ENGINE_MBEDCRYPTO ON.
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(CRYPTO_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-#Check input variables
-if (NOT DEFINED ENABLE_CRYPTO)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_CRYPTO is undefined. ")
-endif()
-
-if (NOT DEFINED CRYPTO_ENGINE_MBEDTLS)
- message(FATAL_ERROR "Incomplete build configuration: CRYPTO_ENGINE_MBEDTLS is undefined. ")
-endif()
-
-if (ENABLE_CRYPTO)
- if (CRYPTO_ENGINE_MBEDTLS)
- if (NOT DEFINED MBEDCRYPTO_INSTALL_DIR)
- message(FATAL_ERROR "Please set MBEDCRYPTO_INSTALL_DIR before including this file.")
- endif()
- endif()
-
- if (NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
- endif()
-
- set (CRYPTO_C_SRC "${CRYPTO_DIR}/crypto_init.c"
- "${CRYPTO_DIR}/crypto_alloc.c"
- "${CRYPTO_DIR}/crypto_cipher.c"
- "${CRYPTO_DIR}/crypto_hash.c"
- "${CRYPTO_DIR}/crypto_mac.c"
- "${CRYPTO_DIR}/crypto_key.c"
- "${CRYPTO_DIR}/crypto_aead.c"
- "${CRYPTO_DIR}/crypto_asymmetric.c"
- "${CRYPTO_DIR}/crypto_key_derivation.c"
- "${CRYPTO_DIR}/tfm_crypto_secure_api.c"
- )
-
- if (CRYPTO_ENGINE_MBEDTLS)
- list(APPEND CRYPTO_C_SRC "${CRYPTO_DIR}/tfm_mbedcrypto_alt.c")
- endif()
-
- #Append all our source files to global lists.
- list(APPEND ALL_SRC_C ${CRYPTO_C_SRC})
- unset(CRYPTO_C_SRC)
-
- #Setting include directories
- embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
- if (CRYPTO_ENGINE_MBEDTLS)
- embedded_include_directories(PATH ${MBEDCRYPTO_INSTALL_DIR}/include ABSOLUTE)
- endif()
-
- #Inform the user about Crypto service features selected based on the Crypto service cmake flags
- message("The Crypto service compile configuration is as follows:")
- if (NOT DEFINED CRYPTO_ENGINE_BUF_SIZE)
- message("- CRYPTO_ENGINE_BUF_SIZE using default value")
- else()
- message("- CRYPTO_ENGINE_BUF_SIZE: " ${CRYPTO_ENGINE_BUF_SIZE})
- endif()
- if (NOT DEFINED CRYPTO_CONC_OPER_NUM)
- message("- CRYPTO_CONC_OPER_NUM using default value")
- else()
- message("- CRYPTO_CONC_OPER_NUM: " ${CRYPTO_CONC_OPER_NUM})
- endif()
-
- if (NOT DEFINED CRYPTO_KEY_MODULE_DISABLED)
- message("- KEY module enabled")
- set(CRYPTO_KEY_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_KEY_MODULE_DISABLED: " ${CRYPTO_KEY_MODULE_DISABLED})
- endif()
- if (NOT CRYPTO_KEY_MODULE_DISABLED AND
- NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
- message(FATAL_ERROR "Internal trusted storage should be enabled for persistent key storage")
- endif()
-
- if (NOT DEFINED CRYPTO_AEAD_MODULE_DISABLED)
- message("- AEAD module enabled")
- set(CRYPTO_AEAD_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_AEAD_MODULE_DISABLED: " ${CRYPTO_AEAD_MODULE_DISABLED})
- endif()
- if (NOT DEFINED CRYPTO_MAC_MODULE_DISABLED)
- message("- MAC module enabled")
- set(CRYPTO_MAC_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_MAC_MODULE_DISABLED: " ${CRYPTO_MAC_MODULE_DISABLED})
- endif()
- if (NOT DEFINED CRYPTO_HASH_MODULE_DISABLED)
- message("- HASH module enabled")
- set(CRYPTO_HASH_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_HASH_MODULE_DISABLED: " ${CRYPTO_HASH_MODULE_DISABLED})
- endif()
- if (NOT DEFINED CRYPTO_CIPHER_MODULE_DISABLED)
- message("- CIPHER module enabled")
- set(CRYPTO_CIPHER_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_CIPHER_MODULE_DISABLED: " ${CRYPTO_CIPHER_MODULE_DISABLED})
- endif()
- if (NOT DEFINED CRYPTO_KEY_DERIVATION_MODULE_DISABLED)
- message("- KEY_DERIVATION module enabled")
- set(CRYPTO_KEY_DERIVATION_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_KEY_DERIVATION_MODULE_DISABLED: " ${CRYPTO_KEY_DERIVATION_MODULE_DISABLED})
- endif()
- if (NOT DEFINED CRYPTO_ASYMMETRIC_MODULE_DISABLED)
- message("- ASYMMETRIC module enabled")
- set(CRYPTO_ASYMMETRIC_MODULE_DISABLED 0)
- else()
- message("- CRYPTO_ASYMMETRIC_MODULE_DISABLED: " ${CRYPTO_ASYMMETRIC_MODULE_DISABLED})
- endif()
- if (TFM_PSA_API)
- if (NOT DEFINED CRYPTO_IOVEC_BUFFER_SIZE)
- message("- CRYPTO_IOVEC_BUFFER_SIZE using default value")
- else()
- message("- CRYPTO_IOVEC_BUFFER_SIZE: " ${CRYPTO_IOVEC_BUFFER_SIZE})
- endif()
- endif()
-
-else()
- message(FATAL_ERROR "Build system currently doesn't support selectively disabling of a service.")
-endif()
diff --git a/secure_fw/partitions/crypto/CMakeLists.txt b/secure_fw/partitions/crypto/CMakeLists.txt
index d076edc..e10de61 100644
--- a/secure_fw/partitions/crypto/CMakeLists.txt
+++ b/secure_fw/partitions/crypto/CMakeLists.txt
@@ -1,148 +1,156 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
-
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
-
-#Some project global settings
-set (CRYPTO_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${CRYPTO_DIR}/../../.." ABSOLUTE)
-
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_crypto LANGUAGES ASM C)
-embedded_project_fixup()
-
-#Get the definition of what files we need to build
-set (ENABLE_CRYPTO ON)
-#The backend of the service is based on Mbed Crypto
-set (CRYPTO_ENGINE_MBEDTLS ON)
-
-if (CRYPTO_ENGINE_MBEDTLS)
- if (NOT DEFINED MBEDTLS_CONFIG_FILE)
- set (MBEDTLS_CONFIG_FILE "tfm_mbedcrypto_config.h")
- endif()
-
- if (NOT DEFINED MBEDTLS_CONFIG_PATH)
- set (MBEDTLS_CONFIG_PATH "${PLATFORM_DIR}/common")
- endif()
-
- #Define location of Mbed-Crypto(MbedTLS) source, build, and installation directory.
- get_filename_component(MBEDCRYPTO_SOURCE_DIR "${TFM_ROOT_DIR}/../mbedtls" ABSOLUTE)
- set (MBEDCRYPTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/mbed-crypto/build")
- set (MBEDCRYPTO_INSTALL_DIR ${MBEDCRYPTO_BINARY_DIR}/../install)
- set (MBEDCRYPTO_TARGET_NAME "mbedcrypto_lib")
+if (NOT TFM_PARTITION_CRYPTO)
+ return()
endif()
-include(CMakeLists.inc)
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0079 NEW)
-if (CRYPTO_HW_ACCELERATOR)
- if(NOT DEFINED CRYPTO_HW_ACCELERATOR_CMAKE_BUILD)
- message(FATAL_ERROR "CRYPTO_HW_ACCELERATOR_CMAKE_BUILD not defined.")
- endif()
- include(${CRYPTO_HW_ACCELERATOR_CMAKE_BUILD})
+add_library(tfm_partition_crypto STATIC)
+
+target_sources(tfm_partition_crypto
+ PRIVATE
+ crypto_init.c
+ crypto_alloc.c
+ crypto_cipher.c
+ crypto_hash.c
+ crypto_mac.c
+ crypto_key.c
+ crypto_aead.c
+ crypto_asymmetric.c
+ crypto_key_derivation.c
+)
+
+target_include_directories(tfm_partition_crypto
+ PRIVATE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+)
+
+# Linking to external interfaces
+target_link_libraries(tfm_partition_crypto
+ PRIVATE
+ tfm_secure_api
+ platform_s
+ mbedcrypto_crypto_service
+ psa_interface
+)
+target_compile_definitions(tfm_partition_crypto
+ PRIVATE
+ $<$<BOOL:${CRYPTO_KEY_MODULE_DISABLED}>:CRYPTO_KEY_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_AEAD_MODULE_DISABLED}>:CRYPTO_AEAD_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_MAC_MODULE_DISABLED}>:CRYPTO_MAC_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_CIPHER_MODULE_DISABLED}>:CRYPTO_CIPHER_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_HASH_MODULE_DISABLED}>:CRYPTO_HASH_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_GENERATOR_MODULE_DISABLED}>:CRYPTO_GENERATOR_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_ASYMMETRIC_MODULE_DISABLED}>:CRYPTO_ASYMMETRIC_MODULE_DISABLED>
+ $<$<BOOL:${CRYPTO_ENGINE_BUF_SIZE}>:CRYPTO_ENGINE_BUF_SIZE=${CRYPTO_ENGINE_BUF_SIZE}>
+ $<$<BOOL:${CRYPTO_CONC_OPER_NUM}>:CRYPTO_CONC_OPER_NUM=${CRYPTO_CONC_OPER_NUM}>
+ $<$<AND:$<NOT:$<BOOL:${TFM_PSA_API}>>,$<BOOL:${CRYPTO_IOVEC_BUFFER_SIZE}>>:CRYPTO_IOVEC_BUFFER_SIZE=${CRYPTO_IOVEC_BUFFER_SIZE}>
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_crypto_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_partition_crypto_secure_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_crypto
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_CRYPTO
+)
+
+############################### MBEDCRYPTO #####################################
+
+add_library(mbedcrypto_crypto_service_config INTERFACE)
+
+target_compile_definitions(mbedcrypto_crypto_service_config
+ INTERFACE
+ MBEDTLS_CONFIG_FILE="${TFM_MBEDCRYPTO_CONFIG_PATH}"
+ $<$<BOOL:${TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH}>:MBEDTLS_USER_CONFIG_FILE="${TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH}">
+ PSA_CRYPTO_SECURE
+ # Workaround for https://github.com/ARMmbed/mbedtls/issues/1077
+ $<$<OR:$<STREQUAL:${CMAKE_SYSTEM_ARCHITECTURE},armv8-m.base>,$<STREQUAL:${CMAKE_SYSTEM_ARCHITECTURE},armv6-m>>:MULADDC_CANNOT_USE_R7>
+)
+cmake_policy(SET CMP0079 NEW)
+
+set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
+set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
+set(ENABLE_TESTING OFF)
+set(ENABLE_PROGRAMS OFF)
+set(MBEDTLS_FATAL_WARNINGS OFF)
+set(ENABLE_DOCS OFF)
+set(INSTALL_MBEDTLS OFF)
+set(INSTALL_MBEDTLS_HEADERS OFF)
+
+# Current variables
+set(mbedcrypto_static_target mbedcrypto_crypto_service)
+set(mbedcrypto_lib_target mbedcrypto_lib_crypto_service)
+# Future variables
+set(lib_target lib_crypto_service)
+set(mbedcrypto_target mbedcrypto_crypto_service)
+set(mbedtls_target mbedtls_crypto_service)
+set(mbedx509_target mbedx509_crypto_service)
+
+# Mbedcrypto is quite a large lib, and it uses too much memory for it to be
+# reasonable to build it in debug info. As a compromise, if `debug` build type
+# is selected mbedcrypto will build under `relwithdebinfo` which preserved debug
+# symbols whild optimizing space.
+set(SAVED_BUILD_TYPE ${CMAKE_BUILD_TYPE})
+set(CMAKE_BUILD_TYPE ${MBEDCRYPTO_BUILD_TYPE})
+add_subdirectory(${MBEDCRYPTO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/mbedcrypto)
+set(CMAKE_BUILD_TYPE ${SAVED_BUILD_TYPE} CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
+
+if(NOT TARGET mbedcrypto_crypto_service)
+ message(FATAL_ERROR "Target mbedcrypto_crypto_service does not exist. Have the patches in ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto been applied to the mbedcrypto repo at ${MBEDCRYPTO_PATH} ?
+ Hint: The command might be `cd ${MBEDCRYPTO_PATH} && git apply ${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/*.patch`")
endif()
-#Create a list of the C defines
-list(APPEND TFM_CRYPTO_C_DEFINES_LIST __thumb2__ TFM_LVL=${TFM_LVL})
+set_target_properties(${mbedtls_target} ${mbedx509_target}
+ PROPERTIES
+ EXCLUDE_FROM_ALL TRUE
+)
-if (CRYPTO_ENGINE_MBEDTLS)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_ENGINE_MBEDTLS MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}")
- if (DEFINED MBEDTLS_USER_CONFIG_FILE)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST MBEDTLS_USER_CONFIG_FILE="${MBEDTLS_USER_CONFIG_FILE}")
- endif()
-endif()
+target_include_directories(mbedcrypto_crypto_service
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
-#Add module configuration parameters in case they are provided during CMake configuration step
-if (CRYPTO_KEY_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_KEY_MODULE_DISABLED)
-endif()
-if (CRYPTO_AEAD_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_AEAD_MODULE_DISABLED)
-endif()
-if (CRYPTO_MAC_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_MAC_MODULE_DISABLED)
-endif()
-if (CRYPTO_CIPHER_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_CIPHER_MODULE_DISABLED)
-endif()
-if (CRYPTO_HASH_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_HASH_MODULE_DISABLED)
-endif()
-if (CRYPTO_KEY_DERIVATION_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_KEY_DERIVATION_MODULE_DISABLED)
-endif()
-if (CRYPTO_ASYMMETRIC_MODULE_DISABLED)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_ASYMMETRIC_MODULE_DISABLED)
-endif()
+target_sources(mbedcrypto_crypto_service
+ PRIVATE
+ $<$<NOT:$<BOOL:${CRYPTO_HW_ACCELERATOR}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_mbedcrypto_alt.c>
+)
-if (DEFINED CRYPTO_ENGINE_BUF_SIZE)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_ENGINE_BUF_SIZE=${CRYPTO_ENGINE_BUF_SIZE})
-endif()
-if (DEFINED CRYPTO_CONC_OPER_NUM)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_CONC_OPER_NUM=${CRYPTO_CONC_OPER_NUM})
-endif()
-if (TFM_PSA_API AND DEFINED CRYPTO_IOVEC_BUFFER_SIZE)
- list(APPEND TFM_CRYPTO_C_DEFINES_LIST TFM_CRYPTO_IOVEC_BUFFER_SIZE=${CRYPTO_IOVEC_BUFFER_SIZE})
-endif()
+target_compile_options(mbedcrypto_crypto_service
+ PRIVATE
+ -Wno-unused-parameter
+)
-if (CRYPTO_ENGINE_MBEDTLS)
- #Set Mbed Crypto compiler flags
- string(APPEND MBEDCRYPTO_C_FLAGS " ${MBEDCRYPTO_C_FLAGS_SERVICES}")
- string(APPEND MBEDCRYPTO_C_FLAGS " -DMBEDTLS_CONFIG_FILE=\\\\\\\"${MBEDTLS_CONFIG_FILE}\\\\\\\""
- " -I${CMAKE_CURRENT_LIST_DIR}")
- if ((DEFINED MBEDTLS_USER_CONFIG_FILE) AND (DEFINED MBEDTLS_USER_CONFIG_PATH))
- string(APPEND MBEDCRYPTO_C_FLAGS " -DMBEDTLS_USER_CONFIG_FILE=\\\\\\\"${MBEDTLS_USER_CONFIG_FILE}\\\\\\\""
- " -I${MBEDTLS_USER_CONFIG_PATH}")
- endif()
- #Add TF-M include directory so Mbed Crypto can include PSA ITS headers
- string(APPEND MBEDCRYPTO_C_FLAGS " -I${TFM_ROOT_DIR}/interface/include")
-
- #Build Mbed Crypto as external project.
- #This ensures Mbed Crypto is built with exactly defined settings.
- #Mbed Crypto will be used from its install location
- include(${TFM_ROOT_DIR}/BuildMbedCrypto.cmake)
-endif()
-
-#Specify what we build (for the crypto service, build as a static library)
-add_library(tfm_crypto STATIC ${ALL_SRC_ASM} ${ALL_SRC_C})
-embedded_set_target_compile_defines(TARGET tfm_crypto LANGUAGE C DEFINES ${TFM_CRYPTO_C_DEFINES_LIST})
-
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_crypto LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
-endif()
-
-if (CRYPTO_ENGINE_MBEDTLS)
- #Add a dependency on the Mbed Crypto install target.
- add_dependencies(tfm_crypto ${MBEDCRYPTO_TARGET_NAME}_install)
- #Ask the compiler to merge the Mbed Crypto and crypto service libraries.
- compiler_merge_library(DEST tfm_crypto LIBS "${MBEDCRYPTO_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX_C}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX_C}")
-
- #Link crypto accelerator libraries if applicable
- if (CRYPTO_HW_ACCELERATOR)
- if(NOT DEFINED CRYPTO_HW_ACCELERATOR_CMAKE_LINK)
- message(FATAL_ERROR "CRYPTO_HW_ACCELERATOR_CMAKE_LINK not defined.")
- endif()
- include(${CRYPTO_HW_ACCELERATOR_CMAKE_LINK})
- endif()
-endif()
-
-#Persistent key requires ITS service
-if (NOT CRYPTO_KEY_MODULE_DISABLED)
- target_link_libraries(tfm_crypto PRIVATE tfm_internal_trusted_storage)
-endif()
-
-#Set common compiler and linker flags
-config_setting_shared_compiler_flags(tfm_crypto)
-config_setting_shared_linker_flags(tfm_crypto)
-
-embedded_project_end(tfm_crypto)
+target_link_libraries(mbedcrypto_crypto_service
+ PRIVATE
+ psa_interface
+ tfm_secure_api
+ platform_s
+ PUBLIC
+ mbedcrypto_crypto_service_config
+)
diff --git a/secure_fw/partitions/crypto/tfm_mbedcrypto_include.h b/secure_fw/partitions/crypto/tfm_mbedcrypto_include.h
index 69342b1..7bb7f46 100644
--- a/secure_fw/partitions/crypto/tfm_mbedcrypto_include.h
+++ b/secure_fw/partitions/crypto/tfm_mbedcrypto_include.h
@@ -14,6 +14,6 @@
* Mbed Crypto
*/
#include "crypto_spe.h"
-#include "mbedcrypto/psa/crypto.h"
+#include "psa/crypto.h"
#endif /* __TFM_MBEDCRYPTO_INCLUDE_H__ */
diff --git a/secure_fw/partitions/initial_attestation/CMakeLists.inc b/secure_fw/partitions/initial_attestation/CMakeLists.inc
deleted file mode 100644
index abd6cd2..0000000
--- a/secure_fw/partitions/initial_attestation/CMakeLists.inc
+++ /dev/null
@@ -1,111 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "initial_attestation" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(INITIAL_ATTESTATION_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-if (NOT DEFINED ATTEST_INCLUDE_OPTIONAL_CLAIMS)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_OPTIONAL_CLAIMS is undefined.")
-endif()
-
-if (NOT DEFINED ATTEST_INCLUDE_TEST_CODE)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_TEST_CODE is undefined.")
-endif()
-
-if (NOT DEFINED ATTEST_INCLUDE_COSE_KEY_ID)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_COSE_KEY_ID is undefined.")
-endif()
-
-if (NOT DEFINED ATTEST_CLAIM_VALUE_CHECK)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_CLAIM_VALUE_CHECK is undefined.")
-endif()
-
-list(APPEND ATTEST_C_SRC
- "${INITIAL_ATTESTATION_DIR}/tfm_attest_secure_api.c"
- "${INITIAL_ATTESTATION_DIR}/tfm_attest.c"
- "${INITIAL_ATTESTATION_DIR}/tfm_attest_req_mngr.c"
- "${INITIAL_ATTESTATION_DIR}/attest_core.c"
- "${INITIAL_ATTESTATION_DIR}/attest_token_encode.c"
- )
-
-if (SYMMETRIC_INITIAL_ATTESTATION)
- list(APPEND ATTEST_C_SRC "${INITIAL_ATTESTATION_DIR}/attest_symmetric_key.c")
-else()
- list(APPEND ATTEST_C_SRC "${INITIAL_ATTESTATION_DIR}/attest_asymmetric_key.c")
-endif()
-
-if (ATTEST_INCLUDE_OPTIONAL_CLAIMS)
- set_property(SOURCE ${ATTEST_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_OPTIONAL_CLAIMS)
-endif()
-
-if (ATTEST_INCLUDE_TEST_CODE)
- set_property(SOURCE ${ATTEST_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE)
-endif()
-
-if (ATTEST_INCLUDE_COSE_KEY_ID)
- set_property(SOURCE ${ATTEST_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_COSE_KEY_ID)
-endif()
-
-if (LEGACY_TFM_TLV_HEADER)
- set_property(SOURCE ${ATTEST_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS LEGACY_TFM_TLV_HEADER)
-endif()
-
-#Inform the user about attestation service features selected based on the cmake flags
-message("The Initial Attestation service compile configuration is as follows:")
-message("- ATTEST_INCLUDE_OPTIONAL_CLAIMS: ${ATTEST_INCLUDE_OPTIONAL_CLAIMS}")
-message("- ATTEST_INCLUDE_TEST_CODE: ${ATTEST_INCLUDE_TEST_CODE}")
-message("- ATTEST_INCLUDE_COSE_KEY_ID: ${ATTEST_INCLUDE_COSE_KEY_ID}")
-message("- ATTEST_CLAIM_VALUE_CHECK: ${ATTEST_CLAIM_VALUE_CHECK}")
-
-#Setting include directories
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/common ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/bl2/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/partitions/lib/sprt/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/qcbor/inc ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/t_cose/inc ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/t_cose/src ABSOLUTE)
-embedded_include_directories(PATH ${INITIAL_ATTESTATION_DIR} ABSOLUTE)
-
-set(BUILD_CMSIS_CORE Off)
-set(BUILD_RETARGET Off)
-set(BUILD_NATIVE_DRIVERS Off)
-set(BUILD_STARTUP Off)
-set(BUILD_TARGET_CFG Off)
-set(BUILD_TARGET_HARDWARE_KEYS Off)
-set(BUILD_TARGET_NV_COUNTERS Off)
-set(BUILD_CMSIS_DRIVERS Off)
-set(BUILD_TIME Off)
-set(BUILD_UART_STDOUT Off)
-set(BUILD_FLASH Off)
-set(BUILD_PLAT_TEST Off)
-if(NOT DEFINED PLATFORM_CMAKE_FILE)
- message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
-elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
- message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
-else()
- include(${PLATFORM_CMAKE_FILE})
-endif()
-
-#Append all our source files to global lists.
-list(APPEND ALL_SRC_C ${ATTEST_C_SRC})
-unset(ATTEST_C_SRC)
diff --git a/secure_fw/partitions/initial_attestation/CMakeLists.txt b/secure_fw/partitions/initial_attestation/CMakeLists.txt
index af89337..509b3a9 100644
--- a/secure_fw/partitions/initial_attestation/CMakeLists.txt
+++ b/secure_fw/partitions/initial_attestation/CMakeLists.txt
@@ -1,51 +1,86 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
-
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
-
-#Some project global settings
-set (INITIAL_ATTESTATION_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${INITIAL_ATTESTATION_DIR}/../../.." ABSOLUTE)
-
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_attest LANGUAGES ASM C)
-embedded_project_fixup()
-
-#Get the definition of what files we need to build
-include(CMakeLists.inc)
-
-if (NOT DEFINED TFM_LVL)
- message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined.")
+if (NOT TFM_PARTITION_INITIAL_ATTESTATION)
+ return()
endif()
-if (NOT TARGET tfm_qcbor_encode)
- add_subdirectory(${TFM_ROOT_DIR}/lib/ext/qcbor ${CMAKE_CURRENT_BINARY_DIR}/qcbor)
-endif()
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0079 NEW)
-if (NOT TARGET tfm_t_cose_sign)
- add_subdirectory(${TFM_ROOT_DIR}/lib/ext/t_cose ${CMAKE_CURRENT_BINARY_DIR}/t_cose)
-endif()
+add_library(tfm_partition_attestation STATIC)
-#Specify what we build (for the initial attestation service, build as a static library)
-add_library(tfm_attest STATIC ${ALL_SRC_ASM} ${ALL_SRC_C} $<TARGET_OBJECTS:tfm_qcbor_encode> $<TARGET_OBJECTS:tfm_t_cose_sign>)
-embedded_set_target_compile_defines(TARGET tfm_attest LANGUAGE C DEFINES __thumb2__ TFM_LVL=${TFM_LVL})
+target_sources(tfm_partition_attestation PRIVATE
+ tfm_attest.c
+ tfm_attest_req_mngr.c
+ attest_core.c
+ $<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:attest_asymmetric_key.c>
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:attest_symmetric_key.c>
+ attest_token_encode.c
+)
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_attest LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
-endif()
+target_include_directories(tfm_partition_attestation
+ PUBLIC
+ .
+)
-#Set common compiler flags
-config_setting_shared_compiler_flags(tfm_attest)
+target_link_libraries(tfm_partition_attestation
+ PRIVATE
+ tfm_secure_api
+ platform_s
+ tfm_qcbor
+ tfm_t_cose
+ secure_fw
+ psa_interface
+ tfm_sprt
+)
-embedded_project_end(tfm_attest)
+target_compile_definitions(tfm_partition_attestation
+ PRIVATE
+ $<$<BOOL:${TFM_INTERNAL_MCUBOOT}>:LEGACY_TFM_TLV_HEADER>
+ $<$<CONFIG:Debug>:INCLUDE_TEST_CODE>
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+ $<$<BOOL:${ATTEST_INCLUDE_OPTIONAL_CLAIMS}>:INCLUDE_OPTIONAL_CLAIMS>
+ $<$<BOOL:${ATTEST_INCLUDE_COSE_KEY_ID}>:INCLUDE_COSE_KEY_ID>
+ $<$<NOT:$<BOOL:${PLATFORM_DUMMY_ATTEST_HAL}>>:CLAIM_VALUE_CHECK>
+)
+
+########################### Attest defs ########################################
+
+add_library(tfm_attestation_defs INTERFACE)
+
+target_include_directories(tfm_attestation_defs
+ INTERFACE
+ .
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_attest_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_attest_secure_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_attestation
+)
+
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_INITIAL_ATTESTATION
+)
diff --git a/secure_fw/partitions/initial_attestation/attest_symmetric_key.c b/secure_fw/partitions/initial_attestation/attest_symmetric_key.c
index 601e390..4fa24a4 100644
--- a/secure_fw/partitions/initial_attestation/attest_symmetric_key.c
+++ b/secure_fw/partitions/initial_attestation/attest_symmetric_key.c
@@ -10,7 +10,7 @@
#include <stdint.h>
#include "attest_key.h"
-#include "platform/include/tfm_plat_crypto_keys.h"
+#include "tfm_plat_crypto_keys.h"
#include "psa/crypto.h"
#include "tfm_memory_utils.h"
diff --git a/secure_fw/partitions/internal_trusted_storage/CMakeLists.inc b/secure_fw/partitions/internal_trusted_storage/CMakeLists.inc
deleted file mode 100644
index a044be0..0000000
--- a/secure_fw/partitions/internal_trusted_storage/CMakeLists.inc
+++ /dev/null
@@ -1,129 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "internal_trusted_storage" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(INTERNAL_TRUSTED_STORAGE_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-#Check input variables
-if (NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-if (NOT DEFINED ITS_CREATE_FLASH_LAYOUT)
- message(FATAL_ERROR "Incomplete build configuration: ITS_CREATE_FLASH_LAYOUT is undefined. ")
-endif()
-
-if (NOT DEFINED ITS_VALIDATE_METADATA_FROM_FLASH)
- message(FATAL_ERROR "Incomplete build configuration: ITS_VALIDATE_METADATA_FROM_FLASH is undefined. ")
-endif()
-
-if (NOT DEFINED ITS_RAM_FS)
- message(FATAL_ERROR "Incomplete build configuration: ITS_RAM_FS is undefined. ")
-endif()
-
-set(INTERNAL_TRUSTED_STORAGE_C_SRC
- "${INTERNAL_TRUSTED_STORAGE_DIR}/tfm_its_secure_api.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/tfm_its_req_mngr.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/tfm_internal_trusted_storage.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/its_utils.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash/its_flash.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash/its_flash_nand.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash/its_flash_nor.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash/its_flash_ram.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash/its_flash_info_internal.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash/its_flash_info_external.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash_fs/its_flash_fs.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash_fs/its_flash_fs_dblock.c"
- "${INTERNAL_TRUSTED_STORAGE_DIR}/flash_fs/its_flash_fs_mblock.c"
-)
-
-# If either ITS or PS requires metadata to be validated, then compile the
-# validation code.
-if (ITS_VALIDATE_METADATA_FROM_FLASH OR PS_VALIDATE_METADATA_FROM_FLASH)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS ITS_VALIDATE_METADATA_FROM_FLASH)
-endif()
-
-if (ITS_CREATE_FLASH_LAYOUT)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS ITS_CREATE_FLASH_LAYOUT)
-endif()
-
-if (ITS_RAM_FS)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS ITS_RAM_FS)
-endif()
-
-if (DEFINED ITS_BUF_SIZE)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS ITS_BUF_SIZE=${ITS_BUF_SIZE})
-endif()
-
-# Also set PS definitions
-if (PS_ENCRYPTION)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_ENCRYPTION)
- if (PS_ROLLBACK_PROTECTION)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_ROLLBACK_PROTECTION)
- endif()
-endif()
-
-if (PS_CREATE_FLASH_LAYOUT)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_CREATE_FLASH_LAYOUT)
-endif()
-
-if (PS_RAM_FS)
- set_property(SOURCE ${INTERNAL_TRUSTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_RAM_FS)
-endif()
-
-#Append all our source files to global lists.
-list(APPEND ALL_SRC_C ${INTERNAL_TRUSTED_STORAGE_C_SRC})
-unset(INTERNAL_TRUSTED_STORAGE_C_SRC)
-
-#Inform the user about ITS service features selected based on the ITS service CMake flags
-message("The ITS service compile configuration is as follows:")
-message("- ITS_VALIDATE_METADATA_FROM_FLASH: " ${ITS_VALIDATE_METADATA_FROM_FLASH})
-message("- ITS_CREATE_FLASH_LAYOUT: " ${ITS_CREATE_FLASH_LAYOUT})
-message("- ITS_RAM_FS: " ${ITS_RAM_FS})
-if (DEFINED ITS_BUF_SIZE)
- message("- ITS_BUF_SIZE: " ${ITS_BUF_SIZE})
-else()
- message("- ITS_BUF_SIZE using default value")
-endif()
-
-#Setting include directories
-embedded_include_directories(PATH ${INTERNAL_TRUSTED_STORAGE_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/driver ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/partitions/protected_storage ABSOLUTE)
-
-set(BUILD_CMSIS_CORE Off)
-set(BUILD_RETARGET Off)
-set(BUILD_NATIVE_DRIVERS Off)
-set(BUILD_STARTUP Off)
-set(BUILD_TARGET_CFG Off)
-set(BUILD_TARGET_HARDWARE_KEYS Off)
-set(BUILD_TARGET_NV_COUNTERS Off)
-set(BUILD_CMSIS_DRIVERS Off)
-set(BUILD_TIME Off)
-set(BUILD_UART_STDOUT Off)
-set(BUILD_FLASH Off)
-if (NOT DEFINED PLATFORM_CMAKE_FILE)
- message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
-elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
- message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
-else()
- include(${PLATFORM_CMAKE_FILE})
-endif()
diff --git a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt
index 569a255..b776b30 100644
--- a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt
+++ b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt
@@ -1,44 +1,87 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
-
-# Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
-
-###Some project global settings
-set (INTERNAL_TRUSTED_STORAGE_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${INTERNAL_TRUSTED_STORAGE_DIR}/../../.." ABSOLUTE)
-
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_internal_trusted_storage LANGUAGES ASM C)
-embedded_project_fixup()
-
-###Get the definition of what files we need to build
-include(CMakeLists.inc)
-
-if (NOT DEFINED TFM_LVL)
- message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ")
+if (NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
+ return()
endif()
-# Specify what we build (for the internal trusted storage service, build as a static library)
-add_library(tfm_internal_trusted_storage STATIC ${ALL_SRC_ASM} ${ALL_SRC_C})
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0079 NEW)
-#Set common compiler and linker flags
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_internal_trusted_storage LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
-endif()
-config_setting_shared_compiler_flags(tfm_internal_trusted_storage)
-config_setting_shared_linker_flags(tfm_internal_trusted_storage)
+add_library(tfm_partition_its STATIC)
-embedded_set_target_compile_defines(TARGET tfm_internal_trusted_storage LANGUAGE C DEFINES __thumb2__ TFM_LVL=${TFM_LVL})
+target_include_directories(tfm_partition_its
+ PRIVATE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ PUBLIC
+ # Required for ps_object_defs.h
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/../protected_storage
+)
-embedded_project_end(tfm_internal_trusted_storage)
+target_sources(tfm_partition_its
+ PRIVATE
+ tfm_its_req_mngr.c
+ tfm_internal_trusted_storage.c
+ its_utils.c
+ flash/its_flash.c
+ flash/its_flash_nand.c
+ flash/its_flash_nor.c
+ flash/its_flash_ram.c
+ flash/its_flash_info_internal.c
+ flash/its_flash_info_external.c
+ flash_fs/its_flash_fs.c
+ flash_fs/its_flash_fs_dblock.c
+ flash_fs/its_flash_fs_mblock.c
+)
+
+target_link_libraries(tfm_partition_its
+ PRIVATE
+ tfm_secure_api
+ platform_s
+ psa_interface
+)
+
+target_compile_definitions(tfm_partition_its
+ PUBLIC
+ $<$<BOOL:${PS_CREATE_FLASH_LAYOUT}>:PS_CREATE_FLASH_LAYOUT>
+ $<$<BOOL:${PS_ENCRYPTION}>:PS_ENCRYPTION>
+ $<$<BOOL:${PS_RAM_FS}>:PS_RAM_FS>
+ $<$<BOOL:${PS_ROLLBACK_PROTECTION}>:PS_ROLLBACK_PROTECTION>
+ $<$<BOOL:${PS_VALIDATE_METADATA_FROM_FLASH}>:PS_VALIDATE_METADATA_FROM_FLASH>
+ $<$<BOOL:${PS_CRYPTO_AEAD_ALG}>:PS_CRYPTO_AEAD_ALG=${PS_CRYPTO_AEAD_ALG}>
+ PRIVATE
+ $<$<BOOL:${ITS_CREATE_FLASH_LAYOUT}>:ITS_CREATE_FLASH_LAYOUT>
+ $<$<BOOL:${ITS_RAM_FS}>:ITS_RAM_FS>
+ $<$<OR:$<BOOL:${ITS_VALIDATE_METADATA_FROM_FLASH}>,$<BOOL:PS_VALIDATE_METADATA_FROM_FLASH>>:ITS_VALIDATE_METADATA_FROM_FLASH>
+ $<$<BOOL:${ITS_BUF_SIZE}>:ITS_BUF_SIZE>
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_its_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_its_secure_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_its
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
+)
diff --git a/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nand.c b/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nand.c
index f6e86d0..5d31646 100644
--- a/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nand.c
+++ b/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nand.c
@@ -7,7 +7,7 @@
*/
#include "its_flash_nand.h"
-#include "Driver_Flash.h"
+#include "driver/Driver_Flash.h"
#include "tfm_memory_utils.h"
static uint32_t buf_block_id = ITS_BLOCK_INVALID_ID;
diff --git a/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nor.c b/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nor.c
index 6d9ac10..2665380 100644
--- a/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nor.c
+++ b/secure_fw/partitions/internal_trusted_storage/flash/its_flash_nor.c
@@ -7,7 +7,7 @@
*/
#include "its_flash_nor.h"
-#include "Driver_Flash.h"
+#include "driver/Driver_Flash.h"
/**
* \brief Gets physical address of the given block ID.
diff --git a/secure_fw/partitions/lib/sprt/CMakeLists.inc b/secure_fw/partitions/lib/sprt/CMakeLists.inc
deleted file mode 100644
index e4f1bd7..0000000
--- a/secure_fw/partitions/lib/sprt/CMakeLists.inc
+++ /dev/null
@@ -1,49 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definations to compile the "libtfmsprt" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C_S: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX_S: C++ source files to be compiled will be added to this list. This shaall be added to your add_executable or add_library command.
-# ALL_SRC_ASM_S: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(LIBSPRT_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-if(NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-set (LIBSPRT_C_SRC
- "${LIBSPRT_DIR}/crt_memcpy.c"
- "${LIBSPRT_DIR}/crt_memmove.c"
- "${LIBSPRT_DIR}/crt_memcmp.c"
- "${LIBSPRT_DIR}/crt_memset.c"
- "${LIBSPRT_DIR}/service_api.c"
- "${TFM_ROOT_DIR}/interface/src/log/tfm_log_raw.c")
-
-if (TFM_PSA_API)
- list(APPEND LIBSPRT_C_SRC
- "${TFM_ROOT_DIR}/interface/src/psa/psa_client.c"
- "${TFM_ROOT_DIR}/interface/src/psa/psa_service.c"
- "${TFM_ROOT_DIR}/interface/src/psa/psa_lifecycle.c"
- )
-endif()
-
-#Append all our source files to global lists.
-list(APPEND ALL_SRC_C_S ${LIBSPRT_C_SRC})
-unset(LIBSPRT_C_SRC)
-
-#Setting include directories
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${LIBSPRT_DIR}/include ABSOLUTE)
diff --git a/secure_fw/partitions/lib/sprt/CMakeLists.txt b/secure_fw/partitions/lib/sprt/CMakeLists.txt
index a183397..626559f 100644
--- a/secure_fw/partitions/lib/sprt/CMakeLists.txt
+++ b/secure_fw/partitions/lib/sprt/CMakeLists.txt
@@ -1,38 +1,31 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.13)
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+add_library(tfm_sprt STATIC)
-#Some project global settings
-set (LIBSPRT_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${CMAKE_SOURCE_DIR}" ABSOLUTE)
+target_include_directories(tfm_sprt
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+)
-#Include common stuff to control cmake.
-include("Common/BuildSys")
+target_sources(tfm_sprt
+ PRIVATE
+ ./crt_memcmp.c
+ ./crt_memcpy.c
+ ./crt_memmove.c
+ ./crt_memset.c
+ ./service_api.c
+)
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(libtfmsprt LANGUAGES ASM C)
-embedded_project_fixup()
-
-#Get the definition of what files we need to build
-include(CMakeLists.inc)
-
-#Build secure partition runtime library as a static library
-add_library(libtfmsprt STATIC ${ALL_SRC_ASM_S} ${ALL_SRC_C_S})
-embedded_set_target_compile_defines(TARGET libtfmsprt LANGUAGE C DEFINES __thumb2__)
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET libtfmsprt LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
-endif()
-#Set common compiler and linker flags
-config_setting_shared_compiler_flags(libtfmsprt)
-config_setting_shared_linker_flags(libtfmsprt)
-
-embedded_project_end(libtfmsprt)
+target_link_libraries(tfm_sprt
+ platform_s
+ psa_interface
+ tfm_boot_status
+ tfm_secure_api
+)
diff --git a/secure_fw/partitions/platform/CMakeLists.inc b/secure_fw/partitions/platform/CMakeLists.inc
deleted file mode 100644
index d71f8a6..0000000
--- a/secure_fw/partitions/platform/CMakeLists.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "Platform" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(PLATFORM_SERVICE_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-if (NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-set (PLATFORM_SERVICE_C_SRC
- "${PLATFORM_SERVICE_DIR}/platform_sp.c"
- "${PLATFORM_SERVICE_DIR}/tfm_platform_secure_api.c")
-
-#Append all our source files to global lists.
-list(APPEND ALL_SRC_C ${PLATFORM_SERVICE_C_SRC})
-unset(PLATFORM_SERVICE_C_SRC)
-
-#Setting include directories
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/common ABSOLUTE)
diff --git a/secure_fw/partitions/platform/CMakeLists.txt b/secure_fw/partitions/platform/CMakeLists.txt
index d5ebd54..9012057 100644
--- a/secure_fw/partitions/platform/CMakeLists.txt
+++ b/secure_fw/partitions/platform/CMakeLists.txt
@@ -1,43 +1,57 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
-
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
-
-###Some project global settings
-set (PLATFORM_SP_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${PLATFORM_SP_DIR}/../../.." ABSOLUTE)
-
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_platform LANGUAGES ASM C)
-embedded_project_fixup()
-
-###Get the definition of what files we need to build
-include(CMakeLists.inc)
-
-if (NOT DEFINED TFM_LVL)
- message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ")
+if (NOT TFM_PARTITION_PLATFORM)
+ return()
endif()
-#Specify what we build (for the platform service, build as a static library)
-add_library(tfm_platform STATIC ${ALL_SRC_ASM} ${ALL_SRC_C})
-embedded_set_target_compile_defines(TARGET tfm_platform LANGUAGE C DEFINES __thumb2__ TFM_LVL=${TFM_LVL})
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_platform LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
-endif()
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0079 NEW)
-#Set common compiler and linker flags
-config_setting_shared_compiler_flags(tfm_platform)
-config_setting_shared_linker_flags(tfm_platform)
+add_library(tfm_partition_platform STATIC
+ platform_sp.c
+)
-embedded_project_end(tfm_platform)
+target_include_directories(tfm_partition_platform
+ PRIVATE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+)
+
+target_link_libraries(tfm_partition_platform
+ PRIVATE
+ platform_s
+ psa_interface
+ tfm_secure_api
+ tfm_arch
+ tfm_spm
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_platform_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_platform_secure_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_platform
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_PLATFORM
+)
diff --git a/secure_fw/partitions/protected_storage/CMakeLists.inc b/secure_fw/partitions/protected_storage/CMakeLists.inc
deleted file mode 100644
index 1462877..0000000
--- a/secure_fw/partitions/protected_storage/CMakeLists.inc
+++ /dev/null
@@ -1,141 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "protected_storage" module.
-#This file assumes it will be included from a project specific cmakefile, and
-#will not create a library or executable.
-#Inputs:
-# TFM_ROOT_DIR - root directory of the TF-M repository.
-#Outputs:
-# Will modify include directories to make the source compile.
-# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
-# Include directories will be modified by using the include_directories() commands as needed.
-
-#Get the current directory where this file is located.
-set(PROTECTED_STORAGE_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-#Check input variables
-if (NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-if (NOT DEFINED PS_ENCRYPTION)
- message(FATAL_ERROR "Incomplete build configuration: PS_ENCRYPTION is undefined. ")
-endif()
-
-if (NOT DEFINED PS_ROLLBACK_PROTECTION)
- message(FATAL_ERROR "Incomplete build configuration: PS_ROLLBACK_PROTECTION is undefined.")
-endif()
-
-if (NOT DEFINED PS_CREATE_FLASH_LAYOUT)
- message(FATAL_ERROR "Incomplete build configuration: PS_CREATE_FLASH_LAYOUT is undefined. ")
-endif()
-
-if (NOT DEFINED PS_VALIDATE_METADATA_FROM_FLASH)
- message(FATAL_ERROR "Incomplete build configuration: PS_VALIDATE_METADATA_FROM_FLASH is undefined. ")
-endif()
-
-if (NOT DEFINED PS_RAM_FS)
- message(FATAL_ERROR "Incomplete build configuration: PS_RAM_FS is undefined. ")
-endif()
-
-if (NOT DEFINED PS_TEST_NV_COUNTERS)
- message(FATAL_ERROR "Incomplete build configuration: PS_TEST_NV_COUNTERS is undefined.")
-endif()
-
-set (PROTECTED_STORAGE_C_SRC
- "${PROTECTED_STORAGE_DIR}/tfm_ps_secure_api.c"
- "${PROTECTED_STORAGE_DIR}/tfm_ps_req_mngr.c"
- "${PROTECTED_STORAGE_DIR}/tfm_protected_storage.c"
- "${PROTECTED_STORAGE_DIR}/ps_object_system.c"
- "${PROTECTED_STORAGE_DIR}/ps_object_table.c"
- "${PROTECTED_STORAGE_DIR}/ps_utils.c"
-)
-
-if (PS_ENCRYPTION)
- list(APPEND PROTECTED_STORAGE_C_SRC
- "${PROTECTED_STORAGE_DIR}/crypto/ps_crypto_interface.c"
- "${PROTECTED_STORAGE_DIR}/ps_encrypted_object.c"
- )
- set_property(SOURCE ${PROTECTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_ENCRYPTION)
-
- if (PS_ROLLBACK_PROTECTION)
- # Only build the NV counters implementation if the PS_TEST_NV_COUNTERS
- # flag is off. When this flag is on, a virtual implementation of the PS
- # NV counters interface is used instead. Full documentation for this
- # flag can be found in the PS Integration Guide.
- if (NOT PS_TEST_NV_COUNTERS)
- list(APPEND PROTECTED_STORAGE_C_SRC
- "${PROTECTED_STORAGE_DIR}/nv_counters/ps_nv_counters.c")
- endif()
- set_property(SOURCE ${PROTECTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_ROLLBACK_PROTECTION)
- endif()
-endif()
-
-if (PS_VALIDATE_METADATA_FROM_FLASH)
- set_property(SOURCE ${PROTECTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_VALIDATE_METADATA_FROM_FLASH)
-endif()
-
-if (PS_CREATE_FLASH_LAYOUT)
- set_property(SOURCE ${PROTECTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_CREATE_FLASH_LAYOUT)
-endif()
-
-if (PS_RAM_FS)
- set_property(SOURCE ${PROTECTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_RAM_FS)
-endif()
-
-if (DEFINED PS_CRYPTO_AEAD_ALG)
- set_property(SOURCE ${PROTECTED_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS PS_CRYPTO_AEAD_ALG=${PS_CRYPTO_AEAD_ALG})
-endif()
-
-#Append all our source files to global lists.
-list(APPEND ALL_SRC_C ${PROTECTED_STORAGE_C_SRC})
-unset(PROTECTED_STORAGE_C_SRC)
-
-#Inform the user about PS service features selected based on the PS service cmake flags
-message("The PS service compile configuration is as follows:")
-message("- PS_ENCRYPTION: " ${PS_ENCRYPTION})
-if (PS_ENCRYPTION)
- message("- PS_ROLLBACK_PROTECTION: " ${PS_ROLLBACK_PROTECTION})
-else()
- message("- PS_ROLLBACK_PROTECTION: N/A")
-endif()
-message("- PS_VALIDATE_METADATA_FROM_FLASH: " ${PS_VALIDATE_METADATA_FROM_FLASH})
-message("- PS_CREATE_FLASH_LAYOUT: " ${PS_CREATE_FLASH_LAYOUT})
-message("- PS_RAM_FS: " ${PS_RAM_FS})
-message("- PS_TEST_NV_COUNTERS: " ${PS_TEST_NV_COUNTERS})
-if (DEFINED PS_CRYPTO_AEAD_ALG)
- message("- PS_CRYPTO_AEAD_ALG: " ${PS_CRYPTO_AEAD_ALG})
-endif()
-
-#Setting include directories
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/common ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/ext/driver ABSOLUTE)
-set(BUILD_CMSIS_CORE Off)
-set(BUILD_RETARGET Off)
-set(BUILD_NATIVE_DRIVERS Off)
-set(BUILD_STARTUP Off)
-set(BUILD_TARGET_CFG Off)
-set(BUILD_TARGET_HARDWARE_KEYS Off)
-set(BUILD_TARGET_NV_COUNTERS Off)
-set(BUILD_CMSIS_DRIVERS Off)
-set(BUILD_TIME Off)
-set(BUILD_UART_STDOUT Off)
-set(BUILD_FLASH Off)
-set(BUILD_PLAT_TEST Off)
-if(NOT DEFINED PLATFORM_CMAKE_FILE)
- message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
-elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
- message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
-else()
- include(${PLATFORM_CMAKE_FILE})
-endif()
diff --git a/secure_fw/partitions/protected_storage/CMakeLists.txt b/secure_fw/partitions/protected_storage/CMakeLists.txt
index c376ce1..5d5cebc 100644
--- a/secure_fw/partitions/protected_storage/CMakeLists.txt
+++ b/secure_fw/partitions/protected_storage/CMakeLists.txt
@@ -1,44 +1,67 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
-
-# Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
-
-###Some project global settings
-set (PROTECTED_STORAGE_DIR "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(TFM_ROOT_DIR "${PROTECTED_STORAGE_DIR}/../../.." ABSOLUTE)
-
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_storage LANGUAGES ASM C)
-embedded_project_fixup()
-
-###Get the definition of what files we need to build
-include(CMakeLists.inc)
-
-if (NOT DEFINED TFM_LVL)
- message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ")
+if (NOT TFM_PARTITION_PROTECTED_STORAGE)
+ return()
endif()
-# Specify what we build (for the protected storage service, build as a static library)
-add_library(tfm_storage STATIC ${ALL_SRC_ASM} ${ALL_SRC_C})
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0079 NEW)
-#Set common compiler and linker flags
-if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_storage LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
-endif()
-config_setting_shared_compiler_flags(tfm_storage)
-config_setting_shared_linker_flags(tfm_storage)
+add_library(tfm_partition_ps STATIC)
-embedded_set_target_compile_defines(TARGET tfm_storage LANGUAGE C DEFINES __thumb2__ TFM_LVL=${TFM_LVL})
+target_include_directories(tfm_partition_ps
+ INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+)
-embedded_project_end(tfm_storage)
+target_sources(tfm_partition_ps
+ PRIVATE
+ tfm_ps_req_mngr.c
+ tfm_protected_storage.c
+ ps_object_system.c
+ ps_object_table.c
+ ps_utils.c
+ $<$<BOOL:${PS_ENCRYPTION}>:crypto/ps_crypto_interface.c>
+ $<$<BOOL:${PS_ENCRYPTION}>:ps_encrypted_object.c>
+ $<$<NOT:$<BOOL:${PS_TEST_NV_COUNTERS}>>:nv_counters/ps_nv_counters.c>
+)
+
+target_link_libraries(tfm_partition_ps
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ secure_fw
+ platform_s
+ tfm_partition_its
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_ps_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_ps_secure_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_ps
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_PROTECTED_STORAGE
+)
diff --git a/secure_fw/partitions/tfm_service_list.inc b/secure_fw/partitions/tfm_service_list.inc
deleted file mode 100644
index d68be93..0000000
--- a/secure_fw/partitions/tfm_service_list.inc
+++ /dev/null
@@ -1,848 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-/*********** WARNING: This is an auto-generated file. Do not edit! ***********/
-
-#ifndef __TFM_SERVICE_LIST_INC__
-#define __TFM_SERVICE_LIST_INC__
-
-#include "secure_fw/partitions/protected_storage/psa_manifest/tfm_protected_storage.h"
-#include "secure_fw/partitions/internal_trusted_storage/psa_manifest/tfm_internal_trusted_storage.h"
-#include "secure_fw/partitions/audit_logging/psa_manifest/tfm_audit_logging.h"
-#include "secure_fw/partitions/crypto/psa_manifest/tfm_crypto.h"
-#include "secure_fw/partitions/platform/psa_manifest/tfm_platform.h"
-#include "secure_fw/partitions/initial_attestation/psa_manifest/tfm_initial_attestation.h"
-#include "../tf-m-tests/test/test_services/tfm_core_test/psa_manifest/tfm_test_core.h"
-#include "../tf-m-tests/test/test_services/tfm_core_test_2/psa_manifest/tfm_test_core_2.h"
-#include "../tf-m-tests/test/test_services/tfm_secure_client_service/psa_manifest/tfm_test_client_service.h"
-#include "../tf-m-tests/test/test_services/tfm_ipc_service/psa_manifest/tfm_ipc_service_partition.h"
-#include "../tf-m-tests/test/test_services/tfm_ipc_client/psa_manifest/tfm_ipc_client_partition.h"
-#include "../tf-m-tests/test/test_services/tfm_irq_test_service_1/psa_manifest/tfm_irq_test_service_1.h"
-#include "../tf-m-tests/test/test_services/tfm_ps_test_service/psa_manifest/tfm_ps_test_service.h"
-#include "../tf-m-tests/test/test_services/tfm_secure_client_2/psa_manifest/tfm_secure_client_2.h"
-
-const struct tfm_spm_service_db_t service_db[] =
-{
-#ifdef TFM_PARTITION_PROTECTED_STORAGE
- /******** TFM_SP_PS ********/
- {
- .name = "TFM_PS_SET",
- .partition_id = TFM_SP_PS,
- .signal = TFM_PS_SET_SIGNAL,
- .sid = 0x00000060,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_PS_GET",
- .partition_id = TFM_SP_PS,
- .signal = TFM_PS_GET_SIGNAL,
- .sid = 0x00000061,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_PS_GET_INFO",
- .partition_id = TFM_SP_PS,
- .signal = TFM_PS_GET_INFO_SIGNAL,
- .sid = 0x00000062,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_PS_REMOVE",
- .partition_id = TFM_SP_PS,
- .signal = TFM_PS_REMOVE_SIGNAL,
- .sid = 0x00000063,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_PS_GET_SUPPORT",
- .partition_id = TFM_SP_PS,
- .signal = TFM_PS_GET_SUPPORT_SIGNAL,
- .sid = 0x00000064,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_PROTECTED_STORAGE */
-
-#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
- /******** TFM_SP_ITS ********/
- {
- .name = "TFM_ITS_SET",
- .partition_id = TFM_SP_ITS,
- .signal = TFM_ITS_SET_SIGNAL,
- .sid = 0x00000070,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_ITS_GET",
- .partition_id = TFM_SP_ITS,
- .signal = TFM_ITS_GET_SIGNAL,
- .sid = 0x00000071,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_ITS_GET_INFO",
- .partition_id = TFM_SP_ITS,
- .signal = TFM_ITS_GET_INFO_SIGNAL,
- .sid = 0x00000072,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_ITS_REMOVE",
- .partition_id = TFM_SP_ITS,
- .signal = TFM_ITS_REMOVE_SIGNAL,
- .sid = 0x00000073,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
-
-#ifdef TFM_PARTITION_CRYPTO
- /******** TFM_SP_CRYPTO ********/
- {
- .name = "TFM_CRYPTO",
- .partition_id = TFM_SP_CRYPTO,
- .signal = TFM_CRYPTO_SIGNAL,
- .sid = 0x00000080,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_CRYPTO */
-
-#ifdef TFM_PARTITION_PLATFORM
- /******** TFM_SP_PLATFORM ********/
- {
- .name = "TFM_SP_PLATFORM_SYSTEM_RESET",
- .partition_id = TFM_SP_PLATFORM,
- .signal = TFM_SP_PLATFORM_SYSTEM_RESET_SIGNAL,
- .sid = 0x00000040,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_SP_PLATFORM_IOCTL",
- .partition_id = TFM_SP_PLATFORM,
- .signal = TFM_SP_PLATFORM_IOCTL_SIGNAL,
- .sid = 0x00000041,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_SP_PLATFORM_NV_COUNTER",
- .partition_id = TFM_SP_PLATFORM,
- .signal = TFM_SP_PLATFORM_NV_COUNTER_SIGNAL,
- .sid = 0x00000042,
- .non_secure_client = false,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_PLATFORM */
-
-#ifdef TFM_PARTITION_INITIAL_ATTESTATION
- /******** TFM_SP_INITIAL_ATTESTATION ********/
- {
- .name = "TFM_ATTEST_GET_TOKEN",
- .partition_id = TFM_SP_INITIAL_ATTESTATION,
- .signal = TFM_ATTEST_GET_TOKEN_SIGNAL,
- .sid = 0x00000020,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_ATTEST_GET_TOKEN_SIZE",
- .partition_id = TFM_SP_INITIAL_ATTESTATION,
- .signal = TFM_ATTEST_GET_TOKEN_SIZE_SIGNAL,
- .sid = 0x00000021,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "TFM_ATTEST_GET_PUBLIC_KEY",
- .partition_id = TFM_SP_INITIAL_ATTESTATION,
- .signal = TFM_ATTEST_GET_PUBLIC_KEY_SIGNAL,
- .sid = 0x00000022,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
-
-#ifdef TFM_PARTITION_TEST_CORE
- /******** TFM_SP_CORE_TEST ********/
- {
- .name = "SPM_CORE_TEST_INIT_SUCCESS",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_INIT_SUCCESS_SIGNAL,
- .sid = 0x0000F020,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_DIRECT_RECURSION",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL,
- .sid = 0x0000F021,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_SS_TO_SS",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_SS_TO_SS_SIGNAL,
- .sid = 0x0000F024,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_SS_TO_SS_BUFFER",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL,
- .sid = 0x0000F025,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_OUTVEC_WRITE",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL,
- .sid = 0x0000F026,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_PERIPHERAL_ACCESS",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_PERIPHERAL_ACCESS_SIGNAL,
- .sid = 0x0000F027,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_GET_CALLER_CLIENT_ID",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL,
- .sid = 0x0000F028,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_SPM_REQUEST",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_SPM_REQUEST_SIGNAL,
- .sid = 0x0000F029,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_BLOCK",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_BLOCK_SIGNAL,
- .sid = 0x0000F02A,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_NS_THREAD",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_NS_THREAD_SIGNAL,
- .sid = 0x0000F02B,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#ifdef TFM_PARTITION_TEST_CORE
- /******** TFM_SP_CORE_TEST_2 ********/
- {
- .name = "SPM_CORE_TEST_2_SLAVE_SERVICE",
- .partition_id = TFM_SP_CORE_TEST_2,
- .signal = SPM_CORE_TEST_2_SLAVE_SERVICE_SIGNAL,
- .sid = 0x0000F040,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID",
- .partition_id = TFM_SP_CORE_TEST_2,
- .signal = SPM_CORE_TEST_2_CHECK_CALLER_CLIENT_ID_SIGNAL,
- .sid = 0x0000F041,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE",
- .partition_id = TFM_SP_CORE_TEST_2,
- .signal = SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SIGNAL,
- .sid = 0x0000F042,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_2_INVERT",
- .partition_id = TFM_SP_CORE_TEST_2,
- .signal = SPM_CORE_TEST_2_INVERT_SIGNAL,
- .sid = 0x0000F043,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_2_PREPARE_TEST_SCENARIO",
- .partition_id = TFM_SP_CORE_TEST_2,
- .signal = SPM_CORE_TEST_2_PREPARE_TEST_SCENARIO_SIGNAL,
- .sid = 0x0000F044,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_2_EXECUTE_TEST_SCENARIO",
- .partition_id = TFM_SP_CORE_TEST_2,
- .signal = SPM_CORE_TEST_2_EXECUTE_TEST_SCENARIO_SIGNAL,
- .sid = 0x0000F045,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
- /******** TFM_SP_SECURE_TEST_PARTITION ********/
- {
- .name = "TFM_SECURE_CLIENT_SFN_RUN_TESTS",
- .partition_id = TFM_SP_SECURE_TEST_PARTITION,
- .signal = TFM_SECURE_CLIENT_SFN_RUN_TESTS_SIGNAL,
- .sid = 0x0000F000,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-#ifdef TFM_PARTITION_TEST_CORE_IPC
- /******** TFM_SP_IPC_SERVICE_TEST ********/
- {
- .name = "IPC_SERVICE_TEST_BASIC",
- .partition_id = TFM_SP_IPC_SERVICE_TEST,
- .signal = IPC_SERVICE_TEST_BASIC_SIGNAL,
- .sid = 0x0000F080,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM",
- .partition_id = TFM_SP_IPC_SERVICE_TEST,
- .signal = IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM_SIGNAL,
- .sid = 0x0000F081,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM",
- .partition_id = TFM_SP_IPC_SERVICE_TEST,
- .signal = IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL,
- .sid = 0x0000F082,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM",
- .partition_id = TFM_SP_IPC_SERVICE_TEST,
- .signal = IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM_SIGNAL,
- .sid = 0x0000F083,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_SERVICE_TEST_CLIENT_PROGRAMMER_ERROR",
- .partition_id = TFM_SP_IPC_SERVICE_TEST,
- .signal = IPC_SERVICE_TEST_CLIENT_PROGRAMMER_ERROR_SIGNAL,
- .sid = 0x0000F084,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_CORE_IPC */
-
-#ifdef TFM_PARTITION_TEST_CORE_IPC
- /******** TFM_SP_IPC_CLIENT_TEST ********/
- {
- .name = "IPC_CLIENT_TEST_BASIC",
- .partition_id = TFM_SP_IPC_CLIENT_TEST,
- .signal = IPC_CLIENT_TEST_BASIC_SIGNAL,
- .sid = 0x0000F060,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM",
- .partition_id = TFM_SP_IPC_CLIENT_TEST,
- .signal = IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM_SIGNAL,
- .sid = 0x0000F061,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_CLIENT_TEST_PSA_ACCESS_APP_READ_ONLY_MEM",
- .partition_id = TFM_SP_IPC_CLIENT_TEST,
- .signal = IPC_CLIENT_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SIGNAL,
- .sid = 0x0000F062,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_CLIENT_TEST_APP_ACCESS_PSA_MEM",
- .partition_id = TFM_SP_IPC_CLIENT_TEST,
- .signal = IPC_CLIENT_TEST_APP_ACCESS_PSA_MEM_SIGNAL,
- .sid = 0x0000F063,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "IPC_CLIENT_TEST_MEM_CHECK",
- .partition_id = TFM_SP_IPC_CLIENT_TEST,
- .signal = IPC_CLIENT_TEST_MEM_CHECK_SIGNAL,
- .sid = 0x0000F064,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_CORE_IPC */
-
-#ifdef TFM_ENABLE_IRQ_TEST
- /******** TFM_IRQ_TEST_1 ********/
- {
- .name = "SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO",
- .partition_id = TFM_IRQ_TEST_1,
- .signal = SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO_SIGNAL,
- .sid = 0x0000F0A0,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_IRQ_TEST_1_EXECUTE_TEST_SCENARIO",
- .partition_id = TFM_IRQ_TEST_1,
- .signal = SPM_CORE_IRQ_TEST_1_EXECUTE_TEST_SCENARIO_SIGNAL,
- .sid = 0x0000F0A1,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_ENABLE_IRQ_TEST */
-
-#ifdef TFM_PARTITION_TEST_PS
- /******** TFM_SP_PS_TEST ********/
- {
- .name = "TFM_PS_TEST_PREPARE",
- .partition_id = TFM_SP_PS_TEST,
- .signal = TFM_PS_TEST_PREPARE_SIGNAL,
- .sid = 0x0000F0C0,
- .non_secure_client = false,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_PS */
-
-#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
- /******** TFM_SP_SECURE_CLIENT_2 ********/
- {
- .name = "TFM_SECURE_CLIENT_2",
- .partition_id = TFM_SP_SECURE_CLIENT_2,
- .signal = TFM_SECURE_CLIENT_2_SIGNAL,
- .sid = 0x0000F0E0,
- .non_secure_client = false,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-};
-
-/**************************************************************************/
-/** The service list */
-/**************************************************************************/
-struct tfm_spm_service_t service[] =
-{
-#ifdef TFM_PARTITION_PROTECTED_STORAGE
- /******** TFM_SP_PS ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_PROTECTED_STORAGE */
-
-#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
- /******** TFM_SP_ITS ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
-
-#ifdef TFM_PARTITION_CRYPTO
- /******** TFM_SP_CRYPTO ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_CRYPTO */
-
-#ifdef TFM_PARTITION_PLATFORM
- /******** TFM_SP_PLATFORM ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_PLATFORM */
-
-#ifdef TFM_PARTITION_INITIAL_ATTESTATION
- /******** TFM_SP_INITIAL_ATTESTATION ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
-
-#ifdef TFM_PARTITION_TEST_CORE
- /******** TFM_SP_CORE_TEST ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#ifdef TFM_PARTITION_TEST_CORE
- /******** TFM_SP_CORE_TEST_2 ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
- /******** TFM_SP_SECURE_TEST_PARTITION ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-#ifdef TFM_PARTITION_TEST_CORE_IPC
- /******** TFM_SP_IPC_SERVICE_TEST ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_CORE_IPC */
-
-#ifdef TFM_PARTITION_TEST_CORE_IPC
- /******** TFM_SP_IPC_CLIENT_TEST ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_CORE_IPC */
-
-#ifdef TFM_ENABLE_IRQ_TEST
- /******** TFM_IRQ_TEST_1 ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_ENABLE_IRQ_TEST */
-
-#ifdef TFM_PARTITION_TEST_PS
- /******** TFM_SP_PS_TEST ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_PS */
-
-#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
- /******** TFM_SP_SECURE_CLIENT_2 ********/
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .list = {0},
- },
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-};
-
-#endif /* __TFM_SERVICE_LIST_INC__ */