Platform: Remove unused platform directories
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/common/driver_partition_psa.json b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/common/driver_partition_psa.json
deleted file mode 100644
index 3e2ec67..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/common/driver_partition_psa.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "psa_framework_version": 1.0,
- "name": "DRIVER_PARTITION",
- "type": "PSA-ROT",
- "priority": "NORMAL",
- "description": "Implements device services such print, flash read/write,. etc.",
- "entry_point": "driver_main",
- "stack_size": "0x400",
- "services": [{
- "name": "DRIVER_UART_SID",
- "sid": "0x0000FC01",
- "signal": "DRIVER_UART_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "DRIVER_WATCHDOG_SID",
- "sid": "0x0000FC02",
- "signal": "DRIVER_WATCHDOG_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "DRIVER_NVMEM_SID",
- "sid": "0x0000FC03",
- "signal": "DRIVER_NVMEM_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "DRIVER_TEST_SID",
- "sid": "0x0000FC04",
- "signal": "DRIVER_TEST_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- }
- ],
- "mmio_regions" : [
- {
- "name": "UART_REGION",
- "base": "0x40004000",
- "size": "0x1000",
- "permission": "READ-WRITE"
- },
- {
- "name": "WATCHDOG_REGION",
- "base": "0x40008000",
- "size": "0x1000",
- "permission": "READ-WRITE"
- },
- {
- "name": "NVMEM_REGION",
- "base": "0x2002F000",
- "size": "0x400",
- "permission": "READ-WRITE"
- },
- {
- "name": "DRIVER_PARTITION_MMIO",
- "base": "0x200AF040",
- "size": "0x20",
- "permission": "READ-WRITE"
- }
- ],
- "irqs": [
- {
- "description": "Using UART TX interrupt to test psa_wait and psa_eoi for irq_signal",
- "signal": "DRIVER_UART_INTR_SIG",
- "line_num": 17
- }
- ]
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/ipc/client_partition_psa.json b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/ipc/client_partition_psa.json
deleted file mode 100644
index b93377b..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/ipc/client_partition_psa.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "psa_framework_version": 1.0,
- "name": "CLIENT_PARTITION",
- "type": "APPLICATION-ROT",
- "priority": "NORMAL",
- "description": "Client partition executing client test func from SPE",
- "entry_point": "client_main",
- "stack_size": "0x400",
- "services": [{
- "name": "CLIENT_TEST_DISPATCHER_SID",
- "sid": "0x0000FA01",
- "signal": "CLIENT_TEST_DISPATCHER_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- }
- ],
- "dependencies": [
- "DRIVER_UART_SID",
- "DRIVER_NVMEM_SID",
- "DRIVER_TEST_SID",
- "SERVER_TEST_DISPATCHER_SID",
- "SERVER_UNSPECIFED_MINOR_V_SID",
- "SERVER_STRICT_MINOR_VERSION_SID",
- "SERVER_RELAX_MINOR_VERSION_SID",
- "SERVER_SECURE_CONNECT_ONLY_SID",
- "SERVER_CONNECTION_DROP_SID"
- ],
- "mmio_regions" : [
- {
- "name": "CLIENT_PARTITION_MMIO",
- "base": "0x200AF000",
- "size": "0x20",
- "permission": "READ-WRITE"
- }
- ]
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/ipc/server_partition_psa.json b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/ipc/server_partition_psa.json
deleted file mode 100644
index 146b8fb..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/manifests/ipc/server_partition_psa.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "psa_framework_version": 1.0,
- "name": "SERVER_PARTITION",
- "type": "APPLICATION-ROT",
- "priority": "NORMAL",
- "description": "Server partition executing server test func",
- "entry_point": "server_main",
- "stack_size": "0x400",
- "heap_size": "0x100",
- "services": [{
- "name": "SERVER_TEST_DISPATCHER_SID",
- "sid": "0x0000FB01",
- "signal": "SERVER_TEST_DISPATCHER_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_SECURE_CONNECT_ONLY_SID",
- "sid": "0x0000FB02",
- "signal": "SERVER_SECURE_CONNECT_ONLY_SIG",
- "non_secure_clients": false,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_STRICT_MINOR_VERSION_SID",
- "sid": "0x0000FB03",
- "signal": "SERVER_STRICT_MINOR_VERSION_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "STRICT"
- },
- {
- "name": "SERVER_UNSPECIFED_MINOR_V_SID",
- "sid": "0x0000FB04",
- "signal": "SERVER_UNSPECIFED_MINOR_V_SIG",
- "non_secure_clients": true
- },
- {
- "name": "SERVER_RELAX_MINOR_VERSION_SID",
- "sid": "0x0000FB05",
- "signal": "SERVER_RELAX_MINOR_VERSION_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_UNEXTERN_SID",
- "sid": "0x0000FB06",
- "signal": "SERVER_UNEXTERN_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_CONNECTION_DROP_SID",
- "sid": "0x0000FB07",
- "signal": "SERVER_CONNECTION_DROP_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- }
- ],
- "dependencies": [
- "DRIVER_UART_SID",
- "DRIVER_NVMEM_SID"
- ]
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_empty_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_empty_intf.c
deleted file mode 100644
index 578b4ce..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_empty_intf.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_client_api_intf.h"
-
-/**
- * @brief - Retrieve the version of the PSA Framework API that is implemented.
- * This is a wrapper API for psa_framework_version API.
- * @param - void
- * @return - The PSA Framework API version.
- */
-
-uint32_t pal_ipc_framework_version(void)
-{
- return 0;
-}
-
-/**
- * @brief - Retrieve the minor version of a Root of Trust Service by its SID.
- * This is a wrapper API for the psa_version API.
- * @param - sid The Root of Trust Service ID
- * @return - Minor version of Root of Trust Service or PSA_VERSION_NONE if Root of Trust
- * Service not present on the system.
- */
-
-uint32_t pal_ipc_version(uint32_t sid)
-{
- return PSA_VERSION_NONE;
-}
-
-/**
- * @brief - Connect to given sid.
- * This is a wrapper API for the psa_connect API.
- * @param - sid : RoT service id
- * @param - minor_version : minor_version of RoT service
- * @return - psa_handle_t : return connection handle
- */
-
-psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version)
-{
- return PSA_NULL_HANDLE;
-}
-
-/**
- * @brief Call a connected Root of Trust Service.
- * This is a wrapper API for the psa_call API.
- * The caller must provide an array of ::psa_invec_t structures as the input payload.
- *
- * @param -handle Handle for the connection.
- * @param -in_vec Array of psa_invec structures.
- * @param -in_len Number of psa_invec structures in in_vec.
- * @param -out_vec Array of psa_outvec structures for optional Root of Trust Service response.
- * @param -out_len Number of psa_outvec structures in out_vec.
- * @return -psa_status_t
- */
-
-psa_status_t pal_ipc_call(psa_handle_t handle,
- const psa_invec *in_vec,
- size_t in_len,
- psa_outvec *out_vec,
- size_t out_len)
-{
- return (PSA_SUCCESS - 1);
-}
-
-/**
- * @brief Close a connection to a Root of Trust Service.
- * This is a wrapper API for the psa_close API.
- * Sends the PSA_IPC_DISCONNECT message to the Root of Trust Service so it can clean up resources.
- *
- * @param handle Handle for the connection.
- * @return void
- */
-
-void pal_ipc_close(psa_handle_t handle)
-{
- return;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.c
deleted file mode 100644
index 20ddd11..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_client_api_intf.h"
-
-/**
- * @brief - Retrieve the version of the PSA Framework API that is implemented.
- * This is a wrapper API for psa_framework_version API.
- * @param - void
- * @return - The PSA Framework API version.
- * Note - Return PAL_STATUS_ERROR if PSA IPC is not implemented.
- */
-
-uint32_t pal_ipc_framework_version(void)
-{
- return (psa_framework_version());
-}
-
-/**
- * @brief - Retrieve the minor version of a Root of Trust Service by its SID.
- * This is a wrapper API for the psa_version API.
- * @param - sid The Root of Trust Service ID
- * @return - Minor version of Root of Trust Service or PSA_VERSION_NONE if Root of Trust
- * Service not present on the system.
- * Note - Return PAL_STATUS_ERROR if PSA IPC is not implemented.
- */
-
-uint32_t pal_ipc_version(uint32_t sid)
-{
- return (psa_version(sid));
-}
-
-/**
- * @brief - Connect to given sid.
- * This is a wrapper API for the psa_connect API.
- * @param - sid : RoT service id
- * @param - minor_version : minor_version of RoT service
- * @return - psa_handle_t : return connection handle
- * Note - Return PSA_NULL_HANDLE if PSA IPC is not implemented.
- */
-
-psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version)
-{
- return (psa_connect(sid, minor_version));
-}
-
-/**
- * @brief Call a connected Root of Trust Service.
- * This is a wrapper API for the psa_call API.
- * The caller must provide an array of ::psa_invec_t structures as the input payload.
- *
- * @param -handle Handle for the connection.
- * @param -in_vec Array of psa_invec structures.
- * @param -in_len Number of psa_invec structures in in_vec.
- * @param -out_vec Array of psa_outvec structures for optional Root of Trust Service response.
- * @param -out_len Number of psa_outvec structures in out_vec.
- * @return -psa_status_t
- * Note - Return -1 if PSA IPC is not implemented.
- */
-
-psa_status_t pal_ipc_call(psa_handle_t handle,
- const psa_invec *in_vec,
- size_t in_len,
- psa_outvec *out_vec,
- size_t out_len)
-{
- return (psa_call(handle, in_vec, in_len, out_vec, out_len));
-}
-
-/**
- * @brief Close a connection to a Root of Trust Service.
- * This is a wrapper API for the psa_close API.
- * Sends the PSA_IPC_DISCONNECT message to the Root of Trust Service so it can clean up resources.
- *
- * @param - handle Handle for the connection.
- * @return - void
- */
-
-void pal_ipc_close(psa_handle_t handle)
-{
- psa_close(handle);
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.h
deleted file mode 100644
index 3f5741e..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_CLIENT_API_H_
-#define _PAL_CLIENT_API_H_
-
-#include "pal_common.h"
-
-uint32_t pal_ipc_framework_version(void);
-uint32_t pal_ipc_version(uint32_t sid);
-psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version);
-psa_status_t pal_ipc_call(psa_handle_t handle,
- const psa_invec *in_vec,
- size_t in_len,
- psa_outvec *out_vec,
- size_t out_len);
-void pal_ipc_close(psa_handle_t handle);
-#endif /* _PAL_CLIENT_API_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_common.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_common.h
deleted file mode 100644
index 0a63b02..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_common.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_COMMON_H_
-#define _PAL_COMMON_H_
-
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <stdarg.h>
-
-#include "pal_config.h"
-#include "pal_crypto_config.h"
-
-/* typedef's */
-typedef uint8_t bool_t;
-typedef uint32_t addr_t;
-typedef uint32_t test_id_t;
-typedef uint32_t block_id_t;
-typedef char char8_t;
-typedef uint32_t cfg_id_t;
-
-#define PAL_STATUS_UNSUPPORTED_FUNC 0xFF
-
-typedef enum
-{
- PAL_STATUS_SUCCESS = 0x0,
- PAL_STATUS_ERROR = 0x80
-} pal_status_t;
-
-typedef enum {
- NVMEM_READ = 0x1,
- NVMEM_WRITE = 0x2,
-} nvmem_fn_type_t;
-
-typedef struct {
- nvmem_fn_type_t nvmem_fn_type;
- addr_t base;
- uint32_t offset;
- int size;
-} nvmem_param_t;
-
-typedef enum {
- WD_INIT_SEQ = 0x1,
- WD_ENABLE_SEQ = 0x2,
- WD_DISABLE_SEQ = 0x3,
- WD_STATUS_SEQ = 0x4,
-} wd_fn_type_t;
-
-typedef enum {
- WD_LOW_TIMEOUT = 0x1,
- WD_MEDIUM_TIMEOUT = 0x2,
- WD_HIGH_TIMEOUT = 0x3,
- WD_CRYPTO_TIMEOUT = 0x4,
-} wd_timeout_type_t;
-
-typedef struct {
- wd_fn_type_t wd_fn_type;
- addr_t wd_base_addr;
- uint32_t wd_time_us;
- uint32_t wd_timer_tick_us;
-} wd_param_t;
-
-typedef enum {
- UART_INIT = 0x1,
- UART_PRINT = 0x2,
-} uart_fn_type_t;
-
-/*
- * Redefining some of the client.h elements for compilation to go through
- * when PSA IPC APIs are not implemented.
- */
-#ifndef IPC
-
-#ifndef PSA_VERSION_NONE
-#define PSA_VERSION_NONE (0)
-#endif
-
-#ifndef PSA_SUCCESS
-#define PSA_SUCCESS (0)
-typedef int32_t psa_status_t;
-#endif
-typedef int32_t psa_handle_t;
-
-#ifndef PSA_NULL_HANDLE
-#define PSA_NULL_HANDLE ((psa_handle_t)0)
-#endif
-
-typedef struct psa_invec {
- const void *base;
- size_t len;
-} psa_invec;
-
-typedef struct psa_outvec {
- void *base;
- size_t len;
-} psa_outvec;
-
-#endif /* IPC */
-
-#endif /* _PAL_COMMON_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_config.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_config.h
deleted file mode 100644
index 61db8d8..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_config.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_CONFIG_H_
-#define _PAL_CONFIG_H_
-
-/* Define PSA test suite dependent macros for non-cmake build */
-#if !defined(PSA_CMAKE_BUILD)
-
-/* Print verbosity = TEST */
-#define VERBOSE 3
-
-/* NSPE or SPE VAL build? */
-#define VAL_NSPE_BUILD
-
-/* NSPE or SPE TEST build? */
-#define NONSECURE_TEST_BUILD
-
-/* Combine test archive or binary? */
-#define TEST_COMBINE_ARCHIVE
-
-/* If not defined, skip watchdog programming */
-#define WATCHDOG_AVAILABLE
-
-/* Are Dynamic memory APIs available to secure partition? */
-#define SP_HEAP_MEM_SUPP
-#endif /* PSA_CMAKE_BUILD */
-
-/* Version of crypto spec used in attestation */
-#define CRYPTO_VERSION_BETA2
-
-/* Use hardcoded public key */
-//#define PLATFORM_OVERRIDE_ATTEST_PK
-
-/*
- * Include of PSA defined Header files
- */
-#ifdef IPC
-/* psa/client.h: Contains the PSA Client API elements */
-#include "psa/client.h"
-
-/*
- * psa_manifest/sid.h: Macro definitions derived from manifest files that map from RoT Service
- * names to Service IDs (SIDs). Partition manifest parse build tool must provide the implementation
- * of this file.
-*/
-#include "psa_manifest/sid.h"
-
-/*
- * psa_manifest/pid.h: Secure Partition IDs
- * Macro definitions that map from Secure Partition names to Secure Partition IDs.
- * Partition manifest parse build tool must provide the implementation of this file.
-*/
-#include "psa_manifest/pid.h"
-#endif
-
-#ifdef CRYPTO
-/* psa/crypto.h: Contains the PSA Crypto API elements */
-#include "psa/crypto.h"
-#endif
-
-#ifdef INTERNAL_TRUSTED_STORAGE
-/* psa/internal_trusted_storage.h: Contains the PSA ITS API elements */
-#include "psa/internal_trusted_storage.h"
-#endif
-
-#ifdef PROTECTED_STORAGE
-/* psa/protected_storage.h: Contains the PSA PS API elements */
-#include "psa/protected_storage.h"
-#endif
-
-#ifdef INITIAL_ATTESTATION
-/* psa/initial_attestation.h: Contains the PSA Initial Attestation API elements */
-#include "psa/initial_attestation.h"
-#endif
-
-#endif /* _PAL_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ipc_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ipc_intf.c
deleted file mode 100644
index f8f773f..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ipc_intf.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_client_api_intf.h"
-
-/**
- @brief - This function initializes the UART
- @param - uart base addr
- @return - SUCCESS/FAILURE
-**/
-int pal_uart_init_ns(uint32_t uart_base_addr)
-{
- psa_handle_t print_handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
- uart_fn_type_t uart_fn = UART_INIT;
-
- psa_invec data[3] = {{&uart_fn, sizeof(uart_fn)},
- {&uart_base_addr, sizeof(uart_base_addr)},
- {NULL, 0}};
-
- print_handle = pal_ipc_connect(DRIVER_UART_SID, 0);
- if (print_handle < 0)
- {
- return(PAL_STATUS_ERROR);
- }
-
- status_of_call = pal_ipc_call(print_handle, data, 3, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- return(PAL_STATUS_ERROR);
- }
-
- pal_ipc_close(print_handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - This function parses the input string and writes bytes into UART TX FIFO
- @param - str : Input String
- - data : Value for format specifier
- @return - SUCCESS/FAILURE
-**/
-
-int pal_print_ns(char *str, int32_t data)
-{
- int string_len = 0;
- char *p = str;
- psa_handle_t print_handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
- pal_status_t status = PAL_STATUS_SUCCESS;
- uart_fn_type_t uart_fn = UART_PRINT;
-
- while (*p != '\0')
- {
- string_len++;
- p++;
- }
-
- psa_invec data1[3] = {{&uart_fn, sizeof(uart_fn)},
- {str, string_len+1},
- {&data, sizeof(data)}};
- print_handle = pal_ipc_connect(DRIVER_UART_SID, 0);
-
- if (print_handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(print_handle, data1, 3, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- status = PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(print_handle);
- return status;
-}
-
-/**
- @brief - Initializes an hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- - time_us : Time in micro seconds
- - timer_tick_us : Number of ticks per micro second
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
-{
- wd_param_t wd_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- wd_param.wd_fn_type = WD_INIT_SEQ;
- wd_param.wd_base_addr = base_addr;
- wd_param.wd_time_us = time_us;
- wd_param.wd_timer_tick_us = timer_tick_us;
- psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
-
- handle = pal_ipc_connect(DRIVER_WATCHDOG_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Enables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_enable_ns(addr_t base_addr)
-{
- wd_param_t wd_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- wd_param.wd_fn_type = WD_ENABLE_SEQ;
- wd_param.wd_base_addr = base_addr;
- wd_param.wd_time_us = 0;
- wd_param.wd_timer_tick_us = 0;
- psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
-
- handle = pal_ipc_connect(DRIVER_WATCHDOG_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Disables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_disable_ns(addr_t base_addr)
-{
- wd_param_t wd_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- wd_param.wd_fn_type = WD_DISABLE_SEQ;
- wd_param.wd_base_addr = base_addr;
- wd_param.wd_time_us = 0;
- wd_param.wd_timer_tick_us = 0;
- psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
-
- handle = pal_ipc_connect(DRIVER_WATCHDOG_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Reads from given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- nvmem_param_t nvmem_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- nvmem_param.nvmem_fn_type = NVMEM_READ;
- nvmem_param.base = base;
- nvmem_param.offset = offset;
- nvmem_param.size = size;
- psa_invec invec[1] = {{&nvmem_param, sizeof(nvmem_param)}};
- psa_outvec outvec[1] = {{buffer, size}};
-
- handle = pal_ipc_connect(DRIVER_NVMEM_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, outvec, 1);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- psa_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Writes into given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- nvmem_param_t nvmem_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- nvmem_param.nvmem_fn_type = NVMEM_WRITE;
- nvmem_param.base = base;
- nvmem_param.offset = offset;
- nvmem_param.size = size;
- psa_invec invec[2] = {{&nvmem_param, sizeof(nvmem_param)}, {buffer, size}};
-
- handle = pal_ipc_connect(DRIVER_NVMEM_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 2, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- * @brief - This function will read peripherals using SPI commands
- * @param - addr : address of the peripheral
- * data : read buffer
- * len : length of the read buffer in bytes
- * @return - error status
-**/
-int pal_spi_read(addr_t addr, uint8_t *data, uint32_t len)
-{
- return 0xFF;
-}
-
-/**
- * @brief - Terminates the simulation at the end of all tests completion.
- * By default, it put cpus into power down mode.
- * @param - void
- * @return - void
-**/
-void pal_terminate_simulation(void)
-{
- /* Add logic to terminate the simluation */
-
- while(1)
- {
- asm volatile("WFI");
- }
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ns_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ns_intf.c
deleted file mode 100644
index 2af6fcc..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ns_intf.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_uart.h"
-#include "pal_nvmem.h"
-#include "pal_wd_cmsdk.h"
-
-/**
- @brief - This function initializes the UART
- @param - uart base addr
- @return - SUCCESS/FAILURE
-**/
-int pal_uart_init_ns(uint32_t uart_base_addr)
-{
- pal_uart_cmsdk_init(uart_base_addr);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - This function parses the input string and writes bytes into UART TX FIFO
- @param - str : Input String
- - data : Value for format specifier
- @return - SUCCESS/FAILURE
-**/
-
-int pal_print_ns(char *str, int32_t data)
-{
- pal_cmsdk_print(str, data);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Initializes an hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- - time_us : Time in micro seconds
- - timer_tick_us : Number of ticks per micro second
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
-{
- return(pal_wd_cmsdk_init(base_addr,time_us, timer_tick_us));
-}
-
-/**
- @brief - Enables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_enable_ns(addr_t base_addr)
-{
- return(pal_wd_cmsdk_enable(base_addr));
-}
-
-/**
- @brief - Disables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_disable_ns(addr_t base_addr)
-{
- return (pal_wd_cmsdk_disable(base_addr));
-}
-
-/**
- @brief - Reads from given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- if (nvmem_read(base, offset, buffer, size))
- {
- return PAL_STATUS_SUCCESS;
- }
- else
- {
- return PAL_STATUS_ERROR;
- }
-}
-
-/**
- @brief - Writes into given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- if (nvmem_write(base, offset, buffer, size))
- {
- return PAL_STATUS_SUCCESS;
- }
- else
- {
- return PAL_STATUS_ERROR;
- }
-}
-
-/**
- * @brief - This function will read peripherals using SPI commands
- * @param - addr : address of the peripheral
- * data : read buffer
- * len : length of the read buffer in bytes
- * @return - error status
-**/
-int pal_spi_read(addr_t addr, uint8_t *data, uint32_t len)
-{
- return 0xFF;
-}
-
-/**
- * @brief - Terminates the simulation at the end of all tests completion.
- * By default, it put cpus into power down mode.
- * @param - void
- * @return - void
-**/
-void pal_terminate_simulation(void)
-{
- /* Add logic to terminate the simluation */
-
- while(1)
- {
- asm volatile("WFI");
- }
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config.h
deleted file mode 100644
index 6d71d2e..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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.
-**/
-
-/*
- * \file pal_crypto_config.h
- *
- * \brief Configuration options for crypto tests (set of defines)
- *
- * This set of compile-time options may be used to enable
- * or disable features selectively for crypto test suite
- */
-
-#ifndef _PAL_CRYPTO_CONFIG_H_
-#define _PAL_CRYPTO_CONFIG_H_
-/**
- * \def ARCH_TEST_RSA
- *
- * Enable the RSA public-key cryptosystem.
- * By default all supported keys are enabled.
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_RSA
-#define ARCH_TEST_RSA_1024
-#define ARCH_TEST_RSA_2048
-#define ARCH_TEST_RSA_3072
-
-/**
- * \def ARCH_TEST_ECC
- * \def ARCH_TEST_ECC_CURVE_SECPXXXR1
- *
- * Enable the elliptic curve
- * Enable specific curves within the Elliptic Curve
- * module. By default all supported curves are enabled.
- *
- * Requires: ARCH_TEST_ECC
- * Comment macros to disable the curve
- */
-#define ARCH_TEST_ECC
-#define ARCH_TEST_ECC_CURVE_SECP192R1
-#define ARCH_TEST_ECC_CURVE_SECP224R1
-#define ARCH_TEST_ECC_CURVE_SECP256R1
-#define ARCH_TEST_ECC_CURVE_SECP384R1
-
-/**
- * \def ARCH_TEST_AES
- *
- * Enable the AES block cipher.
- * By default all supported keys are enabled.
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_AES
-#define ARCH_TEST_AES_128
-#define ARCH_TEST_AES_192
-#define ARCH_TEST_AES_256
-#define ARCH_TEST_AES_512
-
-/**
- * \def ARCH_TEST_DES
- *
- * Enable the DES block cipher.
- * By default all supported keys are enabled.
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_DES
-#define ARCH_TEST_DES_1KEY
-#define ARCH_TEST_DES_2KEY
-#define ARCH_TEST_DES_3KEY
-
-/**
- * \def ARCH_TEST_RAW
- *
- * A "key" of this type cannot be used for any cryptographic operation.
- * Applications may use this type to store arbitrary data in the keystore.
- */
-#define ARCH_TEST_RAW
-
-/**
- * \def ARCH_TEST_CIPER
- *
- * Enable the generic cipher layer.
- */
-
-#define ARCH_TEST_CIPER
-
-/**
- * \def ARCH_TEST_ARC4
- *
- * Enable the ARC4 key type.
- */
-#define ARCH_TEST_ARC4
-
-/**
- * \def ARCH_TEST_CIPER_MODE_CTR
- *
- * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
- *
- * Requires: ARCH_TEST_CIPER
- */
-#define ARCH_TEST_CIPER_MODE_CTR
-
-/**
- * \def ARCH_TEST_CIPER_MODE_CFB
- *
- * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
- *
- * Requires: ARCH_TEST_CIPER
- */
-#define ARCH_TEST_CIPER_MODE_CFB
-
-/**
- * \def ARCH_TEST_CIPER_MODE_CBC
- *
- * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
- *
- * Requires: ARCH_TEST_CIPER
- */
-#define ARCH_TEST_CIPER_MODE_CBC
-
-/**
- * \def ARCH_TEST_CTR_AES
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CTR
- */
-#define ARCH_TEST_CTR_AES
-
-/**
- * \def ARCH_TEST_CBC_AES
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CBC
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CBC_AES
-#define ARCH_TEST_CBC_AES_NO_PADDING
-
-/**
- * \def ARCH_TEST_CBC_NO_PADDING
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_CIPER_MODE_CBC
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CBC_NO_PADDING
-
-/**
- * \def ARCH_TEST_CFB_AES
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CFB
- */
-#define ARCH_TEST_CFB_AES
-
-/**
- * \def ARCH_TEST_PKCS1V15_*
- *
- * Enable support for PKCS#1 v1.5 encoding.
- * Enable support for PKCS#1 v1.5 operations.
- * Enable support for RSA-OAEP
- *
- * Requires: ARCH_TEST_RSA, ARCH_TEST_PKCS1V15
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_PKCS1V15
-#define ARCH_TEST_RSA_PKCS1V15_SIGN
-#define ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-#define ARCH_TEST_RSA_PKCS1V15_CRYPT
-#define ARCH_TEST_RSA_OAEP
-
-/**
- * \def ARCH_TEST_CBC_PKCS7
- *
- * Requires: ARCH_TEST_CIPER_MODE_CBC
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CBC_PKCS7
-
-/**
- * \def ARCH_TEST_ASYMMETRIC_ENCRYPTION
- *
- * Enable support for Asymmetric encryption algorithms
- */
-#define ARCH_TEST_ASYMMETRIC_ENCRYPTION
-
-/**
- * \def ARCH_TEST_HASH
- *
- * Enable the hash algorithm.
- */
-#define ARCH_TEST_HASH
-
-/**
- * \def ARCH_TEST_HMAC
- *
- * The key policy determines which underlying hash algorithm the key can be
- * used for.
- *
- * Requires: ARCH_TEST_HASH
- */
-#define ARCH_TEST_HMAC
-
-/**
- * \def ARCH_TEST_MDX
- * \def ARCH_TEST_SHAXXX
- *
- * Enable the MDX algorithm.
- * Enable the SHAXXX algorithm.
- *
- * Requires: ARCH_TEST_HASH
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_MD2
-#define ARCH_TEST_MD4
-#define ARCH_TEST_MD5
-#define ARCH_TEST_RIPEMD160
-#define ARCH_TEST_SHA1
-#define ARCH_TEST_SHA224
-#define ARCH_TEST_SHA256
-#define ARCH_TEST_SHA384
-#define ARCH_TEST_SHA512
-#define ARCH_TEST_SHA512_224
-#define ARCH_TEST_SHA512_256
-#define ARCH_TEST_SHA3_224
-#define ARCH_TEST_SHA3_256
-#define ARCH_TEST_SHA3_384
-#define ARCH_TEST_SHA3_512
-
-/**
- * \def ARCH_TEST_HKDF
- *
- * Enable the HKDF algorithm (RFC 5869).
- *
- * Requires: ARCH_TEST_HASH
-*/
-#define ARCH_TEST_HKDF
-
-/**
- * \def ARCH_TEST_xMAC
- *
- * Enable the xMAC (Cipher/Hash/G-based Message Authentication Code) mode for block
- * ciphers.
- * Requires: ARCH_TEST_AES or ARCH_TEST_DES
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CMAC
-#define ARCH_TEST_GMAC
-#define ARCH_TEST_HMAC
-
-/**
- * \def ARCH_TEST_CCM
- *
- * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
- *
- * Requires: ARCH_TEST_AES
- */
-#define ARCH_TEST_CCM
-
-/**
- * \def ARCH_TEST_GCM
- *
- * Enable the Galois/Counter Mode (GCM) for AES.
- *
- * Requires: ARCH_TEST_AES
- *
- */
-#define ARCH_TEST_GCM
-
-/**
- * \def ARCH_TEST_TRUNCATED_MAC
- *
- * Enable support for RFC 6066 truncated HMAC in SSL.
- *
- * Comment this macro to disable support for truncated HMAC in SSL
- */
-#define ARCH_TEST_TRUNCATED_MAC
-
-
-/**
- * \def ARCH_TEST_ECDH
- *
- * Enable the elliptic curve Diffie-Hellman library.
- *
- * Requires: ARCH_TEST_ECC
- */
-#define ARCH_TEST_ECDH
-
-/**
- * \def ARCH_TEST_ECDSA
- *
- * Enable the elliptic curve DSA library.
- * Requires: ARCH_TEST_ECC
- */
-#define ARCH_TEST_ECDSA
-
-/**
- * \def ARCH_TEST_DETERMINISTIC_ECDSA
- *
- * Enable deterministic ECDSA (RFC 6979).
-*/
-#define ARCH_TEST_DETERMINISTIC_ECDSA
-
-#include "pal_crypto_config_check.h"
-
-#endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config_check.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config_check.h
deleted file mode 100644
index 443e0bc..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config_check.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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.
-**/
-
-/**
- * \file pal_crypto_config_check.h
- *
- * \brief Consistency checks for configuration options
- *
- */
-
-#ifndef _PAL_CRYPTO_CONFIG_CHECK_H_
-#define _PAL_CRYPTO_CONFIG_CHECK_H_
-
-#if defined(ARCH_TEST_RSA_1024) && !defined(ARCH_TEST_RSA)
-#error "ARCH_TEST_RSA_1024 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_2048) && !defined(ARCH_TEST_RSA)
-#error "ARCH_TEST_RSA_2048 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_3072) && !defined(ARCH_TEST_RSA)
-#error "ARCH_TEST_RSA_3072 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP192R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP192R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP224R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP224R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP256R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP256R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP384R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP384R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_AES_128) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_AES_128 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_AES_256) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_AES_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_AES_512) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_AES_512 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_DES_1KEY) && !defined(ARCH_TEST_DES)
-#error "ARCH_TEST_DES_1KEY defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_DES_2KEY) && !defined(ARCH_TEST_DES)
-#error "ARCH_TEST_DES_2KEY defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_DES_3KEY) && !defined(ARCH_TEST_DES)
-#error "ARCH_TEST_DES_3KEY defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CIPER_MODE_CTR) && !defined(ARCH_TEST_CIPER)
-#error "ARCH_TEST_CIPER_MODE_CTR defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CIPER_MODE_CFB) && !defined(ARCH_TEST_CIPER)
-#error "ARCH_TEST_CIPER_MODE_CFB defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CIPER_MODE_CBC) && !defined(ARCH_TEST_CIPER)
-#error "ARCH_TEST_CIPER_MODE_CBC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CTR_AES) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_AES) || !defined(ARCH_TEST_CIPER_MODE_CTR))
-#error "ARCH_TEST_CTR_AES defined, but not all prerequisites"
-#endif
-
-#if (defined(ARCH_TEST_CBC_AES) || defined(ARCH_TEST_CBC_AES_NO_PADDING)) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_AES) || !defined(ARCH_TEST_CIPER_MODE_CBC))
-#error "ARCH_TEST_CBC_AES defined, but not all prerequisites"
-#endif
-
-#if (defined(ARCH_TEST_CBC_NO_PADDING)) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_CIPER_MODE_CBC))
-#error "ARCH_TEST_CBC_NO_PADDING defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CFB_AES) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_AES) || !defined(ARCH_TEST_CIPER_MODE_CFB))
-#error "ARCH_TEST_CFB_AES defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_PKCS1V15_SIGN) &&\
- (!defined(ARCH_TEST_RSA) || !defined(ARCH_TEST_PKCS1V15))
-#error "ARCH_TEST_RSA_PKCS1V15_SIGN defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_PKCS1V15_SIGN_RAW) &&\
- (!defined(ARCH_TEST_RSA) || !defined(ARCH_TEST_PKCS1V15))
-#error "ARCH_TEST_RSA_PKCS1V15_SIGN_RAW defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_PKCS1V15_CRYPT) &&\
- (!defined(ARCH_TEST_RSA) || !defined(ARCH_TEST_PKCS1V15))
-#error "ARCH_TEST_RSA_PKCS1V15_CRYPT defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CBC_PKCS7) && !defined(ARCH_TEST_CIPER_MODE_CBC)
-#error "ARCH_TEST_CBC_PKCS7 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_HMAC) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_HMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_MD2) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_MD2 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_MD4) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_MD4 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_MD5) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_MD5 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RIPEMD160) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_RIPEMD160 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA1) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA224) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA224 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA256) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA512) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA512 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA512_224) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA512_224 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA512_256) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA512_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_224) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_224 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_256) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_384) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_512) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_HKDF) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_HKDF defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CMAC) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_CMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_GMAC) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_GMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_HMAC) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_HMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CCM) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_CCM defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_GCM) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_GCM defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECDH) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECDH defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECDSA) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECDSA defined, but not all prerequisites"
-#endif
-
-#endif /* _PAL_CRYPTO_CONFIG_CHECK_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_empty_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_empty_intf.c
deleted file mode 100644
index 2a28f39..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested crypto function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_crypto_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.c
deleted file mode 100644
index fd2e055..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_crypto_intf.h"
-
-#define PAL_KEY_SLOT_COUNT 32
-
-/**
- @brief - This API will call the requested crypto function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_crypto_function(int type, va_list valist)
-{
- int i;
- psa_status_t status;
- uint8_t *buffer, *ciphertext, *plaintext;
- const uint8_t *nonce, *additional_data, *salt, *peer;
- size_t *length, size, ciphertext_size, nonce_length;
- size_t salt_length, peer_length, additional_data_length;
- size_t *tag_length, plaintext_size;
- psa_aead_operation_t *aead_operation;
- psa_key_attributes_t *attributes;
- psa_key_handle_t *handle, key_handle;
- psa_key_type_t *key_type_out, key_type;
- psa_key_usage_t *usage_out, usage;
- psa_key_id_t *key_id_out, key_id;
- psa_key_lifetime_t *key_lifetime_out, key_lifetime;
- psa_algorithm_t *key_alg_out, key_alg, alg;
- psa_hash_operation_t *hash_operation, *target_operation;
- psa_mac_operation_t *mac_operation;
- psa_cipher_operation_t *cipher_operation;
- psa_key_derivation_operation_t *derive_operation;
- psa_key_derivation_step_t step;
- switch (type)
- {
- case PAL_CRYPTO_INIT:
- return psa_crypto_init();
- case PAL_CRYPTO_GENERATE_RANDOM:
- buffer = va_arg(valist, uint8_t *);
- size = va_arg(valist, int);
- return psa_generate_random(buffer, size);
- case PAL_CRYPTO_IMPORT_KEY:
- attributes = va_arg(valist, psa_key_attributes_t *);
- buffer = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- status = psa_import_key(attributes, buffer, size, handle);
- return status;
- case PAL_CRYPTO_SET_KEY_TYPE:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_type = va_arg(valist, psa_key_type_t);
- psa_set_key_type(attributes, key_type);
- return 0;
- case PAL_CRYPTO_SET_KEY_BITS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- size = va_arg(valist, size_t);
- psa_set_key_bits(attributes, size);
- return 0;
- case PAL_CRYPTO_GET_KEY_ATTRIBUTES:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- attributes = va_arg(valist, psa_key_attributes_t *);
- return psa_get_key_attributes(key_handle, attributes);
- case PAL_CRYPTO_GET_KEY_TYPE:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_type_out = va_arg(valist, psa_key_type_t *);
- *key_type_out = psa_get_key_type(attributes);
- return 0;
- case PAL_CRYPTO_EXPORT_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- buffer = (uint8_t *)(va_arg(valist, uint8_t *));
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t *);
- return psa_export_key(key_handle, buffer, size, length);
- case PAL_CRYPTO_SET_KEY_USAGE_FLAGS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- usage = va_arg(valist, psa_key_usage_t);
- psa_set_key_usage_flags(attributes, usage);
- return 0;
- case PAL_CRYPTO_RESET_KEY_ATTRIBUTES:
- attributes = va_arg(valist, psa_key_attributes_t *);
- psa_reset_key_attributes(attributes);
- return 0;
- case PAL_CRYPTO_EXPORT_PUBLIC_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- buffer = (uint8_t *)(va_arg(valist, uint8_t *));
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t *);
- return psa_export_public_key(key_handle, buffer, size, length);
- case PAL_CRYPTO_SET_KEY_ID:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_id = va_arg(valist, psa_key_id_t);
- psa_set_key_id(attributes, key_id);
- return 0;
- case PAL_CRYPTO_SET_KEY_LIFETIME:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_lifetime = va_arg(valist, psa_key_lifetime_t);
- psa_set_key_lifetime(attributes, key_lifetime);
- return 0;
- case PAL_CRYPTO_SET_KEY_ALGORITHM:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_alg = va_arg(valist, psa_algorithm_t);
- psa_set_key_algorithm(attributes, key_alg);
- return 0;
- case PAL_CRYPTO_GET_KEY_ID:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_id_out = va_arg(valist, psa_key_id_t *);
- *key_id_out = psa_get_key_id(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_LIFETIME:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_lifetime_out = va_arg(valist, psa_key_lifetime_t *);
- *key_lifetime_out = psa_get_key_lifetime(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_USAGE_FLAGS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- usage_out = va_arg(valist, psa_key_usage_t *);
- *usage_out = psa_get_key_usage_flags(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_ALGORITHM:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_alg_out = va_arg(valist, psa_algorithm_t *);
- *key_alg_out = psa_get_key_algorithm(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_BITS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- length = va_arg(valist, size_t *);
- *length = psa_get_key_bits(attributes);
- return 0;
- case PAL_CRYPTO_DESTROY_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- return psa_destroy_key(key_handle);
- case PAL_CRYPTO_HASH_SETUP:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_hash_setup(hash_operation, alg);
- case PAL_CRYPTO_HASH_UPDATE:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_hash_update(hash_operation, buffer, size);
- case PAL_CRYPTO_HASH_VERIFY:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_hash_verify(hash_operation, buffer, size);
- case PAL_CRYPTO_HASH_FINISH:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_hash_finish(hash_operation, buffer, size, length);
- case PAL_CRYPTO_HASH_ABORT:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- return psa_hash_abort(hash_operation);
- case PAL_CRYPTO_HASH_COMPUTE:
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_hash_compute(alg, plaintext, plaintext_size, buffer, size, length);
- case PAL_CRYPTO_HASH_COMPARE:
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_hash_compare(alg, plaintext, plaintext_size, buffer, size);
- case PAL_CRYPTO_HASH_CLONE:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- target_operation = va_arg(valist, psa_hash_operation_t*);
- return psa_hash_clone(hash_operation, target_operation);
- case PAL_CRYPTO_GENERATE_KEY:
- attributes = va_arg(valist, psa_key_attributes_t *);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_generate_key(attributes, handle);
- case PAL_CRYPTO_AEAD_ENCRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- nonce = va_arg(valist, const uint8_t *);
- nonce_length = va_arg(valist, size_t);
- additional_data = va_arg(valist, const uint8_t *);
- additional_data_length = va_arg(valist, size_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_aead_encrypt(key_handle, alg, nonce, nonce_length, additional_data,
- additional_data_length, plaintext, size, ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_AEAD_DECRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- nonce = va_arg(valist, const uint8_t *);
- nonce_length = va_arg(valist, size_t);
- additional_data = va_arg(valist, const uint8_t *);
- additional_data_length = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_aead_decrypt(key_handle, alg, nonce, nonce_length, additional_data,
- additional_data_length, ciphertext, ciphertext_size, plaintext, size, length);
- case PAL_CRYPTO_AEAD_ENCRYPT_SETUP:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_aead_encrypt_setup(aead_operation, key_handle, alg);
- case PAL_CRYPTO_AEAD_DECRYPT_SETUP:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_aead_decrypt_setup(aead_operation, key_handle, alg);
- case PAL_CRYPTO_AEAD_GENERATE_NONCE:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t*);
- return psa_aead_generate_nonce(aead_operation, buffer, size, length);
- case PAL_CRYPTO_AEAD_SET_NONCE:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_aead_set_nonce(aead_operation, buffer, size);
- case PAL_CRYPTO_AEAD_SET_LENGTHS:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- size = va_arg(valist, size_t);
- plaintext_size = va_arg(valist, size_t);
- return psa_aead_set_lengths(aead_operation, size, plaintext_size);
- case PAL_CRYPTO_AEAD_UPDATE_AD:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_aead_update_ad(aead_operation, buffer, size);
- case PAL_CRYPTO_AEAD_UPDATE:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_aead_update(aead_operation, plaintext, plaintext_size, ciphertext,
- ciphertext_size, length);
- case PAL_CRYPTO_AEAD_FINISH:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- tag_length = (size_t *)va_arg(valist, size_t*);
- return psa_aead_finish(aead_operation, ciphertext, ciphertext_size, length, buffer,
- size, tag_length);
- case PAL_CRYPTO_AEAD_VERIFY:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_aead_verify(aead_operation, plaintext, plaintext_size, length, buffer, size);
- case PAL_CRYPTO_AEAD_ABORT:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- return psa_aead_abort(aead_operation);
- case PAL_CRYPTO_MAC_SIGN_SETUP:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_mac_sign_setup(mac_operation, key_handle, alg);
- case PAL_CRYPTO_MAC_UPDATE:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_mac_update(mac_operation, buffer, size);
- case PAL_CRYPTO_MAC_SIGN_FINISH:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t*);
- return psa_mac_sign_finish(mac_operation, buffer, size, length);
- case PAL_CRYPTO_MAC_VERIFY_SETUP:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_mac_verify_setup(mac_operation, key_handle, alg);
- case PAL_CRYPTO_MAC_VERIFY_FINISH:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_mac_verify_finish(mac_operation, buffer, size);
- case PAL_CRYPTO_MAC_ABORT:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- return psa_mac_abort(mac_operation);
- case PAL_CRYPTO_MAC_COMPUTE:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_mac_compute(key_handle, alg, plaintext, plaintext_size, ciphertext,
- ciphertext_size, length);
- case PAL_CRYPTO_MAC_VERIFY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- return psa_mac_verify(key_handle, alg, plaintext, plaintext_size, ciphertext,
- ciphertext_size);
- case PAL_CRYPTO_ASYMMTERIC_ENCRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- salt = va_arg(valist, const uint8_t *);
- salt_length = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_asymmetric_encrypt(key_handle, alg, plaintext, size, salt, salt_length,
- ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_ASYMMTERIC_DECRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- salt = va_arg(valist, const uint8_t *);
- salt_length = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_asymmetric_decrypt(key_handle, alg, plaintext, size, salt, salt_length,
- ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_CIPHER_ENCRYPT_SETUP:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_cipher_encrypt_setup(cipher_operation, key_handle, alg);
- case PAL_CRYPTO_CIPHER_DECRYPT_SETUP:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_cipher_decrypt_setup(cipher_operation, key_handle, alg);
- case PAL_CRYPTO_CIPHER_GENERATE_IV:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_generate_iv(cipher_operation, buffer, size, length);
- case PAL_CRYPTO_CIPHER_SET_IV:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_cipher_set_iv(cipher_operation, buffer, size);
- case PAL_CRYPTO_CIPHER_UPDATE:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_update(cipher_operation, plaintext, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_CIPHER_FINISH:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_finish(cipher_operation, ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_CIPHER_ABORT:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- return psa_cipher_abort(cipher_operation);
- case PAL_CRYPTO_CIPHER_ENCRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_encrypt(key_handle, alg, plaintext, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_CIPHER_DECRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_decrypt(key_handle, alg, plaintext, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_ASYMMTERIC_SIGN:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_asymmetric_sign(key_handle, alg, buffer, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_ASYMMTERIC_VERIFY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- return psa_asymmetric_verify(key_handle, alg, buffer, size, ciphertext,
- ciphertext_size);
- case PAL_CRYPTO_RAW_KEY_AGREEMENT:
- alg = va_arg(valist, psa_algorithm_t);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- peer = va_arg(valist, uint8_t*);
- peer_length = va_arg(valist, size_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_raw_key_agreement(alg, key_handle, peer, peer_length, buffer, size, length);
- case PAL_CRYPTO_COPY_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- attributes = va_arg(valist, psa_key_attributes_t *);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_copy_key(key_handle, attributes, handle);
- case PAL_CRYPTO_KEY_DERIVATION_SETUP:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_key_derivation_setup(derive_operation, alg);
- case PAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- step = (psa_key_derivation_step_t)va_arg(valist, int);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_key_derivation_input_bytes(derive_operation, step, buffer, size);
- case PAL_CRYPTO_KEY_DERIVATION_INPUT_KEY:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- step = (psa_key_derivation_step_t)va_arg(valist, int);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- return psa_key_derivation_input_key(derive_operation, step, key_handle);
- case PAL_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- step = (psa_key_derivation_step_t)va_arg(valist, int);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- peer = va_arg(valist, uint8_t*);
- peer_length = va_arg(valist, size_t);
- return psa_key_derivation_key_agreement(derive_operation, step, key_handle, peer,
- peer_length);
- case PAL_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_key_derivation_output_bytes(derive_operation, buffer, size);
- case PAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY:
- attributes = va_arg(valist, psa_key_attributes_t *);
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_key_derivation_output_key(attributes, derive_operation, handle);
- case PAL_CRYPTO_KEY_DERIVATION_SET_CAPACITY:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- size = va_arg(valist, size_t);
- return psa_key_derivation_set_capacity(derive_operation, size);
- case PAL_CRYPTO_KEY_DERIVATION_GET_CAPACITY:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- length = va_arg(valist, size_t *);
- return psa_key_derivation_get_capacity(derive_operation, length);
- case PAL_CRYPTO_KEY_DERIVATION_ABORT:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- return psa_key_derivation_abort(derive_operation);
- case PAL_CRYPTO_OPEN_KEY:
- key_id = va_arg(valist, psa_key_id_t);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_open_key(key_id, handle);
- case PAL_CRYPTO_CLOSE_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- return psa_close_key(key_handle);
- case PAL_CRYPTO_FREE:
- for (i = 0; i < PAL_KEY_SLOT_COUNT; i++)
- psa_destroy_key(i);
- return 0;
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.h
deleted file mode 100644
index 671dfa0..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_CRYPTO_INTF_H_
-#define _PAL_CRYPTO_INTF_H_
-
-#include "pal_common.h"
-
-enum crypto_function_code {
- PAL_CRYPTO_INIT = 0x1,
- PAL_CRYPTO_GENERATE_RANDOM = 0x2,
- PAL_CRYPTO_IMPORT_KEY = 0x3,
- PAL_CRYPTO_EXPORT_KEY = 0x4,
- PAL_CRYPTO_EXPORT_PUBLIC_KEY = 0x5,
- PAL_CRYPTO_DESTROY_KEY = 0x6,
- PAL_CRYPTO_HASH_SETUP = 0x7,
- PAL_CRYPTO_HASH_UPDATE = 0x8,
- PAL_CRYPTO_HASH_VERIFY = 0x9,
- PAL_CRYPTO_HASH_FINISH = 0xA,
- PAL_CRYPTO_HASH_ABORT = 0xB,
- PAL_CRYPTO_GENERATE_KEY = 0xC,
- PAL_CRYPTO_AEAD_ENCRYPT = 0xD,
- PAL_CRYPTO_AEAD_DECRYPT = 0xE,
- PAL_CRYPTO_MAC_SIGN_SETUP = 0xF,
- PAL_CRYPTO_MAC_UPDATE = 0x10,
- PAL_CRYPTO_MAC_SIGN_FINISH = 0x11,
- PAL_CRYPTO_MAC_VERIFY_SETUP = 0x12,
- PAL_CRYPTO_MAC_VERIFY_FINISH = 0x13,
- PAL_CRYPTO_MAC_ABORT = 0x14,
- PAL_CRYPTO_ASYMMTERIC_ENCRYPT = 0x15,
- PAL_CRYPTO_ASYMMTERIC_DECRYPT = 0x16,
- PAL_CRYPTO_CIPHER_ENCRYPT_SETUP = 0x17,
- PAL_CRYPTO_CIPHER_DECRYPT_SETUP = 0x18,
- PAL_CRYPTO_CIPHER_GENERATE_IV = 0x19,
- PAL_CRYPTO_CIPHER_SET_IV = 0x1A,
- PAL_CRYPTO_CIPHER_UPDATE = 0x1B,
- PAL_CRYPTO_CIPHER_FINISH = 0x1C,
- PAL_CRYPTO_CIPHER_ABORT = 0x1D,
- PAL_CRYPTO_ASYMMTERIC_SIGN = 0x1E,
- PAL_CRYPTO_ASYMMTERIC_VERIFY = 0x1F,
- PAL_CRYPTO_COPY_KEY = 0x20,
- PAL_CRYPTO_SET_KEY_TYPE = 0x21,
- PAL_CRYPTO_SET_KEY_BITS = 0x22,
- PAL_CRYPTO_GET_KEY_ATTRIBUTES = 0x23,
- PAL_CRYPTO_GET_KEY_TYPE = 0x24,
- PAL_CRYPTO_SET_KEY_USAGE_FLAGS = 0x25,
- PAL_CRYPTO_RESET_KEY_ATTRIBUTES = 0x26,
- PAL_CRYPTO_SET_KEY_ID = 0x27,
- PAL_CRYPTO_SET_KEY_LIFETIME = 0x28,
- PAL_CRYPTO_SET_KEY_ALGORITHM = 0x29,
- PAL_CRYPTO_GET_KEY_ID = 0x2A,
- PAL_CRYPTO_GET_KEY_LIFETIME = 0x2B,
- PAL_CRYPTO_GET_KEY_USAGE_FLAGS = 0x2C,
- PAL_CRYPTO_GET_KEY_ALGORITHM = 0x2D,
- PAL_CRYPTO_GET_KEY_BITS = 0x2E,
- PAL_CRYPTO_HASH_COMPUTE = 0x2F,
- PAL_CRYPTO_HASH_COMPARE = 0x30,
- PAL_CRYPTO_KEY_DERIVATION_SETUP = 0x31,
- PAL_CRYPTO_KEY_DERIVATION_ABORT = 0x32,
- PAL_CRYPTO_RAW_KEY_AGREEMENT = 0x33,
- PAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES = 0x34,
- PAL_CRYPTO_KEY_DERIVATION_INPUT_KEY = 0x35,
- PAL_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT = 0x36,
- PAL_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES = 0x37,
- PAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY = 0x38,
- PAL_CRYPTO_KEY_DERIVATION_SET_CAPACITY = 0x39,
- PAL_CRYPTO_KEY_DERIVATION_GET_CAPACITY = 0x3A,
- PAL_CRYPTO_HASH_CLONE = 0x3B,
- PAL_CRYPTO_MAC_COMPUTE = 0x3C,
- PAL_CRYPTO_MAC_VERIFY = 0x3D,
- PAL_CRYPTO_CIPHER_ENCRYPT = 0x3F,
- PAL_CRYPTO_CIPHER_DECRYPT = 0x40,
- PAL_CRYPTO_OPEN_KEY = 0x41,
- PAL_CRYPTO_CLOSE_KEY = 0x42,
- PAL_CRYPTO_AEAD_ENCRYPT_SETUP = 0x43,
- PAL_CRYPTO_AEAD_DECRYPT_SETUP = 0x44,
- PAL_CRYPTO_AEAD_GENERATE_NONCE = 0x45,
- PAL_CRYPTO_AEAD_SET_NONCE = 0x46,
- PAL_CRYPTO_AEAD_SET_LENGTHS = 0X47,
- PAL_CRYPTO_AEAD_UPDATE_AD = 0x48,
- PAL_CRYPTO_AEAD_UPDATE = 0x49,
- PAL_CRYPTO_AEAD_FINISH = 0x4A,
- PAL_CRYPTO_AEAD_VERIFY = 0x4B,
- PAL_CRYPTO_AEAD_ABORT = 0x4C,
- PAL_CRYPTO_FREE = 0xFE,
-};
-
-int32_t pal_crypto_function(int type, va_list valist);
-#endif /* _PAL_CRYPTO_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.c
deleted file mode 100644
index 04fe5ef..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_attestation_crypto.h"
-
-static uint32_t public_key_registered;
-static psa_key_handle_t public_key_handle;
-
-static inline struct q_useful_buf_c useful_buf_head(struct q_useful_buf_c buf,
- size_t amount)
-{
- return UsefulBuf_Head(buf, amount);
-}
-
-static psa_algorithm_t cose_hash_alg_id_to_psa(int32_t cose_hash_alg_id)
-{
- psa_algorithm_t status;
-
- switch (cose_hash_alg_id)
- {
- case COSE_ALG_SHA256_PROPRIETARY:
- status = PSA_ALG_SHA_256;
- break;
- default:
- status = PSA_ALG_MD4;
- break;
- }
-
- return status;
-}
-
-static int32_t hash_alg_id_from_sig_alg_id(int32_t cose_sig_alg_id)
-{
- switch (cose_sig_alg_id)
- {
- case COSE_ALGORITHM_ES256:
- return COSE_ALG_SHA256_PROPRIETARY;
- default:
- return INT32_MAX;
- }
-}
-
-int32_t pal_cose_crypto_hash_start(psa_hash_operation_t *psa_hash, int32_t cose_hash_alg_id)
-{
- psa_algorithm_t psa_alg;
- psa_status_t status = PSA_ERROR_GENERIC_ERROR;
-
- /* Map the algorithm ID */
- psa_alg = cose_hash_alg_id_to_psa(cose_hash_alg_id);
-
- /* Actually do the hash set up */
- status = psa_hash_setup(psa_hash, psa_alg);
-
- return status;
-
-}
-
-void pal_cose_crypto_hash_update(psa_hash_operation_t *psa_hash,
- struct q_useful_buf_c data_to_hash)
-{
- if (data_to_hash.ptr == NULL) {
- /* No data was passed in to be hashed indicating the mode of use is
- * the computation of the size of hash. This mode is hashing is used
- * by t_cose when it is requested to compute the size of the signed
- * data it might compute, which is in turn used to compute the
- * size of a would be token. When computing the size, the size
- * like this, there is nothing to do in update()
- */
- return;
- }
-
- /* Actually hash the data */
- psa_hash_update(psa_hash, data_to_hash.ptr, data_to_hash.len);
-}
-
-int32_t pal_cose_crypto_hash_finish(psa_hash_operation_t *psa_hash,
- struct q_useful_buf buffer_to_hold_result,
- struct q_useful_buf_c *hash_result)
-{
- psa_status_t status = PSA_ERROR_GENERIC_ERROR;
-
- /* Actually finish up the hash */
- status = psa_hash_finish(psa_hash, buffer_to_hold_result.ptr,
- buffer_to_hold_result.len, &(hash_result->len));
- hash_result->ptr = buffer_to_hold_result.ptr;
-
- return status;
-
-}
-
-int pal_create_sha256(struct q_useful_buf_c bytes_to_hash, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash)
-{
- psa_status_t status = PSA_ERROR_GENERIC_ERROR;
- psa_hash_operation_t psa_hash = PSA_HASH_OPERATION_INIT;
-
- status = pal_cose_crypto_hash_start(&psa_hash, COSE_ALG_SHA256_PROPRIETARY);
- if (status != PSA_SUCCESS)
- goto Done;
-
- pal_cose_crypto_hash_update(&psa_hash, bytes_to_hash);
-
- status = pal_cose_crypto_hash_finish(&psa_hash, buffer_for_hash, hash);
- if (status != PSA_SUCCESS)
- goto Done;
-Done:
- return status;
-}
-
-/**
- @brief - Computes hash for the requested data
- @param - cose_alg_id : Algorithm ID
- - buffer_for_hash : Temp buffer for calculating hash
- - hash : Pointer to store the hash
- - protected_headers : Buffer containing protected data
- - payload : payload data
- @return - SUCCESS/ERROR CODE
-**/
-uint32_t pal_compute_hash(int32_t cose_alg_id, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash, struct q_useful_buf_c protected_headers,
- struct q_useful_buf_c payload)
-{
- uint32_t status;
- QCBOREncodeContext cbor_encode_ctx;
- struct q_useful_buf_c tbs_first_part;
- QCBORError qcbor_result;
- int32_t hash_alg_id;
- UsefulBuf_MAKE_STACK_UB (buffer_for_TBS_first_part, T_COSE_SIZE_OF_TBS);
- psa_hash_operation_t psa_hash = PSA_HASH_OPERATION_INIT;
-
- /* This builds the CBOR-format to-be-signed bytes */
- QCBOREncode_Init(&cbor_encode_ctx, buffer_for_TBS_first_part);
- QCBOREncode_OpenArray(&cbor_encode_ctx);
-
- /* context */
- QCBOREncode_AddSZString(&cbor_encode_ctx, COSE_SIG_CONTEXT_STRING_SIGNATURE1);
-
- /* body_protected */
- QCBOREncode_AddBytes(&cbor_encode_ctx, protected_headers);
-
- /* sign_protected is not used for Sign1 */
- /* external_aad */
- QCBOREncode_AddBytes(&cbor_encode_ctx, NULL_USEFUL_BUF_C);
-
- /* The short fake payload. */
- QCBOREncode_AddBytesLenOnly(&cbor_encode_ctx, payload);
- QCBOREncode_CloseArray(&cbor_encode_ctx);
-
- /* Get the result and convert it to struct q_useful_buf_c representation */
- qcbor_result = QCBOREncode_Finish(&cbor_encode_ctx, &tbs_first_part);
- if (qcbor_result)
- {
- /* Mainly means that the protected_headers were too big
- * (which should never happen)
- */
- status = PAL_ATTEST_ERR_SIGN_STRUCT;
- goto Done;
- }
-
- /* Start the hashing */
- hash_alg_id = hash_alg_id_from_sig_alg_id(cose_alg_id);
-
- /* Don't check hash_alg_id for failure. pal_cose_crypto_hash_start()
- * will handle it properly
- */
- status = pal_cose_crypto_hash_start(&psa_hash, hash_alg_id);
- if (status)
- goto Done;
-
- /* This is hashing of the first part, all the CBOR
- * except the payload.
- */
- pal_cose_crypto_hash_update(&psa_hash, useful_buf_head(tbs_first_part, tbs_first_part.len));
-
- /* Hash the payload, the second part. */
- pal_cose_crypto_hash_update(&psa_hash, payload);
-
- /* Finish the hash and set up to return it */
- status = pal_cose_crypto_hash_finish(&psa_hash, buffer_for_hash, hash);
-
-Done:
- return status;
-}
-
-static int32_t pal_attest_get_public_key(uint8_t *public_key_buff, size_t public_key_buf_size,
- size_t *public_key_len, psa_ecc_curve_t *elliptic_curve_type)
-{
- int32_t status = PAL_ATTEST_ERROR;
-
-#ifdef PLATFORM_OVERRIDE_ATTEST_PK
- if (public_key_buf_size < (attest_key.pubx_key_size + attest_key.puby_key_size + 1))
- return PAL_ATTEST_ERR_SMALL_BUFFER;
-
- *public_key_len = (attest_key.pubx_key_size + attest_key.puby_key_size + 1);
- *elliptic_curve_type = PSA_ECC_CURVE_SECP256R1;
- memcpy(public_key_buff, (void *)&attest_public_key, *public_key_len);
- status = PSA_SUCCESS;
-#else
- status = tfm_initial_attest_get_public_key(public_key_buff,
- public_key_buf_size,
- public_key_len,
- elliptic_curve_type);
-#endif
-
- return status;
-}
-
-static uint32_t pal_import_attest_key(psa_algorithm_t key_alg)
-{
- psa_status_t status = PAL_ATTEST_ERROR;
- psa_key_usage_t usage = PSA_KEY_USAGE_VERIFY;
- psa_ecc_curve_t ecc_curve;
- psa_key_type_t attest_key_type;
- size_t public_key_size;
- uint8_t public_key_buff[ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH] = {0};
-
-#if defined(CRYPTO_VERSION_BETA1) || defined(CRYPTO_VERSION_BETA2)
- psa_key_policy_t policy;
-
- if (!public_key_registered)
- {
- status = pal_attest_get_public_key(public_key_buff,
- sizeof(public_key_buff),
- &public_key_size,
- &ecc_curve);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- if (ecc_curve == USHRT_MAX)
- return PAL_ATTEST_ERROR;
-
- /* Set key type for public key */
- attest_key_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY(ecc_curve);
-
- /* Setup the key policy for public key */
- policy = psa_key_policy_init();
- psa_key_policy_set_usage(&policy, usage, key_alg);
-
- status = psa_allocate_key(&public_key_handle);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- status = psa_set_key_policy(public_key_handle, &policy);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- /* Import the public key */
- status = psa_import_key(public_key_handle,
- attest_key_type,
- public_key_buff,
- public_key_size);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- public_key_registered = 1;
- }
-
-#elif defined(CRYPTO_VERSION_BETA3)
- psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
- if (!public_key_registered)
- {
- status = pal_attest_get_public_key(public_key_buff,
- sizeof(public_key_buff),
- &public_key_size,
- &ecc_curve);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- if (ecc_curve == USHRT_MAX)
- return PAL_ATTEST_ERROR;
-
- /* Set key type for public key */
- attest_key_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY(ecc_curve);
-
- /* Set the attributes for the public key */
- psa_set_key_type(&attributes, attest_key_type);
- psa_set_key_bits(&attributes, public_key_size);
- psa_set_key_usage_flags(&attributes, usage);
- psa_set_key_algorithm(&attributes, key_alg);
-
- /* Import the public key */
- status = psa_import_key(&attributes,
- public_key_buff,
- public_key_size,
- &public_key_handle);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- public_key_registered = 1;
- }
-#endif
-
- return status;
-}
-
-static uint32_t pal_destroy_attest_key(void)
-{
- psa_status_t status;
-
- if (!public_key_registered)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- status = psa_destroy_key(public_key_handle);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- public_key_registered = 0;
-
- return PAL_ATTEST_SUCCESS;
-}
-
-/**
- @brief - Verify the signature using the public key
- @param - cose_algorithm_id : Algorithm ID
- - token_hash : Data that needs to be verified
- - signature : Signature to be verified against
- @return - SUCCESS/ERROR CODE
-**/
-uint32_t pal_crypto_pub_key_verify(int32_t cose_algorithm_id,
- struct q_useful_buf_c token_hash,
- struct q_useful_buf_c signature)
-{
- int32_t status = PAL_ATTEST_ERROR;
- psa_algorithm_t key_alg = PSA_ALG_ECDSA(PSA_ALG_SHA_256);
-
- /* Register the attestation public key */
- status = pal_import_attest_key(key_alg);
- if (status != PAL_ATTEST_SUCCESS)
- return status;
-
- /* Verify the signature */
- status = psa_asymmetric_verify(public_key_handle,
- key_alg, token_hash.ptr, token_hash.len,
- signature.ptr, signature.len);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_SIGNATURE_FAIL;
-
- /* Unregister the attestation public key */
- status = pal_destroy_attest_key();
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- return PAL_ATTEST_SUCCESS;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.h
deleted file mode 100644
index 559a24c..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_ATTESTATION_CRYPTO_H_
-#define _PAL_ATTESTATION_CRYPTO_H_
-
-#include "pal_attestation_eat.h"
-
-#define ATTEST_PUBLIC_KEY_SLOT 4
-#define ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH (1 + 2 * PSA_BITS_TO_BYTES(256))
-
-typedef struct {
- uint8_t *pubx_key;
- size_t pubx_key_size;
- uint8_t *puby_key;
- size_t puby_key_size;
-} ecc_key_t;
-
-struct ecc_public_key_t {
- const uint8_t a;
- uint8_t public_key[]; /* X-coordinate || Y-coordinate */
-};
-
-static const struct ecc_public_key_t attest_public_key = {
- /* Constant byte */
- 0x04,
- /* X-coordinate */
- {0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
- 0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
- 0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
- 0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F,
- /* Y-coordinate */
- 0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
- 0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
- 0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
- 0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64},
-};
-
-static const uint8_t initial_attestation_public_x_key[] = {
- 0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
- 0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
- 0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
- 0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F
-};
-
-static const uint8_t initial_attestation_public_y_key[] = {
- 0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
- 0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
- 0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
- 0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64
-};
-
-/* Initialize the structure with given public key */
-static const ecc_key_t attest_key = {
- (uint8_t *)initial_attestation_public_x_key,
- sizeof(initial_attestation_public_x_key),
- (uint8_t *)initial_attestation_public_y_key,
- sizeof(initial_attestation_public_y_key)
-};
-
-int32_t pal_cose_crypto_hash_start(psa_hash_operation_t *psa_hash, int32_t cose_hash_alg_id);
-void pal_cose_crypto_hash_update(psa_hash_operation_t *psa_hash,
- struct q_useful_buf_c data_to_hash);
-int32_t pal_cose_crypto_hash_finish(psa_hash_operation_t *psa_hash,
- struct q_useful_buf buffer_to_hold_result,
- struct q_useful_buf_c *hash_result);
-int pal_create_sha256(struct q_useful_buf_c bytes_to_hash, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash);
-uint32_t pal_compute_hash(int32_t cose_alg_id, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash, struct q_useful_buf_c protected_headers,
- struct q_useful_buf_c payload);
-uint32_t pal_crypto_pub_key_verify(int32_t cose_algorithm_id, struct q_useful_buf_c token_hash,
- struct q_useful_buf_c signature);
-#endif /* _PAL_ATTESTATION_CRYPTO_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_eat.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_eat.h
deleted file mode 100644
index fae5434..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_eat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_ATTESTATION_EAT_H_
-#define _PAL_ATTESTATION_EAT_H_
-
-#include "qcbor.h"
-#include "pal_common.h"
-
-#define PAL_ATTEST_MIN_ERROR 30
-
-#define COSE_ALGORITHM_ES256 -7
-#define COSE_ALG_SHA256_PROPRIETARY -72000
-
-#define USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB
-
-#define COSE_SIG_CONTEXT_STRING_SIGNATURE1 "Signature1"
-
-/* Private value. Intentionally not documented for Doxygen.
- * This is the size allocated for the encoded protected headers. It
- * needs to be big enough for make_protected_header() to succeed. It
- * currently sized for one header with an algorithm ID up to 32 bits
- * long -- one byte for the wrapping map, one byte for the label, 5
- * bytes for the ID. If this is made accidentially too small, QCBOR will
- * only return an error, and not overrun any buffers.
- *
- * 9 extra bytes are added, rounding it up to 16 total, in case some
- * other protected header is to be added.
- */
-#define T_COSE_SIGN1_MAX_PROT_HEADER (1+1+5+9)
-
-/**
- * This is the size of the first part of the CBOR encoded TBS
- * bytes. It is around 20 bytes. See create_tbs_hash().
- */
-#define T_COSE_SIZE_OF_TBS \
- 1 + /* For opening the array */ \
- sizeof(COSE_SIG_CONTEXT_STRING_SIGNATURE1) + /* "Signature1" */ \
- 2 + /* Overhead for encoding string */ \
- T_COSE_SIGN1_MAX_PROT_HEADER + /* entire protected headers */ \
- 3 * (/* 3 NULL bstrs for fields not used */ \
- 1 /* size of a NULL bstr */ \
- )
-#define NULL_USEFUL_BUF_C NULLUsefulBufC
-
-enum attestation_error_code {
- PAL_ATTEST_SUCCESS = 0,
- PAL_ATTEST_TOKEN_ERR_CBOR_FORMATTING = PAL_ATTEST_MIN_ERROR,
- PAL_ATTEST_TOKEN_CHALLENGE_MISMATCH,
- PAL_ATTEST_TOKEN_NOT_SUPPORTED,
- PAL_ATTEST_TOKEN_NOT_ALL_MANDATORY_CLAIMS,
- PAL_ATTEST_HASH_LENGTH_MISMATCH,
- PAL_ATTEST_HASH_MISMATCH,
- PAL_ATTEST_HASH_FAIL,
- PAL_ATTEST_HASH_UNSUPPORTED,
- PAL_ATTEST_HASH_BUFFER_SIZE,
- PAL_ATTEST_ERR_PROTECTED_HEADERS,
- PAL_ATTEST_ERR_SIGN_STRUCT,
- PAL_ATTEST_ERR_KEY_FAIL,
- PAL_ATTEST_ERR_SIGNATURE_FAIL,
- PAL_ATTEST_ERR_CBOR_STRUCTURE,
- PAL_ATTEST_ERR_SMALL_BUFFER,
- PAL_ATTEST_ERROR,
-};
-
-#endif /* _PAL_ATTESTATION_EAT_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_empty_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_empty_intf.c
deleted file mode 100644
index faf3f49..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested attestation function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_attestation_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.c
deleted file mode 100644
index 83c1ebd..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_attestation_intf.h"
-
-/**
- @brief - This API will call the requested attestation function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_attestation_function(int type, va_list valist)
-{
- uint8_t *challenge, *token;
- size_t challenge_size, *token_size, verify_token_size, token_buffer_size;
-
- switch (type)
- {
- case PAL_INITIAL_ATTEST_GET_TOKEN:
- challenge = va_arg(valist, uint8_t*);
- challenge_size = va_arg(valist, size_t);
- token = va_arg(valist, uint8_t*);
- token_buffer_size = va_arg(valist, size_t);
- token_size = va_arg(valist, size_t*);
- return psa_initial_attest_get_token(challenge, challenge_size, token, token_buffer_size,
- token_size);
- case PAL_INITIAL_ATTEST_GET_TOKEN_SIZE:
- challenge_size = va_arg(valist, size_t);
- token_size = va_arg(valist, size_t*);
- return psa_initial_attest_get_token_size(challenge_size, token_size);
- case PAL_INITIAL_ATTEST_VERIFY_TOKEN:
- challenge = va_arg(valist, uint8_t*);
- challenge_size = va_arg(valist, size_t);
- token = va_arg(valist, uint8_t*);
- verify_token_size = va_arg(valist, size_t);
- return pal_initial_attest_verify_token(challenge, challenge_size,
- token, verify_token_size);
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.h
deleted file mode 100644
index 3ab7ebb..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_ATTESTATION_INTF_H_
-#define _PAL_ATTESTATION_INTF_H_
-
-#include "pal_attestation_crypto.h"
-
-enum attestation_function_code {
- PAL_INITIAL_ATTEST_GET_TOKEN = 0x1,
- PAL_INITIAL_ATTEST_GET_TOKEN_SIZE = 0x2,
- PAL_INITIAL_ATTEST_VERIFY_TOKEN = 0x3,
- PAL_INITIAL_ATTEST_COMPUTE_HASH = 0x4,
- PAL_INITIAL_ATTEST_VERIFY_WITH_PK = 0x5,
-};
-
-int32_t pal_attestation_function(int type, va_list valist);
-#endif /* _PAL_ATTESTATION_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_empty_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_empty_intf.c
deleted file mode 100644
index 133cfa9..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested internal trusted storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_its_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
deleted file mode 100644
index abfdc5d..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_internal_trusted_storage_intf.h"
-
-/**
- @brief - This API will call the requested internal trusted storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_its_function(int type, va_list valist)
-{
- psa_storage_uid_t uid;
- uint32_t data_size, offset;
- const void *p_write_data;
- void *p_read_data;
- size_t *p_data_length;
- psa_storage_create_flags_t its_create_flags;
- struct psa_storage_info_t *its_p_info;
-
- switch (type)
- {
- case PAL_ITS_SET:
- uid = va_arg(valist, psa_storage_uid_t);
- data_size = va_arg(valist, uint32_t);
- p_write_data = va_arg(valist, const void*);
- its_create_flags = va_arg(valist, psa_storage_create_flags_t);
- return psa_its_set(uid, data_size, p_write_data, its_create_flags);
- case PAL_ITS_GET:
- uid = va_arg(valist, psa_storage_uid_t);
- offset = va_arg(valist, uint32_t);
- data_size = va_arg(valist, uint32_t);
- p_read_data = va_arg(valist, void*);
- p_data_length = va_arg(valist, size_t*);
- return psa_its_get(uid, offset, data_size, p_read_data, p_data_length);
- case PAL_ITS_GET_INFO:
- uid = va_arg(valist, psa_storage_uid_t);
- its_p_info = va_arg(valist, struct psa_storage_info_t*);
- return psa_its_get_info(uid, its_p_info);
- case PAL_ITS_REMOVE:
- uid = va_arg(valist, psa_storage_uid_t);
- return psa_its_remove(uid);
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.h
deleted file mode 100644
index 6db6aac..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_INTERNAL_TRUSTED_STORAGE_INTF_H_
-#define _PAL_INTERNAL_TRUSTED_STORAGE_INTF_H_
-
-#include "pal_common.h"
-
-enum its_function_code {
- PAL_ITS_SET = 0x1,
- PAL_ITS_GET = 0x2,
- PAL_ITS_GET_INFO = 0x3,
- PAL_ITS_REMOVE = 0x4,
-};
-
-uint32_t pal_its_function(int type, va_list valist);
-#endif /* _PAL_INTERNAL_TRUSTED_STORAGE_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_empty_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_empty_intf.c
deleted file mode 100644
index ee9b13d..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested protected storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_ps_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.c
deleted file mode 100644
index 0dd07c5..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_protected_storage_intf.h"
-
-/**
- @brief - This API will call the requested protected storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_ps_function(int type, va_list valist)
-{
- psa_storage_uid_t uid;
- uint32_t data_size, size, offset;
- const void *p_write_data;
- void *p_read_data;
- size_t *p_data_length;
- psa_storage_create_flags_t ps_create_flags;
- struct psa_storage_info_t *ps_p_info;
-
- switch (type)
- {
- case PAL_PS_SET:
- uid = va_arg(valist, psa_storage_uid_t);
- data_size = va_arg(valist, uint32_t);
- p_write_data = va_arg(valist, const void*);
- ps_create_flags = va_arg(valist, psa_storage_create_flags_t);
- return psa_ps_set(uid, data_size, p_write_data, ps_create_flags);
- case PAL_PS_GET:
- uid = va_arg(valist, psa_storage_uid_t);
- offset = va_arg(valist, uint32_t);
- data_size = va_arg(valist, uint32_t);
- p_read_data = va_arg(valist, void*);
- p_data_length = va_arg(valist, size_t*);
- return psa_ps_get(uid, offset, data_size, p_read_data, p_data_length);
- case PAL_PS_GET_INFO:
- uid = va_arg(valist, psa_storage_uid_t);
- ps_p_info = va_arg(valist, struct psa_storage_info_t*);
- return psa_ps_get_info(uid, ps_p_info);
- case PAL_PS_REMOVE:
- uid = va_arg(valist, psa_storage_uid_t);
- return psa_ps_remove(uid);
- case PAL_PS_CREATE:
- uid = va_arg(valist, psa_storage_uid_t);
- size = va_arg(valist, uint32_t);
- ps_create_flags = va_arg(valist, psa_storage_create_flags_t);
- return psa_ps_create(uid, size, ps_create_flags);
- case PAL_PS_SET_EXTENDED:
- uid = va_arg(valist, psa_storage_uid_t);
- offset = va_arg(valist, uint32_t);
- data_size = va_arg(valist, uint32_t);
- p_write_data = va_arg(valist, const void*);
- return psa_ps_set_extended(uid, offset, data_size, p_write_data);
- case PAL_PS_GET_SUPPORT:
- return psa_ps_get_support();
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-
- return PAL_STATUS_UNSUPPORTED_FUNC;
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.h
deleted file mode 100644
index a338cdf..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_PROTECTED_STORAGE_INTF_H_
-#define _PAL_PROTECTED_STORAGE_INTF_H_
-
-#include "pal_common.h"
-
-enum ps_function_code {
- PAL_PS_SET = 0x1,
- PAL_PS_GET = 0x2,
- PAL_PS_GET_INFO = 0x3,
- PAL_PS_REMOVE = 0x4,
- PAL_PS_CREATE = 0x5,
- PAL_PS_SET_EXTENDED = 0x6,
- PAL_PS_GET_SUPPORT = 0x7,
-};
-
-uint32_t pal_ps_function(int type, va_list valist);
-#endif /* _PAL_PROTECTED_STORAGE_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/spe/pal_driver_intf.c b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/spe/pal_driver_intf.c
deleted file mode 100644
index fd30783..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/spe/pal_driver_intf.c
+++ /dev/null
@@ -1,132 +0,0 @@
- /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_driver_intf.h"
-
-/**
- @brief - This function initializes the UART
- @param - uart base addr
- @return - void
-**/
-void pal_uart_init(uint32_t uart_base_addr)
-{
- pal_uart_cmsdk_init(uart_base_addr);
-}
-
-/**
- @brief - This function parses the input string and writes bytes into UART TX FIFO
- @param - str : Input String
- - data : Value for format specifier
-**/
-
-void pal_print(char *str, int32_t data)
-{
- pal_cmsdk_print(str,data);
-
-}
-
-
-/**
- @brief - Writes into given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - 1/0
-**/
-int pal_nvmem_write(addr_t base, uint32_t offset, void *buffer, int size)
-{
- return nvmem_write(base, offset, buffer, size);
-}
-
-/**
- @brief - Reads from given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - 1/0
-**/
-int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size)
-{
- return nvmem_read(base, offset, buffer, size);
-}
-
-
-/**
- @brief - Initializes an hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- - time_us : Time in micro seconds
- - timer_tick_us : Number of ticks per micro second
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
-{
- return(pal_wd_cmsdk_init(base_addr,time_us, timer_tick_us));
-
-}
-
-/**
- @brief - Enables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_enable(addr_t base_addr)
-{
- return(pal_wd_cmsdk_enable(base_addr));
-}
-
-/**
- @brief - Disables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_disable(addr_t base_addr)
-{
- return (pal_wd_cmsdk_disable(base_addr));
-}
-
-/**
- @brief - Checks whether hardware watchdog timer is enabled
- @param - base_addr : Base address of the watchdog module
- @return - Enabled : 1, Disabled : 0
-**/
-int pal_wd_timer_is_enabled(addr_t base_addr)
-{
- return (pal_wd_cmsdk_is_enabled(base_addr));
-}
-
-/**
- @brief - Trigger interrupt for irq signal assigned to driver partition
- before return to caller.
- @param - void
- @return - void
-**/
-void pal_generate_interrupt(void)
-{
- pal_uart_cmsdk_generate_irq();
-}
-
-/**
- @brief - Disable interrupt that was generated using pal_generate_interrupt API.
- @param - void
- @return - void
-**/
-void pal_disable_interrupt(void)
-{
- pal_uart_cmsdk_disable_irq();
-}
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/spe/pal_driver_intf.h b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/spe/pal_driver_intf.h
deleted file mode 100644
index cef34ca..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/spe/pal_driver_intf.h
+++ /dev/null
@@ -1,35 +0,0 @@
- /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_DRIVER_INTF_H_
-#define _PAL_DRIVER_INTF_H_
-
-#include "pal_uart.h"
-#include "pal_nvmem.h"
-#include "pal_wd_cmsdk.h"
-
-void pal_uart_init(uint32_t uart_base_addr);
-void pal_print(char *str, int32_t data);
-int pal_nvmem_write(addr_t base, uint32_t offset, void *buffer, int size);
-int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size);
-int pal_wd_timer_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us);
-int pal_wd_timer_enable(addr_t base_addr);
-int pal_wd_timer_disable(addr_t base_addr);
-int pal_wd_timer_is_enabled(addr_t base_addr);
-void pal_generate_interrupt(void);
-void pal_disable_interrupt(void);
-#endif /* _PAL_DRIVER_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/target.cfg b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/target.cfg
deleted file mode 100644
index e458041..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/target.cfg
+++ /dev/null
@@ -1,57 +0,0 @@
-///** @file
-// * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-// * 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.
-//**/
-
-// UART device info
-uart.num=1;
-uart.0.base = 0x40004000;
-uart.0.size = 0xFFF;
-uart.0.intr_id = 0xFF;
-uart.0.permission = TYPE_READ_WRITE;
-
-// Watchdog device info
-watchdog.num = 1;
-watchdog.0.base = 0x40008000;
-watchdog.0.size = 0xFFF;
-watchdog.0.intr_id = 0xFF;
-watchdog.0.permission = TYPE_READ_WRITE;
-watchdog.0.num_of_tick_per_micro_sec = 0x3; //(sys_feq/1000000)
-watchdog.0.timeout_in_micro_sec_low = 0xF4240; //1.0 sec : 1 * 1000 * 1000
-watchdog.0.timeout_in_micro_sec_medium = 0x1E8480; //2.0 sec : 2 * 1000 * 1000
-watchdog.0.timeout_in_micro_sec_high = 0x4C4B40; //5.0 sec : 5 * 1000 * 1000
-watchdog.0.timeout_in_micro_sec_crypto = 0x1312D00; //18.0 sec : 18 * 1000 * 1000
-
-// Range of 1KB Non-volatile memory to preserve data over reset. Ex, NVRAM and FLASH
-nvmem.num =1;
-nvmem.0.start = 0x2002F000;
-nvmem.0.end = 0x2002F3FF;
-nvmem.0.permission = TYPE_READ_WRITE;
-
-// Miscellaneous - Test scatter info
-dut.num = 1;
-
-// Start address of 12KB NS memory for test ELF
-dut.0.ns_test_addr = 0x2007F000;
-
-// Start address of combine_test_binary in memory. Memory can be main memory or secondary memory.
-// Size of combine_test_binary = Summation of size of each test ELF file.
-dut.0.ns_start_addr_of_combine_test_binary = 0x2003F000;
-
-// Is combine_test_binary available in RAM?
-dut.0.combine_test_binary_in_ram = AVAILABLE;
-
-// Level of Isolation
-dut.0.implemented_psa_firmware_isolation_level = LEVEL1;
diff --git a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/target.cmake b/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/target.cmake
deleted file mode 100644
index db9a4fa..0000000
--- a/api-tests/platform/targets/tgt_dev_apis_mbedos_fvp_mps2_m4/target.cmake
+++ /dev/null
@@ -1,105 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * 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.
-#**/
-
-# PAL C source files part of NSPE library
-list(APPEND PAL_SRC_C_NSPE )
-
-# PAL ASM source files part of NSPE library
-list(APPEND PAL_SRC_ASM_NSPE )
-
-# PAL C source files part of SPE library - driver partition
-list(APPEND PAL_SRC_C_DRIVER_SP )
-
-# PAL ASM source files part of SPE library - driver partition
-list(APPEND PAL_SRC_ASM_DRIVER_SP )
-
-
-# Listing all the sources required for given target
-if(${SUITE} STREQUAL "IPC")
- list(APPEND PAL_SRC_C_NSPE
- # driver functionalities are implemented as RoT-services
- # and secure and non-secure clients will call to these RoT-services to get appropriate driver services.
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_client_api_intf.c
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_driver_ipc_intf.c
- )
- list(APPEND PAL_SRC_C_DRIVER_SP
- # Driver files will be compiled as part of driver partition
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/spe/pal_driver_intf.c
- ${PSA_ROOT_DIR}/platform/drivers/nvmem/pal_nvmem.c
- ${PSA_ROOT_DIR}/platform/drivers/uart/cmsdk/pal_uart.c
- ${PSA_ROOT_DIR}/platform/drivers/watchdog/cmsdk/pal_wd_cmsdk.c
- )
-else()
- list(APPEND PAL_SRC_C_NSPE
- # driver files will be compiled as part of NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_client_api_empty_intf.c
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_driver_ns_intf.c
- ${PSA_ROOT_DIR}/platform/drivers/nvmem/pal_nvmem.c
- ${PSA_ROOT_DIR}/platform/drivers/uart/cmsdk/pal_uart.c
- ${PSA_ROOT_DIR}/platform/drivers/watchdog/cmsdk/pal_wd_cmsdk.c
- )
-endif()
-if(${SUITE} STREQUAL "CRYPTO")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto/pal_crypto_intf.c
- )
-endif()
-if(${SUITE} STREQUAL "PROTECTED_STORAGE")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/protected_storage/pal_protected_storage_intf.c
- )
-endif()
-if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
- )
-endif()
-if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/initial_attestation/pal_attestation_intf.c
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/initial_attestation/pal_attestation_crypto.c
- )
-endif()
-
-# Create NSPE library
-add_library(${PSA_TARGET_PAL_NSPE_LIB} STATIC ${PAL_SRC_C_NSPE} ${PAL_SRC_ASM_NSPE})
-
-# PSA Include directories
-foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
- target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE ${psa_inc_path})
-endforeach()
-
-list(APPEND PAL_DRIVER_INCLUDE_PATHS
- ${PSA_ROOT_DIR}/platform/drivers/nvmem
- ${PSA_ROOT_DIR}/platform/drivers/uart/cmsdk
- ${PSA_ROOT_DIR}/platform/drivers/watchdog/cmsdk
-)
-
-target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
- ${PAL_DRIVER_INCLUDE_PATHS}
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/protected_storage
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/internal_trusted_storage
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/initial_attestation
-)
-
-if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
-target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
- ${PSA_QCBOR_INCLUDE_PATH}
-)
-endif()
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/common/driver_partition_psa.json b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/common/driver_partition_psa.json
deleted file mode 100644
index 3e2ec67..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/common/driver_partition_psa.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "psa_framework_version": 1.0,
- "name": "DRIVER_PARTITION",
- "type": "PSA-ROT",
- "priority": "NORMAL",
- "description": "Implements device services such print, flash read/write,. etc.",
- "entry_point": "driver_main",
- "stack_size": "0x400",
- "services": [{
- "name": "DRIVER_UART_SID",
- "sid": "0x0000FC01",
- "signal": "DRIVER_UART_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "DRIVER_WATCHDOG_SID",
- "sid": "0x0000FC02",
- "signal": "DRIVER_WATCHDOG_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "DRIVER_NVMEM_SID",
- "sid": "0x0000FC03",
- "signal": "DRIVER_NVMEM_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "DRIVER_TEST_SID",
- "sid": "0x0000FC04",
- "signal": "DRIVER_TEST_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- }
- ],
- "mmio_regions" : [
- {
- "name": "UART_REGION",
- "base": "0x40004000",
- "size": "0x1000",
- "permission": "READ-WRITE"
- },
- {
- "name": "WATCHDOG_REGION",
- "base": "0x40008000",
- "size": "0x1000",
- "permission": "READ-WRITE"
- },
- {
- "name": "NVMEM_REGION",
- "base": "0x2002F000",
- "size": "0x400",
- "permission": "READ-WRITE"
- },
- {
- "name": "DRIVER_PARTITION_MMIO",
- "base": "0x200AF040",
- "size": "0x20",
- "permission": "READ-WRITE"
- }
- ],
- "irqs": [
- {
- "description": "Using UART TX interrupt to test psa_wait and psa_eoi for irq_signal",
- "signal": "DRIVER_UART_INTR_SIG",
- "line_num": 17
- }
- ]
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/ipc/client_partition_psa.json b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/ipc/client_partition_psa.json
deleted file mode 100644
index b93377b..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/ipc/client_partition_psa.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "psa_framework_version": 1.0,
- "name": "CLIENT_PARTITION",
- "type": "APPLICATION-ROT",
- "priority": "NORMAL",
- "description": "Client partition executing client test func from SPE",
- "entry_point": "client_main",
- "stack_size": "0x400",
- "services": [{
- "name": "CLIENT_TEST_DISPATCHER_SID",
- "sid": "0x0000FA01",
- "signal": "CLIENT_TEST_DISPATCHER_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- }
- ],
- "dependencies": [
- "DRIVER_UART_SID",
- "DRIVER_NVMEM_SID",
- "DRIVER_TEST_SID",
- "SERVER_TEST_DISPATCHER_SID",
- "SERVER_UNSPECIFED_MINOR_V_SID",
- "SERVER_STRICT_MINOR_VERSION_SID",
- "SERVER_RELAX_MINOR_VERSION_SID",
- "SERVER_SECURE_CONNECT_ONLY_SID",
- "SERVER_CONNECTION_DROP_SID"
- ],
- "mmio_regions" : [
- {
- "name": "CLIENT_PARTITION_MMIO",
- "base": "0x200AF000",
- "size": "0x20",
- "permission": "READ-WRITE"
- }
- ]
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/ipc/server_partition_psa.json b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/ipc/server_partition_psa.json
deleted file mode 100644
index 146b8fb..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/manifests/ipc/server_partition_psa.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "psa_framework_version": 1.0,
- "name": "SERVER_PARTITION",
- "type": "APPLICATION-ROT",
- "priority": "NORMAL",
- "description": "Server partition executing server test func",
- "entry_point": "server_main",
- "stack_size": "0x400",
- "heap_size": "0x100",
- "services": [{
- "name": "SERVER_TEST_DISPATCHER_SID",
- "sid": "0x0000FB01",
- "signal": "SERVER_TEST_DISPATCHER_SIG",
- "non_secure_clients": true,
- "minor_version": 1,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_SECURE_CONNECT_ONLY_SID",
- "sid": "0x0000FB02",
- "signal": "SERVER_SECURE_CONNECT_ONLY_SIG",
- "non_secure_clients": false,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_STRICT_MINOR_VERSION_SID",
- "sid": "0x0000FB03",
- "signal": "SERVER_STRICT_MINOR_VERSION_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "STRICT"
- },
- {
- "name": "SERVER_UNSPECIFED_MINOR_V_SID",
- "sid": "0x0000FB04",
- "signal": "SERVER_UNSPECIFED_MINOR_V_SIG",
- "non_secure_clients": true
- },
- {
- "name": "SERVER_RELAX_MINOR_VERSION_SID",
- "sid": "0x0000FB05",
- "signal": "SERVER_RELAX_MINOR_VERSION_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_UNEXTERN_SID",
- "sid": "0x0000FB06",
- "signal": "SERVER_UNEXTERN_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- },
- {
- "name": "SERVER_CONNECTION_DROP_SID",
- "sid": "0x0000FB07",
- "signal": "SERVER_CONNECTION_DROP_SIG",
- "non_secure_clients": true,
- "minor_version": 2,
- "minor_policy": "RELAXED"
- }
- ],
- "dependencies": [
- "DRIVER_UART_SID",
- "DRIVER_NVMEM_SID"
- ]
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_empty_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_empty_intf.c
deleted file mode 100644
index 578b4ce..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_empty_intf.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_client_api_intf.h"
-
-/**
- * @brief - Retrieve the version of the PSA Framework API that is implemented.
- * This is a wrapper API for psa_framework_version API.
- * @param - void
- * @return - The PSA Framework API version.
- */
-
-uint32_t pal_ipc_framework_version(void)
-{
- return 0;
-}
-
-/**
- * @brief - Retrieve the minor version of a Root of Trust Service by its SID.
- * This is a wrapper API for the psa_version API.
- * @param - sid The Root of Trust Service ID
- * @return - Minor version of Root of Trust Service or PSA_VERSION_NONE if Root of Trust
- * Service not present on the system.
- */
-
-uint32_t pal_ipc_version(uint32_t sid)
-{
- return PSA_VERSION_NONE;
-}
-
-/**
- * @brief - Connect to given sid.
- * This is a wrapper API for the psa_connect API.
- * @param - sid : RoT service id
- * @param - minor_version : minor_version of RoT service
- * @return - psa_handle_t : return connection handle
- */
-
-psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version)
-{
- return PSA_NULL_HANDLE;
-}
-
-/**
- * @brief Call a connected Root of Trust Service.
- * This is a wrapper API for the psa_call API.
- * The caller must provide an array of ::psa_invec_t structures as the input payload.
- *
- * @param -handle Handle for the connection.
- * @param -in_vec Array of psa_invec structures.
- * @param -in_len Number of psa_invec structures in in_vec.
- * @param -out_vec Array of psa_outvec structures for optional Root of Trust Service response.
- * @param -out_len Number of psa_outvec structures in out_vec.
- * @return -psa_status_t
- */
-
-psa_status_t pal_ipc_call(psa_handle_t handle,
- const psa_invec *in_vec,
- size_t in_len,
- psa_outvec *out_vec,
- size_t out_len)
-{
- return (PSA_SUCCESS - 1);
-}
-
-/**
- * @brief Close a connection to a Root of Trust Service.
- * This is a wrapper API for the psa_close API.
- * Sends the PSA_IPC_DISCONNECT message to the Root of Trust Service so it can clean up resources.
- *
- * @param handle Handle for the connection.
- * @return void
- */
-
-void pal_ipc_close(psa_handle_t handle)
-{
- return;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.c
deleted file mode 100644
index 20ddd11..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_client_api_intf.h"
-
-/**
- * @brief - Retrieve the version of the PSA Framework API that is implemented.
- * This is a wrapper API for psa_framework_version API.
- * @param - void
- * @return - The PSA Framework API version.
- * Note - Return PAL_STATUS_ERROR if PSA IPC is not implemented.
- */
-
-uint32_t pal_ipc_framework_version(void)
-{
- return (psa_framework_version());
-}
-
-/**
- * @brief - Retrieve the minor version of a Root of Trust Service by its SID.
- * This is a wrapper API for the psa_version API.
- * @param - sid The Root of Trust Service ID
- * @return - Minor version of Root of Trust Service or PSA_VERSION_NONE if Root of Trust
- * Service not present on the system.
- * Note - Return PAL_STATUS_ERROR if PSA IPC is not implemented.
- */
-
-uint32_t pal_ipc_version(uint32_t sid)
-{
- return (psa_version(sid));
-}
-
-/**
- * @brief - Connect to given sid.
- * This is a wrapper API for the psa_connect API.
- * @param - sid : RoT service id
- * @param - minor_version : minor_version of RoT service
- * @return - psa_handle_t : return connection handle
- * Note - Return PSA_NULL_HANDLE if PSA IPC is not implemented.
- */
-
-psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version)
-{
- return (psa_connect(sid, minor_version));
-}
-
-/**
- * @brief Call a connected Root of Trust Service.
- * This is a wrapper API for the psa_call API.
- * The caller must provide an array of ::psa_invec_t structures as the input payload.
- *
- * @param -handle Handle for the connection.
- * @param -in_vec Array of psa_invec structures.
- * @param -in_len Number of psa_invec structures in in_vec.
- * @param -out_vec Array of psa_outvec structures for optional Root of Trust Service response.
- * @param -out_len Number of psa_outvec structures in out_vec.
- * @return -psa_status_t
- * Note - Return -1 if PSA IPC is not implemented.
- */
-
-psa_status_t pal_ipc_call(psa_handle_t handle,
- const psa_invec *in_vec,
- size_t in_len,
- psa_outvec *out_vec,
- size_t out_len)
-{
- return (psa_call(handle, in_vec, in_len, out_vec, out_len));
-}
-
-/**
- * @brief Close a connection to a Root of Trust Service.
- * This is a wrapper API for the psa_close API.
- * Sends the PSA_IPC_DISCONNECT message to the Root of Trust Service so it can clean up resources.
- *
- * @param - handle Handle for the connection.
- * @return - void
- */
-
-void pal_ipc_close(psa_handle_t handle)
-{
- psa_close(handle);
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.h
deleted file mode 100644
index 3f5741e..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_client_api_intf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_CLIENT_API_H_
-#define _PAL_CLIENT_API_H_
-
-#include "pal_common.h"
-
-uint32_t pal_ipc_framework_version(void);
-uint32_t pal_ipc_version(uint32_t sid);
-psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version);
-psa_status_t pal_ipc_call(psa_handle_t handle,
- const psa_invec *in_vec,
- size_t in_len,
- psa_outvec *out_vec,
- size_t out_len);
-void pal_ipc_close(psa_handle_t handle);
-#endif /* _PAL_CLIENT_API_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_common.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_common.h
deleted file mode 100644
index 0a63b02..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_common.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_COMMON_H_
-#define _PAL_COMMON_H_
-
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <stdarg.h>
-
-#include "pal_config.h"
-#include "pal_crypto_config.h"
-
-/* typedef's */
-typedef uint8_t bool_t;
-typedef uint32_t addr_t;
-typedef uint32_t test_id_t;
-typedef uint32_t block_id_t;
-typedef char char8_t;
-typedef uint32_t cfg_id_t;
-
-#define PAL_STATUS_UNSUPPORTED_FUNC 0xFF
-
-typedef enum
-{
- PAL_STATUS_SUCCESS = 0x0,
- PAL_STATUS_ERROR = 0x80
-} pal_status_t;
-
-typedef enum {
- NVMEM_READ = 0x1,
- NVMEM_WRITE = 0x2,
-} nvmem_fn_type_t;
-
-typedef struct {
- nvmem_fn_type_t nvmem_fn_type;
- addr_t base;
- uint32_t offset;
- int size;
-} nvmem_param_t;
-
-typedef enum {
- WD_INIT_SEQ = 0x1,
- WD_ENABLE_SEQ = 0x2,
- WD_DISABLE_SEQ = 0x3,
- WD_STATUS_SEQ = 0x4,
-} wd_fn_type_t;
-
-typedef enum {
- WD_LOW_TIMEOUT = 0x1,
- WD_MEDIUM_TIMEOUT = 0x2,
- WD_HIGH_TIMEOUT = 0x3,
- WD_CRYPTO_TIMEOUT = 0x4,
-} wd_timeout_type_t;
-
-typedef struct {
- wd_fn_type_t wd_fn_type;
- addr_t wd_base_addr;
- uint32_t wd_time_us;
- uint32_t wd_timer_tick_us;
-} wd_param_t;
-
-typedef enum {
- UART_INIT = 0x1,
- UART_PRINT = 0x2,
-} uart_fn_type_t;
-
-/*
- * Redefining some of the client.h elements for compilation to go through
- * when PSA IPC APIs are not implemented.
- */
-#ifndef IPC
-
-#ifndef PSA_VERSION_NONE
-#define PSA_VERSION_NONE (0)
-#endif
-
-#ifndef PSA_SUCCESS
-#define PSA_SUCCESS (0)
-typedef int32_t psa_status_t;
-#endif
-typedef int32_t psa_handle_t;
-
-#ifndef PSA_NULL_HANDLE
-#define PSA_NULL_HANDLE ((psa_handle_t)0)
-#endif
-
-typedef struct psa_invec {
- const void *base;
- size_t len;
-} psa_invec;
-
-typedef struct psa_outvec {
- void *base;
- size_t len;
-} psa_outvec;
-
-#endif /* IPC */
-
-#endif /* _PAL_COMMON_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_config.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_config.h
deleted file mode 100644
index 61db8d8..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_config.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_CONFIG_H_
-#define _PAL_CONFIG_H_
-
-/* Define PSA test suite dependent macros for non-cmake build */
-#if !defined(PSA_CMAKE_BUILD)
-
-/* Print verbosity = TEST */
-#define VERBOSE 3
-
-/* NSPE or SPE VAL build? */
-#define VAL_NSPE_BUILD
-
-/* NSPE or SPE TEST build? */
-#define NONSECURE_TEST_BUILD
-
-/* Combine test archive or binary? */
-#define TEST_COMBINE_ARCHIVE
-
-/* If not defined, skip watchdog programming */
-#define WATCHDOG_AVAILABLE
-
-/* Are Dynamic memory APIs available to secure partition? */
-#define SP_HEAP_MEM_SUPP
-#endif /* PSA_CMAKE_BUILD */
-
-/* Version of crypto spec used in attestation */
-#define CRYPTO_VERSION_BETA2
-
-/* Use hardcoded public key */
-//#define PLATFORM_OVERRIDE_ATTEST_PK
-
-/*
- * Include of PSA defined Header files
- */
-#ifdef IPC
-/* psa/client.h: Contains the PSA Client API elements */
-#include "psa/client.h"
-
-/*
- * psa_manifest/sid.h: Macro definitions derived from manifest files that map from RoT Service
- * names to Service IDs (SIDs). Partition manifest parse build tool must provide the implementation
- * of this file.
-*/
-#include "psa_manifest/sid.h"
-
-/*
- * psa_manifest/pid.h: Secure Partition IDs
- * Macro definitions that map from Secure Partition names to Secure Partition IDs.
- * Partition manifest parse build tool must provide the implementation of this file.
-*/
-#include "psa_manifest/pid.h"
-#endif
-
-#ifdef CRYPTO
-/* psa/crypto.h: Contains the PSA Crypto API elements */
-#include "psa/crypto.h"
-#endif
-
-#ifdef INTERNAL_TRUSTED_STORAGE
-/* psa/internal_trusted_storage.h: Contains the PSA ITS API elements */
-#include "psa/internal_trusted_storage.h"
-#endif
-
-#ifdef PROTECTED_STORAGE
-/* psa/protected_storage.h: Contains the PSA PS API elements */
-#include "psa/protected_storage.h"
-#endif
-
-#ifdef INITIAL_ATTESTATION
-/* psa/initial_attestation.h: Contains the PSA Initial Attestation API elements */
-#include "psa/initial_attestation.h"
-#endif
-
-#endif /* _PAL_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ipc_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ipc_intf.c
deleted file mode 100644
index f8f773f..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ipc_intf.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_client_api_intf.h"
-
-/**
- @brief - This function initializes the UART
- @param - uart base addr
- @return - SUCCESS/FAILURE
-**/
-int pal_uart_init_ns(uint32_t uart_base_addr)
-{
- psa_handle_t print_handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
- uart_fn_type_t uart_fn = UART_INIT;
-
- psa_invec data[3] = {{&uart_fn, sizeof(uart_fn)},
- {&uart_base_addr, sizeof(uart_base_addr)},
- {NULL, 0}};
-
- print_handle = pal_ipc_connect(DRIVER_UART_SID, 0);
- if (print_handle < 0)
- {
- return(PAL_STATUS_ERROR);
- }
-
- status_of_call = pal_ipc_call(print_handle, data, 3, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- return(PAL_STATUS_ERROR);
- }
-
- pal_ipc_close(print_handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - This function parses the input string and writes bytes into UART TX FIFO
- @param - str : Input String
- - data : Value for format specifier
- @return - SUCCESS/FAILURE
-**/
-
-int pal_print_ns(char *str, int32_t data)
-{
- int string_len = 0;
- char *p = str;
- psa_handle_t print_handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
- pal_status_t status = PAL_STATUS_SUCCESS;
- uart_fn_type_t uart_fn = UART_PRINT;
-
- while (*p != '\0')
- {
- string_len++;
- p++;
- }
-
- psa_invec data1[3] = {{&uart_fn, sizeof(uart_fn)},
- {str, string_len+1},
- {&data, sizeof(data)}};
- print_handle = pal_ipc_connect(DRIVER_UART_SID, 0);
-
- if (print_handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(print_handle, data1, 3, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- status = PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(print_handle);
- return status;
-}
-
-/**
- @brief - Initializes an hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- - time_us : Time in micro seconds
- - timer_tick_us : Number of ticks per micro second
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
-{
- wd_param_t wd_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- wd_param.wd_fn_type = WD_INIT_SEQ;
- wd_param.wd_base_addr = base_addr;
- wd_param.wd_time_us = time_us;
- wd_param.wd_timer_tick_us = timer_tick_us;
- psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
-
- handle = pal_ipc_connect(DRIVER_WATCHDOG_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Enables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_enable_ns(addr_t base_addr)
-{
- wd_param_t wd_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- wd_param.wd_fn_type = WD_ENABLE_SEQ;
- wd_param.wd_base_addr = base_addr;
- wd_param.wd_time_us = 0;
- wd_param.wd_timer_tick_us = 0;
- psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
-
- handle = pal_ipc_connect(DRIVER_WATCHDOG_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Disables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_disable_ns(addr_t base_addr)
-{
- wd_param_t wd_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- wd_param.wd_fn_type = WD_DISABLE_SEQ;
- wd_param.wd_base_addr = base_addr;
- wd_param.wd_time_us = 0;
- wd_param.wd_timer_tick_us = 0;
- psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
-
- handle = pal_ipc_connect(DRIVER_WATCHDOG_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Reads from given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- nvmem_param_t nvmem_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- nvmem_param.nvmem_fn_type = NVMEM_READ;
- nvmem_param.base = base;
- nvmem_param.offset = offset;
- nvmem_param.size = size;
- psa_invec invec[1] = {{&nvmem_param, sizeof(nvmem_param)}};
- psa_outvec outvec[1] = {{buffer, size}};
-
- handle = pal_ipc_connect(DRIVER_NVMEM_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 1, outvec, 1);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- psa_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Writes into given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- nvmem_param_t nvmem_param;
- psa_handle_t handle = 0;
- psa_status_t status_of_call = PSA_SUCCESS;
-
- nvmem_param.nvmem_fn_type = NVMEM_WRITE;
- nvmem_param.base = base;
- nvmem_param.offset = offset;
- nvmem_param.size = size;
- psa_invec invec[2] = {{&nvmem_param, sizeof(nvmem_param)}, {buffer, size}};
-
- handle = pal_ipc_connect(DRIVER_NVMEM_SID, 0);
- if (handle < 0)
- {
- return PAL_STATUS_ERROR;
- }
- else
- {
- status_of_call = pal_ipc_call(handle, invec, 2, NULL, 0);
- if (status_of_call != PSA_SUCCESS)
- {
- pal_ipc_close(handle);
- return PAL_STATUS_ERROR;
- }
- }
- pal_ipc_close(handle);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- * @brief - This function will read peripherals using SPI commands
- * @param - addr : address of the peripheral
- * data : read buffer
- * len : length of the read buffer in bytes
- * @return - error status
-**/
-int pal_spi_read(addr_t addr, uint8_t *data, uint32_t len)
-{
- return 0xFF;
-}
-
-/**
- * @brief - Terminates the simulation at the end of all tests completion.
- * By default, it put cpus into power down mode.
- * @param - void
- * @return - void
-**/
-void pal_terminate_simulation(void)
-{
- /* Add logic to terminate the simluation */
-
- while(1)
- {
- asm volatile("WFI");
- }
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ns_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ns_intf.c
deleted file mode 100644
index 2af6fcc..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/common/pal_driver_ns_intf.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_common.h"
-#include "pal_uart.h"
-#include "pal_nvmem.h"
-#include "pal_wd_cmsdk.h"
-
-/**
- @brief - This function initializes the UART
- @param - uart base addr
- @return - SUCCESS/FAILURE
-**/
-int pal_uart_init_ns(uint32_t uart_base_addr)
-{
- pal_uart_cmsdk_init(uart_base_addr);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - This function parses the input string and writes bytes into UART TX FIFO
- @param - str : Input String
- - data : Value for format specifier
- @return - SUCCESS/FAILURE
-**/
-
-int pal_print_ns(char *str, int32_t data)
-{
- pal_cmsdk_print(str, data);
- return PAL_STATUS_SUCCESS;
-}
-
-/**
- @brief - Initializes an hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- - time_us : Time in micro seconds
- - timer_tick_us : Number of ticks per micro second
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
-{
- return(pal_wd_cmsdk_init(base_addr,time_us, timer_tick_us));
-}
-
-/**
- @brief - Enables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_enable_ns(addr_t base_addr)
-{
- return(pal_wd_cmsdk_enable(base_addr));
-}
-
-/**
- @brief - Disables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_disable_ns(addr_t base_addr)
-{
- return (pal_wd_cmsdk_disable(base_addr));
-}
-
-/**
- @brief - Reads from given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- if (nvmem_read(base, offset, buffer, size))
- {
- return PAL_STATUS_SUCCESS;
- }
- else
- {
- return PAL_STATUS_ERROR;
- }
-}
-
-/**
- @brief - Writes into given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - SUCCESS/FAILURE
-**/
-int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
-{
- if (nvmem_write(base, offset, buffer, size))
- {
- return PAL_STATUS_SUCCESS;
- }
- else
- {
- return PAL_STATUS_ERROR;
- }
-}
-
-/**
- * @brief - This function will read peripherals using SPI commands
- * @param - addr : address of the peripheral
- * data : read buffer
- * len : length of the read buffer in bytes
- * @return - error status
-**/
-int pal_spi_read(addr_t addr, uint8_t *data, uint32_t len)
-{
- return 0xFF;
-}
-
-/**
- * @brief - Terminates the simulation at the end of all tests completion.
- * By default, it put cpus into power down mode.
- * @param - void
- * @return - void
-**/
-void pal_terminate_simulation(void)
-{
- /* Add logic to terminate the simluation */
-
- while(1)
- {
- asm volatile("WFI");
- }
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config.h
deleted file mode 100644
index 6d71d2e..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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.
-**/
-
-/*
- * \file pal_crypto_config.h
- *
- * \brief Configuration options for crypto tests (set of defines)
- *
- * This set of compile-time options may be used to enable
- * or disable features selectively for crypto test suite
- */
-
-#ifndef _PAL_CRYPTO_CONFIG_H_
-#define _PAL_CRYPTO_CONFIG_H_
-/**
- * \def ARCH_TEST_RSA
- *
- * Enable the RSA public-key cryptosystem.
- * By default all supported keys are enabled.
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_RSA
-#define ARCH_TEST_RSA_1024
-#define ARCH_TEST_RSA_2048
-#define ARCH_TEST_RSA_3072
-
-/**
- * \def ARCH_TEST_ECC
- * \def ARCH_TEST_ECC_CURVE_SECPXXXR1
- *
- * Enable the elliptic curve
- * Enable specific curves within the Elliptic Curve
- * module. By default all supported curves are enabled.
- *
- * Requires: ARCH_TEST_ECC
- * Comment macros to disable the curve
- */
-#define ARCH_TEST_ECC
-#define ARCH_TEST_ECC_CURVE_SECP192R1
-#define ARCH_TEST_ECC_CURVE_SECP224R1
-#define ARCH_TEST_ECC_CURVE_SECP256R1
-#define ARCH_TEST_ECC_CURVE_SECP384R1
-
-/**
- * \def ARCH_TEST_AES
- *
- * Enable the AES block cipher.
- * By default all supported keys are enabled.
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_AES
-#define ARCH_TEST_AES_128
-#define ARCH_TEST_AES_192
-#define ARCH_TEST_AES_256
-#define ARCH_TEST_AES_512
-
-/**
- * \def ARCH_TEST_DES
- *
- * Enable the DES block cipher.
- * By default all supported keys are enabled.
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_DES
-#define ARCH_TEST_DES_1KEY
-#define ARCH_TEST_DES_2KEY
-#define ARCH_TEST_DES_3KEY
-
-/**
- * \def ARCH_TEST_RAW
- *
- * A "key" of this type cannot be used for any cryptographic operation.
- * Applications may use this type to store arbitrary data in the keystore.
- */
-#define ARCH_TEST_RAW
-
-/**
- * \def ARCH_TEST_CIPER
- *
- * Enable the generic cipher layer.
- */
-
-#define ARCH_TEST_CIPER
-
-/**
- * \def ARCH_TEST_ARC4
- *
- * Enable the ARC4 key type.
- */
-#define ARCH_TEST_ARC4
-
-/**
- * \def ARCH_TEST_CIPER_MODE_CTR
- *
- * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
- *
- * Requires: ARCH_TEST_CIPER
- */
-#define ARCH_TEST_CIPER_MODE_CTR
-
-/**
- * \def ARCH_TEST_CIPER_MODE_CFB
- *
- * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
- *
- * Requires: ARCH_TEST_CIPER
- */
-#define ARCH_TEST_CIPER_MODE_CFB
-
-/**
- * \def ARCH_TEST_CIPER_MODE_CBC
- *
- * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
- *
- * Requires: ARCH_TEST_CIPER
- */
-#define ARCH_TEST_CIPER_MODE_CBC
-
-/**
- * \def ARCH_TEST_CTR_AES
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CTR
- */
-#define ARCH_TEST_CTR_AES
-
-/**
- * \def ARCH_TEST_CBC_AES
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CBC
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CBC_AES
-#define ARCH_TEST_CBC_AES_NO_PADDING
-
-/**
- * \def ARCH_TEST_CBC_NO_PADDING
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_CIPER_MODE_CBC
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CBC_NO_PADDING
-
-/**
- * \def ARCH_TEST_CFB_AES
- *
- * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CFB
- */
-#define ARCH_TEST_CFB_AES
-
-/**
- * \def ARCH_TEST_PKCS1V15_*
- *
- * Enable support for PKCS#1 v1.5 encoding.
- * Enable support for PKCS#1 v1.5 operations.
- * Enable support for RSA-OAEP
- *
- * Requires: ARCH_TEST_RSA, ARCH_TEST_PKCS1V15
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_PKCS1V15
-#define ARCH_TEST_RSA_PKCS1V15_SIGN
-#define ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
-#define ARCH_TEST_RSA_PKCS1V15_CRYPT
-#define ARCH_TEST_RSA_OAEP
-
-/**
- * \def ARCH_TEST_CBC_PKCS7
- *
- * Requires: ARCH_TEST_CIPER_MODE_CBC
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CBC_PKCS7
-
-/**
- * \def ARCH_TEST_ASYMMETRIC_ENCRYPTION
- *
- * Enable support for Asymmetric encryption algorithms
- */
-#define ARCH_TEST_ASYMMETRIC_ENCRYPTION
-
-/**
- * \def ARCH_TEST_HASH
- *
- * Enable the hash algorithm.
- */
-#define ARCH_TEST_HASH
-
-/**
- * \def ARCH_TEST_HMAC
- *
- * The key policy determines which underlying hash algorithm the key can be
- * used for.
- *
- * Requires: ARCH_TEST_HASH
- */
-#define ARCH_TEST_HMAC
-
-/**
- * \def ARCH_TEST_MDX
- * \def ARCH_TEST_SHAXXX
- *
- * Enable the MDX algorithm.
- * Enable the SHAXXX algorithm.
- *
- * Requires: ARCH_TEST_HASH
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_MD2
-#define ARCH_TEST_MD4
-#define ARCH_TEST_MD5
-#define ARCH_TEST_RIPEMD160
-#define ARCH_TEST_SHA1
-#define ARCH_TEST_SHA224
-#define ARCH_TEST_SHA256
-#define ARCH_TEST_SHA384
-#define ARCH_TEST_SHA512
-#define ARCH_TEST_SHA512_224
-#define ARCH_TEST_SHA512_256
-#define ARCH_TEST_SHA3_224
-#define ARCH_TEST_SHA3_256
-#define ARCH_TEST_SHA3_384
-#define ARCH_TEST_SHA3_512
-
-/**
- * \def ARCH_TEST_HKDF
- *
- * Enable the HKDF algorithm (RFC 5869).
- *
- * Requires: ARCH_TEST_HASH
-*/
-#define ARCH_TEST_HKDF
-
-/**
- * \def ARCH_TEST_xMAC
- *
- * Enable the xMAC (Cipher/Hash/G-based Message Authentication Code) mode for block
- * ciphers.
- * Requires: ARCH_TEST_AES or ARCH_TEST_DES
- *
- * Comment macros to disable the types
- */
-#define ARCH_TEST_CMAC
-#define ARCH_TEST_GMAC
-#define ARCH_TEST_HMAC
-
-/**
- * \def ARCH_TEST_CCM
- *
- * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
- *
- * Requires: ARCH_TEST_AES
- */
-#define ARCH_TEST_CCM
-
-/**
- * \def ARCH_TEST_GCM
- *
- * Enable the Galois/Counter Mode (GCM) for AES.
- *
- * Requires: ARCH_TEST_AES
- *
- */
-#define ARCH_TEST_GCM
-
-/**
- * \def ARCH_TEST_TRUNCATED_MAC
- *
- * Enable support for RFC 6066 truncated HMAC in SSL.
- *
- * Comment this macro to disable support for truncated HMAC in SSL
- */
-#define ARCH_TEST_TRUNCATED_MAC
-
-
-/**
- * \def ARCH_TEST_ECDH
- *
- * Enable the elliptic curve Diffie-Hellman library.
- *
- * Requires: ARCH_TEST_ECC
- */
-#define ARCH_TEST_ECDH
-
-/**
- * \def ARCH_TEST_ECDSA
- *
- * Enable the elliptic curve DSA library.
- * Requires: ARCH_TEST_ECC
- */
-#define ARCH_TEST_ECDSA
-
-/**
- * \def ARCH_TEST_DETERMINISTIC_ECDSA
- *
- * Enable deterministic ECDSA (RFC 6979).
-*/
-#define ARCH_TEST_DETERMINISTIC_ECDSA
-
-#include "pal_crypto_config_check.h"
-
-#endif /* _PAL_CRYPTO_CONFIG_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config_check.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config_check.h
deleted file mode 100644
index 443e0bc..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_config_check.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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.
-**/
-
-/**
- * \file pal_crypto_config_check.h
- *
- * \brief Consistency checks for configuration options
- *
- */
-
-#ifndef _PAL_CRYPTO_CONFIG_CHECK_H_
-#define _PAL_CRYPTO_CONFIG_CHECK_H_
-
-#if defined(ARCH_TEST_RSA_1024) && !defined(ARCH_TEST_RSA)
-#error "ARCH_TEST_RSA_1024 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_2048) && !defined(ARCH_TEST_RSA)
-#error "ARCH_TEST_RSA_2048 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_3072) && !defined(ARCH_TEST_RSA)
-#error "ARCH_TEST_RSA_3072 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP192R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP192R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP224R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP224R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP256R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP256R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECC_CURVE_SECP384R1) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECC_CURVE_SECP384R1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_AES_128) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_AES_128 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_AES_256) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_AES_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_AES_512) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_AES_512 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_DES_1KEY) && !defined(ARCH_TEST_DES)
-#error "ARCH_TEST_DES_1KEY defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_DES_2KEY) && !defined(ARCH_TEST_DES)
-#error "ARCH_TEST_DES_2KEY defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_DES_3KEY) && !defined(ARCH_TEST_DES)
-#error "ARCH_TEST_DES_3KEY defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CIPER_MODE_CTR) && !defined(ARCH_TEST_CIPER)
-#error "ARCH_TEST_CIPER_MODE_CTR defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CIPER_MODE_CFB) && !defined(ARCH_TEST_CIPER)
-#error "ARCH_TEST_CIPER_MODE_CFB defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CIPER_MODE_CBC) && !defined(ARCH_TEST_CIPER)
-#error "ARCH_TEST_CIPER_MODE_CBC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CTR_AES) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_AES) || !defined(ARCH_TEST_CIPER_MODE_CTR))
-#error "ARCH_TEST_CTR_AES defined, but not all prerequisites"
-#endif
-
-#if (defined(ARCH_TEST_CBC_AES) || defined(ARCH_TEST_CBC_AES_NO_PADDING)) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_AES) || !defined(ARCH_TEST_CIPER_MODE_CBC))
-#error "ARCH_TEST_CBC_AES defined, but not all prerequisites"
-#endif
-
-#if (defined(ARCH_TEST_CBC_NO_PADDING)) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_CIPER_MODE_CBC))
-#error "ARCH_TEST_CBC_NO_PADDING defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CFB_AES) &&\
- (!defined(ARCH_TEST_CIPER) || !defined(ARCH_TEST_AES) || !defined(ARCH_TEST_CIPER_MODE_CFB))
-#error "ARCH_TEST_CFB_AES defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_PKCS1V15_SIGN) &&\
- (!defined(ARCH_TEST_RSA) || !defined(ARCH_TEST_PKCS1V15))
-#error "ARCH_TEST_RSA_PKCS1V15_SIGN defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_PKCS1V15_SIGN_RAW) &&\
- (!defined(ARCH_TEST_RSA) || !defined(ARCH_TEST_PKCS1V15))
-#error "ARCH_TEST_RSA_PKCS1V15_SIGN_RAW defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RSA_PKCS1V15_CRYPT) &&\
- (!defined(ARCH_TEST_RSA) || !defined(ARCH_TEST_PKCS1V15))
-#error "ARCH_TEST_RSA_PKCS1V15_CRYPT defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CBC_PKCS7) && !defined(ARCH_TEST_CIPER_MODE_CBC)
-#error "ARCH_TEST_CBC_PKCS7 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_HMAC) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_HMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_MD2) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_MD2 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_MD4) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_MD4 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_MD5) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_MD5 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_RIPEMD160) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_RIPEMD160 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA1) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA1 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA224) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA224 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA256) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA512) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA512 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA512_224) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA512_224 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA512_256) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA512_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_224) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_224 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_256) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_384) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_SHA3_512) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_SHA3_256 defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_HKDF) && !defined(ARCH_TEST_HASH)
-#error "ARCH_TEST_HKDF defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CMAC) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_CMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_GMAC) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_GMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_HMAC) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_HMAC defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_CCM) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_CCM defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_GCM) && !defined(ARCH_TEST_AES)
-#error "ARCH_TEST_GCM defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECDH) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECDH defined, but not all prerequisites"
-#endif
-
-#if defined(ARCH_TEST_ECDSA) && !defined(ARCH_TEST_ECC)
-#error "ARCH_TEST_ECDSA defined, but not all prerequisites"
-#endif
-
-#endif /* _PAL_CRYPTO_CONFIG_CHECK_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_empty_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_empty_intf.c
deleted file mode 100644
index 2a28f39..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested crypto function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_crypto_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.c
deleted file mode 100644
index fd2e055..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_crypto_intf.h"
-
-#define PAL_KEY_SLOT_COUNT 32
-
-/**
- @brief - This API will call the requested crypto function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_crypto_function(int type, va_list valist)
-{
- int i;
- psa_status_t status;
- uint8_t *buffer, *ciphertext, *plaintext;
- const uint8_t *nonce, *additional_data, *salt, *peer;
- size_t *length, size, ciphertext_size, nonce_length;
- size_t salt_length, peer_length, additional_data_length;
- size_t *tag_length, plaintext_size;
- psa_aead_operation_t *aead_operation;
- psa_key_attributes_t *attributes;
- psa_key_handle_t *handle, key_handle;
- psa_key_type_t *key_type_out, key_type;
- psa_key_usage_t *usage_out, usage;
- psa_key_id_t *key_id_out, key_id;
- psa_key_lifetime_t *key_lifetime_out, key_lifetime;
- psa_algorithm_t *key_alg_out, key_alg, alg;
- psa_hash_operation_t *hash_operation, *target_operation;
- psa_mac_operation_t *mac_operation;
- psa_cipher_operation_t *cipher_operation;
- psa_key_derivation_operation_t *derive_operation;
- psa_key_derivation_step_t step;
- switch (type)
- {
- case PAL_CRYPTO_INIT:
- return psa_crypto_init();
- case PAL_CRYPTO_GENERATE_RANDOM:
- buffer = va_arg(valist, uint8_t *);
- size = va_arg(valist, int);
- return psa_generate_random(buffer, size);
- case PAL_CRYPTO_IMPORT_KEY:
- attributes = va_arg(valist, psa_key_attributes_t *);
- buffer = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- status = psa_import_key(attributes, buffer, size, handle);
- return status;
- case PAL_CRYPTO_SET_KEY_TYPE:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_type = va_arg(valist, psa_key_type_t);
- psa_set_key_type(attributes, key_type);
- return 0;
- case PAL_CRYPTO_SET_KEY_BITS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- size = va_arg(valist, size_t);
- psa_set_key_bits(attributes, size);
- return 0;
- case PAL_CRYPTO_GET_KEY_ATTRIBUTES:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- attributes = va_arg(valist, psa_key_attributes_t *);
- return psa_get_key_attributes(key_handle, attributes);
- case PAL_CRYPTO_GET_KEY_TYPE:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_type_out = va_arg(valist, psa_key_type_t *);
- *key_type_out = psa_get_key_type(attributes);
- return 0;
- case PAL_CRYPTO_EXPORT_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- buffer = (uint8_t *)(va_arg(valist, uint8_t *));
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t *);
- return psa_export_key(key_handle, buffer, size, length);
- case PAL_CRYPTO_SET_KEY_USAGE_FLAGS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- usage = va_arg(valist, psa_key_usage_t);
- psa_set_key_usage_flags(attributes, usage);
- return 0;
- case PAL_CRYPTO_RESET_KEY_ATTRIBUTES:
- attributes = va_arg(valist, psa_key_attributes_t *);
- psa_reset_key_attributes(attributes);
- return 0;
- case PAL_CRYPTO_EXPORT_PUBLIC_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- buffer = (uint8_t *)(va_arg(valist, uint8_t *));
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t *);
- return psa_export_public_key(key_handle, buffer, size, length);
- case PAL_CRYPTO_SET_KEY_ID:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_id = va_arg(valist, psa_key_id_t);
- psa_set_key_id(attributes, key_id);
- return 0;
- case PAL_CRYPTO_SET_KEY_LIFETIME:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_lifetime = va_arg(valist, psa_key_lifetime_t);
- psa_set_key_lifetime(attributes, key_lifetime);
- return 0;
- case PAL_CRYPTO_SET_KEY_ALGORITHM:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_alg = va_arg(valist, psa_algorithm_t);
- psa_set_key_algorithm(attributes, key_alg);
- return 0;
- case PAL_CRYPTO_GET_KEY_ID:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_id_out = va_arg(valist, psa_key_id_t *);
- *key_id_out = psa_get_key_id(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_LIFETIME:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_lifetime_out = va_arg(valist, psa_key_lifetime_t *);
- *key_lifetime_out = psa_get_key_lifetime(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_USAGE_FLAGS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- usage_out = va_arg(valist, psa_key_usage_t *);
- *usage_out = psa_get_key_usage_flags(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_ALGORITHM:
- attributes = va_arg(valist, psa_key_attributes_t *);
- key_alg_out = va_arg(valist, psa_algorithm_t *);
- *key_alg_out = psa_get_key_algorithm(attributes);
- return 0;
- case PAL_CRYPTO_GET_KEY_BITS:
- attributes = va_arg(valist, psa_key_attributes_t *);
- length = va_arg(valist, size_t *);
- *length = psa_get_key_bits(attributes);
- return 0;
- case PAL_CRYPTO_DESTROY_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- return psa_destroy_key(key_handle);
- case PAL_CRYPTO_HASH_SETUP:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_hash_setup(hash_operation, alg);
- case PAL_CRYPTO_HASH_UPDATE:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_hash_update(hash_operation, buffer, size);
- case PAL_CRYPTO_HASH_VERIFY:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_hash_verify(hash_operation, buffer, size);
- case PAL_CRYPTO_HASH_FINISH:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_hash_finish(hash_operation, buffer, size, length);
- case PAL_CRYPTO_HASH_ABORT:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- return psa_hash_abort(hash_operation);
- case PAL_CRYPTO_HASH_COMPUTE:
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_hash_compute(alg, plaintext, plaintext_size, buffer, size, length);
- case PAL_CRYPTO_HASH_COMPARE:
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_hash_compare(alg, plaintext, plaintext_size, buffer, size);
- case PAL_CRYPTO_HASH_CLONE:
- hash_operation = va_arg(valist, psa_hash_operation_t*);
- target_operation = va_arg(valist, psa_hash_operation_t*);
- return psa_hash_clone(hash_operation, target_operation);
- case PAL_CRYPTO_GENERATE_KEY:
- attributes = va_arg(valist, psa_key_attributes_t *);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_generate_key(attributes, handle);
- case PAL_CRYPTO_AEAD_ENCRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- nonce = va_arg(valist, const uint8_t *);
- nonce_length = va_arg(valist, size_t);
- additional_data = va_arg(valist, const uint8_t *);
- additional_data_length = va_arg(valist, size_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_aead_encrypt(key_handle, alg, nonce, nonce_length, additional_data,
- additional_data_length, plaintext, size, ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_AEAD_DECRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- nonce = va_arg(valist, const uint8_t *);
- nonce_length = va_arg(valist, size_t);
- additional_data = va_arg(valist, const uint8_t *);
- additional_data_length = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_aead_decrypt(key_handle, alg, nonce, nonce_length, additional_data,
- additional_data_length, ciphertext, ciphertext_size, plaintext, size, length);
- case PAL_CRYPTO_AEAD_ENCRYPT_SETUP:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_aead_encrypt_setup(aead_operation, key_handle, alg);
- case PAL_CRYPTO_AEAD_DECRYPT_SETUP:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_aead_decrypt_setup(aead_operation, key_handle, alg);
- case PAL_CRYPTO_AEAD_GENERATE_NONCE:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t*);
- return psa_aead_generate_nonce(aead_operation, buffer, size, length);
- case PAL_CRYPTO_AEAD_SET_NONCE:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_aead_set_nonce(aead_operation, buffer, size);
- case PAL_CRYPTO_AEAD_SET_LENGTHS:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- size = va_arg(valist, size_t);
- plaintext_size = va_arg(valist, size_t);
- return psa_aead_set_lengths(aead_operation, size, plaintext_size);
- case PAL_CRYPTO_AEAD_UPDATE_AD:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_aead_update_ad(aead_operation, buffer, size);
- case PAL_CRYPTO_AEAD_UPDATE:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_aead_update(aead_operation, plaintext, plaintext_size, ciphertext,
- ciphertext_size, length);
- case PAL_CRYPTO_AEAD_FINISH:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- tag_length = (size_t *)va_arg(valist, size_t*);
- return psa_aead_finish(aead_operation, ciphertext, ciphertext_size, length, buffer,
- size, tag_length);
- case PAL_CRYPTO_AEAD_VERIFY:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_aead_verify(aead_operation, plaintext, plaintext_size, length, buffer, size);
- case PAL_CRYPTO_AEAD_ABORT:
- aead_operation = va_arg(valist, psa_aead_operation_t *);
- return psa_aead_abort(aead_operation);
- case PAL_CRYPTO_MAC_SIGN_SETUP:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_mac_sign_setup(mac_operation, key_handle, alg);
- case PAL_CRYPTO_MAC_UPDATE:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_mac_update(mac_operation, buffer, size);
- case PAL_CRYPTO_MAC_SIGN_FINISH:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = (size_t *)va_arg(valist, size_t*);
- return psa_mac_sign_finish(mac_operation, buffer, size, length);
- case PAL_CRYPTO_MAC_VERIFY_SETUP:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_mac_verify_setup(mac_operation, key_handle, alg);
- case PAL_CRYPTO_MAC_VERIFY_FINISH:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_mac_verify_finish(mac_operation, buffer, size);
- case PAL_CRYPTO_MAC_ABORT:
- mac_operation = va_arg(valist, psa_mac_operation_t*);
- return psa_mac_abort(mac_operation);
- case PAL_CRYPTO_MAC_COMPUTE:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_mac_compute(key_handle, alg, plaintext, plaintext_size, ciphertext,
- ciphertext_size, length);
- case PAL_CRYPTO_MAC_VERIFY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t*);
- plaintext_size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t*);
- ciphertext_size = va_arg(valist, size_t);
- return psa_mac_verify(key_handle, alg, plaintext, plaintext_size, ciphertext,
- ciphertext_size);
- case PAL_CRYPTO_ASYMMTERIC_ENCRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- salt = va_arg(valist, const uint8_t *);
- salt_length = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_asymmetric_encrypt(key_handle, alg, plaintext, size, salt, salt_length,
- ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_ASYMMTERIC_DECRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- salt = va_arg(valist, const uint8_t *);
- salt_length = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_asymmetric_decrypt(key_handle, alg, plaintext, size, salt, salt_length,
- ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_CIPHER_ENCRYPT_SETUP:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_cipher_encrypt_setup(cipher_operation, key_handle, alg);
- case PAL_CRYPTO_CIPHER_DECRYPT_SETUP:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_cipher_decrypt_setup(cipher_operation, key_handle, alg);
- case PAL_CRYPTO_CIPHER_GENERATE_IV:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_generate_iv(cipher_operation, buffer, size, length);
- case PAL_CRYPTO_CIPHER_SET_IV:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_cipher_set_iv(cipher_operation, buffer, size);
- case PAL_CRYPTO_CIPHER_UPDATE:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_update(cipher_operation, plaintext, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_CIPHER_FINISH:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_finish(cipher_operation, ciphertext, ciphertext_size, length);
- case PAL_CRYPTO_CIPHER_ABORT:
- cipher_operation = va_arg(valist, psa_cipher_operation_t *);
- return psa_cipher_abort(cipher_operation);
- case PAL_CRYPTO_CIPHER_ENCRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_encrypt(key_handle, alg, plaintext, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_CIPHER_DECRYPT:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- plaintext = va_arg(valist, uint8_t *);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_cipher_decrypt(key_handle, alg, plaintext, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_ASYMMTERIC_SIGN:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_asymmetric_sign(key_handle, alg, buffer, size, ciphertext, ciphertext_size,
- length);
- case PAL_CRYPTO_ASYMMTERIC_VERIFY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- alg = va_arg(valist, psa_algorithm_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- ciphertext = va_arg(valist, uint8_t *);
- ciphertext_size = va_arg(valist, size_t);
- return psa_asymmetric_verify(key_handle, alg, buffer, size, ciphertext,
- ciphertext_size);
- case PAL_CRYPTO_RAW_KEY_AGREEMENT:
- alg = va_arg(valist, psa_algorithm_t);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- peer = va_arg(valist, uint8_t*);
- peer_length = va_arg(valist, size_t);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- length = va_arg(valist, size_t*);
- return psa_raw_key_agreement(alg, key_handle, peer, peer_length, buffer, size, length);
- case PAL_CRYPTO_COPY_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- attributes = va_arg(valist, psa_key_attributes_t *);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_copy_key(key_handle, attributes, handle);
- case PAL_CRYPTO_KEY_DERIVATION_SETUP:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- alg = va_arg(valist, psa_algorithm_t);
- return psa_key_derivation_setup(derive_operation, alg);
- case PAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- step = (psa_key_derivation_step_t)va_arg(valist, int);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_key_derivation_input_bytes(derive_operation, step, buffer, size);
- case PAL_CRYPTO_KEY_DERIVATION_INPUT_KEY:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- step = (psa_key_derivation_step_t)va_arg(valist, int);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- return psa_key_derivation_input_key(derive_operation, step, key_handle);
- case PAL_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- step = (psa_key_derivation_step_t)va_arg(valist, int);
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- peer = va_arg(valist, uint8_t*);
- peer_length = va_arg(valist, size_t);
- return psa_key_derivation_key_agreement(derive_operation, step, key_handle, peer,
- peer_length);
- case PAL_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- buffer = va_arg(valist, uint8_t*);
- size = va_arg(valist, size_t);
- return psa_key_derivation_output_bytes(derive_operation, buffer, size);
- case PAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY:
- attributes = va_arg(valist, psa_key_attributes_t *);
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_key_derivation_output_key(attributes, derive_operation, handle);
- case PAL_CRYPTO_KEY_DERIVATION_SET_CAPACITY:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- size = va_arg(valist, size_t);
- return psa_key_derivation_set_capacity(derive_operation, size);
- case PAL_CRYPTO_KEY_DERIVATION_GET_CAPACITY:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- length = va_arg(valist, size_t *);
- return psa_key_derivation_get_capacity(derive_operation, length);
- case PAL_CRYPTO_KEY_DERIVATION_ABORT:
- derive_operation = va_arg(valist, psa_key_derivation_operation_t *);
- return psa_key_derivation_abort(derive_operation);
- case PAL_CRYPTO_OPEN_KEY:
- key_id = va_arg(valist, psa_key_id_t);
- handle = (psa_key_handle_t *)va_arg(valist, int *);
- return psa_open_key(key_id, handle);
- case PAL_CRYPTO_CLOSE_KEY:
- key_handle = (psa_key_handle_t)va_arg(valist, int);
- return psa_close_key(key_handle);
- case PAL_CRYPTO_FREE:
- for (i = 0; i < PAL_KEY_SLOT_COUNT; i++)
- psa_destroy_key(i);
- return 0;
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.h
deleted file mode 100644
index 671dfa0..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/crypto/pal_crypto_intf.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_CRYPTO_INTF_H_
-#define _PAL_CRYPTO_INTF_H_
-
-#include "pal_common.h"
-
-enum crypto_function_code {
- PAL_CRYPTO_INIT = 0x1,
- PAL_CRYPTO_GENERATE_RANDOM = 0x2,
- PAL_CRYPTO_IMPORT_KEY = 0x3,
- PAL_CRYPTO_EXPORT_KEY = 0x4,
- PAL_CRYPTO_EXPORT_PUBLIC_KEY = 0x5,
- PAL_CRYPTO_DESTROY_KEY = 0x6,
- PAL_CRYPTO_HASH_SETUP = 0x7,
- PAL_CRYPTO_HASH_UPDATE = 0x8,
- PAL_CRYPTO_HASH_VERIFY = 0x9,
- PAL_CRYPTO_HASH_FINISH = 0xA,
- PAL_CRYPTO_HASH_ABORT = 0xB,
- PAL_CRYPTO_GENERATE_KEY = 0xC,
- PAL_CRYPTO_AEAD_ENCRYPT = 0xD,
- PAL_CRYPTO_AEAD_DECRYPT = 0xE,
- PAL_CRYPTO_MAC_SIGN_SETUP = 0xF,
- PAL_CRYPTO_MAC_UPDATE = 0x10,
- PAL_CRYPTO_MAC_SIGN_FINISH = 0x11,
- PAL_CRYPTO_MAC_VERIFY_SETUP = 0x12,
- PAL_CRYPTO_MAC_VERIFY_FINISH = 0x13,
- PAL_CRYPTO_MAC_ABORT = 0x14,
- PAL_CRYPTO_ASYMMTERIC_ENCRYPT = 0x15,
- PAL_CRYPTO_ASYMMTERIC_DECRYPT = 0x16,
- PAL_CRYPTO_CIPHER_ENCRYPT_SETUP = 0x17,
- PAL_CRYPTO_CIPHER_DECRYPT_SETUP = 0x18,
- PAL_CRYPTO_CIPHER_GENERATE_IV = 0x19,
- PAL_CRYPTO_CIPHER_SET_IV = 0x1A,
- PAL_CRYPTO_CIPHER_UPDATE = 0x1B,
- PAL_CRYPTO_CIPHER_FINISH = 0x1C,
- PAL_CRYPTO_CIPHER_ABORT = 0x1D,
- PAL_CRYPTO_ASYMMTERIC_SIGN = 0x1E,
- PAL_CRYPTO_ASYMMTERIC_VERIFY = 0x1F,
- PAL_CRYPTO_COPY_KEY = 0x20,
- PAL_CRYPTO_SET_KEY_TYPE = 0x21,
- PAL_CRYPTO_SET_KEY_BITS = 0x22,
- PAL_CRYPTO_GET_KEY_ATTRIBUTES = 0x23,
- PAL_CRYPTO_GET_KEY_TYPE = 0x24,
- PAL_CRYPTO_SET_KEY_USAGE_FLAGS = 0x25,
- PAL_CRYPTO_RESET_KEY_ATTRIBUTES = 0x26,
- PAL_CRYPTO_SET_KEY_ID = 0x27,
- PAL_CRYPTO_SET_KEY_LIFETIME = 0x28,
- PAL_CRYPTO_SET_KEY_ALGORITHM = 0x29,
- PAL_CRYPTO_GET_KEY_ID = 0x2A,
- PAL_CRYPTO_GET_KEY_LIFETIME = 0x2B,
- PAL_CRYPTO_GET_KEY_USAGE_FLAGS = 0x2C,
- PAL_CRYPTO_GET_KEY_ALGORITHM = 0x2D,
- PAL_CRYPTO_GET_KEY_BITS = 0x2E,
- PAL_CRYPTO_HASH_COMPUTE = 0x2F,
- PAL_CRYPTO_HASH_COMPARE = 0x30,
- PAL_CRYPTO_KEY_DERIVATION_SETUP = 0x31,
- PAL_CRYPTO_KEY_DERIVATION_ABORT = 0x32,
- PAL_CRYPTO_RAW_KEY_AGREEMENT = 0x33,
- PAL_CRYPTO_KEY_DERIVATION_INPUT_BYTES = 0x34,
- PAL_CRYPTO_KEY_DERIVATION_INPUT_KEY = 0x35,
- PAL_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT = 0x36,
- PAL_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES = 0x37,
- PAL_CRYPTO_KEY_DERIVATION_OUTPUT_KEY = 0x38,
- PAL_CRYPTO_KEY_DERIVATION_SET_CAPACITY = 0x39,
- PAL_CRYPTO_KEY_DERIVATION_GET_CAPACITY = 0x3A,
- PAL_CRYPTO_HASH_CLONE = 0x3B,
- PAL_CRYPTO_MAC_COMPUTE = 0x3C,
- PAL_CRYPTO_MAC_VERIFY = 0x3D,
- PAL_CRYPTO_CIPHER_ENCRYPT = 0x3F,
- PAL_CRYPTO_CIPHER_DECRYPT = 0x40,
- PAL_CRYPTO_OPEN_KEY = 0x41,
- PAL_CRYPTO_CLOSE_KEY = 0x42,
- PAL_CRYPTO_AEAD_ENCRYPT_SETUP = 0x43,
- PAL_CRYPTO_AEAD_DECRYPT_SETUP = 0x44,
- PAL_CRYPTO_AEAD_GENERATE_NONCE = 0x45,
- PAL_CRYPTO_AEAD_SET_NONCE = 0x46,
- PAL_CRYPTO_AEAD_SET_LENGTHS = 0X47,
- PAL_CRYPTO_AEAD_UPDATE_AD = 0x48,
- PAL_CRYPTO_AEAD_UPDATE = 0x49,
- PAL_CRYPTO_AEAD_FINISH = 0x4A,
- PAL_CRYPTO_AEAD_VERIFY = 0x4B,
- PAL_CRYPTO_AEAD_ABORT = 0x4C,
- PAL_CRYPTO_FREE = 0xFE,
-};
-
-int32_t pal_crypto_function(int type, va_list valist);
-#endif /* _PAL_CRYPTO_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.c
deleted file mode 100644
index 488c96b..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_attestation_crypto.h"
-
-static uint32_t public_key_registered;
-static psa_key_handle_t public_key_handle;
-
-static inline struct q_useful_buf_c useful_buf_head(struct q_useful_buf_c buf,
- size_t amount)
-{
- return UsefulBuf_Head(buf, amount);
-}
-
-static psa_algorithm_t cose_hash_alg_id_to_psa(int32_t cose_hash_alg_id)
-{
- psa_algorithm_t status;
-
- switch (cose_hash_alg_id)
- {
- case COSE_ALG_SHA256_PROPRIETARY:
- status = PSA_ALG_SHA_256;
- break;
- default:
- status = PSA_ALG_MD4;
- break;
- }
-
- return status;
-}
-
-static int32_t hash_alg_id_from_sig_alg_id(int32_t cose_sig_alg_id)
-{
- switch (cose_sig_alg_id)
- {
- case COSE_ALGORITHM_ES256:
- return COSE_ALG_SHA256_PROPRIETARY;
- default:
- return INT32_MAX;
- }
-}
-
-int32_t pal_cose_crypto_hash_start(psa_hash_operation_t *psa_hash, int32_t cose_hash_alg_id)
-{
- psa_algorithm_t psa_alg;
- psa_status_t status = PSA_ERROR_GENERIC_ERROR;
-
- /* Map the algorithm ID */
- psa_alg = cose_hash_alg_id_to_psa(cose_hash_alg_id);
-
- /* Actually do the hash set up */
- status = psa_hash_setup(psa_hash, psa_alg);
-
- return status;
-
-}
-
-void pal_cose_crypto_hash_update(psa_hash_operation_t *psa_hash,
- struct q_useful_buf_c data_to_hash)
-{
- if (data_to_hash.ptr == NULL) {
- /* No data was passed in to be hashed indicating the mode of use is
- * the computation of the size of hash. This mode is hashing is used
- * by t_cose when it is requested to compute the size of the signed
- * data it might compute, which is in turn used to compute the
- * size of a would be token. When computing the size, the size
- * like this, there is nothing to do in update()
- */
- return;
- }
-
- /* Actually hash the data */
- psa_hash_update(psa_hash, data_to_hash.ptr, data_to_hash.len);
-}
-
-int32_t pal_cose_crypto_hash_finish(psa_hash_operation_t *psa_hash,
- struct q_useful_buf buffer_to_hold_result,
- struct q_useful_buf_c *hash_result)
-{
- psa_status_t status = PSA_ERROR_GENERIC_ERROR;
-
- /* Actually finish up the hash */
- status = psa_hash_finish(psa_hash, buffer_to_hold_result.ptr,
- buffer_to_hold_result.len, &(hash_result->len));
- hash_result->ptr = buffer_to_hold_result.ptr;
-
- return status;
-
-}
-
-int pal_create_sha256(struct q_useful_buf_c bytes_to_hash, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash)
-{
- psa_status_t status = PSA_ERROR_GENERIC_ERROR;
- psa_hash_operation_t psa_hash = PSA_HASH_OPERATION_INIT;
-
- status = pal_cose_crypto_hash_start(&psa_hash, COSE_ALG_SHA256_PROPRIETARY);
- if (status != PSA_SUCCESS)
- goto Done;
-
- pal_cose_crypto_hash_update(&psa_hash, bytes_to_hash);
-
- status = pal_cose_crypto_hash_finish(&psa_hash, buffer_for_hash, hash);
- if (status != PSA_SUCCESS)
- goto Done;
-Done:
- return status;
-}
-
-uint32_t pal_compute_hash(int32_t cose_alg_id, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash, struct q_useful_buf_c protected_headers,
- struct q_useful_buf_c payload)
-{
- uint32_t status;
- QCBOREncodeContext cbor_encode_ctx;
- struct q_useful_buf_c tbs_first_part;
- QCBORError qcbor_result;
- int32_t hash_alg_id;
- UsefulBuf_MAKE_STACK_UB (buffer_for_TBS_first_part, T_COSE_SIZE_OF_TBS);
- psa_hash_operation_t psa_hash = PSA_HASH_OPERATION_INIT;
-
- /* This builds the CBOR-format to-be-signed bytes */
- QCBOREncode_Init(&cbor_encode_ctx, buffer_for_TBS_first_part);
- QCBOREncode_OpenArray(&cbor_encode_ctx);
-
- /* context */
- QCBOREncode_AddSZString(&cbor_encode_ctx, COSE_SIG_CONTEXT_STRING_SIGNATURE1);
-
- /* body_protected */
- QCBOREncode_AddBytes(&cbor_encode_ctx, protected_headers);
-
- /* sign_protected is not used for Sign1 */
- /* external_aad */
- QCBOREncode_AddBytes(&cbor_encode_ctx, NULL_USEFUL_BUF_C);
-
- /* The short fake payload. */
- QCBOREncode_AddBytesLenOnly(&cbor_encode_ctx, payload);
- QCBOREncode_CloseArray(&cbor_encode_ctx);
-
- /* Get the result and convert it to struct q_useful_buf_c representation */
- qcbor_result = QCBOREncode_Finish(&cbor_encode_ctx, &tbs_first_part);
- if (qcbor_result)
- {
- /* Mainly means that the protected_headers were too big
- * (which should never happen)
- */
- status = PAL_ATTEST_ERR_SIGN_STRUCT;
- goto Done;
- }
-
- /* Start the hashing */
- hash_alg_id = hash_alg_id_from_sig_alg_id(cose_alg_id);
-
- /* Don't check hash_alg_id for failure. pal_cose_crypto_hash_start()
- * will handle it properly
- */
- status = pal_cose_crypto_hash_start(&psa_hash, hash_alg_id);
- if (status)
- goto Done;
-
- /* This is hashing of the first part, all the CBOR
- * except the payload.
- */
- pal_cose_crypto_hash_update(&psa_hash, useful_buf_head(tbs_first_part, tbs_first_part.len));
-
- /* Hash the payload, the second part. */
- pal_cose_crypto_hash_update(&psa_hash, payload);
-
- /* Finish the hash and set up to return it */
- status = pal_cose_crypto_hash_finish(&psa_hash, buffer_for_hash, hash);
-
-Done:
- return status;
-}
-
-static int32_t pal_attest_get_public_key(uint8_t *public_key_buff, size_t public_key_buf_size,
- size_t *public_key_len, psa_ecc_curve_t *elliptic_curve_type)
-{
- int32_t status = PAL_ATTEST_ERROR;
-
-#ifdef PLATFORM_OVERRIDE_ATTEST_PK
- if (public_key_buf_size < (attest_key.pubx_key_size + attest_key.puby_key_size + 1))
- return PAL_ATTEST_ERR_SMALL_BUFFER;
-
- *public_key_len = (attest_key.pubx_key_size + attest_key.puby_key_size + 1);
- *elliptic_curve_type = PSA_ECC_CURVE_SECP256R1;
- memcpy(public_key_buff, (void *)&attest_public_key, *public_key_len);
- status = PSA_SUCCESS;
-#else
- status = tfm_initial_attest_get_public_key(public_key_buff,
- public_key_buf_size,
- public_key_len,
- elliptic_curve_type);
-#endif
-
- return status;
-}
-
-static uint32_t pal_import_attest_key(psa_algorithm_t key_alg)
-{
- psa_status_t status = PAL_ATTEST_ERROR;
- psa_key_usage_t usage = PSA_KEY_USAGE_VERIFY;
- psa_ecc_curve_t ecc_curve;
- psa_key_type_t attest_key_type;
- size_t public_key_size;
- uint8_t public_key_buff[ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH] = {0};
-
-#if defined(CRYPTO_VERSION_BETA1) || defined(CRYPTO_VERSION_BETA2)
- psa_key_policy_t policy;
-
- if (!public_key_registered)
- {
- status = pal_attest_get_public_key(public_key_buff,
- sizeof(public_key_buff),
- &public_key_size,
- &ecc_curve);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- if (ecc_curve == USHRT_MAX)
- return PAL_ATTEST_ERROR;
-
- /* Set key type for public key */
- attest_key_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY(ecc_curve);
-
- /* Setup the key policy for public key */
- policy = psa_key_policy_init();
- psa_key_policy_set_usage(&policy, usage, key_alg);
-
- status = psa_allocate_key(&public_key_handle);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- status = psa_set_key_policy(public_key_handle, &policy);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- /* Import the public key */
- status = psa_import_key(public_key_handle,
- attest_key_type,
- public_key_buff,
- public_key_size);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- public_key_registered = 1;
- }
-
-#elif defined(CRYPTO_VERSION_BETA3)
- psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
- if (!public_key_registered)
- {
- status = pal_attest_get_public_key(public_key_buff,
- sizeof(public_key_buff),
- &public_key_size,
- &ecc_curve);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- if (ecc_curve == USHRT_MAX)
- return PAL_ATTEST_ERROR;
-
- /* Set key type for public key */
- attest_key_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY(ecc_curve);
-
- /* Set the attributes for the public key */
- psa_set_key_type(&attributes, attest_key_type);
- psa_set_key_bits(&attributes, public_key_size);
- psa_set_key_usage_flags(&attributes, usage);
- psa_set_key_algorithm(&attributes, key_alg);
-
- /* Import the public key */
- status = psa_import_key(&attributes,
- public_key_buff,
- public_key_size,
- &public_key_handle);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- public_key_registered = 1;
- }
-#endif
-
- return status;
-}
-
-static uint32_t pal_destroy_attest_key(void)
-{
- psa_status_t status;
-
- if (!public_key_registered)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- status = psa_destroy_key(public_key_handle);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- public_key_registered = 0;
-
- return PAL_ATTEST_SUCCESS;
-}
-
-uint32_t pal_crypto_pub_key_verify(int32_t cose_algorithm_id,
- struct q_useful_buf_c token_hash,
- struct q_useful_buf_c signature)
-{
- int32_t status = PAL_ATTEST_ERROR;
- psa_algorithm_t key_alg = PSA_ALG_ECDSA(PSA_ALG_SHA_256);
-
- /* Register the attestation public key */
- status = pal_import_attest_key(key_alg);
- if (status != PAL_ATTEST_SUCCESS)
- return status;
-
- /* Verify the signature */
- status = psa_asymmetric_verify(public_key_handle,
- key_alg, token_hash.ptr, token_hash.len,
- signature.ptr, signature.len);
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_SIGNATURE_FAIL;
-
- /* Unregister the attestation public key */
- status = pal_destroy_attest_key();
- if (status != PSA_SUCCESS)
- return PAL_ATTEST_ERR_KEY_FAIL;
-
- return PAL_ATTEST_SUCCESS;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.h
deleted file mode 100644
index 559a24c..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_crypto.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_ATTESTATION_CRYPTO_H_
-#define _PAL_ATTESTATION_CRYPTO_H_
-
-#include "pal_attestation_eat.h"
-
-#define ATTEST_PUBLIC_KEY_SLOT 4
-#define ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH (1 + 2 * PSA_BITS_TO_BYTES(256))
-
-typedef struct {
- uint8_t *pubx_key;
- size_t pubx_key_size;
- uint8_t *puby_key;
- size_t puby_key_size;
-} ecc_key_t;
-
-struct ecc_public_key_t {
- const uint8_t a;
- uint8_t public_key[]; /* X-coordinate || Y-coordinate */
-};
-
-static const struct ecc_public_key_t attest_public_key = {
- /* Constant byte */
- 0x04,
- /* X-coordinate */
- {0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
- 0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
- 0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
- 0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F,
- /* Y-coordinate */
- 0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
- 0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
- 0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
- 0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64},
-};
-
-static const uint8_t initial_attestation_public_x_key[] = {
- 0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
- 0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
- 0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
- 0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F
-};
-
-static const uint8_t initial_attestation_public_y_key[] = {
- 0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
- 0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
- 0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
- 0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64
-};
-
-/* Initialize the structure with given public key */
-static const ecc_key_t attest_key = {
- (uint8_t *)initial_attestation_public_x_key,
- sizeof(initial_attestation_public_x_key),
- (uint8_t *)initial_attestation_public_y_key,
- sizeof(initial_attestation_public_y_key)
-};
-
-int32_t pal_cose_crypto_hash_start(psa_hash_operation_t *psa_hash, int32_t cose_hash_alg_id);
-void pal_cose_crypto_hash_update(psa_hash_operation_t *psa_hash,
- struct q_useful_buf_c data_to_hash);
-int32_t pal_cose_crypto_hash_finish(psa_hash_operation_t *psa_hash,
- struct q_useful_buf buffer_to_hold_result,
- struct q_useful_buf_c *hash_result);
-int pal_create_sha256(struct q_useful_buf_c bytes_to_hash, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash);
-uint32_t pal_compute_hash(int32_t cose_alg_id, struct q_useful_buf buffer_for_hash,
- struct q_useful_buf_c *hash, struct q_useful_buf_c protected_headers,
- struct q_useful_buf_c payload);
-uint32_t pal_crypto_pub_key_verify(int32_t cose_algorithm_id, struct q_useful_buf_c token_hash,
- struct q_useful_buf_c signature);
-#endif /* _PAL_ATTESTATION_CRYPTO_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_eat.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_eat.h
deleted file mode 100644
index 56d624e..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_eat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_ATTESTATION_EAT_H_
-#define _PAL_ATTESTATION_EAT_H_
-
-#include "qcbor.h"
-#include "pal_common.h"
-
-#define PAL_ATTEST_MIN_ERROR 30
-
-#define COSE_ALGORITHM_ES256 -7
-#define COSE_ALG_SHA256_PROPRIETARY -72000
-
-#define USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB
-
-#define COSE_SIG_CONTEXT_STRING_SIGNATURE1 "Signature1"
-
-/* Private value. Intentionally not documented for Doxygen.
- * This is the size allocated for the encoded protected headers. It
- * needs to be big enough for make_protected_header() to succeed. It
- * currently sized for one header with an algorithm ID up to 32 bits
- * long -- one byte for the wrapping map, one byte for the label, 5
- * bytes for the ID. If this is made accidentially too small, QCBOR will
- * only return an error, and not overrun any buffers.
- *
- * 9 extra bytes are added, rounding it up to 16 total, in case some
- * other protected header is to be added.
- */
-#define T_COSE_SIGN1_MAX_PROT_HEADER (1+1+5+9)
-
-/**
- * This is the size of the first part of the CBOR encoded TBS
- * bytes. It is around 20 bytes. See create_tbs_hash().
- */
-#define T_COSE_SIZE_OF_TBS \
- 1 + /* For opening the array */ \
- sizeof(COSE_SIG_CONTEXT_STRING_SIGNATURE1) + /* "Signature1" */ \
- 2 + /* Overhead for encoding string */ \
- T_COSE_SIGN1_MAX_PROT_HEADER + /* entire protected headers */ \
- 3 * ( /* 3 NULL bstrs for fields not used */ \
- 1 /* size of a NULL bstr */ \
- )
-#define NULL_USEFUL_BUF_C NULLUsefulBufC
-
-enum attestation_error_code {
- PAL_ATTEST_SUCCESS = 0,
- PAL_ATTEST_TOKEN_ERR_CBOR_FORMATTING = PAL_ATTEST_MIN_ERROR,
- PAL_ATTEST_TOKEN_CHALLENGE_MISMATCH,
- PAL_ATTEST_TOKEN_NOT_SUPPORTED,
- PAL_ATTEST_TOKEN_NOT_ALL_MANDATORY_CLAIMS,
- PAL_ATTEST_HASH_LENGTH_MISMATCH,
- PAL_ATTEST_HASH_MISMATCH,
- PAL_ATTEST_HASH_FAIL,
- PAL_ATTEST_HASH_UNSUPPORTED,
- PAL_ATTEST_HASH_BUFFER_SIZE,
- PAL_ATTEST_ERR_PROTECTED_HEADERS,
- PAL_ATTEST_ERR_SIGN_STRUCT,
- PAL_ATTEST_ERR_KEY_FAIL,
- PAL_ATTEST_ERR_SIGNATURE_FAIL,
- PAL_ATTEST_ERR_CBOR_STRUCTURE,
- PAL_ATTEST_ERR_SMALL_BUFFER,
- PAL_ATTEST_ERROR,
-};
-
-#endif /* _PAL_ATTESTATION_EAT_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_empty_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_empty_intf.c
deleted file mode 100644
index faf3f49..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested attestation function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_attestation_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.c
deleted file mode 100644
index 83c1ebd..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_attestation_intf.h"
-
-/**
- @brief - This API will call the requested attestation function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-int32_t pal_attestation_function(int type, va_list valist)
-{
- uint8_t *challenge, *token;
- size_t challenge_size, *token_size, verify_token_size, token_buffer_size;
-
- switch (type)
- {
- case PAL_INITIAL_ATTEST_GET_TOKEN:
- challenge = va_arg(valist, uint8_t*);
- challenge_size = va_arg(valist, size_t);
- token = va_arg(valist, uint8_t*);
- token_buffer_size = va_arg(valist, size_t);
- token_size = va_arg(valist, size_t*);
- return psa_initial_attest_get_token(challenge, challenge_size, token, token_buffer_size,
- token_size);
- case PAL_INITIAL_ATTEST_GET_TOKEN_SIZE:
- challenge_size = va_arg(valist, size_t);
- token_size = va_arg(valist, size_t*);
- return psa_initial_attest_get_token_size(challenge_size, token_size);
- case PAL_INITIAL_ATTEST_VERIFY_TOKEN:
- challenge = va_arg(valist, uint8_t*);
- challenge_size = va_arg(valist, size_t);
- token = va_arg(valist, uint8_t*);
- verify_token_size = va_arg(valist, size_t);
- return pal_initial_attest_verify_token(challenge, challenge_size,
- token, verify_token_size);
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.h
deleted file mode 100644
index 3ab7ebb..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/initial_attestation/pal_attestation_intf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_ATTESTATION_INTF_H_
-#define _PAL_ATTESTATION_INTF_H_
-
-#include "pal_attestation_crypto.h"
-
-enum attestation_function_code {
- PAL_INITIAL_ATTEST_GET_TOKEN = 0x1,
- PAL_INITIAL_ATTEST_GET_TOKEN_SIZE = 0x2,
- PAL_INITIAL_ATTEST_VERIFY_TOKEN = 0x3,
- PAL_INITIAL_ATTEST_COMPUTE_HASH = 0x4,
- PAL_INITIAL_ATTEST_VERIFY_WITH_PK = 0x5,
-};
-
-int32_t pal_attestation_function(int type, va_list valist);
-#endif /* _PAL_ATTESTATION_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_empty_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_empty_intf.c
deleted file mode 100644
index 133cfa9..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested internal trusted storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_its_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
deleted file mode 100644
index abfdc5d..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_internal_trusted_storage_intf.h"
-
-/**
- @brief - This API will call the requested internal trusted storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_its_function(int type, va_list valist)
-{
- psa_storage_uid_t uid;
- uint32_t data_size, offset;
- const void *p_write_data;
- void *p_read_data;
- size_t *p_data_length;
- psa_storage_create_flags_t its_create_flags;
- struct psa_storage_info_t *its_p_info;
-
- switch (type)
- {
- case PAL_ITS_SET:
- uid = va_arg(valist, psa_storage_uid_t);
- data_size = va_arg(valist, uint32_t);
- p_write_data = va_arg(valist, const void*);
- its_create_flags = va_arg(valist, psa_storage_create_flags_t);
- return psa_its_set(uid, data_size, p_write_data, its_create_flags);
- case PAL_ITS_GET:
- uid = va_arg(valist, psa_storage_uid_t);
- offset = va_arg(valist, uint32_t);
- data_size = va_arg(valist, uint32_t);
- p_read_data = va_arg(valist, void*);
- p_data_length = va_arg(valist, size_t*);
- return psa_its_get(uid, offset, data_size, p_read_data, p_data_length);
- case PAL_ITS_GET_INFO:
- uid = va_arg(valist, psa_storage_uid_t);
- its_p_info = va_arg(valist, struct psa_storage_info_t*);
- return psa_its_get_info(uid, its_p_info);
- case PAL_ITS_REMOVE:
- uid = va_arg(valist, psa_storage_uid_t);
- return psa_its_remove(uid);
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.h
deleted file mode 100644
index 6db6aac..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_INTERNAL_TRUSTED_STORAGE_INTF_H_
-#define _PAL_INTERNAL_TRUSTED_STORAGE_INTF_H_
-
-#include "pal_common.h"
-
-enum its_function_code {
- PAL_ITS_SET = 0x1,
- PAL_ITS_GET = 0x2,
- PAL_ITS_GET_INFO = 0x3,
- PAL_ITS_REMOVE = 0x4,
-};
-
-uint32_t pal_its_function(int type, va_list valist);
-#endif /* _PAL_INTERNAL_TRUSTED_STORAGE_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_empty_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_empty_intf.c
deleted file mode 100644
index ee9b13d..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_empty_intf.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 <stdarg.h>
-#include "pal_common.h"
-
-/**
- @brief - This API will call the requested protected storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_ps_function(int type, va_list valist)
-{
- return PAL_STATUS_ERROR;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.c
deleted file mode 100644
index 0dd07c5..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_protected_storage_intf.h"
-
-/**
- @brief - This API will call the requested protected storage function
- @param - type : function code
- valist : variable argument list
- @return - error status
-**/
-uint32_t pal_ps_function(int type, va_list valist)
-{
- psa_storage_uid_t uid;
- uint32_t data_size, size, offset;
- const void *p_write_data;
- void *p_read_data;
- size_t *p_data_length;
- psa_storage_create_flags_t ps_create_flags;
- struct psa_storage_info_t *ps_p_info;
-
- switch (type)
- {
- case PAL_PS_SET:
- uid = va_arg(valist, psa_storage_uid_t);
- data_size = va_arg(valist, uint32_t);
- p_write_data = va_arg(valist, const void*);
- ps_create_flags = va_arg(valist, psa_storage_create_flags_t);
- return psa_ps_set(uid, data_size, p_write_data, ps_create_flags);
- case PAL_PS_GET:
- uid = va_arg(valist, psa_storage_uid_t);
- offset = va_arg(valist, uint32_t);
- data_size = va_arg(valist, uint32_t);
- p_read_data = va_arg(valist, void*);
- p_data_length = va_arg(valist, size_t*);
- return psa_ps_get(uid, offset, data_size, p_read_data, p_data_length);
- case PAL_PS_GET_INFO:
- uid = va_arg(valist, psa_storage_uid_t);
- ps_p_info = va_arg(valist, struct psa_storage_info_t*);
- return psa_ps_get_info(uid, ps_p_info);
- case PAL_PS_REMOVE:
- uid = va_arg(valist, psa_storage_uid_t);
- return psa_ps_remove(uid);
- case PAL_PS_CREATE:
- uid = va_arg(valist, psa_storage_uid_t);
- size = va_arg(valist, uint32_t);
- ps_create_flags = va_arg(valist, psa_storage_create_flags_t);
- return psa_ps_create(uid, size, ps_create_flags);
- case PAL_PS_SET_EXTENDED:
- uid = va_arg(valist, psa_storage_uid_t);
- offset = va_arg(valist, uint32_t);
- data_size = va_arg(valist, uint32_t);
- p_write_data = va_arg(valist, const void*);
- return psa_ps_set_extended(uid, offset, data_size, p_write_data);
- case PAL_PS_GET_SUPPORT:
- return psa_ps_get_support();
- default:
- return PAL_STATUS_UNSUPPORTED_FUNC;
- }
-
- return PAL_STATUS_UNSUPPORTED_FUNC;
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.h
deleted file mode 100644
index a338cdf..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/nspe/protected_storage/pal_protected_storage_intf.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_PROTECTED_STORAGE_INTF_H_
-#define _PAL_PROTECTED_STORAGE_INTF_H_
-
-#include "pal_common.h"
-
-enum ps_function_code {
- PAL_PS_SET = 0x1,
- PAL_PS_GET = 0x2,
- PAL_PS_GET_INFO = 0x3,
- PAL_PS_REMOVE = 0x4,
- PAL_PS_CREATE = 0x5,
- PAL_PS_SET_EXTENDED = 0x6,
- PAL_PS_GET_SUPPORT = 0x7,
-};
-
-uint32_t pal_ps_function(int type, va_list valist);
-#endif /* _PAL_PROTECTED_STORAGE_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/spe/pal_driver_intf.c b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/spe/pal_driver_intf.c
deleted file mode 100644
index fd30783..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/spe/pal_driver_intf.c
+++ /dev/null
@@ -1,132 +0,0 @@
- /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 "pal_driver_intf.h"
-
-/**
- @brief - This function initializes the UART
- @param - uart base addr
- @return - void
-**/
-void pal_uart_init(uint32_t uart_base_addr)
-{
- pal_uart_cmsdk_init(uart_base_addr);
-}
-
-/**
- @brief - This function parses the input string and writes bytes into UART TX FIFO
- @param - str : Input String
- - data : Value for format specifier
-**/
-
-void pal_print(char *str, int32_t data)
-{
- pal_cmsdk_print(str,data);
-
-}
-
-
-/**
- @brief - Writes into given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - 1/0
-**/
-int pal_nvmem_write(addr_t base, uint32_t offset, void *buffer, int size)
-{
- return nvmem_write(base, offset, buffer, size);
-}
-
-/**
- @brief - Reads from given non-volatile address.
- @param - base : Base address of nvmem
- offset : Offset
- buffer : Pointer to source address
- size : Number of bytes
- @return - 1/0
-**/
-int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size)
-{
- return nvmem_read(base, offset, buffer, size);
-}
-
-
-/**
- @brief - Initializes an hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- - time_us : Time in micro seconds
- - timer_tick_us : Number of ticks per micro second
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
-{
- return(pal_wd_cmsdk_init(base_addr,time_us, timer_tick_us));
-
-}
-
-/**
- @brief - Enables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_enable(addr_t base_addr)
-{
- return(pal_wd_cmsdk_enable(base_addr));
-}
-
-/**
- @brief - Disables a hardware watchdog timer
- @param - base_addr : Base address of the watchdog module
- @return - SUCCESS/FAILURE
-**/
-int pal_wd_timer_disable(addr_t base_addr)
-{
- return (pal_wd_cmsdk_disable(base_addr));
-}
-
-/**
- @brief - Checks whether hardware watchdog timer is enabled
- @param - base_addr : Base address of the watchdog module
- @return - Enabled : 1, Disabled : 0
-**/
-int pal_wd_timer_is_enabled(addr_t base_addr)
-{
- return (pal_wd_cmsdk_is_enabled(base_addr));
-}
-
-/**
- @brief - Trigger interrupt for irq signal assigned to driver partition
- before return to caller.
- @param - void
- @return - void
-**/
-void pal_generate_interrupt(void)
-{
- pal_uart_cmsdk_generate_irq();
-}
-
-/**
- @brief - Disable interrupt that was generated using pal_generate_interrupt API.
- @param - void
- @return - void
-**/
-void pal_disable_interrupt(void)
-{
- pal_uart_cmsdk_disable_irq();
-}
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/spe/pal_driver_intf.h b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/spe/pal_driver_intf.h
deleted file mode 100644
index cef34ca..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/spe/pal_driver_intf.h
+++ /dev/null
@@ -1,35 +0,0 @@
- /** @file
- * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
- * 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 _PAL_DRIVER_INTF_H_
-#define _PAL_DRIVER_INTF_H_
-
-#include "pal_uart.h"
-#include "pal_nvmem.h"
-#include "pal_wd_cmsdk.h"
-
-void pal_uart_init(uint32_t uart_base_addr);
-void pal_print(char *str, int32_t data);
-int pal_nvmem_write(addr_t base, uint32_t offset, void *buffer, int size);
-int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size);
-int pal_wd_timer_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us);
-int pal_wd_timer_enable(addr_t base_addr);
-int pal_wd_timer_disable(addr_t base_addr);
-int pal_wd_timer_is_enabled(addr_t base_addr);
-void pal_generate_interrupt(void);
-void pal_disable_interrupt(void);
-#endif /* _PAL_DRIVER_INTF_H_ */
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/target.cfg b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/target.cfg
deleted file mode 100644
index 9a407b8..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/target.cfg
+++ /dev/null
@@ -1,84 +0,0 @@
-///** @file
-// * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-// * 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.
-//**/
-
-// UART device info
-uart.num=1;
-uart.0.base = 0x40004000;
-uart.0.size = 0xFFF;
-uart.0.intr_id = 0xFF;
-uart.0.permission = TYPE_READ_WRITE;
-
-// Watchdog device info
-watchdog.num = 1;
-watchdog.0.base = 0x40008000;
-watchdog.0.size = 0xFFF;
-watchdog.0.intr_id = 0xFF;
-watchdog.0.permission = TYPE_READ_WRITE;
-watchdog.0.num_of_tick_per_micro_sec = 0x3; //(sys_feq/1000000)
-watchdog.0.timeout_in_micro_sec_low = 0xF4240; //1.0 sec : 1 * 1000 * 1000
-watchdog.0.timeout_in_micro_sec_medium = 0x1E8480; //2.0 sec : 2 * 1000 * 1000
-watchdog.0.timeout_in_micro_sec_high = 0x4C4B40; //5.0 sec : 5 * 1000 * 1000
-watchdog.0.timeout_in_micro_sec_crypto = 0x1312D00; //18.0 sec : 18 * 1000 * 1000
-
-// Range of 1KB Non-volatile memory to preserve data over reset. Ex, NVRAM and FLASH
-nvmem.num =1;
-nvmem.0.start = 0x2002F000;
-nvmem.0.end = 0x2002F3FF;
-nvmem.0.permission = TYPE_READ_WRITE;
-
-// Miscellaneous - Test scatter info
-dut.num = 1;
-
-// Start address of 12KB NS memory for test ELF
-dut.0.ns_test_addr = 0x2007F000;
-
-// Start address of combine_test_binary in memory. Memory can be main memory or secondary memory.
-// Size of combine_test_binary = Summation of size of each test ELF file.
-dut.0.ns_start_addr_of_combine_test_binary = 0x2003F000;
-
-// Is combine_test_binary available in RAM?
-dut.0.combine_test_binary_in_ram = AVAILABLE;
-
-
-// ###################################################################
-// Following Target configuration parameters are required for IPC tests
-// only. Avoid updating them if you are running dev_apis.
-// ###################################################################
-
-// Level of Isolation
-dut.0.implemented_psa_firmware_isolation_level = LEVEL1;
-
-// Are dynamic memory allocation functions available to secure partition?
-dut.0.sp_heap_mem_supp = AVAILABLE;
-
-// Assign free memory range for isolation testing. Choose the addresses
-// for these memory regions such that it follows below condition:
-// nspe_mmio.0.start < server_partition_mmio.0.start < driver_partition_mmio.0.start.
-nspe_mmio.num=1;
-nspe_mmio.0.start = 0x200AF000;
-nspe_mmio.0.end = 0x200AF01F;
-nspe_mmio.0.permission = TYPE_READ_WRITE;
-
-server_partition_mmio.num=1;
-server_partition_mmio.0.start = 0x200AF020;
-server_partition_mmio.0.end = 0x200AF03F;
-server_partition_mmio.0.permission = TYPE_READ_WRITE;
-
-driver_partition_mmio.num=1;
-driver_partition_mmio.0.start = 0x200AF040;
-driver_partition_mmio.0.end = 0x200AF05F;
-driver_partition_mmio.0.permission = TYPE_READ_WRITE;
diff --git a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/target.cmake b/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/target.cmake
deleted file mode 100644
index db9a4fa..0000000
--- a/api-tests/platform/targets/tgt_ff_mbedos_fvp_mps2_m4/target.cmake
+++ /dev/null
@@ -1,105 +0,0 @@
-#/** @file
-# * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
-# * 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.
-#**/
-
-# PAL C source files part of NSPE library
-list(APPEND PAL_SRC_C_NSPE )
-
-# PAL ASM source files part of NSPE library
-list(APPEND PAL_SRC_ASM_NSPE )
-
-# PAL C source files part of SPE library - driver partition
-list(APPEND PAL_SRC_C_DRIVER_SP )
-
-# PAL ASM source files part of SPE library - driver partition
-list(APPEND PAL_SRC_ASM_DRIVER_SP )
-
-
-# Listing all the sources required for given target
-if(${SUITE} STREQUAL "IPC")
- list(APPEND PAL_SRC_C_NSPE
- # driver functionalities are implemented as RoT-services
- # and secure and non-secure clients will call to these RoT-services to get appropriate driver services.
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_client_api_intf.c
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_driver_ipc_intf.c
- )
- list(APPEND PAL_SRC_C_DRIVER_SP
- # Driver files will be compiled as part of driver partition
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/spe/pal_driver_intf.c
- ${PSA_ROOT_DIR}/platform/drivers/nvmem/pal_nvmem.c
- ${PSA_ROOT_DIR}/platform/drivers/uart/cmsdk/pal_uart.c
- ${PSA_ROOT_DIR}/platform/drivers/watchdog/cmsdk/pal_wd_cmsdk.c
- )
-else()
- list(APPEND PAL_SRC_C_NSPE
- # driver files will be compiled as part of NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_client_api_empty_intf.c
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common/pal_driver_ns_intf.c
- ${PSA_ROOT_DIR}/platform/drivers/nvmem/pal_nvmem.c
- ${PSA_ROOT_DIR}/platform/drivers/uart/cmsdk/pal_uart.c
- ${PSA_ROOT_DIR}/platform/drivers/watchdog/cmsdk/pal_wd_cmsdk.c
- )
-endif()
-if(${SUITE} STREQUAL "CRYPTO")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto/pal_crypto_intf.c
- )
-endif()
-if(${SUITE} STREQUAL "PROTECTED_STORAGE")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/protected_storage/pal_protected_storage_intf.c
- )
-endif()
-if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
- )
-endif()
-if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
- list(APPEND PAL_SRC_C_NSPE
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/initial_attestation/pal_attestation_intf.c
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/initial_attestation/pal_attestation_crypto.c
- )
-endif()
-
-# Create NSPE library
-add_library(${PSA_TARGET_PAL_NSPE_LIB} STATIC ${PAL_SRC_C_NSPE} ${PAL_SRC_ASM_NSPE})
-
-# PSA Include directories
-foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
- target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE ${psa_inc_path})
-endforeach()
-
-list(APPEND PAL_DRIVER_INCLUDE_PATHS
- ${PSA_ROOT_DIR}/platform/drivers/nvmem
- ${PSA_ROOT_DIR}/platform/drivers/uart/cmsdk
- ${PSA_ROOT_DIR}/platform/drivers/watchdog/cmsdk
-)
-
-target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
- ${PAL_DRIVER_INCLUDE_PATHS}
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/common
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/crypto
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/protected_storage
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/internal_trusted_storage
- ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/initial_attestation
-)
-
-if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
-target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
- ${PSA_QCBOR_INCLUDE_PATH}
-)
-endif()