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