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 14
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 SINGLE_THREADED
96 #endif
97 
98 
99 // <e>File System
100 #define MDK_CONF_FILESYSTEM 1
101 #if MDK_CONF_FILESYSTEM == 0
102 #define NO_FILESYSTEM
103 #else
104 #define WOLFSSL_KEIL_FS
105 #define NO_WOLFSSL_DIR
106 #endif
107 // </e>
108 
109 // <o> Network<0=>None <1=>RLnet <2=>User I/O
110 #define MDK_CONF_NETWORK 1
111 #if MDK_CONF_NETWORK == 0
112 #elif MDK_CONF_NETWORK == 1
113 #define WOLFSSL_KEIL_TCP_NET
114 #elif MDK_CONF_NETWORK == 2
115 #define WOLFSSL_USER_IO
116 #endif
117 
118 // <h>Debug options
119 
120 // <e>Debug Message
121 #define MDK_CONF_DebugMessage 0
122 #if MDK_CONF_DebugMessage == 1
123 #define DEBUG_WOLFSSL
124 #endif
125 // </e>
126 // <e>Check malloc
127 #define MDK_CONF_CheckMalloc 1
128 #if MDK_CONF_CheckMalloc == 1
129 #define WOLFSSL_MALLOC_CHECK
130 #define USE_WOLFSSL_MEMORY
131 #endif
132 // </e>
133 // <e>ErrNo.h
134 #define MDK_CONF_ErrNo 1
135 #if MDK_CONF_ErrNo == 1
136 #define HAVE_ERRNO
137 #endif
138 // </e>
139 // <e>Error Strings
140 #define MDK_CONF_ErrorStrings 1
141 #if MDK_CONF_ErrorStrings == 0
142 #define NO_ERROR_STRINGS
143 #endif
144 // </e>
145 
146 //</h>
147 //</h>
148 
149 // <h> wolfCrypt Configuration
150 
151 // <h>Hash/Crypt Algrithm
152 
153 // <e>MD2
154 #define MDK_CONF_MD2 0
155 #if MDK_CONF_MD2 == 1
156 #define WOLFSSL_MD2
157 #endif
158 // </e>
159 // <e>MD4
160 #define MDK_CONF_MD4 0
161 #if MDK_CONF_MD4 == 0
162 #define NO_MD4
163 #endif
164 // </e>
165 // <e>MD5
166 #define MDK_CONF_MD5 1
167 #if MDK_CONF_MD5 == 0
168 #define NO_MD5
169 #endif
170 // </e>
171 // <e>SHA
172 #define MDK_CONF_SHA 1
173 #if MDK_CONF_SHA == 0
174 #define NO_SHA
175 #endif
176 // </e>
177 // <e>SHA-256
178 #define MDK_CONF_SHA256 1
179 #if MDK_CONF_SHA256 == 0
180 #define NO_SHA256
181 #endif
182 // </e>
183 // <e>SHA-384
184 #define MDK_CONF_SHA384 1
185 #if MDK_CONF_SHA384 == 1
186 #define WOLFSSL_SHA384
187 #endif
188 // </e>
189 // <e>SHA-512
190 #define MDK_CONF_SHA512 1
191 #if MDK_CONF_SHA512 == 1
192 #define WOLFSSL_SHA512
193 #endif
194 // </e>
195 // <e>Hash DRBG
196 #define MDK_CONF_HASHDRBG 1
197 #if MDK_CONF_HASHDRBG == 1
198 #define HAVE_HASHDRBG
199 #endif
200 // </e>
201 // <e>RIPEMD
202 #define MDK_CONF_RIPEMD 1
203 #if MDK_CONF_RIPEMD == 1
204 #define WOLFSSL_RIPEMD
205 #endif
206 // </e>
207 // <e>BLAKE2
208 #define MDK_CONF_BLAKE2 0
209 #if MDK_CONF_BLAKE2 == 1
210 #define HAVE_BLAKE2
211 #endif
212 // </e>
213 // <e>HMAC
214 #define MDK_CONF_HMAC 1
215 #if MDK_CONF_HMAC == 0
216 #define NO_HMAC
217 #endif
218 // </e>
219 // <e>HMAC KDF
220 #define MDK_CONF_HKDF 1
221 #if MDK_CONF_HKDF == 1
222 #define HAVE_HKDF
223 #endif
224 // </e>
225 
226 // <e>AES CCM
227 #define MDK_CONF_AESCCM 1
228 #if MDK_CONF_AESCCM == 1
229 #define HAVE_AESCCM
230 #endif
231 // </e>
232 // <e>AES GCM
233 #define MDK_CONF_AESGCM 1
234 #if MDK_CONF_AESGCM == 1
235 #define HAVE_AESGCM
236 #endif
237 // </e>
238 
239 // <e>RC4
240 #define MDK_CONF_RC4 0
241 #if MDK_CONF_RC4 == 0
242 #define NO_RC4
243 #endif
244 // </e>
245 
246 // <e>HC128
247 #define MDK_CONF_HC128 1
248 #if MDK_CONF_HC128 == 0
249 #define NO_HC128
250 #endif
251 // </e>
252 
253 // <e>RABBIT
254 #define MDK_CONF_RABBIT 1
255 #if MDK_CONF_RABBIT == 0
256 #define NO_RABBIT
257 #endif
258 // </e>
259 
260 // <e>CHACHA
261 #define MDK_CONF_CHACHA 1
262 #if MDK_CONF_CHACHA == 1
263 #define HAVE_CHACHA
264 #endif
265 // </e>
266 
267 // <e>POLY1305
268 #define MDK_CONF_POLY1305 1
269 #if MDK_CONF_POLY1305 == 1
270 #define HAVE_POLY1305
271 #define HAVE_ONE_TIME_AUTH
272 #endif
273 // </e>
274 
275 // <e>DES3
276 #define MDK_CONF_DES3 1
277 #if MDK_CONF_DES3 == 0
278 #define NO_DES3
279 #endif
280 // </e>
281 
282 // <e>AES
283 #define MDK_CONF_AES 1
284 #if MDK_CONF_AES == 0
285 #define NO_AES
286 #endif
287 // </e>
288 
289 // <e>CAMELLIA
290 #define MDK_CONF_CAMELLIA 1
291 #if MDK_CONF_CAMELLIA == 1
292 #define HAVE_CAMELLIA
293 #endif
294 // </e>
295 
296 // <e>DH
297 #define MDK_CONF_DH 1
298 #if MDK_CONF_DH == 0
299 #define NO_DH
300 #endif
301 // </e>
302 // <e>DSA
303 #define MDK_CONF_DSA 1
304 #if MDK_CONF_DSA == 0
305 #define NO_DSA
306 #endif
307 // </e>
308 
309 // <e>SRP
310 #define MDK_CONF_SRP 1
311 #if MDK_CONF_SRP == 1
312 #define HAVE_SRP
313 #endif
314 // </e>
315 
316 // <e>PWDBASED
317 #define MDK_CONF_PWDBASED 1
318 #if MDK_CONF_PWDBASED == 0
319 #define NO_PWDBASED
320 #endif
321 // </e>
322 
323 // <e>ECC
324 #define MDK_CONF_ECC 1
325 #if MDK_CONF_ECC == 1
326 #define HAVE_ECC
327 #endif
328 // </e>
329 
330 // <e>CURVE25519
331 #define MDK_CONF_CURVE25519 1
332 #if MDK_CONF_CURVE25519 == 1
333 #define HAVE_CURVE25519
334 #define CURVED25519_SMALL
335 #endif
336 // </e>
337 // <e>CURVE25519 SMALL
338 #define MDK_CONF_CURVE25519_SMALL 0
339 #if MDK_CONF_CURVE25519_SMALL == 1
340 #define CURVED25519_SMALL
341 #endif
342 // </e>
343 // <e>ED25519
344 #define MDK_CONF_ED25519 1
345 #if MDK_CONF_ED25519 == 1
346 #define HAVE_ED25519
347 #endif
348 // </e>
349 // <e>ED25519 SMALL
350 #define MDK_CONF_ED25519_SMALL 0
351 #if MDK_CONF_ED25519_SMALL == 1
352 #define ED25519_SMALL
353 #endif
354 // </e>
355 // <e>PKCS7
356 #define MDK_CONF_PKCS7 0
357 #if MDK_CONF_PKCS7 == 1
358 #define HAVE_PKCS7
359 #endif
360 // </e>
361 
362 // <e>NTRU (need License, "crypto_ntru.h")
363 #define MDK_CONF_NTRU 0
364 #if MDK_CONF_NTRU == 1
365 #define HAVE_NTRU
366 #endif
367 // </e>
368 // </h>
369 
370 // <e>Random Seed, for TEST Only
371 #define MDK_CONF_RNDSEED 1
372 #if MDK_CONF_RNDSEED == 1
373 #define WOLFSSL_GENSEED_FORTEST
374 #endif
375 // </e>
376 
377 // <h>Hardware Crypt (See document for usage)
378 // <e>Hardware RNG
379 #define MDK_CONF_STM32F2_RNG 0
380 #if MDK_CONF_STM32F2_RNG == 1
381 #define WOLFSSL_STM32_CUBEMX
382 #define STM32_RNG
383 #define WC_ASYNC_DEV_SIZE 320+24
384 #define STM32_HAL_TIMEOUT 0xFF
385 
386 #if defined(STM32F2xx)
387 #define WOLFSSL_STM32F2
388 #elif defined(STM32F4xx)
389 #define WOLFSSL_STM32F4
390 #elif defined(STM32F7xx)
391 #define WOLFSSL_STM32F7
392 #endif
393 
394 #endif
395 // </e>
396 // <e>Hardware Crypt
397 #define MDK_CONF_STM32F2_CRYPTO 0
398 #if MDK_CONF_STM32F2_CRYPTO == 1
399 #define WOLFSSL_STM32_CUBEMX
400 #define STM32_CRYPTO
401 #define WC_ASYNC_DEV_SIZE 320+24
402 #define STM32_HAL_TIMEOUT 0xFF
403 
404 #if defined(STM32F2xx)
405 #define WOLFSSL_STM32F2
406 #elif defined(STM32F4xx)
407 #define WOLFSSL_STM32F4
408 #elif defined(STM32F7xx)
409 #define WOLFSSL_STM32F7
410 #endif
411 
412 #endif
413 // </e>
414 // <e>Hardware Hash
415 #define MDK_CONF_STM32F2_HASH 0
416 #if MDK_CONF_STM32F2_HASH == 1
417 #define WOLFSSL_STM32_CUBEMX
418 #define STM32_HASH
419 #define WC_ASYNC_DEV_SIZE 320+24
420 #define STM32_HAL_TIMEOUT 0xFF
421 
422 #if defined(STM32F2xx)
423 #define WOLFSSL_STM32F2
424 #elif defined(STM32F4xx)
425 #define WOLFSSL_STM32F4
426 #elif defined(STM32F7xx)
427 #define WOLFSSL_STM32F7
428 #endif
429 
430 #endif
431 // </e>
432 // </h>
433 
434 // <h>Cert/Key Strage
435 // <o>Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
436 #define MDK_CONF_CERT_BUFF 0
437 #if MDK_CONF_CERT_BUFF== 1
438 #define USE_CERT_BUFFERS_1024
439 #elif MDK_CONF_CERT_BUFF == 2
440 #define USE_CERT_BUFFERS_2048
441 #endif
442 //</h>
443 // <h>Cert/Key Generation
444 // <e>CertGen
445 #define MDK_CONF_CERT_GEN 0
446 #if MDK_CONF_CERT_GEN == 1
447 #define WOLFSSL_CERT_GEN
448 #endif
449 // </e>
450 // <e>KeyGen
451 #define MDK_CONF_KEY_GEN 0
452 #if MDK_CONF_KEY_GEN == 1
453 #define WOLFSSL_KEY_GEN
454 #endif
455 // </e>
456 // </h>
457 // <e>Use Fast Math
458 #define MDK_CONF_FASTMATH 1
459 #if MDK_CONF_FASTMATH == 1
460 #define USE_FAST_MATH
461 #define TFM_TIMING_RESISTANT
462 #endif
463 // </e>
464 // <e>Small Stack
465 #define MDK_CONF_SmallStack 1
466 #if MDK_CONF_SmallStack == 0
467 #define NO_WOLFSSL_SMALL_STACK
468 #endif
469 // </e>
470 
471 // </h>
472 
473 
474 /**** wolfSSL Configuration ****/
475 
476 // <h> wolfSSL Configuration
477 
478 // <e>TLS 1.3
479 #define MDK_CONF_TLS 1
480 #if MDK_CONF_TLS == 1
481 #define WOLFSSL_TLS13
482 #define HAVE_TLS_EXTENSIONS
483 #define HAVE_SUPPORTED_CURVES
484 #define WC_RSA_PSS
485 #define HAVE_HKDF
486 #define HAVE_FFDHE_2048
487 #endif
488 // </e>
489 
490 // <e>Include Old TLS
491 #define MDK_CONF_NO_OLDTLS 0
492 #if MDK_CONF_NO_OLDTLS == 0
493 #define NO_OLD_TLS
494 #endif
495 // </e>
496 // <e>CRL
497 #define MDK_CONF_CRL 0
498 #if MDK_CONF_CRL == 1
499 #define HAVE_CRL
500 #define WOLFSSL_DER_LOAD
501 #endif
502 // </e>
503 // <e>OCSP
504 #define MDK_CONF_OCSP 0
505 #if MDK_CONF_OCSP == 1
506 #define HAVE_OCSP
507 #endif
508 // </e>
509 // <e>OpenSSL Extra
510 #define MDK_CONF_OPENSSL_EXTRA 0
511 #if MDK_CONF_OPENSSL_EXTRA == 1
512 #define OPENSSL_EXTRA
513 #endif
514 // </e>
515 
516 //</h>