1 /* user_settings.h
2  *
3  * Copyright (C) 2006-2021 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 //  </h>
362 
363 //      <e>Random Seed, for TEST Only
364 #define MDK_CONF_RNDSEED 1
365 #if MDK_CONF_RNDSEED == 1
366 #define WOLFSSL_GENSEED_FORTEST
367 #endif
368 //  </e>
369 
370 //  <h>Hardware Crypt (See document for usage)
371 //      <e>Hardware RNG
372 #define MDK_CONF_STM32F2_RNG 0
373 #if MDK_CONF_STM32F2_RNG == 1
374 #define WOLFSSL_STM32_CUBEMX
375 #define STM32_RNG
376 #define WC_ASYNC_DEV_SIZE 320+24
377 #define STM32_HAL_TIMEOUT 0xFF
378 
379 #if defined(STM32F2xx)
380 #define WOLFSSL_STM32F2
381 #elif defined(STM32F4xx)
382 #define WOLFSSL_STM32F4
383 #elif defined(STM32F7xx)
384 #define WOLFSSL_STM32F7
385 #endif
386 
387 #endif
388 //  </e>
389 //      <e>Hardware Crypt
390 #define MDK_CONF_STM32F2_CRYPTO 0
391 #if MDK_CONF_STM32F2_CRYPTO == 1
392 #define WOLFSSL_STM32_CUBEMX
393 #define STM32_CRYPTO
394 #define WC_ASYNC_DEV_SIZE 320+24
395 #define STM32_HAL_TIMEOUT 0xFF
396 
397 #if defined(STM32F2xx)
398 #define WOLFSSL_STM32F2
399 #elif defined(STM32F4xx)
400 #define WOLFSSL_STM32F4
401 #elif defined(STM32F7xx)
402 #define WOLFSSL_STM32F7
403 #endif
404 
405 #endif
406 //  </e>
407 //      <e>Hardware Hash
408 #define MDK_CONF_STM32F2_HASH 0
409 #if MDK_CONF_STM32F2_HASH == 1
410 #define WOLFSSL_STM32_CUBEMX
411 #define STM32_HASH
412 #define WC_ASYNC_DEV_SIZE 320+24
413 #define STM32_HAL_TIMEOUT 0xFF
414 
415 #if defined(STM32F2xx)
416 #define WOLFSSL_STM32F2
417 #elif defined(STM32F4xx)
418 #define WOLFSSL_STM32F4
419 #elif defined(STM32F7xx)
420 #define WOLFSSL_STM32F7
421 #endif
422 
423 #endif
424 //  </e>
425 // </h>
426 
427 //  <h>Cert/Key Strage
428 //        <o>Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
429 #define MDK_CONF_CERT_BUFF 0
430 #if MDK_CONF_CERT_BUFF== 1
431 #define USE_CERT_BUFFERS_1024
432 #elif MDK_CONF_CERT_BUFF == 2
433 #define USE_CERT_BUFFERS_2048
434 #endif
435 //</h>
436 //  <h>Cert/Key Generation
437 //      <e>CertGen
438 #define MDK_CONF_CERT_GEN 0
439 #if MDK_CONF_CERT_GEN == 1
440 #define WOLFSSL_CERT_GEN
441 #endif
442 //  </e>
443 //      <e>KeyGen
444 #define MDK_CONF_KEY_GEN 0
445 #if MDK_CONF_KEY_GEN == 1
446 #define WOLFSSL_KEY_GEN
447 #endif
448 //  </e>
449 // </h>
450 //      <e>Use Fast Math
451 #define MDK_CONF_FASTMATH 1
452 #if MDK_CONF_FASTMATH == 1
453 #define USE_FAST_MATH
454 #define TFM_TIMING_RESISTANT
455 #endif
456 //  </e>
457 //      <e>Small Stack
458 #define MDK_CONF_SmallStack 1
459 #if MDK_CONF_SmallStack == 0
460 #define NO_WOLFSSL_SMALL_STACK
461 #endif
462 //  </e>
463 
464 //  </h>
465 
466 
467 /**** wolfSSL Configuration ****/
468 
469 // <h> wolfSSL Configuration
470 
471 //      <e>TLS 1.3
472 #define MDK_CONF_TLS 1
473 #if MDK_CONF_TLS == 1
474 #define WOLFSSL_TLS13
475 #define HAVE_TLS_EXTENSIONS
476 #define HAVE_SUPPORTED_CURVES
477 #define WC_RSA_PSS
478 #define HAVE_HKDF
479 #define HAVE_FFDHE_2048
480 #endif
481 //  </e>
482 
483 //      <e>Include Old TLS
484 #define MDK_CONF_NO_OLDTLS 0
485 #if MDK_CONF_NO_OLDTLS == 0
486 #define NO_OLD_TLS
487 #endif
488 //  </e>
489 //      <e>CRL
490 #define MDK_CONF_CRL 0
491 #if MDK_CONF_CRL == 1
492 #define HAVE_CRL
493 #define WOLFSSL_DER_LOAD
494 #endif
495 //  </e>
496 //      <e>OCSP
497 #define MDK_CONF_OCSP 0
498 #if MDK_CONF_OCSP == 1
499 #define HAVE_OCSP
500 #endif
501 //  </e>
502 //      <e>OpenSSL Extra
503 #define MDK_CONF_OPENSSL_EXTRA 0
504 #if MDK_CONF_OPENSSL_EXTRA == 1
505 #define OPENSSL_EXTRA
506 #endif
507 //  </e>
508 
509 //</h>
510