yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* settings.h |
| 2 | * |
| 3 | * Copyright (C) 2006-2021 wolfSSL Inc. |
| 4 | * |
| 5 | * This file is part of wolfSSL. |
| 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-1335, USA |
| 20 | */ |
| 21 | |
| 22 | |
| 23 | /* Place OS specific preprocessor flags, defines, includes here, will be |
| 24 | included into every file because types.h includes it */ |
| 25 | |
| 26 | |
| 27 | #ifndef CTAO_CRYPT_SETTINGS_H |
| 28 | #define CTAO_CRYPT_SETTINGS_H |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | /* Uncomment next line if using IPHONE */ |
| 35 | /* #define IPHONE */ |
| 36 | |
| 37 | /* Uncomment next line if using ThreadX */ |
| 38 | /* #define THREADX */ |
| 39 | |
| 40 | /* Uncomment next line if using Micrium ucOS */ |
| 41 | /* #define MICRIUM */ |
| 42 | |
| 43 | /* Uncomment next line if using Mbed */ |
| 44 | /* #define MBED */ |
| 45 | |
| 46 | /* Uncomment next line if using Microchip PIC32 ethernet starter kit */ |
| 47 | /* #define MICROCHIP_PIC32 */ |
| 48 | |
| 49 | /* Uncomment next line if using Microchip TCP/IP stack, version 5 */ |
| 50 | /* #define MICROCHIP_TCPIP_V5 */ |
| 51 | |
| 52 | /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ |
| 53 | /* #define MICROCHIP_TCPIP */ |
| 54 | |
| 55 | /* Uncomment next line if using PIC32MZ Crypto Engine */ |
| 56 | /* #define CYASSL_MICROCHIP_PIC32MZ */ |
| 57 | |
| 58 | /* Uncomment next line if using FreeRTOS */ |
| 59 | /* #define FREERTOS */ |
| 60 | |
| 61 | /* Uncomment next line if using FreeRTOS Windows Simulator */ |
| 62 | /* #define FREERTOS_WINSIM */ |
| 63 | |
| 64 | /* Uncomment next line if using RTIP */ |
| 65 | /* #define EBSNET */ |
| 66 | |
| 67 | /* Uncomment next line if using lwip */ |
| 68 | /* #define CYASSL_LWIP */ |
| 69 | |
| 70 | /* Uncomment next line if building CyaSSL for a game console */ |
| 71 | /* #define CYASSL_GAME_BUILD */ |
| 72 | |
| 73 | /* Uncomment next line if building CyaSSL for LSR */ |
| 74 | /* #define CYASSL_LSR */ |
| 75 | |
| 76 | /* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */ |
| 77 | /* #define FREESCALE_MQX */ |
| 78 | |
| 79 | /* Uncomment next line if using STM32F2 */ |
| 80 | /* #define CYASSL_STM32F2 */ |
| 81 | |
| 82 | /* Uncomment next line if using QL SEP settings */ |
| 83 | /* #define CYASSL_QL */ |
| 84 | |
| 85 | /* Uncomment next line if building for EROAD */ |
| 86 | /* #define CYASSL_EROAD */ |
| 87 | |
| 88 | /* Uncomment next line if building for IAR EWARM */ |
| 89 | /* #define CYASSL_IAR_ARM */ |
| 90 | |
| 91 | /* Uncomment next line if using TI-RTOS settings */ |
| 92 | /* #define CYASSL_TIRTOS */ |
| 93 | |
| 94 | /* Uncomment next line if building with PicoTCP */ |
| 95 | /* #define CYASSL_PICOTCP */ |
| 96 | |
| 97 | /* Uncomment next line if building for PicoTCP demo bundle */ |
| 98 | /* #define CYASSL_PICOTCP_DEMO */ |
| 99 | |
| 100 | #include <cyassl/ctaocrypt/visibility.h> |
| 101 | |
| 102 | #ifdef IPHONE |
| 103 | #define SIZEOF_LONG_LONG 8 |
| 104 | #endif |
| 105 | |
| 106 | |
| 107 | #ifdef CYASSL_USER_SETTINGS |
| 108 | #include <user_settings.h> |
| 109 | #endif |
| 110 | |
| 111 | /* for reverse compatibility after name change */ |
| 112 | #include <cyassl/ctaocrypt/settings_comp.h> |
| 113 | |
| 114 | #ifdef THREADX |
| 115 | #define SIZEOF_LONG_LONG 8 |
| 116 | #endif |
| 117 | |
| 118 | #ifdef HAVE_NETX |
| 119 | #include "nx_api.h" |
| 120 | #endif |
| 121 | |
| 122 | #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ |
| 123 | #define CYASSL_LWIP |
| 124 | #define NO_WRITEV |
| 125 | #define SINGLE_THREADED |
| 126 | #define CYASSL_USER_IO |
| 127 | #define NO_FILESYSTEM |
| 128 | #endif |
| 129 | |
| 130 | #if defined(CYASSL_IAR_ARM) |
| 131 | #define NO_MAIN_DRIVER |
| 132 | #define SINGLE_THREADED |
| 133 | #define USE_CERT_BUFFERS_1024 |
| 134 | #define BENCH_EMBEDDED |
| 135 | #define NO_FILESYSTEM |
| 136 | #define NO_WRITEV |
| 137 | #define CYASSL_USER_IO |
| 138 | #define BENCH_EMBEDDED |
| 139 | #endif |
| 140 | |
| 141 | #ifdef MICROCHIP_PIC32 |
| 142 | /* #define CYASSL_MICROCHIP_PIC32MZ */ |
| 143 | #define SIZEOF_LONG_LONG 8 |
| 144 | #define SINGLE_THREADED |
| 145 | #define CYASSL_USER_IO |
| 146 | #define NO_WRITEV |
| 147 | #define NO_DEV_RANDOM |
| 148 | #define NO_FILESYSTEM |
| 149 | #define USE_FAST_MATH |
| 150 | #define TFM_TIMING_RESISTANT |
| 151 | #endif |
| 152 | |
| 153 | #if defined(CYASSL_MICROCHIP_PIC32MZ) || defined(WOLFSSL_MICROCHIP_PIC32MZ) |
| 154 | #ifndef NO_PIC32MZ_CRYPT |
| 155 | #define WOLFSSL_PIC32MZ_CRYPT |
| 156 | #endif |
| 157 | #ifndef NO_PIC32MZ_RNG |
| 158 | #define WOLFSSL_PIC32MZ_RNG |
| 159 | #endif |
| 160 | #ifndef NO_PIC32MZ_HASH |
| 161 | #define WOLFSSL_PIC32MZ_HASH |
| 162 | #endif |
| 163 | |
| 164 | #define CYASSL_AES_COUNTER |
| 165 | #define HAVE_AESGCM |
| 166 | #define NO_BIG_INT |
| 167 | #endif |
| 168 | |
| 169 | #ifdef MICROCHIP_TCPIP_V5 |
| 170 | /* include timer functions */ |
| 171 | #include "TCPIP Stack/TCPIP.h" |
| 172 | #endif |
| 173 | |
| 174 | #ifdef MICROCHIP_TCPIP |
| 175 | /* include timer, NTP functions */ |
| 176 | #ifdef MICROCHIP_MPLAB_HARMONY |
| 177 | #include "tcpip/tcpip.h" |
| 178 | #else |
| 179 | #include "system/system_services.h" |
| 180 | #include "tcpip/sntp.h" |
| 181 | #endif |
| 182 | #endif |
| 183 | |
| 184 | #ifdef MBED |
| 185 | #define CYASSL_USER_IO |
| 186 | #define NO_FILESYSTEM |
| 187 | #define NO_CERTS |
| 188 | #define USE_CERT_BUFFERS_1024 |
| 189 | #define NO_WRITEV |
| 190 | #define NO_DEV_RANDOM |
| 191 | #define NO_SHA512 |
| 192 | #define NO_DH |
| 193 | #define NO_DSA |
| 194 | #define NO_HC128 |
| 195 | #define HAVE_ECC |
| 196 | #define NO_SESSION_CACHE |
| 197 | #define CYASSL_CMSIS_RTOS |
| 198 | #endif |
| 199 | |
| 200 | |
| 201 | #ifdef CYASSL_EROAD |
| 202 | #define FREESCALE_MQX |
| 203 | #define FREESCALE_MMCAU |
| 204 | #define SINGLE_THREADED |
| 205 | #define NO_STDIO_FILESYSTEM |
| 206 | #define CYASSL_LEANPSK |
| 207 | #define HAVE_NULL_CIPHER |
| 208 | #define NO_OLD_TLS |
| 209 | #define NO_ASN |
| 210 | #define NO_BIG_INT |
| 211 | #define NO_RSA |
| 212 | #define NO_DSA |
| 213 | #define NO_DH |
| 214 | #define NO_CERTS |
| 215 | #define NO_PWDBASED |
| 216 | #define NO_DES3 |
| 217 | #define NO_MD4 |
| 218 | #define NO_RC4 |
| 219 | #define NO_MD5 |
| 220 | #define NO_SESSION_CACHE |
| 221 | #define NO_MAIN_DRIVER |
| 222 | #endif |
| 223 | |
| 224 | #ifdef CYASSL_PICOTCP |
| 225 | #define errno pico_err |
| 226 | #include "pico_defines.h" |
| 227 | #include "pico_stack.h" |
| 228 | #include "pico_constants.h" |
| 229 | #define CUSTOM_RAND_GENERATE pico_rand |
| 230 | #endif |
| 231 | |
| 232 | #ifdef CYASSL_PICOTCP_DEMO |
| 233 | #define CYASSL_STM32 |
| 234 | #define USE_FAST_MATH |
| 235 | #define TFM_TIMING_RESISTANT |
| 236 | #define XMALLOC(s, h, type) PICO_ZALLOC((s)) |
| 237 | #define XFREE(p, h, type) PICO_FREE((p)) |
| 238 | #define SINGLE_THREADED |
| 239 | #define NO_WRITEV |
| 240 | #define CYASSL_USER_IO |
| 241 | #define NO_DEV_RANDOM |
| 242 | #define NO_FILESYSTEM |
| 243 | #endif |
| 244 | |
| 245 | #ifdef FREERTOS_WINSIM |
| 246 | #define FREERTOS |
| 247 | #define USE_WINDOWS_API |
| 248 | #endif |
| 249 | |
| 250 | |
| 251 | /* Micrium will use Visual Studio for compilation but not the Win32 API */ |
| 252 | #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ |
| 253 | && !defined(EBSNET) && !defined(CYASSL_EROAD) && !defined(INTIME_RTOS) |
| 254 | #define USE_WINDOWS_API |
| 255 | #endif |
| 256 | |
| 257 | |
| 258 | #if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER) |
| 259 | #include <stdlib.h> |
| 260 | #define XMALLOC(s, h, type) malloc((s)) |
| 261 | #define XFREE(p, h, type) free((p)) |
| 262 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
| 263 | #endif |
| 264 | |
| 265 | #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) |
| 266 | #undef XMALLOC |
| 267 | #define XMALLOC yaXMALLOC |
| 268 | #undef XFREE |
| 269 | #define XFREE yaXFREE |
| 270 | #undef XREALLOC |
| 271 | #define XREALLOC yaXREALLOC |
| 272 | #endif |
| 273 | |
| 274 | |
| 275 | #ifdef FREERTOS |
| 276 | #ifndef NO_WRITEV |
| 277 | #define NO_WRITEV |
| 278 | #endif |
| 279 | #ifndef NO_SHA512 |
| 280 | #define NO_SHA512 |
| 281 | #endif |
| 282 | #ifndef NO_DH |
| 283 | #define NO_DH |
| 284 | #endif |
| 285 | #ifndef NO_DSA |
| 286 | #define NO_DSA |
| 287 | #endif |
| 288 | #ifndef NO_HC128 |
| 289 | #define NO_HC128 |
| 290 | #endif |
| 291 | |
| 292 | #ifndef SINGLE_THREADED |
| 293 | #include "FreeRTOS.h" |
| 294 | #include "semphr.h" |
| 295 | #endif |
| 296 | #endif |
| 297 | |
| 298 | #ifdef CYASSL_TIRTOS |
| 299 | #define SIZEOF_LONG_LONG 8 |
| 300 | #define NO_WRITEV |
| 301 | #define NO_CYASSL_DIR |
| 302 | #define USE_FAST_MATH |
| 303 | #define TFM_TIMING_RESISTANT |
| 304 | #define NO_DEV_RANDOM |
| 305 | #define NO_FILESYSTEM |
| 306 | #define USE_CERT_BUFFERS_2048 |
| 307 | #define NO_ERROR_STRINGS |
| 308 | #define USER_TIME |
| 309 | |
| 310 | #ifdef __IAR_SYSTEMS_ICC__ |
| 311 | #pragma diag_suppress=Pa089 |
| 312 | #elif !defined(__GNUC__) |
| 313 | /* Suppress the sslpro warning */ |
| 314 | #pragma diag_suppress=11 |
| 315 | #endif |
| 316 | |
| 317 | #include <ti/ndk/nettools/mytime/mytime.h> |
| 318 | #endif |
| 319 | |
| 320 | #ifdef EBSNET |
| 321 | #include "rtip.h" |
| 322 | |
| 323 | /* #define DEBUG_CYASSL */ |
| 324 | #define NO_CYASSL_DIR /* tbd */ |
| 325 | |
| 326 | #if (POLLOS) |
| 327 | #define SINGLE_THREADED |
| 328 | #endif |
| 329 | |
| 330 | #if (RTPLATFORM) |
| 331 | #if (!RTP_LITTLE_ENDIAN) |
| 332 | #define BIG_ENDIAN_ORDER |
| 333 | #endif |
| 334 | #else |
| 335 | #if (!KS_LITTLE_ENDIAN) |
| 336 | #define BIG_ENDIAN_ORDER |
| 337 | #endif |
| 338 | #endif |
| 339 | |
| 340 | #if (WINMSP3) |
| 341 | #undef SIZEOF_LONG |
| 342 | #define SIZEOF_LONG_LONG 8 |
| 343 | #else |
| 344 | #if !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) |
| 345 | #error settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG |
| 346 | #endif |
| 347 | #endif |
| 348 | |
| 349 | #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) |
| 350 | #define XFREE(p, h, type) (rtp_free(p)) |
| 351 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
| 352 | |
| 353 | #endif /* EBSNET */ |
| 354 | |
| 355 | #ifdef CYASSL_GAME_BUILD |
| 356 | #define SIZEOF_LONG_LONG 8 |
| 357 | #if defined(__PPU) || defined(__XENON) |
| 358 | #define BIG_ENDIAN_ORDER |
| 359 | #endif |
| 360 | #endif |
| 361 | |
| 362 | #ifdef CYASSL_LSR |
| 363 | #define HAVE_WEBSERVER |
| 364 | #define SIZEOF_LONG_LONG 8 |
| 365 | #define CYASSL_LOW_MEMORY |
| 366 | #define NO_WRITEV |
| 367 | #define NO_SHA512 |
| 368 | #define NO_DH |
| 369 | #define NO_DSA |
| 370 | #define NO_HC128 |
| 371 | #define NO_DEV_RANDOM |
| 372 | #define NO_CYASSL_DIR |
| 373 | #define NO_RABBIT |
| 374 | #ifndef NO_FILESYSTEM |
| 375 | #define LSR_FS |
| 376 | #include "inc/hw_types.h" |
| 377 | #include "fs.h" |
| 378 | #endif |
| 379 | #define CYASSL_LWIP |
| 380 | #include <errno.h> /* for tcp errno */ |
| 381 | #define CYASSL_SAFERTOS |
| 382 | #if defined(__IAR_SYSTEMS_ICC__) |
| 383 | /* enum uses enum */ |
| 384 | #pragma diag_suppress=Pa089 |
| 385 | #endif |
| 386 | #endif |
| 387 | |
| 388 | #ifdef CYASSL_SAFERTOS |
| 389 | #ifndef SINGLE_THREADED |
| 390 | #include "SafeRTOS/semphr.h" |
| 391 | #endif |
| 392 | |
| 393 | #include "SafeRTOS/heap.h" |
| 394 | #define XMALLOC(s, h, type) pvPortMalloc((s)) |
| 395 | #define XFREE(p, h, type) vPortFree((p)) |
| 396 | #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) |
| 397 | #endif |
| 398 | |
| 399 | #ifdef CYASSL_LOW_MEMORY |
| 400 | #undef RSA_LOW_MEM |
| 401 | #define RSA_LOW_MEM |
| 402 | #undef CYASSL_SMALL_STACK |
| 403 | #define CYASSL_SMALL_STACK |
| 404 | #undef TFM_TIMING_RESISTANT |
| 405 | #define TFM_TIMING_RESISTANT |
| 406 | #endif |
| 407 | |
| 408 | #ifdef FREESCALE_MQX |
| 409 | #define SIZEOF_LONG_LONG 8 |
| 410 | #define NO_WRITEV |
| 411 | #define NO_DEV_RANDOM |
| 412 | #define NO_RABBIT |
| 413 | #define NO_CYASSL_DIR |
| 414 | #define USE_FAST_MATH |
| 415 | #define TFM_TIMING_RESISTANT |
| 416 | #define FREESCALE_K70_RNGA |
| 417 | /* #define FREESCALE_K53_RNGB */ |
| 418 | #include "mqx.h" |
| 419 | #ifndef NO_FILESYSTEM |
| 420 | #include "mfs.h" |
| 421 | #include "fio.h" |
| 422 | #endif |
| 423 | #ifndef SINGLE_THREADED |
| 424 | #include "mutex.h" |
| 425 | #endif |
| 426 | |
| 427 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) |
| 428 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} |
| 429 | /* Note: MQX has no realloc, using fastmath above */ |
| 430 | #endif |
| 431 | |
| 432 | #ifdef CYASSL_STM32F2 |
| 433 | #define SIZEOF_LONG_LONG 8 |
| 434 | #define NO_DEV_RANDOM |
| 435 | #define NO_CYASSL_DIR |
| 436 | #define NO_RABBIT |
| 437 | #define STM32F2_RNG |
| 438 | #define STM32F2_CRYPTO |
| 439 | #define KEIL_INTRINSICS |
| 440 | #endif |
| 441 | |
| 442 | #ifdef MICRIUM |
| 443 | |
| 444 | #include "stdlib.h" |
| 445 | #include "net_cfg.h" |
| 446 | #include "ssl_cfg.h" |
| 447 | #include "net_secure_os.h" |
| 448 | |
| 449 | #define CYASSL_TYPES |
| 450 | |
| 451 | typedef CPU_INT08U byte; |
| 452 | typedef CPU_INT16U word16; |
| 453 | typedef CPU_INT32U word32; |
| 454 | |
| 455 | #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) |
| 456 | #define SIZEOF_LONG 4 |
| 457 | #undef SIZEOF_LONG_LONG |
| 458 | #else |
| 459 | #undef SIZEOF_LONG |
| 460 | #define SIZEOF_LONG_LONG 8 |
| 461 | #endif |
| 462 | |
| 463 | #define STRING_USER |
| 464 | |
| 465 | #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) |
| 466 | #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ |
| 467 | ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ |
| 468 | (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) |
| 469 | #define XSTRNCMP(pstr_1, pstr_2, len_max) \ |
| 470 | ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ |
| 471 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) |
| 472 | #define XSTRSTR(pstr, pstr_srch) \ |
| 473 | ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ |
| 474 | (CPU_CHAR *)(pstr_srch))) |
| 475 | #define XMEMSET(pmem, data_val, size) \ |
| 476 | ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ |
| 477 | (CPU_SIZE_T)(size))) |
| 478 | #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ |
| 479 | (void *)(psrc), (CPU_SIZE_T)(size))) |
| 480 | #define XMEMCMP(pmem_1, pmem_2, size) \ |
| 481 | (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ |
| 482 | (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) |
| 483 | #define XMEMMOVE XMEMCPY |
| 484 | |
| 485 | #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) |
| 486 | #define MICRIUM_MALLOC |
| 487 | #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ |
| 488 | (CPU_SIZE_T)(s), (void *)0)) |
| 489 | #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ |
| 490 | (p), (void *)0)) |
| 491 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
| 492 | #endif |
| 493 | |
| 494 | #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) |
| 495 | #undef NO_FILESYSTEM |
| 496 | #else |
| 497 | #define NO_FILESYSTEM |
| 498 | #endif |
| 499 | |
| 500 | #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) |
| 501 | #define DEBUG_CYASSL |
| 502 | #else |
| 503 | #undef DEBUG_CYASSL |
| 504 | #endif |
| 505 | |
| 506 | #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) |
| 507 | #define OPENSSL_EXTRA |
| 508 | #else |
| 509 | #undef OPENSSL_EXTRA |
| 510 | #endif |
| 511 | |
| 512 | #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) |
| 513 | #undef SINGLE_THREADED |
| 514 | #else |
| 515 | #define SINGLE_THREADED |
| 516 | #endif |
| 517 | |
| 518 | #if (SSL_CFG_DH_EN == DEF_ENABLED) |
| 519 | #undef NO_DH |
| 520 | #else |
| 521 | #define NO_DH |
| 522 | #endif |
| 523 | |
| 524 | #if (SSL_CFG_DSA_EN == DEF_ENABLED) |
| 525 | #undef NO_DSA |
| 526 | #else |
| 527 | #define NO_DSA |
| 528 | #endif |
| 529 | |
| 530 | #if (SSL_CFG_PSK_EN == DEF_ENABLED) |
| 531 | #undef NO_PSK |
| 532 | #else |
| 533 | #define NO_PSK |
| 534 | #endif |
| 535 | |
| 536 | #if (SSL_CFG_3DES_EN == DEF_ENABLED) |
| 537 | #undef NO_DES3 |
| 538 | #else |
| 539 | #define NO_DES3 |
| 540 | #endif |
| 541 | |
| 542 | #if (SSL_CFG_AES_EN == DEF_ENABLED) |
| 543 | #undef NO_AES |
| 544 | #else |
| 545 | #define NO_AES |
| 546 | #endif |
| 547 | |
| 548 | #if (SSL_CFG_RC4_EN == DEF_ENABLED) |
| 549 | #undef NO_RC4 |
| 550 | #else |
| 551 | #define NO_RC4 |
| 552 | #endif |
| 553 | |
| 554 | #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) |
| 555 | #undef NO_RABBIT |
| 556 | #else |
| 557 | #define NO_RABBIT |
| 558 | #endif |
| 559 | |
| 560 | #if (SSL_CFG_HC128_EN == DEF_ENABLED) |
| 561 | #undef NO_HC128 |
| 562 | #else |
| 563 | #define NO_HC128 |
| 564 | #endif |
| 565 | |
| 566 | #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) |
| 567 | #define BIG_ENDIAN_ORDER |
| 568 | #else |
| 569 | #undef BIG_ENDIAN_ORDER |
| 570 | #define LITTLE_ENDIAN_ORDER |
| 571 | #endif |
| 572 | |
| 573 | #if (SSL_CFG_MD4_EN == DEF_ENABLED) |
| 574 | #undef NO_MD4 |
| 575 | #else |
| 576 | #define NO_MD4 |
| 577 | #endif |
| 578 | |
| 579 | #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) |
| 580 | #undef NO_WRITEV |
| 581 | #else |
| 582 | #define NO_WRITEV |
| 583 | #endif |
| 584 | |
| 585 | #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) |
| 586 | #define NO_DEV_RANDOM |
| 587 | #else |
| 588 | #undef NO_DEV_RANDOM |
| 589 | #endif |
| 590 | |
| 591 | #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) |
| 592 | #define CYASSL_USER_IO |
| 593 | #else |
| 594 | #undef CYASSL_USER_IO |
| 595 | #endif |
| 596 | |
| 597 | #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) |
| 598 | #undef LARGE_STATIC_BUFFERS |
| 599 | #undef STATIC_CHUNKS_ONLY |
| 600 | #else |
| 601 | #define LARGE_STATIC_BUFFERS |
| 602 | #define STATIC_CHUNKS_ONLY |
| 603 | #endif |
| 604 | |
| 605 | #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) |
| 606 | #define CYASSL_DER_LOAD |
| 607 | #else |
| 608 | #undef CYASSL_DER_LOAD |
| 609 | #endif |
| 610 | |
| 611 | #if (SSL_CFG_DTLS_EN == DEF_ENABLED) |
| 612 | #define CYASSL_DTLS |
| 613 | #else |
| 614 | #undef CYASSL_DTLS |
| 615 | #endif |
| 616 | |
| 617 | #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) |
| 618 | #define CYASSL_CALLBACKS |
| 619 | #else |
| 620 | #undef CYASSL_CALLBACKS |
| 621 | #endif |
| 622 | |
| 623 | #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) |
| 624 | #define USE_FAST_MATH |
| 625 | #else |
| 626 | #undef USE_FAST_MATH |
| 627 | #endif |
| 628 | |
| 629 | #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) |
| 630 | #define TFM_TIMING_RESISTANT |
| 631 | #else |
| 632 | #undef TFM_TIMING_RESISTANT |
| 633 | #endif |
| 634 | |
| 635 | #endif /* MICRIUM */ |
| 636 | |
| 637 | |
| 638 | #ifdef CYASSL_QL |
| 639 | #ifndef CYASSL_SEP |
| 640 | #define CYASSL_SEP |
| 641 | #endif |
| 642 | #ifndef OPENSSL_EXTRA |
| 643 | #define OPENSSL_EXTRA |
| 644 | #endif |
| 645 | #ifndef SESSION_CERTS |
| 646 | #define SESSION_CERTS |
| 647 | #endif |
| 648 | #ifndef HAVE_AESCCM |
| 649 | #define HAVE_AESCCM |
| 650 | #endif |
| 651 | #ifndef ATOMIC_USER |
| 652 | #define ATOMIC_USER |
| 653 | #endif |
| 654 | #ifndef CYASSL_DER_LOAD |
| 655 | #define CYASSL_DER_LOAD |
| 656 | #endif |
| 657 | #ifndef KEEP_PEER_CERT |
| 658 | #define KEEP_PEER_CERT |
| 659 | #endif |
| 660 | #ifndef HAVE_ECC |
| 661 | #define HAVE_ECC |
| 662 | #endif |
| 663 | #ifndef SESSION_INDEX |
| 664 | #define SESSION_INDEX |
| 665 | #endif |
| 666 | #endif /* CYASSL_QL */ |
| 667 | |
| 668 | |
| 669 | #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ |
| 670 | !defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY) |
| 671 | #define USE_CYASSL_MEMORY |
| 672 | #endif |
| 673 | |
| 674 | |
| 675 | #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) |
| 676 | #undef KEEP_PEER_CERT |
| 677 | #define KEEP_PEER_CERT |
| 678 | #endif |
| 679 | |
| 680 | |
| 681 | /* stream ciphers except arc4 need 32bit alignment, intel ok without */ |
| 682 | #ifndef XSTREAM_ALIGNMENT |
| 683 | #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) |
| 684 | #define NO_XSTREAM_ALIGNMENT |
| 685 | #else |
| 686 | #define XSTREAM_ALIGNMENT |
| 687 | #endif |
| 688 | #endif |
| 689 | |
| 690 | |
| 691 | /* FreeScale MMCAU hardware crypto has 4 byte alignment */ |
| 692 | #ifdef FREESCALE_MMCAU |
| 693 | #define CYASSL_MMCAU_ALIGNMENT 4 |
| 694 | #endif |
| 695 | |
| 696 | /* if using hardware crypto and have alignment requirements, specify the |
| 697 | requirement here. The record header of SSL/TLS will prvent easy alignment. |
| 698 | This hint tries to help as much as possible. */ |
| 699 | #ifndef CYASSL_GENERAL_ALIGNMENT |
| 700 | #ifdef CYASSL_AESNI |
| 701 | #define CYASSL_GENERAL_ALIGNMENT 16 |
| 702 | #elif defined(XSTREAM_ALIGNMENT) |
| 703 | #define CYASSL_GENERAL_ALIGNMENT 4 |
| 704 | #elif defined(FREESCALE_MMCAU) |
| 705 | #define CYASSL_GENERAL_ALIGNMENT CYASSL_MMCAU_ALIGNMENT |
| 706 | #else |
| 707 | #define CYASSL_GENERAL_ALIGNMENT 0 |
| 708 | #endif |
| 709 | #endif |
| 710 | |
| 711 | |
| 712 | #ifdef __INTEL_COMPILER |
| 713 | #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */ |
| 714 | #endif |
| 715 | |
| 716 | |
| 717 | /* Place any other flags or defines here */ |
| 718 | |
| 719 | |
| 720 | #ifdef __cplusplus |
| 721 | } /* extern "C" */ |
| 722 | #endif |
| 723 | |
| 724 | |
| 725 | #endif /* CTAO_CRYPT_SETTINGS_H */ |