Interface: Clean up the tfm_api.h header file
This file does not look like an "interface" file as it contains
some SPM internal usage definitions.
This patch:
- Moves the SPM internal definitions to spm.h.
- Use the error codes in `internal_status_code.h` instead of the
ones in tfm_api.h.
- Removes error codes in tfm_api.h.
- Renames tfm_api.h to tfm_veneers.h to reflect what it does.
- Corresponding changes in source files.
Change-Id: Iba5d1aae6837c9f0bf52c9a0c456023d19a735ea
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 064fc5b..43f8cb1 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -33,7 +33,7 @@
install(FILES ${CMAKE_BINARY_DIR}/generated/interface/include/psa_manifest/sid.h
DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa_manifest)
-install(FILES ${INTERFACE_INC_DIR}/tfm_api.h
+install(FILES ${INTERFACE_INC_DIR}/tfm_veneers.h
${INTERFACE_INC_DIR}/tfm_ns_interface.h
DESTINATION ${INSTALL_INTERFACE_INC_DIR})
diff --git a/docs/design_docs/dual-cpu/tfm_multi_core_access_check.rst b/docs/design_docs/dual-cpu/tfm_multi_core_access_check.rst
index 4ef0913..2b31d36 100644
--- a/docs/design_docs/dual-cpu/tfm_multi_core_access_check.rst
+++ b/docs/design_docs/dual-cpu/tfm_multi_core_access_check.rst
@@ -93,7 +93,7 @@
:linenos:
:emphasize-lines: 19,36,46
- enum tfm_status_e tfm_has_access_to_region(const void *p, size_t s, uint8_t flags)
+ int32_t tfm_has_access_to_region(const void *p, size_t s, uint8_t flags)
{
struct security_attr_info_t security_attr;
struct mem_attr_info_t mem_attr;
diff --git a/interface/include/tfm_ns_interface.h b/interface/include/tfm_ns_interface.h
index 6b55fc3..32a04c5 100644
--- a/interface/include/tfm_ns_interface.h
+++ b/interface/include/tfm_ns_interface.h
@@ -14,7 +14,7 @@
#endif
#include <stdint.h>
-#include "tfm_api.h"
+#include "tfm_veneers.h"
typedef int32_t (*veneer_fn) (uint32_t arg0, uint32_t arg1,
uint32_t arg2, uint32_t arg3);
diff --git a/interface/include/tfm_platform_api.h b/interface/include/tfm_platform_api.h
index f7f3972..e925503 100644
--- a/interface/include/tfm_platform_api.h
+++ b/interface/include/tfm_platform_api.h
@@ -11,7 +11,7 @@
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
-#include "tfm_api.h"
+#include "psa/client.h"
#ifdef __cplusplus
extern "C" {
diff --git a/interface/include/tfm_api.h b/interface/include/tfm_veneers.h
similarity index 60%
rename from interface/include/tfm_api.h
rename to interface/include/tfm_veneers.h
index 7e79746..24c4036 100644
--- a/interface/include/tfm_api.h
+++ b/interface/include/tfm_veneers.h
@@ -5,59 +5,15 @@
*
*/
-#ifndef __TFM_API_H__
-#define __TFM_API_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __TFM_VENEERS_H__
+#define __TFM_VENEERS_H__
#include <stdint.h>
#include "psa/client.h"
-#define TFM_INVALID_CLIENT_ID 0
-
-/**
- * \brief Checks if the provided client ID is a secure client ID.
- *
- * \param[in] client_id Client ID to check.
- *
- * \retval 1 Client ID is secure.
- * \retval 0 Client ID is non-secure.
- */
-#define TFM_CLIENT_ID_IS_S(client_id) ((client_id)>0)
-
-/**
- * \brief Checks if the provided client ID is a non-secure client ID.
- *
- * \param[in] client_id Client ID to check.
- *
- * \retval 1 Client ID is non-secure.
- * \retval 0 Client ID is secure.
- */
-#define TFM_CLIENT_ID_IS_NS(client_id) ((client_id)<0)
-
-/* The mask used for timeout values */
-#define PSA_TIMEOUT_MASK PSA_BLOCK
-
-/* FixMe: sort out DEBUG compile option and limit return value options
- * on external interfaces */
-enum tfm_status_e
-{
- TFM_SUCCESS = 0,
- TFM_PARTITION_BUSY,
- TFM_ERROR_SECURE_DOMAIN_LOCKED,
- TFM_ERROR_INVALID_PARAMETER,
- TFM_ERROR_PARTITION_NON_REENTRANT,
- TFM_ERROR_NS_THREAD_MODE_CALL,
- TFM_ERROR_NOT_INITIALIZED,
- TFM_ERROR_NO_ACTIVE_PARTITION,
- TFM_ERROR_INVALID_EXC_MODE,
- TFM_ERROR_NOT_IN_RANGE,
- TFM_SECURE_LOCK_FAILED,
- TFM_SECURE_UNLOCK_FAILED,
- TFM_ERROR_GENERIC = 0x1F,
-};
+#ifdef __cplusplus
+extern "C" {
+#endif
/********************* Secure function declarations ***************************/
@@ -116,4 +72,4 @@
}
#endif
-#endif /* __TFM_API_H__ */
+#endif /* __TFM_VENEERS_H__ */
diff --git a/interface/src/multi_core/tfm_multi_core_psa_ns_api.c b/interface/src/multi_core/tfm_multi_core_psa_ns_api.c
index 2d25d09..d02e3a4 100644
--- a/interface/src/multi_core/tfm_multi_core_psa_ns_api.c
+++ b/interface/src/multi_core/tfm_multi_core_psa_ns_api.c
@@ -12,7 +12,6 @@
#include "psa/client.h"
#include "psa/error.h"
-#include "tfm_api.h"
#include "tfm_ns_mailbox.h"
/*
diff --git a/interface/src/tfm_fwu_api.c b/interface/src/tfm_fwu_api.c
index f7565bf..80c4778 100644
--- a/interface/src/tfm_fwu_api.c
+++ b/interface/src/tfm_fwu_api.c
@@ -8,7 +8,6 @@
#include "psa/client.h"
#include "psa/update.h"
#include "psa_manifest/sid.h"
-#include "tfm_api.h"
psa_status_t psa_fwu_start(psa_fwu_component_t component,
const void *manifest,
diff --git a/interface/src/tfm_its_api.c b/interface/src/tfm_its_api.c
index a52197b..adea920 100644
--- a/interface/src/tfm_its_api.c
+++ b/interface/src/tfm_its_api.c
@@ -8,7 +8,6 @@
#include "psa/client.h"
#include "psa/internal_trusted_storage.h"
#include "psa_manifest/sid.h"
-#include "tfm_api.h"
#include "tfm_its_defs.h"
psa_status_t psa_its_set(psa_storage_uid_t uid,
diff --git a/interface/src/tfm_platform_api.c b/interface/src/tfm_platform_api.c
index d709607..4fc564b 100644
--- a/interface/src/tfm_platform_api.c
+++ b/interface/src/tfm_platform_api.c
@@ -7,6 +7,7 @@
#include <stdbool.h>
#include "tfm_platform_api.h"
+#include "psa/client.h"
#include "psa_manifest/sid.h"
enum tfm_platform_err_t tfm_platform_system_reset(void)
diff --git a/interface/src/tfm_psa_ns_api.c b/interface/src/tfm_psa_ns_api.c
index 819c72b..1f9fbe4 100644
--- a/interface/src/tfm_psa_ns_api.c
+++ b/interface/src/tfm_psa_ns_api.c
@@ -7,7 +7,6 @@
#include "psa/client.h"
#include "tfm_ns_interface.h"
-#include "tfm_api.h"
#include "tfm_psa_call_pack.h"
/**** API functions ****/
diff --git a/lib/ext/tf-m-tests/repo_config_default.cmake b/lib/ext/tf-m-tests/repo_config_default.cmake
index 2e45626..943cbff 100644
--- a/lib/ext/tf-m-tests/repo_config_default.cmake
+++ b/lib/ext/tf-m-tests/repo_config_default.cmake
@@ -10,5 +10,5 @@
# Default configs of tf-m-tests repo
set(TFM_TEST_REPO_PATH "DOWNLOAD" CACHE PATH "Path to TFM-TEST repo (or DOWNLOAD to fetch automatically")
-set(TFM_TEST_REPO_VERSION "03d6a93" CACHE STRING "The version of tf-m-tests to use")
+set(TFM_TEST_REPO_VERSION "03864fc" CACHE STRING "The version of tf-m-tests to use")
set(CMSIS_5_PATH "DOWNLOAD" CACHE PATH "Path to CMSIS_5 (or DOWNLOAD to fetch automatically")
diff --git a/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c b/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c
index 7c8301b..59788bc 100644
--- a/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c
@@ -8,7 +8,7 @@
*
*/
-#include "tfm_api.h"
+#include "internal_status_code.h"
#include "tfm_hal_defs.h"
#include "tfm_multi_core.h"
#include "tfm_hal_isolation.h"
@@ -99,7 +99,7 @@
size_t size,
uint32_t access_type)
{
- enum tfm_status_e status;
+ int32_t status;
uint32_t flags = 0;
if ((access_type & TFM_HAL_ACCESS_READWRITE) == TFM_HAL_ACCESS_READWRITE) {
@@ -119,7 +119,7 @@
}
status = tfm_has_access_to_region((const void *)base, size, flags);
- if (status != TFM_SUCCESS) {
+ if (status != SPM_SUCCESS) {
return TFM_HAL_ERROR_MEM_FAULT;
}
diff --git a/platform/ext/target/arm/musca_b1/services/include/tfm_ioctl_api.h b/platform/ext/target/arm/musca_b1/services/include/tfm_ioctl_api.h
index b391bf6..b3bc907 100644
--- a/platform/ext/target/arm/musca_b1/services/include/tfm_ioctl_api.h
+++ b/platform/ext/target/arm/musca_b1/services/include/tfm_ioctl_api.h
@@ -11,7 +11,6 @@
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
-#include "tfm_api.h"
#include "tfm_platform_api.h"
#ifdef __cplusplus
diff --git a/platform/ext/target/arm/musca_s1/services/include/tfm_ioctl_api.h b/platform/ext/target/arm/musca_s1/services/include/tfm_ioctl_api.h
index 345f210..49feb42 100644
--- a/platform/ext/target/arm/musca_s1/services/include/tfm_ioctl_api.h
+++ b/platform/ext/target/arm/musca_s1/services/include/tfm_ioctl_api.h
@@ -11,7 +11,6 @@
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
-#include "tfm_api.h"
#include "tfm_platform_api.h"
#ifdef __cplusplus
diff --git a/platform/ext/target/arm/rss/common/config.cmake b/platform/ext/target/arm/rss/common/config.cmake
index 423974b..87ec9fe 100644
--- a/platform/ext/target/arm/rss/common/config.cmake
+++ b/platform/ext/target/arm/rss/common/config.cmake
@@ -55,7 +55,7 @@
set(TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH ${CMAKE_CURRENT_LIST_DIR}/mbedtls_extra_config.h CACHE PATH "Config to append to standard Mbed Crypto config, used by platforms to cnfigure feature support")
set(TFM_EXTRAS_REPO_PATH "DOWNLOAD" CACHE PATH "Path to tf-m-extras repo (or DOWNLOAD to fetch automatically")
-set(TFM_EXTRAS_REPO_VERSION "f683acf" CACHE STRING "The version of tf-m-extras to use")
+set(TFM_EXTRAS_REPO_VERSION "3d407cf" CACHE STRING "The version of tf-m-extras to use")
set(TFM_EXTRAS_REPO_EXTRA_PARTITIONS "measured_boot;delegated_attestation" CACHE STRING "List of extra secure partition directory name(s)")
# Below TFM_EXTRAS_REPO_EXTRA_MANIFEST_LIST path is relative to tf-m-extras repo
set(TFM_EXTRAS_REPO_EXTRA_MANIFEST_LIST "partitions/measured_boot/measured_boot_manifest_list.yaml;partitions/delegated_attestation/delegated_attestation_manifest_list.yaml" CACHE STRING "List of extra secure partition manifests")
diff --git a/platform/ext/target/cypress/psoc64/driver_smpu.c b/platform/ext/target/cypress/psoc64/driver_smpu.c
index 0c11d22..e640046 100644
--- a/platform/ext/target/cypress/psoc64/driver_smpu.c
+++ b/platform/ext/target/cypress/psoc64/driver_smpu.c
@@ -20,13 +20,13 @@
#include "driver_smpu.h"
+#include "internal_status_code.h"
#include "flash_layout.h"
#include "nv_counters.h"
#include "pc_config.h"
#include "region_defs.h"
#include "RTE_Device.h"
#include "smpu_config.h"
-#include "tfm_api.h"
#include "tfm_spm_log.h"
#include "tfm_hal_its.h"
#ifdef TFM_PARTITION_PROTECTED_STORAGE
@@ -408,7 +408,7 @@
}
/* And the address range */
- if (check_address_range(p, s, address, size) == TFM_SUCCESS) {
+ if (check_address_range(p, s, address, size) == SPM_SUCCESS) {
if (pc_mismatch) {
/* Access denied - PC doesn't match */
p_attr->is_mpu_enabled = true;
diff --git a/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c b/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c
index a484b6a..64b07f8 100644
--- a/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c
+++ b/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c
@@ -11,8 +11,8 @@
#include "array.h"
#include "cy_device.h"
#include "mmio_defs.h"
+#include "internal_status_code.h"
#include "target_cfg.h"
-#include "tfm_api.h"
#include "tfm_hal_defs.h"
#include "tfm_multi_core.h"
#include "tfm_plat_defs.h"
@@ -51,7 +51,7 @@
size_t size,
uint32_t access_type)
{
- enum tfm_status_e status;
+ int32_t status;
uint32_t flags = 0;
if ((access_type & TFM_HAL_ACCESS_READWRITE) == TFM_HAL_ACCESS_READWRITE) {
@@ -71,7 +71,7 @@
}
status = tfm_has_access_to_region((const void *)base, size, flags);
- if (status != TFM_SUCCESS) {
+ if (status != SPM_SUCCESS) {
return TFM_HAL_ERROR_MEM_FAULT;
}
diff --git a/platform/ext/target/lairdconnectivity/bl5340_dvk_cpuapp/services/include/tfm_ioctl_api.h b/platform/ext/target/lairdconnectivity/bl5340_dvk_cpuapp/services/include/tfm_ioctl_api.h
index 4034849..e62c04a 100644
--- a/platform/ext/target/lairdconnectivity/bl5340_dvk_cpuapp/services/include/tfm_ioctl_api.h
+++ b/platform/ext/target/lairdconnectivity/bl5340_dvk_cpuapp/services/include/tfm_ioctl_api.h
@@ -20,7 +20,6 @@
#include <limits.h>
#include <stdint.h>
-#include <tfm_api.h>
#include <tfm_platform_api.h>
/* Include core IOCTL services */
diff --git a/platform/ext/target/nordic_nrf/common/core/services/include/tfm_ioctl_core_api.h b/platform/ext/target/nordic_nrf/common/core/services/include/tfm_ioctl_core_api.h
index 3e9bc31..f24d72a 100644
--- a/platform/ext/target/nordic_nrf/common/core/services/include/tfm_ioctl_core_api.h
+++ b/platform/ext/target/nordic_nrf/common/core/services/include/tfm_ioctl_core_api.h
@@ -19,8 +19,6 @@
*/
#include <limits.h>
-#include <stdint.h>
-#include <tfm_api.h>
#include <tfm_platform_api.h>
#ifdef __cplusplus
diff --git a/platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/services/include/tfm_ioctl_api.h b/platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/services/include/tfm_ioctl_api.h
index 4034849..e62c04a 100644
--- a/platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/services/include/tfm_ioctl_api.h
+++ b/platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/services/include/tfm_ioctl_api.h
@@ -20,7 +20,6 @@
#include <limits.h>
#include <stdint.h>
-#include <tfm_api.h>
#include <tfm_platform_api.h>
/* Include core IOCTL services */
diff --git a/platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/services/include/tfm_ioctl_api.h b/platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/services/include/tfm_ioctl_api.h
index 4034849..e62c04a 100644
--- a/platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/services/include/tfm_ioctl_api.h
+++ b/platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/services/include/tfm_ioctl_api.h
@@ -20,7 +20,6 @@
#include <limits.h>
#include <stdint.h>
-#include <tfm_api.h>
#include <tfm_platform_api.h>
/* Include core IOCTL services */
diff --git a/platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/services/include/tfm_ioctl_api.h b/platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/services/include/tfm_ioctl_api.h
index ddf7b12..842e35b 100644
--- a/platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/services/include/tfm_ioctl_api.h
+++ b/platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/services/include/tfm_ioctl_api.h
@@ -20,7 +20,6 @@
#include <limits.h>
#include <stdint.h>
-#include <tfm_api.h>
#include <tfm_platform_api.h>
/* Include core IOCTL services */
diff --git a/secure_fw/partitions/crypto/tfm_crypto_api.h b/secure_fw/partitions/crypto/tfm_crypto_api.h
index 6ceb9bc..0edc713 100644
--- a/secure_fw/partitions/crypto/tfm_crypto_api.h
+++ b/secure_fw/partitions/crypto/tfm_crypto_api.h
@@ -15,7 +15,7 @@
#include <stdint.h>
#include "tfm_crypto_defs.h"
#include "tfm_crypto_key.h"
-#include "tfm_api.h"
+#include "psa/client.h"
/**
* \brief List of possible operation types supported by the TFM based
diff --git a/secure_fw/partitions/firmware_update/bootloader/mcuboot/tfm_mcuboot_fwu.c b/secure_fw/partitions/firmware_update/bootloader/mcuboot/tfm_mcuboot_fwu.c
index 427a35f..c726f09 100644
--- a/secure_fw/partitions/firmware_update/bootloader/mcuboot/tfm_mcuboot_fwu.c
+++ b/secure_fw/partitions/firmware_update/bootloader/mcuboot/tfm_mcuboot_fwu.c
@@ -6,13 +6,13 @@
*/
#include <string.h>
#include "psa/crypto.h"
+#include "psa/error.h"
#include "tfm_sp_log.h"
#include "bootutil_priv.h"
#include "bootutil/bootutil.h"
#include "bootutil/image.h"
#include "flash_map_backend/flash_map_backend.h"
#include "sysflash/sysflash.h"
-#include "tfm_api.h"
#include "tfm_bootloader_fwu_abstraction.h"
#include "tfm_boot_status.h"
#include "service_api.h"
@@ -49,7 +49,7 @@
static tfm_fwu_mcuboot_ctx_t mcuboot_ctx[FWU_COMPONENT_NUMBER];
static fwu_image_info_data_t __attribute__((aligned(4))) boot_shared_data;
-static int fwu_bootloader_get_shared_data(void)
+static psa_status_t fwu_bootloader_get_shared_data(void)
{
return tfm_core_get_boot_data(TLV_MAJOR_FWU,
(struct tfm_boot_data *)&boot_shared_data,
@@ -94,7 +94,7 @@
psa_status_t fwu_bootloader_init(void)
{
- if (fwu_bootloader_get_shared_data() != TFM_SUCCESS) {
+ if (fwu_bootloader_get_shared_data() != PSA_SUCCESS) {
return PSA_ERROR_STORAGE_FAILURE;
}
/* add Init of specific flash driver */
diff --git a/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c b/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c
index 34257e0..b37bdc0 100644
--- a/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c
+++ b/secure_fw/partitions/firmware_update/tfm_fwu_req_mngr.c
@@ -13,7 +13,6 @@
#include "tfm_bootloader_fwu_abstraction.h"
#include "psa/update.h"
#include "service_api.h"
-#include "tfm_api.h"
#include "psa/service.h"
#include "psa_manifest/tfm_firmware_update.h"
#include "compiler_ext_defs.h"
diff --git a/secure_fw/partitions/initial_attestation/tfm_attest.c b/secure_fw/partitions/initial_attestation/tfm_attest.c
index b7610b6..51eecde 100644
--- a/secure_fw/partitions/initial_attestation/tfm_attest.c
+++ b/secure_fw/partitions/initial_attestation/tfm_attest.c
@@ -5,9 +5,9 @@
*
*/
-#include "tfm_api.h"
#include "service_api.h"
#include "attest.h"
+#include "psa/error.h"
#include "psa/initial_attestation.h"
#include "tfm_boot_status.h"
@@ -31,7 +31,7 @@
int32_t tfm_res;
tfm_res = tfm_core_get_boot_data(major_type, boot_data, len);
- if (tfm_res != (int32_t)TFM_SUCCESS) {
+ if (tfm_res != (int32_t)PSA_SUCCESS) {
attest_res = PSA_ATTEST_ERR_INIT_FAILED;
}
diff --git a/secure_fw/partitions/lib/runtime/include/service_api.h b/secure_fw/partitions/lib/runtime/include/service_api.h
index 57f3e3d..3c89661 100644
--- a/secure_fw/partitions/lib/runtime/include/service_api.h
+++ b/secure_fw/partitions/lib/runtime/include/service_api.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include "tfm_boot_status.h"
+#include "psa/error.h"
/**
* \brief Retrieve secure partition related data from shared memory area, which
@@ -18,8 +19,8 @@
* \param[out] boot_data Pointer to boot data.
* \param[in] len The length of the boot data.
*/
-int32_t tfm_core_get_boot_data(uint8_t major_type,
- struct tfm_boot_data *boot_data,
- uint32_t len);
+psa_status_t tfm_core_get_boot_data(uint8_t major_type,
+ struct tfm_boot_data *boot_data,
+ uint32_t len);
#endif /* __SERVICE_API_H__ */
diff --git a/secure_fw/partitions/lib/runtime/service_api.c b/secure_fw/partitions/lib/runtime/service_api.c
index 3e9576d..65bb844 100644
--- a/secure_fw/partitions/lib/runtime/service_api.c
+++ b/secure_fw/partitions/lib/runtime/service_api.c
@@ -12,9 +12,9 @@
#include "utilities.h"
__attribute__((naked))
-int32_t tfm_core_get_boot_data(uint8_t major_type,
- struct tfm_boot_data *boot_status,
- uint32_t len)
+psa_status_t tfm_core_get_boot_data(uint8_t major_type,
+ struct tfm_boot_data *boot_status,
+ uint32_t len)
{
__ASM volatile(
"SVC "M2S(TFM_SVC_GET_BOOT_DATA)" \n"
diff --git a/secure_fw/partitions/ns_agent_mailbox/tfm_multi_core_mem_check.c b/secure_fw/partitions/ns_agent_mailbox/tfm_multi_core_mem_check.c
index ba6958d..16b7e29 100644
--- a/secure_fw/partitions/ns_agent_mailbox/tfm_multi_core_mem_check.c
+++ b/secure_fw/partitions/ns_agent_mailbox/tfm_multi_core_mem_check.c
@@ -11,6 +11,7 @@
#include <stddef.h>
#include <stdint.h>
+#include "internal_status_code.h"
#include "region.h"
#include "region_defs.h"
#include "tfm_hal_multi_core.h"
@@ -28,23 +29,23 @@
p_attr->is_valid = true;
if (check_address_range(p, s, NS_DATA_START,
- NS_DATA_LIMIT) == TFM_SUCCESS) {
+ NS_DATA_LIMIT) == SPM_SUCCESS) {
p_attr->is_secure = false;
return;
}
if (check_address_range(p, s, NS_CODE_START,
- NS_CODE_LIMIT) == TFM_SUCCESS) {
+ NS_CODE_LIMIT) == SPM_SUCCESS) {
p_attr->is_secure = false;
return;
}
- if (check_address_range(p, s, S_DATA_START, S_DATA_LIMIT) == TFM_SUCCESS) {
+ if (check_address_range(p, s, S_DATA_START, S_DATA_LIMIT) == SPM_SUCCESS) {
p_attr->is_secure = true;
return;
}
- if (check_address_range(p, s, S_CODE_START, S_CODE_LIMIT) == TFM_SUCCESS) {
+ if (check_address_range(p, s, S_CODE_START, S_CODE_LIMIT) == SPM_SUCCESS) {
p_attr->is_secure = true;
return;
}
@@ -72,7 +73,7 @@
p_attr->is_mpu_enabled = false;
p_attr->is_valid = true;
- if (check_address_range(p, s, S_DATA_START, S_DATA_LIMIT) == TFM_SUCCESS) {
+ if (check_address_range(p, s, S_DATA_START, S_DATA_LIMIT) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = true;
p_attr->is_unpriv_rd_allow = true;
@@ -81,7 +82,7 @@
return;
}
- if (check_address_range(p, s, S_CODE_START, S_CODE_LIMIT) == TFM_SUCCESS) {
+ if (check_address_range(p, s, S_CODE_START, S_CODE_LIMIT) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = false;
p_attr->is_unpriv_rd_allow = true;
@@ -100,7 +101,7 @@
/* TFM Core unprivileged code region */
base = (uintptr_t)®ION_NAME(Image$$, TFM_UNPRIV_CODE_START, $$RO$$Base);
limit = (uintptr_t)®ION_NAME(Image$$, TFM_UNPRIV_CODE_END, $$RO$$Limit) - 1;
- if (check_address_range(p, s, base, limit) == TFM_SUCCESS) {
+ if (check_address_range(p, s, base, limit) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = false;
p_attr->is_unpriv_rd_allow = true;
@@ -113,7 +114,7 @@
/* TFM partition metadata pointer region */
base = (uintptr_t)®ION_NAME(Image$$, TFM_SP_META_PTR, $$ZI$$Base);
limit = (uintptr_t)®ION_NAME(Image$$, TFM_SP_META_PTR, $$ZI$$Limit) - 1;
- if (check_address_range(p, s, base, limit) == TFM_SUCCESS) {
+ if (check_address_range(p, s, base, limit) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = true;
p_attr->is_unpriv_rd_allow = true;
@@ -126,7 +127,7 @@
/* APP RoT partition RO region */
base = (uintptr_t)®ION_NAME(Image$$, TFM_APP_CODE_START, $$Base);
limit = (uintptr_t)®ION_NAME(Image$$, TFM_APP_CODE_END, $$Base) - 1;
- if (check_address_range(p, s, base, limit) == TFM_SUCCESS) {
+ if (check_address_range(p, s, base, limit) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = false;
p_attr->is_unpriv_rd_allow = true;
@@ -138,7 +139,7 @@
/* RW, ZI and stack as one region */
base = (uintptr_t)®ION_NAME(Image$$, TFM_APP_RW_STACK_START, $$Base);
limit = (uintptr_t)®ION_NAME(Image$$, TFM_APP_RW_STACK_END, $$Base) - 1;
- if (check_address_range(p, s, base, limit) == TFM_SUCCESS) {
+ if (check_address_range(p, s, base, limit) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = true;
p_attr->is_unpriv_rd_allow = true;
@@ -153,7 +154,7 @@
*/
base = (uintptr_t)S_DATA_START;
limit = (uintptr_t)S_DATA_LIMIT;
- if (check_address_range(p, s, base, limit) == TFM_SUCCESS) {
+ if (check_address_range(p, s, base, limit) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = true;
p_attr->is_unpriv_rd_allow = false;
@@ -164,7 +165,7 @@
base = (uintptr_t)S_CODE_START;
limit = (uintptr_t)S_CODE_LIMIT;
- if (check_address_range(p, s, base, limit) == TFM_SUCCESS) {
+ if (check_address_range(p, s, base, limit) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = false;
p_attr->is_unpriv_rd_allow = false;
@@ -186,7 +187,7 @@
p_attr->is_valid = true;
if (check_address_range(p, s, NS_DATA_START,
- NS_DATA_LIMIT) == TFM_SUCCESS) {
+ NS_DATA_LIMIT) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = true;
p_attr->is_unpriv_rd_allow = true;
@@ -196,7 +197,7 @@
}
if (check_address_range(p, s, NS_CODE_START,
- NS_CODE_LIMIT) == TFM_SUCCESS) {
+ NS_CODE_LIMIT) == SPM_SUCCESS) {
p_attr->is_priv_rd_allow = true;
p_attr->is_priv_wr_allow = false;
p_attr->is_unpriv_rd_allow = true;
@@ -247,16 +248,15 @@
* memory region
* \param[in] flags The flags indicating the access permissions.
*
- * \return TFM_SUCCESS if the check passes,
- * TFM_ERROR_GENERIC otherwise.
+ * \return SPM_SUCCESS if the check passes,
+ * SPM_ERROR_GENERIC otherwise.
*/
-static enum tfm_status_e security_attr_check(struct security_attr_info_t attr,
- uint8_t flags)
+static int32_t security_attr_check(struct security_attr_info_t attr, uint8_t flags)
{
bool secure_access;
if (!attr.is_valid) {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
secure_access = flags & MEM_CHECK_NONSECURE ? false : true;
@@ -265,10 +265,10 @@
* Secure service should not directly access non-secure memory region.
*/
if (secure_access ^ attr.is_secure) {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
/**
@@ -278,11 +278,10 @@
* \param[in] attr The mem_attr_info_t containing attributes of memory region
* \param[in] flags The flags indicating the access permissions.
*
- * \return TFM_SUCCESS if the check passes,
- * TFM_ERROR_GENERIC otherwise.
+ * \return SPM_SUCCESS if the check passes,
+ * SPM_ERROR_GENERIC otherwise.
*/
-static enum tfm_status_e ns_mem_attr_check(struct mem_attr_info_t attr,
- uint8_t flags)
+static int32_t ns_mem_attr_check(struct mem_attr_info_t attr, uint8_t flags)
{
/*
* Non-secure privileged/unprivileged check is skipped.
@@ -293,15 +292,15 @@
if ((flags & MEM_CHECK_MPU_READWRITE) &&
(attr.is_priv_rd_allow || attr.is_unpriv_rd_allow) &&
(attr.is_priv_wr_allow || attr.is_unpriv_wr_allow)) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
if ((flags & MEM_CHECK_MPU_READ) &&
(attr.is_priv_rd_allow || attr.is_unpriv_rd_allow)) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
/**
@@ -311,11 +310,10 @@
* \param[in] attr The mem_attr_info_t containing attributes of memory region
* \param[in] flags The flags indicating the access permissions.
*
- * \return TFM_SUCCESS if the check passes,
- * TFM_ERROR_GENERIC otherwise.
+ * \return SPM_SUCCESS if the check passes,
+ * SPM_ERROR_GENERIC otherwise.
*/
-static enum tfm_status_e secure_mem_attr_check(struct mem_attr_info_t attr,
- uint8_t flags)
+static int32_t secure_mem_attr_check(struct mem_attr_info_t attr, uint8_t flags)
{
#if TFM_ISOLATION_LEVEL == 1
/* Privileged/unprivileged is ignored in TFM_ISOLATION_LEVEL == 1 */
@@ -323,37 +321,37 @@
if ((flags & MEM_CHECK_MPU_READWRITE) &&
(attr.is_priv_rd_allow || attr.is_unpriv_rd_allow) &&
(attr.is_priv_wr_allow || attr.is_unpriv_wr_allow)) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
if ((flags & MEM_CHECK_MPU_READ) &&
(attr.is_priv_rd_allow || attr.is_unpriv_rd_allow)) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
#else
if (flags & MEM_CHECK_MPU_UNPRIV) {
if ((flags & MEM_CHECK_MPU_READWRITE) && attr.is_unpriv_rd_allow &&
attr.is_unpriv_wr_allow) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
if ((flags & MEM_CHECK_MPU_READ) && attr.is_unpriv_rd_allow) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
} else {
if ((flags & MEM_CHECK_MPU_READWRITE) && attr.is_priv_rd_allow &&
attr.is_priv_wr_allow) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
if ((flags & MEM_CHECK_MPU_READ) && attr.is_priv_rd_allow) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
}
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
#endif
}
@@ -364,14 +362,13 @@
* \param[in] attr The mem_attr_info_t containing memory region attributes
* \param[in] flags The flags indicating the access permissions.
*
- * \return TFM_SUCCESS if the check passes,
- * TFM_ERROR_GENERIC otherwise.
+ * \return SPM_SUCCESS if the check passes,
+ * SPM_ERROR_GENERIC otherwise.
*/
-static enum tfm_status_e mem_attr_check(struct mem_attr_info_t attr,
- uint8_t flags)
+static int32_t mem_attr_check(struct mem_attr_info_t attr, uint8_t flags)
{
if (!attr.is_valid) {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
if (flags & MEM_CHECK_NONSECURE) {
@@ -381,23 +378,22 @@
return secure_mem_attr_check(attr, flags);
}
-enum tfm_status_e tfm_has_access_to_region(const void *p, size_t s,
- uint32_t flags)
+int32_t tfm_has_access_to_region(const void *p, size_t s, uint32_t flags)
{
struct security_attr_info_t security_attr;
struct mem_attr_info_t mem_attr;
/* If size is zero, this indicates an empty buffer and base is ignored */
if (s == 0) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
}
if (!p) {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
if ((uintptr_t)p > (UINTPTR_MAX - s)) {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
/* Abort if current check doesn't run in PSA RoT */
@@ -410,8 +406,8 @@
/* Retrieve security attributes of target memory region */
tfm_hal_get_mem_security_attr(p, s, &security_attr);
- if (security_attr_check(security_attr, flags) != TFM_SUCCESS) {
- return TFM_ERROR_GENERIC;
+ if (security_attr_check(security_attr, flags) != SPM_SUCCESS) {
+ return SPM_ERROR_GENERIC;
}
mem_attr_init(&mem_attr);
@@ -434,15 +430,15 @@
return mem_attr_check(mem_attr, flags);
}
-enum tfm_status_e check_address_range(const void *p, size_t s,
- uintptr_t region_start,
- uintptr_t region_limit)
+int32_t check_address_range(const void *p, size_t s,
+ uintptr_t region_start,
+ uintptr_t region_limit)
{
int32_t range_in_region;
/* Check for overflow in the range parameters */
if ((uintptr_t)p > UINTPTR_MAX - s) {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
/* We trust the region parameters, and don't check for overflow */
@@ -451,8 +447,8 @@
range_in_region = ((uintptr_t)p >= region_start) &&
((uintptr_t)((char *) p + s - 1) <= region_limit);
if (range_in_region) {
- return TFM_SUCCESS;
+ return SPM_SUCCESS;
} else {
- return TFM_ERROR_GENERIC;
+ return SPM_ERROR_GENERIC;
}
}
diff --git a/secure_fw/partitions/protected_storage/ps_filesystem_interface.c b/secure_fw/partitions/protected_storage/ps_filesystem_interface.c
index 2254efb..eecac9c 100644
--- a/secure_fw/partitions/protected_storage/ps_filesystem_interface.c
+++ b/secure_fw/partitions/protected_storage/ps_filesystem_interface.c
@@ -7,7 +7,6 @@
#include "psa/client.h"
#include "psa_manifest/sid.h"
-#include "tfm_api.h"
#include "tfm_its_defs.h"
#include "psa_manifest/pid.h"
#include "tfm_internal_trusted_storage.h"
diff --git a/secure_fw/partitions/protected_storage/tfm_ps_req_mngr.c b/secure_fw/partitions/protected_storage/tfm_ps_req_mngr.c
index 755b39e..f10cb75 100644
--- a/secure_fw/partitions/protected_storage/tfm_ps_req_mngr.c
+++ b/secure_fw/partitions/protected_storage/tfm_ps_req_mngr.c
@@ -13,7 +13,6 @@
#include "psa/protected_storage.h"
-#include "tfm_api.h"
#include "tfm_protected_storage.h"
#include "psa/service.h"
#include "psa_manifest/tfm_protected_storage.h"
diff --git a/secure_fw/spm/core/agent_api.c b/secure_fw/spm/core/agent_api.c
index 3cff896..2e5ed7f 100644
--- a/secure_fw/spm/core/agent_api.c
+++ b/secure_fw/spm/core/agent_api.c
@@ -10,6 +10,7 @@
#include "ffm/psa_api.h"
#include "psa/error.h"
+#include "internal_status_code.h"
#include "tfm_multi_core.h"
#include "tfm_psa_call_pack.h"
@@ -34,7 +35,7 @@
if (tfm_has_access_to_region(invec.base,
invec.len,
- MEM_CHECK_NONSECURE | MEM_CHECK_MPU_READ) != TFM_SUCCESS) {
+ MEM_CHECK_NONSECURE | MEM_CHECK_MPU_READ) != SPM_SUCCESS) {
return PSA_ERROR_PROGRAMMER_ERROR;
}
}
@@ -43,7 +44,7 @@
if (tfm_has_access_to_region(outvec.base,
outvec.len,
- MEM_CHECK_NONSECURE | MEM_CHECK_MPU_READWRITE) != TFM_SUCCESS) {
+ MEM_CHECK_NONSECURE | MEM_CHECK_MPU_READWRITE) != SPM_SUCCESS) {
return PSA_ERROR_PROGRAMMER_ERROR;
}
}
diff --git a/secure_fw/spm/core/internal_status_code.h b/secure_fw/spm/core/internal_status_code.h
index fbb0b63..77f9685 100644
--- a/secure_fw/spm/core/internal_status_code.h
+++ b/secure_fw/spm/core/internal_status_code.h
@@ -9,6 +9,8 @@
#include "psa/error.h"
+#define SPM_SUCCESS PSA_SUCCESS
+
/* SPM implementation status range from -249 to -256. */
#define SPM_ERROR_BAD_PARAMETERS ((psa_status_t)-249)
#define SPM_ERROR_SHORT_BUFFER ((psa_status_t)-250)
diff --git a/secure_fw/spm/core/main.c b/secure_fw/spm/core/main.c
index eb29267..64bf4e3 100644
--- a/secure_fw/spm/core/main.c
+++ b/secure_fw/spm/core/main.c
@@ -6,13 +6,13 @@
*/
#include "build_config_check.h"
+#include "internal_status_code.h"
#include "fih.h"
#include "tfm_boot_data.h"
#include "memory_symbols.h"
#include "spm.h"
#include "tfm_hal_isolation.h"
#include "tfm_hal_platform.h"
-#include "tfm_api.h"
#include "tfm_spm_log.h"
#include "tfm_version.h"
#include "tfm_plat_otp.h"
@@ -31,7 +31,7 @@
*/
FIH_CALL(tfm_hal_set_up_static_boundaries, fih_rc, &spm_boundary);
if (fih_not_eq(fih_rc, fih_int_encode(TFM_HAL_SUCCESS))) {
- FIH_RET(fih_int_encode(TFM_ERROR_GENERIC));
+ FIH_RET(fih_int_encode(SPM_ERROR_GENERIC));
}
#ifdef TFM_FIH_PROFILE_ON
FIH_CALL(tfm_hal_verify_static_boundaries, fih_rc);
@@ -42,19 +42,19 @@
FIH_CALL(tfm_hal_platform_init, fih_rc);
if (fih_not_eq(fih_rc, fih_int_encode(TFM_HAL_SUCCESS))) {
- FIH_RET(fih_int_encode(TFM_ERROR_GENERIC));
+ FIH_RET(fih_int_encode(SPM_ERROR_GENERIC));
}
plat_err = tfm_plat_otp_init();
if (plat_err != TFM_PLAT_ERR_SUCCESS) {
- FIH_RET(fih_int_encode(TFM_ERROR_GENERIC));
+ FIH_RET(fih_int_encode(SPM_ERROR_GENERIC));
}
/* Perform provisioning. */
if (tfm_plat_provisioning_is_required()) {
plat_err = tfm_plat_provisioning_perform();
if (plat_err != TFM_PLAT_ERR_SUCCESS) {
- FIH_RET(fih_int_encode(TFM_ERROR_GENERIC));
+ FIH_RET(fih_int_encode(SPM_ERROR_GENERIC));
}
} else {
tfm_plat_provisioning_check_for_dummy_keys();
@@ -78,7 +78,7 @@
tfm_core_validate_boot_data();
- FIH_RET(fih_int_encode(TFM_SUCCESS));
+ FIH_RET(fih_int_encode(SPM_SUCCESS));
}
int main(void)
@@ -91,7 +91,7 @@
fih_delay_init();
FIH_CALL(tfm_core_init, fih_rc);
- if (fih_not_eq(fih_rc, fih_int_encode(TFM_SUCCESS))) {
+ if (fih_not_eq(fih_rc, fih_int_encode(SPM_SUCCESS))) {
tfm_core_panic();
}
diff --git a/secure_fw/spm/core/psa_api.c b/secure_fw/spm/core/psa_api.c
index 9f7d163..16818d5 100644
--- a/secure_fw/spm/core/psa_api.c
+++ b/secure_fw/spm/core/psa_api.c
@@ -25,7 +25,6 @@
#include "ffm/backend.h"
#include "ffm/psa_api.h"
#include "tfm_rpc.h"
-#include "tfm_api.h"
#include "tfm_hal_platform.h"
#include "tfm_psa_call_pack.h"
#include "tfm_hal_isolation.h"
diff --git a/secure_fw/spm/core/spm.h b/secure_fw/spm/core/spm.h
index f94bf53..a0a7ed2 100644
--- a/secure_fw/spm/core/spm.h
+++ b/secure_fw/spm/core/spm.h
@@ -26,6 +26,9 @@
#define TFM_HANDLE_STATUS_ACTIVE 1 /* Handle in use */
#define TFM_HANDLE_STATUS_TO_FREE 2 /* Free the handle */
+/* The mask used for timeout values */
+#define PSA_TIMEOUT_MASK PSA_BLOCK
+
/*
* Set a number limit for stateless handle.
* Valid handle must be positive, set client handle minimum value to 1.
@@ -61,6 +64,9 @@
#define GET_THRD_OWNER(x) TO_CONTAINER(x, struct partition_t, thrd)
#define GET_CTX_OWNER(x) TO_CONTAINER(x, struct partition_t, ctx_ctrl)
+/* Checks if the provided client ID is a non-secure client ID */
+#define TFM_CLIENT_ID_IS_NS(client_id) ((client_id) < 0)
+
/* RoT connection handle list */
struct connection_t {
uint32_t status; /*
diff --git a/secure_fw/spm/core/spm_ipc.c b/secure_fw/spm/core/spm_ipc.c
index 6ddd6f3..8982fde 100644
--- a/secure_fw/spm/core/spm_ipc.c
+++ b/secure_fw/spm/core/spm_ipc.c
@@ -21,7 +21,6 @@
#include "psa/service.h"
#include "thread.h"
#include "internal_status_code.h"
-#include "tfm_api.h"
#include "tfm_arch.h"
#include "tfm_hal_defs.h"
#include "tfm_hal_interrupt.h"
diff --git a/secure_fw/spm/core/tfm_boot_data.c b/secure_fw/spm/core/tfm_boot_data.c
index c83a429..cf49595 100644
--- a/secure_fw/spm/core/tfm_boot_data.c
+++ b/secure_fw/spm/core/tfm_boot_data.c
@@ -10,7 +10,6 @@
#include "array.h"
#include "tfm_boot_status.h"
#include "region_defs.h"
-#include "tfm_api.h"
#include "psa_manifest/pid.h"
#include "internal_status_code.h"
#include "utilities.h"
@@ -157,18 +156,18 @@
curr_partition->boundary, (uintptr_t)buf_start,
buf_size, TFM_HAL_ACCESS_READWRITE);
if (fih_not_eq(fih_rc, fih_int_encode(PSA_SUCCESS))) {
- args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
+ args[0] = (uint32_t)PSA_ERROR_INVALID_ARGUMENT;
return;
}
if (is_boot_data_valid != BOOT_DATA_VALID) {
- args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
+ args[0] = (uint32_t)PSA_ERROR_INVALID_ARGUMENT;
return;
}
/* Check whether caller has access right to given tlv_major_type */
if (tfm_core_check_boot_data_access_policy(tlv_major)) {
- args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
+ args[0] = (uint32_t)PSA_ERROR_INVALID_ARGUMENT;
return;
}
@@ -181,7 +180,7 @@
/* Add header to output buffer as well */
if (buf_size < SHARED_DATA_HEADER_SIZE) {
- args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
+ args[0] = (uint32_t)PSA_ERROR_INVALID_ARGUMENT;
return;
} else {
boot_data = (struct tfm_boot_data *)buf_start;
@@ -204,7 +203,7 @@
if (GET_MAJOR(tlv_entry.tlv_type) == tlv_major) {
/* Check buffer overflow */
if (((ptr - buf_start) + next_tlv_offset) > buf_size) {
- args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
+ args[0] = (uint32_t)PSA_ERROR_INVALID_ARGUMENT;
return;
}
@@ -215,6 +214,6 @@
}
#endif /* BOOT_DATA_AVAILABLE */
- args[0] = (uint32_t)TFM_SUCCESS;
+ args[0] = (uint32_t)PSA_SUCCESS;
return;
}
diff --git a/secure_fw/spm/core/tfm_multi_core.h b/secure_fw/spm/core/tfm_multi_core.h
index 5f24edf..d6d920f 100644
--- a/secure_fw/spm/core/tfm_multi_core.h
+++ b/secure_fw/spm/core/tfm_multi_core.h
@@ -10,8 +10,6 @@
#include <stdbool.h>
-#include "tfm_api.h"
-
/* Follow CMSE flag definitions */
#define MEM_CHECK_MPU_READWRITE (1 << 0x0)
#define MEM_CHECK_AU_NONSECURE (1 << 0x1)
@@ -96,11 +94,10 @@
* \param[in] flags The memory access types to be checked between
* given memory and boundaries.
*
- * \return TFM_SUCCESS if the access is allowed,
- * TFM_ERROR_GENERIC otherwise.
+ * \return SPM_SUCCESS if the access is allowed,
+ * SPM_ERROR_GENERIC otherwise.
*/
-enum tfm_status_e tfm_has_access_to_region(const void *p, size_t s,
- uint32_t flags);
+int32_t tfm_has_access_to_region(const void *p, size_t s, uint32_t flags);
/**
* \brief Initialization of the multi core communication.
@@ -120,10 +117,10 @@
* \param[in] region_limit The end address of the region, which should contain
* the range
*
- * \return TFM_SUCCESS if the region contains the range,
- * TFM_ERROR_GENERIC otherwise.
+ * \return SPM_SUCCESS if the region contains the range,
+ * SPM_ERROR_GENERIC otherwise.
*/
-enum tfm_status_e check_address_range(const void *p, size_t s,
- uintptr_t region_start,
- uintptr_t region_limit);
+int32_t check_address_range(const void *p, size_t s,
+ uintptr_t region_start,
+ uintptr_t region_limit);
#endif /* __TFM_MULTI_CORE_H__ */
diff --git a/secure_fw/spm/core/tfm_svcalls.c b/secure_fw/spm/core/tfm_svcalls.c
index acbf20e..d05806a 100644
--- a/secure_fw/spm/core/tfm_svcalls.c
+++ b/secure_fw/spm/core/tfm_svcalls.c
@@ -10,7 +10,6 @@
#include "memory_symbols.h"
#include "spm.h"
#include "svc_num.h"
-#include "tfm_api.h"
#include "tfm_arch.h"
#include "tfm_core_trustzone.h"
#include "tfm_svcalls.h"