Remove ITS Reset partitions from tests

pull/9529/head
Oren Cohen 2019-01-24 18:35:58 +02:00
parent 0de098e149
commit 51b76350d9
22 changed files with 0 additions and 1704 deletions

View File

@ -1,43 +0,0 @@
/* Copyright (c) 2018 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.
*/
#ifndef TARGET_PSA
#error [NOT_SUPPORTED] ITS tests can run only on PSA-enabled targets.
#endif // TARGET_PSA
#include "test_pits.h"
#include "test_pits_impl.h"
psa_its_status_t test_psa_its_reset(void)
{
return test_psa_its_reset_impl();
}
psa_its_status_t test_psa_its_set_ver(uint32_t major, uint32_t minor)
{
return test_psa_its_set_ver_impl(major, minor);
}
psa_its_status_t test_psa_its_get_ver(uint32_t *major, uint32_t *minor)
{
return test_psa_its_get_ver_impl(major, minor);
}
psa_its_status_t test_psa_its_deinit(void)
{
return test_psa_its_deinit_impl();
}

View File

@ -1,108 +0,0 @@
/* Copyright (c) 2018 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.
*/
#include <string.h>
#include <stdlib.h>
#include "psa/internal_trusted_storage.h"
#include "test_pits_impl.h"
#include "pits_impl.h"
#include "pits_version_impl.h"
#include "kv_config.h"
#include "KVMap.h"
#include "KVStore.h"
#include "mbed_error.h"
using namespace mbed;
#ifdef __cplusplus
extern "C"
{
#endif
void its_deinit(void);
static KVStore *get_instance(void)
{
int kv_status = kv_init_storage_config();
if (kv_status != MBED_SUCCESS) {
return NULL;
}
KVMap &kv_map = KVMap::get_instance();
return kv_map.get_internal_kv_instance(STR_EXPAND(MBED_CONF_STORAGE_DEFAULT_KV));
}
psa_its_status_t test_psa_its_reset_impl(void)
{
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->reset() != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_set_ver_impl(uint32_t major, uint32_t minor)
{
its_version_t ver = {major, minor};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->set(ITS_VERSION_KEY, &ver, sizeof(ver), 0) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_get_ver_impl(uint32_t *major, uint32_t *minor)
{
its_version_t ver = {0, 0};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->get(ITS_VERSION_KEY, &ver, sizeof(ver)) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
} else {
*major = ver.major;
*minor = ver.minor;
}
return status;
}
psa_its_status_t test_psa_its_deinit_impl(void)
{
its_deinit();
return PSA_ITS_SUCCESS;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,38 +0,0 @@
/* Copyright (c) 2018 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.
*/
#ifndef __TEST_PITS_IMPL_H__
#define __TEST_PITS_IMPL_H__
#include "psa/internal_trusted_storage.h"
#ifdef __cplusplus
extern "C"
{
#endif
psa_its_status_t test_psa_its_reset_impl(void);
psa_its_status_t test_psa_its_set_ver_impl(uint32_t major, uint32_t minor);
psa_its_status_t test_psa_its_get_ver_impl(uint32_t *major, uint32_t *minor);
psa_its_status_t test_psa_its_deinit_impl(void);
#ifdef __cplusplus
}
#endif
#endif // __TEST_PITS_IMPL_H__

View File

@ -1,95 +0,0 @@
/* Copyright (c) 2017-2018 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.
*/
#include "psa/client.h"
#include "psa/internal_trusted_storage.h"
#include "test_pits.h"
#include "psa_test_its_reset_ifs.h"
psa_its_status_t test_psa_its_reset(void)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_RESET, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_status_t status = psa_call(conn, NULL, 0, NULL, 0);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}
psa_its_status_t test_psa_its_set_ver(uint32_t major, uint32_t minor)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_SET_VER, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_invec_t msg[2] = {
{&major, sizeof(major)},
{&minor, sizeof(minor)}
};
psa_error_t status = psa_call(conn, msg, 2, NULL, 0);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}
psa_its_status_t test_psa_its_get_ver(uint32_t *major, uint32_t *minor)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_GET_VER, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_outvec_t resp[2] = {
{major, sizeof(*major)},
{minor, sizeof(*minor)}
};
psa_error_t status = psa_call(conn, NULL, 0, resp, 2);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}
psa_its_status_t test_psa_its_deinit(void)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_DEINIT, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_error_t status = psa_call(conn, NULL, 0, NULL, 0);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}

View File

@ -1,138 +0,0 @@
/* Copyright (c) 2017-2018 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/spm/generate_partition_code.py Version 1.0
**********************************************************************************************************************/
#include "cmsis.h"
#include "mbed_toolchain.h" /* For using MBED_ALIGN macro */
#include "rtx_os.h"
#include "spm_panic.h"
#include "spm_internal.h"
#include "psa_test_its_reset_partition.h"
#include "psa_test_its_reset_ifs.h"
/* Threads stacks */
MBED_ALIGN(8) uint8_t test_its_reset_thread_stack[1024] = {0};
/* Threads control blocks */
osRtxThread_t test_its_reset_thread_cb = {0};
/* Thread attributes - for thread initialization */
osThreadAttr_t test_its_reset_thread_attr = {
.name = "test_its_reset",
.attr_bits = 0,
.cb_mem = &test_its_reset_thread_cb,
.cb_size = sizeof(test_its_reset_thread_cb),
.stack_mem = test_its_reset_thread_stack,
.stack_size = 1024,
.priority = osPriorityNormal,
.tz_module = 0,
.reserved = 0
};
spm_rot_service_t test_its_reset_rot_services[TEST_ITS_RESET_ROT_SRV_COUNT] = {
{
.sid = TEST_PSA_ITS_RESET,
.mask = TEST_PSA_ITS_RESET_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
{
.sid = TEST_PSA_ITS_SET_VER,
.mask = TEST_PSA_ITS_SET_VER_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
{
.sid = TEST_PSA_ITS_GET_VER,
.mask = TEST_PSA_ITS_GET_VER_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
{
.sid = TEST_PSA_ITS_DEINIT,
.mask = TEST_PSA_ITS_DEINIT_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
};
static osRtxMutex_t test_its_reset_mutex = {0};
static const osMutexAttr_t test_its_reset_mutex_attr = {
.name = "test_its_reset_mutex",
.attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust,
.cb_mem = &test_its_reset_mutex,
.cb_size = sizeof(test_its_reset_mutex),
};
extern void test_pits_entry(void *ptr);
void test_its_reset_init(spm_partition_t *partition)
{
if (NULL == partition) {
SPM_PANIC("partition is NULL!\n");
}
partition->mutex = osMutexNew(&test_its_reset_mutex_attr);
if (NULL == partition->mutex) {
SPM_PANIC("Failed to create mutex for secure partition test_its_reset!\n");
}
for (uint32_t i = 0; i < TEST_ITS_RESET_ROT_SRV_COUNT; ++i) {
test_its_reset_rot_services[i].partition = partition;
}
partition->rot_services = test_its_reset_rot_services;
partition->thread_id = osThreadNew(test_pits_entry, NULL, &test_its_reset_thread_attr);
if (NULL == partition->thread_id) {
SPM_PANIC("Failed to create start main thread of partition test_its_reset!\n");
}
}

View File

@ -1,59 +0,0 @@
/* Copyright (c) 2017-2018 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/spm/generate_partition_code.py Version 1.0
**********************************************************************************************************************/
#ifndef PSA_TEST_ITS_RESET_PARTITION_H
#define PSA_TEST_ITS_RESET_PARTITION_H
#define TEST_ITS_RESET_ID 11
#define TEST_ITS_RESET_ROT_SRV_COUNT (4UL)
#define TEST_ITS_RESET_EXT_ROT_SRV_COUNT (0UL)
/* TEST_ITS_RESET event flags */
#define TEST_ITS_RESET_RESERVED1_POS (1UL)
#define TEST_ITS_RESET_RESERVED1_MSK (1UL << TEST_ITS_RESET_RESERVED1_POS)
#define TEST_ITS_RESET_RESERVED2_POS (2UL)
#define TEST_ITS_RESET_RESERVED2_MSK (1UL << TEST_ITS_RESET_RESERVED2_POS)
#define TEST_PSA_ITS_RESET_MSK_POS (4UL)
#define TEST_PSA_ITS_RESET_MSK (1UL << TEST_PSA_ITS_RESET_MSK_POS)
#define TEST_PSA_ITS_SET_VER_MSK_POS (5UL)
#define TEST_PSA_ITS_SET_VER_MSK (1UL << TEST_PSA_ITS_SET_VER_MSK_POS)
#define TEST_PSA_ITS_GET_VER_MSK_POS (6UL)
#define TEST_PSA_ITS_GET_VER_MSK (1UL << TEST_PSA_ITS_GET_VER_MSK_POS)
#define TEST_PSA_ITS_DEINIT_MSK_POS (7UL)
#define TEST_PSA_ITS_DEINIT_MSK (1UL << TEST_PSA_ITS_DEINIT_MSK_POS)
#define TEST_ITS_RESET_WAIT_ANY_SID_MSK (\
TEST_PSA_ITS_RESET_MSK | \
TEST_PSA_ITS_SET_VER_MSK | \
TEST_PSA_ITS_GET_VER_MSK | \
TEST_PSA_ITS_DEINIT_MSK)
#endif // PSA_TEST_ITS_RESET_PARTITION_H

View File

@ -1,108 +0,0 @@
/* Copyright (c) 2018 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.
*/
#include <string.h>
#include <stdlib.h>
#include "psa/internal_trusted_storage.h"
#include "test_pits_impl.h"
#include "pits_impl.h"
#include "pits_version_impl.h"
#include "kv_config.h"
#include "KVMap.h"
#include "KVStore.h"
#include "mbed_error.h"
using namespace mbed;
#ifdef __cplusplus
extern "C"
{
#endif
void its_deinit(void);
static KVStore *get_instance(void)
{
int kv_status = kv_init_storage_config();
if (kv_status != MBED_SUCCESS) {
return NULL;
}
KVMap &kv_map = KVMap::get_instance();
return kv_map.get_internal_kv_instance(STR_EXPAND(MBED_CONF_STORAGE_DEFAULT_KV));
}
psa_its_status_t test_psa_its_reset_impl(void)
{
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->reset() != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_set_ver_impl(uint32_t major, uint32_t minor)
{
its_version_t ver = {major, minor};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->set(ITS_VERSION_KEY, &ver, sizeof(ver), 0) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_get_ver_impl(uint32_t *major, uint32_t *minor)
{
its_version_t ver = {0, 0};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->get(ITS_VERSION_KEY, &ver, sizeof(ver)) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
} else {
*major = ver.major;
*minor = ver.minor;
}
return status;
}
psa_its_status_t test_psa_its_deinit_impl(void)
{
its_deinit();
return PSA_ITS_SUCCESS;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,127 +0,0 @@
/* Copyright (c) 2017-2018 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.
*/
// -------------------------------------- Includes -----------------------------------
#include <string.h>
#include "cmsis_os2.h"
#include "psa/service.h"
#include "spm_panic.h"
#include "psa_test_its_reset_partition.h"
#include "psa/internal_trusted_storage.h"
#include "test_pits_impl.h"
#ifdef __cplusplus
extern "C"
{
#endif
void test_pits_entry(void *ptr)
{
uint32_t signals = 0;
psa_msg_t msg = {0};
psa_status_t status = PSA_SUCCESS;
uint32_t major, minor;
while (1) {
signals = psa_wait_any(PSA_BLOCK);
if ((signals & TEST_PSA_ITS_RESET_MSK) != 0) {
psa_get(TEST_PSA_ITS_RESET_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
status = test_psa_its_reset_impl();
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
if ((signals & TEST_PSA_ITS_SET_VER_MSK) != 0) {
psa_get(TEST_PSA_ITS_SET_VER_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
psa_read(msg.handle, 0, &major, sizeof(major));
psa_read(msg.handle, 1, &minor, sizeof(minor));
status = test_psa_its_set_ver_impl(major, minor);
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
if ((signals & TEST_PSA_ITS_GET_VER_MSK) != 0) {
psa_get(TEST_PSA_ITS_GET_VER_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
status = test_psa_its_set_ver_impl(&major, &minor);
psa_write(msg.handle, 0, &major, sizeof(major));
psa_write(msg.handle, 1, &minor, sizeof(minor));
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
if ((signals & TEST_PSA_ITS_DEINIT_MSK) != 0) {
psa_get(TEST_PSA_ITS_DEINIT_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
status = test_psa_its_deinit_impl();
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
}
}
#ifdef __cplusplus
}
#endif

View File

@ -1,34 +0,0 @@
/* Copyright (c) 2017-2018 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/spm/generate_partition_code.py Version 1.0
**********************************************************************************************************************/
#ifndef PSA_TEST_ITS_RESET_PARTITION_ROT_SERVICES_H
#define PSA_TEST_ITS_RESET_PARTITION_ROT_SERVICES_H
#define TEST_PSA_ITS_RESET 0x00011A04
#define TEST_PSA_ITS_SET_VER 0x00011A05
#define TEST_PSA_ITS_GET_VER 0x00011A06
#define TEST_PSA_ITS_DEINIT 0x00011A07
#endif // PSA_TEST_ITS_RESET_PARTITION_ROT_SERVICES_H

View File

@ -1,57 +0,0 @@
/* Copyright (c) 2018 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.
*/
#ifndef __TEST_INTERNAL_TRUSTED_STORAGE_H__
#define __TEST_INTERNAL_TRUSTED_STORAGE_H__
/** @file
@brief This file describes the PSA Internal Trusted Storage API
*/
#include <stddef.h>
#include <stdint.h>
#include "psa/internal_trusted_storage.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \brief Remove the provided key and its associated data from the storage
*
* \return A status indicating the success/failure of the operation
*
* \retval PSA_ITS_SUCCESS The operation completed successfully
* \retval PSA_ITS_ERROR_STORAGE_FAILURE The operation failed because the physical storage has failed (Fatal error)
*/
psa_its_status_t test_psa_its_reset(void);
psa_its_status_t test_psa_its_set_ver(uint32_t major, uint32_t minor);
psa_its_status_t test_psa_its_get_ver(uint32_t *major, uint32_t *minor);
psa_its_status_t test_psa_its_deinit(void);
#ifdef __cplusplus
}
#endif
#endif // __TEST_INTERNAL_TRUSTED_STORAGE_H__

View File

@ -1,45 +0,0 @@
{
"name": "TEST_ITS_RESET",
"type": "APPLICATION-ROT",
"priority": "NORMAL",
"id": "0x0000000B",
"entry_point": "test_pits_entry",
"stack_size": "0x400",
"heap_size": "0x400",
"services": [{
"name": "TEST_PSA_ITS_RESET",
"identifier": "0x00011A04",
"signal": "TEST_PSA_ITS_RESET_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
},
{
"name": "TEST_PSA_ITS_SET_VER",
"identifier": "0x00011A05",
"signal": "TEST_PSA_ITS_SET_VER_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
},
{
"name": "TEST_PSA_ITS_GET_VER",
"identifier": "0x00011A06",
"signal": "TEST_PSA_ITS_GET_VER_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
},
{
"name": "TEST_PSA_ITS_DEINIT",
"identifier": "0x00011A07",
"signal": "TEST_PSA_ITS_DEINIT_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
}
],
"source_files": [
"COMPONENT_SPE/test_pits_reset_partition.c"
]
}

View File

@ -1,43 +0,0 @@
/* Copyright (c) 2018 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.
*/
#ifndef TARGET_PSA
#error [NOT_SUPPORTED] ITS tests can run only on PSA-enabled targets.
#endif // TARGET_PSA
#include "test_pits.h"
#include "test_pits_impl.h"
psa_its_status_t test_psa_its_reset(void)
{
return test_psa_its_reset_impl();
}
psa_its_status_t test_psa_its_set_ver(uint32_t major, uint32_t minor)
{
return test_psa_its_set_ver_impl(major, minor);
}
psa_its_status_t test_psa_its_get_ver(uint32_t *major, uint32_t *minor)
{
return test_psa_its_get_ver_impl(major, minor);
}
psa_its_status_t test_psa_its_deinit(void)
{
return test_psa_its_deinit_impl();
}

View File

@ -1,108 +0,0 @@
/* Copyright (c) 2018 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.
*/
#include <string.h>
#include <stdlib.h>
#include "psa/internal_trusted_storage.h"
#include "test_pits_impl.h"
#include "pits_impl.h"
#include "pits_version_impl.h"
#include "kv_config.h"
#include "KVMap.h"
#include "KVStore.h"
#include "mbed_error.h"
using namespace mbed;
#ifdef __cplusplus
extern "C"
{
#endif
void its_deinit(void);
static KVStore *get_instance(void)
{
int kv_status = kv_init_storage_config();
if (kv_status != MBED_SUCCESS) {
return NULL;
}
KVMap &kv_map = KVMap::get_instance();
return kv_map.get_internal_kv_instance(STR_EXPAND(MBED_CONF_STORAGE_DEFAULT_KV));
}
psa_its_status_t test_psa_its_reset_impl(void)
{
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->reset() != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_set_ver_impl(uint32_t major, uint32_t minor)
{
its_version_t ver = {major, minor};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->set(ITS_VERSION_KEY, &ver, sizeof(ver), 0) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_get_ver_impl(uint32_t *major, uint32_t *minor)
{
its_version_t ver = {0, 0};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->get(ITS_VERSION_KEY, &ver, sizeof(ver)) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
} else {
*major = ver.major;
*minor = ver.minor;
}
return status;
}
psa_its_status_t test_psa_its_deinit_impl(void)
{
its_deinit();
return PSA_ITS_SUCCESS;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,38 +0,0 @@
/* Copyright (c) 2018 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.
*/
#ifndef __TEST_PITS_IMPL_H__
#define __TEST_PITS_IMPL_H__
#include "psa/internal_trusted_storage.h"
#ifdef __cplusplus
extern "C"
{
#endif
psa_its_status_t test_psa_its_reset_impl(void);
psa_its_status_t test_psa_its_set_ver_impl(uint32_t major, uint32_t minor);
psa_its_status_t test_psa_its_get_ver_impl(uint32_t *major, uint32_t *minor);
psa_its_status_t test_psa_its_deinit_impl(void);
#ifdef __cplusplus
}
#endif
#endif // __TEST_PITS_IMPL_H__

View File

@ -1,95 +0,0 @@
/* Copyright (c) 2017-2018 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.
*/
#include "psa/client.h"
#include "psa/internal_trusted_storage.h"
#include "test_pits.h"
#include "psa_test_its_reset_ifs.h"
psa_its_status_t test_psa_its_reset(void)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_RESET, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_status_t status = psa_call(conn, NULL, 0, NULL, 0);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}
psa_its_status_t test_psa_its_set_ver(uint32_t major, uint32_t minor)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_SET_VER, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_invec_t msg[2] = {
{&major, sizeof(major)},
{&minor, sizeof(minor)}
};
psa_error_t status = psa_call(conn, msg, 2, NULL, 0);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}
psa_its_status_t test_psa_its_get_ver(uint32_t *major, uint32_t *minor)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_GET_VER, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_outvec_t resp[2] = {
{major, sizeof(*major)},
{minor, sizeof(*minor)}
};
psa_error_t status = psa_call(conn, NULL, 0, resp, 2);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}
psa_its_status_t test_psa_its_deinit(void)
{
psa_handle_t conn = psa_connect(TEST_PSA_ITS_DEINIT, 1);
if (conn <= PSA_NULL_HANDLE) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_error_t status = psa_call(conn, NULL, 0, NULL, 0);
if (status == PSA_DROP_CONNECTION) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
psa_close(conn);
return status;
}

View File

@ -1,138 +0,0 @@
/* Copyright (c) 2017-2018 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/spm/generate_partition_code.py Version 1.0
**********************************************************************************************************************/
#include "cmsis.h"
#include "mbed_toolchain.h" /* For using MBED_ALIGN macro */
#include "rtx_os.h"
#include "spm_panic.h"
#include "spm_internal.h"
#include "psa_test_its_reset_partition.h"
#include "psa_test_its_reset_ifs.h"
/* Threads stacks */
MBED_ALIGN(8) uint8_t test_its_reset_thread_stack[1024] = {0};
/* Threads control blocks */
osRtxThread_t test_its_reset_thread_cb = {0};
/* Thread attributes - for thread initialization */
osThreadAttr_t test_its_reset_thread_attr = {
.name = "test_its_reset",
.attr_bits = 0,
.cb_mem = &test_its_reset_thread_cb,
.cb_size = sizeof(test_its_reset_thread_cb),
.stack_mem = test_its_reset_thread_stack,
.stack_size = 1024,
.priority = osPriorityNormal,
.tz_module = 0,
.reserved = 0
};
spm_rot_service_t test_its_reset_rot_services[TEST_ITS_RESET_ROT_SRV_COUNT] = {
{
.sid = TEST_PSA_ITS_RESET,
.mask = TEST_PSA_ITS_RESET_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
{
.sid = TEST_PSA_ITS_SET_VER,
.mask = TEST_PSA_ITS_SET_VER_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
{
.sid = TEST_PSA_ITS_GET_VER,
.mask = TEST_PSA_ITS_GET_VER_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
{
.sid = TEST_PSA_ITS_DEINIT,
.mask = TEST_PSA_ITS_DEINIT_MSK,
.partition = NULL,
.min_version = 1,
.min_version_policy = PSA_MINOR_VERSION_POLICY_RELAXED,
.allow_nspe = true,
.queue = {
.head = NULL,
.tail = NULL
}
},
};
static osRtxMutex_t test_its_reset_mutex = {0};
static const osMutexAttr_t test_its_reset_mutex_attr = {
.name = "test_its_reset_mutex",
.attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust,
.cb_mem = &test_its_reset_mutex,
.cb_size = sizeof(test_its_reset_mutex),
};
extern void test_pits_entry(void *ptr);
void test_its_reset_init(spm_partition_t *partition)
{
if (NULL == partition) {
SPM_PANIC("partition is NULL!\n");
}
partition->mutex = osMutexNew(&test_its_reset_mutex_attr);
if (NULL == partition->mutex) {
SPM_PANIC("Failed to create mutex for secure partition test_its_reset!\n");
}
for (uint32_t i = 0; i < TEST_ITS_RESET_ROT_SRV_COUNT; ++i) {
test_its_reset_rot_services[i].partition = partition;
}
partition->rot_services = test_its_reset_rot_services;
partition->thread_id = osThreadNew(test_pits_entry, NULL, &test_its_reset_thread_attr);
if (NULL == partition->thread_id) {
SPM_PANIC("Failed to create start main thread of partition test_its_reset!\n");
}
}

View File

@ -1,59 +0,0 @@
/* Copyright (c) 2017-2018 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/spm/generate_partition_code.py Version 1.0
**********************************************************************************************************************/
#ifndef PSA_TEST_ITS_RESET_PARTITION_H
#define PSA_TEST_ITS_RESET_PARTITION_H
#define TEST_ITS_RESET_ID 11
#define TEST_ITS_RESET_ROT_SRV_COUNT (4UL)
#define TEST_ITS_RESET_EXT_ROT_SRV_COUNT (0UL)
/* TEST_ITS_RESET event flags */
#define TEST_ITS_RESET_RESERVED1_POS (1UL)
#define TEST_ITS_RESET_RESERVED1_MSK (1UL << TEST_ITS_RESET_RESERVED1_POS)
#define TEST_ITS_RESET_RESERVED2_POS (2UL)
#define TEST_ITS_RESET_RESERVED2_MSK (1UL << TEST_ITS_RESET_RESERVED2_POS)
#define TEST_PSA_ITS_RESET_MSK_POS (4UL)
#define TEST_PSA_ITS_RESET_MSK (1UL << TEST_PSA_ITS_RESET_MSK_POS)
#define TEST_PSA_ITS_SET_VER_MSK_POS (5UL)
#define TEST_PSA_ITS_SET_VER_MSK (1UL << TEST_PSA_ITS_SET_VER_MSK_POS)
#define TEST_PSA_ITS_GET_VER_MSK_POS (6UL)
#define TEST_PSA_ITS_GET_VER_MSK (1UL << TEST_PSA_ITS_GET_VER_MSK_POS)
#define TEST_PSA_ITS_DEINIT_MSK_POS (7UL)
#define TEST_PSA_ITS_DEINIT_MSK (1UL << TEST_PSA_ITS_DEINIT_MSK_POS)
#define TEST_ITS_RESET_WAIT_ANY_SID_MSK (\
TEST_PSA_ITS_RESET_MSK | \
TEST_PSA_ITS_SET_VER_MSK | \
TEST_PSA_ITS_GET_VER_MSK | \
TEST_PSA_ITS_DEINIT_MSK)
#endif // PSA_TEST_ITS_RESET_PARTITION_H

View File

@ -1,108 +0,0 @@
/* Copyright (c) 2018 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.
*/
#include <string.h>
#include <stdlib.h>
#include "psa/internal_trusted_storage.h"
#include "test_pits_impl.h"
#include "pits_impl.h"
#include "pits_version_impl.h"
#include "kv_config.h"
#include "KVMap.h"
#include "KVStore.h"
#include "mbed_error.h"
using namespace mbed;
#ifdef __cplusplus
extern "C"
{
#endif
void its_deinit(void);
static KVStore *get_instance(void)
{
int kv_status = kv_init_storage_config();
if (kv_status != MBED_SUCCESS) {
return NULL;
}
KVMap &kv_map = KVMap::get_instance();
return kv_map.get_internal_kv_instance(STR_EXPAND(MBED_CONF_STORAGE_DEFAULT_KV));
}
psa_its_status_t test_psa_its_reset_impl(void)
{
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->reset() != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_set_ver_impl(uint32_t major, uint32_t minor)
{
its_version_t ver = {major, minor};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->set(ITS_VERSION_KEY, &ver, sizeof(ver), 0) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
}
return status;
}
psa_its_status_t test_psa_its_get_ver_impl(uint32_t *major, uint32_t *minor)
{
its_version_t ver = {0, 0};
psa_its_status_t status = PSA_ITS_SUCCESS;
KVStore *kvstore = get_instance();
if (!kvstore) {
return PSA_ITS_ERROR_STORAGE_FAILURE;
}
if (kvstore->get(ITS_VERSION_KEY, &ver, sizeof(ver)) != MBED_SUCCESS) {
status = PSA_ITS_ERROR_STORAGE_FAILURE;
} else {
*major = ver.major;
*minor = ver.minor;
}
return status;
}
psa_its_status_t test_psa_its_deinit_impl(void)
{
its_deinit();
return PSA_ITS_SUCCESS;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,127 +0,0 @@
/* Copyright (c) 2017-2018 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.
*/
// -------------------------------------- Includes -----------------------------------
#include <string.h>
#include "cmsis_os2.h"
#include "psa/service.h"
#include "spm_panic.h"
#include "psa_test_its_reset_partition.h"
#include "psa/internal_trusted_storage.h"
#include "test_pits_impl.h"
#ifdef __cplusplus
extern "C"
{
#endif
void test_pits_entry(void *ptr)
{
uint32_t signals = 0;
psa_msg_t msg = {0};
psa_status_t status = PSA_SUCCESS;
uint32_t major, minor;
while (1) {
signals = psa_wait_any(PSA_BLOCK);
if ((signals & TEST_PSA_ITS_RESET_MSK) != 0) {
psa_get(TEST_PSA_ITS_RESET_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
status = test_psa_its_reset_impl();
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
if ((signals & TEST_PSA_ITS_SET_VER_MSK) != 0) {
psa_get(TEST_PSA_ITS_SET_VER_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
psa_read(msg.handle, 0, &major, sizeof(major));
psa_read(msg.handle, 1, &minor, sizeof(minor));
status = test_psa_its_set_ver_impl(major, minor);
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
if ((signals & TEST_PSA_ITS_GET_VER_MSK) != 0) {
psa_get(TEST_PSA_ITS_GET_VER_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
status = test_psa_its_set_ver_impl(&major, &minor);
psa_write(msg.handle, 0, &major, sizeof(major));
psa_write(msg.handle, 1, &minor, sizeof(minor));
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
if ((signals & TEST_PSA_ITS_DEINIT_MSK) != 0) {
psa_get(TEST_PSA_ITS_DEINIT_MSK, &msg);
switch (msg.type) {
case PSA_IPC_CONNECT: //fallthrough
case PSA_IPC_DISCONNECT: {
break;
}
case PSA_IPC_CALL: {
status = test_psa_its_deinit_impl();
break;
}
default: {
SPM_PANIC("Unexpected message type %d!", (int)(msg.type));
break;
}
}
psa_reply(msg.handle, status);
}
}
}
#ifdef __cplusplus
}
#endif

View File

@ -1,34 +0,0 @@
/* Copyright (c) 2017-2018 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/spm/generate_partition_code.py Version 1.0
**********************************************************************************************************************/
#ifndef PSA_TEST_ITS_RESET_PARTITION_ROT_SERVICES_H
#define PSA_TEST_ITS_RESET_PARTITION_ROT_SERVICES_H
#define TEST_PSA_ITS_RESET 0x00011A04
#define TEST_PSA_ITS_SET_VER 0x00011A05
#define TEST_PSA_ITS_GET_VER 0x00011A06
#define TEST_PSA_ITS_DEINIT 0x00011A07
#endif // PSA_TEST_ITS_RESET_PARTITION_ROT_SERVICES_H

View File

@ -1,57 +0,0 @@
/* Copyright (c) 2018 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.
*/
#ifndef __TEST_INTERNAL_TRUSTED_STORAGE_H__
#define __TEST_INTERNAL_TRUSTED_STORAGE_H__
/** @file
@brief This file describes the PSA Internal Trusted Storage API
*/
#include <stddef.h>
#include <stdint.h>
#include "psa/internal_trusted_storage.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \brief Remove the provided key and its associated data from the storage
*
* \return A status indicating the success/failure of the operation
*
* \retval PSA_ITS_SUCCESS The operation completed successfully
* \retval PSA_ITS_ERROR_STORAGE_FAILURE The operation failed because the physical storage has failed (Fatal error)
*/
psa_its_status_t test_psa_its_reset(void);
psa_its_status_t test_psa_its_set_ver(uint32_t major, uint32_t minor);
psa_its_status_t test_psa_its_get_ver(uint32_t *major, uint32_t *minor);
psa_its_status_t test_psa_its_deinit(void);
#ifdef __cplusplus
}
#endif
#endif // __TEST_INTERNAL_TRUSTED_STORAGE_H__

View File

@ -1,45 +0,0 @@
{
"name": "TEST_ITS_RESET",
"type": "APPLICATION-ROT",
"priority": "NORMAL",
"id": "0x0000000B",
"entry_point": "test_pits_entry",
"stack_size": "0x400",
"heap_size": "0x400",
"services": [{
"name": "TEST_PSA_ITS_RESET",
"identifier": "0x00011A04",
"signal": "TEST_PSA_ITS_RESET_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
},
{
"name": "TEST_PSA_ITS_SET_VER",
"identifier": "0x00011A05",
"signal": "TEST_PSA_ITS_SET_VER_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
},
{
"name": "TEST_PSA_ITS_GET_VER",
"identifier": "0x00011A06",
"signal": "TEST_PSA_ITS_GET_VER_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
},
{
"name": "TEST_PSA_ITS_DEINIT",
"identifier": "0x00011A07",
"signal": "TEST_PSA_ITS_DEINIT_MSK",
"non_secure_clients": true,
"minor_version": 1,
"minor_policy": "RELAXED"
}
],
"source_files": [
"COMPONENT_SPE/test_pits_reset_partition.c"
]
}