Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
settings.h
00001 /* settings.h 00002 * 00003 * Copyright (C) 2006-2016 wolfSSL Inc. 00004 * 00005 * This file is part of wolfSSL. 00006 * 00007 * wolfSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * wolfSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 00020 */ 00021 00022 00023 /* Place OS specific preprocessor flags, defines, includes here, will be 00024 included into every file because types.h includes it */ 00025 00026 00027 #ifndef WOLF_CRYPT_SETTINGS_H 00028 #define WOLF_CRYPT_SETTINGS_H 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 /* Uncomment next line if using IPHONE */ 00035 /* #define IPHONE */ 00036 00037 /* Uncomment next line if using ThreadX */ 00038 /* #define THREADX */ 00039 00040 /* Uncomment next line if using Micrium ucOS */ 00041 /* #define MICRIUM */ 00042 00043 /* Uncomment next line if using Mbed */ 00044 /* #define MBED */ 00045 00046 /* Uncomment next line if using Microchip PIC32 ethernet starter kit */ 00047 /* #define MICROCHIP_PIC32 */ 00048 00049 /* Uncomment next line if using Microchip TCP/IP stack, version 5 */ 00050 /* #define MICROCHIP_TCPIP_V5 */ 00051 00052 /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ 00053 /* #define MICROCHIP_TCPIP */ 00054 00055 /* Uncomment next line if using PIC32MZ Crypto Engine */ 00056 /* #define WOLFSSL_MICROCHIP_PIC32MZ */ 00057 00058 /* Uncomment next line if using FreeRTOS */ 00059 /* #define FREERTOS */ 00060 00061 /* Uncomment next line if using FreeRTOS+ TCP */ 00062 /* #define FREERTOS_TCP */ 00063 00064 /* Uncomment next line if using FreeRTOS Windows Simulator */ 00065 /* #define FREERTOS_WINSIM */ 00066 00067 /* Uncomment next line if using RTIP */ 00068 /* #define EBSNET */ 00069 00070 /* Uncomment next line if using lwip */ 00071 /* #define WOLFSSL_LWIP */ 00072 00073 /* Uncomment next line if building wolfSSL for a game console */ 00074 /* #define WOLFSSL_GAME_BUILD */ 00075 00076 /* Uncomment next line if building wolfSSL for LSR */ 00077 /* #define WOLFSSL_LSR */ 00078 00079 /* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */ 00080 /* #define FREESCALE_MQX */ 00081 00082 /* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */ 00083 /* #define FREESCALE_KSDK_MQX */ 00084 00085 /* Uncomment next line if building for Freescale KSDK Bare Metal */ 00086 /* #define FREESCALE_KSDK_BM */ 00087 00088 /* Uncomment next line if building for Freescale FreeRTOS */ 00089 /* #define FREESCALE_FREE_RTOS */ 00090 00091 /* Uncomment next line if using STM32F2 */ 00092 /* #define WOLFSSL_STM32F2 */ 00093 00094 /* Uncomment next line if using Comverge settings */ 00095 /* #define COMVERGE */ 00096 00097 /* Uncomment next line if using QL SEP settings */ 00098 /* #define WOLFSSL_QL */ 00099 00100 /* Uncomment next line if building for EROAD */ 00101 /* #define WOLFSSL_EROAD */ 00102 00103 /* Uncomment next line if building for IAR EWARM */ 00104 /* #define WOLFSSL_IAR_ARM */ 00105 00106 /* Uncomment next line if building for Rowley CrossWorks ARM */ 00107 /* #define WOLFSSL_ROWLEY_ARM */ 00108 00109 /* Uncomment next line if using TI-RTOS settings */ 00110 /* #define WOLFSSL_TIRTOS */ 00111 00112 /* Uncomment next line if building with PicoTCP */ 00113 /* #define WOLFSSL_PICOTCP */ 00114 00115 /* Uncomment next line if building for PicoTCP demo bundle */ 00116 /* #define WOLFSSL_PICOTCP_DEMO */ 00117 00118 /* Uncomment next line if building for uITRON4 */ 00119 /* #define WOLFSSL_uITRON4 */ 00120 00121 /* Uncomment next line if building for uT-Kernel */ 00122 /* #define WOLFSSL_uTKERNEL2 */ 00123 00124 /* Uncomment next line if using Max Strength build */ 00125 /* #define WOLFSSL_MAX_STRENGTH */ 00126 00127 /* Uncomment next line if building for VxWorks */ 00128 /* #define WOLFSSL_VXWORKS */ 00129 00130 /* Uncomment next line to enable deprecated less secure static DH suites */ 00131 /* #define WOLFSSL_STATIC_DH */ 00132 00133 /* Uncomment next line to enable deprecated less secure static RSA suites */ 00134 /* #define WOLFSSL_STATIC_RSA */ 00135 00136 /* Uncomment next line if building for ARDUINO */ 00137 /* #define WOLFSSL_ARDUINO */ 00138 00139 #include <wolfssl/wolfcrypt/visibility.h> 00140 00141 #define WOLFSSL_USER_SETTINGS 00142 #ifdef WOLFSSL_USER_SETTINGS 00143 #include <user_settings.h> 00144 #endif 00145 00146 00147 /* make sure old RNG name is used with CTaoCrypt FIPS */ 00148 #ifdef HAVE_FIPS 00149 #define WC_RNG RNG 00150 #endif 00151 00152 00153 #ifdef IPHONE 00154 #define SIZEOF_LONG_LONG 8 00155 #endif 00156 00157 00158 #ifdef COMVERGE 00159 #define THREADX 00160 #define HAVE_NETX 00161 #define WOLFSSL_USER_IO 00162 #define NO_WRITEV 00163 #define NO_DEV_RANDOM 00164 #define NO_FILESYSTEM 00165 #define NO_SHA512 00166 #define NO_DH 00167 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ 00168 /* WOLFSSL_DH_CONST */ 00169 #define NO_DSA 00170 #define NO_HC128 00171 #define NO_RSA 00172 #define NO_SESSION_CACHE 00173 #define HAVE_ECC 00174 #endif 00175 00176 00177 #ifdef THREADX 00178 #define SIZEOF_LONG_LONG 8 00179 #endif 00180 00181 #ifdef HAVE_NETX 00182 #include "nx_api.h" 00183 #endif 00184 00185 #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ 00186 #define WOLFSSL_LWIP 00187 #define NO_WRITEV 00188 #define SINGLE_THREADED 00189 #define WOLFSSL_USER_IO 00190 #define NO_FILESYSTEM 00191 #endif 00192 00193 #if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM) 00194 #define NO_MAIN_DRIVER 00195 #define SINGLE_THREADED 00196 #define USE_CERT_BUFFERS_1024 00197 #define BENCH_EMBEDDED 00198 #define NO_FILESYSTEM 00199 #define NO_WRITEV 00200 #define WOLFSSL_USER_IO 00201 #define BENCH_EMBEDDED 00202 #endif 00203 00204 #ifdef MICROCHIP_PIC32 00205 /* #define WOLFSSL_MICROCHIP_PIC32MZ */ 00206 #define SIZEOF_LONG_LONG 8 00207 #define SINGLE_THREADED 00208 #define WOLFSSL_USER_IO 00209 #define NO_WRITEV 00210 #define NO_DEV_RANDOM 00211 #define NO_FILESYSTEM 00212 #define USE_FAST_MATH 00213 #define TFM_TIMING_RESISTANT 00214 #define NEED_AES_TABLES 00215 #define WOLFSSL_HAVE_MIN 00216 #endif 00217 00218 #ifdef WOLFSSL_MICROCHIP_PIC32MZ 00219 #define WOLFSSL_PIC32MZ_CE 00220 #define WOLFSSL_PIC32MZ_CRYPT 00221 #define HAVE_AES_ENGINE 00222 #define WOLFSSL_PIC32MZ_RNG 00223 /* #define WOLFSSL_PIC32MZ_HASH */ 00224 #define WOLFSSL_AES_COUNTER 00225 #define HAVE_AESGCM 00226 #define NO_BIG_INT 00227 #endif 00228 00229 #ifdef MICROCHIP_TCPIP_V5 00230 /* include timer functions */ 00231 #include "TCPIP Stack/TCPIP.h" 00232 #endif 00233 00234 #ifdef MICROCHIP_TCPIP 00235 /* include timer, NTP functions */ 00236 #ifdef MICROCHIP_MPLAB_HARMONY 00237 #include "tcpip/tcpip.h" 00238 #else 00239 #include "system/system_services.h" 00240 #include "tcpip/sntp.h" 00241 #endif 00242 #endif 00243 00244 #ifdef MBED 00245 #define WOLFSSL_USER_IO 00246 #define NO_FILESYSTEM 00247 #define NO_CERT 00248 #define USE_CERT_BUFFERS_1024 00249 #define NO_WRITEV 00250 #define NO_DEV_RANDOM 00251 #define NO_SHA512 00252 #define NO_DH 00253 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ 00254 /* WOLFSSL_DH_CONST */ 00255 #define NO_DSA 00256 #define NO_HC128 00257 #define HAVE_ECC 00258 #define NO_SESSION_CACHE 00259 #define WOLFSSL_CMSIS_RTOS 00260 #endif 00261 00262 00263 #ifdef WOLFSSL_EROAD 00264 #define FREESCALE_MQX 00265 #define FREESCALE_MMCAU 00266 #define SINGLE_THREADED 00267 #define NO_STDIO_FILESYSTEM 00268 #define WOLFSSL_LEANPSK 00269 #define HAVE_NULL_CIPHER 00270 #define NO_OLD_TLS 00271 #define NO_ASN 00272 #define NO_BIG_INT 00273 #define NO_RSA 00274 #define NO_DSA 00275 #define NO_DH 00276 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ 00277 /* WOLFSSL_DH_CONST */ 00278 #define NO_CERTS 00279 #define NO_PWDBASED 00280 #define NO_DES3 00281 #define NO_MD4 00282 #define NO_RC4 00283 #define NO_MD5 00284 #define NO_SESSION_CACHE 00285 #define NO_MAIN_DRIVER 00286 #endif 00287 00288 #ifdef WOLFSSL_PICOTCP 00289 #ifndef errno 00290 #define errno pico_err 00291 #endif 00292 #include "pico_defines.h" 00293 #include "pico_stack.h" 00294 #include "pico_constants.h" 00295 #include "pico_protocol.h" 00296 #define CUSTOM_RAND_GENERATE pico_rand 00297 #endif 00298 00299 #ifdef WOLFSSL_PICOTCP_DEMO 00300 #define WOLFSSL_STM32 00301 #define USE_FAST_MATH 00302 #define TFM_TIMING_RESISTANT 00303 #define XMALLOC(s, h, type) PICO_ZALLOC((s)) 00304 #define XFREE(p, h, type) PICO_FREE((p)) 00305 #define SINGLE_THREADED 00306 #define NO_WRITEV 00307 #define WOLFSSL_USER_IO 00308 #define NO_DEV_RANDOM 00309 #define NO_FILESYSTEM 00310 #endif 00311 00312 #ifdef FREERTOS_WINSIM 00313 #define FREERTOS 00314 #define USE_WINDOWS_API 00315 #endif 00316 00317 00318 #ifdef WOLFSSL_VXWORKS 00319 /* VxWorks simulator incorrectly detects building for i386 */ 00320 #ifdef VXWORKS_SIM 00321 #define TFM_NO_ASM 00322 #endif 00323 #define WOLFSSL_HAVE_MIN 00324 #define USE_FAST_MATH 00325 #define TFM_TIMING_RESISTANT 00326 #define NO_MAIN_DRIVER 00327 #define NO_DEV_RANDOM 00328 #define NO_WRITEV 00329 #endif 00330 00331 00332 #ifdef WOLFSSL_ARDUINO 00333 #define NO_WRITEV 00334 #define NO_WOLFSSL_DIR 00335 #define SINGLE_THREADED 00336 #define NO_DEV_RANDOM 00337 #ifndef INTEL_GALILEO /* Galileo has time.h compatibility */ 00338 #define TIME_OVERRIDES /* must define XTIME and XGMTIME externally */ 00339 #endif 00340 #define WOLFSSL_USER_IO 00341 #define HAVE_ECC 00342 #define NO_DH 00343 #define NO_SESSION_CACHE 00344 #define USE_SLOW_SHA 00345 #define NO_WOLFSSL_SERVER 00346 #define NO_ERROR_STRINGS 00347 #endif 00348 00349 00350 /* Micrium will use Visual Studio for compilation but not the Win32 API */ 00351 #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\ 00352 && !defined(EBSNET) && !defined(WOLFSSL_EROAD) 00353 #define USE_WINDOWS_API 00354 #endif 00355 00356 #if defined(WOLFSSL_uITRON4) 00357 00358 #define XMALLOC_USER 00359 #include <stddef.h> 00360 #define ITRON_POOL_SIZE 1024*20 00361 extern int uITRON4_minit(size_t poolsz) ; 00362 extern void *uITRON4_malloc(size_t sz) ; 00363 extern void *uITRON4_realloc(void *p, size_t sz) ; 00364 extern void uITRON4_free(void *p) ; 00365 00366 #define XMALLOC(sz, heap, type) uITRON4_malloc(sz) 00367 #define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz) 00368 #define XFREE(p, heap, type) uITRON4_free(p) 00369 #endif 00370 00371 #if defined(WOLFSSL_uTKERNEL2) 00372 #define WOLFSSL_CLOSESOCKET 00373 #define XMALLOC_USER 00374 int uTKernel_init_mpool(unsigned int sz) ; /* initializing malloc pool */ 00375 void *uTKernel_malloc(unsigned int sz) ; 00376 void *uTKernel_realloc(void *p, unsigned int sz) ; 00377 void uTKernel_free(void *p) ; 00378 #define XMALLOC(s, h, type) uTKernel_malloc((s)) 00379 #define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n)) 00380 #define XFREE(p, h, type) uTKernel_free((p)) 00381 00382 #include <stdio.h> 00383 #include "tm/tmonitor.h" 00384 static char *fgets(char *buff, int sz, FILE *fp) 00385 /*static char * gets(char *buff)*/ 00386 { 00387 char * p = buff ; 00388 *p = '\0' ; 00389 while(1) { 00390 *p = tm_getchar(-1) ; 00391 tm_putchar(*p) ; 00392 if(*p == '\r') { 00393 tm_putchar('\n') ; 00394 *p = '\0' ; 00395 break ; 00396 } 00397 p ++ ; 00398 } 00399 return buff ; 00400 } 00401 00402 #endif 00403 00404 00405 #if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER) 00406 #include <stdlib.h> 00407 #define XMALLOC(s, h, type) malloc((s)) 00408 #define XFREE(p, h, type) free((p)) 00409 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00410 #endif 00411 00412 #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) 00413 #undef XMALLOC 00414 #define XMALLOC yaXMALLOC 00415 #undef XFREE 00416 #define XFREE yaXFREE 00417 #undef XREALLOC 00418 #define XREALLOC yaXREALLOC 00419 #endif 00420 00421 00422 #ifdef FREERTOS 00423 #include "FreeRTOS.h" 00424 00425 /* FreeRTOS pvPortRealloc() only in AVR32_UC3 port */ 00426 #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) 00427 #define XMALLOC(s, h, type) pvPortMalloc((s)) 00428 #define XFREE(p, h, type) vPortFree((p)) 00429 #endif 00430 00431 #ifndef NO_WRITEV 00432 #define NO_WRITEV 00433 #endif 00434 #ifndef HAVE_SHA512 00435 #ifndef NO_SHA512 00436 #define NO_SHA512 00437 #endif 00438 #endif 00439 #ifndef HAVE_DH 00440 #ifndef NO_DH 00441 #define NO_DH 00442 #endif 00443 #endif 00444 #ifndef NO_DSA 00445 #define NO_DSA 00446 #endif 00447 #ifndef NO_HC128 00448 #define NO_HC128 00449 #endif 00450 00451 #ifndef SINGLE_THREADED 00452 #include "semphr.h" 00453 #endif 00454 #endif 00455 00456 #ifdef FREERTOS_TCP 00457 00458 #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) 00459 #define XMALLOC(s, h, type) pvPortMalloc((s)) 00460 #define XFREE(p, h, type) vPortFree((p)) 00461 #endif 00462 00463 #define WOLFSSL_GENSEED_FORTEST 00464 00465 #define NO_WOLFSSL_DIR 00466 #define NO_WRITEV 00467 #define WOLFSSL_HAVE_MIN 00468 #define USE_FAST_MATH 00469 #define TFM_TIMING_REGISTANT 00470 #define NO_MAIN_DRIVER 00471 00472 #endif 00473 00474 #ifdef WOLFSSL_TIRTOS 00475 #define SIZEOF_LONG_LONG 8 00476 #define NO_WRITEV 00477 #define NO_WOLFSSL_DIR 00478 #define USE_FAST_MATH 00479 #define TFM_TIMING_RESISTANT 00480 #define NO_DEV_RANDOM 00481 #define NO_FILESYSTEM 00482 #define USE_CERT_BUFFERS_2048 00483 #define NO_ERROR_STRINGS 00484 #define USER_TIME 00485 #define HAVE_ECC 00486 00487 #ifdef __IAR_SYSTEMS_ICC__ 00488 #pragma diag_suppress=Pa089 00489 #elif !defined(__GNUC__) 00490 /* Suppress the sslpro warning */ 00491 #pragma diag_suppress=11 00492 #endif 00493 00494 #include <ti/sysbios/hal/Seconds.h> 00495 #endif 00496 00497 #ifdef EBSNET 00498 #include "rtip.h" 00499 00500 /* #define DEBUG_WOLFSSL */ 00501 #define NO_WOLFSSL_DIR /* tbd */ 00502 00503 #if (POLLOS) 00504 #define SINGLE_THREADED 00505 #endif 00506 00507 #if (RTPLATFORM) 00508 #if (!RTP_LITTLE_ENDIAN) 00509 #define BIG_ENDIAN_ORDER 00510 #endif 00511 #else 00512 #if (!KS_LITTLE_ENDIAN) 00513 #define BIG_ENDIAN_ORDER 00514 #endif 00515 #endif 00516 00517 #if (WINMSP3) 00518 #undef SIZEOF_LONG 00519 #define SIZEOF_LONG_LONG 8 00520 #else 00521 #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG 00522 #endif 00523 00524 #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) 00525 #define XFREE(p, h, type) (rtp_free(p)) 00526 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00527 00528 #endif /* EBSNET */ 00529 00530 #ifdef WOLFSSL_GAME_BUILD 00531 #define SIZEOF_LONG_LONG 8 00532 #if defined(__PPU) || defined(__XENON) 00533 #define BIG_ENDIAN_ORDER 00534 #endif 00535 #endif 00536 00537 #ifdef WOLFSSL_LSR 00538 #define HAVE_WEBSERVER 00539 #define SIZEOF_LONG_LONG 8 00540 #define WOLFSSL_LOW_MEMORY 00541 #define NO_WRITEV 00542 #define NO_SHA512 00543 #define NO_DH 00544 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ 00545 /* WOLFSSL_DH_CONST */ 00546 #define NO_DSA 00547 #define NO_HC128 00548 #define NO_DEV_RANDOM 00549 #define NO_WOLFSSL_DIR 00550 #define NO_RABBIT 00551 #ifndef NO_FILESYSTEM 00552 #define LSR_FS 00553 #include "inc/hw_types.h" 00554 #include "fs.h" 00555 #endif 00556 #define WOLFSSL_LWIP 00557 #include <errno.h> /* for tcp errno */ 00558 #define WOLFSSL_SAFERTOS 00559 #if defined(__IAR_SYSTEMS_ICC__) 00560 /* enum uses enum */ 00561 #pragma diag_suppress=Pa089 00562 #endif 00563 #endif 00564 00565 #ifdef WOLFSSL_SAFERTOS 00566 #ifndef SINGLE_THREADED 00567 #include "SafeRTOS/semphr.h" 00568 #endif 00569 00570 #include "SafeRTOS/heap.h" 00571 #define XMALLOC(s, h, type) pvPortMalloc((s)) 00572 #define XFREE(p, h, type) vPortFree((p)) 00573 #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) 00574 #endif 00575 00576 #ifdef WOLFSSL_LOW_MEMORY 00577 #undef RSA_LOW_MEM 00578 #define RSA_LOW_MEM 00579 #undef WOLFSSL_SMALL_STACK 00580 #define WOLFSSL_SMALL_STACK 00581 #undef TFM_TIMING_RESISTANT 00582 #define TFM_TIMING_RESISTANT 00583 #endif 00584 00585 #ifdef FREESCALE_MQX 00586 #define FREESCALE_COMMON 00587 #include "mqx.h" 00588 #ifndef NO_FILESYSTEM 00589 #include "mfs.h" 00590 #if MQX_USE_IO_OLD 00591 #include "fio.h" 00592 #else 00593 #include "nio.h" 00594 #endif 00595 #endif 00596 #ifndef SINGLE_THREADED 00597 #include "mutex.h" 00598 #endif 00599 00600 #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) 00601 #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} 00602 /* Note: MQX has no realloc, using fastmath above */ 00603 #endif 00604 00605 #ifdef FREESCALE_KSDK_MQX 00606 #define FREESCALE_COMMON 00607 #include <mqx.h> 00608 #ifndef NO_FILESYSTEM 00609 #if MQX_USE_IO_OLD 00610 #include <fio.h> 00611 #else 00612 #include <stdio.h> 00613 #include <nio.h> 00614 #endif 00615 #endif 00616 #ifndef SINGLE_THREADED 00617 #include <mutex.h> 00618 #endif 00619 00620 #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) 00621 #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} 00622 #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */ 00623 00624 #define MQX_FILE_PTR FILE * 00625 #define IO_SEEK_SET SEEK_SET 00626 #define IO_SEEK_END SEEK_END 00627 #endif 00628 00629 #ifdef FREESCALE_KSDK_BM 00630 #define FREESCALE_COMMON 00631 #define WOLFSSL_USER_IO 00632 #define SINGLE_THREADED 00633 #define NO_FILESYSTEM 00634 #define USE_WOLFSSL_MEMORY 00635 #endif 00636 00637 #ifdef FREESCALE_FREE_RTOS 00638 #define FREESCALE_COMMON 00639 #define NO_FILESYSTEM 00640 #define NO_MAIN_DRIVER 00641 #define XMALLOC(s, h, t) OSA_MemAlloc(s);(void)h;(void)t; 00642 #define XFREE(p, h, t) {void* xp = (p); if((xp)) OSA_MemFree((xp));} 00643 #ifdef FREESCALE_KSDK_BM 00644 #error Baremetal and FreeRTOS cannot be both enabled at the same time! 00645 #endif 00646 #ifndef SINGLE_THREADED 00647 #include "FreeRTOS.h" 00648 #include "semphr.h" 00649 #endif 00650 #endif 00651 00652 #ifdef FREESCALE_COMMON 00653 #define SIZEOF_LONG_LONG 8 00654 00655 /* disable features */ 00656 #define NO_WRITEV 00657 #define NO_DEV_RANDOM 00658 #define NO_RABBIT 00659 #define NO_WOLFSSL_DIR 00660 00661 /* enable features */ 00662 #define USE_FAST_MATH 00663 #define HAVE_ECC 00664 #define HAVE_AESGCM 00665 00666 /* memory reduction */ 00667 #define TFM_TIMING_RESISTANT 00668 #define ECC_TIMING_RESISTANT 00669 #define ALT_ECC_SIZE 00670 00671 /* setting for PIT timer */ 00672 #define PIT_INSTANCE 0 00673 #define PIT_CHANNEL 0 00674 00675 #if defined(FREESCALE_KSDK_MQX) || defined(FREESCALE_KSDK_BM) || \ 00676 defined(FREESCALE_FREE_RTOS) 00677 #include "fsl_device_registers.h" 00678 #endif 00679 00680 /* random seed */ 00681 #define NO_OLD_RNGNAME 00682 #if (FSL_FEATURE_SOC_TRNG_COUNT > 0) 00683 #define FREESCALE_TRNG 00684 #define TRNG_INSTANCE (0) 00685 #elif (FSL_FEATURE_SOC_RNG_COUNT > 0) 00686 #include "fsl_rnga_driver.h" 00687 #define FREESCALE_RNGA 00688 #define RNGA_INSTANCE (0) 00689 #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS) 00690 /* defaulting to K70 RNGA, user should change if different */ 00691 /* #define FREESCALE_K53_RNGB */ 00692 #define FREESCALE_K70_RNGA 00693 #endif 00694 00695 /* HW crypto */ 00696 /* #define FREESCALE_MMCAU */ 00697 #endif 00698 00699 #ifdef WOLFSSL_STM32F2 00700 #define SIZEOF_LONG_LONG 8 00701 #define NO_DEV_RANDOM 00702 #define NO_WOLFSSL_DIR 00703 #define NO_RABBIT 00704 #define STM32F2_RNG 00705 #define STM32F2_CRYPTO 00706 #define KEIL_INTRINSICS 00707 #endif 00708 00709 #ifdef MICRIUM 00710 00711 #include "stdlib.h" 00712 #include "net_cfg.h" 00713 #include "ssl_cfg.h" 00714 #include "net_secure_os.h" 00715 00716 #define WOLFSSL_TYPES 00717 00718 typedef CPU_INT08U byte; 00719 typedef CPU_INT16U word16; 00720 typedef CPU_INT32U word32; 00721 00722 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) 00723 #define SIZEOF_LONG 4 00724 #undef SIZEOF_LONG_LONG 00725 #else 00726 #undef SIZEOF_LONG 00727 #define SIZEOF_LONG_LONG 8 00728 #endif 00729 00730 #define STRING_USER 00731 00732 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) 00733 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ 00734 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ 00735 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) 00736 #define XSTRNCMP(pstr_1, pstr_2, len_max) \ 00737 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ 00738 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) 00739 #define XSTRSTR(pstr, pstr_srch) \ 00740 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ 00741 (CPU_CHAR *)(pstr_srch))) 00742 #define XMEMSET(pmem, data_val, size) \ 00743 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ 00744 (CPU_SIZE_T)(size))) 00745 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ 00746 (void *)(psrc), (CPU_SIZE_T)(size))) 00747 #define XMEMCMP(pmem_1, pmem_2, size) \ 00748 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ 00749 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) 00750 #define XMEMMOVE XMEMCPY 00751 00752 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) 00753 #define MICRIUM_MALLOC 00754 #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ 00755 (CPU_SIZE_T)(s), (void *)0)) 00756 #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ 00757 (p), (void *)0)) 00758 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00759 #endif 00760 00761 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) 00762 #undef NO_FILESYSTEM 00763 #else 00764 #define NO_FILESYSTEM 00765 #endif 00766 00767 #if (SSL_CFG_TRACE_LEVEL == WOLFSSL_TRACE_LEVEL_DBG) 00768 #define DEBUG_WOLFSSL 00769 #else 00770 #undef DEBUG_WOLFSSL 00771 #endif 00772 00773 #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) 00774 #define OPENSSL_EXTRA 00775 #else 00776 #undef OPENSSL_EXTRA 00777 #endif 00778 00779 #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) 00780 #undef SINGLE_THREADED 00781 #else 00782 #define SINGLE_THREADED 00783 #endif 00784 00785 #if (SSL_CFG_DH_EN == DEF_ENABLED) 00786 #undef NO_DH 00787 #else 00788 #define NO_DH 00789 #endif 00790 00791 #if (SSL_CFG_DSA_EN == DEF_ENABLED) 00792 #undef NO_DSA 00793 #else 00794 #define NO_DSA 00795 #endif 00796 00797 #if (SSL_CFG_PSK_EN == DEF_ENABLED) 00798 #undef NO_PSK 00799 #else 00800 #define NO_PSK 00801 #endif 00802 00803 #if (SSL_CFG_3DES_EN == DEF_ENABLED) 00804 #undef NO_DES 00805 #else 00806 #define NO_DES 00807 #endif 00808 00809 #if (SSL_CFG_AES_EN == DEF_ENABLED) 00810 #undef NO_AES 00811 #else 00812 #define NO_AES 00813 #endif 00814 00815 #if (SSL_CFG_RC4_EN == DEF_ENABLED) 00816 #undef NO_RC4 00817 #else 00818 #define NO_RC4 00819 #endif 00820 00821 #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) 00822 #undef NO_RABBIT 00823 #else 00824 #define NO_RABBIT 00825 #endif 00826 00827 #if (SSL_CFG_HC128_EN == DEF_ENABLED) 00828 #undef NO_HC128 00829 #else 00830 #define NO_HC128 00831 #endif 00832 00833 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) 00834 #define BIG_ENDIAN_ORDER 00835 #else 00836 #undef BIG_ENDIAN_ORDER 00837 #define LITTLE_ENDIAN_ORDER 00838 #endif 00839 00840 #if (SSL_CFG_MD4_EN == DEF_ENABLED) 00841 #undef NO_MD4 00842 #else 00843 #define NO_MD4 00844 #endif 00845 00846 #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) 00847 #undef NO_WRITEV 00848 #else 00849 #define NO_WRITEV 00850 #endif 00851 00852 #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) 00853 #define NO_DEV_RANDOM 00854 #else 00855 #undef NO_DEV_RANDOM 00856 #endif 00857 00858 #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) 00859 #define WOLFSSL_USER_IO 00860 #else 00861 #undef WOLFSSL_USER_IO 00862 #endif 00863 00864 #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) 00865 #undef LARGE_STATIC_BUFFERS 00866 #undef STATIC_CHUNKS_ONLY 00867 #else 00868 #define LARGE_STATIC_BUFFERS 00869 #define STATIC_CHUNKS_ONLY 00870 #endif 00871 00872 #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) 00873 #define WOLFSSL_DER_LOAD 00874 #else 00875 #undef WOLFSSL_DER_LOAD 00876 #endif 00877 00878 #if (SSL_CFG_DTLS_EN == DEF_ENABLED) 00879 #define WOLFSSL_DTLS 00880 #else 00881 #undef WOLFSSL_DTLS 00882 #endif 00883 00884 #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) 00885 #define WOLFSSL_CALLBACKS 00886 #else 00887 #undef WOLFSSL_CALLBACKS 00888 #endif 00889 00890 #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) 00891 #define USE_FAST_MATH 00892 #else 00893 #undef USE_FAST_MATH 00894 #endif 00895 00896 #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) 00897 #define TFM_TIMING_RESISTANT 00898 #else 00899 #undef TFM_TIMING_RESISTANT 00900 #endif 00901 00902 #endif /* MICRIUM */ 00903 00904 00905 #ifdef WOLFSSL_QL 00906 #ifndef WOLFSSL_SEP 00907 #define WOLFSSL_SEP 00908 #endif 00909 #ifndef OPENSSL_EXTRA 00910 #define OPENSSL_EXTRA 00911 #endif 00912 #ifndef SESSION_CERTS 00913 #define SESSION_CERTS 00914 #endif 00915 #ifndef HAVE_AESCCM 00916 #define HAVE_AESCCM 00917 #endif 00918 #ifndef ATOMIC_USER 00919 #define ATOMIC_USER 00920 #endif 00921 #ifndef WOLFSSL_DER_LOAD 00922 #define WOLFSSL_DER_LOAD 00923 #endif 00924 #ifndef KEEP_PEER_CERT 00925 #define KEEP_PEER_CERT 00926 #endif 00927 #ifndef HAVE_ECC 00928 #define HAVE_ECC 00929 #endif 00930 #ifndef SESSION_INDEX 00931 #define SESSION_INDEX 00932 #endif 00933 #endif /* WOLFSSL_QL */ 00934 00935 00936 #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ 00937 !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) 00938 #define USE_WOLFSSL_MEMORY 00939 #endif 00940 00941 00942 #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) 00943 #undef KEEP_PEER_CERT 00944 #define KEEP_PEER_CERT 00945 #endif 00946 00947 00948 /* stream ciphers except arc4 need 32bit alignment, intel ok without */ 00949 #ifndef XSTREAM_ALIGN 00950 #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) 00951 #define NO_XSTREAM_ALIGN 00952 #else 00953 #define XSTREAM_ALIGN 00954 #endif 00955 #endif 00956 00957 00958 /* FreeScale MMCAU hardware crypto has 4 byte alignment */ 00959 #ifdef FREESCALE_MMCAU 00960 #define WOLFSSL_MMCAU_ALIGNMENT 4 00961 #endif 00962 00963 /* if using hardware crypto and have alignment requirements, specify the 00964 requirement here. The record header of SSL/TLS will prevent easy alignment. 00965 This hint tries to help as much as possible. */ 00966 #ifndef WOLFSSL_GENERAL_ALIGNMENT 00967 #ifdef WOLFSSL_AESNI 00968 #define WOLFSSL_GENERAL_ALIGNMENT 16 00969 #elif defined(XSTREAM_ALIGN) 00970 #define WOLFSSL_GENERAL_ALIGNMENT 4 00971 #elif defined(FREESCALE_MMCAU) 00972 #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT 00973 #else 00974 #define WOLFSSL_GENERAL_ALIGNMENT 0 00975 #endif 00976 #endif 00977 00978 #if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0) 00979 #if defined(_MSC_VER) 00980 #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT)) 00981 #elif defined(__GNUC__) 00982 #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT))) 00983 #else 00984 #define XGEN_ALIGN 00985 #endif 00986 #else 00987 #define XGEN_ALIGN 00988 #endif 00989 00990 #ifdef HAVE_CRL 00991 /* not widely supported yet */ 00992 #undef NO_SKID 00993 #define NO_SKID 00994 #endif 00995 00996 00997 #ifdef __INTEL_COMPILER 00998 #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */ 00999 #endif 01000 01001 /* user can specify what curves they want with ECC_USER_CURVES otherwise 01002 * all curves are on by default for now */ 01003 #ifndef ECC_USER_CURVES 01004 #ifndef HAVE_ALL_CURVES 01005 #define HAVE_ALL_CURVES 01006 #endif 01007 #endif 01008 01009 /* ECC Configs */ 01010 #ifdef HAVE_ECC 01011 /* By default enable Sign, Verify, DHE, Key Import and Key Export unless explicitly disabled */ 01012 #ifndef NO_ECC_SIGN 01013 #undef HAVE_ECC_SIGN 01014 #define HAVE_ECC_SIGN 01015 #endif 01016 #ifndef NO_ECC_VERIFY 01017 #undef HAVE_ECC_VERIFY 01018 #define HAVE_ECC_VERIFY 01019 #endif 01020 #ifndef NO_ECC_DHE 01021 #undef HAVE_ECC_DHE 01022 #define HAVE_ECC_DHE 01023 #endif 01024 #ifndef NO_ECC_KEY_IMPORT 01025 #undef HAVE_ECC_KEY_IMPORT 01026 #define HAVE_ECC_KEY_IMPORT 01027 #endif 01028 #ifndef NO_ECC_KEY_EXPORT 01029 #undef HAVE_ECC_KEY_EXPORT 01030 #define HAVE_ECC_KEY_EXPORT 01031 #endif 01032 #endif /* HAVE_ECC */ 01033 01034 /* Curve255519 Configs */ 01035 #ifdef HAVE_CURVE25519 01036 /* By default enable shared secret, key export and import */ 01037 #ifndef NO_CURVE25519_SHARED_SECRET 01038 #undef HAVE_CURVE25519_SHARED_SECRET 01039 #define HAVE_CURVE25519_SHARED_SECRET 01040 #endif 01041 #ifndef NO_CURVE25519_KEY_EXPORT 01042 #undef HAVE_CURVE25519_KEY_EXPORT 01043 #define HAVE_CURVE25519_KEY_EXPORT 01044 #endif 01045 #ifndef NO_CURVE25519_KEY_IMPORT 01046 #undef HAVE_CURVE25519_KEY_IMPORT 01047 #define HAVE_CURVE25519_KEY_IMPORT 01048 #endif 01049 #endif /* HAVE_CURVE25519 */ 01050 01051 /* Ed255519 Configs */ 01052 #ifdef HAVE_ED25519 01053 /* By default enable sign, verify, key export and import */ 01054 #ifndef NO_ED25519_SIGN 01055 #undef HAVE_ED25519_SIGN 01056 #define HAVE_ED25519_SIGN 01057 #endif 01058 #ifndef NO_ED25519_VERIFY 01059 #undef HAVE_ED25519_VERIFY 01060 #define HAVE_ED25519_VERIFY 01061 #endif 01062 #ifndef NO_ED25519_KEY_EXPORT 01063 #undef HAVE_ED25519_KEY_EXPORT 01064 #define HAVE_ED25519_KEY_EXPORT 01065 #endif 01066 #ifndef NO_ED25519_KEY_IMPORT 01067 #undef HAVE_ED25519_KEY_IMPORT 01068 #define HAVE_ED25519_KEY_IMPORT 01069 #endif 01070 #endif /* HAVE_ED25519 */ 01071 01072 /* AES Config */ 01073 #ifndef NO_AES 01074 /* By default enable all AES key sizes, decryption and CBC */ 01075 #ifndef AES_MAX_KEY_SIZE 01076 #undef AES_MAX_KEY_SIZE 01077 #define AES_MAX_KEY_SIZE 256 01078 #endif 01079 #ifndef NO_AES_DECRYPT 01080 #undef HAVE_AES_DECRYPT 01081 #define HAVE_AES_DECRYPT 01082 #endif 01083 #ifndef NO_AES_CBC 01084 #undef HAVE_AES_CBC 01085 #define HAVE_AES_CBC 01086 #else 01087 #ifndef WOLFCRYPT_ONLY 01088 #error "AES CBC is required for TLS and can only be disabled for WOLFCRYPT_ONLY builds" 01089 #endif 01090 #endif 01091 #endif 01092 01093 /* if desktop type system and fastmath increase default max bits */ 01094 #ifdef WOLFSSL_X86_64_BUILD 01095 #ifdef USE_FAST_MATH 01096 #ifndef FP_MAX_BITS 01097 #define FP_MAX_BITS 8192 01098 #endif 01099 #endif 01100 #endif 01101 01102 /* If using the max strength build, ensure OLD TLS is disabled. */ 01103 #ifdef WOLFSSL_MAX_STRENGTH 01104 #undef NO_OLD_TLS 01105 #define NO_OLD_TLS 01106 #endif 01107 01108 /* If not forcing ARC4 as the DRBG or using custom RNG block gen, enable Hash_DRBG */ 01109 #undef HAVE_HASHDRBG 01110 #if !defined(WOLFSSL_FORCE_RC4_DRBG) && !defined(CUSTOM_RAND_GENERATE_BLOCK) 01111 #define HAVE_HASHDRBG 01112 #endif 01113 01114 01115 /* sniffer requires: 01116 * static RSA cipher suites 01117 * session stats and peak stats 01118 */ 01119 #ifdef WOLFSSL_SNIFFER 01120 #ifndef WOLFSSL_STATIC_RSA 01121 #define WOLFSSL_STATIC_RSA 01122 #endif 01123 #ifndef WOLFSSL_SESSION_STATS 01124 #define WOLFSSL_SESSION_STATS 01125 #endif 01126 #ifndef WOLFSSL_PEAK_SESSIONS 01127 #define WOLFSSL_PEAK_SESSIONS 01128 #endif 01129 #endif 01130 01131 /* Decode Public Key extras on by default, user can turn off with 01132 * WOLFSSL_NO_DECODE_EXTRA */ 01133 #ifndef WOLFSSL_NO_DECODE_EXTRA 01134 #ifndef RSA_DECODE_EXTRA 01135 #define RSA_DECODE_EXTRA 01136 #endif 01137 #ifndef ECC_DECODE_EXTRA 01138 #define ECC_DECODE_EXTRA 01139 #endif 01140 #endif 01141 01142 /* C Sharp wrapper defines */ 01143 #ifdef HAVE_CSHARP 01144 #ifndef WOLFSSL_DTLS 01145 #define WOLFSSL_DTLS 01146 #endif 01147 #undef NO_PSK 01148 #undef NO_SHA256 01149 #undef NO_DH 01150 #endif 01151 01152 /* Place any other flags or defines here */ 01153 01154 01155 #ifdef __cplusplus 01156 } /* extern "C" */ 01157 #endif 01158 01159 #endif 01160
Generated on Tue Jul 12 2022 15:55:20 by
1.7.2