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