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