source: UsbWattMeter/trunk/wolfssl-3.7.0/wolfssl/wolfcrypt/settings.h@ 473

Last change on this file since 473 was 167, checked in by coas-nagasima, 8 years ago

MIMEにSJISを設定

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr; charset=SHIFT_JIS
File size: 24.4 KB
Line 
1/* settings.h
2 *
3 * Copyright (C) 2006-2015 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL. (formerly known as CyaSSL)
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-1301, USA
20 */
21
22/* Place OS specific preprocessor flags, defines, includes here, will be
23 included into every file because types.h includes it */
24
25
26#ifndef WOLF_CRYPT_SETTINGS_H
27#define WOLF_CRYPT_SETTINGS_H
28
29#ifdef __cplusplus
30 extern "C" {
31#endif
32
33/* Uncomment next line if using IPHONE */
34/* #define IPHONE */
35
36/* Uncomment next line if using ThreadX */
37/* #define THREADX */
38
39/* Uncomment next line if using Micrium ucOS */
40/* #define MICRIUM */
41
42/* Uncomment next line if using Mbed */
43/* #define MBED */
44
45/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
46/* #define MICROCHIP_PIC32 */
47
48/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
49/* #define MICROCHIP_TCPIP_V5 */
50
51/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
52/* #define MICROCHIP_TCPIP */
53
54/* Uncomment next line if using PIC32MZ Crypto Engine */
55/* #define WOLFSSL_MICROCHIP_PIC32MZ */
56
57/* Uncomment next line if using FreeRTOS */
58/* #define FREERTOS */
59
60/* Uncomment next line if using FreeRTOS+ TCP */
61/* #define FREERTOS_TCP */
62
63/* Uncomment next line if using FreeRTOS Windows Simulator */
64/* #define FREERTOS_WINSIM */
65
66/* Uncomment next line if using RTIP */
67/* #define EBSNET */
68
69/* Uncomment next line if using lwip */
70#define WOLFSSL_LWIP
71
72/* Uncomment next line if building wolfSSL for a game console */
73/* #define WOLFSSL_GAME_BUILD */
74
75/* Uncomment next line if building wolfSSL for LSR */
76/* #define WOLFSSL_LSR */
77
78/* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */
79/* #define FREESCALE_MQX */
80
81/* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */
82/* #define FREESCALE_KSDK_MQX */
83
84/* Uncomment next line if building for Freescale KSDK Bare Metal */
85/* #define FREESCALE_KSDK_BM */
86
87/* Uncomment next line if building for Freescale FreeRTOS */
88/* #define FREESCALE_FREE_RTOS */
89
90/* Uncomment next line if using STM32F2 */
91/* #define WOLFSSL_STM32F2 */
92
93/* Uncomment next line if using Comverge settings */
94/* #define COMVERGE */
95
96/* Uncomment next line if using QL SEP settings */
97/* #define WOLFSSL_QL */
98
99/* Uncomment next line if building for EROAD */
100/* #define WOLFSSL_EROAD */
101
102/* Uncomment next line if building for IAR EWARM */
103/* #define WOLFSSL_IAR_ARM */
104
105/* Uncomment next line if building for Rowley CrossWorks ARM */
106/* #define WOLFSSL_ROWLEY_ARM */
107
108/* Uncomment next line if using TI-RTOS settings */
109/* #define WOLFSSL_TIRTOS */
110
111/* Uncomment next line if building with PicoTCP */
112/* #define WOLFSSL_PICOTCP */
113
114/* Uncomment next line if building for PicoTCP demo bundle */
115/* #define WOLFSSL_PICOTCP_DEMO */
116
117/* Uncomment next line if building for uITRON4 */
118#define WOLFSSL_uITRON4
119
120/* Uncomment next line if building for uT-Kernel */
121/* #define WOLFSSL_uTKERNEL2 */
122
123/* Uncomment next line if using Max Strength build */
124/* #define WOLFSSL_MAX_STRENGTH */
125
126/* Uncomment next line if building for VxWorks */
127/* #define WOLFSSL_VXWORKS */
128
129/* Uncomment next line to enable deprecated less secure static DH suites */
130/* #define WOLFSSL_STATIC_DH */
131
132/* Uncomment next line to enable deprecated less secure static RSA suites */
133/* #define WOLFSSL_STATIC_RSA */
134
135#define NO_PSK
136#define WOLFSSL_FATFS
137#define NO_WRITEV
138#define NO_MAIN_DRIVER
139#define WOLFSSL_LOW_MEMORY
140#define KEEP_PEER_CERT
141
142#include <wolfssl/wolfcrypt/visibility.h>
143
144#ifdef WOLFSSL_USER_SETTINGS
145 #include <user_settings.h>
146#endif
147
148
149/* make sure old RNG name is used with CTaoCrypt FIPS */
150#ifdef HAVE_FIPS
151 #define WC_RNG RNG
152#endif
153
154
155#ifdef IPHONE
156 #define SIZEOF_LONG_LONG 8
157#endif
158
159
160#ifdef COMVERGE
161 #define THREADX
162 #define HAVE_NETX
163 #define WOLFSSL_USER_IO
164 #define NO_WRITEV
165 #define NO_DEV_RANDOM
166 #define NO_FILESYSTEM
167 #define NO_SHA512
168 #define NO_DH
169 #define NO_DSA
170 #define NO_HC128
171 #define NO_RSA
172 #define NO_SESSION_CACHE
173 #define HAVE_ECC
174#endif
175
176
177#ifdef THREADX
178 #define SIZEOF_LONG_LONG 8
179#endif
180
181#ifdef HAVE_NETX
182 #include "nx_api.h"
183#endif
184
185#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
186 #define WOLFSSL_LWIP
187 #define NO_WRITEV
188 #define SINGLE_THREADED
189 #define WOLFSSL_USER_IO
190 #define NO_FILESYSTEM
191#endif
192
193#if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM)
194 #define NO_MAIN_DRIVER
195 #define SINGLE_THREADED
196 #define USE_CERT_BUFFERS_1024
197 #define BENCH_EMBEDDED
198 #define NO_FILESYSTEM
199 #define NO_WRITEV
200 #define WOLFSSL_USER_IO
201 #define BENCH_EMBEDDED
202#endif
203
204#ifdef MICROCHIP_PIC32
205 /* #define WOLFSSL_MICROCHIP_PIC32MZ */
206 #define SIZEOF_LONG_LONG 8
207 #define SINGLE_THREADED
208 #define WOLFSSL_USER_IO
209 #define NO_WRITEV
210 #define NO_DEV_RANDOM
211 #define NO_FILESYSTEM
212 #define USE_FAST_MATH
213 #define TFM_TIMING_RESISTANT
214 #define NEED_AES_TABLES
215 #define WOLFSSL_HAVE_MIN
216#endif
217
218#ifdef WOLFSSL_MICROCHIP_PIC32MZ
219 #define WOLFSSL_PIC32MZ_CE
220 #define WOLFSSL_PIC32MZ_CRYPT
221 #define HAVE_AES_ENGINE
222 #define WOLFSSL_PIC32MZ_RNG
223 /* #define WOLFSSL_PIC32MZ_HASH */
224 #define WOLFSSL_AES_COUNTER
225 #define HAVE_AESGCM
226 #define NO_BIG_INT
227#endif
228
229#ifdef MICROCHIP_TCPIP_V5
230 /* include timer functions */
231 #include "TCPIP Stack/TCPIP.h"
232#endif
233
234#ifdef MICROCHIP_TCPIP
235 /* include timer, NTP functions */
236 #ifdef MICROCHIP_MPLAB_HARMONY
237 #include "tcpip/tcpip.h"
238 #else
239 #include "system/system_services.h"
240 #include "tcpip/sntp.h"
241 #endif
242#endif
243
244#ifdef MBED
245 #define WOLFSSL_USER_IO
246 #define NO_FILESYSTEM
247 #define NO_CERT
248 #define USE_CERT_BUFFERS_1024
249 #define NO_WRITEV
250 #define NO_DEV_RANDOM
251 #define NO_SHA512
252 #define NO_DH
253 #define NO_DSA
254 #define NO_HC128
255 #define HAVE_ECC
256 #define NO_SESSION_CACHE
257 #define WOLFSSL_CMSIS_RTOS
258#endif
259
260
261#ifdef WOLFSSL_EROAD
262 #define FREESCALE_MQX
263 #define FREESCALE_MMCAU
264 #define SINGLE_THREADED
265 #define NO_STDIO_FILESYSTEM
266 #define WOLFSSL_LEANPSK
267 #define HAVE_NULL_CIPHER
268 #define NO_OLD_TLS
269 #define NO_ASN
270 #define NO_BIG_INT
271 #define NO_RSA
272 #define NO_DSA
273 #define NO_DH
274 #define NO_CERTS
275 #define NO_PWDBASED
276 #define NO_DES3
277 #define NO_MD4
278 #define NO_RC4
279 #define NO_MD5
280 #define NO_SESSION_CACHE
281 #define NO_MAIN_DRIVER
282#endif
283
284#ifdef WOLFSSL_PICOTCP
285 #ifndef errno
286 #define errno pico_err
287 #endif
288 #include "pico_defines.h"
289 #include "pico_stack.h"
290 #include "pico_constants.h"
291 #include "pico_protocol.h"
292 #define CUSTOM_RAND_GENERATE pico_rand
293#endif
294
295#ifdef WOLFSSL_PICOTCP_DEMO
296 #define WOLFSSL_STM32
297 #define USE_FAST_MATH
298 #define TFM_TIMING_RESISTANT
299 #define XMALLOC(s, h, type) PICO_ZALLOC((s))
300 #define XFREE(p, h, type) PICO_FREE((p))
301 #define SINGLE_THREADED
302 #define NO_WRITEV
303 #define WOLFSSL_USER_IO
304 #define NO_DEV_RANDOM
305 #define NO_FILESYSTEM
306#endif
307
308#ifdef FREERTOS_WINSIM
309 #define FREERTOS
310 #define USE_WINDOWS_API
311#endif
312
313
314#ifdef WOLFSSL_VXWORKS
315 #define NO_DEV_RANDOM
316 #define NO_WRITEV
317#endif
318
319
320/* Micrium will use Visual Studio for compilation but not the Win32 API */
321#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\
322 && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && !defined(WOLFSSL_uITRON4)
323 #define USE_WINDOWS_API
324#endif
325
326#if defined(WOLFSSL_uITRON4)
327
328#define XMALLOC_USER
329#include <stddef.h>
330#define ITRON_POOL_SIZE 1024*20
331extern int uITRON4_minit(size_t poolsz) ;
332extern void *uITRON4_malloc(size_t sz) ;
333extern void *uITRON4_realloc(void *p, size_t sz) ;
334extern void uITRON4_free(void *p) ;
335
336#define XMALLOC(sz, heap, type) uITRON4_malloc(sz)
337#define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz)
338#define XFREE(p, heap, type) uITRON4_free(p)
339#endif
340
341#if defined(WOLFSSL_uTKERNEL2)
342#define WOLFSSL_CLOSESOCKET
343#define XMALLOC_USER
344int uTKernel_init_mpool(unsigned int sz) ; /* initializing malloc pool */
345void *uTKernel_malloc(unsigned int sz) ;
346void *uTKernel_realloc(void *p, unsigned int sz) ;
347void uTKernel_free(void *p) ;
348#define XMALLOC(s, h, type) uTKernel_malloc((s))
349#define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n))
350#define XFREE(p, h, type) uTKernel_free((p))
351
352#include <stdio.h>
353#include "tm/tmonitor.h"
354static char *fgets(char *buff, int sz, XFILE fp)
355/*static char * gets(char *buff)*/
356{
357 char * p = buff ;
358 *p = '\0' ;
359 while(1) {
360 *p = tm_getchar(-1) ;
361 tm_putchar(*p) ;
362 if(*p == '\r') {
363 tm_putchar('\n') ;
364 *p = '\0' ;
365 break ;
366 }
367 p ++ ;
368 }
369 return buff ;
370}
371
372#endif
373
374
375#if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER)
376 #include <stdlib.h>
377 #define XMALLOC(s, h, type) malloc((s))
378 #define XFREE(p, h, type) free((p))
379 #define XREALLOC(p, n, h, t) realloc((p), (n))
380#endif
381
382#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
383 #undef XMALLOC
384 #define XMALLOC yaXMALLOC
385 #undef XFREE
386 #define XFREE yaXFREE
387 #undef XREALLOC
388 #define XREALLOC yaXREALLOC
389#endif
390
391
392#ifdef FREERTOS
393 #include "FreeRTOS.h"
394
395 /* FreeRTOS pvPortRealloc() only in AVR32_UC3 port */
396 #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY)
397 #define XMALLOC(s, h, type) pvPortMalloc((s))
398 #define XFREE(p, h, type) vPortFree((p))
399 #endif
400
401 #ifndef NO_WRITEV
402 #define NO_WRITEV
403 #endif
404 #ifndef HAVE_SHA512
405 #ifndef NO_SHA512
406 #define NO_SHA512
407 #endif
408 #endif
409 #ifndef HAVE_DH
410 #ifndef NO_DH
411 #define NO_DH
412 #endif
413 #endif
414 #ifndef NO_DSA
415 #define NO_DSA
416 #endif
417 #ifndef NO_HC128
418 #define NO_HC128
419 #endif
420
421 #ifndef SINGLE_THREADED
422 #include "semphr.h"
423 #endif
424#endif
425
426#ifdef FREERTOS_TCP
427
428#if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER)
429#define XMALLOC(s, h, type) pvPortMalloc((s))
430#define XFREE(p, h, type) vPortFree((p))
431#endif
432
433#define WOLFSSL_GENSEED_FORTEST
434
435#define NO_WOLFSSL_DIR
436#define NO_WRITEV
437#define WOLFSSL_HAVE_MIN
438#define USE_FAST_MATH
439#define TFM_TIMING_REGISTANT
440#define NO_MAIN_DRIVER
441
442#endif
443
444#ifdef WOLFSSL_TIRTOS
445 #define SIZEOF_LONG_LONG 8
446 #define NO_WRITEV
447 #define NO_WOLFSSL_DIR
448 #define USE_FAST_MATH
449 #define TFM_TIMING_RESISTANT
450 #define NO_DEV_RANDOM
451 #define NO_FILESYSTEM
452 #define USE_CERT_BUFFERS_2048
453 #define NO_ERROR_STRINGS
454 #define USER_TIME
455
456 #ifdef __IAR_SYSTEMS_ICC__
457 #pragma diag_suppress=Pa089
458 #elif !defined(__GNUC__)
459 /* Suppress the sslpro warning */
460 #pragma diag_suppress=11
461 #endif
462
463 #include <ti/sysbios/hal/Seconds.h>
464#endif
465
466#ifdef EBSNET
467 #include "rtip.h"
468
469 /* #define DEBUG_WOLFSSL */
470 #define NO_WOLFSSL_DIR /* tbd */
471
472 #if (POLLOS)
473 #define SINGLE_THREADED
474 #endif
475
476 #if (RTPLATFORM)
477 #if (!RTP_LITTLE_ENDIAN)
478 #define BIG_ENDIAN_ORDER
479 #endif
480 #else
481 #if (!KS_LITTLE_ENDIAN)
482 #define BIG_ENDIAN_ORDER
483 #endif
484 #endif
485
486 #if (WINMSP3)
487 #undef SIZEOF_LONG
488 #define SIZEOF_LONG_LONG 8
489 #else
490 #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
491 #endif
492
493 #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
494 #define XFREE(p, h, type) (rtp_free(p))
495 #define XREALLOC(p, n, h, t) realloc((p), (n))
496
497#endif /* EBSNET */
498
499#ifdef WOLFSSL_GAME_BUILD
500 #define SIZEOF_LONG_LONG 8
501 #if defined(__PPU) || defined(__XENON)
502 #define BIG_ENDIAN_ORDER
503 #endif
504#endif
505
506#ifdef WOLFSSL_LSR
507 #define HAVE_WEBSERVER
508 #define SIZEOF_LONG_LONG 8
509 #define WOLFSSL_LOW_MEMORY
510 #define NO_WRITEV
511 #define NO_SHA512
512 #define NO_DH
513 #define NO_DSA
514 #define NO_HC128
515 #define NO_DEV_RANDOM
516 #define NO_WOLFSSL_DIR
517 #define NO_RABBIT
518 #ifndef NO_FILESYSTEM
519 #define LSR_FS
520 #include "inc/hw_types.h"
521 #include "fs.h"
522 #endif
523 #define WOLFSSL_LWIP
524 #include <errno.h> /* for tcp errno */
525 #define WOLFSSL_SAFERTOS
526 #if defined(__IAR_SYSTEMS_ICC__)
527 /* enum uses enum */
528 #pragma diag_suppress=Pa089
529 #endif
530#endif
531
532#ifdef WOLFSSL_SAFERTOS
533 #ifndef SINGLE_THREADED
534 #include "SafeRTOS/semphr.h"
535 #endif
536
537 #include "SafeRTOS/heap.h"
538 #define XMALLOC(s, h, type) pvPortMalloc((s))
539 #define XFREE(p, h, type) vPortFree((p))
540 #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
541#endif
542
543#ifdef WOLFSSL_LOW_MEMORY
544 #undef RSA_LOW_MEM
545 #define RSA_LOW_MEM
546 #undef WOLFSSL_SMALL_STACK
547 #define WOLFSSL_SMALL_STACK
548 #undef TFM_TIMING_RESISTANT
549 #define TFM_TIMING_RESISTANT
550#endif
551
552#ifdef FREESCALE_MQX
553 #define FREESCALE_COMMON
554 #include "mqx.h"
555 #ifndef NO_FILESYSTEM
556 #include "mfs.h"
557 #if MQX_USE_IO_OLD
558 #include "fio.h"
559 #else
560 #include "nio.h"
561 #endif
562 #endif
563 #ifndef SINGLE_THREADED
564 #include "mutex.h"
565 #endif
566
567 #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
568 #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
569 /* Note: MQX has no realloc, using fastmath above */
570#endif
571
572#ifdef FREESCALE_KSDK_MQX
573 #define FREESCALE_COMMON
574 #include <mqx.h>
575 #ifndef NO_FILESYSTEM
576 #if MQX_USE_IO_OLD
577 #include <fio.h>
578 #else
579 #include <stdio.h>
580 #include <nio.h>
581 #endif
582 #endif
583 #ifndef SINGLE_THREADED
584 #include <mutex.h>
585 #endif
586
587 #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
588 #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
589 #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
590#endif
591
592#ifdef FREESCALE_KSDK_BM
593 #define FREESCALE_COMMON
594 #define WOLFSSL_USER_IO
595 #define SINGLE_THREADED
596 #define NO_FILESYSTEM
597 #define USE_WOLFSSL_MEMORY
598#endif
599
600#ifdef FREESCALE_FREE_RTOS
601 #define FREESCALE_COMMON
602 #define NO_FILESYSTEM
603 #define NO_MAIN_DRIVER
604 #define XMALLOC(s, h, t) OSA_MemAlloc(s);
605 #define XFREE(p, h, t) {void* xp = (p); if((xp)) OSA_MemFree((xp));}
606 #define XREALLOC(p, n, h, t) ksdk_realloc((p), (n), (h), (t));
607 #ifdef FREESCALE_KSDK_BM
608 #error Baremetal and FreeRTOS cannot be both enabled at the same time!
609 #endif
610 #ifndef SINGLE_THREADED
611 #include "FreeRTOS.h"
612 #include "semphr.h"
613 #endif
614#endif
615
616#ifdef FREESCALE_COMMON
617 #define SIZEOF_LONG_LONG 8
618 #define NO_WRITEV
619 #define NO_DEV_RANDOM
620 #define NO_RABBIT
621 #define NO_WOLFSSL_DIR
622 #define USE_FAST_MATH
623 #define TFM_TIMING_RESISTANT
624
625 #if FSL_FEATURE_SOC_ENET_COUNT == 0
626 #define WOLFSSL_USER_IO
627 #endif
628
629 /* random seed */
630 #define NO_OLD_RNGNAME
631 #if FSL_FEATURE_SOC_TRNG_COUNT > 0
632 #define FREESCALE_TRNG
633 #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS)
634 #define FREESCALE_K70_RNGA
635 /* #define FREESCALE_K53_RNGB */
636 #endif
637
638 /* HW crypto */
639 /* #define FREESCALE_MMCAU */
640#endif
641
642#ifdef WOLFSSL_STM32F2
643 #define SIZEOF_LONG_LONG 8
644 #define NO_DEV_RANDOM
645 #define NO_WOLFSSL_DIR
646 #define NO_RABBIT
647 #define STM32F2_RNG
648 #define STM32F2_CRYPTO
649 #define KEIL_INTRINSICS
650#endif
651
652#ifdef MICRIUM
653
654 #include "stdlib.h"
655 #include "net_cfg.h"
656 #include "ssl_cfg.h"
657 #include "net_secure_os.h"
658
659 #define WOLFSSL_TYPES
660
661 typedef CPU_INT08U byte;
662 typedef CPU_INT16U word16;
663 typedef CPU_INT32U word32;
664
665 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
666 #define SIZEOF_LONG 4
667 #undef SIZEOF_LONG_LONG
668 #else
669 #undef SIZEOF_LONG
670 #define SIZEOF_LONG_LONG 8
671 #endif
672
673 #define STRING_USER
674
675 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
676 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
677 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
678 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
679 #define XSTRNCMP(pstr_1, pstr_2, len_max) \
680 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
681 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
682 #define XSTRSTR(pstr, pstr_srch) \
683 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
684 (CPU_CHAR *)(pstr_srch)))
685 #define XMEMSET(pmem, data_val, size) \
686 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
687 (CPU_SIZE_T)(size)))
688 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
689 (void *)(psrc), (CPU_SIZE_T)(size)))
690 #define XMEMCMP(pmem_1, pmem_2, size) \
691 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
692 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
693 #define XMEMMOVE XMEMCPY
694
695#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
696 #define MICRIUM_MALLOC
697 #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
698 (CPU_SIZE_T)(s), (void *)0))
699 #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
700 (p), (void *)0))
701 #define XREALLOC(p, n, h, t) realloc((p), (n))
702#endif
703
704 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
705 #undef NO_FILESYSTEM
706 #else
707 #define NO_FILESYSTEM
708 #endif
709
710 #if (SSL_CFG_TRACE_LEVEL == WOLFSSL_TRACE_LEVEL_DBG)
711 #define DEBUG_WOLFSSL
712 #else
713 #undef DEBUG_WOLFSSL
714 #endif
715
716 #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
717 #define OPENSSL_EXTRA
718 #else
719 #undef OPENSSL_EXTRA
720 #endif
721
722 #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
723 #undef SINGLE_THREADED
724 #else
725 #define SINGLE_THREADED
726 #endif
727
728 #if (SSL_CFG_DH_EN == DEF_ENABLED)
729 #undef NO_DH
730 #else
731 #define NO_DH
732 #endif
733
734 #if (SSL_CFG_DSA_EN == DEF_ENABLED)
735 #undef NO_DSA
736 #else
737 #define NO_DSA
738 #endif
739
740 #if (SSL_CFG_PSK_EN == DEF_ENABLED)
741 #undef NO_PSK
742 #else
743 #define NO_PSK
744 #endif
745
746 #if (SSL_CFG_3DES_EN == DEF_ENABLED)
747 #undef NO_DES
748 #else
749 #define NO_DES
750 #endif
751
752 #if (SSL_CFG_AES_EN == DEF_ENABLED)
753 #undef NO_AES
754 #else
755 #define NO_AES
756 #endif
757
758 #if (SSL_CFG_RC4_EN == DEF_ENABLED)
759 #undef NO_RC4
760 #else
761 #define NO_RC4
762 #endif
763
764 #if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
765 #undef NO_RABBIT
766 #else
767 #define NO_RABBIT
768 #endif
769
770 #if (SSL_CFG_HC128_EN == DEF_ENABLED)
771 #undef NO_HC128
772 #else
773 #define NO_HC128
774 #endif
775
776 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
777 #define BIG_ENDIAN_ORDER
778 #else
779 #undef BIG_ENDIAN_ORDER
780 #define LITTLE_ENDIAN_ORDER
781 #endif
782
783 #if (SSL_CFG_MD4_EN == DEF_ENABLED)
784 #undef NO_MD4
785 #else
786 #define NO_MD4
787 #endif
788
789 #if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
790 #undef NO_WRITEV
791 #else
792 #define NO_WRITEV
793 #endif
794
795 #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
796 #define NO_DEV_RANDOM
797 #else
798 #undef NO_DEV_RANDOM
799 #endif
800
801 #if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
802 #define WOLFSSL_USER_IO
803 #else
804 #undef WOLFSSL_USER_IO
805 #endif
806
807 #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
808 #undef LARGE_STATIC_BUFFERS
809 #undef STATIC_CHUNKS_ONLY
810 #else
811 #define LARGE_STATIC_BUFFERS
812 #define STATIC_CHUNKS_ONLY
813 #endif
814
815 #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
816 #define WOLFSSL_DER_LOAD
817 #else
818 #undef WOLFSSL_DER_LOAD
819 #endif
820
821 #if (SSL_CFG_DTLS_EN == DEF_ENABLED)
822 #define WOLFSSL_DTLS
823 #else
824 #undef WOLFSSL_DTLS
825 #endif
826
827 #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
828 #define WOLFSSL_CALLBACKS
829 #else
830 #undef WOLFSSL_CALLBACKS
831 #endif
832
833 #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
834 #define USE_FAST_MATH
835 #else
836 #undef USE_FAST_MATH
837 #endif
838
839 #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
840 #define TFM_TIMING_RESISTANT
841 #else
842 #undef TFM_TIMING_RESISTANT
843 #endif
844
845#endif /* MICRIUM */
846
847
848#ifdef WOLFSSL_QL
849 #ifndef WOLFSSL_SEP
850 #define WOLFSSL_SEP
851 #endif
852 #ifndef OPENSSL_EXTRA
853 #define OPENSSL_EXTRA
854 #endif
855 #ifndef SESSION_CERTS
856 #define SESSION_CERTS
857 #endif
858 #ifndef HAVE_AESCCM
859 #define HAVE_AESCCM
860 #endif
861 #ifndef ATOMIC_USER
862 #define ATOMIC_USER
863 #endif
864 #ifndef WOLFSSL_DER_LOAD
865 #define WOLFSSL_DER_LOAD
866 #endif
867 #ifndef KEEP_PEER_CERT
868 #define KEEP_PEER_CERT
869 #endif
870 #ifndef HAVE_ECC
871 #define HAVE_ECC
872 #endif
873 #ifndef SESSION_INDEX
874 #define SESSION_INDEX
875 #endif
876#endif /* WOLFSSL_QL */
877
878
879#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
880 !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY)
881 #define USE_WOLFSSL_MEMORY
882#endif
883
884
885#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
886 #undef KEEP_PEER_CERT
887 #define KEEP_PEER_CERT
888#endif
889
890
891/* stream ciphers except arc4 need 32bit alignment, intel ok without */
892#ifndef XSTREAM_ALIGN
893 #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
894 #define NO_XSTREAM_ALIGN
895 #else
896 #define XSTREAM_ALIGN
897 #endif
898#endif
899
900
901/* FreeScale MMCAU hardware crypto has 4 byte alignment */
902#ifdef FREESCALE_MMCAU
903 #define WOLFSSL_MMCAU_ALIGNMENT 4
904#endif
905
906/* if using hardware crypto and have alignment requirements, specify the
907 requirement here. The record header of SSL/TLS will prvent easy alignment.
908 This hint tries to help as much as possible. */
909#ifndef WOLFSSL_GENERAL_ALIGNMENT
910 #ifdef WOLFSSL_AESNI
911 #define WOLFSSL_GENERAL_ALIGNMENT 16
912 #elif defined(XSTREAM_ALIGN)
913 #define WOLFSSL_GENERAL_ALIGNMENT 4
914 #elif defined(FREESCALE_MMCAU)
915 #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT
916 #else
917 #define WOLFSSL_GENERAL_ALIGNMENT 0
918 #endif
919#endif
920
921#if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0)
922 #if defined(_MSC_VER)
923 #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT))
924 #elif defined(__GNUC__)
925 #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT)))
926 #else
927 #define XGEN_ALIGN
928 #endif
929#else
930 #define XGEN_ALIGN
931#endif
932
933#ifdef HAVE_CRL
934 /* not widely supported yet */
935 #undef NO_SKID
936 #define NO_SKID
937#endif
938
939
940#ifdef __INTEL_COMPILER
941 #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */
942#endif
943
944/* user can specify what curves they want with ECC_USER_CURVES otherwise
945 * all curves are on by default for now */
946#ifndef ECC_USER_CURVES
947 #ifndef HAVE_ALL_CURVES
948 #define HAVE_ALL_CURVES
949 #endif
950#endif
951
952/* if desktop type system and fastmath increase default max bits */
953#ifdef WOLFSSL_X86_64_BUILD
954 #ifdef USE_FAST_MATH
955 #ifndef FP_MAX_BITS
956 #define FP_MAX_BITS 8192
957 #endif
958 #endif
959#endif
960
961/* If using the max strength build, ensure OLD TLS is disabled. */
962#ifdef WOLFSSL_MAX_STRENGTH
963 #undef NO_OLD_TLS
964 #define NO_OLD_TLS
965#endif
966
967/* If not forcing to use ARC4 as the DRBG, always enable Hash_DRBG */
968#undef HAVE_HASHDRBG
969#ifndef WOLFSSL_FORCE_RC4_DRBG
970 #define HAVE_HASHDRBG
971#endif
972
973
974/* sniffer requires:
975 * static RSA cipher suites
976 * session stats and peak stats
977 */
978#ifdef WOLFSSL_SNIFFER
979 #ifndef WOLFSSL_STATIC_RSA
980 #define WOLFSSL_STATIC_RSA
981 #endif
982 #ifndef WOLFSSL_SESSION_STATS
983 #define WOLFSSL_SESSION_STATS
984 #endif
985 #ifndef WOLFSSL_PEAK_SESSIONS
986 #define WOLFSSL_PEAK_SESSIONS
987 #endif
988#endif
989
990/* Certificate Request Extensions needs decode extras */
991#ifdef WOLFSSL_CERT_EXT
992 #ifndef RSA_DECODE_EXTRA
993 #define RSA_DECODE_EXTRA
994 #endif
995 #ifndef ECC_DECODE_EXTRA
996 #define ECC_DECODE_EXTRA
997 #endif
998#endif
999
1000/* Place any other flags or defines here */
1001
1002
1003#ifdef __cplusplus
1004 } /* extern "C" */
1005#endif
1006
1007#endif
Note: See TracBrowser for help on using the repository browser.