1 | /* settings.h
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2017 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 |
|
---|
23 | /* Place OS specific preprocessor flags, defines, includes here, will be
|
---|
24 | included into every file because types.h includes it */
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef WOLF_CRYPT_SETTINGS_H
|
---|
28 | #define WOLF_CRYPT_SETTINGS_H
|
---|
29 |
|
---|
30 | #ifdef __cplusplus
|
---|
31 | extern "C" {
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Uncomment next line if using IPHONE */
|
---|
35 | /* #define IPHONE */
|
---|
36 |
|
---|
37 | /* Uncomment next line if using ThreadX */
|
---|
38 | /* #define THREADX */
|
---|
39 |
|
---|
40 | /* Uncomment next line if using Micrium uC/OS-III */
|
---|
41 | /* #define MICRIUM */
|
---|
42 |
|
---|
43 | /* Uncomment next line if using Mbed */
|
---|
44 | /* #define MBED */
|
---|
45 |
|
---|
46 | /* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
---|
47 | /* #define MICROCHIP_PIC32 */
|
---|
48 |
|
---|
49 | /* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
---|
50 | /* #define MICROCHIP_TCPIP_V5 */
|
---|
51 |
|
---|
52 | /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
---|
53 | /* #define MICROCHIP_TCPIP */
|
---|
54 |
|
---|
55 | /* Uncomment next line if using PIC32MZ Crypto Engine */
|
---|
56 | /* #define WOLFSSL_MICROCHIP_PIC32MZ */
|
---|
57 |
|
---|
58 | /* Uncomment next line if using FreeRTOS */
|
---|
59 | /* #define FREERTOS */
|
---|
60 |
|
---|
61 | /* Uncomment next line if using FreeRTOS+ TCP */
|
---|
62 | /* #define FREERTOS_TCP */
|
---|
63 |
|
---|
64 | /* Uncomment next line if using FreeRTOS Windows Simulator */
|
---|
65 | /* #define FREERTOS_WINSIM */
|
---|
66 |
|
---|
67 | /* Uncomment next line if using RTIP */
|
---|
68 | /* #define EBSNET */
|
---|
69 |
|
---|
70 | /* Uncomment next line if using lwip */
|
---|
71 | /* #define WOLFSSL_LWIP */
|
---|
72 |
|
---|
73 | /* Uncomment next line if building wolfSSL for a game console */
|
---|
74 | /* #define WOLFSSL_GAME_BUILD */
|
---|
75 |
|
---|
76 | /* Uncomment next line if building wolfSSL for LSR */
|
---|
77 | /* #define WOLFSSL_LSR */
|
---|
78 |
|
---|
79 | /* Uncomment next line if building for Freescale Classic MQX version 4.0 */
|
---|
80 | /* #define FREESCALE_MQX_4_0 */
|
---|
81 |
|
---|
82 | /* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */
|
---|
83 | /* #define FREESCALE_MQX */
|
---|
84 |
|
---|
85 | /* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */
|
---|
86 | /* #define FREESCALE_KSDK_MQX */
|
---|
87 |
|
---|
88 | /* Uncomment next line if building for Freescale KSDK Bare Metal */
|
---|
89 | /* #define FREESCALE_KSDK_BM */
|
---|
90 |
|
---|
91 | /* Uncomment next line if building for Freescale KSDK FreeRTOS, */
|
---|
92 | /* (old name FREESCALE_FREE_RTOS) */
|
---|
93 | /* #define FREESCALE_KSDK_FREERTOS */
|
---|
94 |
|
---|
95 | /* Uncomment next line if using STM32F2 */
|
---|
96 | /* #define WOLFSSL_STM32F2 */
|
---|
97 |
|
---|
98 | /* Uncomment next line if using STM32F4 */
|
---|
99 | /* #define WOLFSSL_STM32F4 */
|
---|
100 |
|
---|
101 | /* Uncomment next line if using STM32FL */
|
---|
102 | /* #define WOLFSSL_STM32FL */
|
---|
103 |
|
---|
104 | /* Uncomment next line if using STM32F7 */
|
---|
105 | /* #define WOLFSSL_STM32F7 */
|
---|
106 |
|
---|
107 | /* Uncomment next line if using QL SEP settings */
|
---|
108 | /* #define WOLFSSL_QL */
|
---|
109 |
|
---|
110 | /* Uncomment next line if building for EROAD */
|
---|
111 | /* #define WOLFSSL_EROAD */
|
---|
112 |
|
---|
113 | /* Uncomment next line if building for IAR EWARM */
|
---|
114 | /* #define WOLFSSL_IAR_ARM */
|
---|
115 |
|
---|
116 | /* Uncomment next line if building for Rowley CrossWorks ARM */
|
---|
117 | /* #define WOLFSSL_ROWLEY_ARM */
|
---|
118 |
|
---|
119 | /* Uncomment next line if using TI-RTOS settings */
|
---|
120 | /* #define WOLFSSL_TIRTOS */
|
---|
121 |
|
---|
122 | /* Uncomment next line if building with PicoTCP */
|
---|
123 | /* #define WOLFSSL_PICOTCP */
|
---|
124 |
|
---|
125 | /* Uncomment next line if building for PicoTCP demo bundle */
|
---|
126 | /* #define WOLFSSL_PICOTCP_DEMO */
|
---|
127 |
|
---|
128 | /* Uncomment next line if building for uITRON4 */
|
---|
129 | /* #define WOLFSSL_uITRON4 */
|
---|
130 |
|
---|
131 | /* Uncomment next line if building for uT-Kernel */
|
---|
132 | /* #define WOLFSSL_uTKERNEL2 */
|
---|
133 |
|
---|
134 | /* Uncomment next line if using Max Strength build */
|
---|
135 | /* #define WOLFSSL_MAX_STRENGTH */
|
---|
136 |
|
---|
137 | /* Uncomment next line if building for VxWorks */
|
---|
138 | /* #define WOLFSSL_VXWORKS */
|
---|
139 |
|
---|
140 | /* Uncomment next line if building for Nordic nRF5x platofrm */
|
---|
141 | /* #define WOLFSSL_NRF5x */
|
---|
142 |
|
---|
143 | /* Uncomment next line to enable deprecated less secure static DH suites */
|
---|
144 | /* #define WOLFSSL_STATIC_DH */
|
---|
145 |
|
---|
146 | /* Uncomment next line to enable deprecated less secure static RSA suites */
|
---|
147 | /* #define WOLFSSL_STATIC_RSA */
|
---|
148 |
|
---|
149 | /* Uncomment next line if building for ARDUINO */
|
---|
150 | /* Uncomment both lines if building for ARDUINO on INTEL_GALILEO */
|
---|
151 | /* #define WOLFSSL_ARDUINO */
|
---|
152 | /* #define INTEL_GALILEO */
|
---|
153 |
|
---|
154 | /* Uncomment next line to enable asynchronous crypto WC_PENDING_E */
|
---|
155 | /* #define WOLFSSL_ASYNC_CRYPT */
|
---|
156 |
|
---|
157 | /* Uncomment next line if building for uTasker */
|
---|
158 | /* #define WOLFSSL_UTASKER */
|
---|
159 |
|
---|
160 | /* Uncomment next line if building for embOS */
|
---|
161 | /* #define WOLFSSL_EMBOS */
|
---|
162 |
|
---|
163 | /* Uncomment next line if building for RIOT-OS */
|
---|
164 | /* #define WOLFSSL_RIOT_OS */
|
---|
165 |
|
---|
166 | /* Uncomment next line if building for using XILINX hardened crypto */
|
---|
167 | /* #define WOLFSSL_XILINX_CRYPT */
|
---|
168 |
|
---|
169 | /* Uncomment next line if building for using XILINX */
|
---|
170 | /* #define WOLFSSL_XILINX */
|
---|
171 |
|
---|
172 | /* Uncomment next line if building for Nucleus 1.2 */
|
---|
173 | /* #define WOLFSSL_NUCLEUS_1_2 */
|
---|
174 |
|
---|
175 | /* Uncomment next line if building for using Apache mynewt */
|
---|
176 | /* #define WOLFSSL_APACHE_MYNEWT */
|
---|
177 |
|
---|
178 | /* Uncomment next line if building for using ESP-IDF */
|
---|
179 | /* #define WOLFSSL_ESPIDF */
|
---|
180 |
|
---|
181 | /* Uncomment next line if using Espressif ESP32-WROOM-32 */
|
---|
182 | /* #define WOLFSSL_ESPWROOM32 */
|
---|
183 |
|
---|
184 | #include <wolfssl/wolfcrypt/visibility.h>
|
---|
185 |
|
---|
186 | #ifdef WOLFSSL_USER_SETTINGS
|
---|
187 | #include "user_settings.h"
|
---|
188 | #endif
|
---|
189 |
|
---|
190 |
|
---|
191 | /* make sure old RNG name is used with CTaoCrypt FIPS */
|
---|
192 | #ifdef HAVE_FIPS
|
---|
193 | #define WC_RNG RNG
|
---|
194 | /* blinding adds API not available yet in FIPS mode */
|
---|
195 | #undef WC_RSA_BLINDING
|
---|
196 | #endif
|
---|
197 |
|
---|
198 |
|
---|
199 | #if defined(_WIN32) && !defined(_M_X64) && \
|
---|
200 | defined(HAVE_AESGCM) && defined(WOLFSSL_AESNI)
|
---|
201 |
|
---|
202 | /* The _M_X64 macro is what's used in the headers for MSC to tell if it
|
---|
203 | * has the 64-bit versions of the 128-bit integers available. If one is
|
---|
204 | * building on 32-bit Windows with AES-NI, turn off the AES-GCMloop
|
---|
205 | * unrolling. */
|
---|
206 |
|
---|
207 | #define AES_GCM_AESNI_NO_UNROLL
|
---|
208 | #endif
|
---|
209 |
|
---|
210 | #ifdef IPHONE
|
---|
211 | #define SIZEOF_LONG_LONG 8
|
---|
212 | #endif
|
---|
213 |
|
---|
214 | #ifdef THREADX
|
---|
215 | #define SIZEOF_LONG_LONG 8
|
---|
216 | #endif
|
---|
217 |
|
---|
218 | #ifdef HAVE_NETX
|
---|
219 | #ifdef NEED_THREADX_TYPES
|
---|
220 | #include <types.h>
|
---|
221 | #endif
|
---|
222 | #include <nx_api.h>
|
---|
223 | #endif
|
---|
224 |
|
---|
225 | #if defined(WOLFSSL_ESPIDF)
|
---|
226 | #define FREERTOS
|
---|
227 | #define WOLFSSL_LWIP
|
---|
228 | #define NO_WRITEV
|
---|
229 | #define SIZEOF_LONG_LONG 8
|
---|
230 | #define NO_WOLFSSL_DIR
|
---|
231 | #define WOLFSSL_NO_CURRDIR
|
---|
232 |
|
---|
233 | #define TFM_TIMING_RESISTANT
|
---|
234 | #define ECC_TIMING_RESISTANT
|
---|
235 | #define WC_RSA_BLINDING
|
---|
236 | #if !defined(WOLFSSL_USER_SETTINGS)
|
---|
237 | #define HAVE_ECC
|
---|
238 | #endif /* !WOLFSSL_USER_SETTINGS */
|
---|
239 | #endif /* WOLFSSL_ESPIDF */
|
---|
240 |
|
---|
241 | #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
|
---|
242 | #define WOLFSSL_LWIP
|
---|
243 | #define NO_WRITEV
|
---|
244 | #define SINGLE_THREADED
|
---|
245 | #define WOLFSSL_USER_IO
|
---|
246 | #define NO_FILESYSTEM
|
---|
247 | #endif
|
---|
248 |
|
---|
249 | #if defined(WOLFSSL_CONTIKI)
|
---|
250 | #include <contiki.h>
|
---|
251 | #define WOLFSSL_UIP
|
---|
252 | #define NO_WOLFSSL_MEMORY
|
---|
253 | #define NO_WRITEV
|
---|
254 | #define SINGLE_THREADED
|
---|
255 | #define WOLFSSL_USER_IO
|
---|
256 | #define NO_FILESYSTEM
|
---|
257 | #define CUSTOM_RAND_TYPE uint16_t
|
---|
258 | #define CUSTOM_RAND_GENERATE random_rand
|
---|
259 | static inline unsigned int LowResTimer(void)
|
---|
260 | {
|
---|
261 | return clock_seconds();
|
---|
262 | }
|
---|
263 | #endif
|
---|
264 |
|
---|
265 | #if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM)
|
---|
266 | #define NO_MAIN_DRIVER
|
---|
267 | #define SINGLE_THREADED
|
---|
268 | #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096)
|
---|
269 | #define USE_CERT_BUFFERS_1024
|
---|
270 | #endif
|
---|
271 | #define BENCH_EMBEDDED
|
---|
272 | #define NO_FILESYSTEM
|
---|
273 | #define NO_WRITEV
|
---|
274 | #define WOLFSSL_USER_IO
|
---|
275 | #define BENCH_EMBEDDED
|
---|
276 | #endif
|
---|
277 |
|
---|
278 | #ifdef MICROCHIP_PIC32
|
---|
279 | /* #define WOLFSSL_MICROCHIP_PIC32MZ */
|
---|
280 | #define SIZEOF_LONG_LONG 8
|
---|
281 | #define SINGLE_THREADED
|
---|
282 | #define WOLFSSL_USER_IO
|
---|
283 | #define NO_WRITEV
|
---|
284 | #define NO_DEV_RANDOM
|
---|
285 | #define NO_FILESYSTEM
|
---|
286 | #define USE_FAST_MATH
|
---|
287 | #define TFM_TIMING_RESISTANT
|
---|
288 | #define WOLFSSL_HAVE_MIN
|
---|
289 | #define WOLFSSL_HAVE_MAX
|
---|
290 | #define NO_BIG_INT
|
---|
291 | #endif
|
---|
292 |
|
---|
293 | #ifdef WOLFSSL_MICROCHIP_PIC32MZ
|
---|
294 | #ifndef NO_PIC32MZ_CRYPT
|
---|
295 | #define WOLFSSL_PIC32MZ_CRYPT
|
---|
296 | #endif
|
---|
297 | #ifndef NO_PIC32MZ_RNG
|
---|
298 | #define WOLFSSL_PIC32MZ_RNG
|
---|
299 | #endif
|
---|
300 | #ifndef NO_PIC32MZ_HASH
|
---|
301 | #define WOLFSSL_PIC32MZ_HASH
|
---|
302 | #endif
|
---|
303 | #endif
|
---|
304 |
|
---|
305 | #ifdef MICROCHIP_TCPIP_V5
|
---|
306 | /* include timer functions */
|
---|
307 | #include "TCPIP Stack/TCPIP.h"
|
---|
308 | #endif
|
---|
309 |
|
---|
310 | #ifdef MICROCHIP_TCPIP
|
---|
311 | /* include timer, NTP functions */
|
---|
312 | #ifdef MICROCHIP_MPLAB_HARMONY
|
---|
313 | #include "tcpip/tcpip.h"
|
---|
314 | #else
|
---|
315 | #include "system/system_services.h"
|
---|
316 | #include "tcpip/sntp.h"
|
---|
317 | #endif
|
---|
318 | #endif
|
---|
319 |
|
---|
320 | #ifdef MBED
|
---|
321 | #define WOLFSSL_USER_IO
|
---|
322 | #define NO_FILESYSTEM
|
---|
323 | #define NO_CERT
|
---|
324 | #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096)
|
---|
325 | #define USE_CERT_BUFFERS_1024
|
---|
326 | #endif
|
---|
327 | #define NO_WRITEV
|
---|
328 | #define NO_DEV_RANDOM
|
---|
329 | #define NO_SHA512
|
---|
330 | #define NO_DH
|
---|
331 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
332 | /* WOLFSSL_DH_CONST */
|
---|
333 | #define NO_DSA
|
---|
334 | #define NO_HC128
|
---|
335 | #define HAVE_ECC
|
---|
336 | #define NO_SESSION_CACHE
|
---|
337 | #define WOLFSSL_CMSIS_RTOS
|
---|
338 | #endif
|
---|
339 |
|
---|
340 |
|
---|
341 | #ifdef WOLFSSL_EROAD
|
---|
342 | #define FREESCALE_MQX
|
---|
343 | #define FREESCALE_MMCAU
|
---|
344 | #define SINGLE_THREADED
|
---|
345 | #define NO_STDIO_FILESYSTEM
|
---|
346 | #define WOLFSSL_LEANPSK
|
---|
347 | #define HAVE_NULL_CIPHER
|
---|
348 | #define NO_OLD_TLS
|
---|
349 | #define NO_ASN
|
---|
350 | #define NO_BIG_INT
|
---|
351 | #define NO_RSA
|
---|
352 | #define NO_DSA
|
---|
353 | #define NO_DH
|
---|
354 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
355 | /* WOLFSSL_DH_CONST */
|
---|
356 | #define NO_CERTS
|
---|
357 | #define NO_PWDBASED
|
---|
358 | #define NO_DES3
|
---|
359 | #define NO_MD4
|
---|
360 | #define NO_RC4
|
---|
361 | #define NO_MD5
|
---|
362 | #define NO_SESSION_CACHE
|
---|
363 | #define NO_MAIN_DRIVER
|
---|
364 | #endif
|
---|
365 |
|
---|
366 | #ifdef WOLFSSL_PICOTCP
|
---|
367 | #ifndef errno
|
---|
368 | #define errno pico_err
|
---|
369 | #endif
|
---|
370 | #include "pico_defines.h"
|
---|
371 | #include "pico_stack.h"
|
---|
372 | #include "pico_constants.h"
|
---|
373 | #include "pico_protocol.h"
|
---|
374 | #define CUSTOM_RAND_GENERATE pico_rand
|
---|
375 | #endif
|
---|
376 |
|
---|
377 | #ifdef WOLFSSL_PICOTCP_DEMO
|
---|
378 | #define WOLFSSL_STM32
|
---|
379 | #define USE_FAST_MATH
|
---|
380 | #define TFM_TIMING_RESISTANT
|
---|
381 | #define XMALLOC(s, h, type) PICO_ZALLOC((s))
|
---|
382 | #define XFREE(p, h, type) PICO_FREE((p))
|
---|
383 | #define SINGLE_THREADED
|
---|
384 | #define NO_WRITEV
|
---|
385 | #define WOLFSSL_USER_IO
|
---|
386 | #define NO_DEV_RANDOM
|
---|
387 | #define NO_FILESYSTEM
|
---|
388 | #endif
|
---|
389 |
|
---|
390 | #ifdef FREERTOS_WINSIM
|
---|
391 | #define FREERTOS
|
---|
392 | #define USE_WINDOWS_API
|
---|
393 | #endif
|
---|
394 |
|
---|
395 |
|
---|
396 | #ifdef WOLFSSL_VXWORKS
|
---|
397 | /* VxWorks simulator incorrectly detects building for i386 */
|
---|
398 | #ifdef VXWORKS_SIM
|
---|
399 | #define TFM_NO_ASM
|
---|
400 | #endif
|
---|
401 | /* For VxWorks pthreads wrappers for mutexes uncomment the next line. */
|
---|
402 | /* #define WOLFSSL_PTHREADS */
|
---|
403 | #define WOLFSSL_HAVE_MIN
|
---|
404 | #define WOLFSSL_HAVE_MAX
|
---|
405 | #define USE_FAST_MATH
|
---|
406 | #define TFM_TIMING_RESISTANT
|
---|
407 | #define NO_MAIN_DRIVER
|
---|
408 | #define NO_DEV_RANDOM
|
---|
409 | #define NO_WRITEV
|
---|
410 | #endif
|
---|
411 |
|
---|
412 |
|
---|
413 | #ifdef WOLFSSL_ARDUINO
|
---|
414 | #define NO_WRITEV
|
---|
415 | #define NO_WOLFSSL_DIR
|
---|
416 | #define SINGLE_THREADED
|
---|
417 | #define NO_DEV_RANDOM
|
---|
418 | #ifndef INTEL_GALILEO /* Galileo has time.h compatibility */
|
---|
419 | #define TIME_OVERRIDES /* must define XTIME and XGMTIME externally */
|
---|
420 | #endif
|
---|
421 | #define WOLFSSL_USER_IO
|
---|
422 | #define HAVE_ECC
|
---|
423 | #define NO_DH
|
---|
424 | #define NO_SESSION_CACHE
|
---|
425 | #define USE_SLOW_SHA
|
---|
426 | #define NO_WOLFSSL_SERVER
|
---|
427 | #define NO_ERROR_STRINGS
|
---|
428 | #endif
|
---|
429 |
|
---|
430 |
|
---|
431 | #ifdef WOLFSSL_UTASKER
|
---|
432 | /* uTasker configuration - used for fnRandom() */
|
---|
433 | #include "config.h"
|
---|
434 |
|
---|
435 | #define SINGLE_THREADED
|
---|
436 | #define NO_WOLFSSL_DIR
|
---|
437 | #define WOLFSSL_HAVE_MIN
|
---|
438 | #define NO_WRITEV
|
---|
439 |
|
---|
440 | #define HAVE_ECC
|
---|
441 | #define ALT_ECC_SIZE
|
---|
442 | #define USE_FAST_MATH
|
---|
443 | #define TFM_TIMING_RESISTANT
|
---|
444 | #define ECC_TIMING_RESISTANT
|
---|
445 |
|
---|
446 | /* used in wolfCrypt test */
|
---|
447 | #define NO_MAIN_DRIVER
|
---|
448 | #define USE_CERT_BUFFERS_2048
|
---|
449 |
|
---|
450 | /* uTasker port uses RAW sockets, use I/O callbacks
|
---|
451 | * See wolfSSL uTasker example for sample callbacks */
|
---|
452 | #define WOLFSSL_USER_IO
|
---|
453 |
|
---|
454 | /* uTasker filesystem not ported */
|
---|
455 | #define NO_FILESYSTEM
|
---|
456 |
|
---|
457 | /* uTasker RNG is abstracted, calls HW RNG when available */
|
---|
458 | #define CUSTOM_RAND_GENERATE fnRandom
|
---|
459 | #define CUSTOM_RAND_TYPE unsigned short
|
---|
460 |
|
---|
461 | /* user needs to define XTIME to function that provides
|
---|
462 | * seconds since Unix epoch */
|
---|
463 | #ifndef XTIME
|
---|
464 | #error XTIME must be defined in wolfSSL settings.h
|
---|
465 | /* #define XTIME fnSecondsSinceEpoch */
|
---|
466 | #endif
|
---|
467 |
|
---|
468 | /* use uTasker std library replacements where available */
|
---|
469 | #define STRING_USER
|
---|
470 | #define XMEMCPY(d,s,l) uMemcpy((d),(s),(l))
|
---|
471 | #define XMEMSET(b,c,l) uMemset((b),(c),(l))
|
---|
472 | #define XMEMCMP(s1,s2,n) uMemcmp((s1),(s2),(n))
|
---|
473 | #define XMEMMOVE(d,s,l) memmove((d),(s),(l))
|
---|
474 |
|
---|
475 | #define XSTRLEN(s1) uStrlen((s1))
|
---|
476 | #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
|
---|
477 | #define XSTRSTR(s1,s2) strstr((s1),(s2))
|
---|
478 | #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
|
---|
479 | #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n))
|
---|
480 | #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n))
|
---|
481 | #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
|
---|
482 | #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN)
|
---|
483 | #define XSTRTOK strtok_r
|
---|
484 | #endif
|
---|
485 | #endif
|
---|
486 |
|
---|
487 | #ifdef WOLFSSL_EMBOS
|
---|
488 | #define NO_FILESYSTEM /* Not ported at this time */
|
---|
489 | #define USE_CERT_BUFFERS_2048 /* use when NO_FILESYSTEM */
|
---|
490 | #define NO_MAIN_DRIVER
|
---|
491 | #define NO_RC4
|
---|
492 | #define SINGLE_THREADED /* Not ported at this time */
|
---|
493 | #endif
|
---|
494 |
|
---|
495 | #ifdef WOLFSSL_RIOT_OS
|
---|
496 | #define NO_WRITEV
|
---|
497 | #define TFM_NO_ASM
|
---|
498 | #define USE_FAST_MATH
|
---|
499 | #define NO_FILESYSTEM
|
---|
500 | #define USE_CERT_BUFFERS_2048
|
---|
501 | #endif
|
---|
502 |
|
---|
503 | #ifdef WOLFSSL_CHIBIOS
|
---|
504 | /* ChibiOS definitions. This file is distributed with chibiOS. */
|
---|
505 | #include "wolfssl_chibios.h"
|
---|
506 | #endif
|
---|
507 |
|
---|
508 | #ifdef WOLFSSL_PB
|
---|
509 | /* PB is using older 1.2 version of Nucleus */
|
---|
510 | #undef WOLFSSL_NUCLEUS
|
---|
511 | #define WOLFSSL_NUCLEUS_1_2
|
---|
512 | #endif
|
---|
513 |
|
---|
514 | #ifdef WOLFSSL_NUCLEUS_1_2
|
---|
515 | #define NO_WRITEV
|
---|
516 | #define NO_WOLFSSL_DIR
|
---|
517 |
|
---|
518 | #if !defined(NO_ASN_TIME) && !defined(USER_TIME)
|
---|
519 | #error User must define XTIME, see manual
|
---|
520 | #endif
|
---|
521 |
|
---|
522 | #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER)
|
---|
523 | extern void* nucleus_malloc(unsigned long size, void* heap, int type);
|
---|
524 | extern void* nucleus_realloc(void* ptr, unsigned long size, void* heap,
|
---|
525 | int type);
|
---|
526 | extern void nucleus_free(void* ptr, void* heap, int type);
|
---|
527 |
|
---|
528 | #define XMALLOC(s, h, type) nucleus_malloc((s), (h), (type))
|
---|
529 | #define XREALLOC(p, n, h, t) nucleus_realloc((p), (n), (h), (t))
|
---|
530 | #define XFREE(p, h, type) nucleus_free((p), (h), (type))
|
---|
531 | #endif
|
---|
532 | #endif
|
---|
533 |
|
---|
534 | #ifdef WOLFSSL_NRF5x
|
---|
535 | #define SIZEOF_LONG 4
|
---|
536 | #define SIZEOF_LONG_LONG 8
|
---|
537 | #define NO_ASN_TIME
|
---|
538 | #define NO_DEV_RANDOM
|
---|
539 | #define NO_FILESYSTEM
|
---|
540 | #define NO_MAIN_DRIVER
|
---|
541 | #define NO_WRITEV
|
---|
542 | #define SINGLE_THREADED
|
---|
543 | #define USE_FAST_MATH
|
---|
544 | #define TFM_TIMING_RESISTANT
|
---|
545 | #define USE_WOLFSSL_MEMORY
|
---|
546 | #define WOLFSSL_NRF51
|
---|
547 | #define WOLFSSL_USER_IO
|
---|
548 | #define NO_SESSION_CACHE
|
---|
549 | #endif
|
---|
550 |
|
---|
551 | /* Micrium will use Visual Studio for compilation but not the Win32 API */
|
---|
552 | #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \
|
---|
553 | !defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \
|
---|
554 | !defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS)
|
---|
555 | #define USE_WINDOWS_API
|
---|
556 | #endif
|
---|
557 |
|
---|
558 | #if defined(WOLFSSL_uITRON4)
|
---|
559 |
|
---|
560 | #define XMALLOC_USER
|
---|
561 | #include <stddef.h>
|
---|
562 | #define ITRON_POOL_SIZE 1024*20
|
---|
563 | extern int uITRON4_minit(size_t poolsz) ;
|
---|
564 | extern void *uITRON4_malloc(size_t sz) ;
|
---|
565 | extern void *uITRON4_realloc(void *p, size_t sz) ;
|
---|
566 | extern void uITRON4_free(void *p) ;
|
---|
567 |
|
---|
568 | #define XMALLOC(sz, heap, type) uITRON4_malloc(sz)
|
---|
569 | #define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz)
|
---|
570 | #define XFREE(p, heap, type) uITRON4_free(p)
|
---|
571 | #endif
|
---|
572 |
|
---|
573 | #if defined(WOLFSSL_uTKERNEL2)
|
---|
574 | #ifndef NO_TKERNEL_MEM_POOL
|
---|
575 | #define XMALLOC_OVERRIDE
|
---|
576 | int uTKernel_init_mpool(unsigned int sz); /* initializing malloc pool */
|
---|
577 | void* uTKernel_malloc(unsigned int sz);
|
---|
578 | void* uTKernel_realloc(void *p, unsigned int sz);
|
---|
579 | void uTKernel_free(void *p);
|
---|
580 | #define XMALLOC(s, h, type) uTKernel_malloc((s))
|
---|
581 | #define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n))
|
---|
582 | #define XFREE(p, h, type) uTKernel_free((p))
|
---|
583 | #endif
|
---|
584 |
|
---|
585 | #ifndef NO_STDIO_FGETS_REMAP
|
---|
586 | #include <stdio.h>
|
---|
587 | #include "tm/tmonitor.h"
|
---|
588 |
|
---|
589 | /* static char* gets(char *buff); */
|
---|
590 | static char* fgets(char *buff, int sz, XFILE fp) {
|
---|
591 | char * p = buff;
|
---|
592 | *p = '\0';
|
---|
593 | while (1) {
|
---|
594 | *p = tm_getchar(-1);
|
---|
595 | tm_putchar(*p);
|
---|
596 | if (*p == '\r') {
|
---|
597 | tm_putchar('\n');
|
---|
598 | *p = '\0';
|
---|
599 | break;
|
---|
600 | }
|
---|
601 | p++;
|
---|
602 | }
|
---|
603 | return buff;
|
---|
604 | }
|
---|
605 | #endif /* !NO_STDIO_FGETS_REMAP */
|
---|
606 | #endif
|
---|
607 |
|
---|
608 |
|
---|
609 | #if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER)
|
---|
610 | #include <stdlib.h>
|
---|
611 | #define XMALLOC(s, h, type) malloc((s))
|
---|
612 | #define XFREE(p, h, type) free((p))
|
---|
613 | #define XREALLOC(p, n, h, t) realloc((p), (n))
|
---|
614 | #endif
|
---|
615 |
|
---|
616 | #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
---|
617 | #undef XMALLOC
|
---|
618 | #define XMALLOC yaXMALLOC
|
---|
619 | #undef XFREE
|
---|
620 | #define XFREE yaXFREE
|
---|
621 | #undef XREALLOC
|
---|
622 | #define XREALLOC yaXREALLOC
|
---|
623 | #endif
|
---|
624 |
|
---|
625 |
|
---|
626 | #ifdef FREERTOS
|
---|
627 | #include "FreeRTOS.h"
|
---|
628 |
|
---|
629 | /* FreeRTOS pvPortRealloc() only in AVR32_UC3 port */
|
---|
630 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
|
---|
631 | !defined(WOLFSSL_STATIC_MEMORY)
|
---|
632 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
633 | #define XFREE(p, h, type) vPortFree((p))
|
---|
634 | #endif
|
---|
635 | #if defined(HAVE_ED25519) || defined(WOLFSSL_ESPIDF)
|
---|
636 | #define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n))
|
---|
637 | #endif
|
---|
638 | #ifndef NO_WRITEV
|
---|
639 | #define NO_WRITEV
|
---|
640 | #endif
|
---|
641 | #ifndef HAVE_SHA512
|
---|
642 | #ifndef NO_SHA512
|
---|
643 | #define NO_SHA512
|
---|
644 | #endif
|
---|
645 | #endif
|
---|
646 | #ifndef HAVE_DH
|
---|
647 | #ifndef NO_DH
|
---|
648 | #define NO_DH
|
---|
649 | #endif
|
---|
650 | #endif
|
---|
651 | #ifndef NO_DSA
|
---|
652 | #define NO_DSA
|
---|
653 | #endif
|
---|
654 | #ifndef NO_HC128
|
---|
655 | #define NO_HC128
|
---|
656 | #endif
|
---|
657 |
|
---|
658 | #ifndef SINGLE_THREADED
|
---|
659 | #include "semphr.h"
|
---|
660 | #endif
|
---|
661 | #endif
|
---|
662 |
|
---|
663 | #ifdef FREERTOS_TCP
|
---|
664 | #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \
|
---|
665 | !defined(WOLFSSL_STATIC_MEMORY)
|
---|
666 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
667 | #define XFREE(p, h, type) vPortFree((p))
|
---|
668 | #endif
|
---|
669 |
|
---|
670 | #define WOLFSSL_GENSEED_FORTEST
|
---|
671 |
|
---|
672 | #define NO_WOLFSSL_DIR
|
---|
673 | #define NO_WRITEV
|
---|
674 | #define USE_FAST_MATH
|
---|
675 | #define TFM_TIMING_RESISTANT
|
---|
676 | #define NO_MAIN_DRIVER
|
---|
677 | #endif
|
---|
678 |
|
---|
679 | #ifdef WOLFSSL_TIRTOS
|
---|
680 | #define SIZEOF_LONG_LONG 8
|
---|
681 | #define NO_WRITEV
|
---|
682 | #define NO_WOLFSSL_DIR
|
---|
683 | #define USE_FAST_MATH
|
---|
684 | #define TFM_TIMING_RESISTANT
|
---|
685 | #define ECC_TIMING_RESISTANT
|
---|
686 | #define WC_RSA_BLINDING
|
---|
687 | #define NO_DEV_RANDOM
|
---|
688 | #define NO_FILESYSTEM
|
---|
689 | #define USE_CERT_BUFFERS_2048
|
---|
690 | #define NO_ERROR_STRINGS
|
---|
691 | #define USER_TIME
|
---|
692 | #define HAVE_ECC
|
---|
693 | #define HAVE_ALPN
|
---|
694 | #define USE_WOLF_STRTOK /* use with HAVE_ALPN */
|
---|
695 | #define HAVE_TLS_EXTENSIONS
|
---|
696 | #define HAVE_AESGCM
|
---|
697 | #define HAVE_SUPPORTED_CURVES
|
---|
698 | #define ALT_ECC_SIZE
|
---|
699 |
|
---|
700 | #ifdef __IAR_SYSTEMS_ICC__
|
---|
701 | #pragma diag_suppress=Pa089
|
---|
702 | #elif !defined(__GNUC__)
|
---|
703 | /* Suppress the sslpro warning */
|
---|
704 | #pragma diag_suppress=11
|
---|
705 | #endif
|
---|
706 |
|
---|
707 | #include <ti/sysbios/hal/Seconds.h>
|
---|
708 | #endif
|
---|
709 |
|
---|
710 | #ifdef EBSNET
|
---|
711 | #include "rtip.h"
|
---|
712 |
|
---|
713 | /* #define DEBUG_WOLFSSL */
|
---|
714 | #define NO_WOLFSSL_DIR /* tbd */
|
---|
715 |
|
---|
716 | #if (POLLOS)
|
---|
717 | #define SINGLE_THREADED
|
---|
718 | #endif
|
---|
719 |
|
---|
720 | #if (RTPLATFORM)
|
---|
721 | #if (!RTP_LITTLE_ENDIAN)
|
---|
722 | #define BIG_ENDIAN_ORDER
|
---|
723 | #endif
|
---|
724 | #else
|
---|
725 | #if (!KS_LITTLE_ENDIAN)
|
---|
726 | #define BIG_ENDIAN_ORDER
|
---|
727 | #endif
|
---|
728 | #endif
|
---|
729 |
|
---|
730 | #if (WINMSP3)
|
---|
731 | #undef SIZEOF_LONG
|
---|
732 | #define SIZEOF_LONG_LONG 8
|
---|
733 | #else
|
---|
734 | #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
---|
735 | #endif
|
---|
736 |
|
---|
737 | #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
---|
738 | #define XFREE(p, h, type) (rtp_free(p))
|
---|
739 | #define XREALLOC(p, n, h, t) realloc((p), (n))
|
---|
740 |
|
---|
741 | #endif /* EBSNET */
|
---|
742 |
|
---|
743 | #ifdef WOLFSSL_GAME_BUILD
|
---|
744 | #define SIZEOF_LONG_LONG 8
|
---|
745 | #if defined(__PPU) || defined(__XENON)
|
---|
746 | #define BIG_ENDIAN_ORDER
|
---|
747 | #endif
|
---|
748 | #endif
|
---|
749 |
|
---|
750 | #ifdef WOLFSSL_LSR
|
---|
751 | #define HAVE_WEBSERVER
|
---|
752 | #define SIZEOF_LONG_LONG 8
|
---|
753 | #define WOLFSSL_LOW_MEMORY
|
---|
754 | #define NO_WRITEV
|
---|
755 | #define NO_SHA512
|
---|
756 | #define NO_DH
|
---|
757 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
758 | /* WOLFSSL_DH_CONST */
|
---|
759 | #define NO_DSA
|
---|
760 | #define NO_HC128
|
---|
761 | #define NO_DEV_RANDOM
|
---|
762 | #define NO_WOLFSSL_DIR
|
---|
763 | #define NO_RABBIT
|
---|
764 | #ifndef NO_FILESYSTEM
|
---|
765 | #define LSR_FS
|
---|
766 | #include "inc/hw_types.h"
|
---|
767 | #include "fs.h"
|
---|
768 | #endif
|
---|
769 | #define WOLFSSL_LWIP
|
---|
770 | #include <errno.h> /* for tcp errno */
|
---|
771 | #define WOLFSSL_SAFERTOS
|
---|
772 | #if defined(__IAR_SYSTEMS_ICC__)
|
---|
773 | /* enum uses enum */
|
---|
774 | #pragma diag_suppress=Pa089
|
---|
775 | #endif
|
---|
776 | #endif
|
---|
777 |
|
---|
778 | #ifdef WOLFSSL_SAFERTOS
|
---|
779 | #ifndef SINGLE_THREADED
|
---|
780 | #include "SafeRTOS/semphr.h"
|
---|
781 | #endif
|
---|
782 |
|
---|
783 | #include "SafeRTOS/heap.h"
|
---|
784 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
785 | #define XFREE(p, h, type) vPortFree((p))
|
---|
786 | #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
---|
787 | #endif
|
---|
788 |
|
---|
789 | #ifdef WOLFSSL_LOW_MEMORY
|
---|
790 | #undef RSA_LOW_MEM
|
---|
791 | #define RSA_LOW_MEM
|
---|
792 | #undef WOLFSSL_SMALL_STACK
|
---|
793 | #define WOLFSSL_SMALL_STACK
|
---|
794 | #undef TFM_TIMING_RESISTANT
|
---|
795 | #define TFM_TIMING_RESISTANT
|
---|
796 | #endif
|
---|
797 |
|
---|
798 | #ifdef FREESCALE_MQX_4_0
|
---|
799 | /* use normal Freescale MQX port, but with minor changes for 4.0 */
|
---|
800 | #define FREESCALE_MQX
|
---|
801 | #endif
|
---|
802 |
|
---|
803 | #ifdef FREESCALE_MQX
|
---|
804 | #define FREESCALE_COMMON
|
---|
805 | #include "mqx.h"
|
---|
806 | #ifndef NO_FILESYSTEM
|
---|
807 | #include "mfs.h"
|
---|
808 | #if MQX_USE_IO_OLD
|
---|
809 | #include "fio.h"
|
---|
810 | #define NO_STDIO_FILESYSTEM
|
---|
811 | #else
|
---|
812 | #include "nio.h"
|
---|
813 | #endif
|
---|
814 | #endif
|
---|
815 | #ifndef SINGLE_THREADED
|
---|
816 | #include "mutex.h"
|
---|
817 | #endif
|
---|
818 |
|
---|
819 | #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER)
|
---|
820 | #define XMALLOC_OVERRIDE
|
---|
821 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
---|
822 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
---|
823 | /* Note: MQX has no realloc, using fastmath above */
|
---|
824 | #endif
|
---|
825 | #endif
|
---|
826 |
|
---|
827 | #ifdef FREESCALE_KSDK_MQX
|
---|
828 | #define FREESCALE_COMMON
|
---|
829 | #include <mqx.h>
|
---|
830 | #ifndef NO_FILESYSTEM
|
---|
831 | #if MQX_USE_IO_OLD
|
---|
832 | #include <fio.h>
|
---|
833 | #else
|
---|
834 | #include <stdio.h>
|
---|
835 | #include <nio.h>
|
---|
836 | #endif
|
---|
837 | #endif
|
---|
838 | #ifndef SINGLE_THREADED
|
---|
839 | #include <mutex.h>
|
---|
840 | #endif
|
---|
841 |
|
---|
842 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
---|
843 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
---|
844 | #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
|
---|
845 |
|
---|
846 | #define MQX_FILE_PTR FILE *
|
---|
847 | #define IO_SEEK_SET SEEK_SET
|
---|
848 | #define IO_SEEK_END SEEK_END
|
---|
849 | #endif /* FREESCALE_KSDK_MQX */
|
---|
850 |
|
---|
851 | #if defined(FREESCALE_FREE_RTOS) || defined(FREESCALE_KSDK_FREERTOS)
|
---|
852 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
853 | /* WOLFSSL_DH_CONST */
|
---|
854 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
855 | /* WOLFSSL_DH_CONST */
|
---|
856 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
857 | /* WOLFSSL_DH_CONST */
|
---|
858 | #define NO_FILESYSTEM
|
---|
859 | #define WOLFSSL_CRYPT_HW_MUTEX 1
|
---|
860 |
|
---|
861 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY)
|
---|
862 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
863 | #define XFREE(p, h, type) vPortFree((p))
|
---|
864 | #endif
|
---|
865 |
|
---|
866 | //#define USER_TICKS
|
---|
867 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
868 | /* WOLFSSL_DH_CONST */
|
---|
869 | #define WOLFSSL_LWIP
|
---|
870 | #define FREERTOS_TCP
|
---|
871 |
|
---|
872 | #define FREESCALE_FREE_RTOS
|
---|
873 | #define FREERTOS_SOCKET_ERROR ( -1 )
|
---|
874 | #define FREERTOS_EWOULDBLOCK ( -2 )
|
---|
875 | #define FREERTOS_EINVAL ( -4 )
|
---|
876 | #define FREERTOS_EADDRNOTAVAIL ( -5 )
|
---|
877 | #define FREERTOS_EADDRINUSE ( -6 )
|
---|
878 | #define FREERTOS_ENOBUFS ( -7 )
|
---|
879 | #define FREERTOS_ENOPROTOOPT ( -8 )
|
---|
880 | #endif /* FREESCALE_FREE_RTOS || FREESCALE_KSDK_FREERTOS */
|
---|
881 |
|
---|
882 | #ifdef FREESCALE_KSDK_BM
|
---|
883 | #define FREESCALE_COMMON
|
---|
884 | #define WOLFSSL_USER_IO
|
---|
885 | #define SINGLE_THREADED
|
---|
886 | #define NO_FILESYSTEM
|
---|
887 | #ifndef TIME_OVERRIDES
|
---|
888 | #define USER_TICKS
|
---|
889 | #endif
|
---|
890 | #endif /* FREESCALE_KSDK_BM */
|
---|
891 |
|
---|
892 | #ifdef FREESCALE_COMMON
|
---|
893 | #define SIZEOF_LONG_LONG 8
|
---|
894 |
|
---|
895 | /* disable features */
|
---|
896 | #undef NO_WRITEV
|
---|
897 | #define NO_WRITEV
|
---|
898 | #undef NO_DEV_RANDOM
|
---|
899 | #define NO_DEV_RANDOM
|
---|
900 | #undef NO_RABBIT
|
---|
901 | #define NO_RABBIT
|
---|
902 | #undef NO_WOLFSSL_DIR
|
---|
903 | #define NO_WOLFSSL_DIR
|
---|
904 | #undef NO_RC4
|
---|
905 | #define NO_RC4
|
---|
906 |
|
---|
907 | /* enable features */
|
---|
908 | #undef USE_FAST_MATH
|
---|
909 | #define USE_FAST_MATH
|
---|
910 |
|
---|
911 | #define USE_CERT_BUFFERS_2048
|
---|
912 | #define BENCH_EMBEDDED
|
---|
913 |
|
---|
914 | #define TFM_TIMING_RESISTANT
|
---|
915 | #define ECC_TIMING_RESISTANT
|
---|
916 |
|
---|
917 | #undef HAVE_ECC
|
---|
918 | #define HAVE_ECC
|
---|
919 | #ifndef NO_AES
|
---|
920 | #undef HAVE_AESCCM
|
---|
921 | #define HAVE_AESCCM
|
---|
922 | #undef HAVE_AESGCM
|
---|
923 | #define HAVE_AESGCM
|
---|
924 | #undef WOLFSSL_AES_COUNTER
|
---|
925 | #define WOLFSSL_AES_COUNTER
|
---|
926 | #undef WOLFSSL_AES_DIRECT
|
---|
927 | #define WOLFSSL_AES_DIRECT
|
---|
928 | #endif
|
---|
929 |
|
---|
930 | #ifdef FREESCALE_KSDK_1_3
|
---|
931 | #include "fsl_device_registers.h"
|
---|
932 | #elif !defined(FREESCALE_MQX)
|
---|
933 | /* Classic MQX does not have fsl_common.h */
|
---|
934 | #include "fsl_common.h"
|
---|
935 | #endif
|
---|
936 |
|
---|
937 | /* random seed */
|
---|
938 | #define NO_OLD_RNGNAME
|
---|
939 | #if defined(FSL_FEATURE_SOC_TRNG_COUNT) && (FSL_FEATURE_SOC_TRNG_COUNT > 0)
|
---|
940 | #define FREESCALE_KSDK_2_0_TRNG
|
---|
941 | #elif defined(FSL_FEATURE_SOC_RNG_COUNT) && (FSL_FEATURE_SOC_RNG_COUNT > 0)
|
---|
942 | #ifdef FREESCALE_KSDK_1_3
|
---|
943 | #include "fsl_rnga_driver.h"
|
---|
944 | #define FREESCALE_RNGA
|
---|
945 | #define RNGA_INSTANCE (0)
|
---|
946 | #else
|
---|
947 | #define FREESCALE_KSDK_2_0_RNGA
|
---|
948 | #endif
|
---|
949 | #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS) && !defined(FREESCALE_KSDK_FREERTOS)
|
---|
950 | #define FREESCALE_RNGA
|
---|
951 | #define RNGA_INSTANCE (0)
|
---|
952 | /* defaulting to K70 RNGA, user should change if different */
|
---|
953 | /* #define FREESCALE_K53_RNGB */
|
---|
954 | #define FREESCALE_K70_RNGA
|
---|
955 | #endif
|
---|
956 |
|
---|
957 | /* HW crypto */
|
---|
958 | /* automatic enable based on Kinetis feature */
|
---|
959 | /* if case manual selection is required, for example for benchmarking purposes,
|
---|
960 | * just define FREESCALE_USE_MMCAU or FREESCALE_USE_LTC or none of these two macros (for software only)
|
---|
961 | * both can be enabled simultaneously as LTC has priority over MMCAU in source code.
|
---|
962 | */
|
---|
963 | /* #define FSL_HW_CRYPTO_MANUAL_SELECTION */
|
---|
964 | #ifndef FSL_HW_CRYPTO_MANUAL_SELECTION
|
---|
965 | #if defined(FSL_FEATURE_SOC_MMCAU_COUNT) && FSL_FEATURE_SOC_MMCAU_COUNT
|
---|
966 | #define FREESCALE_USE_MMCAU
|
---|
967 | #endif
|
---|
968 |
|
---|
969 | #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT
|
---|
970 | #define FREESCALE_USE_LTC
|
---|
971 | #endif
|
---|
972 | #else
|
---|
973 | /* #define FREESCALE_USE_MMCAU */
|
---|
974 | /* #define FREESCALE_USE_LTC */
|
---|
975 | #endif
|
---|
976 | #endif /* FREESCALE_COMMON */
|
---|
977 |
|
---|
978 | /* Classic pre-KSDK mmCAU library */
|
---|
979 | #ifdef FREESCALE_USE_MMCAU_CLASSIC
|
---|
980 | #define FREESCALE_USE_MMCAU
|
---|
981 | #define FREESCALE_MMCAU_CLASSIC
|
---|
982 | #define FREESCALE_MMCAU_CLASSIC_SHA
|
---|
983 | #endif
|
---|
984 |
|
---|
985 | /* KSDK mmCAU library */
|
---|
986 | #ifdef FREESCALE_USE_MMCAU
|
---|
987 | /* AES and DES */
|
---|
988 | #define FREESCALE_MMCAU
|
---|
989 | /* MD5, SHA-1 and SHA-256 */
|
---|
990 | #define FREESCALE_MMCAU_SHA
|
---|
991 | #endif /* FREESCALE_USE_MMCAU */
|
---|
992 |
|
---|
993 | #ifdef FREESCALE_USE_LTC
|
---|
994 | #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT
|
---|
995 | #define FREESCALE_LTC
|
---|
996 | #define LTC_BASE LTC0
|
---|
997 |
|
---|
998 | #if defined(FSL_FEATURE_LTC_HAS_DES) && FSL_FEATURE_LTC_HAS_DES
|
---|
999 | #define FREESCALE_LTC_DES
|
---|
1000 | #endif
|
---|
1001 |
|
---|
1002 | #if defined(FSL_FEATURE_LTC_HAS_GCM) && FSL_FEATURE_LTC_HAS_GCM
|
---|
1003 | #define FREESCALE_LTC_AES_GCM
|
---|
1004 | #endif
|
---|
1005 |
|
---|
1006 | #if defined(FSL_FEATURE_LTC_HAS_SHA) && FSL_FEATURE_LTC_HAS_SHA
|
---|
1007 | #define FREESCALE_LTC_SHA
|
---|
1008 | #endif
|
---|
1009 |
|
---|
1010 | #if defined(FSL_FEATURE_LTC_HAS_PKHA) && FSL_FEATURE_LTC_HAS_PKHA
|
---|
1011 | #define FREESCALE_LTC_ECC
|
---|
1012 | #define FREESCALE_LTC_TFM
|
---|
1013 |
|
---|
1014 | /* the LTC PKHA hardware limit is 2048 bits (256 bytes) for integer arithmetic.
|
---|
1015 | the LTC_MAX_INT_BYTES defines the size of local variables that hold big integers. */
|
---|
1016 | #ifndef LTC_MAX_INT_BYTES
|
---|
1017 | #define LTC_MAX_INT_BYTES (256)
|
---|
1018 | #endif
|
---|
1019 |
|
---|
1020 | /* This FREESCALE_LTC_TFM_RSA_4096_ENABLE macro can be defined.
|
---|
1021 | * In such a case both software and hardware algorithm
|
---|
1022 | * for TFM is linked in. The decision for which algorithm is used is determined at runtime
|
---|
1023 | * from size of inputs. If inputs and result can fit into LTC (see LTC_MAX_INT_BYTES)
|
---|
1024 | * then we call hardware algorithm, otherwise we call software algorithm.
|
---|
1025 | *
|
---|
1026 | * Chinese reminder theorem is used to break RSA 4096 exponentiations (both public and private key)
|
---|
1027 | * into several computations with 2048-bit modulus and exponents.
|
---|
1028 | */
|
---|
1029 | /* #define FREESCALE_LTC_TFM_RSA_4096_ENABLE */
|
---|
1030 |
|
---|
1031 | /* ECC-384, ECC-256, ECC-224 and ECC-192 have been enabled with LTC PKHA acceleration */
|
---|
1032 | #ifdef HAVE_ECC
|
---|
1033 | #undef ECC_TIMING_RESISTANT
|
---|
1034 | #define ECC_TIMING_RESISTANT
|
---|
1035 |
|
---|
1036 | /* the LTC PKHA hardware limit is 512 bits (64 bytes) for ECC.
|
---|
1037 | the LTC_MAX_ECC_BITS defines the size of local variables that hold ECC parameters
|
---|
1038 | and point coordinates */
|
---|
1039 | #ifndef LTC_MAX_ECC_BITS
|
---|
1040 | #define LTC_MAX_ECC_BITS (384)
|
---|
1041 | #endif
|
---|
1042 |
|
---|
1043 | /* Enable curves up to 384 bits */
|
---|
1044 | #if !defined(ECC_USER_CURVES) && !defined(HAVE_ALL_CURVES)
|
---|
1045 | #define ECC_USER_CURVES
|
---|
1046 | #define HAVE_ECC192
|
---|
1047 | #define HAVE_ECC224
|
---|
1048 | #undef NO_ECC256
|
---|
1049 | #define HAVE_ECC384
|
---|
1050 | #endif
|
---|
1051 | #endif
|
---|
1052 | #endif
|
---|
1053 | #endif
|
---|
1054 | #endif /* FREESCALE_USE_LTC */
|
---|
1055 |
|
---|
1056 | #ifdef FREESCALE_LTC_TFM_RSA_4096_ENABLE
|
---|
1057 | #undef USE_CERT_BUFFERS_4096
|
---|
1058 | #define USE_CERT_BUFFERS_4096
|
---|
1059 | #undef FP_MAX_BITS
|
---|
1060 | #define FP_MAX_BITS (8192)
|
---|
1061 |
|
---|
1062 | #undef NO_DH
|
---|
1063 | #define NO_DH
|
---|
1064 | #undef NO_DSA
|
---|
1065 | #define NO_DSA
|
---|
1066 | #endif /* FREESCALE_LTC_TFM_RSA_4096_ENABLE */
|
---|
1067 |
|
---|
1068 | /* if LTC has AES engine but doesn't have GCM, use software with LTC AES ECB mode */
|
---|
1069 | #if defined(FREESCALE_USE_LTC) && !defined(FREESCALE_LTC_AES_GCM)
|
---|
1070 | #define GCM_TABLE
|
---|
1071 | #endif
|
---|
1072 |
|
---|
1073 | #if defined(WOLFSSL_STM32F2) || defined(WOLFSSL_STM32F4) || \
|
---|
1074 | defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32F1) || \
|
---|
1075 | defined(WOLFSSL_STM32L4)
|
---|
1076 |
|
---|
1077 | #define SIZEOF_LONG_LONG 8
|
---|
1078 | #define NO_DEV_RANDOM
|
---|
1079 | #define NO_WOLFSSL_DIR
|
---|
1080 | #undef NO_RABBIT
|
---|
1081 | #define NO_RABBIT
|
---|
1082 | #ifndef NO_STM32_RNG
|
---|
1083 | #undef STM32_RNG
|
---|
1084 | #define STM32_RNG
|
---|
1085 | #ifdef WOLFSSL_STM32F427_RNG
|
---|
1086 | #include "stm32f427xx.h"
|
---|
1087 | #endif
|
---|
1088 | #endif
|
---|
1089 | #ifndef NO_STM32_CRYPTO
|
---|
1090 | #undef STM32_CRYPTO
|
---|
1091 | #define STM32_CRYPTO
|
---|
1092 |
|
---|
1093 | #ifdef WOLFSSL_STM32L4
|
---|
1094 | #define NO_AES_192 /* hardware does not support 192-bit */
|
---|
1095 | #endif
|
---|
1096 | #endif
|
---|
1097 | #ifndef NO_STM32_HASH
|
---|
1098 | #undef STM32_HASH
|
---|
1099 | #define STM32_HASH
|
---|
1100 | #endif
|
---|
1101 | #if !defined(__GNUC__) && !defined(__ICCARM__)
|
---|
1102 | #define KEIL_INTRINSICS
|
---|
1103 | #endif
|
---|
1104 | #define NO_OLD_RNGNAME
|
---|
1105 | #ifdef WOLFSSL_STM32_CUBEMX
|
---|
1106 | #if defined(WOLFSSL_STM32F2)
|
---|
1107 | #include "stm32f2xx_hal.h"
|
---|
1108 | #elif defined(WOLFSSL_STM32L4)
|
---|
1109 | #include "stm32l4xx_hal.h"
|
---|
1110 | #elif defined(WOLFSSL_STM32F4)
|
---|
1111 | #include "stm32f4xx_hal.h"
|
---|
1112 | #elif defined(WOLFSSL_STM32F7)
|
---|
1113 | #include "stm32f7xx_hal.h"
|
---|
1114 | #elif defined(WOLFSSL_STM32F1)
|
---|
1115 | #include "stm32f1xx_hal.h"
|
---|
1116 | #endif
|
---|
1117 |
|
---|
1118 | #ifndef STM32_HAL_TIMEOUT
|
---|
1119 | #define STM32_HAL_TIMEOUT 0xFF
|
---|
1120 | #endif
|
---|
1121 | #else
|
---|
1122 | #if defined(WOLFSSL_STM32F2)
|
---|
1123 | #include "stm32f2xx.h"
|
---|
1124 | #ifdef STM32_CRYPTO
|
---|
1125 | #include "stm32f2xx_cryp.h"
|
---|
1126 | #endif
|
---|
1127 | #ifdef STM32_HASH
|
---|
1128 | #include "stm32f2xx_hash.h"
|
---|
1129 | #endif
|
---|
1130 | #elif defined(WOLFSSL_STM32F4)
|
---|
1131 | #include "stm32f4xx.h"
|
---|
1132 | #ifdef STM32_CRYPTO
|
---|
1133 | #include "stm32f4xx_cryp.h"
|
---|
1134 | #endif
|
---|
1135 | #ifdef STM32_HASH
|
---|
1136 | #include "stm32f4xx_hash.h"
|
---|
1137 | #endif
|
---|
1138 | #elif defined(WOLFSSL_STM32L4)
|
---|
1139 | #include "stm32l4xx.h"
|
---|
1140 | #ifdef STM32_CRYPTO
|
---|
1141 | #include "stm32l4xx_cryp.h"
|
---|
1142 | #endif
|
---|
1143 | #ifdef STM32_HASH
|
---|
1144 | #include "stm32l4xx_hash.h"
|
---|
1145 | #endif
|
---|
1146 | #elif defined(WOLFSSL_STM32F7)
|
---|
1147 | #include "stm32f7xx.h"
|
---|
1148 | #elif defined(WOLFSSL_STM32F1)
|
---|
1149 | #include "stm32f1xx.h"
|
---|
1150 | #endif
|
---|
1151 | #endif /* WOLFSSL_STM32_CUBEMX */
|
---|
1152 | #endif /* WOLFSSL_STM32F2 || WOLFSSL_STM32F4 || WOLFSSL_STM32L4 || WOLFSSL_STM32F7 */
|
---|
1153 |
|
---|
1154 | #ifdef MICRIUM
|
---|
1155 | #include <stdlib.h>
|
---|
1156 | #include <os.h>
|
---|
1157 | #include <net_cfg.h>
|
---|
1158 | #include <net_sock.h>
|
---|
1159 | #include <net_err.h>
|
---|
1160 | #include <lib_mem.h>
|
---|
1161 | #include <lib_math.h>
|
---|
1162 |
|
---|
1163 | #define USE_FAST_MATH
|
---|
1164 | #define TFM_TIMING_RESISTANT
|
---|
1165 | #define ECC_TIMING_RESISTANT
|
---|
1166 | #define WC_RSA_BLINDING
|
---|
1167 | #define HAVE_HASHDRBG
|
---|
1168 |
|
---|
1169 | #define HAVE_ECC
|
---|
1170 | #define ALT_ECC_SIZE
|
---|
1171 | #define TFM_ECC192
|
---|
1172 | #define TFM_ECC224
|
---|
1173 | #define TFM_ECC256
|
---|
1174 | #define TFM_ECC384
|
---|
1175 | #define TFM_ECC521
|
---|
1176 |
|
---|
1177 | #define NO_RC4
|
---|
1178 | #define HAVE_TLS_EXTENSIONS
|
---|
1179 | #define HAVE_SUPPORTED_CURVES
|
---|
1180 | #define HAVE_EXTENDED_MASTER
|
---|
1181 |
|
---|
1182 | #define NO_WOLFSSL_DIR
|
---|
1183 | #define NO_WRITEV
|
---|
1184 |
|
---|
1185 | #ifndef CUSTOM_RAND_GENERATE
|
---|
1186 | #define CUSTOM_RAND_TYPE RAND_NBR
|
---|
1187 | #define CUSTOM_RAND_GENERATE Math_Rand
|
---|
1188 | #endif
|
---|
1189 | #define STRING_USER
|
---|
1190 | #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
---|
1191 | #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
---|
1192 | ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
---|
1193 | (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
---|
1194 | #define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
---|
1195 | ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
---|
1196 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
---|
1197 | #define XSTRNCASECMP(pstr_1, pstr_2, len_max) \
|
---|
1198 | ((CPU_INT16S)Str_CmpIgnoreCase_N((CPU_CHAR *)(pstr_1), \
|
---|
1199 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
---|
1200 | #define XSTRSTR(pstr, pstr_srch) \
|
---|
1201 | ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
---|
1202 | (CPU_CHAR *)(pstr_srch)))
|
---|
1203 | #define XSTRNSTR(pstr, pstr_srch, len_max) \
|
---|
1204 | ((CPU_CHAR *)Str_Str_N((CPU_CHAR *)(pstr), \
|
---|
1205 | (CPU_CHAR *)(pstr_srch),(CPU_SIZE_T)(len_max)))
|
---|
1206 | #define XSTRNCAT(pstr_dest, pstr_cat, len_max) \
|
---|
1207 | ((CPU_CHAR *)Str_Cat_N((CPU_CHAR *)(pstr_dest), \
|
---|
1208 | (const CPU_CHAR *)(pstr_cat),(CPU_SIZE_T)(len_max)))
|
---|
1209 | #define XMEMSET(pmem, data_val, size) \
|
---|
1210 | ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
---|
1211 | (CPU_SIZE_T)(size)))
|
---|
1212 | #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
---|
1213 | (void *)(psrc), (CPU_SIZE_T)(size)))
|
---|
1214 | #define XMEMCMP(pmem_1, pmem_2, size) \
|
---|
1215 | (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
---|
1216 | (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
---|
1217 | #define XMEMMOVE XMEMCPY
|
---|
1218 |
|
---|
1219 | #if (OS_CFG_MUTEX_EN == DEF_DISABLED)
|
---|
1220 | #define SINGLE_THREADED
|
---|
1221 | #endif
|
---|
1222 |
|
---|
1223 | #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
---|
1224 | #define BIG_ENDIAN_ORDER
|
---|
1225 | #else
|
---|
1226 | #undef BIG_ENDIAN_ORDER
|
---|
1227 | #define LITTLE_ENDIAN_ORDER
|
---|
1228 | #endif
|
---|
1229 | #endif /* MICRIUM */
|
---|
1230 |
|
---|
1231 |
|
---|
1232 | #ifdef WOLFSSL_QL
|
---|
1233 | #ifndef WOLFSSL_SEP
|
---|
1234 | #define WOLFSSL_SEP
|
---|
1235 | #endif
|
---|
1236 | #ifndef OPENSSL_EXTRA
|
---|
1237 | #define OPENSSL_EXTRA
|
---|
1238 | #endif
|
---|
1239 | #ifndef SESSION_CERTS
|
---|
1240 | #define SESSION_CERTS
|
---|
1241 | #endif
|
---|
1242 | #ifndef HAVE_AESCCM
|
---|
1243 | #define HAVE_AESCCM
|
---|
1244 | #endif
|
---|
1245 | #ifndef ATOMIC_USER
|
---|
1246 | #define ATOMIC_USER
|
---|
1247 | #endif
|
---|
1248 | #ifndef WOLFSSL_DER_LOAD
|
---|
1249 | #define WOLFSSL_DER_LOAD
|
---|
1250 | #endif
|
---|
1251 | #ifndef KEEP_PEER_CERT
|
---|
1252 | #define KEEP_PEER_CERT
|
---|
1253 | #endif
|
---|
1254 | #ifndef HAVE_ECC
|
---|
1255 | #define HAVE_ECC
|
---|
1256 | #endif
|
---|
1257 | #ifndef SESSION_INDEX
|
---|
1258 | #define SESSION_INDEX
|
---|
1259 | #endif
|
---|
1260 | #endif /* WOLFSSL_QL */
|
---|
1261 |
|
---|
1262 |
|
---|
1263 | #if defined(WOLFSSL_XILINX)
|
---|
1264 | #define USER_TIME /* XTIME in asn.c */
|
---|
1265 | #define NO_WOLFSSL_DIR
|
---|
1266 | #define NO_DEV_RANDOM
|
---|
1267 | #define HAVE_AESGCM
|
---|
1268 | #endif
|
---|
1269 |
|
---|
1270 | #if defined(WOLFSSL_XILINX_CRYPT)
|
---|
1271 | #if defined(WOLFSSL_ARMASM)
|
---|
1272 | #error can not use both ARMv8 instructions and XILINX hardened crypto
|
---|
1273 | #endif
|
---|
1274 | #if defined(WOLFSSL_SHA3)
|
---|
1275 | /* only SHA3-384 is supported */
|
---|
1276 | #undef WOLFSSL_NOSHA3_224
|
---|
1277 | #undef WOLFSSL_NOSHA3_256
|
---|
1278 | #undef WOLFSSL_NOSHA3_512
|
---|
1279 | #define WOLFSSL_NOSHA3_224
|
---|
1280 | #define WOLFSSL_NOSHA3_256
|
---|
1281 | #define WOLFSSL_NOSHA3_512
|
---|
1282 | #endif
|
---|
1283 | #endif /*(WOLFSSL_XILINX_CRYPT)*/
|
---|
1284 |
|
---|
1285 | #if defined(WOLFSSL_APACHE_MYNEWT)
|
---|
1286 | #include "os/os_malloc.h"
|
---|
1287 | #if !defined(WOLFSSL_LWIP)
|
---|
1288 | #include <mn_socket/mn_socket.h>
|
---|
1289 | #endif
|
---|
1290 |
|
---|
1291 | #if !defined(SIZEOF_LONG)
|
---|
1292 | #define SIZEOF_LONG 4
|
---|
1293 | #endif
|
---|
1294 | #if !defined(SIZEOF_LONG_LONG)
|
---|
1295 | #define SIZEOF_LONG_LONG 8
|
---|
1296 | #endif
|
---|
1297 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
---|
1298 | #define BIG_ENDIAN_ORDER
|
---|
1299 | #else
|
---|
1300 | #undef BIG_ENDIAN_ORDER
|
---|
1301 | #define LITTLE_ENDIAN_ORDER
|
---|
1302 | #endif
|
---|
1303 | #define NO_WRITEV
|
---|
1304 | #define WOLFSSL_USER_IO
|
---|
1305 | #define SINGLE_THREADED
|
---|
1306 | #define NO_DEV_RANDOM
|
---|
1307 | #define NO_DH
|
---|
1308 | #define NO_WOLFSSL_DIR
|
---|
1309 | #define NO_ERROR_STRINGS
|
---|
1310 | #define HAVE_ECC
|
---|
1311 | #define NO_SESSION_CACHE
|
---|
1312 | #define NO_ERROR_STRINGS
|
---|
1313 | #define XMALLOC_USER
|
---|
1314 | #define XMALLOC(sz, heap, type) os_malloc(sz)
|
---|
1315 | #define XREALLOC(p, sz, heap, type) os_realloc(p, sz)
|
---|
1316 | #define XFREE(p, heap, type) os_free(p)
|
---|
1317 |
|
---|
1318 | #endif /*(WOLFSSL_APACHE_MYNEWT)*/
|
---|
1319 |
|
---|
1320 | #ifdef WOLFSSL_IMX6
|
---|
1321 | #ifndef SIZEOF_LONG_LONG
|
---|
1322 | #define SIZEOF_LONG_LONG 8
|
---|
1323 | #endif
|
---|
1324 | #endif
|
---|
1325 |
|
---|
1326 | /* if defined turn on all CAAM support */
|
---|
1327 | #ifdef WOLFSSL_IMX6_CAAM
|
---|
1328 | #undef WOLFSSL_IMX6_CAAM_RNG
|
---|
1329 | #define WOLFSSL_IMX6_CAAM_RNG
|
---|
1330 |
|
---|
1331 | #undef WOLFSSL_IMX6_CAAM_BLOB
|
---|
1332 | #define WOLFSSL_IMX6_CAAM_BLOB
|
---|
1333 |
|
---|
1334 | #if defined(HAVE_AESGCM) || defined(WOLFSSL_AES_XTS)
|
---|
1335 | /* large performance gain with HAVE_AES_ECB defined */
|
---|
1336 | #undef HAVE_AES_ECB
|
---|
1337 | #define HAVE_AES_ECB
|
---|
1338 | #endif
|
---|
1339 | #endif
|
---|
1340 |
|
---|
1341 | #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
---|
1342 | !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) && \
|
---|
1343 | !defined(XMALLOC_OVERRIDE)
|
---|
1344 | #define USE_WOLFSSL_MEMORY
|
---|
1345 | #endif
|
---|
1346 |
|
---|
1347 |
|
---|
1348 | #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
---|
1349 | #undef KEEP_PEER_CERT
|
---|
1350 | #define KEEP_PEER_CERT
|
---|
1351 | #endif
|
---|
1352 |
|
---|
1353 |
|
---|
1354 | /* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
---|
1355 | #ifndef XSTREAM_ALIGN
|
---|
1356 | #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
---|
1357 | #define NO_XSTREAM_ALIGN
|
---|
1358 | #else
|
---|
1359 | #define XSTREAM_ALIGN
|
---|
1360 | #endif
|
---|
1361 | #endif
|
---|
1362 |
|
---|
1363 | /* write dup cannot be used with secure renegotiation because write dup
|
---|
1364 | * make write side write only and read side read only */
|
---|
1365 | #if defined(HAVE_WRITE_DUP) && defined(HAVE_SECURE_RENEGOTIATION)
|
---|
1366 | #error "WRITE DUP and SECURE RENEGOTIATION cannot both be on"
|
---|
1367 | #endif
|
---|
1368 |
|
---|
1369 | #ifdef WOLFSSL_SGX
|
---|
1370 | #ifdef _MSC_VER
|
---|
1371 | #define NO_RC4
|
---|
1372 | #ifndef HAVE_FIPS
|
---|
1373 | #define WOLFCRYPT_ONLY
|
---|
1374 | #define NO_DES3
|
---|
1375 | #define NO_SHA
|
---|
1376 | #define NO_MD5
|
---|
1377 | #else
|
---|
1378 | #define TFM_TIMING_RESISTANT
|
---|
1379 | #define NO_WOLFSSL_DIR
|
---|
1380 | #define NO_WRITEV
|
---|
1381 | #define NO_MAIN_DRIVER
|
---|
1382 | #define WOLFSSL_LOG_PRINTF
|
---|
1383 | #define WOLFSSL_DH_CONST
|
---|
1384 | #endif
|
---|
1385 | #else
|
---|
1386 | #define HAVE_ECC
|
---|
1387 | #define NO_WRITEV
|
---|
1388 | #define NO_MAIN_DRIVER
|
---|
1389 | #define USER_TICKS
|
---|
1390 | #define WOLFSSL_LOG_PRINTF
|
---|
1391 | #define WOLFSSL_DH_CONST
|
---|
1392 | #endif /* _MSC_VER */
|
---|
1393 | #if !defined(HAVE_FIPS) && !defined(NO_RSA)
|
---|
1394 | #define WC_RSA_BLINDING
|
---|
1395 | #endif
|
---|
1396 |
|
---|
1397 | #define NO_FILESYSTEM
|
---|
1398 | #define ECC_TIMING_RESISTANT
|
---|
1399 | #define TFM_TIMING_RESISTANT
|
---|
1400 | #define SINGLE_THREADED
|
---|
1401 | #define NO_ASN_TIME /* can not use headers such as windows.h */
|
---|
1402 | #define HAVE_AESGCM
|
---|
1403 | #define USE_CERT_BUFFERS_2048
|
---|
1404 | #define USE_FAST_MATH
|
---|
1405 | #endif /* WOLFSSL_SGX */
|
---|
1406 |
|
---|
1407 | /* FreeScale MMCAU hardware crypto has 4 byte alignment.
|
---|
1408 | However, KSDK fsl_mmcau.h gives API with no alignment
|
---|
1409 | requirements (4 byte alignment is managed internally by fsl_mmcau.c) */
|
---|
1410 | #ifdef FREESCALE_MMCAU
|
---|
1411 | #ifdef FREESCALE_MMCAU_CLASSIC
|
---|
1412 | #define WOLFSSL_MMCAU_ALIGNMENT 4
|
---|
1413 | #else
|
---|
1414 | #define WOLFSSL_MMCAU_ALIGNMENT 0
|
---|
1415 | #endif
|
---|
1416 | #endif
|
---|
1417 |
|
---|
1418 | /* if using hardware crypto and have alignment requirements, specify the
|
---|
1419 | requirement here. The record header of SSL/TLS will prevent easy alignment.
|
---|
1420 | This hint tries to help as much as possible. */
|
---|
1421 | #ifndef WOLFSSL_GENERAL_ALIGNMENT
|
---|
1422 | #ifdef WOLFSSL_AESNI
|
---|
1423 | #define WOLFSSL_GENERAL_ALIGNMENT 16
|
---|
1424 | #elif defined(XSTREAM_ALIGN)
|
---|
1425 | #define WOLFSSL_GENERAL_ALIGNMENT 4
|
---|
1426 | #elif defined(FREESCALE_MMCAU) || defined(FREESCALE_MMCAU_CLASSIC)
|
---|
1427 | #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT
|
---|
1428 | #else
|
---|
1429 | #define WOLFSSL_GENERAL_ALIGNMENT 0
|
---|
1430 | #endif
|
---|
1431 | #endif
|
---|
1432 |
|
---|
1433 | #if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0)
|
---|
1434 | #if defined(_MSC_VER)
|
---|
1435 | #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT))
|
---|
1436 | #elif defined(__GNUC__)
|
---|
1437 | #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT)))
|
---|
1438 | #else
|
---|
1439 | #define XGEN_ALIGN
|
---|
1440 | #endif
|
---|
1441 | #else
|
---|
1442 | #define XGEN_ALIGN
|
---|
1443 | #endif
|
---|
1444 |
|
---|
1445 | #ifdef HAVE_CRL
|
---|
1446 | /* not widely supported yet */
|
---|
1447 | #undef NO_SKID
|
---|
1448 | #define NO_SKID
|
---|
1449 | #endif
|
---|
1450 |
|
---|
1451 |
|
---|
1452 | #ifdef __INTEL_COMPILER
|
---|
1453 | #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */
|
---|
1454 | #endif
|
---|
1455 |
|
---|
1456 | /* user can specify what curves they want with ECC_USER_CURVES otherwise
|
---|
1457 | * all curves are on by default for now */
|
---|
1458 | #ifndef ECC_USER_CURVES
|
---|
1459 | #if !defined(WOLFSSL_SP_MATH) && !defined(HAVE_ALL_CURVES)
|
---|
1460 | #define HAVE_ALL_CURVES
|
---|
1461 | #endif
|
---|
1462 | #endif
|
---|
1463 |
|
---|
1464 | /* ECC Configs */
|
---|
1465 | #ifdef HAVE_ECC
|
---|
1466 | /* By default enable Sign, Verify, DHE, Key Import and Key Export unless explicitly disabled */
|
---|
1467 | #ifndef NO_ECC_SIGN
|
---|
1468 | #undef HAVE_ECC_SIGN
|
---|
1469 | #define HAVE_ECC_SIGN
|
---|
1470 | #endif
|
---|
1471 | #ifndef NO_ECC_VERIFY
|
---|
1472 | #undef HAVE_ECC_VERIFY
|
---|
1473 | #define HAVE_ECC_VERIFY
|
---|
1474 | #endif
|
---|
1475 | #ifndef NO_ECC_CHECK_KEY
|
---|
1476 | #undef HAVE_ECC_CHECK_KEY
|
---|
1477 | #define HAVE_ECC_CHECK_KEY
|
---|
1478 | #endif
|
---|
1479 | #ifndef NO_ECC_DHE
|
---|
1480 | #undef HAVE_ECC_DHE
|
---|
1481 | #define HAVE_ECC_DHE
|
---|
1482 | #endif
|
---|
1483 | #ifndef NO_ECC_KEY_IMPORT
|
---|
1484 | #undef HAVE_ECC_KEY_IMPORT
|
---|
1485 | #define HAVE_ECC_KEY_IMPORT
|
---|
1486 | #endif
|
---|
1487 | #ifndef NO_ECC_KEY_EXPORT
|
---|
1488 | #undef HAVE_ECC_KEY_EXPORT
|
---|
1489 | #define HAVE_ECC_KEY_EXPORT
|
---|
1490 | #endif
|
---|
1491 | #endif /* HAVE_ECC */
|
---|
1492 |
|
---|
1493 | /* Curve255519 Configs */
|
---|
1494 | #ifdef HAVE_CURVE25519
|
---|
1495 | /* By default enable shared secret, key export and import */
|
---|
1496 | #ifndef NO_CURVE25519_SHARED_SECRET
|
---|
1497 | #undef HAVE_CURVE25519_SHARED_SECRET
|
---|
1498 | #define HAVE_CURVE25519_SHARED_SECRET
|
---|
1499 | #endif
|
---|
1500 | #ifndef NO_CURVE25519_KEY_EXPORT
|
---|
1501 | #undef HAVE_CURVE25519_KEY_EXPORT
|
---|
1502 | #define HAVE_CURVE25519_KEY_EXPORT
|
---|
1503 | #endif
|
---|
1504 | #ifndef NO_CURVE25519_KEY_IMPORT
|
---|
1505 | #undef HAVE_CURVE25519_KEY_IMPORT
|
---|
1506 | #define HAVE_CURVE25519_KEY_IMPORT
|
---|
1507 | #endif
|
---|
1508 | #endif /* HAVE_CURVE25519 */
|
---|
1509 |
|
---|
1510 | /* Ed255519 Configs */
|
---|
1511 | #ifdef HAVE_ED25519
|
---|
1512 | /* By default enable sign, verify, key export and import */
|
---|
1513 | #ifndef NO_ED25519_SIGN
|
---|
1514 | #undef HAVE_ED25519_SIGN
|
---|
1515 | #define HAVE_ED25519_SIGN
|
---|
1516 | #endif
|
---|
1517 | #ifndef NO_ED25519_VERIFY
|
---|
1518 | #undef HAVE_ED25519_VERIFY
|
---|
1519 | #define HAVE_ED25519_VERIFY
|
---|
1520 | #endif
|
---|
1521 | #ifndef NO_ED25519_KEY_EXPORT
|
---|
1522 | #undef HAVE_ED25519_KEY_EXPORT
|
---|
1523 | #define HAVE_ED25519_KEY_EXPORT
|
---|
1524 | #endif
|
---|
1525 | #ifndef NO_ED25519_KEY_IMPORT
|
---|
1526 | #undef HAVE_ED25519_KEY_IMPORT
|
---|
1527 | #define HAVE_ED25519_KEY_IMPORT
|
---|
1528 | #endif
|
---|
1529 | #endif /* HAVE_ED25519 */
|
---|
1530 |
|
---|
1531 | /* AES Config */
|
---|
1532 | #ifndef NO_AES
|
---|
1533 | /* By default enable all AES key sizes, decryption and CBC */
|
---|
1534 | #ifndef AES_MAX_KEY_SIZE
|
---|
1535 | #undef AES_MAX_KEY_SIZE
|
---|
1536 | #define AES_MAX_KEY_SIZE 256
|
---|
1537 | #endif
|
---|
1538 |
|
---|
1539 | #ifndef NO_AES_128
|
---|
1540 | #undef WOLFSSL_AES_128
|
---|
1541 | #define WOLFSSL_AES_128
|
---|
1542 | #endif
|
---|
1543 | #if !defined(NO_AES_192) && AES_MAX_KEY_SIZE >= 192
|
---|
1544 | #undef WOLFSSL_AES_192
|
---|
1545 | #define WOLFSSL_AES_192
|
---|
1546 | #endif
|
---|
1547 | #if !defined(NO_AES_256) && AES_MAX_KEY_SIZE >= 256
|
---|
1548 | #undef WOLFSSL_AES_256
|
---|
1549 | #define WOLFSSL_AES_256
|
---|
1550 | #endif
|
---|
1551 | #if !defined(WOLFSSL_AES_128) && defined(HAVE_ECC_ENCRYPT)
|
---|
1552 | #warning HAVE_ECC_ENCRYPT uses AES 128 bit keys
|
---|
1553 | #endif
|
---|
1554 |
|
---|
1555 | #ifndef NO_AES_DECRYPT
|
---|
1556 | #undef HAVE_AES_DECRYPT
|
---|
1557 | #define HAVE_AES_DECRYPT
|
---|
1558 | #endif
|
---|
1559 | #ifndef NO_AES_CBC
|
---|
1560 | #undef HAVE_AES_CBC
|
---|
1561 | #define HAVE_AES_CBC
|
---|
1562 | #endif
|
---|
1563 | #ifdef WOLFSSL_AES_XTS
|
---|
1564 | /* AES-XTS makes calls to AES direct functions */
|
---|
1565 | #ifndef WOLFSSL_AES_DIRECT
|
---|
1566 | #define WOLFSSL_AES_DIRECT
|
---|
1567 | #endif
|
---|
1568 | #endif
|
---|
1569 | #ifdef WOLFSSL_AES_CFB
|
---|
1570 | /* AES-CFB makes calls to AES direct functions */
|
---|
1571 | #ifndef WOLFSSL_AES_DIRECT
|
---|
1572 | #define WOLFSSL_AES_DIRECT
|
---|
1573 | #endif
|
---|
1574 | #endif
|
---|
1575 | #endif
|
---|
1576 |
|
---|
1577 | #if (defined(WOLFSSL_TLS13) && defined(WOLFSSL_NO_TLS12)) || \
|
---|
1578 | (!defined(HAVE_AES_CBC) && defined(NO_DES3) && defined(NO_RC4) && \
|
---|
1579 | !defined(HAVE_CAMELLIA) && !defined(HAVE_IDEA) && \
|
---|
1580 | !defined(HAVE_NULL_CIPHER) && !defined(HAVE_HC128))
|
---|
1581 | #define WOLFSSL_AEAD_ONLY
|
---|
1582 | #endif
|
---|
1583 |
|
---|
1584 | /* if desktop type system and fastmath increase default max bits */
|
---|
1585 | #ifdef WOLFSSL_X86_64_BUILD
|
---|
1586 | #ifdef USE_FAST_MATH
|
---|
1587 | #ifndef FP_MAX_BITS
|
---|
1588 | #define FP_MAX_BITS 8192
|
---|
1589 | #endif
|
---|
1590 | #endif
|
---|
1591 | #endif
|
---|
1592 |
|
---|
1593 | /* If using the max strength build, ensure OLD TLS is disabled. */
|
---|
1594 | #ifdef WOLFSSL_MAX_STRENGTH
|
---|
1595 | #undef NO_OLD_TLS
|
---|
1596 | #define NO_OLD_TLS
|
---|
1597 | #endif
|
---|
1598 |
|
---|
1599 |
|
---|
1600 | /* Default AES minimum auth tag sz, allow user to override */
|
---|
1601 | #ifndef WOLFSSL_MIN_AUTH_TAG_SZ
|
---|
1602 | #define WOLFSSL_MIN_AUTH_TAG_SZ 12
|
---|
1603 | #endif
|
---|
1604 |
|
---|
1605 |
|
---|
1606 | /* sniffer requires:
|
---|
1607 | * static RSA cipher suites
|
---|
1608 | * session stats and peak stats
|
---|
1609 | */
|
---|
1610 | #ifdef WOLFSSL_SNIFFER
|
---|
1611 | #ifndef WOLFSSL_STATIC_RSA
|
---|
1612 | #define WOLFSSL_STATIC_RSA
|
---|
1613 | #endif
|
---|
1614 | #ifndef WOLFSSL_SESSION_STATS
|
---|
1615 | #define WOLFSSL_SESSION_STATS
|
---|
1616 | #endif
|
---|
1617 | #ifndef WOLFSSL_PEAK_SESSIONS
|
---|
1618 | #define WOLFSSL_PEAK_SESSIONS
|
---|
1619 | #endif
|
---|
1620 | #endif
|
---|
1621 |
|
---|
1622 | /* Decode Public Key extras on by default, user can turn off with
|
---|
1623 | * WOLFSSL_NO_DECODE_EXTRA */
|
---|
1624 | #ifndef WOLFSSL_NO_DECODE_EXTRA
|
---|
1625 | #ifndef RSA_DECODE_EXTRA
|
---|
1626 | #define RSA_DECODE_EXTRA
|
---|
1627 | #endif
|
---|
1628 | #ifndef ECC_DECODE_EXTRA
|
---|
1629 | #define ECC_DECODE_EXTRA
|
---|
1630 | #endif
|
---|
1631 | #endif
|
---|
1632 |
|
---|
1633 | /* C Sharp wrapper defines */
|
---|
1634 | #ifdef HAVE_CSHARP
|
---|
1635 | #ifndef WOLFSSL_DTLS
|
---|
1636 | #define WOLFSSL_DTLS
|
---|
1637 | #endif
|
---|
1638 | #undef NO_PSK
|
---|
1639 | #undef NO_SHA256
|
---|
1640 | #undef NO_DH
|
---|
1641 | #endif
|
---|
1642 |
|
---|
1643 | /* Asynchronous Crypto */
|
---|
1644 | #ifdef WOLFSSL_ASYNC_CRYPT
|
---|
1645 | /* Make sure wolf events are enabled */
|
---|
1646 | #undef HAVE_WOLF_EVENT
|
---|
1647 | #define HAVE_WOLF_EVENT
|
---|
1648 |
|
---|
1649 | #ifdef WOLFSSL_ASYNC_CRYPT_TEST
|
---|
1650 | #define WC_ASYNC_DEV_SIZE 328+24
|
---|
1651 | #else
|
---|
1652 | #define WC_ASYNC_DEV_SIZE 328
|
---|
1653 | #endif
|
---|
1654 |
|
---|
1655 | #if !defined(HAVE_CAVIUM) && !defined(HAVE_INTEL_QA) && \
|
---|
1656 | !defined(WOLFSSL_ASYNC_CRYPT_TEST)
|
---|
1657 | #error No async hardware defined with WOLFSSL_ASYNC_CRYPT!
|
---|
1658 | #endif
|
---|
1659 |
|
---|
1660 | /* Enable ECC_CACHE_CURVE for ASYNC */
|
---|
1661 | #if !defined(ECC_CACHE_CURVE)
|
---|
1662 | #define ECC_CACHE_CURVE
|
---|
1663 | #endif
|
---|
1664 | #endif /* WOLFSSL_ASYNC_CRYPT */
|
---|
1665 | #ifndef WC_ASYNC_DEV_SIZE
|
---|
1666 | #define WC_ASYNC_DEV_SIZE 0
|
---|
1667 | #endif
|
---|
1668 |
|
---|
1669 | /* leantls checks */
|
---|
1670 | #ifdef WOLFSSL_LEANTLS
|
---|
1671 | #ifndef HAVE_ECC
|
---|
1672 | #error leantls build needs ECC
|
---|
1673 | #endif
|
---|
1674 | #endif /* WOLFSSL_LEANTLS*/
|
---|
1675 |
|
---|
1676 | /* restriction with static memory */
|
---|
1677 | #ifdef WOLFSSL_STATIC_MEMORY
|
---|
1678 | #if defined(HAVE_IO_POOL) || defined(XMALLOC_USER) || defined(NO_WOLFSSL_MEMORY)
|
---|
1679 | #error static memory cannot be used with HAVE_IO_POOL, XMALLOC_USER or NO_WOLFSSL_MEMORY
|
---|
1680 | #endif
|
---|
1681 | #if !defined(USE_FAST_MATH) && !defined(NO_BIG_INT)
|
---|
1682 | #error static memory requires fast math please define USE_FAST_MATH
|
---|
1683 | #endif
|
---|
1684 | #ifdef WOLFSSL_SMALL_STACK
|
---|
1685 | #error static memory does not support small stack please undefine
|
---|
1686 | #endif
|
---|
1687 | #endif /* WOLFSSL_STATIC_MEMORY */
|
---|
1688 |
|
---|
1689 | #ifdef HAVE_AES_KEYWRAP
|
---|
1690 | #ifndef WOLFSSL_AES_DIRECT
|
---|
1691 | #error AES key wrap requires AES direct please define WOLFSSL_AES_DIRECT
|
---|
1692 | #endif
|
---|
1693 | #endif
|
---|
1694 |
|
---|
1695 | #ifdef HAVE_PKCS7
|
---|
1696 | #if defined(NO_AES) && defined(NO_DES3)
|
---|
1697 | #error PKCS7 needs either AES or 3DES enabled, please enable one
|
---|
1698 | #endif
|
---|
1699 | #ifndef HAVE_AES_KEYWRAP
|
---|
1700 | #error PKCS7 requires AES key wrap please define HAVE_AES_KEYWRAP
|
---|
1701 | #endif
|
---|
1702 | #if defined(HAVE_ECC) && !defined(HAVE_X963_KDF)
|
---|
1703 | #error PKCS7 requires X963 KDF please define HAVE_X963_KDF
|
---|
1704 | #endif
|
---|
1705 | #endif
|
---|
1706 |
|
---|
1707 | #if !defined(WOLFCRYPT_ONLY) && !defined(NO_OLD_TLS) && \
|
---|
1708 | (defined(NO_SHA) || defined(NO_MD5))
|
---|
1709 | #error old TLS requires MD5 and SHA
|
---|
1710 | #endif
|
---|
1711 |
|
---|
1712 | /* for backwards compatibility */
|
---|
1713 | #if defined(TEST_IPV6) && !defined(WOLFSSL_IPV6)
|
---|
1714 | #define WOLFSSL_IPV6
|
---|
1715 | #endif
|
---|
1716 |
|
---|
1717 |
|
---|
1718 | /* Place any other flags or defines here */
|
---|
1719 |
|
---|
1720 | #if defined(WOLFSSL_MYSQL_COMPATIBLE) && defined(_WIN32) \
|
---|
1721 | && defined(HAVE_GMTIME_R)
|
---|
1722 | #undef HAVE_GMTIME_R /* don't trust macro with windows */
|
---|
1723 | #endif /* WOLFSSL_MYSQL_COMPATIBLE */
|
---|
1724 |
|
---|
1725 | #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
---|
1726 | #define SSL_OP_NO_COMPRESSION SSL_OP_NO_COMPRESSION
|
---|
1727 | #define OPENSSL_NO_ENGINE
|
---|
1728 | #define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT
|
---|
1729 | #ifndef OPENSSL_EXTRA
|
---|
1730 | #define OPENSSL_EXTRA
|
---|
1731 | #endif
|
---|
1732 | #ifndef HAVE_SESSION_TICKET
|
---|
1733 | #define HAVE_SESSION_TICKET
|
---|
1734 | #endif
|
---|
1735 | #ifndef HAVE_OCSP
|
---|
1736 | #define HAVE_OCSP
|
---|
1737 | #endif
|
---|
1738 | #ifndef KEEP_OUR_CERT
|
---|
1739 | #define KEEP_OUR_CERT
|
---|
1740 | #endif
|
---|
1741 | #ifndef HAVE_SNI
|
---|
1742 | #define HAVE_SNI
|
---|
1743 | #endif
|
---|
1744 | #endif
|
---|
1745 |
|
---|
1746 | #if defined(WOLFSSL_NGINX)
|
---|
1747 | #define SSL_CTRL_SET_TLSEXT_HOSTNAME
|
---|
1748 | #endif
|
---|
1749 |
|
---|
1750 | /* both CURVE and ED small math should be enabled */
|
---|
1751 | #ifdef CURVED25519_SMALL
|
---|
1752 | #define CURVE25519_SMALL
|
---|
1753 | #define ED25519_SMALL
|
---|
1754 | #endif
|
---|
1755 |
|
---|
1756 |
|
---|
1757 | #ifndef WOLFSSL_ALERT_COUNT_MAX
|
---|
1758 | #define WOLFSSL_ALERT_COUNT_MAX 5
|
---|
1759 | #endif
|
---|
1760 |
|
---|
1761 | /* warning for not using harden build options (default with ./configure) */
|
---|
1762 | #ifndef WC_NO_HARDEN
|
---|
1763 | #if (defined(USE_FAST_MATH) && !defined(TFM_TIMING_RESISTANT)) || \
|
---|
1764 | (defined(HAVE_ECC) && !defined(ECC_TIMING_RESISTANT)) || \
|
---|
1765 | (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS) && \
|
---|
1766 | !defined(WC_NO_RNG))
|
---|
1767 |
|
---|
1768 | #ifndef _MSC_VER
|
---|
1769 | #warning "For timing resistance / side-channel attack prevention consider using harden options"
|
---|
1770 | #else
|
---|
1771 | #pragma message("Warning: For timing resistance / side-channel attack prevention consider using harden options")
|
---|
1772 | #endif
|
---|
1773 | #endif
|
---|
1774 | #endif
|
---|
1775 |
|
---|
1776 | #if defined(NO_OLD_WC_NAMES) || defined(OPENSSL_EXTRA)
|
---|
1777 | /* added to have compatibility with SHA256() */
|
---|
1778 | #if !defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS)
|
---|
1779 | #define NO_OLD_SHA_NAMES
|
---|
1780 | #endif
|
---|
1781 | #endif
|
---|
1782 |
|
---|
1783 | /* switch for compatibility layer functionality. Has subparts i.e. BIO/X509
|
---|
1784 | * When opensslextra is enabled all subparts should be turned on. */
|
---|
1785 | #ifdef OPENSSL_EXTRA
|
---|
1786 | #undef OPENSSL_EXTRA_X509_SMALL
|
---|
1787 | #define OPENSSL_EXTRA_X509_SMALL
|
---|
1788 | #endif /* OPENSSL_EXTRA */
|
---|
1789 |
|
---|
1790 | /* support for converting DER to PEM */
|
---|
1791 | #if defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN) || \
|
---|
1792 | defined(OPENSSL_EXTRA)
|
---|
1793 | #undef WOLFSSL_DER_TO_PEM
|
---|
1794 | #define WOLFSSL_DER_TO_PEM
|
---|
1795 | #endif
|
---|
1796 |
|
---|
1797 | /* keep backwards compatibility enabling encrypted private key */
|
---|
1798 | #ifndef WOLFSSL_ENCRYPTED_KEYS
|
---|
1799 | #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \
|
---|
1800 | defined(HAVE_WEBSERVER)
|
---|
1801 | #define WOLFSSL_ENCRYPTED_KEYS
|
---|
1802 | #endif
|
---|
1803 | #endif
|
---|
1804 |
|
---|
1805 | /* support for disabling PEM to DER */
|
---|
1806 | #if !defined(WOLFSSL_NO_PEM)
|
---|
1807 | #undef WOLFSSL_PEM_TO_DER
|
---|
1808 | #define WOLFSSL_PEM_TO_DER
|
---|
1809 | #endif
|
---|
1810 |
|
---|
1811 | /* Parts of the openssl compatibility layer require peer certs */
|
---|
1812 | #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
---|
1813 | #undef KEEP_PEER_CERT
|
---|
1814 | #define KEEP_PEER_CERT
|
---|
1815 | #endif
|
---|
1816 |
|
---|
1817 | /* RAW hash function APIs are not implemented with ARMv8 hardware acceleration*/
|
---|
1818 | #ifdef WOLFSSL_ARMASM
|
---|
1819 | #undef WOLFSSL_NO_HASH_RAW
|
---|
1820 | #define WOLFSSL_NO_HASH_RAW
|
---|
1821 | #endif
|
---|
1822 |
|
---|
1823 | #if !defined(WOLFSSL_SHA384) && !defined(WOLFSSL_SHA512) && defined(NO_AES) && \
|
---|
1824 | !defined(WOLFSSL_SHA3)
|
---|
1825 | #undef WOLFSSL_NO_WORD64_OPS
|
---|
1826 | #define WOLFSSL_NO_WORD64_OPS
|
---|
1827 | #endif
|
---|
1828 |
|
---|
1829 | #if defined(NO_AES) && defined(NO_DES3) && !defined(HAVE_CAMELLIA) && \
|
---|
1830 | defined(NO_PWDBASED) && !defined(HAVE_IDEA)
|
---|
1831 | #undef WOLFSSL_NO_XOR_OPS
|
---|
1832 | #define WOLFSSL_NO_XOR_OPS
|
---|
1833 | #endif
|
---|
1834 |
|
---|
1835 | #if defined(NO_ASN) && defined(WOLFCRYPT_ONLY)
|
---|
1836 | #undef WOLFSSL_NO_INT_ENCODE
|
---|
1837 | #define WOLFSSL_NO_INT_ENCODE
|
---|
1838 | #undef WOLFSSL_NO_INT_DECODE
|
---|
1839 | #define WOLFSSL_NO_INT_DECODE
|
---|
1840 | #endif
|
---|
1841 |
|
---|
1842 | #if defined(WOLFCRYPT_ONLY) && defined(WOLFSSL_RSA_VERIFY_ONLY) && \
|
---|
1843 | defined(WC_NO_RSA_OAEP)
|
---|
1844 | #undef WOLFSSL_NO_CT_OPS
|
---|
1845 | #define WOLFSSL_NO_CT_OPS
|
---|
1846 | #endif
|
---|
1847 |
|
---|
1848 | #if defined(WOLFCRYPT_ONLY) && defined(NO_AES) && !defined(HAVE_CURVE25519) && \
|
---|
1849 | defined(WC_NO_RNG) && defined(WC_NO_RSA_OAEP)
|
---|
1850 | #undef WOLFSSL_NO_CONST_CMP
|
---|
1851 | #define WOLFSSL_NO_CONST_CMP
|
---|
1852 | #endif
|
---|
1853 |
|
---|
1854 | #if defined(WOLFCRYPT_ONLY) && defined(NO_AES) && !defined(WOLFSSL_SHA384) && \
|
---|
1855 | !defined(WOLFSSL_SHA512) && defined(WC_NO_RNG) && \
|
---|
1856 | defined(WOLFSSL_SP_MATH) && defined(WOLFSSL_RSA_PUBLIC_ONLY)
|
---|
1857 | #undef WOLFSSL_NO_FORCE_ZERO
|
---|
1858 | #define WOLFSSL_NO_FORCE_ZERO
|
---|
1859 | #endif
|
---|
1860 |
|
---|
1861 | #ifdef __cplusplus
|
---|
1862 | } /* extern "C" */
|
---|
1863 | #endif
|
---|
1864 |
|
---|
1865 | #endif
|
---|