1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __CONFIG_PROFILE_MEDIUM_H__
9 #define __CONFIG_PROFILE_MEDIUM_H__
10 
11 /* Platform Partition Configs */
12 
13 /* Size of input buffer in platform service */
14 #ifndef PLATFORM_SERVICE_INPUT_BUFFER_SIZE
15 #define PLATFORM_SERVICE_INPUT_BUFFER_SIZE     64
16 #endif
17 
18 /* Size of output buffer in platform service */
19 #ifndef PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE
20 #define PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE    64
21 #endif
22 
23 /* The stack size of the Platform Secure Partition */
24 #ifndef PLATFORM_SP_STACK_SIZE
25 #define PLATFORM_SP_STACK_SIZE                 0x500
26 #endif
27 
28 /* Disable Non-volatile counter module */
29 #ifndef PLATFORM_NV_COUNTER_MODULE_DISABLED
30 #define PLATFORM_NV_COUNTER_MODULE_DISABLED    0
31 #endif
32 
33 /* Crypto Partition Configs */
34 
35 /*
36  * Heap size for the crypto backend
37  * CRYPTO_ENGINE_BUF_SIZE needs to be >8KB for EC signing by attest module.
38  */
39 #ifndef CRYPTO_ENGINE_BUF_SIZE
40 #define CRYPTO_ENGINE_BUF_SIZE                 0x2080
41 #endif
42 
43 /* The max number of concurrent operations that can be active (allocated) at any time in Crypto */
44 #ifndef CRYPTO_CONC_OPER_NUM
45 #define CRYPTO_CONC_OPER_NUM                   8
46 #endif
47 
48 /* Enable PSA Crypto random number generator module */
49 #ifndef CRYPTO_RNG_MODULE_ENABLED
50 #define CRYPTO_RNG_MODULE_ENABLED              1
51 #endif
52 
53 /* Enable PSA Crypto Key module */
54 #ifndef CRYPTO_KEY_MODULE_ENABLED
55 #define CRYPTO_KEY_MODULE_ENABLED              1
56 #endif
57 
58 /* Enable PSA Crypto AEAD module */
59 #ifndef CRYPTO_AEAD_MODULE_ENABLED
60 #define CRYPTO_AEAD_MODULE_ENABLED             1
61 #endif
62 
63 /* Enable PSA Crypto MAC module */
64 #ifndef CRYPTO_MAC_MODULE_ENABLED
65 #define CRYPTO_MAC_MODULE_ENABLED              1
66 #endif
67 
68 /* Enable PSA Crypto Hash module */
69 #ifndef CRYPTO_HASH_MODULE_ENABLED
70 #define CRYPTO_HASH_MODULE_ENABLED             1
71 #endif
72 
73 /* Enable PSA Crypto Cipher module */
74 #ifndef CRYPTO_CIPHER_MODULE_ENABLED
75 #define CRYPTO_CIPHER_MODULE_ENABLED           1
76 #endif
77 
78 /* Enable PSA Crypto asymmetric key signature module */
79 #ifndef CRYPTO_ASYM_SIGN_MODULE_ENABLED
80 #define CRYPTO_ASYM_SIGN_MODULE_ENABLED        1
81 #endif
82 
83 /* Enable PSA Crypto asymmetric key encryption module */
84 #ifndef CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED
85 #define CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED     0
86 #endif
87 
88 /* Enable PSA Crypto key derivation module */
89 #ifndef CRYPTO_KEY_DERIVATION_MODULE_ENABLED
90 #define CRYPTO_KEY_DERIVATION_MODULE_ENABLED   1
91 #endif
92 
93 /* Default size of the internal scratch buffer used for PSA FF IOVec allocations */
94 #ifndef CRYPTO_IOVEC_BUFFER_SIZE
95 #define CRYPTO_IOVEC_BUFFER_SIZE               5120
96 #endif
97 
98 /* Use stored NV seed to provide entropy */
99 #ifndef CRYPTO_NV_SEED
100 #define CRYPTO_NV_SEED                         1
101 #endif
102 
103 /*
104  * Only enable multi-part operations in Hash, MAC, AEAD and symmetric ciphers,
105  * to optimize memory footprint in resource-constrained devices.
106  */
107 #ifndef CRYPTO_SINGLE_PART_FUNCS_DISABLED
108 #define CRYPTO_SINGLE_PART_FUNCS_DISABLED      0
109 #endif
110 
111 /* The stack size of the Crypto Secure Partition */
112 #ifndef CRYPTO_STACK_SIZE
113 #define CRYPTO_STACK_SIZE                      0x1B00
114 #endif
115 
116 /* FWU Partition Configs */
117 
118 /* Size of the FWU internal data transfer buffer */
119 #ifndef TFM_FWU_BUF_SIZE
120 #define TFM_FWU_BUF_SIZE                       PSA_FWU_MAX_WRITE_SIZE
121 #endif
122 
123 /* The stack size of the Firmware Update Secure Partition */
124 #ifndef FWU_STACK_SIZE
125 #define FWU_STACK_SIZE                         0x600
126 #endif
127 
128 /* Attest Partition Configs */
129 
130 /* Include optional claims in initial attestation token */
131 #ifndef ATTEST_INCLUDE_OPTIONAL_CLAIMS
132 #define ATTEST_INCLUDE_OPTIONAL_CLAIMS         0
133 #endif
134 
135 /* Include COSE key-id in initial attestation token */
136 #ifndef ATTEST_INCLUDE_COSE_KEY_ID
137 #define ATTEST_INCLUDE_COSE_KEY_ID             0
138 #endif
139 
140 /* The stack size of the Initial Attestation Secure Partition */
141 #ifndef ATTEST_STACK_SIZE
142 #define ATTEST_STACK_SIZE                      0x700
143 #endif
144 
145 /* Set the initial attestation token profile */
146 #ifndef ATTEST_TOKEN_PROFILE_PSA_IOT_1
147 #define ATTEST_TOKEN_PROFILE_PSA_IOT_1         1
148 #endif
149 
150 /* ITS Partition Configs */
151 
152 /* Create flash FS if it doesn't exist for Internal Trusted Storage partition */
153 #ifndef ITS_CREATE_FLASH_LAYOUT
154 #define ITS_CREATE_FLASH_LAYOUT                1
155 #endif
156 
157 /* Enable emulated RAM FS for platforms that don't have flash for Internal Trusted Storage partition */
158 #ifndef ITS_RAM_FS
159 #define ITS_RAM_FS                             0
160 #endif
161 
162 /* Validate filesystem metadata every time it is read from flash */
163 #ifndef ITS_VALIDATE_METADATA_FROM_FLASH
164 #define ITS_VALIDATE_METADATA_FROM_FLASH       1
165 #endif
166 
167 /* The maximum asset size to be stored in the Internal Trusted Storage */
168 #ifndef ITS_MAX_ASSET_SIZE
169 #define ITS_MAX_ASSET_SIZE                     512
170 #endif
171 
172 /* Size of the ITS internal data transfer buffer */
173 #ifndef ITS_BUF_SIZE
174 #define ITS_BUF_SIZE                           32
175 #endif
176 
177 /* The maximum number of assets to be stored in the Internal Trusted Storage */
178 #ifndef ITS_NUM_ASSETS
179 #define ITS_NUM_ASSETS                         10
180 #endif
181 
182 /* The stack size of the Internal Trusted Storage Secure Partition */
183 #ifndef ITS_STACK_SIZE
184 #define ITS_STACK_SIZE                         0x720
185 #endif
186 
187 /* PS Partition Configs */
188 
189 /* Create flash FS if it doesn't exist for Protected Storage partition */
190 #ifndef PS_CREATE_FLASH_LAYOUT
191 #define PS_CREATE_FLASH_LAYOUT                 1
192 #endif
193 
194 /* Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition */
195 #ifndef PS_RAM_FS
196 #define PS_RAM_FS                              0
197 #endif
198 
199 /* Enable rollback protection for Protected Storage partition */
200 #ifndef PS_ROLLBACK_PROTECTION
201 #define PS_ROLLBACK_PROTECTION                 1
202 #endif
203 
204 /* Validate filesystem metadata every time it is read from flash */
205 #ifndef PS_VALIDATE_METADATA_FROM_FLASH
206 #define PS_VALIDATE_METADATA_FROM_FLASH        1
207 #endif
208 
209 /* The maximum asset size to be stored in the Protected Storage */
210 #ifndef PS_MAX_ASSET_SIZE
211 #define PS_MAX_ASSET_SIZE                      2048
212 #endif
213 
214 /* The maximum number of assets to be stored in the Protected Storage */
215 #ifndef PS_NUM_ASSETS
216 #define PS_NUM_ASSETS                          10
217 #endif
218 
219 /* The stack size of the Protected Storage Secure Partition */
220 #ifndef PS_STACK_SIZE
221 #define PS_STACK_SIZE                          0x700
222 #endif
223 
224 /* The stack size of the NS Agent Mailbox Secure Partition */
225 #ifndef NS_AGENT_MAILBOX_STACK_SIZE
226 #define NS_AGENT_MAILBOX_STACK_SIZE            0x800
227 #endif
228 
229 /* SPM Partition Configs */
230 
231 /* The maximal number of secure services that are connected or requested at the same time */
232 #ifndef CONFIG_TFM_CONN_HANDLE_MAX_NUM
233 #define CONFIG_TFM_CONN_HANDLE_MAX_NUM         8
234 #endif
235 
236 /* Enable the doorbell APIs */
237 #ifndef CONFIG_TFM_DOORBELL_API
238 #define CONFIG_TFM_DOORBELL_API                1
239 #endif
240 
241 #endif /* __CONFIG_PROFILE_MEDIUM_H__ */
242