user_settings.h
1 /* user_settings.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 #define NO_MAIN_DRIVER
23 #define BENCH_EMBEDDED
24 #define NO_DEV_RANDOM
25 #define WOLFSSL_USER_CURRTIME
26 #define SIZEOF_LONG_LONG 8
27 #define NO_WRITEV
28 #define NO_DEV_RANDOM
29 
30 #define TFM_TIMING_RESISTANT
31 #define ECC_TIMING_RESISTANT
32 #define WC_RSA_BLINDING
33 
34 #define WOLFSSL_USER_CURRTIME /* for benchmark */
35 #define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
36 #define WOLFSSL_GMTIME
37 #define NO_MULTIBYTE_PRINT
38 
39 // <<< Use Configuration Wizard in Context Menu >>>
40 
41 
42 // <h>Common options
43 // <o> MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
44 #define MDK_CONF_MPU 3
45 #if MDK_CONF_MPU == 0
46 
47 #elif MDK_CONF_MPU == 1
48 #define WOLFSSL_STM32_CUBEMX
49 #define STM32F2xx
50 #elif MDK_CONF_MPU == 2
51 #define WOLFSSL_STM32_CUBEMX
52 #define STM32F4xx
53 #elif MDK_CONF_MPU == 3
54 #define WOLFSSL_STM32_CUBEMX
55 #define STM32F7xx
56 #endif
57 
58 // <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
59 // <5=>PThread <6=>ThreadX
60 // <7=>Micrium <8=>EBSnet <9=>MQX
61 // <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
62 // <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
63 #define MDK_CONF_THREAD 15
64 #if MDK_CONF_THREAD== 0
65 #define SINGLE_THREADED
66 #elif MDK_CONF_THREAD == 1
67 #define FREERTOS
68 #elif MDK_CONF_THREAD == 3
69 #define WOLFSSL_SAFERTOS
70 #elif MDK_CONF_THREAD == 4
71 #define USE_WINDOWS_API
72 #elif MDK_CONF_THREAD == 5
73 #define WOLFSSL_PTHREADS
74 #elif MDK_CONF_THREAD == 6
75 #define THREADX
76 #define NETX
77 #elif MDK_CONF_THREAD == 7
78 #define MICRIUM
79 #elif MDK_CONF_THREAD == 8
80 #define EBSNET
81 #elif MDK_CONF_THREAD == 9
82 #define FREESCALE_MQX
83 #define FREESCALE_KSDK_MQX
84 #elif MDK_CONF_THREAD == 10
85 #define WOLFSSL_TIRTOS
86 #elif MDK_CONF_THREAD == 11
87 #define WOLFSSL_uITRON4
88 #elif MDK_CONF_THREAD == 12
89 #define WOLFSSL_uTKERNEL2
90 #elif MDK_CONF_THREAD == 13
91 #define WOLFSSL_FROSTED
92 #elif MDK_CONF_THREAD == 14
93 #define WOLFSSL_CMSIS_RTOS
94 #elif MDK_CONF_THREAD == 15
95 #define WOLFSSL_CMSIS_RTOSv2
96 #elif MDK_CONF_THREAD == 16
97 #define SINGLE_THREADED
98 #endif
99 
100 
101 // <e>File System
102 #define MDK_CONF_FILESYSTEM 1
103 #if MDK_CONF_FILESYSTEM == 0
104 #define NO_FILESYSTEM
105 #else
106 #define WOLFSSL_KEIL_FS
107 #define NO_WOLFSSL_DIR
108 #endif
109 // </e>
110 
111 // <o> Network<0=>None <1=>RLnet <2=>User I/O
112 #define MDK_CONF_NETWORK 1
113 #if MDK_CONF_NETWORK == 0
114 #elif MDK_CONF_NETWORK == 1
115 #define WOLFSSL_KEIL_TCP_NET
116 #elif MDK_CONF_NETWORK == 2
117 #define WOLFSSL_USER_IO
118 #endif
119 
120 // <h>Debug options
121 
122 // <e>Debug Message
123 #define MDK_CONF_DebugMessage 0
124 #if MDK_CONF_DebugMessage == 1
125 #define DEBUG_WOLFSSL
126 #endif
127 // </e>
128 // <e>Check malloc
129 #define MDK_CONF_CheckMalloc 1
130 #if MDK_CONF_CheckMalloc == 1
131 #define WOLFSSL_MALLOC_CHECK
132 #define USE_WOLFSSL_MEMORY
133 #endif
134 // </e>
135 // <e>ErrNo.h
136 #define MDK_CONF_ErrNo 1
137 #if MDK_CONF_ErrNo == 1
138 #define HAVE_ERRNO
139 #endif
140 // </e>
141 // <e>Error Strings
142 #define MDK_CONF_ErrorStrings 1
143 #if MDK_CONF_ErrorStrings == 0
144 #define NO_ERROR_STRINGS
145 #endif
146 // </e>
147 
148 //</h>
149 //</h>
150 
151 // <h> wolfCrypt Configuration
152 
153 // <h>Hash/Crypt Algrithm
154 
155 // <e>MD2
156 #define MDK_CONF_MD2 0
157 #if MDK_CONF_MD2 == 1
158 #define WOLFSSL_MD2
159 #endif
160 // </e>
161 // <e>MD4
162 #define MDK_CONF_MD4 0
163 #if MDK_CONF_MD4 == 0
164 #define NO_MD4
165 #endif
166 // </e>
167 // <e>MD5
168 #define MDK_CONF_MD5 1
169 #if MDK_CONF_MD5 == 0
170 #define NO_MD5
171 #endif
172 // </e>
173 // <e>SHA
174 #define MDK_CONF_SHA 1
175 #if MDK_CONF_SHA == 0
176 #define NO_SHA
177 #endif
178 // </e>
179 // <e>SHA-256
180 #define MDK_CONF_SHA256 1
181 #if MDK_CONF_SHA256 == 0
182 #define NO_SHA256
183 #endif
184 // </e>
185 // <e>SHA-384
186 #define MDK_CONF_SHA384 1
187 #if MDK_CONF_SHA384 == 1
188 #define WOLFSSL_SHA384
189 #endif
190 // </e>
191 // <e>SHA-512
192 #define MDK_CONF_SHA512 1
193 #if MDK_CONF_SHA512 == 1
194 #define WOLFSSL_SHA512
195 #endif
196 // </e>
197 // <e>Hash DRBG
198 #define MDK_CONF_HASHDRBG 1
199 #if MDK_CONF_HASHDRBG == 1
200 #define HAVE_HASHDRBG
201 #endif
202 // </e>
203 // <e>RIPEMD
204 #define MDK_CONF_RIPEMD 1
205 #if MDK_CONF_RIPEMD == 1
206 #define WOLFSSL_RIPEMD
207 #endif
208 // </e>
209 // <e>BLAKE2
210 #define MDK_CONF_BLAKE2 0
211 #if MDK_CONF_BLAKE2 == 1
212 #define HAVE_BLAKE2
213 #endif
214 // </e>
215 // <e>HMAC
216 #define MDK_CONF_HMAC 1
217 #if MDK_CONF_HMAC == 0
218 #define NO_HMAC
219 #endif
220 // </e>
221 // <e>HMAC KDF
222 #define MDK_CONF_HKDF 1
223 #if MDK_CONF_HKDF == 1
224 #define HAVE_HKDF
225 #endif
226 // </e>
227 
228 // <e>AES CCM
229 #define MDK_CONF_AESCCM 1
230 #if MDK_CONF_AESCCM == 1
231 #define HAVE_AESCCM
232 #endif
233 // </e>
234 // <e>AES GCM
235 #define MDK_CONF_AESGCM 1
236 #if MDK_CONF_AESGCM == 1
237 #define HAVE_AESGCM
238 #endif
239 // </e>
240 
241 // <e>RC4
242 #define MDK_CONF_RC4 0
243 #if MDK_CONF_RC4 == 0
244 #define NO_RC4
245 #endif
246 // </e>
247 
248 // <e>HC128
249 #define MDK_CONF_HC128 1
250 #if MDK_CONF_HC128 == 0
251 #define NO_HC128
252 #endif
253 // </e>
254 
255 // <e>RABBIT
256 #define MDK_CONF_RABBIT 1
257 #if MDK_CONF_RABBIT == 0
258 #define NO_RABBIT
259 #endif
260 // </e>
261 
262 // <e>CHACHA
263 #define MDK_CONF_CHACHA 1
264 #if MDK_CONF_CHACHA == 1
265 #define HAVE_CHACHA
266 #endif
267 // </e>
268 
269 // <e>POLY1305
270 #define MDK_CONF_POLY1305 1
271 #if MDK_CONF_POLY1305 == 1
272 #define HAVE_POLY1305
273 #define HAVE_ONE_TIME_AUTH
274 #endif
275 // </e>
276 
277 // <e>DES3
278 #define MDK_CONF_DES3 1
279 #if MDK_CONF_DES3 == 0
280 #define NO_DES3
281 #endif
282 // </e>
283 
284 // <e>AES
285 #define MDK_CONF_AES 1
286 #if MDK_CONF_AES == 0
287 #define NO_AES
288 #endif
289 // </e>
290 
291 // <e>CAMELLIA
292 #define MDK_CONF_CAMELLIA 1
293 #if MDK_CONF_CAMELLIA == 1
294 #define HAVE_CAMELLIA
295 #endif
296 // </e>
297 
298 // <e>DH
299 #define MDK_CONF_DH 1
300 #if MDK_CONF_DH == 0
301 #define NO_DH
302 #endif
303 // </e>
304 // <e>DSA
305 #define MDK_CONF_DSA 1
306 #if MDK_CONF_DSA == 0
307 #define NO_DSA
308 #endif
309 // </e>
310 
311 // <e>SRP
312 #define MDK_CONF_SRP 1
313 #if MDK_CONF_SRP == 1
314 #define HAVE_SRP
315 #endif
316 // </e>
317 
318 // <e>PWDBASED
319 #define MDK_CONF_PWDBASED 1
320 #if MDK_CONF_PWDBASED == 0
321 #define NO_PWDBASED
322 #endif
323 // </e>
324 
325 // <e>ECC
326 #define MDK_CONF_ECC 1
327 #if MDK_CONF_ECC == 1
328 #define HAVE_ECC
329 #endif
330 // </e>
331 
332 // <e>CURVE25519
333 #define MDK_CONF_CURVE25519 1
334 #if MDK_CONF_CURVE25519 == 1
335 #define HAVE_CURVE25519
336 #define CURVED25519_SMALL
337 #endif
338 // </e>
339 // <e>CURVE25519 SMALL
340 #define MDK_CONF_CURVE25519_SMALL 0
341 #if MDK_CONF_CURVE25519_SMALL == 1
342 #define CURVED25519_SMALL
343 #endif
344 // </e>
345 // <e>ED25519
346 #define MDK_CONF_ED25519 1
347 #if MDK_CONF_ED25519 == 1
348 #define HAVE_ED25519
349 #endif
350 // </e>
351 // <e>ED25519 SMALL
352 #define MDK_CONF_ED25519_SMALL 0
353 #if MDK_CONF_ED25519_SMALL == 1
354 #define ED25519_SMALL
355 #endif
356 // </e>
357 // <e>PKCS7
358 #define MDK_CONF_PKCS7 0
359 #if MDK_CONF_PKCS7 == 1
360 #define HAVE_PKCS7
361 #endif
362 // </e>
363 
364 // <e>NTRU (need License, "crypto_ntru.h")
365 #define MDK_CONF_NTRU 0
366 #if MDK_CONF_NTRU == 1
367 #define HAVE_NTRU
368 #endif
369 // </e>
370 // </h>
371 
372 // <e>Random Seed, for TEST Only
373 #define MDK_CONF_RNDSEED 1
374 #if MDK_CONF_RNDSEED == 1
375 #define WOLFSSL_GENSEED_FORTEST
376 #endif
377 // </e>
378 
379 // <h>Hardware Crypt (See document for usage)
380 // <e>Hardware RNG
381 #define MDK_CONF_STM32F2_RNG 0
382 #if MDK_CONF_STM32F2_RNG == 1
383 #define WOLFSSL_STM32_CUBEMX
384 #define STM32_RNG
385 #define WC_ASYNC_DEV_SIZE 320+24
386 #define STM32_HAL_TIMEOUT 0xFF
387 
388 #if defined(STM32F2xx)
389 #define WOLFSSL_STM32F2
390 #elif defined(STM32F4xx)
391 #define WOLFSSL_STM32F4
392 #elif defined(STM32F7xx)
393 #define WOLFSSL_STM32F7
394 #endif
395 
396 #endif
397 // </e>
398 // <e>Hardware Crypt
399 #define MDK_CONF_STM32F2_CRYPTO 0
400 #if MDK_CONF_STM32F2_CRYPTO == 1
401 #define WOLFSSL_STM32_CUBEMX
402 #define STM32_CRYPTO
403 #define WC_ASYNC_DEV_SIZE 320+24
404 #define STM32_HAL_TIMEOUT 0xFF
405 
406 #if defined(STM32F2xx)
407 #define WOLFSSL_STM32F2
408 #elif defined(STM32F4xx)
409 #define WOLFSSL_STM32F4
410 #elif defined(STM32F7xx)
411 #define WOLFSSL_STM32F7
412 #endif
413 
414 #endif
415 // </e>
416 // <e>Hardware Hash
417 #define MDK_CONF_STM32F2_HASH 0
418 #if MDK_CONF_STM32F2_HASH == 1
419 #define WOLFSSL_STM32_CUBEMX
420 #define STM32_HASH
421 #define WC_ASYNC_DEV_SIZE 320+24
422 #define STM32_HAL_TIMEOUT 0xFF
423 
424 #if defined(STM32F2xx)
425 #define WOLFSSL_STM32F2
426 #elif defined(STM32F4xx)
427 #define WOLFSSL_STM32F4
428 #elif defined(STM32F7xx)
429 #define WOLFSSL_STM32F7
430 #endif
431 
432 #endif
433 // </e>
434 // </h>
435 
436 // <h>Cert/Key Strage
437 // <o>Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
438 #define MDK_CONF_CERT_BUFF 0
439 #if MDK_CONF_CERT_BUFF== 1
440 #define USE_CERT_BUFFERS_1024
441 #elif MDK_CONF_CERT_BUFF == 2
442 #define USE_CERT_BUFFERS_2048
443 #endif
444 //</h>
445 // <h>Cert/Key Generation
446 // <e>CertGen
447 #define MDK_CONF_CERT_GEN 0
448 #if MDK_CONF_CERT_GEN == 1
449 #define WOLFSSL_CERT_GEN
450 #endif
451 // </e>
452 // <e>KeyGen
453 #define MDK_CONF_KEY_GEN 0
454 #if MDK_CONF_KEY_GEN == 1
455 #define WOLFSSL_KEY_GEN
456 #endif
457 // </e>
458 // </h>
459 // <e>Use Fast Math
460 #define MDK_CONF_FASTMATH 1
461 #if MDK_CONF_FASTMATH == 1
462 #define USE_FAST_MATH
463 #define TFM_TIMING_RESISTANT
464 #endif
465 // </e>
466 // <e>Small Stack
467 #define MDK_CONF_SmallStack 1
468 #if MDK_CONF_SmallStack == 0
469 #define NO_WOLFSSL_SMALL_STACK
470 #endif
471 // </e>
472 
473 // </h>
474 
475 
476 /**** wolfSSL Configuration ****/
477 
478 // <h> wolfSSL Configuration
479 
480 // <e>TLS 1.3
481 #define MDK_CONF_TLS 1
482 #if MDK_CONF_TLS == 1
483 #define WOLFSSL_TLS13
484 #define HAVE_TLS_EXTENSIONS
485 #define HAVE_SUPPORTED_CURVES
486 #define WC_RSA_PSS
487 #define HAVE_HKDF
488 #define HAVE_FFDHE_2048
489 #endif
490 // </e>
491 
492 // <e>Include Old TLS
493 #define MDK_CONF_NO_OLDTLS 0
494 #if MDK_CONF_NO_OLDTLS == 0
495 #define NO_OLD_TLS
496 #endif
497 // </e>
498 // <e>CRL
499 #define MDK_CONF_CRL 0
500 #if MDK_CONF_CRL == 1
501 #define HAVE_CRL
502 #define WOLFSSL_DER_LOAD
503 #endif
504 // </e>
505 // <e>OCSP
506 #define MDK_CONF_OCSP 0
507 #if MDK_CONF_OCSP == 1
508 #define HAVE_OCSP
509 #endif
510 // </e>
511 // <e>OpenSSL Extra
512 #define MDK_CONF_OPENSSL_EXTRA 0
513 #if MDK_CONF_OPENSSL_EXTRA == 1
514 #define OPENSSL_EXTRA
515 #endif
516 // </e>
517 
518 //</h>