diff --git a/TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp b/TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp index d2ce680717..7d99bd751f 100644 --- a/TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp +++ b/TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp @@ -24,7 +24,14 @@ #include "unity.h" #include "utest.h" #include "psa/client.h" -#include "psa_client_tests_part1_ifs.h" + +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_CLIENT_TESTS_PART1 +#define USE_CLIENT_TESTS_PART1 +#endif +#include "psa_manifest/sid.h" #if defined(TARGET_TFM) #include "psa/service.h" diff --git a/TESTS/psa/spm_client/TARGET_MBED_SPM/COMPONENT_SPE/psa_client_tests_part1_partition.c b/TESTS/psa/spm_client/TARGET_MBED_SPM/COMPONENT_SPE/psa_client_tests_part1_partition.c index 1c3332eb11..1e814be9e6 100644 --- a/TESTS/psa/spm_client/TARGET_MBED_SPM/COMPONENT_SPE/psa_client_tests_part1_partition.c +++ b/TESTS/psa/spm_client/TARGET_MBED_SPM/COMPONENT_SPE/psa_client_tests_part1_partition.c @@ -29,7 +29,14 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_client_tests_part1_partition.h" -#include "psa_client_tests_part1_ifs.h" + +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_CLIENT_TESTS_PART1 +#define USE_CLIENT_TESTS_PART1 +#endif +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp b/TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp index 65bb311e62..0c0f66bbd3 100644 --- a/TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp +++ b/TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp @@ -24,9 +24,19 @@ #include "unity.h" #include "utest.h" #include "psa/client.h" -#include "psa_server_tests_part1_ifs.h" #include "server_tests.h" +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_SERVER_TESTS_PART1 +#define USE_SERVER_TESTS_PART1 +#endif +#ifndef USE_SERVER_TESTS_PART2 +#define USE_SERVER_TESTS_PART2 +#endif +#include "psa_manifest/sid.h" + #if defined(TARGET_TFM) #include "psa/service.h" #endif diff --git a/TESTS/psa/spm_server/COMPONENT_SPE/tests.c b/TESTS/psa/spm_server/COMPONENT_SPE/tests.c index 382a909b69..3d4079030e 100644 --- a/TESTS/psa/spm_server/COMPONENT_SPE/tests.c +++ b/TESTS/psa/spm_server/COMPONENT_SPE/tests.c @@ -19,9 +19,19 @@ #include "psa/client.h" #include "psa/service.h" #include "psa_server_tests_part1_partition.h" -#include "psa_server_tests_part2_ifs.h" #include "server_tests.h" +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_SERVER_TESTS_PART1 +#define USE_SERVER_TESTS_PART1 +#endif +#ifndef USE_SERVER_TESTS_PART2 +#define USE_SERVER_TESTS_PART2 +#endif +#include "psa_manifest/sid.h" + /** * Process a generic connect message to TEST ROT_SRV. * @return PSA_SUCCESS or negative error code if failed. diff --git a/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part1_partition.c b/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part1_partition.c index 947ae47caf..98339f49d4 100644 --- a/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part1_partition.c +++ b/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part1_partition.c @@ -29,8 +29,17 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_server_tests_part1_partition.h" -#include "psa_server_tests_part1_ifs.h" -#include "psa_server_tests_part2_ifs.h" + +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_SERVER_TESTS_PART1 +#define USE_SERVER_TESTS_PART1 +#endif +#ifndef USE_SERVER_TESTS_PART2 +#define USE_SERVER_TESTS_PART2 +#endif +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part2_partition.c b/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part2_partition.c index 714c1779fe..7cd6a3fcba 100644 --- a/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part2_partition.c +++ b/TESTS/psa/spm_server/TARGET_MBED_SPM/COMPONENT_SPE/psa_server_tests_part2_partition.c @@ -29,7 +29,17 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_server_tests_part2_partition.h" -#include "psa_server_tests_part2_ifs.h" + +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_SERVER_TESTS_PART1 +#define USE_SERVER_TESTS_PART1 +#endif +#ifndef USE_SERVER_TESTS_PART2 +#define USE_SERVER_TESTS_PART2 +#endif +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/TESTS/psa/spm_smoke/COMPONENT_NSPE/main.cpp b/TESTS/psa/spm_smoke/COMPONENT_NSPE/main.cpp index eef5bfa31b..09a6479a38 100644 --- a/TESTS/psa/spm_smoke/COMPONENT_NSPE/main.cpp +++ b/TESTS/psa/spm_smoke/COMPONENT_NSPE/main.cpp @@ -26,7 +26,14 @@ #include "unity.h" #include "utest.h" #include "psa/client.h" -#include "psa_smoke_tests_part1_ifs.h" + +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_SMOKE_TESTS_PART1 +#define USE_SMOKE_TESTS_PART1 +#endif +#include "psa_manifest/sid.h" #if defined(TARGET_TFM) #include "psa/service.h" diff --git a/TESTS/psa/spm_smoke/TARGET_MBED_SPM/COMPONENT_SPE/psa_smoke_tests_part1_partition.c b/TESTS/psa/spm_smoke/TARGET_MBED_SPM/COMPONENT_SPE/psa_smoke_tests_part1_partition.c index 5149fe86f3..2661fe38fc 100644 --- a/TESTS/psa/spm_smoke/TARGET_MBED_SPM/COMPONENT_SPE/psa_smoke_tests_part1_partition.c +++ b/TESTS/psa/spm_smoke/TARGET_MBED_SPM/COMPONENT_SPE/psa_smoke_tests_part1_partition.c @@ -29,7 +29,14 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_smoke_tests_part1_partition.h" -#include "psa_smoke_tests_part1_ifs.h" + +#ifndef USE_PSA_TEST_PARTITIONS +#define USE_PSA_TEST_PARTITIONS +#endif +#ifndef USE_SMOKE_TESTS_PART1 +#define USE_SMOKE_TESTS_PART1 +#endif +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/components/TARGET_PSA/inc/psa_manifest/sid.h b/components/TARGET_PSA/inc/psa_manifest/sid.h new file mode 100644 index 0000000000..486a66b16f --- /dev/null +++ b/components/TARGET_PSA/inc/psa_manifest/sid.h @@ -0,0 +1,71 @@ +/* Copyright (c) 2019 ARM Limited + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*********** WARNING: This is an auto-generated file. Do not edit! ***********/ + +#ifndef SID_H +#define SID_H + +/*************************** Service Partitions ******************************/ + +#define PSA_ITS_GET 0x00011A00 +#define PSA_ITS_SET 0x00011A01 +#define PSA_ITS_INFO 0x00011A02 +#define PSA_ITS_REMOVE 0x00011A03 +#define PSA_ITS_RESET 0x00011A04 +#define PSA_PLATFORM_LC_GET 0x00011000 +#define PSA_PLATFORM_LC_SET 0x00011001 +#define PSA_PLATFORM_SYSTEM_RESET 0x00011002 +#define PSA_CRYPTO_INIT_ID 0x00000F00 +#define PSA_MAC_ID 0x00000F01 +#define PSA_HASH_ID 0x00000F02 +#define PSA_ASYMMETRIC_ID 0x00000F03 +#define PSA_SYMMETRIC_ID 0x00000F04 +#define PSA_AEAD_ID 0x00000F05 +#define PSA_KEY_MNG_ID 0x00000F06 +#define PSA_RNG_ID 0x00000F07 +#define PSA_CRYPTO_FREE_ID 0x00000F08 +#define PSA_GENERATOR_ID 0x00000F09 +#define PSA_ENTROPY_ID 0x00000F0A + +/*************************** Test Partitions *********************************/ + +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CLIENT_TESTS_PART1 +#define PART1_ROT_SRV1 0x00001A05 +#define DROP_CONN 0x00001A06 +#define SECURE_CLIENTS_ONLY 0x00001A07 +#endif + +#ifdef USE_SERVER_TESTS_PART1 +#define CONTROL 0x00001A01 +#define TEST 0x00001A02 +#endif + +#ifdef USE_SERVER_TESTS_PART2 +#define ROT_SRV_REVERSE 0x00001A03 +#define ROT_SRV_DB_TST 0x00001A04 +#endif + +#ifdef USE_SMOKE_TESTS_PART1 +#define ROT_SRV1 0x00001A00 +#endif + +#endif // USE_PSA_TEST_PARTITIONS + +#endif // SID_H diff --git a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c index 79c1cc97d5..6c12142ac4 100644 --- a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c +++ b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c @@ -24,7 +24,7 @@ #include #include -#include "psa_crypto_srv_ifs.h" +#include "psa_manifest/sid.h" #include "psa/client.h" #include "crypto.h" #include "crypto_platform_spe.h" diff --git a/components/TARGET_PSA/services/crypto/TARGET_MBED_SPM/COMPONENT_SPE/psa_crypto_srv_partition.c b/components/TARGET_PSA/services/crypto/TARGET_MBED_SPM/COMPONENT_SPE/psa_crypto_srv_partition.c index b211184d7e..ebe089ffe1 100644 --- a/components/TARGET_PSA/services/crypto/TARGET_MBED_SPM/COMPONENT_SPE/psa_crypto_srv_partition.c +++ b/components/TARGET_PSA/services/crypto/TARGET_MBED_SPM/COMPONENT_SPE/psa_crypto_srv_partition.c @@ -29,8 +29,7 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_crypto_srv_partition.h" -#include "psa_crypto_srv_ifs.h" -#include "psa_its_ifs.h" +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/components/TARGET_PSA/services/platform/COMPONENT_PSA_SRV_IPC/platform_ipc.c b/components/TARGET_PSA/services/platform/COMPONENT_PSA_SRV_IPC/platform_ipc.c index 0309393177..7807c0d11d 100644 --- a/components/TARGET_PSA/services/platform/COMPONENT_PSA_SRV_IPC/platform_ipc.c +++ b/components/TARGET_PSA/services/platform/COMPONENT_PSA_SRV_IPC/platform_ipc.c @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "psa_platform_ifs.h" +#include "psa_manifest/sid.h" #include "psa/lifecycle.h" #include "psa/client.h" #include "mbed_toolchain.h" diff --git a/components/TARGET_PSA/services/platform/TARGET_MBED_SPM/COMPONENT_SPE/psa_platform_partition.c b/components/TARGET_PSA/services/platform/TARGET_MBED_SPM/COMPONENT_SPE/psa_platform_partition.c index 72986f2162..72c124a7ca 100644 --- a/components/TARGET_PSA/services/platform/TARGET_MBED_SPM/COMPONENT_SPE/psa_platform_partition.c +++ b/components/TARGET_PSA/services/platform/TARGET_MBED_SPM/COMPONENT_SPE/psa_platform_partition.c @@ -29,8 +29,7 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_platform_partition.h" -#include "psa_platform_ifs.h" -#include "psa_its_ifs.h" +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/components/TARGET_PSA/services/storage/its/COMPONENT_PSA_SRV_IPC/psa_prot_internal_storage.c b/components/TARGET_PSA/services/storage/its/COMPONENT_PSA_SRV_IPC/psa_prot_internal_storage.c index b8f0ad993d..65f19ac5ea 100644 --- a/components/TARGET_PSA/services/storage/its/COMPONENT_PSA_SRV_IPC/psa_prot_internal_storage.c +++ b/components/TARGET_PSA/services/storage/its/COMPONENT_PSA_SRV_IPC/psa_prot_internal_storage.c @@ -18,7 +18,7 @@ #include "psa/client.h" #include "psa/storage_common.h" #include "psa/internal_trusted_storage.h" -#include "psa_its_ifs.h" +#include "psa_manifest/sid.h" psa_status_t psa_its_set(psa_storage_uid_t uid, uint32_t data_length, const void *p_data, psa_storage_create_flags_t create_flags) { diff --git a/components/TARGET_PSA/services/storage/its/TARGET_MBED_SPM/COMPONENT_SPE/psa_its_partition.c b/components/TARGET_PSA/services/storage/its/TARGET_MBED_SPM/COMPONENT_SPE/psa_its_partition.c index c4122edd6b..484523fb42 100644 --- a/components/TARGET_PSA/services/storage/its/TARGET_MBED_SPM/COMPONENT_SPE/psa_its_partition.c +++ b/components/TARGET_PSA/services/storage/its/TARGET_MBED_SPM/COMPONENT_SPE/psa_its_partition.c @@ -29,7 +29,7 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_its_partition.h" -#include "psa_its_ifs.h" +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/tools/psa/mbed_spm/templates/TARGET_MBED_SPM/COMPONENT_SPE/psa_NAME_partition.c.tpl b/tools/psa/mbed_spm/templates/TARGET_MBED_SPM/COMPONENT_SPE/psa_NAME_partition.c.tpl index 0f262f36f5..ba4a0f77fd 100644 --- a/tools/psa/mbed_spm/templates/TARGET_MBED_SPM/COMPONENT_SPE/psa_NAME_partition.c.tpl +++ b/tools/psa/mbed_spm/templates/TARGET_MBED_SPM/COMPONENT_SPE/psa_NAME_partition.c.tpl @@ -29,10 +29,7 @@ #include "spm_panic.h" #include "spm_internal.h" #include "psa_{{partition.name|lower}}_partition.h" -#include "psa_{{partition.name|lower}}_ifs.h" -{% for partition in dependent_partitions %} -#include "psa_{{partition|lower}}_ifs.h" -{% endfor %} +#include "psa_manifest/sid.h" /* Threads stacks */ diff --git a/tools/psa/tfm/templates/sid.h.tpl b/tools/psa/tfm/templates/sid.h.tpl new file mode 100644 index 0000000000..33d7b8605e --- /dev/null +++ b/tools/psa/tfm/templates/sid.h.tpl @@ -0,0 +1,46 @@ +/* Copyright (c) 2019 ARM Limited + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*********** WARNING: This is an auto-generated file. Do not edit! ***********/ + +#ifndef SID_H +#define SID_H + +/*************************** Service Partitions ******************************/ + +{% for partition in service_partitions %} +{% for rot_srv in partition.rot_services %} +#define {{rot_srv.name|upper}} {{rot_srv.id}} +{% endfor %} +{% endfor %} + +/*************************** Test Partitions *********************************/ + +#ifdef USE_PSA_TEST_PARTITIONS + +{% for partition in test_partitions %} +#ifdef USE_{{partition.name|upper}} +{% for rot_srv in partition.rot_services %} +#define {{rot_srv.name|upper}} {{rot_srv.id}} +{% endfor %} +#endif + +{% endfor %} +#endif // USE_PSA_TEST_PARTITIONS + +#endif // SID_H +{# End of file #} diff --git a/tools/psa/tfm/tfm_generated_file_list.json b/tools/psa/tfm/tfm_generated_file_list.json index ddecfcd997..4765532a3d 100644 --- a/tools/psa/tfm/tfm_generated_file_list.json +++ b/tools/psa/tfm/tfm_generated_file_list.json @@ -15,8 +15,13 @@ "output": "components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/autogen/tfm_service_list.inc" }, { - "name": "Secure Service siganls list", + "name": "Secure Service signals list", "template": "tools/psa/tfm/templates/tfm_spm_signal_defs.h.tpl", "output": "components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/autogen/tfm_spm_signal_defs.h" + }, + { + "name": "Mappings from RoT Service names to SIDs", + "template": "tools/psa/tfm/templates/sid.h.tpl", + "output": "components/TARGET_PSA/inc/psa_manifest/sid.h" } ]