-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathuser_settings.h
More file actions
318 lines (281 loc) · 7.55 KB
/
user_settings.h
File metadata and controls
318 lines (281 loc) · 7.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* user_settings.h
*
* Custom configuration for wolfCrypt/wolfSSL.
* Enabled via WOLFSSL_USER_SETTINGS.
*
*
* Copyright (C) 2025 wolfSSL Inc.
*
* This file is part of wolfBoot.
*
* wolfBoot is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wolfBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef H_USER_SETTINGS_
#define H_USER_SETTINGS_
#define WOLFBOOT_LOADER_MAIN
#define EXT_FLASH
#define NO_XIP
#define WOLFBOOT_DUALBOOT
/* For RSIP use, please enable the following line. */
/* #define WOLFBOOT_RENESAS_RSIP */
#define WOLFBOOT_SIGN_RSA2048
/* #define WOLFBOOT_SIGN_RSA3072 */
/* #define WOLFBOOT_SIGN_RSA4096 */
/* #define WOLFBOOT_SIGN_ED25519 */
/* #define WOLFBOOT_SIGN_ED488 */
/* #define WOLFBOOT_SIGN_ECC256 */
/* #define WOLFBOOT_SIGN_ECC384 */
/* #define WOLFBOOT_SIGN_ECC521 */
#ifdef WOLFBOOT_RENESAS_RSIP
#define WOLFSSL_RENESAS_RSIP
#define WOLFSSL_RENESAS_FSPSM
#define WOLFSSL_RENESAS_RSIP_CRYPTONLY
#undef WOLFSSL_RENESAS_FSPSM_TLS
#define WOLFSSL_RENESAS_FSPSM_CRYPTONLY
#define WOLFBOOT_SMALL_STACK
#define WOLF_CRYPTO_CB
#define RENESAS_RSIP_INSTALLEDKEY_FLASH_ADDR 0x60200000
#define RENESAS_RSIP_INSTALLEDKEY_RAM_ADDR 0x10000100
#define RENESAS_DEVID 7890
#define WOLFBOOT_DEVID_PUBKEY RENESAS_DEVID
#define WOLFBOOT_DEVID_CRYPT (RENESAS_DEVID + 1)
#if defined(WOLFBOOT_SIGN_RSA3072) ||\
defined(WOLFBOOT_SIGN_RSA4096) ||\
defined(WOLFBOOT_SIGN_ED25519) ||\
defined(WOLFBOOT_SIGN_ED488) ||\
defined(WOLFBOOT_SIGN_ECC256) ||\
defined(WOLFBOOT_SIGN_ECC384) ||\
defined(WOLFBOOT_SIGN_ECC521)
#error "wolfBoot with RSIP supports RSA 2048 only."
#endif
#endif
#define WOLFBOOT_HASH_SHA256
#define FLASHBUFFER_SIZE WOLFBOOT_SECTOR_SIZE
#define WC_NO_RNG_SIMPLE
#define WOLFSSL_SP_MATH_ALL /* for sp_int.c */
/* System */
#define WOLFSSL_GENERAL_ALIGNMENT 4
#define SINGLE_THREADED
#define WOLFCRYPT_ONLY
#define SIZEOF_LONG_LONG 8
#ifdef USE_FAST_MATH
# define WC_NO_HARDEN
#endif
#if defined(WOLFBOOT_SIGN_RSA2048) || defined(WOLFBOOT_SIGN_RSA3072) || defined(WOLFBOOT_SIGN_ED448)
#define IMAGE_HEADER_SIZE 512
#elif defined(WOLFBOOT_SIGN_RSA4096)
#define IMAGE_HEADER_SIZE 1024
#endif
/* ED25519 and SHA512 */
#ifdef WOLFBOOT_SIGN_ED25519
# define HAVE_ED25519
# define ED25519_SMALL
# define NO_ED25519_SIGN
# define NO_ED25519_EXPORT
# define WOLFSSL_SHA512
# define USE_SLOW_SHA512
# define NO_RSA
# define NO_ASN
#endif
/* ED448 */
#ifdef WOLFBOOT_SIGN_ED448
# define HAVE_ED448
# define HAVE_ED448_VERIFY
# define ED448_SMALL
# define NO_ED448_SIGN
# define NO_ED448_EXPORT
# define NO_RSA
# define NO_ASN
# define WOLFSSL_SHA3
# define WOLFSSL_SHAKE256
#endif
/* ECC and SHA256 */
#if defined (WOLFBOOT_SIGN_ECC256) ||\
defined (WOLFBOOT_SIGN_ECC384) ||\
defined (WOLFBOOT_SIGN_ECC521)
# define HAVE_ECC
# define ECC_TIMING_RESISTANT
/* Kinetis LTC support */
# ifdef FREESCALE_USE_LTC
# define LTC_MAX_ECC_BITS (256)
# define LTC_MAX_INT_BYTES (128)
# ifndef LTC_BASE
# define LTC_BASE ((LTC_Type *)LTC0_BASE)
# endif
# endif
/* SP MATH */
#ifndef WOLFSSL_NO_SW_MATH
# ifndef USE_FAST_MATH
# define WOLFSSL_SP
# define WOLFSSL_SP_MATH
# define WOLFSSL_SP_SMALL
# define SP_WORD_SIZE 32
# define WOLFSSL_HAVE_SP_ECC
# endif
#endif
/* ECC options disabled to reduce size */
# define NO_ECC_SIGN
# define NO_ECC_EXPORT
# define NO_ECC_DHE
# define NO_ECC_KEY_EXPORT
/* Curve */
# define NO_ECC192
# define NO_ECC224
#ifdef WOLFBOOT_SIGN_ECC256
# define HAVE_ECC256
# define FP_MAX_BITS (256 + 32)
# define NO_ECC384
# define NO_ECC521
#elif defined WOLFBOOT_SIGN_ECC384
# define HAVE_ECC384
# define FP_MAX_BITS (1024 + 32)
# define WOLFSSL_SP_384
# define WOLFSSL_SP_NO_256
# define NO_ECC256
# define NO_ECC521
#elif defined WOLFBOOT_SIGN_ECC521
# define HAVE_ECC521
# define FP_MAX_BITS (544 + 32)
# define NO_ECC256
# define NO_ECC384
#endif
# define NO_RSA
# define NO_ASN
#endif
#ifdef WOLFBOOT_SIGN_RSA2048
# define RSA_LOW_MEM
# define WOLFSSL_RSA_VERIFY_INLINE
# ifndef WOLFBOOT_RENESAS_RSIP
# define WOLFSSL_RSA_VERIFY_ONLY
# endif
# define WC_NO_RSA_OAEP
# define FP_MAX_BITS (2048 * 2)
/* sp math */
#ifndef WOLFSSL_NO_SW_MATH
# ifndef USE_FAST_MATH
# define WOLFSSL_HAVE_SP_RSA
# define WOLFSSL_SP
# define WOLFSSL_SP_SMALL
# define WOLFSSL_SP_MATH
# define SP_WORD_SIZE 32
# define WOLFSSL_SP_NO_3072
# define WOLFSSL_SP_NO_4096
# endif
#endif
#endif
#ifdef WOLFBOOT_SIGN_RSA3072
# define RSA_LOW_MEM
# define WOLFSSL_RSA_VERIFY_INLINE
# define WOLFSSL_RSA_VERIFY_ONLY
# define WC_NO_RSA_OAEP
# define FP_MAX_BITS (3072 * 2)
/* sp math */
#ifndef WOLFSSL_NO_SW_MATH
# ifndef USE_FAST_MATH
# define WOLFSSL_HAVE_SP_RSA
# define WOLFSSL_SP
# define WOLFSSL_SP_SMALL
# define WOLFSSL_SP_MATH
# define SP_WORD_SIZE 32
# define WOLFSSL_SP_NO_2048
# define WOLFSSL_SP_NO_4096
# endif
#endif
#endif
#ifdef WOLFBOOT_SIGN_RSA4096
# define RSA_LOW_MEM
# define WOLFSSL_RSA_VERIFY_INLINE
# define WOLFSSL_RSA_VERIFY_ONLY
# define WC_NO_RSA_OAEP
# define FP_MAX_BITS (4096 * 2)
/* sp math */
#ifndef WOLFSSL_NO_SW_MATH
# ifndef USE_FAST_MATH
# define WOLFSSL_HAVE_SP_RSA
# define WOLFSSL_SP
# define WOLFSSL_SP_SMALL
# define WOLFSSL_SP_MATH
# define SP_WORD_SIZE 32
# define WOLFSSL_SP_4096
# define WOLFSSL_SP_NO_2048
# define WOLFSSL_SP_NO_3072
# endif
#endif
#endif
#ifdef WOLFBOOT_HASH_SHA3_384
# define WOLFSSL_SHA3
# define NO_SHA256
#endif
#ifdef WOLFBOOT_HASH_SHA384
# define WOLFSSL_SHA384
# define NO_SHA256
#endif
#ifdef EXT_ENCRYPTED
# define HAVE_PWDBASED
#else
# define NO_PWDBASED
#endif
/* Disables - For minimum wolfCrypt build */
#ifndef WOLFBOOT_TPM
# if !defined(ENCRYPT_WITH_AES128) && !defined(ENCRYPT_WITH_AES256)
# define NO_AES
# endif
# define NO_HMAC
#endif
#define NO_CMAC
#define NO_CODING
#define WOLFSSL_NO_PEM
#define NO_ASN_TIME
#define NO_RC4
#define NO_SHA
#define NO_DH
#define NO_DSA
#define NO_MD4
#define NO_RABBIT
#define NO_MD5
#define NO_SIG_WRAPPER
#define NO_CERT
#define NO_SESSION_CACHE
#define NO_HC128
#define NO_DES3
#define WC_NO_RNG
#define WC_NO_HASHDRBG
#define NO_WRITEV
#define NO_DEV_RANDOM
#define NO_FILESYSTEM
#define NO_MAIN_DRIVER
#define NO_OLD_RNGNAME
#define NO_WOLFSSL_DIR
#define WOLFSSL_NO_SOCK
#define WOLFSSL_IGNORE_FILE_WARN
#define NO_ERROR_STRINGS
#define BENCH_EMBEDDED
#define NO_CRYPT_TEST
#define NO_CRYPT_BENCHMARK
#ifdef __QNX__
# define WOLFSSL_HAVE_MIN
# define WOLFSSL_HAVE_MAX
#endif
/* Memory model */
#ifndef WOLFBOOT_SMALL_STACK
# ifdef WOLFSSL_SP_MATH
# define WOLFSSL_SP_NO_MALLOC
# define WOLFSSL_SP_NO_DYN_STACK
# endif
# define WOLFSSL_NO_MALLOC
#else
# define WOLFSSL_SMALL_STACK
#endif
#endif /* !H_USER_SETTINGS_ */