Xinyu Zhang | a2fab0e | 2022-10-24 15:37:46 +0800 | [diff] [blame] | 1 | /* |
Sherry Zhang | f2a4f91 | 2023-09-12 15:38:12 +0800 | [diff] [blame] | 2 | * Copyright (c) 2022-2024, Arm Limited. All rights reserved. |
Chris Brand | 72ee4c6 | 2024-01-08 16:56:55 -0800 | [diff] [blame] | 3 | * Copyright (c) 2023-2024 Cypress Semiconductor Corporation (an Infineon |
Chris Brand | 80326b7 | 2023-03-15 13:07:49 -0700 | [diff] [blame] | 4 | * company) or an affiliate of Cypress Semiconductor Corporation. All rights |
| 5 | * reserved. |
Xinyu Zhang | a2fab0e | 2022-10-24 15:37:46 +0800 | [diff] [blame] | 6 | * |
| 7 | * SPDX-License-Identifier: BSD-3-Clause |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | #ifndef __CONFIG_BASE_H__ |
| 12 | #define __CONFIG_BASE_H__ |
| 13 | |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 14 | /* Platform Partition Configs */ |
| 15 | |
| 16 | /* Size of input buffer in platform service */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 17 | #ifndef PLATFORM_SERVICE_INPUT_BUFFER_SIZE |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 18 | #define PLATFORM_SERVICE_INPUT_BUFFER_SIZE 64 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 19 | #endif |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 20 | |
| 21 | /* Size of output buffer in platform service */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 22 | #ifndef PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 23 | #define PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 64 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 24 | #endif |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 25 | |
| 26 | /* The stack size of the Platform Secure Partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 27 | #ifndef PLATFORM_SP_STACK_SIZE |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 28 | #define PLATFORM_SP_STACK_SIZE 0x500 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 29 | #endif |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 30 | |
| 31 | /* Disable Non-volatile counter module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 32 | #ifndef PLATFORM_NV_COUNTER_MODULE_DISABLED |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 33 | #define PLATFORM_NV_COUNTER_MODULE_DISABLED 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 34 | #endif |
Xinyu Zhang | 77668dd | 2022-10-24 16:17:37 +0800 | [diff] [blame] | 35 | |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 36 | /* Crypto Partition Configs */ |
| 37 | |
| 38 | /* |
| 39 | * Heap size for the crypto backend |
| 40 | * CRYPTO_ENGINE_BUF_SIZE needs to be >8KB for EC signing by attest module. |
| 41 | */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 42 | #ifndef CRYPTO_ENGINE_BUF_SIZE |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 43 | #define CRYPTO_ENGINE_BUF_SIZE 0x2080 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 44 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 45 | |
| 46 | /* The max number of concurrent operations that can be active (allocated) at any time in Crypto */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 47 | #ifndef CRYPTO_CONC_OPER_NUM |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 48 | #define CRYPTO_CONC_OPER_NUM 8 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 49 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 50 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 51 | /* Enable PSA Crypto random number generator module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 52 | #ifndef CRYPTO_RNG_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 53 | #define CRYPTO_RNG_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 54 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 55 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 56 | /* Enable PSA Crypto Key module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 57 | #ifndef CRYPTO_KEY_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 58 | #define CRYPTO_KEY_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 59 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 60 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 61 | /* Enable PSA Crypto AEAD module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 62 | #ifndef CRYPTO_AEAD_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 63 | #define CRYPTO_AEAD_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 64 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 65 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 66 | /* Enable PSA Crypto MAC module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 67 | #ifndef CRYPTO_MAC_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 68 | #define CRYPTO_MAC_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 69 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 70 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 71 | /* Enable PSA Crypto Hash module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 72 | #ifndef CRYPTO_HASH_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 73 | #define CRYPTO_HASH_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 74 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 75 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 76 | /* Enable PSA Crypto Cipher module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 77 | #ifndef CRYPTO_CIPHER_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 78 | #define CRYPTO_CIPHER_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 79 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 80 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 81 | /* Enable PSA Crypto asymmetric key signature module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 82 | #ifndef CRYPTO_ASYM_SIGN_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 83 | #define CRYPTO_ASYM_SIGN_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 84 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 85 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 86 | /* Enable PSA Crypto asymmetric key encryption module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 87 | #ifndef CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 88 | #define CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 89 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 90 | |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 91 | /* Enable PSA Crypto key derivation module */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 92 | #ifndef CRYPTO_KEY_DERIVATION_MODULE_ENABLED |
Jianliang Shen | 78ca8d4 | 2022-11-16 17:33:18 +0800 | [diff] [blame] | 93 | #define CRYPTO_KEY_DERIVATION_MODULE_ENABLED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 94 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 95 | |
| 96 | /* Default size of the internal scratch buffer used for PSA FF IOVec allocations */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 97 | #ifndef CRYPTO_IOVEC_BUFFER_SIZE |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 98 | #define CRYPTO_IOVEC_BUFFER_SIZE 5120 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 99 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 100 | |
| 101 | /* Use stored NV seed to provide entropy */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 102 | #ifndef CRYPTO_NV_SEED |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 103 | #define CRYPTO_NV_SEED 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 104 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 105 | |
| 106 | /* |
| 107 | * Only enable multi-part operations in Hash, MAC, AEAD and symmetric ciphers, |
| 108 | * to optimize memory footprint in resource-constrained devices. |
| 109 | */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 110 | #ifndef CRYPTO_SINGLE_PART_FUNCS_DISABLED |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 111 | #define CRYPTO_SINGLE_PART_FUNCS_DISABLED 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 112 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 113 | |
Antonio de Angelis | bb6f711 | 2024-10-16 19:15:25 +0100 | [diff] [blame] | 114 | /* |
| 115 | * The service assumes that the client interface and internal |
| 116 | * interface towards the library that provides the PSA Crypto |
| 117 | * core component maintain the same ABI. This is not the default |
| 118 | * when using the Mbed TLS reference implementation |
| 119 | */ |
| 120 | #ifndef CRYPTO_LIBRARY_ABI_COMPAT |
| 121 | #define CRYPTO_LIBRARY_ABI_COMPAT (0) |
| 122 | #endif |
| 123 | |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 124 | /* The stack size of the Crypto Secure Partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 125 | #ifndef CRYPTO_STACK_SIZE |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 126 | #define CRYPTO_STACK_SIZE 0x1B00 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 127 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 128 | |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 129 | /* FWU Partition Configs */ |
| 130 | |
| 131 | /* Size of the FWU internal data transfer buffer */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 132 | #ifndef TFM_FWU_BUF_SIZE |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 133 | #define TFM_FWU_BUF_SIZE PSA_FWU_MAX_WRITE_SIZE |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 134 | #endif |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 135 | |
| 136 | /* The stack size of the Firmware Update Secure Partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 137 | #ifndef FWU_STACK_SIZE |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 138 | #define FWU_STACK_SIZE 0x600 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 139 | #endif |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 140 | |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 141 | /* Attest Partition Configs */ |
| 142 | |
| 143 | /* Include optional claims in initial attestation token */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 144 | #ifndef ATTEST_INCLUDE_OPTIONAL_CLAIMS |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 145 | #define ATTEST_INCLUDE_OPTIONAL_CLAIMS 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 146 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 147 | |
| 148 | /* Include COSE key-id in initial attestation token */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 149 | #ifndef ATTEST_INCLUDE_COSE_KEY_ID |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 150 | #define ATTEST_INCLUDE_COSE_KEY_ID 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 151 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 152 | |
| 153 | /* The stack size of the Initial Attestation Secure Partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 154 | #ifndef ATTEST_STACK_SIZE |
Tamas Ban | 6bff468 | 2024-09-25 15:15:26 +0200 | [diff] [blame] | 155 | #define ATTEST_STACK_SIZE 0x800 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 156 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 157 | |
| 158 | /* Set the initial attestation token profile */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 159 | #if (!ATTEST_TOKEN_PROFILE_PSA_IOT_1) && \ |
| 160 | (!ATTEST_TOKEN_PROFILE_PSA_2_0_0) && \ |
| 161 | (!ATTEST_TOKEN_PROFILE_ARM_CCA) |
Antonio de Angelis | 58fc26c | 2024-11-07 17:06:55 +0100 | [diff] [blame] | 162 | #define ATTEST_TOKEN_PROFILE_PSA_IOT_1 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 163 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 164 | |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 165 | /* ITS Partition Configs */ |
| 166 | |
| 167 | /* Create flash FS if it doesn't exist for Internal Trusted Storage partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 168 | #ifndef ITS_CREATE_FLASH_LAYOUT |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 169 | #define ITS_CREATE_FLASH_LAYOUT 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 170 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 171 | |
| 172 | /* Enable emulated RAM FS for platforms that don't have flash for Internal Trusted Storage partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 173 | #ifndef ITS_RAM_FS |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 174 | #define ITS_RAM_FS 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 175 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 176 | |
| 177 | /* Validate filesystem metadata every time it is read from flash */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 178 | #ifndef ITS_VALIDATE_METADATA_FROM_FLASH |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 179 | #define ITS_VALIDATE_METADATA_FROM_FLASH 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 180 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 181 | |
| 182 | /* The maximum asset size to be stored in the Internal Trusted Storage */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 183 | #ifndef ITS_MAX_ASSET_SIZE |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 184 | #define ITS_MAX_ASSET_SIZE 512 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 185 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 186 | |
| 187 | /* |
| 188 | * Size of the ITS internal data transfer buffer |
| 189 | * (Default to the max asset size so that all requests can be handled in one iteration.) |
| 190 | */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 191 | #ifndef ITS_BUF_SIZE |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 192 | #define ITS_BUF_SIZE ITS_MAX_ASSET_SIZE |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 193 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 194 | |
| 195 | /* The maximum number of assets to be stored in the Internal Trusted Storage */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 196 | #ifndef ITS_NUM_ASSETS |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 197 | #define ITS_NUM_ASSETS 10 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 198 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 199 | |
| 200 | /* The stack size of the Internal Trusted Storage Secure Partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 201 | #ifndef ITS_STACK_SIZE |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 202 | #define ITS_STACK_SIZE 0x720 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 203 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 204 | |
Markus Swarowsky | 7de096f | 2023-03-16 10:32:02 +0100 | [diff] [blame] | 205 | /* The size of the authentication tag used when authentication/encryption of ITS files is enabled */ |
| 206 | #ifndef TFM_ITS_AUTH_TAG_LENGTH |
| 207 | #define TFM_ITS_AUTH_TAG_LENGTH 16 |
| 208 | #endif |
| 209 | |
Gabor Toth | dd6c405 | 2024-09-13 14:06:19 +0200 | [diff] [blame] | 210 | /* The size of the key used when authentication/encryption of ITS files is enabled */ |
| 211 | #ifndef TFM_ITS_KEY_LENGTH |
| 212 | #define TFM_ITS_KEY_LENGTH 16 |
| 213 | #endif |
| 214 | |
Markus Swarowsky | 7de096f | 2023-03-16 10:32:02 +0100 | [diff] [blame] | 215 | /* The size of the nonce used when ITS file encryption is enabled */ |
| 216 | #ifndef TFM_ITS_ENC_NONCE_LENGTH |
| 217 | #define TFM_ITS_ENC_NONCE_LENGTH 12 |
| 218 | #endif |
| 219 | |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 220 | /* PS Partition Configs */ |
| 221 | |
| 222 | /* Create flash FS if it doesn't exist for Protected Storage partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 223 | #ifndef PS_CREATE_FLASH_LAYOUT |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 224 | #define PS_CREATE_FLASH_LAYOUT 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 225 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 226 | |
| 227 | /* Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 228 | #ifndef PS_RAM_FS |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 229 | #define PS_RAM_FS 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 230 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 231 | |
| 232 | /* Enable rollback protection for Protected Storage partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 233 | #ifndef PS_ROLLBACK_PROTECTION |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 234 | #define PS_ROLLBACK_PROTECTION 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 235 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 236 | |
| 237 | /* Validate filesystem metadata every time it is read from flash */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 238 | #ifndef PS_VALIDATE_METADATA_FROM_FLASH |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 239 | #define PS_VALIDATE_METADATA_FROM_FLASH 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 240 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 241 | |
| 242 | /* The maximum asset size to be stored in the Protected Storage */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 243 | #ifndef PS_MAX_ASSET_SIZE |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 244 | #define PS_MAX_ASSET_SIZE 2048 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 245 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 246 | |
| 247 | /* The maximum number of assets to be stored in the Protected Storage */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 248 | #ifndef PS_NUM_ASSETS |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 249 | #define PS_NUM_ASSETS 10 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 250 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 251 | |
| 252 | /* The stack size of the Protected Storage Secure Partition */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 253 | #ifndef PS_STACK_SIZE |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 254 | #define PS_STACK_SIZE 0x700 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 255 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 256 | |
Chris Brand | 72ee4c6 | 2024-01-08 16:56:55 -0800 | [diff] [blame] | 257 | /* NS Agent Mailbox Partition Configs */ |
| 258 | |
Sherry Zhang | 415d713 | 2023-08-09 16:26:56 +0800 | [diff] [blame] | 259 | /* The stack size of the NS Agent Mailbox Secure Partition */ |
| 260 | #ifndef NS_AGENT_MAILBOX_STACK_SIZE |
| 261 | #define NS_AGENT_MAILBOX_STACK_SIZE 0x800 |
| 262 | #endif |
| 263 | |
Chris Brand | da938d8 | 2024-08-01 12:42:10 -0700 | [diff] [blame] | 264 | /* Whether the mailbox itself is in memory that is uncached in the SPE */ |
| 265 | #ifndef MAILBOX_IS_UNCACHED_S |
| 266 | #define MAILBOX_IS_UNCACHED_S 1 |
| 267 | #endif |
| 268 | |
| 269 | /* Whether the mailbox itself is in memory that is uncached in the NSPE */ |
| 270 | #ifndef MAILBOX_IS_UNCACHED_NS |
| 271 | #define MAILBOX_IS_UNCACHED_NS 1 |
| 272 | #endif |
| 273 | |
Jackson Cooper-Driver | 92f631c | 2024-10-08 13:46:42 +0000 | [diff] [blame] | 274 | /* Secure Test Partition Configs */ |
| 275 | #ifdef TFM_PARTITION_DPE |
| 276 | /* DPE tests require larger test partition stack */ |
| 277 | #define SECURE_TEST_PARTITION_STACK_SIZE 0x3000 |
| 278 | #else |
| 279 | #define SECURE_TEST_PARTITION_STACK_SIZE 0x0D00 |
| 280 | #endif |
| 281 | |
Chris Brand | 72ee4c6 | 2024-01-08 16:56:55 -0800 | [diff] [blame] | 282 | /* SPM Configs */ |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 283 | |
Xinyu Zhang | 9a6d90a | 2023-03-22 17:32:27 +0800 | [diff] [blame] | 284 | #ifdef CONFIG_TFM_CONNECTION_POOL_ENABLE |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 285 | /* The maximal number of secure services that are connected or requested at the same time */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 286 | #ifndef CONFIG_TFM_CONN_HANDLE_MAX_NUM |
Chris Brand | 80326b7 | 2023-03-15 13:07:49 -0700 | [diff] [blame] | 287 | #define CONFIG_TFM_CONN_HANDLE_MAX_NUM 8 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 288 | #endif |
Xinyu Zhang | 9a6d90a | 2023-03-22 17:32:27 +0800 | [diff] [blame] | 289 | #endif |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 290 | |
Xinyu Zhang | 44dbfa6 | 2022-11-23 14:22:32 +0800 | [diff] [blame] | 291 | /* Disable the doorbell APIs */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 292 | #ifndef CONFIG_TFM_DOORBELL_API |
Chris Brand | 80326b7 | 2023-03-15 13:07:49 -0700 | [diff] [blame] | 293 | #define CONFIG_TFM_DOORBELL_API 0 |
| 294 | #endif |
| 295 | |
| 296 | /* Do not run the scheduler after handling a secure interrupt if the NSPE was pre-empted */ |
| 297 | #ifndef CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED |
| 298 | #define CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 299 | #endif |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 300 | |
Sherry Zhang | f2a4f91 | 2023-09-12 15:38:12 +0800 | [diff] [blame] | 301 | /* Mask Non-Secure interrupts when executing in secure state. */ |
| 302 | #ifndef CONFIG_TFM_SECURE_THREAD_MASK_NS_INTERRUPT |
| 303 | #define CONFIG_TFM_SECURE_THREAD_MASK_NS_INTERRUPT 0 |
| 304 | #endif |
| 305 | |
Roman Mazurak | 96585b8 | 2024-04-03 14:35:00 +0300 | [diff] [blame] | 306 | /* |
| 307 | * tfm_hal_post_partition_init_hook is called if this option is enabled. |
| 308 | * It's called by SPM right before starting scheduler. |
| 309 | */ |
| 310 | #ifndef CONFIG_TFM_POST_PARTITION_INIT_HOOK |
| 311 | #define CONFIG_TFM_POST_PARTITION_INIT_HOOK 0 |
| 312 | #endif |
| 313 | |
Andrej Butok | 302da63 | 2023-07-14 12:57:08 +0200 | [diff] [blame] | 314 | /* Enable OTP/NV_COUNTERS emulation in RAM */ |
| 315 | #ifndef OTP_NV_COUNTERS_RAM_EMULATION |
| 316 | #define OTP_NV_COUNTERS_RAM_EMULATION 0 |
| 317 | #endif |
| 318 | |
Aziz IDOMAR | 8277288 | 2024-04-09 14:19:52 +0100 | [diff] [blame] | 319 | /* Error Codes Configs */ |
| 320 | |
| 321 | /* Enable unique error codes */ |
| 322 | #ifndef TFM_UNIQUE_ERROR_CODES |
| 323 | #define TFM_UNIQUE_ERROR_CODES 0 |
| 324 | #endif |
| 325 | |
Xinyu Zhang | a2fab0e | 2022-10-24 15:37:46 +0800 | [diff] [blame] | 326 | #endif /* __CONFIG_BASE_H__ */ |