diff --git a/components/TARGET_PSA/TARGET_MBED_SPM/COMPONENT_SPE/psa_setup.c b/components/TARGET_PSA/TARGET_MBED_SPM/COMPONENT_SPE/psa_setup.c new file mode 100644 index 0000000000..3738c7b8fc --- /dev/null +++ b/components/TARGET_PSA/TARGET_MBED_SPM/COMPONENT_SPE/psa_setup.c @@ -0,0 +1,1173 @@ +/* Copyright (c) 2017-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. + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +#include "cmsis.h" +#include "rtx_os.h" + +#include "mbed_toolchain.h" /* For using MBED_ALIGN macro */ + +#include "spm_panic.h" +#include "spm_internal.h" +#include "handles_manager.h" +#include "mbed_spm_partitions.h" + +#include "psa_manifest/sid.h" + +extern spm_db_t g_spm; + +/****************** Service Partitions ****************************************/ + +/* ----------------------------------------------------------------------------- + * ATTEST_SRV declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t attest_srv_thread_stack[8192] = {0}; + +static osRtxThread_t attest_srv_thread_cb = {0}; +static const osThreadAttr_t attest_srv_thread_attr = { + .name = "attest_srv", + .attr_bits = 0, + .cb_mem = &attest_srv_thread_cb, + .cb_size = sizeof(attest_srv_thread_cb), + .stack_mem = attest_srv_thread_stack, + .stack_size = 8192, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t attest_srv_mutex = {0}; +static const osMutexAttr_t attest_srv_mutex_attr = { + .name = "attest_srv_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &attest_srv_mutex, + .cb_size = sizeof(attest_srv_mutex), +}; + +spm_rot_service_t attest_srv_rot_services[] = { + { + .sid = PSA_ATTEST_GET_TOKEN_ID, + .mask = PSA_ATTEST_GET_TOKEN, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ATTEST_GET_TOKEN_SIZE_ID, + .mask = PSA_ATTEST_GET_TOKEN_SIZE, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ATTEST_INJECT_KEY_ID, + .mask = PSA_ATTEST_INJECT_KEY, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +/* External SIDs used by ATTEST_SRV */ +const uint32_t attest_srv_external_sids[7] = { + PSA_CRYPTO_INIT_ID, + PSA_HASH_ID, + PSA_ASYMMETRIC_ID, + PSA_KEY_MNG_ID, + PSA_CRYPTO_FREE_ID, + PSA_KEY_DERIVATION_ID, + PSA_PLATFORM_LC_GET, +}; + +extern void attest_main(void *ptr); + +void attest_srv_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&attest_srv_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition attest_srv!\n"); + } + + for (uint32_t i = 0; i < ATTEST_SRV_ROT_SRV_COUNT; ++i) { + attest_srv_rot_services[i].partition = partition; + } + partition->rot_services = attest_srv_rot_services; + + partition->thread_id = osThreadNew(attest_main, NULL, &attest_srv_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition attest_srv!\n"); + } +} + +/* ----------------------------------------------------------------------------- + * CRYPTO_SRV declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t crypto_srv_thread_stack[16384] = {0}; + +static osRtxThread_t crypto_srv_thread_cb = {0}; +static const osThreadAttr_t crypto_srv_thread_attr = { + .name = "crypto_srv", + .attr_bits = 0, + .cb_mem = &crypto_srv_thread_cb, + .cb_size = sizeof(crypto_srv_thread_cb), + .stack_mem = crypto_srv_thread_stack, + .stack_size = 16384, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t crypto_srv_mutex = {0}; +static const osMutexAttr_t crypto_srv_mutex_attr = { + .name = "crypto_srv_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &crypto_srv_mutex, + .cb_size = sizeof(crypto_srv_mutex), +}; + +spm_rot_service_t crypto_srv_rot_services[] = { + { + .sid = PSA_CRYPTO_INIT_ID, + .mask = PSA_CRYPTO_INIT, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_MAC_ID, + .mask = PSA_MAC, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_HASH_ID, + .mask = PSA_HASH, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ASYMMETRIC_ID, + .mask = PSA_ASYMMETRIC, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_SYMMETRIC_ID, + .mask = PSA_SYMMETRIC, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_AEAD_ID, + .mask = PSA_AEAD, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_KEY_MNG_ID, + .mask = PSA_KEY_MNG, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_RNG_ID, + .mask = PSA_RNG, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_CRYPTO_FREE_ID, + .mask = PSA_CRYPTO_FREE, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_KEY_DERIVATION_ID, + .mask = PSA_KEY_DERIVATION, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ENTROPY_ID, + .mask = PSA_ENTROPY_INJECT, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +/* External SIDs used by CRYPTO_SRV */ +const uint32_t crypto_srv_external_sids[4] = { + PSA_ITS_GET, + PSA_ITS_SET, + PSA_ITS_INFO, + PSA_ITS_REMOVE, +}; + +extern void crypto_main(void *ptr); + +void crypto_srv_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&crypto_srv_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition crypto_srv!\n"); + } + + for (uint32_t i = 0; i < CRYPTO_SRV_ROT_SRV_COUNT; ++i) { + crypto_srv_rot_services[i].partition = partition; + } + partition->rot_services = crypto_srv_rot_services; + + partition->thread_id = osThreadNew(crypto_main, NULL, &crypto_srv_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition crypto_srv!\n"); + } +} + +/* ----------------------------------------------------------------------------- + * PLATFORM declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t platform_thread_stack[1024] = {0}; + +static osRtxThread_t platform_thread_cb = {0}; +static const osThreadAttr_t platform_thread_attr = { + .name = "platform", + .attr_bits = 0, + .cb_mem = &platform_thread_cb, + .cb_size = sizeof(platform_thread_cb), + .stack_mem = platform_thread_stack, + .stack_size = 1024, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t platform_mutex = {0}; +static const osMutexAttr_t platform_mutex_attr = { + .name = "platform_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &platform_mutex, + .cb_size = sizeof(platform_mutex), +}; + +spm_rot_service_t platform_rot_services[] = { + { + .sid = PSA_PLATFORM_LC_GET, + .mask = PSA_PLATFORM_LC_GET_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_PLATFORM_LC_SET, + .mask = PSA_PLATFORM_LC_SET_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_PLATFORM_SYSTEM_RESET, + .mask = PSA_PLATFORM_SYSTEM_RESET_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +/* External SIDs used by PLATFORM */ +const uint32_t platform_external_sids[1] = { + PSA_ITS_RESET, +}; + +extern void platform_partition_entry(void *ptr); + +void platform_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&platform_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition platform!\n"); + } + + for (uint32_t i = 0; i < PLATFORM_ROT_SRV_COUNT; ++i) { + platform_rot_services[i].partition = partition; + } + partition->rot_services = platform_rot_services; + + partition->thread_id = osThreadNew(platform_partition_entry, NULL, &platform_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition platform!\n"); + } +} + +/* ----------------------------------------------------------------------------- + * ITS declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t its_thread_stack[2048] = {0}; + +static osRtxThread_t its_thread_cb = {0}; +static const osThreadAttr_t its_thread_attr = { + .name = "its", + .attr_bits = 0, + .cb_mem = &its_thread_cb, + .cb_size = sizeof(its_thread_cb), + .stack_mem = its_thread_stack, + .stack_size = 2048, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t its_mutex = {0}; +static const osMutexAttr_t its_mutex_attr = { + .name = "its_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &its_mutex, + .cb_size = sizeof(its_mutex), +}; + +spm_rot_service_t its_rot_services[] = { + { + .sid = PSA_ITS_GET, + .mask = PSA_ITS_GET_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ITS_SET, + .mask = PSA_ITS_SET_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ITS_INFO, + .mask = PSA_ITS_INFO_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ITS_REMOVE, + .mask = PSA_ITS_REMOVE_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = PSA_ITS_RESET, + .mask = PSA_ITS_RESET_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = false, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +extern void its_entry(void *ptr); + +void its_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&its_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition its!\n"); + } + + for (uint32_t i = 0; i < ITS_ROT_SRV_COUNT; ++i) { + its_rot_services[i].partition = partition; + } + partition->rot_services = its_rot_services; + + partition->thread_id = osThreadNew(its_entry, NULL, &its_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition its!\n"); + } +} + + +/****************** Test Partitions *******************************************/ +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST +/* ----------------------------------------------------------------------------- + * CRYPTO_ACL_TEST declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t crypto_acl_test_thread_stack[512] = {0}; + +static osRtxThread_t crypto_acl_test_thread_cb = {0}; +static const osThreadAttr_t crypto_acl_test_thread_attr = { + .name = "crypto_acl_test", + .attr_bits = 0, + .cb_mem = &crypto_acl_test_thread_cb, + .cb_size = sizeof(crypto_acl_test_thread_cb), + .stack_mem = crypto_acl_test_thread_stack, + .stack_size = 512, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t crypto_acl_test_mutex = {0}; +static const osMutexAttr_t crypto_acl_test_mutex_attr = { + .name = "crypto_acl_test_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &crypto_acl_test_mutex, + .cb_size = sizeof(crypto_acl_test_mutex), +}; + +spm_rot_service_t crypto_acl_test_rot_services[] = { + { + .sid = CRYPTO_GENERATE_KEY, + .mask = CRYPTO_GENERATE_KEY_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CRYPTO_OPEN_KEY, + .mask = CRYPTO_OPEN_KEY_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CRYPTO_CLOSE_KEY, + .mask = CRYPTO_CLOSE_KEY_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CRYPTO_DESTROY_KEY, + .mask = CRYPTO_DESTROY_KEY_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CRYPTO_GET_KEY_ATTRIBUTES, + .mask = CRYPTO_GET_KEY_ATTRIBUTES_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CRYPTO_IMPORT_KEY, + .mask = CRYPTO_IMPORT_KEY_MSK, + .partition = NULL, + .min_version = 1, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +/* External SIDs used by CRYPTO_ACL_TEST */ +const uint32_t crypto_acl_test_external_sids[1] = { + PSA_KEY_MNG_ID, +}; + +extern void test_partition_main(void *ptr); + +void crypto_acl_test_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&crypto_acl_test_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition crypto_acl_test!\n"); + } + + for (uint32_t i = 0; i < CRYPTO_ACL_TEST_ROT_SRV_COUNT; ++i) { + crypto_acl_test_rot_services[i].partition = partition; + } + partition->rot_services = crypto_acl_test_rot_services; + + partition->thread_id = osThreadNew(test_partition_main, NULL, &crypto_acl_test_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition crypto_acl_test!\n"); + } +} + +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * CLIENT_TESTS_PART1 declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t client_tests_part1_thread_stack[1024] = {0}; + +static osRtxThread_t client_tests_part1_thread_cb = {0}; +static const osThreadAttr_t client_tests_part1_thread_attr = { + .name = "client_tests_part1", + .attr_bits = 0, + .cb_mem = &client_tests_part1_thread_cb, + .cb_size = sizeof(client_tests_part1_thread_cb), + .stack_mem = client_tests_part1_thread_stack, + .stack_size = 1024, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t client_tests_part1_mutex = {0}; +static const osMutexAttr_t client_tests_part1_mutex_attr = { + .name = "client_tests_part1_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &client_tests_part1_mutex, + .cb_size = sizeof(client_tests_part1_mutex), +}; + +spm_rot_service_t client_tests_part1_rot_services[] = { + { + .sid = CLIENT_TESTS_PART1_ROT_SRV1, + .mask = PART1_ROT_SRV1_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CLIENT_TESTS_PART1_DROP_CONN, + .mask = DROP_CONN_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY, + .mask = SECURE_CLIENTS_ONLY_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = false, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +extern void client_part_main(void *ptr); + +void client_tests_part1_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&client_tests_part1_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition client_tests_part1!\n"); + } + + for (uint32_t i = 0; i < CLIENT_TESTS_PART1_ROT_SRV_COUNT; ++i) { + client_tests_part1_rot_services[i].partition = partition; + } + partition->rot_services = client_tests_part1_rot_services; + + partition->thread_id = osThreadNew(client_part_main, NULL, &client_tests_part1_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition client_tests_part1!\n"); + } +} + +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART1 declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t server_tests_part1_thread_stack[1024] = {0}; + +static osRtxThread_t server_tests_part1_thread_cb = {0}; +static const osThreadAttr_t server_tests_part1_thread_attr = { + .name = "server_tests_part1", + .attr_bits = 0, + .cb_mem = &server_tests_part1_thread_cb, + .cb_size = sizeof(server_tests_part1_thread_cb), + .stack_mem = server_tests_part1_thread_stack, + .stack_size = 1024, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t server_tests_part1_mutex = {0}; +static const osMutexAttr_t server_tests_part1_mutex_attr = { + .name = "server_tests_part1_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &server_tests_part1_mutex, + .cb_size = sizeof(server_tests_part1_mutex), +}; + +spm_rot_service_t server_tests_part1_rot_services[] = { + { + .sid = SERVER_TESTS_PART1_CONTROL, + .mask = CONTROL_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = SERVER_TESTS_PART1_TEST, + .mask = TEST_MSK, + .partition = NULL, + .min_version = 12, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +/* External SIDs used by SERVER_TESTS_PART1 */ +const uint32_t server_tests_part1_external_sids[2] = { + SERVER_TESTS_PART2_ROT_SRV_REVERSE, + SERVER_TESTS_PART2_ROT_SRV_DB_TST, +}; + +extern void server_part1_main(void *ptr); + +void server_tests_part1_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&server_tests_part1_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition server_tests_part1!\n"); + } + + for (uint32_t i = 0; i < SERVER_TESTS_PART1_ROT_SRV_COUNT; ++i) { + server_tests_part1_rot_services[i].partition = partition; + } + partition->rot_services = server_tests_part1_rot_services; + + partition->thread_id = osThreadNew(server_part1_main, NULL, &server_tests_part1_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition server_tests_part1!\n"); + } +} + +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART2 declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t server_tests_part2_thread_stack[1024] = {0}; + +static osRtxThread_t server_tests_part2_thread_cb = {0}; +static const osThreadAttr_t server_tests_part2_thread_attr = { + .name = "server_tests_part2", + .attr_bits = 0, + .cb_mem = &server_tests_part2_thread_cb, + .cb_size = sizeof(server_tests_part2_thread_cb), + .stack_mem = server_tests_part2_thread_stack, + .stack_size = 1024, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t server_tests_part2_mutex = {0}; +static const osMutexAttr_t server_tests_part2_mutex_attr = { + .name = "server_tests_part2_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &server_tests_part2_mutex, + .cb_size = sizeof(server_tests_part2_mutex), +}; + +spm_rot_service_t server_tests_part2_rot_services[] = { + { + .sid = SERVER_TESTS_PART2_ROT_SRV_REVERSE, + .mask = ROT_SRV_REVERSE_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = false, + .queue = { + .head = NULL, + .tail = NULL + } + }, + { + .sid = SERVER_TESTS_PART2_ROT_SRV_DB_TST, + .mask = ROT_SRV_DB_TST_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_STRICT, + .allow_nspe = false, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +extern void server_part2_main(void *ptr); + +void server_tests_part2_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&server_tests_part2_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition server_tests_part2!\n"); + } + + for (uint32_t i = 0; i < SERVER_TESTS_PART2_ROT_SRV_COUNT; ++i) { + server_tests_part2_rot_services[i].partition = partition; + } + partition->rot_services = server_tests_part2_rot_services; + + partition->thread_id = osThreadNew(server_part2_main, NULL, &server_tests_part2_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition server_tests_part2!\n"); + } +} + +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SMOKE_TESTS_PART1 declarations + * -------------------------------------------------------------------------- */ +MBED_ALIGN(8) static uint8_t smoke_tests_part1_thread_stack[512] = {0}; + +static osRtxThread_t smoke_tests_part1_thread_cb = {0}; +static const osThreadAttr_t smoke_tests_part1_thread_attr = { + .name = "smoke_tests_part1", + .attr_bits = 0, + .cb_mem = &smoke_tests_part1_thread_cb, + .cb_size = sizeof(smoke_tests_part1_thread_cb), + .stack_mem = smoke_tests_part1_thread_stack, + .stack_size = 512, + .priority = osPriorityNormal, + .tz_module = 0, + .reserved = 0 +}; + +static osRtxMutex_t smoke_tests_part1_mutex = {0}; +static const osMutexAttr_t smoke_tests_part1_mutex_attr = { + .name = "smoke_tests_part1_mutex", + .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust, + .cb_mem = &smoke_tests_part1_mutex, + .cb_size = sizeof(smoke_tests_part1_mutex), +}; + +spm_rot_service_t smoke_tests_part1_rot_services[] = { + { + .sid = SMOKE_TESTS_PART1_ROT_SRV1, + .mask = ROT_SRV1_MSK, + .partition = NULL, + .min_version = 5, + .min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED, + .allow_nspe = true, + .queue = { + .head = NULL, + .tail = NULL + } + }, +}; + +extern void smoke_part_main(void *ptr); + +void smoke_tests_part1_init(spm_partition_t *partition) +{ + if (NULL == partition) { + SPM_PANIC("partition is NULL!\n"); + } + + partition->mutex = osMutexNew(&smoke_tests_part1_mutex_attr); + if (NULL == partition->mutex) { + SPM_PANIC("Failed to create mutex for secure partition smoke_tests_part1!\n"); + } + + for (uint32_t i = 0; i < SMOKE_TESTS_PART1_ROT_SRV_COUNT; ++i) { + smoke_tests_part1_rot_services[i].partition = partition; + } + partition->rot_services = smoke_tests_part1_rot_services; + + partition->thread_id = osThreadNew(smoke_part_main, NULL, &smoke_tests_part1_thread_attr); + if (NULL == partition->thread_id) { + SPM_PANIC("Failed to create start main thread of partition smoke_tests_part1!\n"); + } +} + +#endif // USE_SMOKE_TESTS_PART1 + +#endif // USE_PSA_TEST_PARTITIONS + +/****************** SPM DB initialization *************************************/ +spm_partition_t g_partitions[] = { + /* ATTEST_SRV */ + { + .partition_id = ATTEST_SRV_ID, + .thread_id = 0, + .flags = ATTEST_SRV_WAIT_ANY_SID_MSK | ATTEST_SRV_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = ATTEST_SRV_ROT_SRV_COUNT, + .extern_sids = attest_srv_external_sids, + .extern_sids_count = ATTEST_SRV_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, + + /* CRYPTO_SRV */ + { + .partition_id = CRYPTO_SRV_ID, + .thread_id = 0, + .flags = CRYPTO_SRV_WAIT_ANY_SID_MSK | CRYPTO_SRV_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = CRYPTO_SRV_ROT_SRV_COUNT, + .extern_sids = crypto_srv_external_sids, + .extern_sids_count = CRYPTO_SRV_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, + + /* PLATFORM */ + { + .partition_id = PLATFORM_ID, + .thread_id = 0, + .flags = PLATFORM_WAIT_ANY_SID_MSK | PLATFORM_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = PLATFORM_ROT_SRV_COUNT, + .extern_sids = platform_external_sids, + .extern_sids_count = PLATFORM_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, + + /* ITS */ + { + .partition_id = ITS_ID, + .thread_id = 0, + .flags = ITS_WAIT_ANY_SID_MSK | ITS_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = ITS_ROT_SRV_COUNT, + .extern_sids = NULL, + .extern_sids_count = ITS_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, + +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST /* CRYPTO_ACL_TEST */ + { + .partition_id = CRYPTO_ACL_TEST_ID, + .thread_id = 0, + .flags = CRYPTO_ACL_TEST_WAIT_ANY_SID_MSK | CRYPTO_ACL_TEST_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = CRYPTO_ACL_TEST_ROT_SRV_COUNT, + .extern_sids = crypto_acl_test_external_sids, + .extern_sids_count = CRYPTO_ACL_TEST_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 /* CLIENT_TESTS_PART1 */ + { + .partition_id = CLIENT_TESTS_PART1_ID, + .thread_id = 0, + .flags = CLIENT_TESTS_PART1_WAIT_ANY_SID_MSK | CLIENT_TESTS_PART1_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = CLIENT_TESTS_PART1_ROT_SRV_COUNT, + .extern_sids = NULL, + .extern_sids_count = CLIENT_TESTS_PART1_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 /* SERVER_TESTS_PART1 */ + { + .partition_id = SERVER_TESTS_PART1_ID, + .thread_id = 0, + .flags = SERVER_TESTS_PART1_WAIT_ANY_SID_MSK | SERVER_TESTS_PART1_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = SERVER_TESTS_PART1_ROT_SRV_COUNT, + .extern_sids = server_tests_part1_external_sids, + .extern_sids_count = SERVER_TESTS_PART1_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 /* SERVER_TESTS_PART2 */ + { + .partition_id = SERVER_TESTS_PART2_ID, + .thread_id = 0, + .flags = SERVER_TESTS_PART2_WAIT_ANY_SID_MSK | SERVER_TESTS_PART2_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = SERVER_TESTS_PART2_ROT_SRV_COUNT, + .extern_sids = NULL, + .extern_sids_count = SERVER_TESTS_PART2_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 /* SMOKE_TESTS_PART1 */ + { + .partition_id = SMOKE_TESTS_PART1_ID, + .thread_id = 0, + .flags = SMOKE_TESTS_PART1_WAIT_ANY_SID_MSK | SMOKE_TESTS_PART1_WAIT_ANY_IRQ_MSK, + .rot_services = NULL, + .rot_services_count = SMOKE_TESTS_PART1_ROT_SRV_COUNT, + .extern_sids = NULL, + .extern_sids_count = SMOKE_TESTS_PART1_EXT_ROT_SRV_COUNT, + .irq_mapper = NULL, + }, +#endif // USE_SMOKE_TESTS_PART1 + +#endif // USE_PSA_TEST_PARTITIONS + +}; + +/****************** MMIO regions **********************************************/ +const mem_region_t *mem_regions = NULL; +const uint32_t mem_region_count = 0; + +/****************** Partitions init function *********************************/ +uint32_t init_partitions(spm_partition_t **partitions) +{ + uint32_t partition_idx = 0; + + if (NULL == partitions) { + SPM_PANIC("partitions is NULL!\n"); + } + + attest_srv_init(&(g_partitions[partition_idx++])); + crypto_srv_init(&(g_partitions[partition_idx++])); + platform_init(&(g_partitions[partition_idx++])); + its_init(&(g_partitions[partition_idx++])); + +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST + crypto_acl_test_init(&(g_partitions[partition_idx++])); +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 + client_tests_part1_init(&(g_partitions[partition_idx++])); +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 + server_tests_part1_init(&(g_partitions[partition_idx++])); +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 + server_tests_part2_init(&(g_partitions[partition_idx++])); +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 + smoke_tests_part1_init(&(g_partitions[partition_idx++])); +#endif // USE_SMOKE_TESTS_PART1 + +#endif // USE_PSA_TEST_PARTITIONS + + *partitions = g_partitions; + return partition_idx; +} + diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_defs.inc b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_defs.inc new file mode 100644 index 0000000000..042c2a97f8 --- /dev/null +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_defs.inc @@ -0,0 +1,68 @@ +/* Copyright (c) 2017-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. + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +#ifndef __TFM_PARTITION_DEFS_INC__ +#define __TFM_PARTITION_DEFS_INC__ + +/*************************** Service Partitions *******************************/ + +#define ATTEST_SRV_ID (TFM_SP_BASE + 0) +#define CRYPTO_SRV_ID (TFM_SP_BASE + 1) +#define PLATFORM_ID (TFM_SP_BASE + 2) +#define ITS_ID (TFM_SP_BASE + 3) + +/*************************** Test Partitions **********************************/ + +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST +#define CRYPTO_ACL_TEST_ID (TFM_SP_BASE + 4 + 0) +#endif + +#ifdef USE_CLIENT_TESTS_PART1 +#define CLIENT_TESTS_PART1_ID (TFM_SP_BASE + 4 + 1) +#endif + +#ifdef USE_SERVER_TESTS_PART1 +#define SERVER_TESTS_PART1_ID (TFM_SP_BASE + 4 + 2) +#endif + +#ifdef USE_SERVER_TESTS_PART2 +#define SERVER_TESTS_PART2_ID (TFM_SP_BASE + 4 + 3) +#endif + +#ifdef USE_SMOKE_TESTS_PART1 +#define SMOKE_TESTS_PART1_ID (TFM_SP_BASE + 4 + 4) +#endif + +#endif // USE_PSA_TEST_PARTITIONS + +#ifdef USE_PSA_TEST_PARTITIONS +#define TFM_MAX_USER_PARTITIONS (4 + 5) +#else +#define TFM_MAX_USER_PARTITIONS (4) +#endif + +#endif // __TFM_PARTITION_DEFS_INC__ diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_list.inc b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_list.inc new file mode 100644 index 0000000000..2a66f265ab --- /dev/null +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_list.inc @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +#ifndef __TFM_PARTITION_LIST_INC__ +#define __TFM_PARTITION_LIST_INC__ + +/*************************** Service Partitions *******************************/ +/* ----------------------------------------------------------------------------- + * ATTEST_SRV + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(ATTEST_SRV, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 37, NORMAL, 8192); +PARTITION_ADD_INIT_FUNC(ATTEST_SRV, attest_main); + +/* ----------------------------------------------------------------------------- + * CRYPTO_SRV + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(CRYPTO_SRV, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 35, NORMAL, 16384); +PARTITION_ADD_INIT_FUNC(CRYPTO_SRV, crypto_main); + +/* ----------------------------------------------------------------------------- + * PLATFORM + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(PLATFORM, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 8, NORMAL, 1024); +PARTITION_ADD_INIT_FUNC(PLATFORM, platform_partition_entry); + +/* ----------------------------------------------------------------------------- + * ITS + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(ITS, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 10, NORMAL, 2048); +PARTITION_ADD_INIT_FUNC(ITS, its_entry); + +/*************************** Test Partitions **********************************/ +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST +/* ----------------------------------------------------------------------------- + * CRYPTO_ACL_TEST + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(CRYPTO_ACL_TEST, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 128, NORMAL, 512); +PARTITION_ADD_INIT_FUNC(CRYPTO_ACL_TEST, test_partition_main); +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * CLIENT_TESTS_PART1 + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(CLIENT_TESTS_PART1, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 1, NORMAL, 1024); +PARTITION_ADD_INIT_FUNC(CLIENT_TESTS_PART1, client_part_main); +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART1 + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(SERVER_TESTS_PART1, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 2, NORMAL, 1024); +PARTITION_ADD_INIT_FUNC(SERVER_TESTS_PART1, server_part1_main); +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART2 + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(SERVER_TESTS_PART2, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 3, NORMAL, 1024); +PARTITION_ADD_INIT_FUNC(SERVER_TESTS_PART2, server_part2_main); +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SMOKE_TESTS_PART1 + * -------------------------------------------------------------------------- */ +PARTITION_DECLARE(SMOKE_TESTS_PART1, 0 + | SPM_PART_FLAG_IPC + , "APPLICATION-ROT", 4, NORMAL, 512); +PARTITION_ADD_INIT_FUNC(SMOKE_TESTS_PART1, smoke_part_main); +#endif // USE_SMOKE_TESTS_PART1 + +#endif // USE_PSA_TEST_PARTITIONS + +#endif // __TFM_PARTITION_LIST_INC__ diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_service_list.inc b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_service_list.inc new file mode 100644 index 0000000000..6373268cfe --- /dev/null +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_service_list.inc @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +#ifndef __TFM_SERVICE_LIST_INC__ +#define __TFM_SERVICE_LIST_INC__ + +/*************************** Service Partitions *******************************/ +/* ----------------------------------------------------------------------------- + * ATTEST_SRV Services + * -------------------------------------------------------------------------- */ +{"PSA_ATTEST_GET_TOKEN_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN, 0x00000F10, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_ATTEST_GET_TOKEN_SIZE_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN_SIZE, 0x00000F11, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_ATTEST_INJECT_KEY_ID", ATTEST_SRV_ID, PSA_ATTEST_INJECT_KEY, 0x00000F12, true, 1, TFM_VERSION_POLICY_STRICT}, + +/* ----------------------------------------------------------------------------- + * CRYPTO_SRV Services + * -------------------------------------------------------------------------- */ +{"PSA_CRYPTO_INIT_ID", CRYPTO_SRV_ID, PSA_CRYPTO_INIT, 0x00000F00, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_MAC_ID", CRYPTO_SRV_ID, PSA_MAC, 0x00000F01, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_HASH_ID", CRYPTO_SRV_ID, PSA_HASH, 0x00000F02, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_ASYMMETRIC_ID", CRYPTO_SRV_ID, PSA_ASYMMETRIC, 0x00000F03, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_SYMMETRIC_ID", CRYPTO_SRV_ID, PSA_SYMMETRIC, 0x00000F04, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_AEAD_ID", CRYPTO_SRV_ID, PSA_AEAD, 0x00000F05, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_KEY_MNG_ID", CRYPTO_SRV_ID, PSA_KEY_MNG, 0x00000F06, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_RNG_ID", CRYPTO_SRV_ID, PSA_RNG, 0x00000F07, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_CRYPTO_FREE_ID", CRYPTO_SRV_ID, PSA_CRYPTO_FREE, 0x00000F08, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_KEY_DERIVATION_ID", CRYPTO_SRV_ID, PSA_KEY_DERIVATION, 0x00000F09, true, 1, TFM_VERSION_POLICY_STRICT}, +{"PSA_ENTROPY_ID", CRYPTO_SRV_ID, PSA_ENTROPY_INJECT, 0x00000F0A, true, 1, TFM_VERSION_POLICY_STRICT}, + +/* ----------------------------------------------------------------------------- + * PLATFORM Services + * -------------------------------------------------------------------------- */ +{"PSA_PLATFORM_LC_GET", PLATFORM_ID, PSA_PLATFORM_LC_GET_MSK, 0x00011000, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"PSA_PLATFORM_LC_SET", PLATFORM_ID, PSA_PLATFORM_LC_SET_MSK, 0x00011001, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"PSA_PLATFORM_SYSTEM_RESET", PLATFORM_ID, PSA_PLATFORM_SYSTEM_RESET_MSK, 0x00011002, true, 1, TFM_VERSION_POLICY_RELAXED}, + +/* ----------------------------------------------------------------------------- + * ITS Services + * -------------------------------------------------------------------------- */ +{"PSA_ITS_GET", ITS_ID, PSA_ITS_GET_MSK, 0x00011A00, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"PSA_ITS_SET", ITS_ID, PSA_ITS_SET_MSK, 0x00011A01, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"PSA_ITS_INFO", ITS_ID, PSA_ITS_INFO_MSK, 0x00011A02, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"PSA_ITS_REMOVE", ITS_ID, PSA_ITS_REMOVE_MSK, 0x00011A03, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"PSA_ITS_RESET", ITS_ID, PSA_ITS_RESET_MSK, 0x00011A04, false, 1, TFM_VERSION_POLICY_RELAXED}, + +/*************************** Test Partitions **********************************/ +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST +/* ----------------------------------------------------------------------------- + * CRYPTO_ACL_TEST Services + * -------------------------------------------------------------------------- */ +{"CRYPTO_GENERATE_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_GENERATE_KEY_MSK, 0x00000201, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"CRYPTO_OPEN_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_OPEN_KEY_MSK, 0x00000202, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"CRYPTO_CLOSE_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_CLOSE_KEY_MSK, 0x00000203, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"CRYPTO_DESTROY_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_DESTROY_KEY_MSK, 0x00000205, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"CRYPTO_GET_KEY_ATTRIBUTES", CRYPTO_ACL_TEST_ID, CRYPTO_GET_KEY_ATTRIBUTES_MSK, 0x00000206, true, 1, TFM_VERSION_POLICY_RELAXED}, +{"CRYPTO_IMPORT_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_IMPORT_KEY_MSK, 0x00000208, true, 1, TFM_VERSION_POLICY_RELAXED}, +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * CLIENT_TESTS_PART1 Services + * -------------------------------------------------------------------------- */ +{"CLIENT_TESTS_PART1_ROT_SRV1", CLIENT_TESTS_PART1_ID, PART1_ROT_SRV1_MSK, 0x00001A05, true, 5, TFM_VERSION_POLICY_RELAXED}, +{"CLIENT_TESTS_PART1_DROP_CONN", CLIENT_TESTS_PART1_ID, DROP_CONN_MSK, 0x00001A06, true, 5, TFM_VERSION_POLICY_RELAXED}, +{"CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY", CLIENT_TESTS_PART1_ID, SECURE_CLIENTS_ONLY_MSK, 0x00001A07, false, 5, TFM_VERSION_POLICY_RELAXED}, +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART1 Services + * -------------------------------------------------------------------------- */ +{"SERVER_TESTS_PART1_CONTROL", SERVER_TESTS_PART1_ID, CONTROL_MSK, 0x00001A01, true, 5, TFM_VERSION_POLICY_RELAXED}, +{"SERVER_TESTS_PART1_TEST", SERVER_TESTS_PART1_ID, TEST_MSK, 0x00001A02, true, 12, TFM_VERSION_POLICY_STRICT}, +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART2 Services + * -------------------------------------------------------------------------- */ +{"SERVER_TESTS_PART2_ROT_SRV_REVERSE", SERVER_TESTS_PART2_ID, ROT_SRV_REVERSE_MSK, 0x00001A03, false, 5, TFM_VERSION_POLICY_STRICT}, +{"SERVER_TESTS_PART2_ROT_SRV_DB_TST", SERVER_TESTS_PART2_ID, ROT_SRV_DB_TST_MSK, 0x00001A04, false, 5, TFM_VERSION_POLICY_STRICT}, +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SMOKE_TESTS_PART1 Services + * -------------------------------------------------------------------------- */ +{"SMOKE_TESTS_PART1_ROT_SRV1", SMOKE_TESTS_PART1_ID, ROT_SRV1_MSK, 0x00001A00, true, 5, TFM_VERSION_POLICY_RELAXED}, +#endif // USE_SMOKE_TESTS_PART1 + +#endif // USE_PSA_TEST_PARTITIONS + +#endif // __TFM_SERVICE_LIST_INC__ diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_spm_signal_defs.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_spm_signal_defs.h new file mode 100644 index 0000000000..e41c52d073 --- /dev/null +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/inc/tfm_spm_signal_defs.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +#ifndef __TFM_SPM_SIGNAL_DEFS_H__ +#define __TFM_SPM_SIGNAL_DEFS_H__ + +/*************************** Service Partitions *******************************/ +/* ----------------------------------------------------------------------------- + * ATTEST_SRV Signals + * -------------------------------------------------------------------------- */ +#define PSA_ATTEST_GET_TOKEN_POS (4UL) +#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS) +#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL) +#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS) +#define PSA_ATTEST_INJECT_KEY_POS (6UL) +#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS) + +/* ----------------------------------------------------------------------------- + * CRYPTO_SRV Signals + * -------------------------------------------------------------------------- */ +#define PSA_CRYPTO_INIT_POS (4UL) +#define PSA_CRYPTO_INIT (1UL << PSA_CRYPTO_INIT_POS) +#define PSA_MAC_POS (5UL) +#define PSA_MAC (1UL << PSA_MAC_POS) +#define PSA_HASH_POS (6UL) +#define PSA_HASH (1UL << PSA_HASH_POS) +#define PSA_ASYMMETRIC_POS (7UL) +#define PSA_ASYMMETRIC (1UL << PSA_ASYMMETRIC_POS) +#define PSA_SYMMETRIC_POS (8UL) +#define PSA_SYMMETRIC (1UL << PSA_SYMMETRIC_POS) +#define PSA_AEAD_POS (9UL) +#define PSA_AEAD (1UL << PSA_AEAD_POS) +#define PSA_KEY_MNG_POS (10UL) +#define PSA_KEY_MNG (1UL << PSA_KEY_MNG_POS) +#define PSA_RNG_POS (11UL) +#define PSA_RNG (1UL << PSA_RNG_POS) +#define PSA_CRYPTO_FREE_POS (12UL) +#define PSA_CRYPTO_FREE (1UL << PSA_CRYPTO_FREE_POS) +#define PSA_KEY_DERIVATION_POS (13UL) +#define PSA_KEY_DERIVATION (1UL << PSA_KEY_DERIVATION_POS) +#define PSA_ENTROPY_INJECT_POS (14UL) +#define PSA_ENTROPY_INJECT (1UL << PSA_ENTROPY_INJECT_POS) + +/* ----------------------------------------------------------------------------- + * PLATFORM Signals + * -------------------------------------------------------------------------- */ +#define PSA_PLATFORM_LC_GET_MSK_POS (4UL) +#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS) +#define PSA_PLATFORM_LC_SET_MSK_POS (5UL) +#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS) +#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL) +#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS) + +/* ----------------------------------------------------------------------------- + * ITS Signals + * -------------------------------------------------------------------------- */ +#define PSA_ITS_GET_MSK_POS (4UL) +#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS) +#define PSA_ITS_SET_MSK_POS (5UL) +#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS) +#define PSA_ITS_INFO_MSK_POS (6UL) +#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS) +#define PSA_ITS_REMOVE_MSK_POS (7UL) +#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS) +#define PSA_ITS_RESET_MSK_POS (8UL) +#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS) + +/*************************** Test Partitions **********************************/ +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST +/* ----------------------------------------------------------------------------- + * CRYPTO_ACL_TEST Signals + * -------------------------------------------------------------------------- */ +#define CRYPTO_GENERATE_KEY_MSK_POS (4UL) +#define CRYPTO_GENERATE_KEY_MSK (1UL << CRYPTO_GENERATE_KEY_MSK_POS) +#define CRYPTO_OPEN_KEY_MSK_POS (5UL) +#define CRYPTO_OPEN_KEY_MSK (1UL << CRYPTO_OPEN_KEY_MSK_POS) +#define CRYPTO_CLOSE_KEY_MSK_POS (6UL) +#define CRYPTO_CLOSE_KEY_MSK (1UL << CRYPTO_CLOSE_KEY_MSK_POS) +#define CRYPTO_DESTROY_KEY_MSK_POS (7UL) +#define CRYPTO_DESTROY_KEY_MSK (1UL << CRYPTO_DESTROY_KEY_MSK_POS) +#define CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS (8UL) +#define CRYPTO_GET_KEY_ATTRIBUTES_MSK (1UL << CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS) +#define CRYPTO_IMPORT_KEY_MSK_POS (9UL) +#define CRYPTO_IMPORT_KEY_MSK (1UL << CRYPTO_IMPORT_KEY_MSK_POS) +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * CLIENT_TESTS_PART1 Signals + * -------------------------------------------------------------------------- */ +#define PART1_ROT_SRV1_MSK_POS (4UL) +#define PART1_ROT_SRV1_MSK (1UL << PART1_ROT_SRV1_MSK_POS) +#define DROP_CONN_MSK_POS (5UL) +#define DROP_CONN_MSK (1UL << DROP_CONN_MSK_POS) +#define SECURE_CLIENTS_ONLY_MSK_POS (6UL) +#define SECURE_CLIENTS_ONLY_MSK (1UL << SECURE_CLIENTS_ONLY_MSK_POS) +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART1 Signals + * -------------------------------------------------------------------------- */ +#define CONTROL_MSK_POS (4UL) +#define CONTROL_MSK (1UL << CONTROL_MSK_POS) +#define TEST_MSK_POS (5UL) +#define TEST_MSK (1UL << TEST_MSK_POS) +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART2 Signals + * -------------------------------------------------------------------------- */ +#define ROT_SRV_REVERSE_MSK_POS (4UL) +#define ROT_SRV_REVERSE_MSK (1UL << ROT_SRV_REVERSE_MSK_POS) +#define ROT_SRV_DB_TST_MSK_POS (5UL) +#define ROT_SRV_DB_TST_MSK (1UL << ROT_SRV_DB_TST_MSK_POS) +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SMOKE_TESTS_PART1 Signals + * -------------------------------------------------------------------------- */ +#define ROT_SRV1_MSK_POS (4UL) +#define ROT_SRV1_MSK (1UL << ROT_SRV1_MSK_POS) +#endif // USE_SMOKE_TESTS_PART1 + +#endif // USE_PSA_TEST_PARTITIONS + +#endif // __TFM_SPM_SIGNAL_DEFS_H__ diff --git a/components/TARGET_PSA/services/inc/autogen_sid.h b/components/TARGET_PSA/services/inc/autogen_sid.h new file mode 100644 index 0000000000..c4fecf5c93 --- /dev/null +++ b/components/TARGET_PSA/services/inc/autogen_sid.h @@ -0,0 +1,110 @@ +/* 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. + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +/****************** Service Partitions ****************************************/ + +/* ----------------------------------------------------------------------------- + * ATTEST_SRV Service IDs + * -------------------------------------------------------------------------- */ + +#define PSA_ATTEST_GET_TOKEN_ID 0x00000F10 +#define PSA_ATTEST_GET_TOKEN_SIZE_ID 0x00000F11 +#define PSA_ATTEST_INJECT_KEY_ID 0x00000F12 + +/* ----------------------------------------------------------------------------- + * CRYPTO_SRV Service IDs + * -------------------------------------------------------------------------- */ + +#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_KEY_DERIVATION_ID 0x00000F09 +#define PSA_ENTROPY_ID 0x00000F0A + +/* ----------------------------------------------------------------------------- + * PLATFORM Service IDs + * -------------------------------------------------------------------------- */ + +#define PSA_PLATFORM_LC_GET 0x00011000 +#define PSA_PLATFORM_LC_SET 0x00011001 +#define PSA_PLATFORM_SYSTEM_RESET 0x00011002 + +/* ----------------------------------------------------------------------------- + * ITS Service IDs + * -------------------------------------------------------------------------- */ + +#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 + +/****************** Test Partitions *******************************************/ + +/* ----------------------------------------------------------------------------- + * CRYPTO_ACL_TEST Service IDs + * -------------------------------------------------------------------------- */ + +#define CRYPTO_GENERATE_KEY 0x00000201 +#define CRYPTO_OPEN_KEY 0x00000202 +#define CRYPTO_CLOSE_KEY 0x00000203 +#define CRYPTO_DESTROY_KEY 0x00000205 +#define CRYPTO_GET_KEY_ATTRIBUTES 0x00000206 +#define CRYPTO_IMPORT_KEY 0x00000208 + +/* ----------------------------------------------------------------------------- + * CLIENT_TESTS_PART1 Service IDs + * -------------------------------------------------------------------------- */ + +#define CLIENT_TESTS_PART1_ROT_SRV1 0x00001A05 +#define CLIENT_TESTS_PART1_DROP_CONN 0x00001A06 +#define CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY 0x00001A07 + +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART1 Service IDs + * -------------------------------------------------------------------------- */ + +#define SERVER_TESTS_PART1_CONTROL 0x00001A01 +#define SERVER_TESTS_PART1_TEST 0x00001A02 + +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART2 Service IDs + * -------------------------------------------------------------------------- */ + +#define SERVER_TESTS_PART2_ROT_SRV_REVERSE 0x00001A03 +#define SERVER_TESTS_PART2_ROT_SRV_DB_TST 0x00001A04 + +/* ----------------------------------------------------------------------------- + * SMOKE_TESTS_PART1 Service IDs + * -------------------------------------------------------------------------- */ + +#define SMOKE_TESTS_PART1_ROT_SRV1 0x00001A00 + diff --git a/components/TARGET_PSA/services/inc/mbed_spm_partitions.h b/components/TARGET_PSA/services/inc/mbed_spm_partitions.h new file mode 100644 index 0000000000..5d9c137f86 --- /dev/null +++ b/components/TARGET_PSA/services/inc/mbed_spm_partitions.h @@ -0,0 +1,307 @@ +/* Copyright (c) 2017-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. + */ + +/******************************************************************************* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT. + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * Template Version 1.0 + * Generated by tools/psa/generate_partition_code.py Version 1.1 + ******************************************************************************/ + +#ifndef __MBED_SPM_PARTITIONS_H___ +#define __MBED_SPM_PARTITIONS_H___ + + +/****************** Common definitions ****************************************/ + +/* PSA reserved event flags */ +#define PSA_RESERVED1_POS (1UL) +#define PSA_RESERVED1_MSK (1UL << PSA_RESERVED1_POS) + +#define PSA_RESERVED2_POS (2UL) +#define PSA_RESERVED2_MSK (1UL << PSA_RESERVED2_POS) + +/****************** Service Partitions ****************************************/ + +/* ----------------------------------------------------------------------------- + * ATTEST_SRV defines + * -------------------------------------------------------------------------- */ +#define ATTEST_SRV_ID 37 + +#define ATTEST_SRV_ROT_SRV_COUNT (3UL) +#define ATTEST_SRV_EXT_ROT_SRV_COUNT (7UL) + + +#define ATTEST_SRV_WAIT_ANY_IRQ_MSK (0) + +#define PSA_ATTEST_GET_TOKEN_POS (4UL) +#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS) +#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL) +#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS) +#define PSA_ATTEST_INJECT_KEY_POS (6UL) +#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS) + +#define ATTEST_SRV_WAIT_ANY_SID_MSK (\ + PSA_ATTEST_GET_TOKEN | \ + PSA_ATTEST_GET_TOKEN_SIZE | \ + PSA_ATTEST_INJECT_KEY) + + +/* ----------------------------------------------------------------------------- + * CRYPTO_SRV defines + * -------------------------------------------------------------------------- */ +#define CRYPTO_SRV_ID 35 + +#define CRYPTO_SRV_ROT_SRV_COUNT (11UL) +#define CRYPTO_SRV_EXT_ROT_SRV_COUNT (4UL) + + +#define CRYPTO_SRV_WAIT_ANY_IRQ_MSK (0) + +#define PSA_CRYPTO_INIT_POS (4UL) +#define PSA_CRYPTO_INIT (1UL << PSA_CRYPTO_INIT_POS) +#define PSA_MAC_POS (5UL) +#define PSA_MAC (1UL << PSA_MAC_POS) +#define PSA_HASH_POS (6UL) +#define PSA_HASH (1UL << PSA_HASH_POS) +#define PSA_ASYMMETRIC_POS (7UL) +#define PSA_ASYMMETRIC (1UL << PSA_ASYMMETRIC_POS) +#define PSA_SYMMETRIC_POS (8UL) +#define PSA_SYMMETRIC (1UL << PSA_SYMMETRIC_POS) +#define PSA_AEAD_POS (9UL) +#define PSA_AEAD (1UL << PSA_AEAD_POS) +#define PSA_KEY_MNG_POS (10UL) +#define PSA_KEY_MNG (1UL << PSA_KEY_MNG_POS) +#define PSA_RNG_POS (11UL) +#define PSA_RNG (1UL << PSA_RNG_POS) +#define PSA_CRYPTO_FREE_POS (12UL) +#define PSA_CRYPTO_FREE (1UL << PSA_CRYPTO_FREE_POS) +#define PSA_KEY_DERIVATION_POS (13UL) +#define PSA_KEY_DERIVATION (1UL << PSA_KEY_DERIVATION_POS) +#define PSA_ENTROPY_INJECT_POS (14UL) +#define PSA_ENTROPY_INJECT (1UL << PSA_ENTROPY_INJECT_POS) + +#define CRYPTO_SRV_WAIT_ANY_SID_MSK (\ + PSA_CRYPTO_INIT | \ + PSA_MAC | \ + PSA_HASH | \ + PSA_ASYMMETRIC | \ + PSA_SYMMETRIC | \ + PSA_AEAD | \ + PSA_KEY_MNG | \ + PSA_RNG | \ + PSA_CRYPTO_FREE | \ + PSA_KEY_DERIVATION | \ + PSA_ENTROPY_INJECT) + + +/* ----------------------------------------------------------------------------- + * PLATFORM defines + * -------------------------------------------------------------------------- */ +#define PLATFORM_ID 8 + +#define PLATFORM_ROT_SRV_COUNT (3UL) +#define PLATFORM_EXT_ROT_SRV_COUNT (1UL) + + +#define PLATFORM_WAIT_ANY_IRQ_MSK (0) + +#define PSA_PLATFORM_LC_GET_MSK_POS (4UL) +#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS) +#define PSA_PLATFORM_LC_SET_MSK_POS (5UL) +#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS) +#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL) +#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS) + +#define PLATFORM_WAIT_ANY_SID_MSK (\ + PSA_PLATFORM_LC_GET_MSK | \ + PSA_PLATFORM_LC_SET_MSK | \ + PSA_PLATFORM_SYSTEM_RESET_MSK) + + +/* ----------------------------------------------------------------------------- + * ITS defines + * -------------------------------------------------------------------------- */ +#define ITS_ID 10 + +#define ITS_ROT_SRV_COUNT (5UL) +#define ITS_EXT_ROT_SRV_COUNT (0UL) + + +#define ITS_WAIT_ANY_IRQ_MSK (0) + +#define PSA_ITS_GET_MSK_POS (4UL) +#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS) +#define PSA_ITS_SET_MSK_POS (5UL) +#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS) +#define PSA_ITS_INFO_MSK_POS (6UL) +#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS) +#define PSA_ITS_REMOVE_MSK_POS (7UL) +#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS) +#define PSA_ITS_RESET_MSK_POS (8UL) +#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS) + +#define ITS_WAIT_ANY_SID_MSK (\ + PSA_ITS_GET_MSK | \ + PSA_ITS_SET_MSK | \ + PSA_ITS_INFO_MSK | \ + PSA_ITS_REMOVE_MSK | \ + PSA_ITS_RESET_MSK) + + + +/****************** Test Partitions *******************************************/ + +#ifdef USE_PSA_TEST_PARTITIONS + +#ifdef USE_CRYPTO_ACL_TEST +/* ----------------------------------------------------------------------------- + * CRYPTO_ACL_TEST defines + * -------------------------------------------------------------------------- */ +#define CRYPTO_ACL_TEST_ID 128 + +#define CRYPTO_ACL_TEST_ROT_SRV_COUNT (6UL) +#define CRYPTO_ACL_TEST_EXT_ROT_SRV_COUNT (1UL) + + +#define CRYPTO_ACL_TEST_WAIT_ANY_IRQ_MSK (0) + +#define CRYPTO_GENERATE_KEY_MSK_POS (4UL) +#define CRYPTO_GENERATE_KEY_MSK (1UL << CRYPTO_GENERATE_KEY_MSK_POS) +#define CRYPTO_OPEN_KEY_MSK_POS (5UL) +#define CRYPTO_OPEN_KEY_MSK (1UL << CRYPTO_OPEN_KEY_MSK_POS) +#define CRYPTO_CLOSE_KEY_MSK_POS (6UL) +#define CRYPTO_CLOSE_KEY_MSK (1UL << CRYPTO_CLOSE_KEY_MSK_POS) +#define CRYPTO_DESTROY_KEY_MSK_POS (7UL) +#define CRYPTO_DESTROY_KEY_MSK (1UL << CRYPTO_DESTROY_KEY_MSK_POS) +#define CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS (8UL) +#define CRYPTO_GET_KEY_ATTRIBUTES_MSK (1UL << CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS) +#define CRYPTO_IMPORT_KEY_MSK_POS (9UL) +#define CRYPTO_IMPORT_KEY_MSK (1UL << CRYPTO_IMPORT_KEY_MSK_POS) + +#define CRYPTO_ACL_TEST_WAIT_ANY_SID_MSK (\ + CRYPTO_GENERATE_KEY_MSK | \ + CRYPTO_OPEN_KEY_MSK | \ + CRYPTO_CLOSE_KEY_MSK | \ + CRYPTO_DESTROY_KEY_MSK | \ + CRYPTO_GET_KEY_ATTRIBUTES_MSK | \ + CRYPTO_IMPORT_KEY_MSK) + + +#endif // USE_CRYPTO_ACL_TEST + +#ifdef USE_CLIENT_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * CLIENT_TESTS_PART1 defines + * -------------------------------------------------------------------------- */ +#define CLIENT_TESTS_PART1_ID 1 + +#define CLIENT_TESTS_PART1_ROT_SRV_COUNT (3UL) +#define CLIENT_TESTS_PART1_EXT_ROT_SRV_COUNT (0UL) + + +#define CLIENT_TESTS_PART1_WAIT_ANY_IRQ_MSK (0) + +#define PART1_ROT_SRV1_MSK_POS (4UL) +#define PART1_ROT_SRV1_MSK (1UL << PART1_ROT_SRV1_MSK_POS) +#define DROP_CONN_MSK_POS (5UL) +#define DROP_CONN_MSK (1UL << DROP_CONN_MSK_POS) +#define SECURE_CLIENTS_ONLY_MSK_POS (6UL) +#define SECURE_CLIENTS_ONLY_MSK (1UL << SECURE_CLIENTS_ONLY_MSK_POS) + +#define CLIENT_TESTS_PART1_WAIT_ANY_SID_MSK (\ + PART1_ROT_SRV1_MSK | \ + DROP_CONN_MSK | \ + SECURE_CLIENTS_ONLY_MSK) + + +#endif // USE_CLIENT_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART1 defines + * -------------------------------------------------------------------------- */ +#define SERVER_TESTS_PART1_ID 2 + +#define SERVER_TESTS_PART1_ROT_SRV_COUNT (2UL) +#define SERVER_TESTS_PART1_EXT_ROT_SRV_COUNT (2UL) + + +#define SERVER_TESTS_PART1_WAIT_ANY_IRQ_MSK (0) + +#define CONTROL_MSK_POS (4UL) +#define CONTROL_MSK (1UL << CONTROL_MSK_POS) +#define TEST_MSK_POS (5UL) +#define TEST_MSK (1UL << TEST_MSK_POS) + +#define SERVER_TESTS_PART1_WAIT_ANY_SID_MSK (\ + CONTROL_MSK | \ + TEST_MSK) + + +#endif // USE_SERVER_TESTS_PART1 + +#ifdef USE_SERVER_TESTS_PART2 +/* ----------------------------------------------------------------------------- + * SERVER_TESTS_PART2 defines + * -------------------------------------------------------------------------- */ +#define SERVER_TESTS_PART2_ID 3 + +#define SERVER_TESTS_PART2_ROT_SRV_COUNT (2UL) +#define SERVER_TESTS_PART2_EXT_ROT_SRV_COUNT (0UL) + + +#define SERVER_TESTS_PART2_WAIT_ANY_IRQ_MSK (0) + +#define ROT_SRV_REVERSE_MSK_POS (4UL) +#define ROT_SRV_REVERSE_MSK (1UL << ROT_SRV_REVERSE_MSK_POS) +#define ROT_SRV_DB_TST_MSK_POS (5UL) +#define ROT_SRV_DB_TST_MSK (1UL << ROT_SRV_DB_TST_MSK_POS) + +#define SERVER_TESTS_PART2_WAIT_ANY_SID_MSK (\ + ROT_SRV_REVERSE_MSK | \ + ROT_SRV_DB_TST_MSK) + + +#endif // USE_SERVER_TESTS_PART2 + +#ifdef USE_SMOKE_TESTS_PART1 +/* ----------------------------------------------------------------------------- + * SMOKE_TESTS_PART1 defines + * -------------------------------------------------------------------------- */ +#define SMOKE_TESTS_PART1_ID 4 + +#define SMOKE_TESTS_PART1_ROT_SRV_COUNT (1UL) +#define SMOKE_TESTS_PART1_EXT_ROT_SRV_COUNT (0UL) + + +#define SMOKE_TESTS_PART1_WAIT_ANY_IRQ_MSK (0) + +#define ROT_SRV1_MSK_POS (4UL) +#define ROT_SRV1_MSK (1UL << ROT_SRV1_MSK_POS) + +#define SMOKE_TESTS_PART1_WAIT_ANY_SID_MSK (\ + ROT_SRV1_MSK) + + +#endif // USE_SMOKE_TESTS_PART1 + + +#endif // USE_PSA_TEST_PARTITIONS + +#endif // __MBED_SPM_PARTITIONS_H___ diff --git a/tools/build.py b/tools/build.py index 5c2d4aa064..bde4561050 100644 --- a/tools/build.py +++ b/tools/build.py @@ -44,7 +44,7 @@ from tools.utils import argparse_filestring_type, args_error, argparse_many from tools.utils import argparse_dir_not_parent from tools.utils import NoValidToolchainException from tools.utils import print_end_warnings -from tools.psa import generate_psa_sources, clean_psa_autogen +from tools.psa import generate_psa_sources from tools.resources import OsAndSpeResourceFilter def main(): @@ -166,9 +166,6 @@ def main(): skipped = [] end_warnings = [] - if options.clean: - clean_psa_autogen() - for toolchain in toolchains: for target_name in targets: target = Target.get_target(target_name) @@ -191,14 +188,12 @@ def main(): profile = extract_profile(parser, options, internal_tc_name) if options.source_dir: - if target.is_PSA_target: + resource_filter = None + if target.is_PSA_secure_target: generate_psa_sources( source_dirs=options.source_dir, ignore_paths=[options.build_dir] ) - - resource_filter = None - if target.is_PSA_secure_target: resource_filter = OsAndSpeResourceFilter() lib_build_res = build_library( diff --git a/tools/make.py b/tools/make.py index 6fd8ee9b98..fe3f6584f7 100644 --- a/tools/make.py +++ b/tools/make.py @@ -55,7 +55,7 @@ from tools.utils import print_end_warnings from tools.utils import print_large_string from tools.settings import ROOT from tools.targets import Target -from tools.psa import generate_psa_sources, clean_psa_autogen +from tools.psa import generate_psa_sources from tools.resources import OsAndSpeResourceFilter def default_args_dict(options): @@ -305,10 +305,6 @@ def main(): elif options.list_tests is True: print('\n'.join(map(str, sorted(TEST_MAP.values())))) else: - - if options.clean: - clean_psa_autogen() - # Target if options.mcu is None: args_error(parser, "argument -m/--mcu is required") @@ -339,14 +335,12 @@ def main(): args_error(parser, str(e)) if options.source_dir is not None: - if target.is_PSA_target: + resource_filter = None + if target.is_PSA_secure_target: generate_psa_sources( source_dirs=options.source_dir, ignore_paths=[options.build_dir] ) - - resource_filter = None - if target.is_PSA_secure_target: resource_filter = OsAndSpeResourceFilter() wrapped_build_project( diff --git a/tools/project.py b/tools/project.py index 1bf47693e9..76cc051bd4 100644 --- a/tools/project.py +++ b/tools/project.py @@ -53,7 +53,7 @@ from tools.utils import print_large_string from tools.utils import NotSupportedException from tools.options import extract_profile, list_profiles, extract_mcus from tools.notifier.term import TerminalNotifier -from tools.psa import generate_psa_sources, clean_psa_autogen +from tools.psa import generate_psa_sources from tools.resources import OsAndSpeResourceFilter """ The CLI entry point for exporting projects from the mbed tools to any of the @@ -380,7 +380,6 @@ def main(): if options.clean: clean(options.source_dir) - clean_psa_autogen() ide = resolve_exporter_alias(options.ide) exporter, toolchain_name = get_exporter_toolchain(ide) @@ -391,13 +390,11 @@ def main(): try: target = Target.get_target(mcu) - if target.is_PSA_target: + resource_filter = None + if target.is_PSA_secure_target: generate_psa_sources(source_dirs=options.source_dir, ignore_paths=[] ) - - resource_filter = None - if target.is_PSA_secure_target: resource_filter = OsAndSpeResourceFilter() export( diff --git a/tools/psa/README.md b/tools/psa/README.md index 5de016913b..047a3992ee 100644 --- a/tools/psa/README.md +++ b/tools/psa/README.md @@ -57,7 +57,8 @@ optional arguments: * When `MCU ` is not specified, the script compiles all the images for all the targets. * When `-t/--tc` is not specified, the script compiles with the default_toolchain speciified in targets.json. * When `-d/--debug` is not specified, the script compiles the images using the release profile. -* When `--commit` is not specified, the script will not commit the images to git. +* When `--commit` is not specified, the script will not commit the images to git and + any auto-generated PSA related components and services. * A user can specify additional commands that will be passed on to the build commands (Ex. -D for compilation defines). This script should be run in following scenarios: diff --git a/tools/psa/__init__.py b/tools/psa/__init__.py index 255971dc05..21e25ba464 100644 --- a/tools/psa/__init__.py +++ b/tools/psa/__init__.py @@ -57,23 +57,11 @@ def find_secure_image(notify, resources, ns_image_path, return secure_image - -def _get_psa_autogen_dir(): - return os.path.join(ROOT, 'PSA_AUTOGEN') - - -def clean_psa_autogen(): - psa_out_dir = _get_psa_autogen_dir() - - if os.path.isdir(psa_out_dir): - shutil.rmtree(psa_out_dir) - - def generate_psa_sources(source_dirs, ignore_paths): services, apps = manifests_discovery(root_dirs=source_dirs, ignore_paths=ignore_paths + ['.git']) assert len(services + apps), 'PSA manifest discovery failed' - psa_out_dir = _get_psa_autogen_dir() + psa_out_dir = os.path.join(ROOT, 'components', 'TARGET_PSA') generate_spm_code(services, apps, psa_out_dir) return psa_out_dir diff --git a/tools/psa/release.py b/tools/psa/release.py index f74985f3ae..8034df81f4 100644 --- a/tools/psa/release.py +++ b/tools/psa/release.py @@ -48,7 +48,7 @@ PSA_TESTS = { '*psa-crypto_access_control': ['USE_PSA_TEST_PARTITIONS', 'USE_CRYPTO_ACL_TEST'] } - +PSA_AUTOGEN_LOCATION = os.path.join(ROOT, 'components', 'TARGET_PSA') def _psa_backend(target): """ @@ -247,6 +247,34 @@ def commit_binaries(target, delivery_dir, toolchain): else: logger.info("No changes detected in {}, Skipping commit".format(target)) +def commit_psa_autogen(): + """ + Commit changes related to auto-generated PSA components and services + """ + changes_made = verbose_check_call([ + 'git', + '-C', ROOT, + 'diff', '--exit-code', '--quiet', + PSA_AUTOGEN_LOCATION], check_call=False) + + if changes_made: + logger.info("Change in PSA auto-generated files has been detected") + verbose_check_call([ + 'git', + '-C', ROOT, + 'add', PSA_AUTOGEN_LOCATION]) + + logger.info("Committing changes...") + commit_message = ('--message=Update PSA auto-generated components and ' + 'services') + verbose_check_call([ + 'git', + '-C', ROOT, + 'commit', + commit_message]) + else: + logger.info("No changes has been detected for PSA autogen, " + "Skipping commit") def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit, skip_tests, args): @@ -268,6 +296,7 @@ def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit, build_default_image(target, toolchain, profile, args) if git_commit: commit_binaries(target, delivery_dir, toolchain) + commit_psa_autogen() def get_parser(): diff --git a/tools/psa/spm_template_file_list.json b/tools/psa/spm_template_file_list.json index ae04c05558..2c4125114e 100644 --- a/tools/psa/spm_template_file_list.json +++ b/tools/psa/spm_template_file_list.json @@ -2,36 +2,36 @@ { "name": "Secure Partition ID definitions", "template": "tools/psa/templates/tfm_partition_defs.inc.tpl", - "output": "COMPONENT_SPE/TARGET_TFM/tfm_partition_defs.inc" + "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_defs.inc" }, { "name": "Secure Partition declarations", "template": "tools/psa/templates/tfm_partition_list.inc.tpl", - "output": "COMPONENT_SPE/TARGET_TFM/tfm_partition_list.inc" + "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_list.inc" }, { "name": "Secure Service list", "template": "tools/psa/templates/tfm_service_list.inc.tpl", - "output": "COMPONENT_SPE/TARGET_TFM/tfm_service_list.inc" + "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_service_list.inc" }, { "name": "Secure Service signals list", "template": "tools/psa/templates/tfm_spm_signal_defs.h.tpl", - "output": "COMPONENT_SPE/TARGET_TFM/tfm_spm_signal_defs.h" + "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_spm_signal_defs.h" }, { "name": "mbed-SPM database", "template": "tools/psa/templates/psa_setup.c.tpl", - "output": "COMPONENT_SPE/TARGET_MBED_SPM/psa_setup.c" + "output": "TARGET_MBED_SPM/COMPONENT_SPE/psa_setup.c" }, { "name": "Mappings from RoT Service names to SIDs", "template": "tools/psa/templates/sid.h.tpl", - "output": "autogen_sid.h" + "output": "services/inc/autogen_sid.h" }, { "name": "Details partition defines and structures", "template": "tools/psa/templates/mbed_spm_partitions.h.tpl", - "output": "mbed_spm_partitions.h" + "output": "services/inc/mbed_spm_partitions.h" } ] diff --git a/tools/test.py b/tools/test.py index 5de76bed7f..4d7803757b 100644 --- a/tools/test.py +++ b/tools/test.py @@ -43,7 +43,7 @@ from tools.utils import argparse_dir_not_parent from tools.utils import print_end_warnings from tools.settings import ROOT from tools.targets import Target -from tools.psa import generate_psa_sources, clean_psa_autogen +from tools.psa import generate_psa_sources from tools.resources import OsAndSpeResourceFilter, SpeOnlyResourceFilter def main(): @@ -220,10 +220,6 @@ def main(): print_tests(tests, options.format) sys.exit(0) else: - - if options.clean: - clean_psa_autogen() - # Build all tests if not options.build_dir: args_error(parser, "argument --build is required") @@ -243,8 +239,6 @@ def main(): resource_filter = None if target.is_PSA_secure_target: resource_filter = OsAndSpeResourceFilter() - - if target.is_PSA_target: generate_psa_sources( source_dirs=base_source_paths, ignore_paths=[options.build_dir]