aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/user_guides/services/tfm_attestation_integration_guide.rst7
-rw-r--r--interface/include/psa_manifest/sid.h6
-rw-r--r--interface/include/psa_manifest/sid.h.template2
-rw-r--r--platform/ext/target/musca_a/services/src/tfm_platform_system.c37
-rw-r--r--platform/ext/target/musca_b1/services/src/tfm_platform_system.c42
-rw-r--r--secure_fw/core/include/tfm_internal.h7
-rw-r--r--secure_fw/core/include/tfm_secure_api.h6
-rw-r--r--secure_fw/core/tfm_core_svcalls_func.c5
-rw-r--r--secure_fw/core/tfm_func_api.c78
-rw-r--r--secure_fw/core/tfm_spm_services.c13
-rw-r--r--secure_fw/include/core/tfm_core_svc.h1
-rw-r--r--secure_fw/services/initial_attestation/attestation.h23
-rw-r--r--secure_fw/services/initial_attestation/attestation_core.c28
-rw-r--r--secure_fw/services/initial_attestation/tfm_attestation.c18
-rw-r--r--secure_fw/services/tfm_service_list.inc34
-rw-r--r--secure_fw/services/tfm_service_list.inc.template2
-rw-r--r--test/suites/core/non_secure/core_ns_positive_testsuite.c76
-rw-r--r--test/test_services/tfm_core_test/core_test_defs.h4
-rw-r--r--test/test_services/tfm_core_test/psa_manifest/tfm_test_core.h18
-rw-r--r--test/test_services/tfm_core_test/tfm_ss_core_test.c140
-rw-r--r--test/test_services/tfm_core_test/tfm_test_core.yaml14
-rw-r--r--test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c18
22 files changed, 22 insertions, 557 deletions
diff --git a/docs/user_guides/services/tfm_attestation_integration_guide.rst b/docs/user_guides/services/tfm_attestation_integration_guide.rst
index bb48437264..e2abbcf6f4 100644
--- a/docs/user_guides/services/tfm_attestation_integration_guide.rst
+++ b/docs/user_guides/services/tfm_attestation_integration_guide.rst
@@ -248,11 +248,6 @@ according to their SPM implementation.
enum psa_attest_err_t
attest_get_caller_client_id(int32_t *caller_id);
- enum psa_attest_err_t
- attest_check_memory_access(void *addr,
- uint32_t size,
- enum attest_memory_access access);
-
- ``attest_get_boot_data()``: Service can retrieve the relevant data from shared
memory area between boot loader and runtime software. It might be the case
that only SPM has direct access to the shared memory area, therefore this
@@ -271,8 +266,6 @@ according to their SPM implementation.
tlv_header->tlv_tot_len = sizeof(struct shared_data_tlv_header *tlv_header);
- ``attest_get_caller_client_id()``: Retrieves the ID of the caller thread.
-- ``attest_check_memory_access()``: Validates the availability and access rights
- of memory regions received as input data: challenge object, token buffer, etc.
- ``tfm_client.h``: Service relies on the following external definitions, which
must be present or included in this header file:
diff --git a/interface/include/psa_manifest/sid.h b/interface/include/psa_manifest/sid.h
index 6ee681b833..4e9e44084b 100644
--- a/interface/include/psa_manifest/sid.h
+++ b/interface/include/psa_manifest/sid.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -59,10 +59,6 @@ extern "C" {
#define SPM_CORE_TEST_INIT_SUCCESS_VERSION (1U)
#define SPM_CORE_TEST_DIRECT_RECURSION_SID (0x0000F021U)
#define SPM_CORE_TEST_DIRECT_RECURSION_VERSION (1U)
-#define SPM_CORE_TEST_MPU_ACCESS_SID (0x0000F022U)
-#define SPM_CORE_TEST_MPU_ACCESS_VERSION (1U)
-#define SPM_CORE_TEST_MEMORY_PERMISSIONS_SID (0x0000F023U)
-#define SPM_CORE_TEST_MEMORY_PERMISSIONS_VERSION (1U)
#define SPM_CORE_TEST_SS_TO_SS_SID (0x0000F024U)
#define SPM_CORE_TEST_SS_TO_SS_VERSION (1U)
#define SPM_CORE_TEST_SS_TO_SS_BUFFER_SID (0x0000F025U)
diff --git a/interface/include/psa_manifest/sid.h.template b/interface/include/psa_manifest/sid.h.template
index f4c3ad9c43..f25a1ca2fa 100644
--- a/interface/include/psa_manifest/sid.h.template
+++ b/interface/include/psa_manifest/sid.h.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
diff --git a/platform/ext/target/musca_a/services/src/tfm_platform_system.c b/platform/ext/target/musca_a/services/src/tfm_platform_system.c
index 4a8dc36115..7faa0a8cd4 100644
--- a/platform/ext/target/musca_a/services/src/tfm_platform_system.c
+++ b/platform/ext/target/musca_a/services/src/tfm_platform_system.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -11,36 +11,8 @@
#include "target_cfg.h"
#include "device_definition.h"
#include "psa/client.h"
-#include "tfm_secure_api.h"
#include "services/include/tfm_ioctl_api.h"
-#ifndef TFM_PSA_API
-/*!
- * \brief Verify access rights for memory addresses sent in io vectors
- *
- * \param[in] in_vec Pointer to in_vec array, which contains pointer
- * to input arguments for the service
- * \param[in] out_vec Pointer out_vec array, which contains pointer to
- * output data of the pin service
- *
- * \return Returns true if memory is accessible by the service
- */
-static bool memory_addr_check(const psa_invec *in_vec,
- const psa_outvec *out_vec)
-{
- if ((in_vec->base != NULL) &&
- (tfm_core_memory_permission_check((void *)in_vec->base, in_vec->len,
- TFM_MEMORY_ACCESS_RO) == TFM_SUCCESS) &&
- (out_vec->base != NULL) &&
- (tfm_core_memory_permission_check((void *)out_vec->base, out_vec->len,
- TFM_MEMORY_ACCESS_RW) == TFM_SUCCESS)) {
- return true;
- } else {
- return false;
- }
-}
-#endif /* TFM_PSA_API */
-
void tfm_platform_hal_system_reset(void)
{
/* Reset the system */
@@ -59,12 +31,6 @@ tfm_platform_hal_gpio_service(const psa_invec *in_vec,
*/
enum gpio_cmsdk_altfunc_t altfunc = GPIO_CMSDK_MAIN_FUNC;
-#ifndef TFM_PSA_API
- if (memory_addr_check(in_vec, out_vec) == false) {
- return TFM_PLATFORM_ERR_SYSTEM_ERROR;
- }
-#endif /* TFM_PSA_API */
-
if (in_vec->len != sizeof(struct tfm_gpio_service_args_t) ||
out_vec->len != sizeof(struct tfm_gpio_service_out_t)) {
return TFM_PLATFORM_ERR_INVALID_PARAM;
@@ -137,4 +103,3 @@ enum tfm_platform_err_t tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request,
return TFM_PLATFORM_ERR_NOT_SUPPORTED;
}
}
-
diff --git a/platform/ext/target/musca_b1/services/src/tfm_platform_system.c b/platform/ext/target/musca_b1/services/src/tfm_platform_system.c
index 47eedb284d..76c983def8 100644
--- a/platform/ext/target/musca_b1/services/src/tfm_platform_system.c
+++ b/platform/ext/target/musca_b1/services/src/tfm_platform_system.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -11,36 +11,8 @@
#include "target_cfg.h"
#include "device_definition.h"
#include "psa/client.h"
-#include "tfm_secure_api.h"
#include "services/include/tfm_ioctl_api.h"
-#ifndef TFM_PSA_API
-/*!
- * \brief Verify access rights for memory addresses sent in io vectors
- *
- * \param[in] in_vec Pointer to in_vec array, which contains pointer
- * to input arguments for the service
- * \param[in] out_vec Pointer out_vec array, which contains pointer to
- * output data of the pin service
- *
- * \return Returns true if memory is accessible by the service
- */
-static bool memory_addr_check(const psa_invec *in_vec,
- const psa_outvec *out_vec)
-{
- if ((in_vec->base != NULL) &&
- (tfm_core_memory_permission_check((void *)in_vec->base, in_vec->len,
- TFM_MEMORY_ACCESS_RO) == TFM_SUCCESS) &&
- (out_vec->base != NULL) &&
- (tfm_core_memory_permission_check((void *)out_vec->base, out_vec->len,
- TFM_MEMORY_ACCESS_RW) == TFM_SUCCESS)) {
- return true;
- } else {
- return false;
- }
-}
-#endif /* TFM_PSA_API */
-
void tfm_platform_hal_system_reset(void)
{
__disable_irq();
@@ -67,12 +39,6 @@ musca_b1_pin_service(const psa_invec *in_vec,
enum gpio_altfunc_t altfunc;
enum pinmode_select_t pin_mode;
-#ifndef TFM_PSA_API
- if (memory_addr_check(in_vec, out_vec) == false) {
- return TFM_PLATFORM_ERR_SYSTEM_ERROR;
- }
-#endif /* TFM_PSA_API */
-
if (in_vec->len != sizeof(struct tfm_pin_service_args_t) ||
out_vec->len != sizeof(uint32_t)) {
return TFM_PLATFORM_ERR_INVALID_PARAM;
@@ -118,12 +84,6 @@ tfm_platform_hal_gpio_service(const psa_invec *in_vec,
*/
enum gpio_cmsdk_altfunc_t altfunc = GPIO_CMSDK_MAIN_FUNC;
-#ifndef TFM_PSA_API
- if (memory_addr_check(in_vec, out_vec) == false) {
- return TFM_PLATFORM_ERR_SYSTEM_ERROR;
- }
-#endif /* TFM_PSA_API */
-
if (in_vec->len != sizeof(struct tfm_gpio_service_args_t) ||
out_vec->len != sizeof(struct tfm_gpio_service_out_t)) {
return TFM_PLATFORM_ERR_INVALID_PARAM;
diff --git a/secure_fw/core/include/tfm_internal.h b/secure_fw/core/include/tfm_internal.h
index 7da56c0add..c68eabccff 100644
--- a/secure_fw/core/include/tfm_internal.h
+++ b/secure_fw/core/include/tfm_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -58,11 +58,6 @@ void tfm_core_validate_secure_caller_handler(const uint32_t svc_args[]);
void tfm_core_get_caller_client_id_handler(const uint32_t svc_args[]);
/**
- * \brief Checks if a secure service's access to a memory location is permitted
- */
-void tfm_core_memory_permission_check_handler(const uint32_t svc_args[]);
-
-/**
* \brief Handle an SPM request by a secure service
*/
void tfm_core_spm_request_handler(const struct tfm_state_context_t *svc_ctx);
diff --git a/secure_fw/core/include/tfm_secure_api.h b/secure_fw/core/include/tfm_secure_api.h
index 7c3ca10fb9..c4559898e1 100644
--- a/secure_fw/core/include/tfm_secure_api.h
+++ b/secure_fw/core/include/tfm_secure_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -78,10 +78,6 @@ extern int32_t tfm_core_validate_secure_caller(void);
extern int32_t tfm_core_get_caller_client_id(int32_t *caller_client_id);
-extern int32_t tfm_core_memory_permission_check(const void *ptr,
- uint32_t size,
- int32_t access);
-
extern int32_t tfm_core_get_boot_data(uint8_t major_type,
struct tfm_boot_data *boot_data,
uint32_t len);
diff --git a/secure_fw/core/tfm_core_svcalls_func.c b/secure_fw/core/tfm_core_svcalls_func.c
index 31cff2cb86..e54153fce0 100644
--- a/secure_fw/core/tfm_core_svcalls_func.c
+++ b/secure_fw/core/tfm_core_svcalls_func.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -65,9 +65,6 @@ uint32_t tfm_core_svc_handler(uint32_t *svc_args, uint32_t lr, uint32_t *msp)
case TFM_SVC_SPM_REQUEST:
tfm_core_spm_request_handler((struct tfm_state_context_t *)svc_args);
break;
- case TFM_SVC_MEMORY_CHECK:
- tfm_core_memory_permission_check_handler(svc_args);
- break;
case TFM_SVC_DEPRIV_REQ:
lr = tfm_core_depriv_req_handler(svc_args, lr);
break;
diff --git a/secure_fw/core/tfm_func_api.c b/secure_fw/core/tfm_func_api.c
index 92c8b9581e..7bb079ae04 100644
--- a/secure_fw/core/tfm_func_api.c
+++ b/secure_fw/core/tfm_func_api.c
@@ -810,84 +810,6 @@ void tfm_core_get_caller_client_id_handler(uint32_t *svc_args)
svc_args[0] = (uint32_t)TFM_SUCCESS;
}
-void tfm_core_memory_permission_check_handler(uint32_t *svc_args)
-{
- void *ptr = (void *)svc_args[0];
- uint32_t size = svc_args[1];
- int32_t access = svc_args[2];
-
- enum tfm_status_e res;
- uint32_t running_partition_idx =
- tfm_spm_partition_get_running_partition_idx();
- uint32_t running_partition_flags =
- tfm_spm_partition_get_flags(running_partition_idx);
- int32_t flags = 0;
-
- if (!(running_partition_flags & SPM_PART_FLAG_APP_ROT) || (size == 0)) {
- /* This handler should only be called from a secure partition. */
- svc_args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
- return;
- }
-
- if (access == (int32_t)TFM_MEMORY_ACCESS_RW) {
- flags |= CMSE_MPU_READWRITE;
- } else {
- flags |= CMSE_MPU_READ;
- }
-
- /* Check if partition access to address would fail */
- if (cmse_check_address_range(ptr, size, flags) == NULL) {
- svc_args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
- return;
- }
-
- /* Get regions associated with address */
- cmse_address_info_t addr_info = cmse_TT(ptr);
-
- if (addr_info.flags.secure) {
- /* For privileged partition execution, all secure data and code memory
- * are accessible
- */
- res = check_address_range(ptr, size, S_DATA_START, S_DATA_LIMIT);
-
- if ((res != TFM_SUCCESS) && (access == (int32_t)TFM_MEMORY_ACCESS_RO)) {
- res = check_address_range(ptr, size, S_CODE_START, S_CODE_LIMIT);
- }
- } else {
- if (!addr_info.flags.sau_region_valid) {
- /* If address is NS, TF-M expects SAU to be configured
- */
- svc_args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
- return;
- }
- switch (addr_info.flags.sau_region) {
- case TFM_NS_REGION_CODE:
- if (access == (int32_t)TFM_MEMORY_ACCESS_RW) {
- res = TFM_ERROR_INVALID_PARAMETER;
- } else {
- /* Currently TF-M does not support checks for NS Memory
- * accesses by partitions
- */
- res = TFM_SUCCESS;
- }
- break;
- case TFM_NS_REGION_DATA:
- /* Currently TF-M does not support checks for NS Memory
- * accesses by partitions
- */
- res = TFM_SUCCESS;
- break;
- default:
- /* Only NS data and code regions can be accessed as buffers */
- res = TFM_ERROR_INVALID_PARAMETER;
- break;
- }
- }
-
- /* Store return value in r0 */
- svc_args[0] = (uint32_t)res;
-}
-
/* This SVC handler is called if veneer is running in thread mode */
uint32_t tfm_core_partition_request_svc_handler(
const struct tfm_state_context_t *svc_ctx, uint32_t excReturn)
diff --git a/secure_fw/core/tfm_spm_services.c b/secure_fw/core/tfm_spm_services.c
index fec40d368b..9701a83738 100644
--- a/secure_fw/core/tfm_spm_services.c
+++ b/secure_fw/core/tfm_spm_services.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -24,17 +24,6 @@ void jump_to_ns_code(void)
#ifndef TFM_PSA_API
__attribute__((naked))
-int32_t tfm_core_memory_permission_check(const void *ptr,
- uint32_t len,
- int32_t access)
-{
- __ASM volatile(
- "SVC %0\n"
- "BX lr\n"
- : : "I" (TFM_SVC_MEMORY_CHECK));
-}
-
-__attribute__((naked))
int32_t tfm_core_get_caller_client_id(int32_t *caller_client_id)
{
__ASM volatile(
diff --git a/secure_fw/include/core/tfm_core_svc.h b/secure_fw/include/core/tfm_core_svc.h
index f5a1c8508f..03597e29db 100644
--- a/secure_fw/include/core/tfm_core_svc.h
+++ b/secure_fw/include/core/tfm_core_svc.h
@@ -15,7 +15,6 @@ typedef enum {
TFM_SVC_SFN_RETURN,
TFM_SVC_VALIDATE_SECURE_CALLER,
TFM_SVC_GET_CALLER_CLIENT_ID,
- TFM_SVC_MEMORY_CHECK,
TFM_SVC_SPM_REQUEST,
TFM_SVC_GET_BOOT_DATA,
TFM_SVC_DEPRIV_REQ,
diff --git a/secure_fw/services/initial_attestation/attestation.h b/secure_fw/services/initial_attestation/attestation.h
index a381cf1f3d..a7be321a06 100644
--- a/secure_fw/services/initial_attestation/attestation.h
+++ b/secure_fw/services/initial_attestation/attestation.h
@@ -16,14 +16,6 @@
extern "C" {
#endif
-/*!
- * \brief Type of memory access
- */
-enum attest_memory_access_t {
- TFM_ATTEST_ACCESS_RO = 1,
- TFM_ATTEST_ACCESS_RW = 2,
-};
-
/**
* \enum psa_attest_err_t
*
@@ -77,21 +69,6 @@ enum psa_attest_err_t
attest_get_caller_client_id(int32_t *caller_id);
/*!
- * \brief Verify memory access rights
- *
- * \param[in] addr Pointer to the base of the address range to check
- * \param[in] size Size of the address range to check
- * \param[in] access Type of memory access as specified in
- * \ref attest_memory_access
- *
- * \return Returns error code as specified in \ref psa_attest_err_t
- */
-enum psa_attest_err_t
-attest_check_memory_access(void *addr,
- uint32_t size,
- enum attest_memory_access_t access);
-
-/*!
* \brief Initialise the initial attestation service during the TF-M boot up
* process.
*
diff --git a/secure_fw/services/initial_attestation/attestation_core.c b/secure_fw/services/initial_attestation/attestation_core.c
index 37da0798ae..f68ff838b1 100644
--- a/secure_fw/services/initial_attestation/attestation_core.c
+++ b/secure_fw/services/initial_attestation/attestation_core.c
@@ -1093,25 +1093,11 @@ initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec,
goto error;
}
- attest_err = attest_check_memory_access((void *)challenge.ptr,
- challenge.len,
- TFM_ATTEST_ACCESS_RO);
- if (attest_err != PSA_ATTEST_ERR_SUCCESS) {
- goto error;
- }
-
if (token.len == 0) {
attest_err = PSA_ATTEST_ERR_INVALID_INPUT;
goto error;
}
- attest_err = attest_check_memory_access(token.ptr,
- token.len,
- TFM_ATTEST_ACCESS_RW);
- if (attest_err != PSA_ATTEST_ERR_SUCCESS) {
- goto error;
- }
-
attest_err = attest_create_token(&challenge, &token, &completed_token);
if (attest_err != PSA_ATTEST_ERR_SUCCESS) {
goto error;
@@ -1190,20 +1176,6 @@ initial_attest_get_public_key(const psa_invec *in_vec, uint32_t num_invec,
goto error;
}
- attest_err = attest_check_memory_access(key_buffer.ptr,
- key_buffer.len,
- TFM_ATTEST_ACCESS_RW);
- if (attest_err != PSA_ATTEST_ERR_SUCCESS) {
- goto error;
- }
-
- attest_err = attest_check_memory_access(out_vec[1].base,
- out_vec[1].len,
- TFM_ATTEST_ACCESS_RW);
- if (attest_err != PSA_ATTEST_ERR_SUCCESS) {
- goto error;
- }
-
attest_err = attest_get_initial_attestation_public_key(&key_source,
&key_len,
&curve_type);
diff --git a/secure_fw/services/initial_attestation/tfm_attestation.c b/secure_fw/services/initial_attestation/tfm_attestation.c
index 7e20b2e3d4..cf28baa7a2 100644
--- a/secure_fw/services/initial_attestation/tfm_attestation.c
+++ b/secure_fw/services/initial_attestation/tfm_attestation.c
@@ -16,24 +16,6 @@ extern int32_t g_attest_caller_id;
#endif
enum psa_attest_err_t
-attest_check_memory_access(void *addr,
- uint32_t size,
- enum attest_memory_access_t access)
-{
- enum psa_attest_err_t attest_res = PSA_ATTEST_ERR_SUCCESS;
-#ifndef TFM_PSA_API
- int32_t tfm_res;
-
- tfm_res = tfm_core_memory_permission_check(addr, size, (int32_t)access);
- if (tfm_res) {
- attest_res = PSA_ATTEST_ERR_INVALID_INPUT;
- }
-#endif
-
- return attest_res;
-}
-
-enum psa_attest_err_t
attest_get_caller_client_id(int32_t *caller_id)
{
enum psa_attest_err_t attest_res = PSA_ATTEST_ERR_SUCCESS;
diff --git a/secure_fw/services/tfm_service_list.inc b/secure_fw/services/tfm_service_list.inc
index 539dada747..35ad61f641 100644
--- a/secure_fw/services/tfm_service_list.inc
+++ b/secure_fw/services/tfm_service_list.inc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -204,24 +204,6 @@ const struct tfm_spm_service_db_t service_db[] =
.version_policy = TFM_VERSION_POLICY_STRICT
},
{
- .name = "SPM_CORE_TEST_MPU_ACCESS",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_MPU_ACCESS_SIGNAL,
- .sid = 0x0000F022,
- .non_secure_client = true,
- .version = 1,
- .version_policy = TFM_VERSION_POLICY_STRICT
- },
- {
- .name = "SPM_CORE_TEST_MEMORY_PERMISSIONS",
- .partition_id = TFM_SP_CORE_TEST,
- .signal = SPM_CORE_TEST_MEMORY_PERMISSIONS_SIGNAL,
- .sid = 0x0000F023,
- .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,
@@ -738,20 +720,6 @@ struct tfm_spm_service_t service[] =
.msg_queue = {0},
.list = {0},
},
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .msg_queue = {0},
- .list = {0},
- },
- {
- .service_db = NULL,
- .partition = NULL,
- .handle_list = {0},
- .msg_queue = {0},
- .list = {0},
- },
#endif /* TFM_PARTITION_TEST_CORE */
#ifdef TFM_PARTITION_TEST_CORE
diff --git a/secure_fw/services/tfm_service_list.inc.template b/secure_fw/services/tfm_service_list.inc.template
index 2be53700f2..fdbbb3d197 100644
--- a/secure_fw/services/tfm_service_list.inc.template
+++ b/secure_fw/services/tfm_service_list.inc.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
diff --git a/test/suites/core/non_secure/core_ns_positive_testsuite.c b/test/suites/core/non_secure/core_ns_positive_testsuite.c
index 4b275ab9ac..42a14e36b9 100644
--- a/test/suites/core/non_secure/core_ns_positive_testsuite.c
+++ b/test/suites/core/non_secure/core_ns_positive_testsuite.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
* Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -33,8 +33,6 @@
description, {0} }
#ifndef TFM_PSA_API
-static void tfm_core_test_permissions(struct test_result_t *ret);
-static void tfm_core_test_mpu_access(struct test_result_t *ret);
static void tfm_core_test_get_caller_client_id(struct test_result_t *ret);
static void tfm_core_test_spm_request(struct test_result_t *ret);
#endif /* TFM_PSA_API */
@@ -67,20 +65,11 @@ CORE_TEST_DESCRIPTION(CORE_TEST_ID_CHECK_INIT, tfm_core_test_check_init,
CORE_TEST_DESCRIPTION(CORE_TEST_ID_RECURSION, tfm_core_test_recursion,
"Test direct recursion of secure services"),
#endif
-#ifndef TFM_PSA_API
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_MEMORY_PERMISSIONS,
- tfm_core_test_permissions,
- "Test secure service memory access permissions"),
-#endif /* TFM_PSA_API */
#ifdef TFM_ENABLE_IRQ_TEST
CORE_TEST_DESCRIPTION(CORE_TEST_ID_SECURE_IRQ,
tfm_core_test_irq,
"Test secure irq"),
#endif
-#ifndef TFM_PSA_API
-CORE_TEST_DESCRIPTION(CORE_TEST_ID_MPU_ACCESS, tfm_core_test_mpu_access,
- "Test secure service MPU accesses"),
-#endif /* TFM_PSA_API */
CORE_TEST_DESCRIPTION(CORE_TEST_ID_BUFFER_CHECK, tfm_core_test_buffer_check,
"Test secure service buffer accesses"),
CORE_TEST_DESCRIPTION(CORE_TEST_ID_SS_TO_SS, tfm_core_test_ss_to_ss,
@@ -674,69 +663,6 @@ static void tfm_core_test_recursion(struct test_result_t *ret)
}
#endif
-#ifndef TFM_PSA_API
-static char *error_to_string(const char *desc, int32_t err)
-{
- static char info[80];
-
- sprintf(info, "%s. Error code: %d, extra data: %d",
- desc,
- CORE_TEST_ERROR_GET_CODE(err),
- CORE_TEST_ERROR_GET_EXTRA(err));
- return info;
-}
-
-static void tfm_core_test_mpu_access(struct test_result_t *ret)
-{
- int32_t err;
- int32_t test_case_id = CORE_TEST_ID_MPU_ACCESS;
- uint32_t data[4] = {0};
- psa_invec in_vec[] = { {&test_case_id, sizeof(int32_t)},
- {data, sizeof(data)},
- {(void *)((int32_t)tfm_core_test_mpu_access &
- (~(0x3))),
- sizeof(uint32_t)} };
- psa_outvec outvec[] = { {data, sizeof(data)} };
- struct tfm_core_test_call_args_t args = {in_vec, 3, outvec, 1};
-
- err = tfm_core_test_call(tfm_spm_core_test_sfn_veneer, &args);
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- char *info = error_to_string(
- "Service memory accesses configured incorrectly.", err);
- TEST_FAIL(info);
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-
-static void tfm_core_test_permissions(struct test_result_t *ret)
-{
- int32_t err;
- int32_t test_case_id = CORE_TEST_ID_MEMORY_PERMISSIONS;
- uint32_t data[4] = {0};
- psa_invec in_vec[] = { {&test_case_id, sizeof(int32_t)},
- {data, sizeof(data)},
- {(void *)((int32_t)tfm_core_test_mpu_access &
- (~(0x3))),
- sizeof(uint32_t)} };
- psa_outvec outvec[] = { {data, sizeof(data)} };
- struct tfm_core_test_call_args_t args = {in_vec, 3, outvec, 1};
-
- err = tfm_core_test_call(tfm_spm_core_test_sfn_veneer, &args);
-
- if (err != CORE_TEST_ERRNO_SUCCESS) {
- char *info = error_to_string(
- "Service memory accesses configured incorrectly.", err);
- TEST_FAIL(info);
- return;
- }
-
- ret->val = TEST_PASSED;
-}
-#endif /* TFM_PSA_API */
-
static void tfm_core_test_buffer_check(struct test_result_t *ret)
{
int32_t res, i;
diff --git a/test/test_services/tfm_core_test/core_test_defs.h b/test/test_services/tfm_core_test/core_test_defs.h
index e2b26c559f..f1e07fbb84 100644
--- a/test/test_services/tfm_core_test/core_test_defs.h
+++ b/test/test_services/tfm_core_test/core_test_defs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -21,8 +21,6 @@ extern "C" {
#define CORE_TEST_ID_NS_THREAD 1001
#define CORE_TEST_ID_CHECK_INIT 1003
#define CORE_TEST_ID_RECURSION 1004
-#define CORE_TEST_ID_MEMORY_PERMISSIONS 1005
-#define CORE_TEST_ID_MPU_ACCESS 1006
#define CORE_TEST_ID_BUFFER_CHECK 1007
#define CORE_TEST_ID_SS_TO_SS 1008
#define CORE_TEST_ID_SS_TO_SS_BUFFER 1010
diff --git a/test/test_services/tfm_core_test/psa_manifest/tfm_test_core.h b/test/test_services/tfm_core_test/psa_manifest/tfm_test_core.h
index 346d0b7987..e4a41a4f70 100644
--- a/test/test_services/tfm_core_test/psa_manifest/tfm_test_core.h
+++ b/test/test_services/tfm_core_test/psa_manifest/tfm_test_core.h
@@ -16,16 +16,14 @@ extern "C" {
#define SPM_CORE_TEST_INIT_SUCCESS_SIGNAL (1U << (0 + 4))
#define SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL (1U << (1 + 4))
-#define SPM_CORE_TEST_MPU_ACCESS_SIGNAL (1U << (2 + 4))
-#define SPM_CORE_TEST_MEMORY_PERMISSIONS_SIGNAL (1U << (3 + 4))
-#define SPM_CORE_TEST_SS_TO_SS_SIGNAL (1U << (4 + 4))
-#define SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL (1U << (5 + 4))
-#define SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL (1U << (6 + 4))
-#define SPM_CORE_TEST_PERIPHERAL_ACCESS_SIGNAL (1U << (7 + 4))
-#define SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL (1U << (8 + 4))
-#define SPM_CORE_TEST_SPM_REQUEST_SIGNAL (1U << (9 + 4))
-#define SPM_CORE_TEST_BLOCK_SIGNAL (1U << (10 + 4))
-#define SPM_CORE_TEST_NS_THREAD_SIGNAL (1U << (11 + 4))
+#define SPM_CORE_TEST_SS_TO_SS_SIGNAL (1U << (2 + 4))
+#define SPM_CORE_TEST_SS_TO_SS_BUFFER_SIGNAL (1U << (3 + 4))
+#define SPM_CORE_TEST_OUTVEC_WRITE_SIGNAL (1U << (4 + 4))
+#define SPM_CORE_TEST_PERIPHERAL_ACCESS_SIGNAL (1U << (5 + 4))
+#define SPM_CORE_TEST_GET_CALLER_CLIENT_ID_SIGNAL (1U << (6 + 4))
+#define SPM_CORE_TEST_SPM_REQUEST_SIGNAL (1U << (7 + 4))
+#define SPM_CORE_TEST_BLOCK_SIGNAL (1U << (8 + 4))
+#define SPM_CORE_TEST_NS_THREAD_SIGNAL (1U << (9 + 4))
#ifdef __cplusplus
}
diff --git a/test/test_services/tfm_core_test/tfm_ss_core_test.c b/test/test_services/tfm_core_test/tfm_ss_core_test.c
index 35f6e65e1a..87d22ed5a8 100644
--- a/test/test_services/tfm_core_test/tfm_ss_core_test.c
+++ b/test/test_services/tfm_core_test/tfm_ss_core_test.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 - 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -113,94 +113,6 @@ psa_status_t spm_core_test_sfn_direct_recursion(
return CORE_TEST_ERRNO_SUCCESS;
}
}
-
-
-/* Service RW data array for testing memory accesses */
-static int32_t mem[4] = {1, 2, 3, 4};
-
-static psa_status_t test_mpu_access(
- uint32_t *data_r_ptr, uint32_t *code_ptr, uint32_t *data_w_ptr)
-{
- /* If these accesses fail, TFM Core kicks in, there's no returning to sfn */
- /* Code execution, stack access is implicitly tested */
- /* Read RW data */
- int32_t len = sizeof(uint32_t);
- int32_t tmp = mem[0];
-
- tmp++;
- /* Write to RW data region */
- mem[0] = mem[1];
- mem[1] = tmp;
- mem[2] = len;
- mem[3] = ~len;
-
- /* Read from NS data region */
- if (tfm_core_memory_permission_check(data_r_ptr, len, TFM_MEMORY_ACCESS_RO)
- != TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_INVALID_BUFFER);
- }
- mem[0] = *data_r_ptr;
-
- /* Write to NS data region */
- if (tfm_core_memory_permission_check(data_w_ptr, len, TFM_MEMORY_ACCESS_RW)
- != TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_INVALID_BUFFER);
- }
- data_w_ptr[0] = mem[0];
- data_w_ptr[1] = len;
-
- /* Read from NS code region */
- if (tfm_core_memory_permission_check(code_ptr, len, TFM_MEMORY_ACCESS_RO)
- != TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_INVALID_BUFFER);
- }
- data_w_ptr[2] = *code_ptr;
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
-
-static psa_status_t test_memory_permissions(
- uint32_t *data_r_ptr, uint32_t *code_ptr, uint32_t *data_w_ptr)
-{
- int32_t len = sizeof(uint32_t);
- /* Read from NS data region */
- if (tfm_core_memory_permission_check(data_r_ptr, len, TFM_MEMORY_ACCESS_RO)
- != TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR);
- }
-
- /* Write to NS data region */
- if (tfm_core_memory_permission_check(data_w_ptr, len, TFM_MEMORY_ACCESS_RW)
- != TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR);
- }
-
- /* Read from NS code region */
- if (tfm_core_memory_permission_check(code_ptr, len, TFM_MEMORY_ACCESS_RO)
- != TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR);
- }
-
- /* Write to NS code region - should be rejected */
- if (tfm_core_memory_permission_check(code_ptr, len, TFM_MEMORY_ACCESS_RW)
- == TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR);
- }
-
- /* NS peripheral region - should be rejected */
- if (tfm_core_memory_permission_check(
- (uint32_t *)0x40000000, len, TFM_MEMORY_ACCESS_RO) == TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR);
- }
-
- /* S peripheral region - should be rejected */
- if (tfm_core_memory_permission_check(
- (uint32_t *)0x50000000, len, TFM_MEMORY_ACCESS_RO) == TFM_SUCCESS) {
- CORE_TEST_RETURN_ERROR(CORE_TEST_ERRNO_UNEXPECTED_CORE_BEHAVIOUR);
- }
-
- return CORE_TEST_ERRNO_SUCCESS;
-}
#endif /* !defined(TFM_PSA_API) */
static psa_status_t test_peripheral_access(void)
@@ -246,16 +158,6 @@ static psa_status_t test_ss_to_ss_buffer(uint32_t *in_ptr, uint32_t *out_ptr,
return CORE_TEST_ERRNO_TEST_FAULT;
}
-#ifndef TFM_PSA_API
- /* Check requires byte-based size */
- if ((tfm_core_memory_permission_check(in_ptr, len << 2,
- TFM_MEMORY_ACCESS_RW) != TFM_SUCCESS) ||
- (tfm_core_memory_permission_check(out_ptr, len << 2,
- TFM_MEMORY_ACCESS_RW) != TFM_SUCCESS)) {
- return CORE_TEST_ERRNO_INVALID_BUFFER;
- }
-#endif /* !defined(TFM_PSA_API) */
-
for (i = 0; i < len; i++) {
ss_buffer[i] = in_ptr[i];
}
@@ -487,30 +389,6 @@ psa_status_t spm_core_test_sfn(struct psa_invec *in_vec, size_t in_len,
tc = *((uint32_t *)in_vec[0].base);
switch (tc) {
- case CORE_TEST_ID_MPU_ACCESS:
- if ((in_len != 3) || (out_len != 1) ||
- (in_vec[1].len < sizeof(int32_t)) ||
- (in_vec[2].len < sizeof(int32_t)) ||
- (out_vec[0].len < 3*sizeof(int32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- arg1 = (int32_t)in_vec[1].base;
- arg2 = (int32_t)in_vec[2].base;
- arg3 = (int32_t)out_vec[0].base;
- return test_mpu_access(
- (uint32_t *)arg1, (uint32_t *)arg2, (uint32_t *)arg3);
- case CORE_TEST_ID_MEMORY_PERMISSIONS:
- if ((in_len != 3) || (out_len != 1) ||
- (in_vec[1].len < sizeof(int32_t)) ||
- (in_vec[2].len < sizeof(int32_t)) ||
- (out_vec[0].len < sizeof(int32_t))) {
- return CORE_TEST_ERRNO_INVALID_PARAMETER;
- }
- arg1 = (int32_t)in_vec[1].base;
- arg2 = (int32_t)in_vec[2].base;
- arg3 = (int32_t)out_vec[0].base;
- return test_memory_permissions(
- (uint32_t *)arg1, (uint32_t *)arg2, (uint32_t *)arg3);
case CORE_TEST_ID_SS_TO_SS:
return test_ss_to_ss();
case CORE_TEST_ID_SS_TO_SS_BUFFER:
@@ -560,16 +438,6 @@ static psa_status_t tfm_core_test_sfn_wrap_direct_recursion(psa_msg_t *msg)
return CORE_TEST_ERRNO_TEST_FAULT;
}
-static psa_status_t tfm_core_test_sfn_wrap_mpu_access(psa_msg_t *msg)
-{
- return CORE_TEST_ERRNO_TEST_NOT_SUPPORTED;
-}
-
-static psa_status_t tfm_core_test_sfn_wrap_memory_permissions(psa_msg_t *msg)
-{
- return CORE_TEST_ERRNO_TEST_NOT_SUPPORTED;
-}
-
static psa_status_t tfm_core_test_sfn_wrap_ss_to_ss(psa_msg_t *msg)
{
return test_ss_to_ss();
@@ -687,12 +555,6 @@ psa_status_t core_test_init(void)
} else if (signals & SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL) {
core_test_signal_handle(SPM_CORE_TEST_DIRECT_RECURSION_SIGNAL,
tfm_core_test_sfn_wrap_direct_recursion);
- } else if (signals & SPM_CORE_TEST_MPU_ACCESS_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_MPU_ACCESS_SIGNAL,
- tfm_core_test_sfn_wrap_mpu_access);
- } else if (signals & SPM_CORE_TEST_MEMORY_PERMISSIONS_SIGNAL) {
- core_test_signal_handle(SPM_CORE_TEST_MEMORY_PERMISSIONS_SIGNAL,
- tfm_core_test_sfn_wrap_memory_permissions);
} else if (signals & SPM_CORE_TEST_SS_TO_SS_SIGNAL) {
core_test_signal_handle(SPM_CORE_TEST_SS_TO_SS_SIGNAL,
tfm_core_test_sfn_wrap_ss_to_ss);
diff --git a/test/test_services/tfm_core_test/tfm_test_core.yaml b/test/test_services/tfm_core_test/tfm_test_core.yaml
index 2127ef2961..a7e6a81a8b 100644
--- a/test/test_services/tfm_core_test/tfm_test_core.yaml
+++ b/test/test_services/tfm_core_test/tfm_test_core.yaml
@@ -57,20 +57,6 @@
"version_policy": "STRICT"
},
{
- "name": "SPM_CORE_TEST_MPU_ACCESS",
- "sid": "0x0000F022",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
- "name": "SPM_CORE_TEST_MEMORY_PERMISSIONS",
- "sid": "0x0000F023",
- "non_secure_clients": true,
- "version": 1,
- "version_policy": "STRICT"
- },
- {
"name": "SPM_CORE_TEST_SS_TO_SS",
"sid": "0x0000F024",
"non_secure_clients": true,
diff --git a/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c b/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c
index b584b933be..d1187569a0 100644
--- a/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c
+++ b/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -142,28 +142,12 @@ static psa_status_t spm_core_test_2_sfn_invert_internal(uint32_t *in_ptr,
int32_t i;
static uint32_t invert_buffer[SFN_INVERT_MAX_LEN];
-#ifndef TFM_PSA_API
- if (tfm_core_memory_permission_check(res_ptr, sizeof(int32_t),
- TFM_MEMORY_ACCESS_RW) != TFM_SUCCESS) {
- return CORE_TEST_ERRNO_INVALID_BUFFER;
- }
-#endif /* !defined(TFM_PSA_API) */
*res_ptr = -1;
if (len > SFN_INVERT_MAX_LEN) {
return CORE_TEST_ERRNO_INVALID_BUFFER;
}
-#ifndef TFM_PSA_API
- /* Check requires byte-based size */
- if ((tfm_core_memory_permission_check(in_ptr, len << 2,
- TFM_MEMORY_ACCESS_RW) != TFM_SUCCESS) ||
- (tfm_core_memory_permission_check(out_ptr, len << 2,
- TFM_MEMORY_ACCESS_RW) != TFM_SUCCESS)) {
- return CORE_TEST_ERRNO_INVALID_BUFFER;
- }
-#endif /* !defined(TFM_PSA_API) */
-
for (i = 0; i < len; i++) {
invert_buffer[i] = in_ptr[i];
}