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 | |
114 | /* The stack size of the Crypto Secure Partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 115 | #ifndef CRYPTO_STACK_SIZE |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 116 | #define CRYPTO_STACK_SIZE 0x1B00 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 117 | #endif |
Xinyu Zhang | d755b82 | 2022-10-25 11:18:09 +0800 | [diff] [blame] | 118 | |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 119 | /* FWU Partition Configs */ |
120 | |||||
121 | /* Size of the FWU internal data transfer buffer */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 122 | #ifndef TFM_FWU_BUF_SIZE |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 123 | #define TFM_FWU_BUF_SIZE PSA_FWU_MAX_WRITE_SIZE |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 124 | #endif |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 125 | |
126 | /* The stack size of the Firmware Update Secure Partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 127 | #ifndef FWU_STACK_SIZE |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 128 | #define FWU_STACK_SIZE 0x600 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 129 | #endif |
Xinyu Zhang | ff65372 | 2022-10-27 14:17:36 +0800 | [diff] [blame] | 130 | |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 131 | /* Attest Partition Configs */ |
132 | |||||
133 | /* Include optional claims in initial attestation token */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 134 | #ifndef ATTEST_INCLUDE_OPTIONAL_CLAIMS |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 135 | #define ATTEST_INCLUDE_OPTIONAL_CLAIMS 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 136 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 137 | |
138 | /* Include COSE key-id in initial attestation token */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 139 | #ifndef ATTEST_INCLUDE_COSE_KEY_ID |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 140 | #define ATTEST_INCLUDE_COSE_KEY_ID 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 141 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 142 | |
143 | /* The stack size of the Initial Attestation Secure Partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 144 | #ifndef ATTEST_STACK_SIZE |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 145 | #define ATTEST_STACK_SIZE 0x700 |
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 | /* Set the initial attestation token profile */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 149 | #if (!ATTEST_TOKEN_PROFILE_PSA_IOT_1) && \ |
150 | (!ATTEST_TOKEN_PROFILE_PSA_2_0_0) && \ | ||||
151 | (!ATTEST_TOKEN_PROFILE_ARM_CCA) | ||||
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 152 | #define ATTEST_TOKEN_PROFILE_PSA_IOT_1 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 153 | #endif |
Xinyu Zhang | d15f99c | 2022-10-27 15:03:34 +0800 | [diff] [blame] | 154 | |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 155 | /* ITS Partition Configs */ |
156 | |||||
157 | /* 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] | 158 | #ifndef ITS_CREATE_FLASH_LAYOUT |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 159 | #define ITS_CREATE_FLASH_LAYOUT 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 160 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 161 | |
162 | /* 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] | 163 | #ifndef ITS_RAM_FS |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 164 | #define ITS_RAM_FS 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 165 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 166 | |
167 | /* Validate filesystem metadata every time it is read from flash */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 168 | #ifndef ITS_VALIDATE_METADATA_FROM_FLASH |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 169 | #define ITS_VALIDATE_METADATA_FROM_FLASH 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 | /* The maximum asset size to be stored in the Internal Trusted Storage */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 173 | #ifndef ITS_MAX_ASSET_SIZE |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 174 | #define ITS_MAX_ASSET_SIZE 512 |
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 | /* | ||||
178 | * Size of the ITS internal data transfer buffer | ||||
179 | * (Default to the max asset size so that all requests can be handled in one iteration.) | ||||
180 | */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 181 | #ifndef ITS_BUF_SIZE |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 182 | #define ITS_BUF_SIZE ITS_MAX_ASSET_SIZE |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 183 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 184 | |
185 | /* 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] | 186 | #ifndef ITS_NUM_ASSETS |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 187 | #define ITS_NUM_ASSETS 10 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 188 | #endif |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 189 | |
190 | /* The stack size of the Internal Trusted Storage Secure Partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 191 | #ifndef ITS_STACK_SIZE |
Xinyu Zhang | c8fc2c0 | 2022-10-31 12:13:45 +0800 | [diff] [blame] | 192 | #define ITS_STACK_SIZE 0x720 |
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 | |
Markus Swarowsky | 7de096f | 2023-03-16 10:32:02 +0100 | [diff] [blame] | 195 | /* The size of the authentication tag used when authentication/encryption of ITS files is enabled */ |
196 | #ifndef TFM_ITS_AUTH_TAG_LENGTH | ||||
197 | #define TFM_ITS_AUTH_TAG_LENGTH 16 | ||||
198 | #endif | ||||
199 | |||||
Bence Balogh | 49a0d7d | 2024-08-13 14:26:20 +0200 | [diff] [blame] | 200 | /* The size of the key used when authentication/encryption of ITS files is enabled */ |
201 | #ifndef TFM_ITS_KEY_LENGTH | ||||
202 | #define TFM_ITS_KEY_LENGTH 16 | ||||
203 | #endif | ||||
204 | |||||
Markus Swarowsky | 7de096f | 2023-03-16 10:32:02 +0100 | [diff] [blame] | 205 | /* The size of the nonce used when ITS file encryption is enabled */ |
206 | #ifndef TFM_ITS_ENC_NONCE_LENGTH | ||||
207 | #define TFM_ITS_ENC_NONCE_LENGTH 12 | ||||
208 | #endif | ||||
209 | |||||
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 210 | /* PS Partition Configs */ |
211 | |||||
212 | /* Create flash FS if it doesn't exist for Protected Storage partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 213 | #ifndef PS_CREATE_FLASH_LAYOUT |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 214 | #define PS_CREATE_FLASH_LAYOUT 1 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 215 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 216 | |
217 | /* 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] | 218 | #ifndef PS_RAM_FS |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 219 | #define PS_RAM_FS 0 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 220 | #endif |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 221 | |
222 | /* Enable rollback protection for Protected Storage partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 223 | #ifndef PS_ROLLBACK_PROTECTION |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 224 | #define PS_ROLLBACK_PROTECTION 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 | /* Validate filesystem metadata every time it is read from flash */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 228 | #ifndef PS_VALIDATE_METADATA_FROM_FLASH |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 229 | #define PS_VALIDATE_METADATA_FROM_FLASH 1 |
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 | /* The maximum asset size to be stored in the Protected Storage */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 233 | #ifndef PS_MAX_ASSET_SIZE |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 234 | #define PS_MAX_ASSET_SIZE 2048 |
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 | /* The maximum number of assets to be stored in the Protected Storage */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 238 | #ifndef PS_NUM_ASSETS |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 239 | #define PS_NUM_ASSETS 10 |
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 stack size of the Protected Storage Secure Partition */ | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 243 | #ifndef PS_STACK_SIZE |
Xinyu Zhang | 0715270 | 2022-10-31 12:35:49 +0800 | [diff] [blame] | 244 | #define PS_STACK_SIZE 0x700 |
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 | |
Chris Brand | 72ee4c6 | 2024-01-08 16:56:55 -0800 | [diff] [blame] | 247 | /* NS Agent Mailbox Partition Configs */ |
248 | |||||
Sherry Zhang | 415d713 | 2023-08-09 16:26:56 +0800 | [diff] [blame] | 249 | /* The stack size of the NS Agent Mailbox Secure Partition */ |
250 | #ifndef NS_AGENT_MAILBOX_STACK_SIZE | ||||
251 | #define NS_AGENT_MAILBOX_STACK_SIZE 0x800 | ||||
252 | #endif | ||||
253 | |||||
Chris Brand | 72ee4c6 | 2024-01-08 16:56:55 -0800 | [diff] [blame] | 254 | /* SPM Configs */ |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 255 | |
Xinyu Zhang | 9a6d90a | 2023-03-22 17:32:27 +0800 | [diff] [blame] | 256 | #ifdef CONFIG_TFM_CONNECTION_POOL_ENABLE |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 257 | /* 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] | 258 | #ifndef CONFIG_TFM_CONN_HANDLE_MAX_NUM |
Chris Brand | 80326b7 | 2023-03-15 13:07:49 -0700 | [diff] [blame] | 259 | #define CONFIG_TFM_CONN_HANDLE_MAX_NUM 8 |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 260 | #endif |
Xinyu Zhang | 9a6d90a | 2023-03-22 17:32:27 +0800 | [diff] [blame] | 261 | #endif |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 262 | |
Xinyu Zhang | 44dbfa6 | 2022-11-23 14:22:32 +0800 | [diff] [blame] | 263 | /* Disable the doorbell APIs */ |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 264 | #ifndef CONFIG_TFM_DOORBELL_API |
Chris Brand | 80326b7 | 2023-03-15 13:07:49 -0700 | [diff] [blame] | 265 | #define CONFIG_TFM_DOORBELL_API 0 |
266 | #endif | ||||
267 | |||||
268 | /* Do not run the scheduler after handling a secure interrupt if the NSPE was pre-empted */ | ||||
269 | #ifndef CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED | ||||
270 | #define CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED 0 | ||||
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 271 | #endif |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 272 | |
Sherry Zhang | f2a4f91 | 2023-09-12 15:38:12 +0800 | [diff] [blame] | 273 | /* Mask Non-Secure interrupts when executing in secure state. */ |
274 | #ifndef CONFIG_TFM_SECURE_THREAD_MASK_NS_INTERRUPT | ||||
275 | #define CONFIG_TFM_SECURE_THREAD_MASK_NS_INTERRUPT 0 | ||||
276 | #endif | ||||
277 | |||||
Andrej Butok | 302da63 | 2023-07-14 12:57:08 +0200 | [diff] [blame] | 278 | /* Enable OTP/NV_COUNTERS emulation in RAM */ |
279 | #ifndef OTP_NV_COUNTERS_RAM_EMULATION | ||||
280 | #define OTP_NV_COUNTERS_RAM_EMULATION 0 | ||||
281 | #endif | ||||
282 | |||||
Xinyu Zhang | a2fab0e | 2022-10-24 15:37:46 +0800 | [diff] [blame] | 283 | #endif /* __CONFIG_BASE_H__ */ |