aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaef Coles <raef.coles@arm.com>2021-03-19 10:09:54 +0000
committerAnton Komlev <Anton.Komlev@arm.com>2021-03-22 12:02:08 +0100
commit4c03b8203c07d81ccda43acc911e6b187bcdd93d (patch)
tree7acc7021ba85ed872497758b42729fa6956e8da9
parent232df54e422b55fcbd7e165eaba01cb560d74bb7 (diff)
downloadtrusted-firmware-m-4c03b8203c07d81ccda43acc911e6b187bcdd93d.tar.gz
Platform: Remove duplicated files from psoc64
Remove duplicated default implementations from the psoc64 platform, and instead the ones in platform/common. Change-Id: I6ef9a94f595eefdea155f4e15e322c9f1231606a Signed-off-by: Raef Coles <raef.coles@arm.com>
-rw-r--r--platform/ext/target/cypress/psoc64/CMakeLists.txt1
-rw-r--r--platform/ext/target/cypress/psoc64/attest_hal.c36
-rw-r--r--platform/ext/target/cypress/psoc64/config.cmake2
-rw-r--r--platform/ext/target/cypress/psoc64/dummy_boot_seed.c53
-rw-r--r--platform/ext/target/cypress/psoc64/dummy_crypto_keys.c133
-rw-r--r--platform/ext/target/cypress/psoc64/dummy_device_id.c78
6 files changed, 0 insertions, 303 deletions
diff --git a/platform/ext/target/cypress/psoc64/CMakeLists.txt b/platform/ext/target/cypress/psoc64/CMakeLists.txt
index 82ab1f26b2..0110ccb26c 100644
--- a/platform/ext/target/cypress/psoc64/CMakeLists.txt
+++ b/platform/ext/target/cypress/psoc64/CMakeLists.txt
@@ -122,7 +122,6 @@ target_sources(platform_s
./driver_dap.c
./nv_counters.c
./services/src/tfm_platform_system.c
- ./dummy_crypto_keys.c
./Device/Source/device_definition.c
$<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/plat_test.c>
$<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/services/src/tfm_platform_system.c>
diff --git a/platform/ext/target/cypress/psoc64/attest_hal.c b/platform/ext/target/cypress/psoc64/attest_hal.c
deleted file mode 100644
index 97ca9a68ca..0000000000
--- a/platform/ext/target/cypress/psoc64/attest_hal.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "tfm_attest_hal.h"
-#include <stdint.h>
-
-/* Example verification service URL for initial attestation token */
-static const char verification_service_url[] = "www.trustedfirmware.org";
-
-/* Example profile definition document for initial attestation token */
-static const char attestation_profile_definition[] = "PSA_IOT_PROFILE_1";
-
-enum tfm_security_lifecycle_t tfm_attest_hal_get_security_lifecycle(void)
-{
- return TFM_SLC_SECURED;
-}
-
-const char *
-tfm_attest_hal_get_verification_service(uint32_t *size)
-{
- *size = sizeof(verification_service_url) - 1;
-
- return verification_service_url;
-}
-
-const char *
-tfm_attest_hal_get_profile_definition(uint32_t *size)
-{
- *size = sizeof(attestation_profile_definition) - 1;
-
- return attestation_profile_definition;
-}
diff --git a/platform/ext/target/cypress/psoc64/config.cmake b/platform/ext/target/cypress/psoc64/config.cmake
index b1d7532bbe..f8402014f3 100644
--- a/platform/ext/target/cypress/psoc64/config.cmake
+++ b/platform/ext/target/cypress/psoc64/config.cmake
@@ -16,9 +16,7 @@ set(TFM_NS_CLIENT_IDENTIFICATION OFF CACHE BOOL "Enable NS c
set(TFM_MULTI_CORE_TOPOLOGY ON CACHE BOOL "Whether to build for a dual-cpu architecture")
set(NUM_MAILBOX_QUEUE_SLOT 4 CACHE BOOL "Number of mailbox queue slots")
-set(PLATFORM_DUMMY_ATTEST_HAL FALSE CACHE BOOL "Use dummy attest hal implementation. Should not be used in production.")
set(PLATFORM_DUMMY_NV_COUNTERS FALSE CACHE BOOL "Use dummy nv counter implementation. Should not be used in production.")
-set(PLATFORM_DUMMY_CRYPTO_KEYS FALSE CACHE BOOL "Use dummy crypto keys. Should not be used in production.")
# Disable default PDL IPC configuration. Use Cy_Platform_Init() in
# in psoc6_system_init_cm4.c and psoc6_system_init_cm0p.c instead.
diff --git a/platform/ext/target/cypress/psoc64/dummy_boot_seed.c b/platform/ext/target/cypress/psoc64/dummy_boot_seed.c
deleted file mode 100644
index 2a70a6756d..0000000000
--- a/platform/ext/target/cypress/psoc64/dummy_boot_seed.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2018-2020 ARM Limited
- *
- * 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 "tfm_plat_boot_seed.h"
-
-/*!
- * \def BOOT_SEED
- *
- * \brief Fixed value for boot seed used for test.
- */
-#define BOOT_SEED 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, \
- 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, \
- 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, \
- 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF
-
-static const uint8_t boot_seed[BOOT_SEED_SIZE] = {BOOT_SEED};
-
-enum tfm_plat_err_t tfm_plat_get_boot_seed(uint32_t size, uint8_t *buf)
-{
- /* FixMe: - This getter function must be ported per target platform.
- * - Platform service shall provide an API to further interact this
- * getter function to retrieve the boot seed.
- */
-
- uint32_t i;
- uint8_t *p_dst = buf;
- const uint8_t *p_src = boot_seed;
-
- if (size != BOOT_SEED_SIZE) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- for (i = size; i > 0; i--) {
- *p_dst = *p_src;
- p_src++;
- p_dst++;
- }
-
- return TFM_PLAT_ERR_SUCCESS;
-}
diff --git a/platform/ext/target/cypress/psoc64/dummy_crypto_keys.c b/platform/ext/target/cypress/psoc64/dummy_crypto_keys.c
deleted file mode 100644
index 157ddca37a..0000000000
--- a/platform/ext/target/cypress/psoc64/dummy_crypto_keys.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2017-2020 ARM Limited
- *
- * 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 "tfm_plat_crypto_keys.h"
-#include <stddef.h>
-#include "psa/crypto_types.h"
-
-/* FIXME: Functions in this file should be implemented by platform vendor. For
- * the security of the storage system, it is critical to use a hardware unique
- * key. For the security of the attestation, it is critical to use a unique key
- * pair and keep the private key is secret.
- */
-
-#define TFM_KEY_LEN_BYTES 16
-
-static const uint8_t sample_tfm_key[TFM_KEY_LEN_BYTES] =
- {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
-
-extern const psa_ecc_family_t initial_attestation_curve_type;
-extern const uint8_t initial_attestation_private_key[];
-extern const uint32_t initial_attestation_private_key_size;
-
-extern const struct tfm_plat_rotpk_t device_rotpk[];
-extern const uint32_t rotpk_key_cnt;
-
-/**
- * \brief Copy the key to the destination buffer
- *
- * \param[out] p_dst Pointer to buffer where to store the key
- * \param[in] p_src Pointer to the key
- * \param[in] size Length of the key
- */
-static inline void copy_key(uint8_t *p_dst, const uint8_t *p_src, size_t size)
-{
- uint32_t i;
-
- for (i = size; i > 0; i--) {
- *p_dst = *p_src;
- p_src++;
- p_dst++;
- }
-}
-
-enum tfm_plat_err_t tfm_plat_get_huk_derived_key(const uint8_t *label,
- size_t label_size,
- const uint8_t *context,
- size_t context_size,
- uint8_t *key,
- size_t key_size)
-{
- (void)label;
- (void)label_size;
- (void)context;
- (void)context_size;
-
- if (key_size > TFM_KEY_LEN_BYTES) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- /* FIXME: Do key derivation */
- copy_key(key, sample_tfm_key, key_size);
-
- return TFM_PLAT_ERR_SUCCESS;
-}
-
-enum tfm_plat_err_t
-tfm_plat_get_initial_attest_key(uint8_t *key_buf,
- uint32_t size,
- struct ecc_key_t *ecc_key,
- psa_ecc_family_t *curve_type)
-{
- uint8_t *key_dst;
- const uint8_t *key_src;
- uint32_t key_size;
- uint32_t full_key_size = initial_attestation_private_key_size;
-
- if (size < full_key_size) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- /* Set the EC curve type which the key belongs to */
- *curve_type = initial_attestation_curve_type;
-
- /* Copy the private key to the buffer, it MUST be present */
- key_dst = key_buf;
- key_src = initial_attestation_private_key;
- key_size = initial_attestation_private_key_size;
- copy_key(key_dst, key_src, key_size);
- ecc_key->priv_key = key_dst;
- ecc_key->priv_key_size = key_size;
-
- ecc_key->pubx_key = NULL;
- ecc_key->pubx_key_size = 0;
- ecc_key->puby_key = NULL;
- ecc_key->puby_key_size = 0;
-
- return TFM_PLAT_ERR_SUCCESS;
-}
-
-#ifdef BL2
-enum tfm_plat_err_t
-tfm_plat_get_rotpk_hash(uint8_t image_id,
- uint8_t *rotpk_hash,
- uint32_t *rotpk_hash_size)
-{
- if(*rotpk_hash_size < ROTPK_HASH_LEN) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- if (image_id >= rotpk_key_cnt) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- *rotpk_hash_size = ROTPK_HASH_LEN;
- copy_key(rotpk_hash, device_rotpk[image_id].key_hash, *rotpk_hash_size);
-
- return TFM_PLAT_ERR_SUCCESS;
-}
-#endif
diff --git a/platform/ext/target/cypress/psoc64/dummy_device_id.c b/platform/ext/target/cypress/psoc64/dummy_device_id.c
deleted file mode 100644
index 65452f8b90..0000000000
--- a/platform/ext/target/cypress/psoc64/dummy_device_id.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2018-2020 ARM Limited
- *
- * 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 "tfm_plat_device_id.h"
-#include <stddef.h>
-/*
- * NOTE: Functions in this file must be ported per target platform.
- */
-
-static const uint8_t implementation_id[] = {
- 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
-};
-
-static const uint8_t example_ean_13[] = "060456527282910010";
-/**
- * \brief Copy the device specific ID to the destination buffer
- *
- * \param[out] p_dst Pointer to buffer where to store ID
- * \param[in] p_src Pointer to the ID
- * \param[in] size Length of the ID
- */
-static inline void copy_id(uint8_t *p_dst, const uint8_t *p_src, size_t size)
-{
- uint32_t i;
-
- for (i = size; i > 0; i--) {
- *p_dst = *p_src;
- p_src++;
- p_dst++;
- }
-}
-
-enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size,
- uint8_t *buf)
-{
- const uint8_t *p_impl_id = implementation_id;
- uint32_t impl_id_size = sizeof(implementation_id);
-
- if (*size < impl_id_size) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- copy_id(buf, p_impl_id, impl_id_size);
- *size = impl_id_size;
-
- return TFM_PLAT_ERR_SUCCESS;
-}
-
-enum tfm_plat_err_t tfm_plat_get_hw_version(uint32_t *size, uint8_t *buf)
-{
- const uint8_t *p_hw_version = example_ean_13;
- uint32_t hw_version_size = sizeof(example_ean_13) - 1;
-
- if (*size < hw_version_size) {
- return TFM_PLAT_ERR_SYSTEM_ERR;
- }
-
- copy_id(buf, p_hw_version, hw_version_size);
- *size = hw_version_size;
-
- return TFM_PLAT_ERR_SUCCESS;
-}