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