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-2013 wolfSSL Inc. 00004 * 00005 * This file is part of CyaSSL. 00006 * 00007 * CyaSSL 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 * CyaSSL 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 00022 /* Place OS specific preprocessor flags, defines, includes here, will be 00023 included into every file because types.h includes it */ 00024 00025 00026 #ifndef CTAO_CRYPT_SETTINGS_H 00027 #define CTAO_CRYPT_SETTINGS_H 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 /* Uncomment next line if using IPHONE */ 00034 /* #define IPHONE */ 00035 00036 /* Uncomment next line if using ThreadX */ 00037 /* #define THREADX */ 00038 00039 /* Uncomment next line if using Micrium ucOS */ 00040 /* #define MICRIUM */ 00041 00042 /* Uncomment next line if using Mbed */ 00043 /* #define 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 FreeRTOS */ 00056 /* #define FREERTOS */ 00057 00058 /* Uncomment next line if using FreeRTOS Windows Simulator */ 00059 /* #define FREERTOS_WINSIM */ 00060 00061 /* Uncomment next line if using RTIP */ 00062 /* #define EBSNET */ 00063 00064 /* Uncomment next line if using lwip */ 00065 /* #define CYASSL_LWIP */ 00066 00067 /* Uncomment next line if building CyaSSL for a game console */ 00068 /* #define CYASSL_GAME_BUILD */ 00069 00070 /* Uncomment next line if building CyaSSL for LSR */ 00071 /* #define CYASSL_LSR */ 00072 00073 /* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */ 00074 /* #define FREESCALE_MQX */ 00075 00076 /* Uncomment next line if using STM32F2 */ 00077 /* #define CYASSL_STM32F2 */ 00078 00079 /* Uncomment next line if using Comverge settings */ 00080 /* #define COMVERGE */ 00081 00082 00083 #include <cyassl/ctaocrypt/visibility.h> 00084 00085 #ifdef IPHONE 00086 #define SIZEOF_LONG_LONG 8 00087 #endif 00088 00089 00090 #ifdef COMVERGE 00091 #define THREADX 00092 #define HAVE_NETX 00093 #define CYASSL_USER_IO 00094 #define NO_WRITEV 00095 #define NO_DEV_RANDOM 00096 #define NO_FILESYSTEM 00097 #define NO_SHA512 00098 #define NO_DH 00099 #define NO_DSA 00100 #define NO_HC128 00101 #define NO_RSA 00102 #define NO_SESSION_CACHE 00103 #define HAVE_ECC 00104 #endif 00105 00106 00107 #ifdef THREADX 00108 #define SIZEOF_LONG_LONG 8 00109 #endif 00110 00111 #ifdef HAVE_NETX 00112 #include "nx_api.h" 00113 #endif 00114 00115 #ifdef MICROCHIP_PIC32 00116 #define SIZEOF_LONG_LONG 8 00117 #define SINGLE_THREADED 00118 #define CYASSL_USER_IO 00119 #define NO_WRITEV 00120 #define NO_DEV_RANDOM 00121 #define NO_FILESYSTEM 00122 #define USE_FAST_MATH 00123 #define TFM_TIMING_RESISTANT 00124 #endif 00125 00126 #ifdef MICROCHIP_TCPIP_V5 00127 /* include timer functions */ 00128 #include "TCPIP Stack/TCPIP.h" 00129 #endif 00130 00131 #ifdef MICROCHIP_TCPIP 00132 /* include timer, NTP functions */ 00133 #include "system/system_services.h" 00134 #ifdef MICROCHIP_MPLAB_HARMONY 00135 #include "tcpip/tcpip.h" 00136 #else 00137 #include "tcpip/sntp.h" 00138 #endif 00139 #endif 00140 00141 #ifdef MBED 00142 //#define SINGLE_THREADED 00143 #define CYASSL_USER_IO 00144 #define NO_FILESYSTEM 00145 #define NO_CERT 00146 #define USE_CERT_BUFFERS_1024 00147 #define NO_WRITEV 00148 #define NO_DEV_RANDOM 00149 #define NO_SHA512 00150 #define NO_DH 00151 #define NO_DSA 00152 #define NO_HC128 00153 #define HAVE_ECC 00154 #define NO_SESSION_CACHE 00155 #define CYASSL_CMSIS_RTOS 00156 #endif 00157 00158 #ifdef CYASSL_TYTO 00159 #define FREERTOS 00160 #define NO_FILESYSTEM 00161 #define CYASSL_USER_IO 00162 #define NO_DEV_RANDOM 00163 #endif 00164 00165 #ifdef FREERTOS_WINSIM 00166 #define FREERTOS 00167 #define USE_WINDOWS_API 00168 #endif 00169 00170 00171 /* Micrium will use Visual Studio for compilation but not the Win32 API */ 00172 #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ 00173 && !defined(EBSNET) 00174 #define USE_WINDOWS_API 00175 #endif 00176 00177 00178 #if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER) 00179 #include <stdlib.h> 00180 #define XMALLOC(s, h, type) malloc((s)) 00181 #define XFREE(p, h, type) free((p)) 00182 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00183 #endif 00184 00185 #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) 00186 #undef XMALLOC 00187 #define XMALLOC yaXMALLOC 00188 #undef XFREE 00189 #define XFREE yaXFREE 00190 #undef XREALLOC 00191 #define XREALLOC yaXREALLOC 00192 #endif 00193 00194 00195 #ifdef FREERTOS 00196 #ifndef NO_WRITEV 00197 #define NO_WRITEV 00198 #endif 00199 #ifndef NO_SHA512 00200 #define NO_SHA512 00201 #endif 00202 #ifndef NO_DH 00203 #define NO_DH 00204 #endif 00205 #ifndef NO_DSA 00206 #define NO_DSA 00207 #endif 00208 #ifndef NO_HC128 00209 #define NO_HC128 00210 #endif 00211 00212 #ifndef SINGLE_THREADED 00213 #include "FreeRTOS.h" 00214 #include "semphr.h" 00215 #endif 00216 #endif 00217 00218 #ifdef EBSNET 00219 #include "rtip.h" 00220 00221 /* #define DEBUG_CYASSL */ 00222 #define NO_CYASSL_DIR /* tbd */ 00223 00224 #if (POLLOS) 00225 #define SINGLE_THREADED 00226 #endif 00227 00228 #if (RTPLATFORM) 00229 #if (!RTP_LITTLE_ENDIAN) 00230 #define BIG_ENDIAN_ORDER 00231 #endif 00232 #else 00233 #if (!KS_LITTLE_ENDIAN) 00234 #define BIG_ENDIAN_ORDER 00235 #endif 00236 #endif 00237 00238 #if (WINMSP3) 00239 #undef SIZEOF_LONG 00240 #define SIZEOF_LONG_LONG 8 00241 #else 00242 #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG 00243 #endif 00244 00245 #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) 00246 #define XFREE(p, h, type) (rtp_free(p)) 00247 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00248 00249 #endif /* EBSNET */ 00250 00251 #ifdef CYASSL_GAME_BUILD 00252 #define SIZEOF_LONG_LONG 8 00253 #if defined(__PPU) || defined(__XENON) 00254 #define BIG_ENDIAN_ORDER 00255 #endif 00256 #endif 00257 00258 #ifdef CYASSL_LSR 00259 #define HAVE_WEBSERVER 00260 #define SIZEOF_LONG_LONG 8 00261 #define CYASSL_LOW_MEMORY 00262 #define NO_WRITEV 00263 #define NO_SHA512 00264 #define NO_DH 00265 #define NO_DSA 00266 #define NO_HC128 00267 #define NO_DEV_RANDOM 00268 #define NO_CYASSL_DIR 00269 #define NO_RABBIT 00270 #ifndef NO_FILESYSTEM 00271 #define LSR_FS 00272 #include "inc/hw_types.h" 00273 #include "fs.h" 00274 #endif 00275 #define CYASSL_LWIP 00276 #include <errno.h> /* for tcp errno */ 00277 #define CYASSL_SAFERTOS 00278 #if defined(__IAR_SYSTEMS_ICC__) 00279 /* enum uses enum */ 00280 #pragma diag_suppress=Pa089 00281 #endif 00282 #endif 00283 00284 #ifdef CYASSL_SAFERTOS 00285 #ifndef SINGLE_THREADED 00286 #include "SafeRTOS/semphr.h" 00287 #endif 00288 00289 #include "SafeRTOS/heap.h" 00290 #define XMALLOC(s, h, type) pvPortMalloc((s)) 00291 #define XFREE(p, h, type) vPortFree((p)) 00292 #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) 00293 #endif 00294 00295 #ifdef CYASSL_LOW_MEMORY 00296 #undef RSA_LOW_MEM 00297 #define RSA_LOW_MEM 00298 #undef CYASSL_SMALL_STACK 00299 #define CYASSL_SMALL_STACK 00300 #undef TFM_TIMING_RESISTANT 00301 #define TFM_TIMING_RESISTANT 00302 #endif 00303 00304 #ifdef FREESCALE_MQX 00305 #define SIZEOF_LONG_LONG 8 00306 #define NO_WRITEV 00307 #define NO_DEV_RANDOM 00308 #define NO_RABBIT 00309 #define NO_CYASSL_DIR 00310 #define USE_FAST_MATH 00311 #define TFM_TIMING_RESISTANT 00312 #define FREESCALE_K70_RNGA 00313 /* #define FREESCALE_K53_RNGB */ 00314 #include "mqx.h" 00315 #ifndef NO_FILESYSTEM 00316 #include "mfs.h" 00317 #include "fio.h" 00318 #endif 00319 #ifndef SINGLE_THREADED 00320 #include "mutex.h" 00321 #endif 00322 00323 #define XMALLOC(s, h, type) (void *)_mem_alloc_system((s)) 00324 #define XFREE(p, h, type) _mem_free(p) 00325 /* Note: MQX has no realloc, using fastmath above */ 00326 #endif 00327 00328 #ifdef CYASSL_STM32F2 00329 #define SIZEOF_LONG_LONG 8 00330 #define NO_DEV_RANDOM 00331 #define NO_CYASSL_DIR 00332 #define NO_RABBIT 00333 #define STM32F2_RNG 00334 #define STM32F2_CRYPTO 00335 #define KEIL_INTRINSICS 00336 #endif 00337 00338 #ifdef MICRIUM 00339 00340 #include "stdlib.h" 00341 #include "net_cfg.h" 00342 #include "ssl_cfg.h" 00343 #include "net_secure_os.h" 00344 00345 #define CYASSL_TYPES 00346 00347 typedef CPU_INT08U byte; 00348 typedef CPU_INT16U word16; 00349 typedef CPU_INT32U word32; 00350 00351 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) 00352 #define SIZEOF_LONG 4 00353 #undef SIZEOF_LONG_LONG 00354 #else 00355 #undef SIZEOF_LONG 00356 #define SIZEOF_LONG_LONG 8 00357 #endif 00358 00359 #define STRING_USER 00360 00361 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) 00362 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ 00363 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ 00364 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) 00365 #define XSTRNCMP(pstr_1, pstr_2, len_max) \ 00366 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ 00367 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) 00368 #define XSTRSTR(pstr, pstr_srch) \ 00369 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ 00370 (CPU_CHAR *)(pstr_srch))) 00371 #define XMEMSET(pmem, data_val, size) \ 00372 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ 00373 (CPU_SIZE_T)(size))) 00374 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ 00375 (void *)(psrc), (CPU_SIZE_T)(size))) 00376 #define XMEMCMP(pmem_1, pmem_2, size) \ 00377 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ 00378 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) 00379 #define XMEMMOVE XMEMCPY 00380 00381 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) 00382 #define MICRIUM_MALLOC 00383 #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ 00384 (CPU_SIZE_T)(s), (void *)0)) 00385 #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ 00386 (p), (void *)0)) 00387 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00388 #endif 00389 00390 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) 00391 #undef NO_FILESYSTEM 00392 #else 00393 #define NO_FILESYSTEM 00394 #endif 00395 00396 #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) 00397 #define DEBUG_CYASSL 00398 #else 00399 #undef DEBUG_CYASSL 00400 #endif 00401 00402 #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) 00403 #define OPENSSL_EXTRA 00404 #else 00405 #undef OPENSSL_EXTRA 00406 #endif 00407 00408 #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) 00409 #undef SINGLE_THREADED 00410 #else 00411 #define SINGLE_THREADED 00412 #endif 00413 00414 #if (SSL_CFG_DH_EN == DEF_ENABLED) 00415 #undef NO_DH 00416 #else 00417 #define NO_DH 00418 #endif 00419 00420 #if (SSL_CFG_DSA_EN == DEF_ENABLED) 00421 #undef NO_DSA 00422 #else 00423 #define NO_DSA 00424 #endif 00425 00426 #if (SSL_CFG_PSK_EN == DEF_ENABLED) 00427 #undef NO_PSK 00428 #else 00429 #define NO_PSK 00430 #endif 00431 00432 #if (SSL_CFG_3DES_EN == DEF_ENABLED) 00433 #undef NO_DES 00434 #else 00435 #define NO_DES 00436 #endif 00437 00438 #if (SSL_CFG_AES_EN == DEF_ENABLED) 00439 #undef NO_AES 00440 #else 00441 #define NO_AES 00442 #endif 00443 00444 #if (SSL_CFG_RC4_EN == DEF_ENABLED) 00445 #undef NO_RC4 00446 #else 00447 #define NO_RC4 00448 #endif 00449 00450 #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) 00451 #undef NO_RABBIT 00452 #else 00453 #define NO_RABBIT 00454 #endif 00455 00456 #if (SSL_CFG_HC128_EN == DEF_ENABLED) 00457 #undef NO_HC128 00458 #else 00459 #define NO_HC128 00460 #endif 00461 00462 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) 00463 #define BIG_ENDIAN_ORDER 00464 #else 00465 #undef BIG_ENDIAN_ORDER 00466 #define LITTLE_ENDIAN_ORDER 00467 #endif 00468 00469 #if (SSL_CFG_MD4_EN == DEF_ENABLED) 00470 #undef NO_MD4 00471 #else 00472 #define NO_MD4 00473 #endif 00474 00475 #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) 00476 #undef NO_WRITEV 00477 #else 00478 #define NO_WRITEV 00479 #endif 00480 00481 #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) 00482 #define NO_DEV_RANDOM 00483 #else 00484 #undef NO_DEV_RANDOM 00485 #endif 00486 00487 #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) 00488 #define CYASSL_USER_IO 00489 #else 00490 #undef CYASSL_USER_IO 00491 #endif 00492 00493 #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) 00494 #undef LARGE_STATIC_BUFFERS 00495 #undef STATIC_CHUNKS_ONLY 00496 #else 00497 #define LARGE_STATIC_BUFFERS 00498 #define STATIC_CHUNKS_ONLY 00499 #endif 00500 00501 #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) 00502 #define CYASSL_DER_LOAD 00503 #else 00504 #undef CYASSL_DER_LOAD 00505 #endif 00506 00507 #if (SSL_CFG_DTLS_EN == DEF_ENABLED) 00508 #define CYASSL_DTLS 00509 #else 00510 #undef CYASSL_DTLS 00511 #endif 00512 00513 #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) 00514 #define CYASSL_CALLBACKS 00515 #else 00516 #undef CYASSL_CALLBACKS 00517 #endif 00518 00519 #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) 00520 #define USE_FAST_MATH 00521 #else 00522 #undef USE_FAST_MATH 00523 #endif 00524 00525 #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) 00526 #define TFM_TIMING_RESISTANT 00527 #else 00528 #undef TFM_TIMING_RESISTANT 00529 #endif 00530 00531 #endif /* MICRIUM */ 00532 00533 00534 #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ 00535 !defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY) 00536 #define USE_CYASSL_MEMORY 00537 #endif 00538 00539 00540 #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) 00541 #undef KEEP_PEER_CERT 00542 #define KEEP_PEER_CERT 00543 #endif 00544 00545 00546 /* stream ciphers except arc4 need 32bit alignment, intel ok without */ 00547 #ifndef XSTREAM_ALIGNMENT 00548 #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) 00549 #define NO_XSTREAM_ALIGNMENT 00550 #else 00551 #define XSTREAM_ALIGNMENT 00552 #endif 00553 #endif 00554 00555 00556 /* if using hardware crypto and have alignment requirements, specify the 00557 requirement here. The record header of SSL/TLS will prvent easy alignment. 00558 This hint tries to help as much as possible. */ 00559 #ifndef CYASSL_GENERAL_ALIGNMENT 00560 #ifdef CYASSL_AESNI 00561 #define CYASSL_GENERAL_ALIGNMENT 16 00562 #elif defined(XSTREAM_ALIGNMENT) 00563 #define CYASSL_GENERAL_ALIGNMENT 4 00564 #else 00565 #define CYASSL_GENERAL_ALIGNMENT 0 00566 #endif 00567 #endif 00568 00569 #ifdef HAVE_CRL 00570 /* not widely supported yet */ 00571 #undef NO_SKID 00572 #define NO_SKID 00573 #endif 00574 00575 /* Place any other flags or defines here */ 00576 00577 00578 #ifdef __cplusplus 00579 } /* extern "C" */ 00580 #endif 00581 00582 00583 #endif /* CTAO_CRYPT_SETTINGS_H */ 00584
Generated on Tue Jul 12 2022 20:12:51 by
