diff options
| author | Michal Hanus <mikehanus@protonmail.com> | 2025-04-19 22:50:44 +0200 |
|---|---|---|
| committer | Michal Hanus <mikehanus@protonmail.com> | 2025-04-19 22:50:44 +0200 |
| commit | 9078b7ec09b135f091cb951ed234bf013c9c838e (patch) | |
| tree | ba953e144c2dd42d327a83720cdfc9fb5bb9fe34 /nrfdemo/builddk/tfm/api_ns/platform/include | |
| parent | 2e13c372f1419f08dab7797b244681f889dd9bcf (diff) | |
bme680 added
Diffstat (limited to 'nrfdemo/builddk/tfm/api_ns/platform/include')
29 files changed, 0 insertions, 2678 deletions
diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/boot_hal.h b/nrfdemo/builddk/tfm/api_ns/platform/include/boot_hal.h deleted file mode 100644 index 0238241..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/boot_hal.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2019-2023, Arm Limited. All rights reserved. - * Copyright (c) 2020 STMicroelectronics. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __BOOT_HAL_H__ -#define __BOOT_HAL_H__ - -#include <stdint.h> -#include <stddef.h> -#include <stdbool.h> -#include "cmsis_compiler.h" - -/* Include header section */ - -#ifdef __cplusplus -extern "C" { -#endif - -struct boot_arm_vector_table { - uint32_t msp; - uint32_t reset; -}; - -/* - * \brief It clears that part of the RAM which was used by MCUBoot, expect the - * TFM_SHARED_DATA area, which is used to pass data to the TF-M runtime. - * - * \note This function must be implemented per target platform by system - * integrator. If the bootloader has not loaded any secret to the shared - * RAM then this function can immediately return to shorten the boot-up - * time. Clearing RAM area can be done several way, it is platform - * dependent: - * - Overwritten with a pre-defined constant value (i.e.: 0). - * - Overwritten with a random value. - * - Change the secret if its location is known. - * - Set a register which can hide some part of the flash/RAM against - * next stage software components. - * - Etc. - */ -void boot_clear_ram_area(void); - -/* - * \brief Chain-loading the next image in the boot sequence. - * Can be overridden for platform specific initialization. - * \param[in] reset_handler_addr Address of next image's Reset_Handler() in - the boot chain (TF-M SPE, etc.) - */ -void boot_jump_to_next_image(uint32_t reset_handler_addr) __NO_RETURN; - -/** - * \brief Platform peripherals and devices initialization. - * Can be overridden for platform specific initialization. - * - * \return Returns 0 on success, non-zero otherwise - */ -int32_t boot_platform_init(void); - -/** - * \brief Perform later platform specific initialization. Runs at the end of the - * boot initialization phase, for platform-specific code that depends on - * other initialization code being run beforehand. - * - * \return Returns 0 on success, non-zero otherwise - */ -int32_t boot_platform_post_init(void); - -/** - * \brief Platform operation to start secure image. - * Can be overridden for platform specific initialization. - * - * \param[in] vt pointer to secure application vector table descriptor - */ -void boot_platform_quit(struct boot_arm_vector_table *vt) __NO_RETURN; - -/** - * \brief Platform operation to perform steps required before image load. - * Can be overridden for platform specific initialization. - * - * \param[in] image_id The ID of the image that is about to be loaded. - * - * \return Returns 0 on success, non-zero otherwise - */ -int boot_platform_pre_load(uint32_t image_id); - -/** - * \brief Platform operation to perform steps required after image load. - * Can be overridden for platform specific initialization. - * - * \param[in] image_id The ID of the image that has just been loaded. - * - * \return Returns 0 on success, non-zero otherwise - */ -int boot_platform_post_load(uint32_t image_id); - -/** - * Version of a SW component, to be encoded as "major.minor.revision+build_num". - */ -struct boot_measurement_version { - uint8_t major; - uint8_t minor; - uint16_t revision; - uint32_t build_num; -}; - -struct boot_measurement_metadata { - uint32_t measurement_type; /* Identifier of the measurement method - * used to compute the measurement value. - */ - uint8_t signer_id[64]; /* Signer identity (hash of public key). */ - size_t signer_id_size; /* Size of the signer's ID in bytes. */ - char sw_type[10]; /* Representing the role of the SW component. */ - struct boot_measurement_version sw_version; /* Version of the SW component */ -}; - -/** - * \brief Stores single boot measurement and associated metadata in a - * non-persistent storage to a known location. - * - * \note The measurement values and associated metadata are stored at a known - * location where they can be accessed later at runtime from secure - * software. - * - * \param[in] index In which measurement slot to store, - * the largest allowed index is 63 (0x3F). - * \param[in] measurement Pointer to buffer that stores the - * measurement value. - * \param[in] measurement_size Size of the measurement value in bytes. - * \param[in] metadata Pointer to a structure, containing the - * associated metadata. - * \param[in] lock_measurement If true, it locks the measurement slot and - * it is not allowed the extend it anymore with - * additional measurement values. - * - * \return Returns 0 on success, non-zero otherwise. - */ -int boot_store_measurement(uint8_t index, - const uint8_t *measurement, - size_t measurement_size, - const struct boot_measurement_metadata *metadata, - bool lock_measurement); - -#ifdef __cplusplus -} -#endif - -#endif /* __BOOT_HAL_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/cmsis_override.h b/nrfdemo/builddk/tfm/api_ns/platform/include/cmsis_override.h deleted file mode 100644 index 3901e85..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/cmsis_override.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __CMSIS_OVERRIDE_H__ -#define __CMSIS_OVERRIDE_H__ - -#if defined(__GNUC__) - -#define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit -#define __STACK_LIMIT Image$$ARM_LIB_STACK$$ZI$$Base - -#elif defined(__ICCARM__) - -#define __INITIAL_SP ARM_LIB_STACK$$Limit -#define __STACK_LIMIT ARM_LIB_STACK$$Base - -#endif - -#endif /* __CMSIS_OVERRIDE_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/exception_info.h b/nrfdemo/builddk/tfm/api_ns/platform/include/exception_info.h deleted file mode 100644 index 9502008..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/exception_info.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2021, Nordic Semiconductor ASA. All rights reserved. - * Copyright (c) 2023, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __EXCEPTION_INFO_H__ -#define __EXCEPTION_INFO_H__ - -#include <stdint.h> - -#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) -#define TRUSTZONE_PRESENT -#endif - -#if defined(__ARM_ARCH_8_1M_MAIN__) || defined(__ARM_ARCH_8M_MAIN__) \ - || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) -#define FAULT_STATUS_PRESENT -#endif - -/* Exception type number (subtract 16 for IRQn) */ -#define EXCEPTION_TYPE_HARDFAULT 3 -#define EXCEPTION_TYPE_MEMMANAGEFAULT 4 -#define EXCEPTION_TYPE_BUSFAULT 5 -#define EXCEPTION_TYPE_USAGEFAULT 6 -#define EXCEPTION_TYPE_SECUREFAULT 7 - -/* Store context for an exception, and print an error message with the context. - * - * @param[in] exception_type One of the EXCEPTION_TYPE_* values defined above. Any - * other value will result in printing "Unknown". - */ -#ifdef TFM_EXCEPTION_INFO_DUMP - -struct exception_info_t { - uint32_t VECTACTIVE; /* Active exception number. */ - uint32_t EXC_RETURN; /* EXC_RETURN value in LR. */ - uint32_t MSP; /* (Secure) MSP. */ - uint32_t PSP; /* (Secure) PSP. */ - uint32_t *EXC_FRAME; /* Exception frame on stack. */ - uint32_t EXC_FRAME_COPY[8]; /* Copy of the basic exception frame. */ - uint32_t CALLEE_SAVED_COPY[8]; /* Copy of the callee saved registers. */ - uint32_t xPSR; /* Program Status Registers. */ - -#ifdef FAULT_STATUS_PRESENT - uint32_t CFSR; /* Configurable Fault Status Register. */ - uint32_t HFSR; /* Hard Fault Status Register. */ - uint32_t BFAR; /* Bus Fault address register. */ - uint32_t BFARVALID; /* Whether BFAR contains a valid address. */ - uint32_t MMFAR; /* MemManage Fault address register. */ - uint32_t MMARVALID; /* Whether MMFAR contains a valid address. */ -#ifdef TRUSTZONE_PRESENT - uint32_t SFSR; /* SecureFault Status Register. */ - uint32_t SFAR; /* SecureFault Address Register. */ - uint32_t SFARVALID; /* Whether SFAR contains a valid address. */ -#endif -#endif -}; - -/** - * \brief Get a pointer to the current exception_info_t context - * - * \return A pointer to the exception_info_t context or NULL if no context - * has been stored - */ -void tfm_exception_info_get_context(struct exception_info_t *ctx); - -/* Store context for an exception, then print the info. - * Call EXCEPTION_INFO() instead of calling this directly. - */ -void store_and_dump_context(uint32_t MSP_in, uint32_t PSP_in, uint32_t LR_in, - uint32_t *callee_saved); - -/* IAR Specific */ -#if defined(__ICCARM__) -#pragma required = store_and_dump_context -#endif - -#if defined(__ARM_ARCH_8M_BASE__) || defined(__ARCM_ARCH_V6_M__) -#define EXCEPTION_INFO() \ - __ASM volatile( \ - "MRS R0, MSP\n" \ - "MRS R1, PSP\n" \ - "MOV R2, R11\n" \ - "MOV R3, R10\n" \ - "PUSH {R2, R3}\n" \ - "MOV R2, R9\n" \ - "MOV R3, R8\n" \ - "PUSH {R2, R3}\n" \ - "PUSH {R4-R7}\n" \ - "MOV R3, SP\n" \ - "MOV R2, LR\n" \ - "BL store_and_dump_context\n" \ - "ADD SP, #32\n" \ - ) -#elif defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8_1M_MAIN__) || \ - defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) -#define EXCEPTION_INFO() \ - __ASM volatile( \ - "MRS R0, MSP\n" \ - "MRS R1, PSP\n" \ - "PUSH {R4-R11}\n" \ - "MOV R3, SP\n" \ - "MOV R2, LR\n" \ - "BL store_and_dump_context\n" \ - "ADD SP, #32\n" \ - ) -#else -/* Unhandled arch, call store_and_dump_context with callee_saved = NULL */ -#define EXCEPTION_INFO() \ - __ASM volatile( \ - "MRS R0, MSP\n" \ - "MRS R1, PSP\n" \ - "MOV R2, LR\n" \ - "MOV R3, #0\n" \ - "BL store_and_dump_context\n" \ - ) -#endif - -#else /* TFM_EXCEPTION_INFO_DUMP */ -#define EXCEPTION_INFO() -#endif /* TFM_EXCEPTION_INFO_DUMP */ - -#endif /* __EXCEPTION_INFO_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/fih.h b/nrfdemo/builddk/tfm/api_ns/platform/include/fih.h deleted file mode 100644 index fcb604b..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/fih.h +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (c) 2020-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_FIH_H__ -#define __TFM_FIH_H__ - -#include <stddef.h> -#include <stdint.h> - -/* - * Fault injection mitigation library. - * - * Has support for different measures, which can either be enabled/disabled - * separately or by defining one of the TFM_FIH_PROFILEs. - * - * NOTE: It is not guaranteed that these constructs against fault injection - * attacks can be preserved in all compilers. - * - * FIH_ENABLE_DOUBLE_VARS makes critical variables into a tuple (x, x ^ msk). - * Then the correctness of x can be checked by XORing the two tuple values - * together. This also means that comparisons between fih_ints can be verified - * by doing x == y && x_msk == y_msk. - * - * FIH_ENABLE_GLOBAL_FAIL makes all while(1) failure loops redirect to a global - * failure loop. This loop has mitigations against loop escapes / unlooping. - * This also means that any unlooping won't immediately continue executing the - * function that was executing before the failure. - * - * FIH_ENABLE_CFI (Control Flow Integrity) creates a global counter that is - * incremented before every FIH_CALL of vulnerable functions. On the function - * return the counter is decremented, and after the return it is verified that - * the counter has the same value as before this process. This can be used to - * verify that the function has actually been called. This protection is - * intended to discover that important functions are called in an expected - * sequence and none of them is missed due to an instruction skip which could - * be a result of glitching attack. It does not provide protection against ROP - * or JOP attacks. - * - * FIH_ENABLE_DELAY causes random delays. This makes it hard to cause faults - * precisely. It requires an RNG. A simple example using SysTick as entropy - * source is provided in tfm_fih_rng.h, but any RNG that has an entropy - * source can be used by implementing the fih_delay_random function. - * - * The basic call pattern is: - * - * fih_int fih_rc = FIH_FAILURE; - * FIH_CALL(vulnerable_function, fih_rc, arg1, arg2); - * if (fih_not_eq(fih_rc, FIH_SUCCESS)) { - * error_handling(); - * } - * - * If a fault injection is detected, call FIH_PANIC to trap the execution. - * - * Note that any function called by FIH_CALL must only return using FIH_RET, - * as otherwise the CFI counter will not be decremented and the CFI check will - * fail causing a panic. - */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#undef FIH_ENABLE_GLOBAL_FAIL -#undef FIH_ENABLE_CFI -#undef FIH_ENABLE_DOUBLE_VARS -#undef FIH_ENABLE_DELAY - -#ifdef TFM_FIH_PROFILE_ON -#if defined(TFM_FIH_PROFILE_LOW) -#define FIH_ENABLE_GLOBAL_FAIL -#define FIH_ENABLE_CFI - -#elif defined(TFM_FIH_PROFILE_MEDIUM) -#define FIH_ENABLE_DOUBLE_VARS -#define FIH_ENABLE_GLOBAL_FAIL -#define FIH_ENABLE_CFI - -#elif defined(TFM_FIH_PROFILE_HIGH) -#define FIH_ENABLE_DELAY /* Requires an hardware entropy source */ -#define FIH_ENABLE_DOUBLE_VARS -#define FIH_ENABLE_GLOBAL_FAIL -#define FIH_ENABLE_CFI - -#else -#error "Invalid FIH Profile configuration" -#endif /* TFM_FIH_PROFILE */ - -#define FIH_TRUE 0xC35A -#define FIH_FALSE 0x0 - -#ifdef FIH_ENABLE_DOUBLE_VARS -#define FIH_POSITIVE_VALUE 0x5555AAAA -#define FIH_NEGATIVE_VALUE 0xAAAA5555 - -/* - * A volatile mask is used to prevent compiler optimization - the mask is xored - * with the variable to create the backup and the integrity can be checked with - * another xor. The mask value doesn't _really_ matter that much, as long as - * it has reasonably high hamming weight. - */ -#define _FIH_MASK_VALUE 0xA5C35A3C - -/* - * All ints are replaced with two int - the normal one and a backup which is - * XORed with the mask. - */ -typedef volatile struct { - volatile int32_t val; - volatile int32_t msk; -} fih_int; - -#define FIH_INT_INIT(x) {(x), (x) ^ _FIH_MASK_VALUE} -#else /* FIH_ENABLE_DOUBLE_VARS */ -#define FIH_POSITIVE_VALUE 0x0 -#define FIH_NEGATIVE_VALUE 0xAAAA5555 - -typedef volatile int32_t fih_int; - -#define FIH_INT_INIT(x) (x) -#endif /* FIH_ENABLE_DOUBLE_VARS */ - -extern fih_int FIH_SUCCESS; -extern fih_int FIH_FAILURE; - -#ifdef FIH_ENABLE_GLOBAL_FAIL -/* - * Global failure handler - more resistant to unlooping. noinline and used are - * used to prevent optimization. - * - * NOTE - * This failure handler shall be used as FIH specific error handling to capture - * FI attacks. Error handling in SPM and SP should be enhanced respectively. - */ -__attribute__((noinline)) __attribute__((used)) void fih_panic_loop(void); -#define FIH_PANIC fih_panic_loop() -#else /* FIH_ENABLE_GLOBAL_FAIL */ -#define FIH_PANIC \ - do { \ - FIH_LABEL("FAILURE_LOOP"); \ - while (1) {} \ - } while (0) -#endif /* FIH_ENABLE_GLOBAL_FAIL */ - -/* - * NOTE - * For functions to be inlined outside their compilation unit they have to - * have the body in the header file. This is required as function calls are easy - * to skip. - */ -#ifdef FIH_ENABLE_DELAY -/** - * @brief Set up the RNG for use with random delays. Called once at startup. - */ -void fih_delay_init(void); - -/** - * Get a random uint8_t value from an RNG seeded with an entropy source. - * - * NOTE - * Do not directly call this function. - */ -uint8_t fih_delay_random(void); - -/* Delaying logic, with randomness from a CSPRNG */ -__attribute__((always_inline)) inline -void fih_delay(void) -{ - uint32_t i = 0; - volatile uint32_t delay = FIH_NEGATIVE_VALUE; - volatile uint32_t counter = 0; - - delay = fih_delay_random(); - - if (delay == FIH_NEGATIVE_VALUE) { - FIH_PANIC; - } - - delay &= 0xFF; - - for (i = 0; i < delay; i++) { - counter++; - } - - if (counter != delay) { - FIH_PANIC; - } -} -#else /* FIH_ENABLE_DELAY */ -#define fih_delay_init() - -#define fih_delay() -#endif /* FIH_ENABLE_DELAY */ - -#ifdef FIH_ENABLE_DOUBLE_VARS -__attribute__((always_inline)) inline -void fih_int_validate(fih_int x) -{ - if (x.val != (x.msk ^ _FIH_MASK_VALUE)) { - FIH_PANIC; - } -} - -/* Convert a fih_int to an int. Validate for tampering. */ -__attribute__((always_inline)) inline -int32_t fih_int_decode(fih_int x) -{ - fih_int_validate(x); - return x.val; -} - -/* Convert an int to a fih_int, can be used to encode specific error codes. */ -__attribute__((always_inline)) inline -fih_int fih_int_encode(int32_t x) -{ - fih_int ret = {x, x ^ _FIH_MASK_VALUE}; - return ret; -} - -/* Standard equality. If A == B then 1, else 0 */ -__attribute__((always_inline)) inline -int32_t fih_eq(fih_int x, fih_int y) -{ - volatile int32_t rc1 = FIH_FALSE; - volatile int32_t rc2 = FIH_FALSE; - - fih_int_validate(x); - fih_int_validate(y); - - if (x.val == y.val) { - rc1 = FIH_TRUE; - } - - fih_delay(); - - if (x.msk == y.msk) { - rc2 = FIH_TRUE; - } - - fih_delay(); - - if (rc1 != rc2) { - FIH_PANIC; - } - - return rc1; -} - -__attribute__((always_inline)) inline -int32_t fih_not_eq(fih_int x, fih_int y) -{ - volatile int32_t rc1 = FIH_FALSE; - volatile int32_t rc2 = FIH_FALSE; - - fih_int_validate(x); - fih_int_validate(y); - - if (x.val != y.val) { - rc1 = FIH_TRUE; - } - - fih_delay(); - - if (x.msk != y.msk) { - rc2 = FIH_TRUE; - } - - fih_delay(); - - if (rc1 != rc2) { - FIH_PANIC; - } - - return rc1; -} -#else /* FIH_ENABLE_DOUBLE_VARS */ -/* NOOP */ -#define fih_int_validate(x) - -/* NOOP */ -#define fih_int_decode(x) (x) - -/* NOOP */ -#define fih_int_encode(x) (x) - -__attribute__((always_inline)) inline -int32_t fih_eq(fih_int x, fih_int y) -{ - volatile int32_t rc = FIH_FALSE; - - if (x == y) { - rc = FIH_TRUE; - } - - fih_delay(); - - if (x != y) { - rc = FIH_FALSE; - } - - return rc; -} - -__attribute__((always_inline)) inline -int32_t fih_not_eq(fih_int x, fih_int y) -{ - volatile int32_t rc = FIH_FALSE; - - if (x != y) { - rc = FIH_TRUE; - } - - fih_delay(); - - if (x == y) { - rc = FIH_FALSE; - } - - return rc; -} -#endif /* FIH_ENABLE_DOUBLE_VARS */ - -/* - * C has a common return pattern where 0 is a correct value and all others are - * errors. This function converts 0 to FIH_SUCCESS and any other number to a - * value that is not FIH_SUCCESS - */ -__attribute__((always_inline)) inline -fih_int fih_int_encode_zero_equality(int32_t x) -{ - if (x) { - return FIH_FAILURE; - } else { - return FIH_SUCCESS; - } -} - -#ifdef FIH_ENABLE_CFI -/* Global Control Flow Integrity counter */ -extern fih_int _fih_cfi_ctr; - -/* - * Increment the CFI counter by input counter and return the value before the - * increment. - * - * NOTE - * This function shall not be called directly. - */ -fih_int fih_cfi_get_and_increment(uint8_t cnt); - -/* - * Validate that the saved precall value is the same as the value of the global - * counter. For this to be the case, a fih_ret must have been called between - * these functions being executed. If the values aren't the same then panic. - * - * NOTE - * This function shall not be called directly. - */ -void fih_cfi_validate(fih_int saved); - -/* - * Decrement the global CFI counter by one, so that it has the same value as - * before the cfi_precall. - * - * NOTE - * This function shall not be called directly. - */ -void fih_cfi_decrement(void); - -/* - * Macro wrappers for functions - Even when the functions have zero body this - * saves a few bytes on noop functions as it doesn't generate the call/ret - * - * CFI precall function saves the CFI counter and then increments it - the - * postcall then checks if the counter is equal to the saved value. In order for - * this to be the case a FIH_RET must have been performed inside the called - * function in order to decrement the counter, so the function must have been - * called. - */ -#define FIH_CFI_PRECALL_BLOCK \ - fih_int _fih_cfi_precall_saved_value = fih_cfi_get_and_increment(1) - -#define FIH_CFI_POSTCALL_BLOCK \ - fih_cfi_validate(_fih_cfi_precall_saved_value) - -#define FIH_CFI_PRERET \ - fih_cfi_decrement() - -/* - * Marcos to support protect the control flow integrity inside a function. - * - * The FIH_CFI_PRECALL_BLOCK/FIH_CFI_POSTCALL_BLOCK pair mainly protect function - * calls from fault injection. Fault injection may attack a function to skip its - * critical steps which are not function calls. It is difficult for the caller - * to dectect the injection as long as the function successfully returns. - * - * The following macros can be called in a function to track the critical steps, - * especially those which are not function calls. - */ -/* - * FIH_CFI_STEP_INIT() saves the CFI counter and increase the CFI counter by the - * number of the critical steps. It should be called before execution starts. - */ -#define FIH_CFI_STEP_INIT(x) \ - fih_int _fih_cfi_step_saved_value = fih_cfi_get_and_increment(x) - -/* - * FIH_CFI_STEP_DECREMENT() decrease the CFI counter by one. It can be called - * after each critical step execution completes. - */ -#define FIH_CFI_STEP_DECREMENT() \ - fih_cfi_decrement() - -/* - * FIH_CFI_STEP_ERR_RESET() resets the CFI counter to the previous value saved - * by FIH_CFI_STEP_INIT(). It shall be called only when a functionality error - * occurs and forces the function to exit. It can enable the caller to capture - * the functionality error other than being trapped in fault injection error - * handling. - */ -#define FIH_CFI_STEP_ERR_RESET() \ - do { \ - _fih_cfi_ctr = _fih_cfi_step_saved_value; \ - fih_int_validate(_fih_cfi_ctr); \ - } while(0) - -#else /* FIH_ENABLE_CFI */ -#define FIH_CFI_PRECALL_BLOCK -#define FIH_CFI_POSTCALL_BLOCK -#define FIH_CFI_PRERET - -#define FIH_CFI_STEP_INIT(x) -#define FIH_CFI_STEP_DECREMENT() -#define FIH_CFI_STEP_ERR_RESET() -#endif /* FIH_ENABLE_CFI */ - -/* - * Label for interacting with FIH testing tool. Can be parsed from the elf file - * after compilation. Does not require debug symbols. - */ -#define FIH_LABEL(str) __asm volatile ("FIH_LABEL_" str "_0_%=:" ::) -#define FIH_LABEL_CRITICAL_POINT() FIH_LABEL("FIH_CRITICAL_POINT") - -/* - * Main FIH calling macro. return variable is second argument. Does some setup - * before and validation afterwards. Inserts labels for use with testing script. - * - * First perform the precall step - this gets the current value of the CFI - * counter and saves it to a local variable, and then increments the counter. - * - * Then set the return variable to FIH_FAILURE as a base case. - * - * Then perform the function call. As part of the function FIH_RET must be - * called which will decrement the counter. - * - * The postcall step gets the value of the counter and compares it to the - * previously saved value. If this is equal then the function call and all child - * function calls were performed. - */ -#define FIH_CALL(f, ret, ...) \ - do { \ - FIH_LABEL("FIH_CALL_START_" # f); \ - FIH_CFI_PRECALL_BLOCK; \ - ret = FIH_FAILURE; \ - fih_delay(); \ - ret = f(__VA_ARGS__); \ - FIH_CFI_POSTCALL_BLOCK; \ - fih_int_validate(ret); \ - FIH_LABEL("FIH_CALL_END"); \ - } while (0) - -/* - * FIH return changes the state of the internal state machine. If you do a - * FIH_CALL then you need to do a FIH_RET else the state machine will detect - * tampering and panic. - */ -#define FIH_RET(ret) \ - do { \ - FIH_CFI_PRERET; \ - return ret; \ - } while (0) - -/* - * FIH return type macro changes the function return types to fih_int. - * All functions that need to be protected by FIH and called via FIH_CALL must - * return a fih_int type. - */ -#define FIH_RET_TYPE(type) fih_int - -#else /* TFM_FIH_PROFILE_ON */ -typedef int32_t fih_int; - -#define FIH_INT_INIT(x) (x) - -#define FIH_SUCCESS 0 -#define FIH_FAILURE -1 - -#define fih_int_validate(x) - -#define fih_int_decode(x) (x) - -#define fih_int_encode(x) (x) - -#define fih_int_encode_zero_equality(x) ((x) == 0 ? 0 : 1) - -#define fih_eq(x, y) ((x) == (y)) - -#define fih_not_eq(x, y) ((x) != (y)) - -#define fih_delay_init() (0) -#define fih_delay() - -#define FIH_CALL(f, ret, ...) \ - do { \ - ret = f(__VA_ARGS__); \ - } while (0) - -#define FIH_RET(ret) \ - do { \ - return ret; \ - } while (0) - -#define FIH_RET_TYPE(type) type - -#define FIH_PANIC do { \ - while(1) {}; \ - } while (0) - -#define FIH_CFI_STEP_INIT(x) -#define FIH_CFI_STEP_DECREMENT() -#define FIH_CFI_STEP_ERR_RESET() - -#define FIH_LABEL_CRITICAL_POINT() - -#endif /* TFM_FIH_PROFILE_ON */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __TFM_FIH_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/mbedtls_entropy_nv_seed_config.h b/nrfdemo/builddk/tfm/api_ns/platform/include/mbedtls_entropy_nv_seed_config.h deleted file mode 100644 index 34258d7..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/mbedtls_entropy_nv_seed_config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ -#ifndef __MBEDTLS_ENTROPY_NV_SEED_CONF_H__ -#define __MBEDTLS_ENTROPY_NV_SEED_CONF_H__ - -#include "tfm_plat_crypto_nv_seed.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#undef MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES - -#define MBEDTLS_ENTROPY_NV_SEED -#ifndef MBEDTLS_PLATFORM_NV_SEED_READ_MACRO -#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO tfm_plat_crypto_nv_seed_read -#endif -#ifndef MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO -#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO tfm_plat_crypto_nv_seed_write -#endif - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __MBEDTLS_ENTROPY_NV_SEED_CONF_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/region.h b/nrfdemo/builddk/tfm/api_ns/platform/include/region.h deleted file mode 100644 index 4684ae9..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/region.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __REGION_H__ -#define __REGION_H__ - -#include <stdint.h> - -/* Macros to pick linker symbols */ -#define REGION(a, b, c) a##b##c -#define REGION_NAME(a, b, c) REGION(a, b, c) -#define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c) -#define REGION_DECLARE_T(a, b, c, t) extern t REGION_NAME(a, b, c) - -#ifdef __ICCARM__ -/* - * ARMCLANG - IAR linker compatibility - */ -#define Image$$ -#define Load$$LR$$ -#define $$ZI$$Base $$Base -#define $$ZI$$Limit $$Limit -#define $$RO$$Base $$Base -#define $$RO$$Limit $$Limit -#define $$RW$$Base $$Base -#define $$RW$$Limit $$Limit -#define _DATA$$RW$$Base _DATA$$Base -#define _DATA$$RW$$Limit _DATA$$Limit -#define _DATA$$ZI$$Base _DATA$$Base -#define _DATA$$ZI$$Limit _DATA$$Limit -#define _STACK$$ZI$$Base _STACK$$Base -#define _STACK$$ZI$$Limit _STACK$$Limit - -#endif /* __ICCARM__ */ - -#endif /* __REGION_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_attest_hal.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_attest_hal.h deleted file mode 100644 index 97b07d5..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_attest_hal.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2019-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_ATTEST_HAL_H__ -#define __TFM_ATTEST_HAL_H__ - -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Security lifecycle of the device - */ -enum tfm_security_lifecycle_t { - TFM_SLC_UNKNOWN = 0x0000u, - TFM_SLC_ASSEMBLY_AND_TEST = 0x1000u, - TFM_SLC_PSA_ROT_PROVISIONING = 0x2000u, - TFM_SLC_SECURED = 0x3000u, - TFM_SLC_NON_PSA_ROT_DEBUG = 0x4000u, - TFM_SLC_RECOVERABLE_PSA_ROT_DEBUG = 0x5000u, - TFM_SLC_DECOMMISSIONED = 0x6000u, - TFM_SLC_MAX_VALUE = UINT32_MAX, -}; - -/** - * \def VERIFICATION_URL_MAX_SIZE - * - * \brief Maximum size of verification URL in bytes - */ -#define VERIFICATION_URL_MAX_SIZE (32u) - -/** - * \def PROFILE_DEFINITION_MAX_SIZE - * - * \brief Maximum size of profile definition in bytes - */ -#define PROFILE_DEFINITION_MAX_SIZE (32u) - -/** - * \def PLATFORM_CONFIG_MAX_SIZE - * - * \brief Maximum size of the the platform configuration data. - */ -#define PLATFORM_CONFIG_MAX_SIZE (32u) - -/** - * \def PLATFORM_HASH_ALGO_ID_MAX_SIZE - * - * \brief Maximum size of the platform hash algorithm identifier string. - */ -#define PLATFORM_HASH_ALGO_ID_MAX_SIZE (32u) - -/** - * \brief Retrieve the security lifecycle of the device - * - * Security lifecycle is a mandatory claim in the initial attestation token. - * - * \return According to \ref tfm_security_lifecycle_t - */ -enum tfm_security_lifecycle_t tfm_attest_hal_get_security_lifecycle(void); - -/** - * \brief Retrieve the verification service indicator for initial attestation. - * - * It is used by relying party to locate a validation service for the token. - * It can be a text string that can be used to locate the service or can be a - * URL specifying the address of the service. - * - * \param[in/out] size As an input value it indicates the size of the caller - * allocated buffer (in bytes) to store the verification - * service indicator. At return its value is updated with - * the exact size of the verification service URL. - * \param[out] buf Pointer to the buffer to store the verification service - * URL. - * - * \return Returns error code specified in \ref tfm_plat_err_t - */ -enum tfm_plat_err_t -tfm_attest_hal_get_verification_service(uint32_t *size, uint8_t *buf); - -/** - * \brief Retrieve the name of the profile definition document for initial - * attestation. - * - * This document describes the 'profile' of the initial attestation token, - * being a full description of the claims, their usage, verification and - * token signing. - * - * \param[in/out] size As an input value it indicates the size of the caller - * allocated buffer (in bytes) to store the profile - * definition. At return its value is updated with the - * exact size of the profile definition. - * \param[out] buf Pointer to the buffer to store the profile definition. - * - * \return Returns error code specified in \ref tfm_plat_err_t - */ -enum tfm_plat_err_t -tfm_attest_hal_get_profile_definition(uint32_t *size, uint8_t *buf); - -/** - * \brief Retrieve the platform configuration data. - * - * The Root Non-Volatile Storage(RNVS) is an on-chip non-volatile storage - * resource like fuses or on-chip flash that stores CCA platform immutable - * boot parameters. - * - * \param[in/out] size As an input value it indicates the size of the caller - * allocated buffer (in bytes) to store the platform - * config. At return its value is updated with the - * exact size of the platform configuration data. - * \param[out] buf Pointer to the buffer to store the platform - * configuration data. - * - * \return Returns error code specified in \ref tfm_plat_err_t - */ -enum tfm_plat_err_t -tfm_attest_hal_get_platform_config(uint32_t *size, uint8_t *buf); - - -/** - * \brief Retrieve the platform hash algorithm identifier. - * - * According to IANA hash algorithm registry: - * - https://www.iana.org/assignments/hash-function-text-names/hash-function-text-names.xml - * - * \param[in/out] size As an input value it indicates the size of the caller - * allocated buffer (in bytes) to store the platform - * hash algo. At return its value is updated with the - * exact size of the platform hahs algo string. - * \param[out] buf Pointer to the buffer to store the platform - * hash algo string. - * - * \return Returns error code specified in \ref tfm_plat_err_t - */ -enum tfm_plat_err_t -tfm_attest_hal_get_platform_hash_algo(uint32_t *size, uint8_t *buf); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_ATTEST_HAL_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_defs.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_defs.h deleted file mode 100644 index c5e836b..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_defs.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_DEFS_H__ -#define __TFM_HAL_DEFS_H__ - -#include <limits.h> -#include <stdint.h> - -enum tfm_hal_status_t { - TFM_HAL_ERROR_MEM_FAULT = SCHAR_MIN, - TFM_HAL_ERROR_MAX_VALUE = SCHAR_MIN + 0x3A5C, - TFM_HAL_ERROR_BAD_STATE = SCHAR_MIN + 0x55A3, - TFM_HAL_ERROR_NOT_SUPPORTED = SCHAR_MIN + 0xA3C5, - TFM_HAL_ERROR_INVALID_INPUT = SCHAR_MIN + 0xC35A, - TFM_HAL_ERROR_NOT_INIT = SCHAR_MIN + 0x33CA5, - TFM_HAL_ERROR_GENERIC = SCHAR_MIN + 0x3C5A, - TFM_HAL_SUCCESS = 0 -}; - -#endif /* __TFM_HAL_DEFS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_device_header.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_device_header.h deleted file mode 100644 index ee095cd..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_device_header.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2019, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_DEVICE_HEADER_H__ -#define __TFM_HAL_DEVICE_HEADER_H__ - -#ifdef CMSIS_device_header -#include CMSIS_device_header -#else -#include "cmsis.h" -#endif - -#endif /* __TFM_HAL_DEVICE_HEADER_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_interrupt.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_interrupt.h deleted file mode 100644 index 3081a1e..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_interrupt.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_INTERRUPT_H__ -#define __TFM_HAL_INTERRUPT_H__ - -#include <stdint.h> -#include "tfm_hal_defs.h" - -/** - * \brief Enables an interrupt from the Interrupt Controller of the platform - * - * \param[in] irq_num the interrupt to be enabled with a number - * - * \return TFM_HAL_ERROR_INVALID_INPUT - the irq_num is not invalid. - * TFM_HAL_ERROR_GENERIC - failed to enable the interrupt. - * TFM_HAL_SUCCESS - the interrupt is enabled. - */ -enum tfm_hal_status_t tfm_hal_irq_enable(uint32_t irq_num); - -/** - * \brief Disables an interrupt from the Interrupt Controller of the platform - * - * \param[in] irq_num the interrupt to be disabled with a number - * - * \return TFM_HAL_ERROR_INVALID_INPUT - the irq_num is not invalid. - * TFM_HAL_ERROR_GENERIC - failed to disable the interrupt. - * TFM_HAL_SUCCESS - the interrupt is disable. - */ -enum tfm_hal_status_t tfm_hal_irq_disable(uint32_t irq_num); - -/** - * \brief Clears an active and pending interrupt. - * - * \param[in] irq_num the interrupt to be cleared with a number - * - * \return TFM_HAL_ERROR_INVALID_INPUT - the irq_num is not invalid. - * TFM_HAL_ERROR_GENERIC - failed to clear the pending interrupt. - * TFM_HAL_SUCCESS - the pending interrupt is cleared. - */ -enum tfm_hal_status_t tfm_hal_irq_clear_pending(uint32_t irq_num); - -#endif /* __TFM_HAL_INTERRUPT_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_isolation.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_isolation.h deleted file mode 100644 index 238a8fd..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_isolation.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2020-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_ISOLATION_H__ -#define __TFM_HAL_ISOLATION_H__ - -#include <stddef.h> -#include <stdint.h> -#include <stdbool.h> -#include "fih.h" -#include "tfm_hal_defs.h" -#include "load/partition_defs.h" -#include "load/asset_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Memory access attributes */ -#define TFM_HAL_ACCESS_EXECUTABLE (1UL << 0) -#define TFM_HAL_ACCESS_READABLE (1UL << 1) -#define TFM_HAL_ACCESS_WRITABLE (1UL << 2) -#define TFM_HAL_ACCESS_UNPRIVILEGED (1UL << 3) -#define TFM_HAL_ACCESS_DEVICE (1UL << 4) -#define TFM_HAL_ACCESS_NS (1UL << 5) - -#define TFM_HAL_ACCESS_READWRITE \ - (TFM_HAL_ACCESS_READABLE | TFM_HAL_ACCESS_WRITABLE) - -#ifdef TFM_FIH_PROFILE_ON - -/** - * \brief This function is responsible for checking all critical isolation - configurations. - * - * \return TFM_HAL_SUCCESS - the verification passed. - * TFM_HAL_ERROR_GENERIC - the verification failed. - */ -fih_int tfm_hal_verify_static_boundaries(void); - -#endif /* TFM_FIH_PROFILE_ON */ -/** - * \brief Sets up the static isolation boundaries which are constant throughout - * the runtime of the system, including the SPE/NSPE and partition - * boundaries. - * - * \param[out] p_spm_boundary Pointer of the boundary value - * - * \return TFM_HAL_SUCCESS - the isolation boundaries have been set up. - * TFM_HAL_ERROR_GENERIC - failed to set up the isolation boundaries. - */ -FIH_RET_TYPE(enum tfm_hal_status_t) tfm_hal_set_up_static_boundaries( - uintptr_t *p_spm_boundary); - -/** - * \brief Activate one Secure Partition boundary. - * - * \param[in] p_ldinf Partition load information. - * \param[in] boundary Platform boundary value for partition. - * - * \return TFM_HAL_SUCCESS The isolation boundaries update succeeded. - * TFM_HAL_ERROR_GENERIC Failed to update the isolation boundaries. - */ -FIH_RET_TYPE(enum tfm_hal_status_t) tfm_hal_activate_boundary( - const struct partition_load_info_t *p_ldinf, - uintptr_t boundary); - -/** - * \brief This API checks if a given range of memory can be accessed with - * specified access types in boundary. The boundary belongs to - * a partition which contains all asset info. - * - * \param[in] boundary The boundary that the given memory is to be - * checked with. - * \param[in] base The base address of the region. - * \param[in] size The size of the region. - * \param[in] access_type The memory access types to be checked between - * given memory and boundaries. - * - * \return TFM_HAL_SUCCESS - The memory region has the access permissions. - * TFM_HAL_ERROR_MEM_FAULT - The memory region has not the access - * permissions. - * TFM_HAL_ERROR_INVALID_INPUT - Invalid inputs. - * TFM_HAL_ERROR_GENERIC - An error occurred. - */ -FIH_RET_TYPE(enum tfm_hal_status_t) tfm_hal_memory_check( - uintptr_t boundary, uintptr_t base, - size_t size, uint32_t access_type); - -/** - * \brief This API binds partition boundaries with the platform. The platform - * maintains the platform-specific settings for SPM further - * usage, such as update partition boundaries or - * check resource accessibility. The platform needs to manage - * the settings with internal mechanism, and return a value - * to SPM. SPM delivers this value back to platform when - * necessary. And SPM checks this value to decide if the - * platform-specific settings need to be updated. Hence - * multiple partitions can have the same value if they have - * the same platform-specific settings, depending on isolation level. - * - * \param[in] p_ldinf Partition load information. - * \param[in] p_boundary Pointer of the boundary value - * - * \return TFM_HAL_SUCCESS - A platform value bound successfully. - * TFM_HAL_ERROR_GENERIC - Error occurred while binding. - */ -FIH_RET_TYPE(enum tfm_hal_status_t) tfm_hal_bind_boundary( - const struct partition_load_info_t *p_ldinf, - uintptr_t *p_boundary); - -/** - * \brief This API let the platform decide if a boundary switch is needed. - * - * \param[in] boundary_from The current boundary to be switched. - * \param[in] boundary_to The target boundary to be switched to. - * - * \return true - a switching is needed. - * false - do not need a switch. - */ -bool tfm_hal_boundary_need_switch(uintptr_t boundary_from, - uintptr_t boundary_to); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_HAL_ISOLATION_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_its.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_its.h deleted file mode 100644 index a451485..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_its.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_ITS_H__ -#define __TFM_HAL_ITS_H__ - -#include <stddef.h> -#include <stdint.h> - -#include "Driver_Flash.h" -#include "flash_layout.h" -#include "tfm_hal_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* The name of the ARM_DRIVER_FLASH to use for ITS */ -#ifndef TFM_HAL_ITS_FLASH_DRIVER -#error "TFM_HAL_ITS_FLASH_DRIVER must be defined by the target in flash_layout.h" -#endif - -/* The size of the ITS flash device's physical program unit. Must be equal to - * TFM_HAL_ITS_FLASH_DRIVER.GetInfo()->program_unit, but required at compile - * time. - */ -#ifndef TFM_HAL_ITS_PROGRAM_UNIT -#error "TFM_HAL_ITS_PROGRAM_UNIT must be defined by the target in flash_layout.h" -#elif (TFM_HAL_ITS_PROGRAM_UNIT < 1) -#error "TFM_HAL_ITS_PROGRAM_UNIT must be greater than 1" -#elif (TFM_HAL_ITS_PROGRAM_UNIT & (TFM_HAL_ITS_PROGRAM_UNIT - 1) != 0) -#error "TFM_HAL_ITS_PROGRAM_UNIT must be a power of two" -#endif - -/** - * \brief Struct containing information required from the platform at runtime - * to configure the ITS filesystem. - */ -struct tfm_hal_its_fs_info_t { - uint32_t flash_area_addr; /**< Location of the block of flash to use for - * ITS - */ - size_t flash_area_size; /**< Number of bytes of flash to use for ITS */ - uint8_t sectors_per_block; /**< Number of erase sectors per logical FS block - */ -}; - -/** - * \brief The flash driver to use for ITS. - */ -extern ARM_DRIVER_FLASH TFM_HAL_ITS_FLASH_DRIVER; - -/** - * \brief Retrieve the filesystem config for ITS. - * - * Note that this function should ensure that the values returned do - * not result in a security compromise. - * - * \param [out] fs_info Filesystem config information - * - * \return A status code as specified in \ref tfm_hal_status_t - * If an error is detected within this function, is should leave the - * content of the parameters unchanged. - * - * \retval TFM_HAL_SUCCESS The operation completed successfully - * \retval TFM_HAL_ERROR_INVALID_INPUT Invalid parameter - */ -enum tfm_hal_status_t -tfm_hal_its_fs_info(struct tfm_hal_its_fs_info_t *fs_info); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_HAL_ITS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_its_encryption.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_its_encryption.h deleted file mode 100644 index 0229382..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_its_encryption.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_ITS_ENCRYPTION_H__ -#define __TFM_HAL_ITS_ENCRYPTION_H__ - -#include <stddef.h> -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * \brief Struct containing information required from the platform to perform - * encryption/decryption of ITS files. - */ -struct tfm_hal_its_auth_crypt_ctx { - uint8_t *deriv_label; /* The derivation label for AEAD */ - size_t deriv_label_size; /* Size of the deriv_label in bytes */ - uint8_t *aad; /* The additional authenticated data for AEAD */ - size_t add_size; /* Size of the add in bytes */ - uint8_t *nonce; /* The nonce for AEAD */ - size_t nonce_size; /* Size of the nonce in bytes */ -}; - -/** - * \brief Generate an encryption nonce - * - * \details The nonce has to be unique for every encryption using the same key, - * even across resets. - * \param [out] nonce Pointer to the nonce - * \param [in] nonce_size Size of the nonce in bytes - * - * \retval TFM_HAL_SUCCESS The operation completed successfully - * \retval TFM_HAL_ERROR_INVALID_INPUT Invalid argument - * \retval TFM_HAL_ERROR_GENERIC Failed to fill the nonce seed because of - * an internal error - */ -enum tfm_hal_status_t tfm_hal_its_aead_generate_nonce(uint8_t *nonce, - const size_t nonce_size); - -/** - * \brief Perform authenticated encryption. - * - * \details Perform the the AEAD encryption. - * It will start with deriving a key based long-term key-derivation - * key and the provided derivation label. - * This derived key will then be used to perform the AEAD operation. - * Therefore the following members of the ctx struct must be set: - * nonce - * nonce_size - * deriv_label - * deriv_label_size - * If additional data should be authenticated also - * aad - * aad_size - * must be set. - * - * \param [in] ctx AEAD context for ITS object - * \param [in] plaintext Pointer to the plaintext - * \param [in] plaintext_size Size of the plaintext in bytes - * \param [out] ciphertext Pointer to the ciphertext - * \param [in] ciphertext_size Size of the ciphertext in bytes - * \param [out] tag Authentication tag - * \param [in] tag_size Authentication tag size in bytes - * - * \retval TFM_HAL_SUCCESS The operation completed successfully - * \retval TFM_HAL_ERROR_INVALID_INPUT Invalid argument - * \retval TFM_HAL_ERROR_GENERIC Failed to encrypt - */ -enum tfm_hal_status_t tfm_hal_its_aead_encrypt( - struct tfm_hal_its_auth_crypt_ctx *ctx, - const uint8_t *plaintext, - const size_t plaintext_size, - uint8_t *ciphertext, - const size_t ciphertext_size, - uint8_t *tag, - const size_t tag_size); - -/** - * \brief Perform authenticated decryption. - * - * \details To perform the the AEAD decryption, the following members of the - * ctx struct must be set: - * nonce - * nonce_size - * deriv_label - * deriv_label_size - * If additional data should be authenticated also - * aad - * aad_size - * must be set. - * - * - * \param [in] ctx AEAD context for ITS object - * \param [in] ciphertext Pointer to the ciphertext - * \param [in] ciphertext_size Size of the ciphertext in bytes - * \param [in] tag Authentication tag - * \param [in] tag_size Authentication tag size in bytes - * \param [out] plaintext Pointer to the plaintext - * \param [in] plaintext_size Size of the plaintext in bytes - * - * \retval TFM_HAL_SUCCESS The operation completed successfully - * \retval TFM_HAL_ERROR_INVALID_INPUT Invalid argument - * \retval TFM_HAL_ERROR_GENERIC Failed to decrypt - */ -enum tfm_hal_status_t tfm_hal_its_aead_decrypt( - struct tfm_hal_its_auth_crypt_ctx *ctx, - const uint8_t *ciphertext, - const size_t ciphertext_size, - uint8_t *tag, - const size_t tag_size, - uint8_t *plaintext, - const size_t plaintext_size); - - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_HAL_ITS_ENCRYPTION_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_multi_core.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_multi_core.h deleted file mode 100644 index 553e84d..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_multi_core.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_MULTI_CORE_H__ -#define __TFM_HAL_MULTI_CORE_H__ - -#include <stddef.h> -#include <stdint.h> - -#include "tfm_multi_core.h" - -/** - * \brief Performs the necessary actions to start the non-secure CPU running - * the code at the specified address. - * - * \param[in] start_addr The entry point address of non-secure code. - */ -void tfm_hal_boot_ns_cpu(uintptr_t start_addr); - -/** - * \brief Called on the secure CPU. - * Flags that the secure CPU has completed its initialization - * Waits, if necessary, for the non-secure CPU to flag that - * it has completed its initialisation - */ -void tfm_hal_wait_for_ns_cpu_ready(void); - -/** - * \brief Retrieve the current active security configuration information and - * fills the \ref security_attr_info_t. - * - * \param[in] p Base address of target memory region - * \param[in] s Size of target memory region - * \param[out] p_attr Address of \ref security_attr_info_t to be filled - * - * \return void - */ -void tfm_hal_get_mem_security_attr(const void *p, size_t s, - struct security_attr_info_t *p_attr); - -/** - * \brief Retrieve the secure memory protection configuration information and - * fills the \ref mem_attr_info_t. - * - * \param[in] p Base address of target memory region - * \param[in] s Size of target memory region - * \param[out] p_attr Address of \ref mem_attr_info_t to be filled - * - * \return void - */ -void tfm_hal_get_secure_access_attr(const void *p, size_t s, - struct mem_attr_info_t *p_attr); - -/** - * \brief Retrieve the non-secure memory protection configuration information - * and fills the \ref mem_attr_info_t. - * - * \param[in] p Base address of target memory region - * \param[in] s Size of target memory region - * \param[out] p_attr Address of \ref mem_attr_info_t to be filled - * - * \return void - */ -void tfm_hal_get_ns_access_attr(const void *p, size_t s, - struct mem_attr_info_t *p_attr); - -#endif /* __TFM_HAL_MULTI_CORE_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_platform.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_platform.h deleted file mode 100644 index c03c14b..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_platform.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) - * or an affiliate of Cypress Semiconductor Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_PLATFORM_H__ -#define __TFM_HAL_PLATFORM_H__ - -#include <stddef.h> -#include <stdint.h> - -#include "fih.h" -#include "tfm_hal_defs.h" - -/** - * \brief This function performs the platform-specific initialization. - * - * This function is called after architecture and platform common initialization - * has finished during system early startup. - * - * \retval TFM_HAL_SUCCESS Init success. - * \retval TFM_HAL_ERROR_GENERIC Generic errors. - */ -FIH_RET_TYPE(enum tfm_hal_status_t) tfm_hal_platform_init(void); - -/** - * \brief System reset - */ -void tfm_hal_system_reset(void); - -/** - * \brief System halt - */ -void tfm_hal_system_halt(void); - -/** - * \brief Set up the RNG for use with random delays. - * - * \retval TFM_HAL_SUCCESS Platform specific random number generation - * initialization succeeded. - * \retval Other code Initialization failed. - */ -int32_t tfm_hal_random_init(void); - -/** - * \brief Get a random number from an RNG seeded with an entropy source. - * - * \param[out] rand Buffer to hold the random value - * \param[in] size The size of the buffer - * - * \retval TFM_HAL_SUCCESS Platform specific random number generation - * succeed. - * \retval Other code generation failed. - */ -int32_t tfm_hal_random_generate(uint8_t *rand, size_t size); - -/** - * \brief Get the VTOR value of non-secure image - * - * \return Returns the address where the vector table of the non-secure image - * is located - */ -uint32_t tfm_hal_get_ns_VTOR(void); - -/** - * \brief Get the entry point of the non-secure image - * - * \return Returns the address of the non-secure image entry point - */ -uint32_t tfm_hal_get_ns_entry_point(void); - -#ifdef TFM_PARTITION_NS_AGENT_TZ -/** - * \brief Get the initial address of non-secure image main stack - * - * \return Returns the initial non-secure MSP - */ -uint32_t tfm_hal_get_ns_MSP(void); -#endif /* TFM_PARTITION_NS_AGENT_TZ */ - -#endif /* __TFM_HAL_PLATFORM_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_ps.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_ps.h deleted file mode 100644 index b4cc72a..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_hal_ps.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. - * Copyright (c) 2020-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_HAL_PS_H__ -#define __TFM_HAL_PS_H__ - -#include <stddef.h> -#include <stdint.h> - -#include "Driver_Flash.h" -#include "flash_layout.h" -#include "tfm_hal_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* The name of the ARM_DRIVER_FLASH to use for PS */ -#ifndef TFM_HAL_PS_FLASH_DRIVER -#error "TFM_HAL_PS_FLASH_DRIVER must be defined by the target in flash_layout.h" -#endif - -/* The size of the PS flash device's physical program unit. Must be equal to - * TFM_HAL_PS_FLASH_DRIVER.GetInfo()->program_unit, but required at compile - * time. - */ -#ifndef TFM_HAL_PS_PROGRAM_UNIT -#error "TFM_HAL_PS_PROGRAM_UNIT must be defined by the target in flash_layout.h" -#elif (TFM_HAL_PS_PROGRAM_UNIT < 1) -#error "TFM_HAL_PS_PROGRAM_UNIT must be greater than 1" -#elif (TFM_HAL_PS_PROGRAM_UNIT & (TFM_HAL_PS_PROGRAM_UNIT - 1) != 0) -#error "TFM_HAL_PS_PROGRAM_UNIT must be a power of two" -#endif - -/** - * \brief Struct containing information required from the platform at runtime - * to configure the PS filesystem. - */ -struct tfm_hal_ps_fs_info_t { - uint32_t flash_area_addr; /**< Location of the block of flash to use for PS - */ - size_t flash_area_size; /**< Number of bytes of flash to use for PS */ - uint8_t sectors_per_block; /**< Number of erase sectors per logical FS block - */ -}; - -/** - * \brief The flash driver to use for PS. - */ -extern ARM_DRIVER_FLASH TFM_HAL_PS_FLASH_DRIVER; - -/** - * \brief Retrieve the filesystem config for PS. - * - * Note that this function should ensure that the values returned do - * not result in a security compromise. - * - * \param [out] fs_info Filesystem config information - * - * \return A status code as specified in \ref tfm_hal_status_t - * If an error is detected within this function, is should leave the - * content of the parameters unchanged. - * - * \retval TFM_HAL_SUCCESS The operation completed successfully - * \retval TFM_HAL_ERROR_INVALID_INPUT Invalid parameter - */ -enum tfm_hal_status_t tfm_hal_ps_fs_info(struct tfm_hal_ps_fs_info_t *fs_info); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_HAL_PS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_boot_seed.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_boot_seed.h deleted file mode 100644 index 11b79f0..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_boot_seed.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_BOOT_SEED_H__ -#define __TFM_PLAT_BOOT_SEED_H__ -/** - * \file tfm_plat_boot_seed.h - * - * Boot seed is used by a validating entity to ensure multiple reports were - * generated in the same boot session. Boot seed is a random number, generated - * only once during a boot cycle and its value is constant in the same cycle. - * Size recommendation is 256-bit to meet the statistically improbable property. - * Boot seed can be generated by secure boot loader an included to the measured - * boot state or can be generated by PRoT SW. - */ - -/** - * \note The interfaces defined in this file must be implemented for each - * SoC. - */ - -#include <stdint.h> -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * \def BOOT_SEED_SIZE - * - * \brief Size of boot seed in bytes. - */ -#define BOOT_SEED_SIZE (32u) - -/** - * \brief Gets the boot seed, which is a constant random number during a boot - * cycle. - * - * \param[in] size The required size of boot seed in bytes - * \param[out] buf Pointer to the buffer to store boot seed - * - * \return TFM_PLAT_ERR_SUCCESS if the value is generated correctly. Otherwise, - * it returns TFM_PLAT_ERR_SYSTEM_ERR. - */ -enum tfm_plat_err_t tfm_plat_get_boot_seed(uint32_t size, uint8_t *buf); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_BOOT_SEED_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_config.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_config.h deleted file mode 100644 index 448964d..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2020, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ -#ifndef __TFM_PLAT_CONFIG_H__ -#define __TFM_PLAT_CONFIG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Enable the multiple data section copy and bss section clear feature - * in GNUARM low level start-up. - */ -#define __STARTUP_COPY_MULTIPLE -#define __STARTUP_CLEAR_BSS_MULTIPLE - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_CONFIG_H__ */
\ No newline at end of file diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_crypto_keys.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_crypto_keys.h deleted file mode 100644 index 59146a1..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_crypto_keys.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017-2023, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_CRYPTO_KEYS_H__ -#define __TFM_PLAT_CRYPTO_KEYS_H__ - -#include <stdint.h> -#include "psa/crypto.h" -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Callback function type platform key loader functions - * - * This function pointer type defines the prototype for a builtin key loader function so that the - * key can be probed by the tfm_builtin_key_loader driver during the init phase. Note that the key - * must be readable from the secure processing element to be able to use the tfm_builtin_key_loader - * - * \param[out] buf Buffer to hold the retrieved key material from the platform - * \param[in] buf_len Size of the buf buffer - * \param[out] key_len Actual length of the key material in bytes retrieved from the platform - * \param[out] key_bits Size in bits of the key (important for those keys that are not byte-multiple) - * \param[out] algorithm \ref psa_algorithm_t value associated to the retrieved key material - * \param[out] type \ref psa_key_type_t value associated to the retrieved key material - * - * \return Returns an error value as specified by the \ref tfm_plat_err_t type. - * - */ -typedef enum tfm_plat_err_t (*key_loader_func_ptr) - (uint8_t *buf, size_t buf_len, size_t *key_len, size_t *key_bits, psa_algorithm_t *algorithm, psa_key_type_t *type); - -/** - * \brief This type describes the information that each TF-M builtin key - * must key in the associated descriptor table in \ref crypto_keys.c - */ -typedef struct { - psa_key_id_t key_id; /*!< Key id associated to the builtin key */ - psa_drv_slot_number_t slot_number; /*!< Slot number for the builtin key in the platform */ - psa_key_lifetime_t lifetime; /*!< Lifetime (persistence + location) for the builtin key */ - key_loader_func_ptr loader_key_func; /*!< Loader function that reads the key from the platform */ -} tfm_plat_builtin_key_descriptor_t; - -/** - * \brief This function retrieves a pointer to the description table for builtin keys. Each platform - * must implement this table with the details of the builtin keys available in the platform - * - * \param[out] desc_ptr A pointer to the description table - * - * \return size_t The number of builtin keys available in the platform - */ -size_t tfm_plat_builtin_key_get_desc_table_ptr(const tfm_plat_builtin_key_descriptor_t *desc_ptr[]); - -/** - * \brief This type maps a particular user of a builtin key (i.e. an owner) to - * the allowed usage (i.e. a policy) as specified by the platform - */ -typedef struct { - int32_t user; - psa_key_usage_t usage; -} tfm_plat_builtin_key_per_user_policy_t; - -/** - * \brief This type maps a particular key_id associated to a builtin key to the - * allowed usage (i.e. a policy). The policy can be user specific in case - * the per_user_policy field is greater than 0. In that case policy_ptr needs - * to be used to access the policies for each user of the key_id which are of - * type \ref tfm_platf_builtin_key_per_user_policy_t - */ -typedef struct { - psa_key_id_t key_id; - size_t per_user_policy; - union { - psa_key_usage_t usage; - const tfm_plat_builtin_key_per_user_policy_t *policy_ptr; - }; -} tfm_plat_builtin_key_policy_t; - -/** - * \brief This function retrieves a pointer to the policy table of the builtin keys. Each platform - * must implement this table with the details of the builtin keys available in the platform - * - * \param[out] desc_ptr A pointer to the policy table - * - * \return size_t The number of builtin keys available in the platform with associated policies - */ -size_t tfm_plat_builtin_key_get_policy_table_ptr(const tfm_plat_builtin_key_policy_t *desc_ptr[]); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_CRYPTO_KEYS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_crypto_nv_seed.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_crypto_nv_seed.h deleted file mode 100644 index fe29672..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_crypto_nv_seed.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ -#ifndef __TFM_PLAT_CRYPTO_NV_SEED_H__ -#define __TFM_PLAT_CRYPTO_NV_SEED_H__ - -#include <stddef.h> - -#ifndef NV_SEED_FILE_ID -#define NV_SEED_FILE_ID 9 -#endif - -#define TFM_CRYPTO_NV_SEED_SUCCESS 0 -#define TFM_CRYPTO_NV_SEED_FAILED -1 - -/** - * \brief Provision Seed to NV storage. Fails if a seed is already in storage. - * - * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success, - * or TFM_CRYPTO_NV_SEED_FAILED on failure. - */ -int tfm_plat_crypto_provision_entropy_seed(void); - -/** - * \brief Read Seed from NV storage. - * - * \param[out] buf Buffer to store the seed - * \param[in] buf_len Buffer length to read - * - * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success, - * or TFM_CRYPTO_NV_SEED_FAILED on failure. - */ -int tfm_plat_crypto_nv_seed_read(unsigned char *buf, size_t buf_len); - -/** - * \brief Write Seed to NV storage. - * - * \param[in] buf Buffer storing the seed - * \param[in] buf_len Buffer length to write - * - * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success, - * or TFM_CRYPTO_NV_SEED_FAILED on failure. - */ -int tfm_plat_crypto_nv_seed_write(const unsigned char *buf, size_t buf_len); - -#endif /* __TFM_PLAT_CRYPTO_NV_SEED_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_defs.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_defs.h deleted file mode 100644 index 3c7ae6c..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_defs.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2017-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_DEFS_H__ -#define __TFM_PLAT_DEFS_H__ -/** - * \note The interfaces defined in this file must be implemented for each - * target. - */ - -#include <stdint.h> -#include <limits.h> - -enum tfm_plat_err_t { - TFM_PLAT_ERR_SUCCESS = 0, - TFM_PLAT_ERR_SYSTEM_ERR = 0x3A5C, - TFM_PLAT_ERR_MAX_VALUE = 0x55A3, - TFM_PLAT_ERR_INVALID_INPUT = 0xA3C5, - TFM_PLAT_ERR_UNSUPPORTED = 0xC35A, - TFM_PLAT_ERR_NOT_PERMITTED = 0xC5A3, - /* Following entry is only to ensure the error code of int size */ - TFM_PLAT_ERR_FORCE_INT_SIZE = INT_MAX -}; - -#if defined(TFM_ISOLATION_LEVEL) && (TFM_ISOLATION_LEVEL != 1) - -/*! - * \def TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME) - * - * \brief This macro provides a mechanism to place a function code or a data - * variable in the code section (e.g. RO) of a specific secure partition - * at linker time. - * - * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest - * file "name" field. - * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest - * file "type" field. - */ -#define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME, \ - TFM_PARTITION_TYPE) \ - __attribute__((section(TFM_PARTITION_NAME "_" TFM_PARTITION_TYPE "_ATTR_FN"))) - -/*! - * \def TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME) - * - * \brief This macro provides a mechanism to place data variables in the RW data - * section of a specific secure partition at linker time. - * - * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest - * file "name" field. - * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest - * file "type" field. - */ -#define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME, \ - TFM_PARTITION_TYPE) \ - __attribute__((section(TFM_PARTITION_NAME "_" TFM_PARTITION_TYPE "_ATTR_RW"))) - -/*! - * \def TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME) - * - * \brief This macro provides a mechanism to place data variables in the ZI data - * section of a specific secure partition at linker time. - * - * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest - * file "name" field. - * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest - * file "type" field. - */ -#define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME, \ - TFM_PARTITION_TYPE) \ - __attribute__((section(TFM_PARTITION_NAME "_" TFM_PARTITION_TYPE "_ATTR_ZI"))) -#else -#define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME, TFM_PARTITION_TYPE) -#define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME, TFM_PARTITION_TYPE) -#define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME, TFM_PARTITION_TYPE) -#endif -#endif /* __TFM_PLAT_DEFS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_device_id.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_device_id.h deleted file mode 100644 index d2f5a19..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_device_id.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_DEVICE_ID_H__ -#define __TFM_PLAT_DEVICE_ID_H__ -/** - * \file tfm_plat_device_id.h - * - * The interfaces defined in this file are meant to provide the following - * attributes of the device: - * - Instance ID: Unique identifier of the device. - * - Implementation ID: Original implementation signer of the attestation key. - * - Hardware version: Identify the GDSII that went to fabrication. - */ - -/** - * \note The interfaces defined in this file must be implemented for each - * SoC. - */ - -#include <stdint.h> -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \def INSTANCE_ID_MAX_SIZE - * - * \brief Maximum size of instance ID in bytes - */ -#define INSTANCE_ID_MAX_SIZE (33u) - -/** - * \def IMPLEMENTATION_ID_MAX_SIZE - * - * \brief Maximum size of implementation ID in bytes - */ -#define IMPLEMENTATION_ID_MAX_SIZE (32u) - -/** - * \def CERTIFICATION_REF_MAX_SIZE - * - * \brief Maximum size of hardware version in bytes - * - * Recommended to use the European Article Number format: EAN-13 + '-' + 5 - * https://www.ietf.org/archive/id/draft-tschofenig-rats-psa-token-09.html#name-certification-reference - */ -#define CERTIFICATION_REF_MAX_SIZE (19u) - -/** - * \brief Get the Implementation ID of the device. - * - * This mandatory claim represents the original implementation signer of the - * attestation key and identifies the contract between the report and - * verification. A verification service will use this claim to locate the - * details of the verification process. The claim will be represented by a - * custom EAT claim with a value consisting of a CBOR byte string. The size of - * this string will normally be 32 bytes to accommodate a 256 bit hash. - * - * \param[in/out] size As an input value it indicates the size of the caller - * allocated buffer (in bytes) to store the implementation - * ID. At return its value is updated with the exact size - * of the implementation ID. - * \param[out] buf Pointer to the buffer to store the implementation ID - * - * \return Returns error code specified in \ref tfm_plat_err_t - */ -enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size, - uint8_t *buf); - -/** - * \brief Get the PSA certification reference of the device. - * - * This optional claim provides metadata linking the token to the GDSII that - * went to fabrication for this instance. It is represented as CBOR text string. - * It is recommended to use for identification the format of the European - * Article Number: EAN-13+5. - * - * \param[in/out] size As an input value it indicates the size of the caller - * allocated buffer (in bytes) to store the certification - * reference. At return its value is updated with the exact - * size of the certification reference. - * \param[out] buf Pointer to the buffer to store the certification - * reference. - * - * \return Returns error code specified in \ref tfm_plat_err_t - */ -enum tfm_plat_err_t tfm_plat_get_cert_ref(uint32_t *size, uint8_t *buf); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_DEVICE_ID_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_ns.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_ns.h deleted file mode 100644 index 1e35894..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_ns.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2018-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_NS_H__ -#define __TFM_PLAT_NS_H__ - -/** - * \brief Platform peripherals and devices initialization. - * - * \return ARM_DRIVER_OK if the initialization succeeds -*/ - -int32_t tfm_ns_platform_init(void); - -/** - * \brief Coprocessor initialization. - * - * \return ARM_DRIVER_OK if the initialization succeeds -*/ -int32_t tfm_ns_cp_init(void); - -#endif /* __TFM_PLAT_NS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_nv_counters.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_nv_counters.h deleted file mode 100644 index 25b5149..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_nv_counters.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2018-2023, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_NV_COUNTERS_H__ -#define __TFM_PLAT_NV_COUNTERS_H__ - -/** - * \file tfm_plat_nv_counters.h - * - * \note The interfaces defined in this file must be implemented for each - * SoC. - * \note The interface must be implemented in a fail-safe way that is - * resistant to asynchronous power failures or it can use hardware - * counters that have this capability, if supported by the platform. - * When a counter incrementation was interrupted it must be able to - * continue the incrementation process or recover the previous consistent - * status of the counters. If the counters have reached a stable status - * (every counter incrementation operation has finished), from that point - * their value cannot decrease due to any kind of power failure. - */ - -#include <stdint.h> -#include "tfm_plat_defs.h" - -#ifndef PLATFORM_NS_NV_COUNTERS -#define PLATFORM_NS_NV_COUNTERS 0 -#endif - -#ifdef PLATFORM_DEFAULT_NV_COUNTERS -enum tfm_nv_counter_t { - PLAT_NV_COUNTER_PS_0 = 0, /* Used by PS service */ - PLAT_NV_COUNTER_PS_1, /* Used by PS service */ - PLAT_NV_COUNTER_PS_2, /* Used by PS service */ - - /* BL2 NV counters must be contiguous */ - PLAT_NV_COUNTER_BL2_0, /* Used by bootloader */ - PLAT_NV_COUNTER_BL2_1, /* Used by bootloader */ - PLAT_NV_COUNTER_BL2_2, /* Used by bootloader */ - PLAT_NV_COUNTER_BL2_3, /* Used by bootloader */ - - PLAT_NV_COUNTER_BL1_0, /* Used by bootloader */ - - /* NS counters must be contiguous */ - PLAT_NV_COUNTER_NS_0, /* Used by NS */ - PLAT_NV_COUNTER_NS_1, /* Used by NS */ - PLAT_NV_COUNTER_NS_2, /* Used by NS */ - - PLAT_NV_COUNTER_MAX, - PLAT_NV_COUNTER_BOUNDARY = UINT32_MAX /* Fix tfm_nv_counter_t size - to 4 bytes */ -}; -#else -#include "platform_nv_counters_ids.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Initialises all non-volatile (NV) counters. - * - * \return TFM_PLAT_ERR_SUCCESS if the initialization succeeds, otherwise - * TFM_PLAT_ERR_SYSTEM_ERR - */ -enum tfm_plat_err_t tfm_plat_init_nv_counter(void); - -/** - * \brief Reads the given non-volatile (NV) counter. - * - * \param[in] counter_id NV counter ID. - * \param[in] size Size of the buffer to store NV counter value - * in bytes. - * \param[out] val Pointer to store the current NV counter value. - * - * \return TFM_PLAT_ERR_SUCCESS if the value is read correctly. Otherwise, - * it returns TFM_PLAT_ERR_SYSTEM_ERR. - */ -enum tfm_plat_err_t tfm_plat_read_nv_counter(enum tfm_nv_counter_t counter_id, - uint32_t size, uint8_t *val); - -/** - * \brief Increments the given non-volatile (NV) counter. - * - * \param[in] counter_id NV counter ID. - * - * \return When the NV counter reaches its maximum value, the - * TFM_PLAT_ERR_MAX_VALUE error is returned to indicate the value - * cannot be incremented. Otherwise, it returns TFM_PLAT_ERR_SUCCESS. - */ -enum tfm_plat_err_t tfm_plat_increment_nv_counter( - enum tfm_nv_counter_t counter_id); - -/** - * \brief Sets the given non-volatile (NV) counter to the specified value. - * - * \param[in] counter_id NV counter ID. - * \param[in] value New value of the NV counter. The maximum value that - * can be set depends on the constraints of the - * underlying implementation, but it always must be - * greater than or equal to the current NV counter value. - * - * \retval TFM_PLAT_ERR_SUCCESS The NV counter is set successfully - * \retval TFM_PLAT_ERR_INVALID_INPUT The new value is less than the current - * counter value - * \retval TFM_PLAT_ERR_MAX_VALUE The new value is greater than the - * maximum value of the NV counter - * \retval TFM_PLAT_ERR_UNSUPPORTED The function is not implemented for - * the given platform or the new value is - * not representable on the underlying - * counter implementation - * \retval TFM_PLAT_ERR_SYSTEM_ERR An unspecified error occurred - * (none of the other standard error codes - * are applicable) - */ -enum tfm_plat_err_t tfm_plat_set_nv_counter(enum tfm_nv_counter_t counter_id, - uint32_t value); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_NV_COUNTERS_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_otp.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_otp.h deleted file mode 100644 index 7457e54..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_otp.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2021-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_OTP_H__ -#define __TFM_PLAT_OTP_H__ - -#include <stdint.h> -#include <stddef.h> -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef PLATFORM_DEFAULT_OTP -enum tfm_otp_element_id_t { - PLAT_OTP_ID_HUK = 0, - PLAT_OTP_ID_GUK, - PLAT_OTP_ID_IAK, - PLAT_OTP_ID_IAK_LEN, - PLAT_OTP_ID_IAK_TYPE, - PLAT_OTP_ID_IAK_ID, - - PLAT_OTP_ID_BOOT_SEED, - PLAT_OTP_ID_LCS, - PLAT_OTP_ID_IMPLEMENTATION_ID, - PLAT_OTP_ID_CERT_REF, - PLAT_OTP_ID_VERIFICATION_SERVICE_URL, - PLAT_OTP_ID_PROFILE_DEFINITION, - - /* BL2 ROTPK must be contiguous */ - PLAT_OTP_ID_BL2_ROTPK_0, - PLAT_OTP_ID_BL2_ROTPK_1, - PLAT_OTP_ID_BL2_ROTPK_2, - PLAT_OTP_ID_BL2_ROTPK_3, - - /* BL2 NV counters must be contiguous */ - PLAT_OTP_ID_NV_COUNTER_BL2_0, - PLAT_OTP_ID_NV_COUNTER_BL2_1, - PLAT_OTP_ID_NV_COUNTER_BL2_2, - PLAT_OTP_ID_NV_COUNTER_BL2_3, - - PLAT_OTP_ID_NV_COUNTER_NS_0, - PLAT_OTP_ID_NV_COUNTER_NS_1, - PLAT_OTP_ID_NV_COUNTER_NS_2, - - PLAT_OTP_ID_KEY_BL2_ENCRYPTION, - PLAT_OTP_ID_BL1_2_IMAGE, - PLAT_OTP_ID_BL1_2_IMAGE_HASH, - PLAT_OTP_ID_BL2_IMAGE_HASH, - PLAT_OTP_ID_BL1_ROTPK_0, - - PLAT_OTP_ID_NV_COUNTER_BL1_0, - - PLAT_OTP_ID_ENTROPY_SEED, - - PLAT_OTP_ID_SECURE_DEBUG_PK, - - PLAT_OTP_ID_MAX = UINT32_MAX, -}; -#else -#include "platform_otp_ids.h" -#endif /* PLATFORM_DEFAULT_OTP */ - -/* These are separate from the tfm_security_lifecycle_t definitions because here - * the possible transitions are encoded by using the property that OTP bits can - * be changed from a 0 to a 1, but not from a 1 to a 0. - * - * For example: - * If the device is in PLAT_OTP_LCS_SECURED, it can transition to - * PLAT_OTP_LCS_DECOMMISSIONED by setting bit 3, but cannot transition back to - * PLAT_OTP_LCS_PSA_ROT_PROVISIONING as that would require setting bit 2 to 0, - * which cannot be done as per OTP semantics. - * - * NON_PSA_ROT_DEBUG and RECOVERABLE_PSA_ROT_DEBUG must be handled separately to - * OTP memory as they are reversible transitions from SECURED, and OTP cannot - * handle reversible transitions. - */ -enum plat_otp_lcs_t { - PLAT_OTP_LCS_ASSEMBLY_AND_TEST = 0x0, - PLAT_OTP_LCS_PSA_ROT_PROVISIONING = 0x1, - PLAT_OTP_LCS_SECURED = 0x3, - PLAT_OTP_LCS_DECOMMISSIONED = 0x7, - PLAT_OTP_LCS_UNKNOWN = 0xF, - PLAT_OTP_LCS_MAX = UINT32_MAX, -}; - -/** - * \brief Initialises OTP storage. - * - * \return TFM_PLAT_ERR_SUCCESS if the - * initialization succeeds, otherwise - * TFM_PLAT_ERR_SYSTEM_ERR - */ -enum tfm_plat_err_t tfm_plat_otp_init(void); - -/** - * \brief Reads the given OTP element. - * - * \param[in] id ID of the element to read. - * \param[in] out_len Size of the buffer to read the element - * into in bytes. - * \param[out] out Buffer to read the element into. - * - * \note If the size of the internal OTP - * representation of the item is different - * to out_len, then the smaller of the two - * is the amount of bytes that must be - * read. - * - * \retval TFM_PLAT_ERR_SUCCESS The element is read successfully. - * \retval TFM_PLAT_ERR_UNSUPPORTED The given element has not been - * instanciated in OTP memory by this - * particular platform. - * \retval TFM_PLAT_ERR_SYSTEM_ERR An unspecified error occurred. - */ -enum tfm_plat_err_t tfm_plat_otp_read(enum tfm_otp_element_id_t id, - size_t out_len, uint8_t *out); - -/** - * \brief Writes the specified bytes to the given - * OTP element. - * - * \param[in] id ID of the element to write. - * \param[in] in_len Size of the buffer to write to the - * element in bytes. - * \param[in] in Pointer to the buffer to write to the - * element. - * - * \note This function must implement the OTP - * writing semantics, where any bit - * currently set to 1 cannot be set to 0. - * If such a write is requested, the - * function should return an error code and - * not alter the contents of OTP memory. - * - * \note If the size of the internal OTP - * representation of the item is smaller - * than in_len, this function must return - * an error other than TFM_PLAT_ERR_SUCCESS - * and not write any OTP. - * - * \retval TFM_PLAT_ERR_SUCCESS The OTP is written successfully - * \retval TFM_PLAT_ERR_UNSUPPORTED The element is not supported. - * \retval TFM_PLAT_ERR_SYSTEM_ERR An unspecified error occurred. - */ -enum tfm_plat_err_t tfm_plat_otp_write(enum tfm_otp_element_id_t id, - size_t in_len, const uint8_t *in); - -/** - * \brief Returns the size of a given OTP element. - * - * \param[in] id ID of the element. - * \param[out] size Size of the element. - * - * \retval TFM_PLAT_ERR_SUCCESS The size is returned successfully. - * \retval TFM_PLAT_ERR_UNSUPPORTED The element is not supported. - * \retval TFM_PLAT_ERR_SYSTEM_ERR An unspecified error occurred. - */ -enum tfm_plat_err_t tfm_plat_otp_get_size(enum tfm_otp_element_id_t id, - size_t *size); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_OTP_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_provisioning.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_provisioning.h deleted file mode 100644 index 2f3b169..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_provisioning.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_PROVISIONING_H__ -#define __TFM_PLAT_PROVISIONING_H__ - -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Check the contents of OTP memory for the - * presence of keys provisioned by - * TFM_DUMMY_PROVISIONING - * - * \note This function should print a warning to - * the UART, or otherwise notify the device - * user, if dummy keys are detected. - */ -void tfm_plat_provisioning_check_for_dummy_keys(void); - -/** - * \brief Check if a provisioning operation is - * required. - * - * \retval 1 A provisioning operation is required. - * \retval 0 A provisioning operation is not - * required. - */ -int tfm_plat_provisioning_is_required(void); - -/** - * \brief Performs a provisioning operation. - * - * \retval TFM_PLAT_ERR_SUCCESS The provisioning operation completed - * successfully. - * \retval TFM_PLAT_ERR_INVALID_INPUT The provisioning data that was input to - * the device is invalid - * \retval TFM_PLAT_ERR_SYSTEM_ERR An unspecified error occurred. - */ -enum tfm_plat_err_t tfm_plat_provisioning_perform(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_PROVISIONING_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_rotpk.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_rotpk.h deleted file mode 100644 index 3bc93f5..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_rotpk.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_ROTPK_H__ -#define __TFM_PLAT_ROTPK_H__ -/** - * \note The interfaces defined in this file must be implemented for each - * SoC. - */ - -#include <stddef.h> -#include <stdint.h> -#include "tfm_plat_defs.h" -#include "psa/crypto.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Structure to store the hard-coded (embedded in secure firmware) hash of ROTPK - * for firmware authentication. - * - * \note Just temporary solution, hard-coded key-hash values in firmware is not - * suited for use in production! - */ -struct tfm_plat_rotpk_t { - const uint8_t *key_hash; - const uint8_t hash_len; -}; - -/** - * \brief Get the hash of the corresponding Root of Trust Public Key for - * firmware authentication. - * - * \param[in] image_id The identifier of firmware image - * \param[out] rotpk_hash Buffer to store the key-hash in - * \param[in,out] rotpk_hash_size As input the size of the buffer. As output - * the actual key-hash length. - */ -enum tfm_plat_err_t -tfm_plat_get_rotpk_hash(uint8_t image_id, - uint8_t *rotpk_hash, - uint32_t *rotpk_hash_size); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_ROTPK_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_test.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_test.h deleted file mode 100644 index 7e138f0..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_plat_test.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2019-2022, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_TEST_H__ -#define __TFM_PLAT_TEST_H__ - -#include "tfm_plat_defs.h" - -/** - * \brief starts Secure timer - * - * Configures a timer to start counting, and generate a timer interrupt after a - * certain amount of time. For the test case to be useful, the timeout value of - * the timer should be long enough so that the test service can go to the state - * where it starts waiting for the interrupt. - */ -#ifdef TFM_PARTITION_SLIH_TEST -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT") -#elif defined(TFM_PARTITION_FLIH_TEST) -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT") -#endif -void tfm_plat_test_secure_timer_start(void); - - -/** - * \brief Clears Secure timer interrupt - */ -#ifdef TFM_PARTITION_SLIH_TEST -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT") -#elif TFM_PARTITION_FLIH_TEST -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT") -#endif -void tfm_plat_test_secure_timer_clear_intr(void); - -/** - * \brief Stops the Secure timer and clears the timer interrupt. - */ -#ifdef TFM_PARTITION_SLIH_TEST -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT") -#elif defined(TFM_PARTITION_FLIH_TEST) -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT") -#endif -void tfm_plat_test_secure_timer_stop(void); - -/** - * \brief starts Non-secure timer - * - * Configures a timer to start counting, and generate a timer interrupt after a - * certain amount of time. For the test case to be useful, the timeout value of - * the timer should be long enough so that the test service can go to the state - * where it starts waiting for the interrupt. - */ -void tfm_plat_test_non_secure_timer_start(void); - -/** - * \brief Stops the non-Secure timer and clears the timer interrupt. - */ -void tfm_plat_test_non_secure_timer_stop(void); - - -#endif /* __TFM_PLAT_TEST_H__ */ diff --git a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_platform_system.h b/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_platform_system.h deleted file mode 100644 index 40bd130..0000000 --- a/nrfdemo/builddk/tfm/api_ns/platform/include/tfm_platform_system.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018-2021, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLATFORM_SYSTEM_H__ -#define __TFM_PLATFORM_SYSTEM_H__ -/** - * \note The interfaces defined in this file must be implemented for each - * target. - */ - -#include "psa/client.h" -#include "tfm_plat_defs.h" -#include "tfm_platform_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Resets the system. - * - * \details Requests a system reset to reset the MCU. - */ -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_PLATFORM", "PSA-ROT") -void tfm_platform_hal_system_reset(void); - -/*! - * \brief Performs a platform-specific service - * - * \param[in] request Request identifier (valid values vary - * based on the platform) - * \param[in] in_vec Input buffer to the requested service (or NULL) - * \param[out] out_vec Output buffer to the requested service (or NULL) - * - * \return Returns values as specified by the \ref tfm_platform_err_t - */ -TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_PLATFORM", "PSA-ROT") -enum tfm_platform_err_t tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request, - psa_invec *in_vec, - psa_outvec *out_vec); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLATFORM_SYSTEM_H__ */ |
