[457] | 1 | /* settings.h
|
---|
| 2 | *
|
---|
| 3 | * Copyright (C) 2006-2020 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 WOLF_CRYPT_SETTINGS_H
|
---|
| 28 | #define WOLF_CRYPT_SETTINGS_H
|
---|
| 29 |
|
---|
| 30 | #ifdef __cplusplus
|
---|
| 31 | extern "C" {
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | /* This flag allows wolfSSL to include options.h instead of having client
|
---|
| 35 | * projects do it themselves. This should *NEVER* be defined when building
|
---|
| 36 | * wolfSSL as it can cause hard to debug problems. */
|
---|
| 37 | #ifdef EXTERNAL_OPTS_OPENVPN
|
---|
| 38 | #include <wolfssl/options.h>
|
---|
| 39 | #endif
|
---|
| 40 |
|
---|
| 41 | /* Uncomment next line if using IPHONE */
|
---|
| 42 | /* #define IPHONE */
|
---|
| 43 |
|
---|
| 44 | /* Uncomment next line if using ThreadX */
|
---|
| 45 | /* #define THREADX */
|
---|
| 46 |
|
---|
| 47 | /* Uncomment next line if using Micrium uC/OS-III */
|
---|
| 48 | /* #define MICRIUM */
|
---|
| 49 |
|
---|
| 50 | /* Uncomment next line if using Deos RTOS*/
|
---|
| 51 | /* #define WOLFSSL_DEOS*/
|
---|
| 52 |
|
---|
| 53 | /* Uncomment next line if using Mbed */
|
---|
| 54 | /* #define MBED */
|
---|
| 55 |
|
---|
| 56 | /* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
---|
| 57 | /* #define MICROCHIP_PIC32 */
|
---|
| 58 |
|
---|
| 59 | /* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
---|
| 60 | /* #define MICROCHIP_TCPIP_V5 */
|
---|
| 61 |
|
---|
| 62 | /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
---|
| 63 | /* #define MICROCHIP_TCPIP */
|
---|
| 64 |
|
---|
[464] | 65 | /* Uncomment next line if using above Microchip TCP/IP defines with BSD API */
|
---|
| 66 | /* #define MICROCHIP_TCPIP_BSD_API */
|
---|
| 67 |
|
---|
[457] | 68 | /* Uncomment next line if using PIC32MZ Crypto Engine */
|
---|
| 69 | /* #define WOLFSSL_MICROCHIP_PIC32MZ */
|
---|
| 70 |
|
---|
| 71 | /* Uncomment next line if using FreeRTOS */
|
---|
| 72 | /* #define FREERTOS */
|
---|
| 73 |
|
---|
| 74 | /* Uncomment next line if using FreeRTOS+ TCP */
|
---|
| 75 | /* #define FREERTOS_TCP */
|
---|
| 76 |
|
---|
| 77 | /* Uncomment next line if using FreeRTOS Windows Simulator */
|
---|
| 78 | /* #define FREERTOS_WINSIM */
|
---|
| 79 |
|
---|
| 80 | /* Uncomment next line if using RTIP */
|
---|
| 81 | /* #define EBSNET */
|
---|
| 82 |
|
---|
| 83 | /* Uncomment next line if using lwip */
|
---|
| 84 | /* #define WOLFSSL_LWIP */
|
---|
| 85 |
|
---|
| 86 | /* Uncomment next line if building wolfSSL for a game console */
|
---|
| 87 | /* #define WOLFSSL_GAME_BUILD */
|
---|
| 88 |
|
---|
| 89 | /* Uncomment next line if building wolfSSL for LSR */
|
---|
| 90 | /* #define WOLFSSL_LSR */
|
---|
| 91 |
|
---|
| 92 | /* Uncomment next line if building for Freescale Classic MQX version 5.0 */
|
---|
| 93 | /* #define FREESCALE_MQX_5_0 */
|
---|
| 94 |
|
---|
| 95 | /* Uncomment next line if building for Freescale Classic MQX version 4.0 */
|
---|
| 96 | /* #define FREESCALE_MQX_4_0 */
|
---|
| 97 |
|
---|
| 98 | /* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */
|
---|
| 99 | /* #define FREESCALE_MQX */
|
---|
| 100 |
|
---|
| 101 | /* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */
|
---|
| 102 | /* #define FREESCALE_KSDK_MQX */
|
---|
| 103 |
|
---|
| 104 | /* Uncomment next line if building for Freescale KSDK Bare Metal */
|
---|
| 105 | /* #define FREESCALE_KSDK_BM */
|
---|
| 106 |
|
---|
| 107 | /* Uncomment next line if building for Freescale KSDK FreeRTOS, */
|
---|
| 108 | /* (old name FREESCALE_FREE_RTOS) */
|
---|
| 109 | /* #define FREESCALE_KSDK_FREERTOS */
|
---|
| 110 |
|
---|
| 111 | /* Uncomment next line if using STM32F2 */
|
---|
| 112 | /* #define WOLFSSL_STM32F2 */
|
---|
| 113 |
|
---|
| 114 | /* Uncomment next line if using STM32F4 */
|
---|
| 115 | /* #define WOLFSSL_STM32F4 */
|
---|
| 116 |
|
---|
| 117 | /* Uncomment next line if using STM32FL */
|
---|
| 118 | /* #define WOLFSSL_STM32FL */
|
---|
| 119 |
|
---|
| 120 | /* Uncomment next line if using STM32F7 */
|
---|
| 121 | /* #define WOLFSSL_STM32F7 */
|
---|
| 122 |
|
---|
| 123 | /* Uncomment next line if using QL SEP settings */
|
---|
| 124 | /* #define WOLFSSL_QL */
|
---|
| 125 |
|
---|
| 126 | /* Uncomment next line if building for EROAD */
|
---|
| 127 | /* #define WOLFSSL_EROAD */
|
---|
| 128 |
|
---|
| 129 | /* Uncomment next line if building for IAR EWARM */
|
---|
| 130 | /* #define WOLFSSL_IAR_ARM */
|
---|
| 131 |
|
---|
| 132 | /* Uncomment next line if building for Rowley CrossWorks ARM */
|
---|
| 133 | /* #define WOLFSSL_ROWLEY_ARM */
|
---|
| 134 |
|
---|
| 135 | /* Uncomment next line if using TI-RTOS settings */
|
---|
| 136 | /* #define WOLFSSL_TIRTOS */
|
---|
| 137 |
|
---|
| 138 | /* Uncomment next line if building with PicoTCP */
|
---|
| 139 | /* #define WOLFSSL_PICOTCP */
|
---|
| 140 |
|
---|
| 141 | /* Uncomment next line if building for PicoTCP demo bundle */
|
---|
| 142 | /* #define WOLFSSL_PICOTCP_DEMO */
|
---|
| 143 |
|
---|
| 144 | /* Uncomment next line if building for uITRON4 */
|
---|
| 145 | /* #define WOLFSSL_uITRON4 */
|
---|
| 146 |
|
---|
| 147 | /* Uncomment next line if building for uT-Kernel */
|
---|
| 148 | /* #define WOLFSSL_uTKERNEL2 */
|
---|
| 149 |
|
---|
| 150 | /* Uncomment next line if using Max Strength build */
|
---|
| 151 | /* #define WOLFSSL_MAX_STRENGTH */
|
---|
| 152 |
|
---|
| 153 | /* Uncomment next line if building for VxWorks */
|
---|
| 154 | /* #define WOLFSSL_VXWORKS */
|
---|
| 155 |
|
---|
| 156 | /* Uncomment next line if building for Nordic nRF5x platform */
|
---|
| 157 | /* #define WOLFSSL_NRF5x */
|
---|
| 158 |
|
---|
| 159 | /* Uncomment next line to enable deprecated less secure static DH suites */
|
---|
| 160 | /* #define WOLFSSL_STATIC_DH */
|
---|
| 161 |
|
---|
| 162 | /* Uncomment next line to enable deprecated less secure static RSA suites */
|
---|
| 163 | /* #define WOLFSSL_STATIC_RSA */
|
---|
| 164 |
|
---|
| 165 | /* Uncomment next line if building for ARDUINO */
|
---|
| 166 | /* Uncomment both lines if building for ARDUINO on INTEL_GALILEO */
|
---|
| 167 | /* #define WOLFSSL_ARDUINO */
|
---|
| 168 | /* #define INTEL_GALILEO */
|
---|
| 169 |
|
---|
| 170 | /* Uncomment next line to enable asynchronous crypto WC_PENDING_E */
|
---|
| 171 | /* #define WOLFSSL_ASYNC_CRYPT */
|
---|
| 172 |
|
---|
| 173 | /* Uncomment next line if building for uTasker */
|
---|
| 174 | /* #define WOLFSSL_UTASKER */
|
---|
| 175 |
|
---|
| 176 | /* Uncomment next line if building for embOS */
|
---|
| 177 | /* #define WOLFSSL_EMBOS */
|
---|
| 178 |
|
---|
| 179 | /* Uncomment next line if building for RIOT-OS */
|
---|
| 180 | /* #define WOLFSSL_RIOT_OS */
|
---|
| 181 |
|
---|
| 182 | /* Uncomment next line if building for using XILINX hardened crypto */
|
---|
| 183 | /* #define WOLFSSL_XILINX_CRYPT */
|
---|
| 184 |
|
---|
| 185 | /* Uncomment next line if building for using XILINX */
|
---|
| 186 | /* #define WOLFSSL_XILINX */
|
---|
| 187 |
|
---|
| 188 | /* Uncomment next line if building for WICED Studio. */
|
---|
| 189 | /* #define WOLFSSL_WICED */
|
---|
| 190 |
|
---|
| 191 | /* Uncomment next line if building for Nucleus 1.2 */
|
---|
| 192 | /* #define WOLFSSL_NUCLEUS_1_2 */
|
---|
| 193 |
|
---|
| 194 | /* Uncomment next line if building for using Apache mynewt */
|
---|
| 195 | /* #define WOLFSSL_APACHE_MYNEWT */
|
---|
| 196 |
|
---|
| 197 | /* Uncomment next line if building for using ESP-IDF */
|
---|
| 198 | /* #define WOLFSSL_ESPIDF */
|
---|
| 199 |
|
---|
| 200 | /* Uncomment next line if using Espressif ESP32-WROOM-32 */
|
---|
| 201 | /* #define WOLFSSL_ESPWROOM32 */
|
---|
| 202 |
|
---|
| 203 | /* Uncomment next line if using Espressif ESP32-WROOM-32SE */
|
---|
| 204 | /* #define WOLFSSL_ESPWROOM32SE */
|
---|
| 205 |
|
---|
| 206 | /* Uncomment next line if using ARM CRYPTOCELL*/
|
---|
| 207 | /* #define WOLFSSL_CRYPTOCELL */
|
---|
| 208 |
|
---|
| 209 | /* Uncomment next line if using RENESAS TSIP */
|
---|
| 210 | /* #define WOLFSSL_RENESAS_TSIP */
|
---|
| 211 |
|
---|
| 212 | /* Uncomment next line if using RENESAS RX64N */
|
---|
| 213 | /* #define WOLFSSL_RENESAS_RX65N */
|
---|
| 214 |
|
---|
[464] | 215 | /* Uncomment next line if using Solaris OS*/
|
---|
| 216 | /* #define WOLFSSL_SOLARIS */
|
---|
| 217 |
|
---|
| 218 | /* Uncomment next line if building for Linux Kernel Module */
|
---|
| 219 | /* #define WOLFSSL_LINUXKM */
|
---|
| 220 |
|
---|
| 221 |
|
---|
[457] | 222 | #include <wolfssl/wolfcrypt/visibility.h>
|
---|
| 223 |
|
---|
| 224 | #ifdef WOLFSSL_USER_SETTINGS
|
---|
| 225 | #include "user_settings.h"
|
---|
[464] | 226 | #elif defined(USE_HAL_DRIVER) && !defined(HAVE_CONFIG_H)
|
---|
| 227 | /* STM Configuration File (generated by CubeMX) */
|
---|
| 228 | #include "wolfSSL.I-CUBE-wolfSSL_conf.h"
|
---|
[457] | 229 | #endif
|
---|
| 230 |
|
---|
| 231 | /* make sure old RNG name is used with CTaoCrypt FIPS */
|
---|
| 232 | #ifdef HAVE_FIPS
|
---|
| 233 | #if !defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)
|
---|
| 234 | #define WC_RNG RNG
|
---|
| 235 | #else
|
---|
| 236 | #ifndef WOLFSSL_STM32L4
|
---|
| 237 | #define RNG WC_RNG
|
---|
| 238 | #endif
|
---|
| 239 | #endif
|
---|
| 240 | /* blinding adds API not available yet in FIPS mode */
|
---|
| 241 | #undef WC_RSA_BLINDING
|
---|
| 242 | #endif
|
---|
| 243 |
|
---|
| 244 |
|
---|
| 245 | #if defined(_WIN32) && !defined(_M_X64) && \
|
---|
| 246 | defined(HAVE_AESGCM) && defined(WOLFSSL_AESNI)
|
---|
| 247 |
|
---|
| 248 | /* The _M_X64 macro is what's used in the headers for MSC to tell if it
|
---|
| 249 | * has the 64-bit versions of the 128-bit integers available. If one is
|
---|
| 250 | * building on 32-bit Windows with AES-NI, turn off the AES-GCMloop
|
---|
| 251 | * unrolling. */
|
---|
| 252 |
|
---|
| 253 | #define AES_GCM_AESNI_NO_UNROLL
|
---|
| 254 | #endif
|
---|
| 255 |
|
---|
| 256 | #ifdef IPHONE
|
---|
| 257 | #define SIZEOF_LONG_LONG 8
|
---|
| 258 | #endif
|
---|
| 259 |
|
---|
| 260 | #ifdef THREADX
|
---|
| 261 | #define SIZEOF_LONG_LONG 8
|
---|
| 262 | #endif
|
---|
| 263 |
|
---|
| 264 | #ifdef HAVE_NETX
|
---|
| 265 | #ifdef NEED_THREADX_TYPES
|
---|
| 266 | #include <types.h>
|
---|
| 267 | #endif
|
---|
| 268 | #include <nx_api.h>
|
---|
| 269 | #endif
|
---|
| 270 |
|
---|
| 271 | #if defined(WOLFSSL_ESPIDF)
|
---|
| 272 | #define FREERTOS
|
---|
| 273 | #define WOLFSSL_LWIP
|
---|
| 274 | #define NO_WRITEV
|
---|
| 275 | #define SIZEOF_LONG_LONG 8
|
---|
| 276 | #define NO_WOLFSSL_DIR
|
---|
| 277 | #define WOLFSSL_NO_CURRDIR
|
---|
| 278 |
|
---|
| 279 | #define TFM_TIMING_RESISTANT
|
---|
| 280 | #define ECC_TIMING_RESISTANT
|
---|
| 281 | #define WC_RSA_BLINDING
|
---|
| 282 |
|
---|
| 283 | #if defined(WOLFSSL_ESPWROOM32) || defined(WOLFSSL_ESPWROOM32SE)
|
---|
| 284 | #ifndef NO_ESP32WROOM32_CRYPT
|
---|
| 285 | #define WOLFSSL_ESP32WROOM32_CRYPT
|
---|
| 286 | #if defined(ESP32_USE_RSA_PRIMITIVE) && \
|
---|
| 287 | !defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI)
|
---|
| 288 | #define WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI
|
---|
| 289 | #define USE_FAST_MATH
|
---|
| 290 | #define WOLFSSL_SMALL_STACK
|
---|
| 291 | #endif
|
---|
| 292 | #endif
|
---|
| 293 | #endif
|
---|
| 294 | #endif /* WOLFSSL_ESPIDF */
|
---|
| 295 |
|
---|
| 296 | #if defined(WOLFSSL_RENESAS_TSIP)
|
---|
| 297 | #define TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE 64
|
---|
| 298 | #define TSIP_TLS_MASTERSECRET_SIZE 80 /* 20 words */
|
---|
| 299 | #define TSIP_TLS_ENCPUBKEY_SZ_BY_CERTVRFY 560 /* in byte */
|
---|
| 300 | #if !defined(NO_RENESAS_TSIP_CRYPT) && defined(WOLFSSL_RENESAS_RX65N)
|
---|
| 301 | #define WOLFSSL_RENESAS_TSIP_CRYPT
|
---|
| 302 | #define WOLFSSL_RENESAS_TSIP_TLS
|
---|
| 303 | #define WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT
|
---|
| 304 | #endif
|
---|
| 305 | #endif
|
---|
| 306 |
|
---|
[464] | 307 | #if defined(WOLFSSL_RENESAS_RA6M3G) || defined(WOLFSSL_RENESAS_RA6M3)
|
---|
[457] | 308 | /* settings in user_settings.h */
|
---|
| 309 | #endif
|
---|
| 310 |
|
---|
| 311 | #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
|
---|
| 312 | #define WOLFSSL_LWIP
|
---|
| 313 | #define NO_WRITEV
|
---|
| 314 | #define SINGLE_THREADED
|
---|
| 315 | #define WOLFSSL_USER_IO
|
---|
| 316 | #define NO_FILESYSTEM
|
---|
| 317 | #endif
|
---|
| 318 |
|
---|
| 319 | #if defined(WOLFSSL_CONTIKI)
|
---|
| 320 | #include <contiki.h>
|
---|
| 321 | #define WOLFSSL_UIP
|
---|
| 322 | #define NO_WOLFSSL_MEMORY
|
---|
| 323 | #define NO_WRITEV
|
---|
| 324 | #define SINGLE_THREADED
|
---|
| 325 | #define WOLFSSL_USER_IO
|
---|
| 326 | #define NO_FILESYSTEM
|
---|
| 327 | #define CUSTOM_RAND_TYPE uint16_t
|
---|
| 328 | #define CUSTOM_RAND_GENERATE random_rand
|
---|
| 329 | static inline word32 LowResTimer(void)
|
---|
| 330 | {
|
---|
| 331 | return clock_seconds();
|
---|
| 332 | }
|
---|
| 333 | #endif
|
---|
| 334 |
|
---|
| 335 | #if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM)
|
---|
| 336 | #define NO_MAIN_DRIVER
|
---|
| 337 | #define SINGLE_THREADED
|
---|
| 338 | #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096)
|
---|
| 339 | #define USE_CERT_BUFFERS_1024
|
---|
| 340 | #endif
|
---|
| 341 | #define BENCH_EMBEDDED
|
---|
| 342 | #define NO_FILESYSTEM
|
---|
| 343 | #define NO_WRITEV
|
---|
| 344 | #define WOLFSSL_USER_IO
|
---|
| 345 | #define BENCH_EMBEDDED
|
---|
| 346 | #endif
|
---|
| 347 |
|
---|
| 348 | #ifdef MICROCHIP_PIC32
|
---|
| 349 | /* #define WOLFSSL_MICROCHIP_PIC32MZ */
|
---|
| 350 | #define SIZEOF_LONG_LONG 8
|
---|
| 351 | #define SINGLE_THREADED
|
---|
[464] | 352 | #ifndef MICROCHIP_TCPIP_BSD_API
|
---|
| 353 | #define WOLFSSL_USER_IO
|
---|
| 354 | #endif
|
---|
[457] | 355 | #define NO_WRITEV
|
---|
| 356 | #define NO_DEV_RANDOM
|
---|
| 357 | #define NO_FILESYSTEM
|
---|
| 358 | #define USE_FAST_MATH
|
---|
| 359 | #define TFM_TIMING_RESISTANT
|
---|
| 360 | #define NO_BIG_INT
|
---|
| 361 | #endif
|
---|
| 362 |
|
---|
| 363 | #ifdef WOLFSSL_MICROCHIP_PIC32MZ
|
---|
[464] | 364 | #define WOLFSSL_HAVE_MIN
|
---|
| 365 | #define WOLFSSL_HAVE_MAX
|
---|
| 366 |
|
---|
[457] | 367 | #ifndef NO_PIC32MZ_CRYPT
|
---|
| 368 | #define WOLFSSL_PIC32MZ_CRYPT
|
---|
| 369 | #endif
|
---|
| 370 | #ifndef NO_PIC32MZ_RNG
|
---|
| 371 | #define WOLFSSL_PIC32MZ_RNG
|
---|
| 372 | #endif
|
---|
| 373 | #ifndef NO_PIC32MZ_HASH
|
---|
| 374 | #define WOLFSSL_PIC32MZ_HASH
|
---|
| 375 | #endif
|
---|
| 376 | #endif
|
---|
| 377 |
|
---|
| 378 | #ifdef MICROCHIP_TCPIP_V5
|
---|
| 379 | /* include timer functions */
|
---|
| 380 | #include "TCPIP Stack/TCPIP.h"
|
---|
| 381 | #endif
|
---|
| 382 |
|
---|
| 383 | #ifdef MICROCHIP_TCPIP
|
---|
| 384 | /* include timer, NTP functions */
|
---|
| 385 | #ifdef MICROCHIP_MPLAB_HARMONY
|
---|
| 386 | #include "tcpip/tcpip.h"
|
---|
| 387 | #else
|
---|
| 388 | #include "system/system_services.h"
|
---|
| 389 | #include "tcpip/sntp.h"
|
---|
| 390 | #endif
|
---|
| 391 | #endif
|
---|
| 392 |
|
---|
[464] | 393 | #ifdef WOLFSSL_ATECC508A
|
---|
| 394 | /* backwards compatibility */
|
---|
| 395 | #ifndef WOLFSSL_ATECC_NO_ECDH_ENC
|
---|
| 396 | #define WOLFSSL_ATECC_ECDH_ENC
|
---|
| 397 | #endif
|
---|
| 398 | #ifdef WOLFSSL_ATECC508A_DEBUG
|
---|
| 399 | #define WOLFSSL_ATECC_DEBUG
|
---|
| 400 | #endif
|
---|
| 401 | #endif
|
---|
| 402 |
|
---|
[457] | 403 | #ifdef MBED
|
---|
| 404 | #define WOLFSSL_USER_IO
|
---|
| 405 | #define NO_FILESYSTEM
|
---|
| 406 | #define NO_CERTS
|
---|
| 407 | #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096)
|
---|
| 408 | #define USE_CERT_BUFFERS_1024
|
---|
| 409 | #endif
|
---|
| 410 | #define NO_WRITEV
|
---|
| 411 | #define NO_DEV_RANDOM
|
---|
| 412 | #define NO_SHA512
|
---|
| 413 | #define NO_DH
|
---|
| 414 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
| 415 | /* WOLFSSL_DH_CONST */
|
---|
| 416 | #define NO_DSA
|
---|
| 417 | #define NO_HC128
|
---|
| 418 | #define HAVE_ECC
|
---|
| 419 | #define NO_SESSION_CACHE
|
---|
| 420 | #define WOLFSSL_CMSIS_RTOS
|
---|
| 421 | #endif
|
---|
| 422 |
|
---|
| 423 |
|
---|
| 424 | #ifdef WOLFSSL_EROAD
|
---|
| 425 | #define FREESCALE_MQX
|
---|
| 426 | #define FREESCALE_MMCAU
|
---|
| 427 | #define SINGLE_THREADED
|
---|
| 428 | #define NO_STDIO_FILESYSTEM
|
---|
| 429 | #define WOLFSSL_LEANPSK
|
---|
| 430 | #define HAVE_NULL_CIPHER
|
---|
| 431 | #define NO_OLD_TLS
|
---|
| 432 | #define NO_ASN
|
---|
| 433 | #define NO_BIG_INT
|
---|
| 434 | #define NO_RSA
|
---|
| 435 | #define NO_DSA
|
---|
| 436 | #define NO_DH
|
---|
| 437 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
| 438 | /* WOLFSSL_DH_CONST */
|
---|
| 439 | #define NO_CERTS
|
---|
| 440 | #define NO_PWDBASED
|
---|
| 441 | #define NO_DES3
|
---|
| 442 | #define NO_MD4
|
---|
| 443 | #define NO_RC4
|
---|
| 444 | #define NO_MD5
|
---|
| 445 | #define NO_SESSION_CACHE
|
---|
| 446 | #define NO_MAIN_DRIVER
|
---|
| 447 | #endif
|
---|
| 448 |
|
---|
| 449 | #ifdef WOLFSSL_PICOTCP
|
---|
| 450 | #ifndef errno
|
---|
| 451 | #define errno pico_err
|
---|
| 452 | #endif
|
---|
| 453 | #include "pico_defines.h"
|
---|
| 454 | #include "pico_stack.h"
|
---|
| 455 | #include "pico_constants.h"
|
---|
| 456 | #include "pico_protocol.h"
|
---|
| 457 | #define CUSTOM_RAND_GENERATE pico_rand
|
---|
| 458 | #endif
|
---|
| 459 |
|
---|
| 460 | #ifdef WOLFSSL_PICOTCP_DEMO
|
---|
| 461 | #define WOLFSSL_STM32
|
---|
| 462 | #define USE_FAST_MATH
|
---|
| 463 | #define TFM_TIMING_RESISTANT
|
---|
| 464 | #define XMALLOC(s, h, type) PICO_ZALLOC((s))
|
---|
| 465 | #define XFREE(p, h, type) PICO_FREE((p))
|
---|
| 466 | #define SINGLE_THREADED
|
---|
| 467 | #define NO_WRITEV
|
---|
| 468 | #define WOLFSSL_USER_IO
|
---|
| 469 | #define NO_DEV_RANDOM
|
---|
| 470 | #define NO_FILESYSTEM
|
---|
| 471 | #endif
|
---|
| 472 |
|
---|
| 473 | #ifdef FREERTOS_WINSIM
|
---|
| 474 | #define FREERTOS
|
---|
| 475 | #define USE_WINDOWS_API
|
---|
| 476 | #endif
|
---|
| 477 |
|
---|
| 478 |
|
---|
| 479 | #ifdef WOLFSSL_VXWORKS
|
---|
| 480 | /* VxWorks simulator incorrectly detects building for i386 */
|
---|
| 481 | #ifdef VXWORKS_SIM
|
---|
| 482 | #define TFM_NO_ASM
|
---|
| 483 | #endif
|
---|
| 484 | /* For VxWorks pthreads wrappers for mutexes uncomment the next line. */
|
---|
| 485 | /* #define WOLFSSL_PTHREADS */
|
---|
| 486 | #define WOLFSSL_HAVE_MIN
|
---|
| 487 | #define WOLFSSL_HAVE_MAX
|
---|
| 488 | #define USE_FAST_MATH
|
---|
| 489 | #define TFM_TIMING_RESISTANT
|
---|
| 490 | #define NO_MAIN_DRIVER
|
---|
| 491 | #define NO_DEV_RANDOM
|
---|
| 492 | #define NO_WRITEV
|
---|
| 493 | #define HAVE_STRINGS_H
|
---|
| 494 | #endif
|
---|
| 495 |
|
---|
| 496 |
|
---|
| 497 | #ifdef WOLFSSL_ARDUINO
|
---|
| 498 | #define NO_WRITEV
|
---|
| 499 | #define NO_WOLFSSL_DIR
|
---|
| 500 | #define SINGLE_THREADED
|
---|
| 501 | #define NO_DEV_RANDOM
|
---|
| 502 | #ifndef INTEL_GALILEO /* Galileo has time.h compatibility */
|
---|
| 503 | #define TIME_OVERRIDES
|
---|
| 504 | #ifndef XTIME
|
---|
| 505 | #error "Must define XTIME externally see porting guide"
|
---|
| 506 | #error "https://www.wolfssl.com/docs/porting-guide/"
|
---|
| 507 | #endif
|
---|
| 508 | #ifndef XGMTIME
|
---|
| 509 | #error "Must define XGMTIME externally see porting guide"
|
---|
| 510 | #error "https://www.wolfssl.com/docs/porting-guide/"
|
---|
| 511 | #endif
|
---|
| 512 | #endif
|
---|
| 513 | #define WOLFSSL_USER_IO
|
---|
| 514 | #define HAVE_ECC
|
---|
| 515 | #define NO_DH
|
---|
| 516 | #define NO_SESSION_CACHE
|
---|
| 517 | #endif
|
---|
| 518 |
|
---|
| 519 |
|
---|
| 520 | #ifdef WOLFSSL_UTASKER
|
---|
| 521 | /* uTasker configuration - used for fnRandom() */
|
---|
| 522 | #include "config.h"
|
---|
| 523 |
|
---|
| 524 | #define SINGLE_THREADED
|
---|
| 525 | #define NO_WOLFSSL_DIR
|
---|
| 526 | #define WOLFSSL_HAVE_MIN
|
---|
| 527 | #define NO_WRITEV
|
---|
| 528 |
|
---|
| 529 | #define HAVE_ECC
|
---|
| 530 | #define ALT_ECC_SIZE
|
---|
| 531 | #define USE_FAST_MATH
|
---|
| 532 | #define TFM_TIMING_RESISTANT
|
---|
| 533 | #define ECC_TIMING_RESISTANT
|
---|
| 534 |
|
---|
| 535 | /* used in wolfCrypt test */
|
---|
| 536 | #define NO_MAIN_DRIVER
|
---|
| 537 | #define USE_CERT_BUFFERS_2048
|
---|
| 538 |
|
---|
| 539 | /* uTasker port uses RAW sockets, use I/O callbacks
|
---|
| 540 | * See wolfSSL uTasker example for sample callbacks */
|
---|
| 541 | #define WOLFSSL_USER_IO
|
---|
| 542 |
|
---|
| 543 | /* uTasker filesystem not ported */
|
---|
| 544 | #define NO_FILESYSTEM
|
---|
| 545 |
|
---|
| 546 | /* uTasker RNG is abstracted, calls HW RNG when available */
|
---|
| 547 | #define CUSTOM_RAND_GENERATE fnRandom
|
---|
| 548 | #define CUSTOM_RAND_TYPE unsigned short
|
---|
| 549 |
|
---|
| 550 | /* user needs to define XTIME to function that provides
|
---|
| 551 | * seconds since Unix epoch */
|
---|
| 552 | #ifndef XTIME
|
---|
| 553 | #error XTIME must be defined in wolfSSL settings.h
|
---|
| 554 | /* #define XTIME fnSecondsSinceEpoch */
|
---|
| 555 | #endif
|
---|
| 556 |
|
---|
| 557 | /* use uTasker std library replacements where available */
|
---|
| 558 | #define STRING_USER
|
---|
| 559 | #define XMEMCPY(d,s,l) uMemcpy((d),(s),(l))
|
---|
| 560 | #define XMEMSET(b,c,l) uMemset((b),(c),(l))
|
---|
| 561 | #define XMEMCMP(s1,s2,n) uMemcmp((s1),(s2),(n))
|
---|
| 562 | #define XMEMMOVE(d,s,l) memmove((d),(s),(l))
|
---|
| 563 |
|
---|
| 564 | #define XSTRLEN(s1) uStrlen((s1))
|
---|
| 565 | #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
|
---|
| 566 | #define XSTRSTR(s1,s2) strstr((s1),(s2))
|
---|
| 567 | #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
|
---|
| 568 | #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n))
|
---|
| 569 | #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n))
|
---|
| 570 | #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
|
---|
| 571 | #if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) \
|
---|
| 572 | || defined(HAVE_ALPN)
|
---|
| 573 | #define XSTRTOK strtok_r
|
---|
| 574 | #endif
|
---|
| 575 | #endif
|
---|
| 576 |
|
---|
| 577 | #ifdef WOLFSSL_EMBOS
|
---|
| 578 | #define NO_FILESYSTEM /* Not ported at this time */
|
---|
| 579 | #define USE_CERT_BUFFERS_2048 /* use when NO_FILESYSTEM */
|
---|
| 580 | #define NO_MAIN_DRIVER
|
---|
| 581 | #define NO_RC4
|
---|
| 582 | #define SINGLE_THREADED /* Not ported at this time */
|
---|
| 583 | #endif
|
---|
| 584 |
|
---|
| 585 | #ifdef WOLFSSL_RIOT_OS
|
---|
| 586 | #define NO_WRITEV
|
---|
| 587 | #define TFM_NO_ASM
|
---|
| 588 | #define NO_FILESYSTEM
|
---|
| 589 | #define USE_CERT_BUFFERS_2048
|
---|
| 590 | #if defined(WOLFSSL_GNRC) && !defined(WOLFSSL_DTLS)
|
---|
| 591 | #define WOLFSSL_DTLS
|
---|
| 592 | #endif
|
---|
| 593 | #endif
|
---|
| 594 |
|
---|
| 595 | #ifdef WOLFSSL_CHIBIOS
|
---|
| 596 | /* ChibiOS definitions. This file is distributed with chibiOS. */
|
---|
| 597 | #include "wolfssl_chibios.h"
|
---|
| 598 | #endif
|
---|
| 599 |
|
---|
| 600 | #ifdef WOLFSSL_PB
|
---|
| 601 | /* PB is using older 1.2 version of Nucleus */
|
---|
| 602 | #undef WOLFSSL_NUCLEUS
|
---|
| 603 | #define WOLFSSL_NUCLEUS_1_2
|
---|
| 604 | #endif
|
---|
| 605 |
|
---|
| 606 | #ifdef WOLFSSL_NUCLEUS_1_2
|
---|
| 607 | #define NO_WRITEV
|
---|
| 608 | #define NO_WOLFSSL_DIR
|
---|
| 609 |
|
---|
| 610 | #if !defined(NO_ASN_TIME) && !defined(USER_TIME)
|
---|
| 611 | #error User must define XTIME, see manual
|
---|
| 612 | #endif
|
---|
| 613 |
|
---|
| 614 | #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER)
|
---|
| 615 | extern void* nucleus_malloc(unsigned long size, void* heap, int type);
|
---|
| 616 | extern void* nucleus_realloc(void* ptr, unsigned long size, void* heap,
|
---|
| 617 | int type);
|
---|
| 618 | extern void nucleus_free(void* ptr, void* heap, int type);
|
---|
| 619 |
|
---|
| 620 | #define XMALLOC(s, h, type) nucleus_malloc((s), (h), (type))
|
---|
| 621 | #define XREALLOC(p, n, h, t) nucleus_realloc((p), (n), (h), (t))
|
---|
| 622 | #define XFREE(p, h, type) nucleus_free((p), (h), (type))
|
---|
| 623 | #endif
|
---|
| 624 | #endif
|
---|
| 625 |
|
---|
| 626 | #ifdef WOLFSSL_NRF5x
|
---|
| 627 | #define SIZEOF_LONG 4
|
---|
| 628 | #define SIZEOF_LONG_LONG 8
|
---|
| 629 | #define NO_DEV_RANDOM
|
---|
| 630 | #define NO_FILESYSTEM
|
---|
| 631 | #define NO_MAIN_DRIVER
|
---|
| 632 | #define NO_WRITEV
|
---|
| 633 | #define SINGLE_THREADED
|
---|
| 634 | #define USE_FAST_MATH
|
---|
| 635 | #define TFM_TIMING_RESISTANT
|
---|
| 636 | #define WOLFSSL_NRF51
|
---|
| 637 | #define WOLFSSL_USER_IO
|
---|
| 638 | #define NO_SESSION_CACHE
|
---|
| 639 | #endif
|
---|
| 640 |
|
---|
| 641 | /* Micrium will use Visual Studio for compilation but not the Win32 API */
|
---|
| 642 | #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \
|
---|
| 643 | !defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \
|
---|
| 644 | !defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS)
|
---|
| 645 | #define USE_WINDOWS_API
|
---|
| 646 | #endif
|
---|
| 647 |
|
---|
| 648 | #if defined(WOLFSSL_uITRON4)
|
---|
| 649 |
|
---|
| 650 | #define XMALLOC_USER
|
---|
| 651 | #include <stddef.h>
|
---|
| 652 | #define ITRON_POOL_SIZE 1024*20
|
---|
| 653 | extern int uITRON4_minit(size_t poolsz) ;
|
---|
| 654 | extern void *uITRON4_malloc(size_t sz) ;
|
---|
| 655 | extern void *uITRON4_realloc(void *p, size_t sz) ;
|
---|
| 656 | extern void uITRON4_free(void *p) ;
|
---|
| 657 |
|
---|
| 658 | #define XMALLOC(sz, heap, type) uITRON4_malloc(sz)
|
---|
| 659 | #define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz)
|
---|
| 660 | #define XFREE(p, heap, type) uITRON4_free(p)
|
---|
| 661 | #endif
|
---|
| 662 |
|
---|
| 663 | #if defined(WOLFSSL_uTKERNEL2)
|
---|
| 664 | #ifndef NO_TKERNEL_MEM_POOL
|
---|
| 665 | #define XMALLOC_OVERRIDE
|
---|
| 666 | int uTKernel_init_mpool(unsigned int sz); /* initializing malloc pool */
|
---|
| 667 | void* uTKernel_malloc(unsigned int sz);
|
---|
| 668 | void* uTKernel_realloc(void *p, unsigned int sz);
|
---|
| 669 | void uTKernel_free(void *p);
|
---|
| 670 | #define XMALLOC(s, h, type) uTKernel_malloc((s))
|
---|
| 671 | #define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n))
|
---|
| 672 | #define XFREE(p, h, type) uTKernel_free((p))
|
---|
| 673 | #endif
|
---|
| 674 |
|
---|
| 675 | #ifndef NO_STDIO_FGETS_REMAP
|
---|
| 676 | #include <stdio.h>
|
---|
| 677 | #include "tm/tmonitor.h"
|
---|
| 678 |
|
---|
| 679 | /* static char* gets(char *buff); */
|
---|
| 680 | static char* fgets(char *buff, int sz, XFILE fp) {
|
---|
[464] | 681 | char * s = buff;
|
---|
| 682 | *s = '\0';
|
---|
[457] | 683 | while (1) {
|
---|
[464] | 684 | *s = tm_getchar(-1);
|
---|
| 685 | tm_putchar(*s);
|
---|
| 686 | if (*s == '\r') {
|
---|
[457] | 687 | tm_putchar('\n');
|
---|
[464] | 688 | *s = '\0';
|
---|
[457] | 689 | break;
|
---|
| 690 | }
|
---|
[464] | 691 | s++;
|
---|
[457] | 692 | }
|
---|
| 693 | return buff;
|
---|
| 694 | }
|
---|
| 695 | #endif /* !NO_STDIO_FGETS_REMAP */
|
---|
| 696 | #endif
|
---|
| 697 |
|
---|
| 698 |
|
---|
| 699 | #if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER) && \
|
---|
| 700 | !defined(NO_WOLFSSL_MEMORY)
|
---|
| 701 | #include <stdlib.h>
|
---|
| 702 | #define XMALLOC(s, h, type) malloc((s))
|
---|
| 703 | #define XFREE(p, h, type) free((p))
|
---|
| 704 | #define XREALLOC(p, n, h, t) realloc((p), (n))
|
---|
| 705 | #endif
|
---|
| 706 |
|
---|
| 707 | #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
---|
| 708 | #undef XMALLOC
|
---|
| 709 | #define XMALLOC yaXMALLOC
|
---|
| 710 | #undef XFREE
|
---|
| 711 | #define XFREE yaXFREE
|
---|
| 712 | #undef XREALLOC
|
---|
| 713 | #define XREALLOC yaXREALLOC
|
---|
| 714 | #endif
|
---|
| 715 |
|
---|
| 716 |
|
---|
| 717 | #ifdef FREERTOS
|
---|
| 718 | #include "FreeRTOS.h"
|
---|
| 719 |
|
---|
| 720 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
|
---|
| 721 | !defined(WOLFSSL_STATIC_MEMORY)
|
---|
| 722 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
| 723 | #define XFREE(p, h, type) vPortFree((p))
|
---|
[464] | 724 | /* FreeRTOS pvPortRealloc() implementation can be found here:
|
---|
| 725 | https://github.com/wolfSSL/wolfssl-freertos/pull/3/files */
|
---|
| 726 | #if !defined(USE_FAST_MATH) || defined(HAVE_ED25519) || \
|
---|
| 727 | defined(HAVE_ED448)
|
---|
| 728 | #if defined(WOLFSSL_ESPIDF)
|
---|
| 729 | /*In IDF, realloc(p, n) is equivalent to
|
---|
| 730 | heap_caps_realloc(p, s, MALLOC_CAP_8BIT) */
|
---|
| 731 | #define XREALLOC(p, n, h, t) realloc((p), (n))
|
---|
| 732 | #else
|
---|
| 733 | #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
---|
| 734 | #endif
|
---|
[457] | 735 | #endif
|
---|
| 736 | #endif
|
---|
[464] | 737 |
|
---|
[457] | 738 | #ifndef NO_WRITEV
|
---|
| 739 | #define NO_WRITEV
|
---|
| 740 | #endif
|
---|
| 741 | #ifndef HAVE_SHA512
|
---|
| 742 | #ifndef NO_SHA512
|
---|
| 743 | #define NO_SHA512
|
---|
| 744 | #endif
|
---|
| 745 | #endif
|
---|
| 746 | #ifndef HAVE_DH
|
---|
| 747 | #ifndef NO_DH
|
---|
| 748 | #define NO_DH
|
---|
| 749 | #endif
|
---|
| 750 | #endif
|
---|
| 751 | #ifndef NO_DSA
|
---|
| 752 | #define NO_DSA
|
---|
| 753 | #endif
|
---|
| 754 | #ifndef NO_HC128
|
---|
| 755 | #define NO_HC128
|
---|
| 756 | #endif
|
---|
| 757 |
|
---|
| 758 | #ifndef SINGLE_THREADED
|
---|
| 759 | #include "semphr.h"
|
---|
| 760 | #endif
|
---|
| 761 | #endif
|
---|
| 762 |
|
---|
| 763 | #ifdef FREERTOS_TCP
|
---|
| 764 | #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \
|
---|
| 765 | !defined(WOLFSSL_STATIC_MEMORY)
|
---|
| 766 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
| 767 | #define XFREE(p, h, type) vPortFree((p))
|
---|
| 768 | #endif
|
---|
| 769 |
|
---|
| 770 | #define WOLFSSL_GENSEED_FORTEST
|
---|
| 771 |
|
---|
| 772 | #define NO_WOLFSSL_DIR
|
---|
| 773 | #define NO_WRITEV
|
---|
| 774 | #define USE_FAST_MATH
|
---|
| 775 | #define TFM_TIMING_RESISTANT
|
---|
| 776 | #define NO_MAIN_DRIVER
|
---|
| 777 | #endif
|
---|
| 778 |
|
---|
| 779 | #ifdef WOLFSSL_TIRTOS
|
---|
| 780 | #define SIZEOF_LONG_LONG 8
|
---|
| 781 | #define NO_WRITEV
|
---|
| 782 | #define NO_WOLFSSL_DIR
|
---|
| 783 | #define USE_FAST_MATH
|
---|
| 784 | #define TFM_TIMING_RESISTANT
|
---|
| 785 | #define ECC_TIMING_RESISTANT
|
---|
| 786 | #define WC_RSA_BLINDING
|
---|
| 787 | #define NO_DEV_RANDOM
|
---|
| 788 | #define NO_FILESYSTEM
|
---|
| 789 | #define USE_CERT_BUFFERS_2048
|
---|
| 790 | #define NO_ERROR_STRINGS
|
---|
| 791 | /* Uncomment this setting if your toolchain does not offer time.h header */
|
---|
| 792 | /* #define USER_TIME */
|
---|
| 793 | #define HAVE_ECC
|
---|
| 794 | #define HAVE_ALPN
|
---|
| 795 | #define USE_WOLF_STRTOK /* use with HAVE_ALPN */
|
---|
| 796 | #define HAVE_TLS_EXTENSIONS
|
---|
| 797 | #define HAVE_AESGCM
|
---|
| 798 | #ifdef WOLFSSL_TI_CRYPT
|
---|
| 799 | #define NO_GCM_ENCRYPT_EXTRA
|
---|
| 800 | #define NO_PUBLIC_GCM_SET_IV
|
---|
| 801 | #define NO_PUBLIC_CCM_SET_NONCE
|
---|
| 802 | #endif
|
---|
| 803 | #define HAVE_SUPPORTED_CURVES
|
---|
| 804 | #define ALT_ECC_SIZE
|
---|
| 805 |
|
---|
| 806 | #ifdef __IAR_SYSTEMS_ICC__
|
---|
| 807 | #pragma diag_suppress=Pa089
|
---|
| 808 | #elif !defined(__GNUC__)
|
---|
| 809 | /* Suppress the sslpro warning */
|
---|
| 810 | #pragma diag_suppress=11
|
---|
| 811 | #endif
|
---|
| 812 |
|
---|
| 813 | #include <ti/sysbios/hal/Seconds.h>
|
---|
| 814 | #endif
|
---|
| 815 |
|
---|
| 816 | #ifdef EBSNET
|
---|
| 817 | #include "rtip.h"
|
---|
| 818 |
|
---|
| 819 | /* #define DEBUG_WOLFSSL */
|
---|
| 820 | #define NO_WOLFSSL_DIR /* tbd */
|
---|
| 821 |
|
---|
| 822 | #if (POLLOS)
|
---|
| 823 | #define SINGLE_THREADED
|
---|
| 824 | #endif
|
---|
| 825 |
|
---|
| 826 | #if (RTPLATFORM)
|
---|
| 827 | #if (!RTP_LITTLE_ENDIAN)
|
---|
| 828 | #define BIG_ENDIAN_ORDER
|
---|
| 829 | #endif
|
---|
| 830 | #else
|
---|
| 831 | #if (!KS_LITTLE_ENDIAN)
|
---|
| 832 | #define BIG_ENDIAN_ORDER
|
---|
| 833 | #endif
|
---|
| 834 | #endif
|
---|
| 835 |
|
---|
| 836 | #if (WINMSP3)
|
---|
| 837 | #undef SIZEOF_LONG
|
---|
| 838 | #define SIZEOF_LONG_LONG 8
|
---|
| 839 | #else
|
---|
[464] | 840 | #if !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG)
|
---|
| 841 | #error settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
---|
| 842 | #endif
|
---|
[457] | 843 | #endif
|
---|
| 844 |
|
---|
| 845 | #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
---|
| 846 | #define XFREE(p, h, type) (rtp_free(p))
|
---|
| 847 | #define XREALLOC(p, n, h, t) (rtp_realloc((p), (n)))
|
---|
| 848 |
|
---|
| 849 | #if (WINMSP3)
|
---|
| 850 | #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
|
---|
| 851 | #else
|
---|
[464] | 852 | #ifndef XSTRNCASECMP
|
---|
| 853 | #error settings.h - please implement XSTRNCASECMP - needed for HAVE_ECC
|
---|
| 854 | #endif
|
---|
[457] | 855 | #endif
|
---|
| 856 |
|
---|
| 857 | #define WOLFSSL_HAVE_MAX
|
---|
| 858 | #define WOLFSSL_HAVE_MIN
|
---|
| 859 |
|
---|
| 860 | #define USE_FAST_MATH
|
---|
| 861 | #define TFM_TIMING_RESISTANT
|
---|
| 862 | #define WC_RSA_BLINDING
|
---|
| 863 | #define ECC_TIMING_RESISTANT
|
---|
| 864 |
|
---|
| 865 | #define HAVE_ECC
|
---|
| 866 |
|
---|
| 867 | #endif /* EBSNET */
|
---|
| 868 |
|
---|
| 869 | #ifdef WOLFSSL_GAME_BUILD
|
---|
| 870 | #define SIZEOF_LONG_LONG 8
|
---|
| 871 | #if defined(__PPU) || defined(__XENON)
|
---|
| 872 | #define BIG_ENDIAN_ORDER
|
---|
| 873 | #endif
|
---|
| 874 | #endif
|
---|
| 875 |
|
---|
| 876 | #ifdef WOLFSSL_LSR
|
---|
| 877 | #define HAVE_WEBSERVER
|
---|
| 878 | #define SIZEOF_LONG_LONG 8
|
---|
| 879 | #define WOLFSSL_LOW_MEMORY
|
---|
| 880 | #define NO_WRITEV
|
---|
| 881 | #define NO_SHA512
|
---|
| 882 | #define NO_DH
|
---|
| 883 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
| 884 | /* WOLFSSL_DH_CONST */
|
---|
| 885 | #define NO_DSA
|
---|
| 886 | #define NO_HC128
|
---|
| 887 | #define NO_DEV_RANDOM
|
---|
| 888 | #define NO_WOLFSSL_DIR
|
---|
| 889 | #define NO_RABBIT
|
---|
| 890 | #ifndef NO_FILESYSTEM
|
---|
| 891 | #define LSR_FS
|
---|
| 892 | #include "inc/hw_types.h"
|
---|
| 893 | #include "fs.h"
|
---|
| 894 | #endif
|
---|
| 895 | #define WOLFSSL_LWIP
|
---|
| 896 | #include <errno.h> /* for tcp errno */
|
---|
| 897 | #define WOLFSSL_SAFERTOS
|
---|
| 898 | #if defined(__IAR_SYSTEMS_ICC__)
|
---|
| 899 | /* enum uses enum */
|
---|
| 900 | #pragma diag_suppress=Pa089
|
---|
| 901 | #endif
|
---|
| 902 | #endif
|
---|
| 903 |
|
---|
| 904 | #ifdef WOLFSSL_SAFERTOS
|
---|
| 905 | #ifndef SINGLE_THREADED
|
---|
| 906 | #include "SafeRTOS/semphr.h"
|
---|
| 907 | #endif
|
---|
| 908 | #ifndef WOLFSSL_NO_MALLOC
|
---|
| 909 | #include "SafeRTOS/heap.h"
|
---|
| 910 | #endif
|
---|
| 911 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
|
---|
| 912 | !defined(WOLFSSL_STATIC_MEMORY)
|
---|
| 913 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
| 914 | #define XFREE(p, h, type) vPortFree((p))
|
---|
[464] | 915 |
|
---|
| 916 | /* FreeRTOS pvPortRealloc() implementation can be found here:
|
---|
| 917 | https://github.com/wolfSSL/wolfssl-freertos/pull/3/files */
|
---|
| 918 | #if !defined(USE_FAST_MATH) || defined(HAVE_ED25519) || \
|
---|
| 919 | defined(HAVE_ED448)
|
---|
| 920 | #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
---|
| 921 | #endif
|
---|
[457] | 922 | #endif
|
---|
| 923 | #endif
|
---|
| 924 |
|
---|
| 925 | #ifdef WOLFSSL_LOW_MEMORY
|
---|
| 926 | #undef RSA_LOW_MEM
|
---|
| 927 | #define RSA_LOW_MEM
|
---|
| 928 | #undef WOLFSSL_SMALL_STACK
|
---|
| 929 | #define WOLFSSL_SMALL_STACK
|
---|
| 930 | #undef TFM_TIMING_RESISTANT
|
---|
| 931 | #define TFM_TIMING_RESISTANT
|
---|
| 932 | #endif
|
---|
| 933 |
|
---|
[464] | 934 | /* To support storing some of the large constant tables in flash memory rather than SRAM.
|
---|
| 935 | Useful for processors that have limited SRAM, such as the AVR family of microtrollers. */
|
---|
| 936 | #ifdef WOLFSSL_USE_FLASHMEM
|
---|
| 937 | /* This is supported on the avr-gcc compiler, for more information see:
|
---|
| 938 | https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html */
|
---|
| 939 | #define FLASH_QUALIFIER __flash
|
---|
| 940 |
|
---|
| 941 | /* Copy data out of flash memory and into SRAM */
|
---|
| 942 | #define XMEMCPY_P(pdest, psrc, size) memcpy_P((pdest), (psrc), (size))
|
---|
| 943 | #else
|
---|
| 944 | #define FLASH_QUALIFIER
|
---|
| 945 | #endif
|
---|
| 946 |
|
---|
[457] | 947 | #ifdef FREESCALE_MQX_5_0
|
---|
| 948 | /* use normal Freescale MQX port, but with minor changes for 5.0 */
|
---|
| 949 | #define FREESCALE_MQX
|
---|
| 950 | #endif
|
---|
| 951 |
|
---|
| 952 | #ifdef FREESCALE_MQX_4_0
|
---|
| 953 | /* use normal Freescale MQX port, but with minor changes for 4.0 */
|
---|
| 954 | #define FREESCALE_MQX
|
---|
| 955 | #endif
|
---|
| 956 |
|
---|
| 957 | #ifdef FREESCALE_MQX
|
---|
| 958 | #define FREESCALE_COMMON
|
---|
| 959 | #include "mqx.h"
|
---|
| 960 | #ifndef NO_FILESYSTEM
|
---|
| 961 | #include "mfs.h"
|
---|
| 962 | #if (defined(MQX_USE_IO_OLD) && MQX_USE_IO_OLD) || \
|
---|
| 963 | defined(FREESCALE_MQX_5_0)
|
---|
| 964 | #include "fio.h"
|
---|
| 965 | #define NO_STDIO_FILESYSTEM
|
---|
| 966 | #else
|
---|
| 967 | #include "nio.h"
|
---|
| 968 | #endif
|
---|
| 969 | #endif
|
---|
| 970 | #ifndef SINGLE_THREADED
|
---|
| 971 | #include "mutex.h"
|
---|
| 972 | #endif
|
---|
| 973 |
|
---|
| 974 | #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER)
|
---|
| 975 | #define XMALLOC_OVERRIDE
|
---|
| 976 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
---|
| 977 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
---|
| 978 | /* Note: MQX has no realloc, using fastmath above */
|
---|
| 979 | #endif
|
---|
[464] | 980 | #ifdef USE_FAST_MATH
|
---|
| 981 | /* Undef first to avoid re-definition if user_settings.h defines */
|
---|
| 982 | #undef TFM_TIMING_RESISTANT
|
---|
| 983 | #define TFM_TIMING_RESISTANT
|
---|
| 984 | #undef ECC_TIMING_RESISTANT
|
---|
| 985 | #define ECC_TIMING_RESISTANT
|
---|
| 986 | #undef WC_RSA_BLINDING
|
---|
| 987 | #define WC_RSA_BLINDING
|
---|
| 988 | #endif
|
---|
[457] | 989 | #endif
|
---|
| 990 |
|
---|
| 991 | #ifdef FREESCALE_KSDK_MQX
|
---|
| 992 | #define FREESCALE_COMMON
|
---|
| 993 | #include <mqx.h>
|
---|
| 994 | #ifndef NO_FILESYSTEM
|
---|
| 995 | #if (defined(MQX_USE_IO_OLD) && MQX_USE_IO_OLD) || \
|
---|
| 996 | defined(FREESCALE_MQX_5_0)
|
---|
| 997 | #include <fio.h>
|
---|
| 998 | #else
|
---|
| 999 | #include <stdio.h>
|
---|
| 1000 | #include <nio.h>
|
---|
| 1001 | #endif
|
---|
| 1002 | #endif
|
---|
| 1003 | #ifndef SINGLE_THREADED
|
---|
| 1004 | #include <mutex.h>
|
---|
| 1005 | #endif
|
---|
| 1006 |
|
---|
| 1007 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
---|
| 1008 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
---|
| 1009 | #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
|
---|
| 1010 |
|
---|
| 1011 | #define MQX_FILE_PTR FILE *
|
---|
| 1012 | #define IO_SEEK_SET SEEK_SET
|
---|
| 1013 | #define IO_SEEK_END SEEK_END
|
---|
| 1014 | #endif /* FREESCALE_KSDK_MQX */
|
---|
| 1015 |
|
---|
| 1016 | #if defined(FREESCALE_FREE_RTOS) || defined(FREESCALE_KSDK_FREERTOS)
|
---|
| 1017 | #define NO_FILESYSTEM
|
---|
| 1018 | #define WOLFSSL_CRYPT_HW_MUTEX 1
|
---|
| 1019 |
|
---|
| 1020 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY)
|
---|
| 1021 | #define XMALLOC(s, h, type) pvPortMalloc((s))
|
---|
| 1022 | #define XFREE(p, h, type) vPortFree((p))
|
---|
| 1023 | #endif
|
---|
| 1024 |
|
---|
| 1025 | //#define USER_TICKS
|
---|
| 1026 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
|
---|
| 1027 | /* WOLFSSL_DH_CONST */
|
---|
| 1028 | #define WOLFSSL_LWIP
|
---|
| 1029 | #define FREERTOS_TCP
|
---|
| 1030 |
|
---|
| 1031 | #define FREESCALE_FREE_RTOS
|
---|
| 1032 | #define FREERTOS_SOCKET_ERROR ( -1 )
|
---|
| 1033 | #define FREERTOS_EWOULDBLOCK ( -2 )
|
---|
| 1034 | #define FREERTOS_EINVAL ( -4 )
|
---|
| 1035 | #define FREERTOS_EADDRNOTAVAIL ( -5 )
|
---|
| 1036 | #define FREERTOS_EADDRINUSE ( -6 )
|
---|
| 1037 | #define FREERTOS_ENOBUFS ( -7 )
|
---|
| 1038 | #define FREERTOS_ENOPROTOOPT ( -8 )
|
---|
| 1039 | #endif /* FREESCALE_FREE_RTOS || FREESCALE_KSDK_FREERTOS */
|
---|
| 1040 |
|
---|
| 1041 | #ifdef FREESCALE_KSDK_BM
|
---|
| 1042 | #define FREESCALE_COMMON
|
---|
| 1043 | #define WOLFSSL_USER_IO
|
---|
| 1044 | #define SINGLE_THREADED
|
---|
| 1045 | #define NO_FILESYSTEM
|
---|
| 1046 | #ifndef TIME_OVERRIDES
|
---|
| 1047 | #define USER_TICKS
|
---|
| 1048 | #endif
|
---|
| 1049 | #endif /* FREESCALE_KSDK_BM */
|
---|
| 1050 |
|
---|
| 1051 | #ifdef FREESCALE_COMMON
|
---|
| 1052 | #define SIZEOF_LONG_LONG 8
|
---|
| 1053 |
|
---|
| 1054 | /* disable features */
|
---|
| 1055 | #undef NO_WRITEV
|
---|
| 1056 | #define NO_WRITEV
|
---|
| 1057 | #undef NO_DEV_RANDOM
|
---|
| 1058 | #define NO_DEV_RANDOM
|
---|
| 1059 | #undef NO_RABBIT
|
---|
| 1060 | #define NO_RABBIT
|
---|
| 1061 | #undef NO_WOLFSSL_DIR
|
---|
| 1062 | #define NO_WOLFSSL_DIR
|
---|
| 1063 | #undef NO_RC4
|
---|
| 1064 | #define NO_RC4
|
---|
| 1065 |
|
---|
| 1066 | /* enable features */
|
---|
| 1067 | #undef USE_FAST_MATH
|
---|
| 1068 | #define USE_FAST_MATH
|
---|
| 1069 |
|
---|
| 1070 | #define USE_CERT_BUFFERS_2048
|
---|
| 1071 | #define BENCH_EMBEDDED
|
---|
| 1072 |
|
---|
| 1073 | #define TFM_TIMING_RESISTANT
|
---|
| 1074 | #define ECC_TIMING_RESISTANT
|
---|
| 1075 |
|
---|
| 1076 | #undef HAVE_ECC
|
---|
[464] | 1077 | #ifndef WOLFCRYPT_FIPS_RAND
|
---|
[457] | 1078 | #define HAVE_ECC
|
---|
[464] | 1079 | #endif
|
---|
[457] | 1080 | #ifndef NO_AES
|
---|
| 1081 | #undef HAVE_AESCCM
|
---|
| 1082 | #define HAVE_AESCCM
|
---|
| 1083 | #undef HAVE_AESGCM
|
---|
| 1084 | #define HAVE_AESGCM
|
---|
| 1085 | #undef WOLFSSL_AES_COUNTER
|
---|
| 1086 | #define WOLFSSL_AES_COUNTER
|
---|
| 1087 | #undef WOLFSSL_AES_DIRECT
|
---|
| 1088 | #define WOLFSSL_AES_DIRECT
|
---|
| 1089 | #endif
|
---|
| 1090 |
|
---|
| 1091 | #ifdef FREESCALE_KSDK_1_3
|
---|
| 1092 | #include "fsl_device_registers.h"
|
---|
| 1093 | #elif !defined(FREESCALE_MQX)
|
---|
| 1094 | /* Classic MQX does not have fsl_common.h */
|
---|
| 1095 | #include "fsl_common.h"
|
---|
| 1096 | #endif
|
---|
| 1097 |
|
---|
| 1098 | /* random seed */
|
---|
| 1099 | #define NO_OLD_RNGNAME
|
---|
[464] | 1100 | #if defined(FREESCALE_NO_RNG)
|
---|
| 1101 | /* nothing to define */
|
---|
| 1102 | #elif defined(FSL_FEATURE_SOC_TRNG_COUNT) && (FSL_FEATURE_SOC_TRNG_COUNT > 0)
|
---|
[457] | 1103 | #define FREESCALE_KSDK_2_0_TRNG
|
---|
| 1104 | #elif defined(FSL_FEATURE_SOC_RNG_COUNT) && (FSL_FEATURE_SOC_RNG_COUNT > 0)
|
---|
| 1105 | #ifdef FREESCALE_KSDK_1_3
|
---|
| 1106 | #include "fsl_rnga_driver.h"
|
---|
| 1107 | #define FREESCALE_RNGA
|
---|
| 1108 | #define RNGA_INSTANCE (0)
|
---|
| 1109 | #else
|
---|
| 1110 | #define FREESCALE_KSDK_2_0_RNGA
|
---|
| 1111 | #endif
|
---|
| 1112 | #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS) && !defined(FREESCALE_KSDK_FREERTOS)
|
---|
| 1113 | #define FREESCALE_RNGA
|
---|
| 1114 | #define RNGA_INSTANCE (0)
|
---|
| 1115 | /* defaulting to K70 RNGA, user should change if different */
|
---|
| 1116 | /* #define FREESCALE_K53_RNGB */
|
---|
| 1117 | #define FREESCALE_K70_RNGA
|
---|
| 1118 | #endif
|
---|
| 1119 |
|
---|
| 1120 | /* HW crypto */
|
---|
| 1121 | /* automatic enable based on Kinetis feature */
|
---|
| 1122 | /* if case manual selection is required, for example for benchmarking purposes,
|
---|
| 1123 | * just define FREESCALE_USE_MMCAU or FREESCALE_USE_LTC or none of these two macros (for software only)
|
---|
| 1124 | * both can be enabled simultaneously as LTC has priority over MMCAU in source code.
|
---|
| 1125 | */
|
---|
| 1126 | /* #define FSL_HW_CRYPTO_MANUAL_SELECTION */
|
---|
| 1127 | #ifndef FSL_HW_CRYPTO_MANUAL_SELECTION
|
---|
| 1128 | #if defined(FSL_FEATURE_SOC_MMCAU_COUNT) && FSL_FEATURE_SOC_MMCAU_COUNT
|
---|
| 1129 | #define FREESCALE_USE_MMCAU
|
---|
| 1130 | #endif
|
---|
| 1131 |
|
---|
| 1132 | #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT
|
---|
| 1133 | #define FREESCALE_USE_LTC
|
---|
| 1134 | #endif
|
---|
| 1135 | #else
|
---|
| 1136 | /* #define FREESCALE_USE_MMCAU */
|
---|
| 1137 | /* #define FREESCALE_USE_LTC */
|
---|
| 1138 | #endif
|
---|
| 1139 | #endif /* FREESCALE_COMMON */
|
---|
| 1140 |
|
---|
| 1141 | /* Classic pre-KSDK mmCAU library */
|
---|
| 1142 | #ifdef FREESCALE_USE_MMCAU_CLASSIC
|
---|
| 1143 | #define FREESCALE_USE_MMCAU
|
---|
| 1144 | #define FREESCALE_MMCAU_CLASSIC
|
---|
| 1145 | #define FREESCALE_MMCAU_CLASSIC_SHA
|
---|
| 1146 | #endif
|
---|
| 1147 |
|
---|
| 1148 | /* KSDK mmCAU library */
|
---|
| 1149 | #ifdef FREESCALE_USE_MMCAU
|
---|
| 1150 | /* AES and DES */
|
---|
| 1151 | #define FREESCALE_MMCAU
|
---|
| 1152 | /* MD5, SHA-1 and SHA-256 */
|
---|
| 1153 | #define FREESCALE_MMCAU_SHA
|
---|
| 1154 | #endif /* FREESCALE_USE_MMCAU */
|
---|
| 1155 |
|
---|
| 1156 | #ifdef FREESCALE_USE_LTC
|
---|
| 1157 | #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT
|
---|
| 1158 | #define FREESCALE_LTC
|
---|
| 1159 | #define LTC_BASE LTC0
|
---|
| 1160 |
|
---|
| 1161 | #if defined(FSL_FEATURE_LTC_HAS_DES) && FSL_FEATURE_LTC_HAS_DES
|
---|
| 1162 | #define FREESCALE_LTC_DES
|
---|
| 1163 | #endif
|
---|
| 1164 |
|
---|
| 1165 | #if defined(FSL_FEATURE_LTC_HAS_GCM) && FSL_FEATURE_LTC_HAS_GCM
|
---|
| 1166 | #define FREESCALE_LTC_AES_GCM
|
---|
| 1167 | #endif
|
---|
| 1168 |
|
---|
| 1169 | #if defined(FSL_FEATURE_LTC_HAS_SHA) && FSL_FEATURE_LTC_HAS_SHA
|
---|
| 1170 | #define FREESCALE_LTC_SHA
|
---|
| 1171 | #endif
|
---|
| 1172 |
|
---|
| 1173 | #if defined(FSL_FEATURE_LTC_HAS_PKHA) && FSL_FEATURE_LTC_HAS_PKHA
|
---|
[464] | 1174 | #ifndef WOLFCRYPT_FIPS_RAND
|
---|
[457] | 1175 | #define FREESCALE_LTC_ECC
|
---|
[464] | 1176 | #endif
|
---|
[457] | 1177 | #define FREESCALE_LTC_TFM
|
---|
| 1178 |
|
---|
| 1179 | /* the LTC PKHA hardware limit is 2048 bits (256 bytes) for integer arithmetic.
|
---|
| 1180 | the LTC_MAX_INT_BYTES defines the size of local variables that hold big integers. */
|
---|
| 1181 | #ifndef LTC_MAX_INT_BYTES
|
---|
| 1182 | #define LTC_MAX_INT_BYTES (256)
|
---|
| 1183 | #endif
|
---|
| 1184 |
|
---|
| 1185 | /* This FREESCALE_LTC_TFM_RSA_4096_ENABLE macro can be defined.
|
---|
| 1186 | * In such a case both software and hardware algorithm
|
---|
| 1187 | * for TFM is linked in. The decision for which algorithm is used is determined at runtime
|
---|
| 1188 | * from size of inputs. If inputs and result can fit into LTC (see LTC_MAX_INT_BYTES)
|
---|
| 1189 | * then we call hardware algorithm, otherwise we call software algorithm.
|
---|
| 1190 | *
|
---|
| 1191 | * Chinese reminder theorem is used to break RSA 4096 exponentiations (both public and private key)
|
---|
| 1192 | * into several computations with 2048-bit modulus and exponents.
|
---|
| 1193 | */
|
---|
| 1194 | /* #define FREESCALE_LTC_TFM_RSA_4096_ENABLE */
|
---|
| 1195 |
|
---|
| 1196 | /* ECC-384, ECC-256, ECC-224 and ECC-192 have been enabled with LTC PKHA acceleration */
|
---|
| 1197 | #ifdef HAVE_ECC
|
---|
| 1198 | #undef ECC_TIMING_RESISTANT
|
---|
| 1199 | #define ECC_TIMING_RESISTANT
|
---|
| 1200 |
|
---|
| 1201 | /* the LTC PKHA hardware limit is 512 bits (64 bytes) for ECC.
|
---|
| 1202 | the LTC_MAX_ECC_BITS defines the size of local variables that hold ECC parameters
|
---|
| 1203 | and point coordinates */
|
---|
| 1204 | #ifndef LTC_MAX_ECC_BITS
|
---|
| 1205 | #define LTC_MAX_ECC_BITS (384)
|
---|
| 1206 | #endif
|
---|
| 1207 |
|
---|
| 1208 | /* Enable curves up to 384 bits */
|
---|
| 1209 | #if !defined(ECC_USER_CURVES) && !defined(HAVE_ALL_CURVES)
|
---|
| 1210 | #define ECC_USER_CURVES
|
---|
| 1211 | #define HAVE_ECC192
|
---|
| 1212 | #define HAVE_ECC224
|
---|
| 1213 | #undef NO_ECC256
|
---|
| 1214 | #define HAVE_ECC384
|
---|
| 1215 | #endif
|
---|
| 1216 | #endif
|
---|
| 1217 | #endif
|
---|
| 1218 | #endif
|
---|
| 1219 | #endif /* FREESCALE_USE_LTC */
|
---|
| 1220 |
|
---|
| 1221 | #ifdef FREESCALE_LTC_TFM_RSA_4096_ENABLE
|
---|
| 1222 | #undef USE_CERT_BUFFERS_4096
|
---|
| 1223 | #define USE_CERT_BUFFERS_4096
|
---|
| 1224 | #undef FP_MAX_BITS
|
---|
| 1225 | #define FP_MAX_BITS (8192)
|
---|
[464] | 1226 | #undef SP_INT_BITS
|
---|
| 1227 | #define SP_INT_BITS (4096)
|
---|
[457] | 1228 |
|
---|
| 1229 | #undef NO_DH
|
---|
| 1230 | #define NO_DH
|
---|
| 1231 | #undef NO_DSA
|
---|
| 1232 | #define NO_DSA
|
---|
| 1233 | #endif /* FREESCALE_LTC_TFM_RSA_4096_ENABLE */
|
---|
| 1234 |
|
---|
| 1235 | /* if LTC has AES engine but doesn't have GCM, use software with LTC AES ECB mode */
|
---|
| 1236 | #if defined(FREESCALE_USE_LTC) && !defined(FREESCALE_LTC_AES_GCM)
|
---|
| 1237 | #define GCM_TABLE
|
---|
| 1238 | #endif
|
---|
| 1239 |
|
---|
| 1240 | #if defined(WOLFSSL_STM32F2) || defined(WOLFSSL_STM32F4) || \
|
---|
| 1241 | defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32F1) || \
|
---|
[464] | 1242 | defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \
|
---|
| 1243 | defined(WOLFSSL_STM32WB) || defined(WOLFSSL_STM32H7)
|
---|
[457] | 1244 |
|
---|
| 1245 | #define SIZEOF_LONG_LONG 8
|
---|
| 1246 | #ifndef CHAR_BIT
|
---|
| 1247 | #define CHAR_BIT 8
|
---|
| 1248 | #endif
|
---|
| 1249 | #define NO_DEV_RANDOM
|
---|
| 1250 | #define NO_WOLFSSL_DIR
|
---|
| 1251 | #undef NO_RABBIT
|
---|
| 1252 | #define NO_RABBIT
|
---|
| 1253 | #ifndef NO_STM32_RNG
|
---|
| 1254 | #undef STM32_RNG
|
---|
| 1255 | #define STM32_RNG
|
---|
| 1256 | #ifdef WOLFSSL_STM32F427_RNG
|
---|
| 1257 | #include "stm32f427xx.h"
|
---|
| 1258 | #endif
|
---|
| 1259 | #endif
|
---|
| 1260 | #ifndef NO_STM32_CRYPTO
|
---|
| 1261 | #undef STM32_CRYPTO
|
---|
| 1262 | #define STM32_CRYPTO
|
---|
| 1263 |
|
---|
[464] | 1264 | #if defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \
|
---|
| 1265 | defined(WOLFSSL_STM32WB)
|
---|
[457] | 1266 | #define NO_AES_192 /* hardware does not support 192-bit */
|
---|
| 1267 | #endif
|
---|
| 1268 | #endif
|
---|
| 1269 | #ifndef NO_STM32_HASH
|
---|
| 1270 | #undef STM32_HASH
|
---|
| 1271 | #define STM32_HASH
|
---|
| 1272 | #endif
|
---|
| 1273 | #if !defined(__GNUC__) && !defined(__ICCARM__)
|
---|
| 1274 | #define KEIL_INTRINSICS
|
---|
| 1275 | #endif
|
---|
| 1276 | #define NO_OLD_RNGNAME
|
---|
| 1277 | #ifdef WOLFSSL_STM32_CUBEMX
|
---|
[464] | 1278 | #if defined(WOLFSSL_STM32F1)
|
---|
| 1279 | #include "stm32f1xx_hal.h"
|
---|
| 1280 | #elif defined(WOLFSSL_STM32F2)
|
---|
[457] | 1281 | #include "stm32f2xx_hal.h"
|
---|
[464] | 1282 | #elif defined(WOLFSSL_STM32L5)
|
---|
| 1283 | #include "stm32l5xx_hal.h"
|
---|
[457] | 1284 | #elif defined(WOLFSSL_STM32L4)
|
---|
| 1285 | #include "stm32l4xx_hal.h"
|
---|
| 1286 | #elif defined(WOLFSSL_STM32F4)
|
---|
| 1287 | #include "stm32f4xx_hal.h"
|
---|
| 1288 | #elif defined(WOLFSSL_STM32F7)
|
---|
| 1289 | #include "stm32f7xx_hal.h"
|
---|
| 1290 | #elif defined(WOLFSSL_STM32F1)
|
---|
| 1291 | #include "stm32f1xx_hal.h"
|
---|
[464] | 1292 | #elif defined(WOLFSSL_STM32H7)
|
---|
| 1293 | #include "stm32h7xx_hal.h"
|
---|
| 1294 | #elif defined(WOLFSSL_STM32WB)
|
---|
| 1295 | #include "stm32wbxx_hal.h"
|
---|
[457] | 1296 | #endif
|
---|
| 1297 | #if defined(WOLFSSL_CUBEMX_USE_LL) && defined(WOLFSSL_STM32L4)
|
---|
| 1298 | #include "stm32l4xx_ll_rng.h"
|
---|
| 1299 | #endif
|
---|
| 1300 |
|
---|
| 1301 | #ifndef STM32_HAL_TIMEOUT
|
---|
| 1302 | #define STM32_HAL_TIMEOUT 0xFF
|
---|
| 1303 | #endif
|
---|
| 1304 | #else
|
---|
| 1305 | #if defined(WOLFSSL_STM32F2)
|
---|
| 1306 | #include "stm32f2xx.h"
|
---|
| 1307 | #ifdef STM32_CRYPTO
|
---|
| 1308 | #include "stm32f2xx_cryp.h"
|
---|
| 1309 | #endif
|
---|
| 1310 | #ifdef STM32_HASH
|
---|
| 1311 | #include "stm32f2xx_hash.h"
|
---|
| 1312 | #endif
|
---|
| 1313 | #elif defined(WOLFSSL_STM32F4)
|
---|
| 1314 | #include "stm32f4xx.h"
|
---|
| 1315 | #ifdef STM32_CRYPTO
|
---|
| 1316 | #include "stm32f4xx_cryp.h"
|
---|
| 1317 | #endif
|
---|
| 1318 | #ifdef STM32_HASH
|
---|
| 1319 | #include "stm32f4xx_hash.h"
|
---|
| 1320 | #endif
|
---|
[464] | 1321 | #elif defined(WOLFSSL_STM32L5)
|
---|
| 1322 | #include "stm32l5xx.h"
|
---|
| 1323 | #ifdef STM32_CRYPTO
|
---|
| 1324 | #include "stm32l5xx_cryp.h"
|
---|
| 1325 | #endif
|
---|
| 1326 | #ifdef STM32_HASH
|
---|
| 1327 | #include "stm32l5xx_hash.h"
|
---|
| 1328 | #endif
|
---|
[457] | 1329 | #elif defined(WOLFSSL_STM32L4)
|
---|
| 1330 | #include "stm32l4xx.h"
|
---|
| 1331 | #ifdef STM32_CRYPTO
|
---|
| 1332 | #include "stm32l4xx_cryp.h"
|
---|
| 1333 | #endif
|
---|
| 1334 | #ifdef STM32_HASH
|
---|
| 1335 | #include "stm32l4xx_hash.h"
|
---|
| 1336 | #endif
|
---|
| 1337 | #elif defined(WOLFSSL_STM32F7)
|
---|
| 1338 | #include "stm32f7xx.h"
|
---|
[464] | 1339 | #elif defined(WOLFSSL_STM32H7)
|
---|
| 1340 | #include "stm32h7xx.h"
|
---|
[457] | 1341 | #elif defined(WOLFSSL_STM32F1)
|
---|
| 1342 | #include "stm32f1xx.h"
|
---|
| 1343 | #endif
|
---|
| 1344 | #endif /* WOLFSSL_STM32_CUBEMX */
|
---|
[464] | 1345 | #endif /* WOLFSSL_STM32F2 || WOLFSSL_STM32F4 || WOLFSSL_STM32L4 ||
|
---|
| 1346 | WOLFSSL_STM32L5 || WOLFSSL_STM32F7 || WOLFSSL_STMWB || WOLFSSL_STM32H7 */
|
---|
[457] | 1347 | #ifdef WOLFSSL_DEOS
|
---|
| 1348 | #include <deos.h>
|
---|
| 1349 | #include <timeout.h>
|
---|
| 1350 | #include <socketapi.h>
|
---|
| 1351 | #include <lwip-socket.h>
|
---|
| 1352 | #include <mem.h>
|
---|
| 1353 | #include <string.h>
|
---|
| 1354 | #include <stdlib.h> /* for rand_r: pseudo-random number generator */
|
---|
| 1355 | #include <stdio.h> /* for snprintf */
|
---|
| 1356 |
|
---|
| 1357 | /* use external memory XMALLOC, XFREE and XREALLOC functions */
|
---|
| 1358 | #define XMALLOC_USER
|
---|
| 1359 |
|
---|
| 1360 | /* disable fall-back case, malloc, realloc and free are unavailable */
|
---|
| 1361 | #define WOLFSSL_NO_MALLOC
|
---|
| 1362 |
|
---|
| 1363 | /* file system has not been ported since it is a separate product. */
|
---|
| 1364 |
|
---|
| 1365 | #define NO_FILESYSTEM
|
---|
| 1366 |
|
---|
| 1367 | #ifdef NO_FILESYSTEM
|
---|
| 1368 | #define NO_WOLFSSL_DIR
|
---|
| 1369 | #define NO_WRITEV
|
---|
| 1370 | #endif
|
---|
| 1371 |
|
---|
| 1372 | #define USE_FAST_MATH
|
---|
| 1373 | #define TFM_TIMING_RESISTANT
|
---|
| 1374 | #define ECC_TIMING_RESISTANT
|
---|
| 1375 | #define WC_RSA_BLINDING
|
---|
| 1376 |
|
---|
| 1377 | #define HAVE_ECC
|
---|
| 1378 | #define ALT_ECC_SIZE
|
---|
| 1379 | #define TFM_ECC192
|
---|
| 1380 | #define TFM_ECC224
|
---|
| 1381 | #define TFM_ECC256
|
---|
| 1382 | #define TFM_ECC384
|
---|
| 1383 | #define TFM_ECC521
|
---|
| 1384 |
|
---|
| 1385 | #define HAVE_TLS_EXTENSIONS
|
---|
| 1386 | #define HAVE_SUPPORTED_CURVES
|
---|
| 1387 | #define HAVE_EXTENDED_MASTER
|
---|
| 1388 |
|
---|
| 1389 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
---|
| 1390 | #define BIG_ENDIAN_ORDER
|
---|
| 1391 | #else
|
---|
| 1392 | #undef BIG_ENDIAN_ORDER
|
---|
| 1393 | #define LITTLE_ENDIAN_ORDER
|
---|
| 1394 | #endif
|
---|
| 1395 | #endif /* WOLFSSL_DEOS*/
|
---|
| 1396 |
|
---|
| 1397 | #ifdef MICRIUM
|
---|
| 1398 | #include <stdlib.h>
|
---|
| 1399 | #include <os.h>
|
---|
[464] | 1400 | #if defined(RTOS_MODULE_NET_AVAIL) || (APP_CFG_TCPIP_EN == DEF_ENABLED)
|
---|
| 1401 | #include <net_cfg.h>
|
---|
| 1402 | #include <net_sock.h>
|
---|
| 1403 | #if (OS_VERSION < 50000)
|
---|
| 1404 | #include <net_err.h>
|
---|
| 1405 | #endif
|
---|
| 1406 | #endif
|
---|
[457] | 1407 | #include <lib_mem.h>
|
---|
| 1408 | #include <lib_math.h>
|
---|
[464] | 1409 | #include <lib_str.h>
|
---|
| 1410 | #include <stdio.h>
|
---|
| 1411 | #include <string.h>
|
---|
[457] | 1412 |
|
---|
| 1413 | #define USE_FAST_MATH
|
---|
| 1414 | #define TFM_TIMING_RESISTANT
|
---|
| 1415 | #define ECC_TIMING_RESISTANT
|
---|
| 1416 | #define WC_RSA_BLINDING
|
---|
| 1417 | #define HAVE_HASHDRBG
|
---|
| 1418 |
|
---|
| 1419 | #define HAVE_ECC
|
---|
| 1420 | #define ALT_ECC_SIZE
|
---|
| 1421 | #define TFM_ECC192
|
---|
| 1422 | #define TFM_ECC224
|
---|
| 1423 | #define TFM_ECC256
|
---|
| 1424 | #define TFM_ECC384
|
---|
| 1425 | #define TFM_ECC521
|
---|
| 1426 |
|
---|
| 1427 | #define NO_RC4
|
---|
| 1428 | #define HAVE_TLS_EXTENSIONS
|
---|
| 1429 | #define HAVE_SUPPORTED_CURVES
|
---|
| 1430 | #define HAVE_EXTENDED_MASTER
|
---|
| 1431 |
|
---|
| 1432 | #define NO_WOLFSSL_DIR
|
---|
| 1433 | #define NO_WRITEV
|
---|
| 1434 |
|
---|
[464] | 1435 | #if ! defined(WOLFSSL_SILABS_SE_ACCEL) && !defined(CUSTOM_RAND_GENERATE)
|
---|
[457] | 1436 | #define CUSTOM_RAND_TYPE RAND_NBR
|
---|
| 1437 | #define CUSTOM_RAND_GENERATE Math_Rand
|
---|
| 1438 | #endif
|
---|
| 1439 | #define STRING_USER
|
---|
| 1440 | #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
---|
| 1441 | #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
---|
| 1442 | ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
---|
| 1443 | (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
---|
| 1444 | #define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
---|
| 1445 | ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
---|
| 1446 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
---|
| 1447 | #define XSTRNCASECMP(pstr_1, pstr_2, len_max) \
|
---|
| 1448 | ((CPU_INT16S)Str_CmpIgnoreCase_N((CPU_CHAR *)(pstr_1), \
|
---|
| 1449 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
---|
| 1450 | #define XSTRSTR(pstr, pstr_srch) \
|
---|
| 1451 | ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
---|
| 1452 | (CPU_CHAR *)(pstr_srch)))
|
---|
| 1453 | #define XSTRNSTR(pstr, pstr_srch, len_max) \
|
---|
| 1454 | ((CPU_CHAR *)Str_Str_N((CPU_CHAR *)(pstr), \
|
---|
| 1455 | (CPU_CHAR *)(pstr_srch),(CPU_SIZE_T)(len_max)))
|
---|
| 1456 | #define XSTRNCAT(pstr_dest, pstr_cat, len_max) \
|
---|
| 1457 | ((CPU_CHAR *)Str_Cat_N((CPU_CHAR *)(pstr_dest), \
|
---|
| 1458 | (const CPU_CHAR *)(pstr_cat),(CPU_SIZE_T)(len_max)))
|
---|
| 1459 | #define XMEMSET(pmem, data_val, size) \
|
---|
| 1460 | ((void)Mem_Set((void *)(pmem), \
|
---|
| 1461 | (CPU_INT08U) (data_val), \
|
---|
| 1462 | (CPU_SIZE_T)(size)))
|
---|
| 1463 | #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
---|
| 1464 | (void *)(psrc), (CPU_SIZE_T)(size)))
|
---|
[464] | 1465 |
|
---|
| 1466 | #if (OS_VERSION < 50000)
|
---|
| 1467 | #define XMEMCMP(pmem_1, pmem_2, size) \
|
---|
| 1468 | (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), \
|
---|
| 1469 | (void *)(pmem_2), \
|
---|
[457] | 1470 | (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
---|
[464] | 1471 | #else
|
---|
| 1472 | /* Work around for Micrium OS version 5.8 change in behavior
|
---|
| 1473 | * that returns DEF_NO for 0 size compare
|
---|
| 1474 | */
|
---|
| 1475 | #define XMEMCMP(pmem_1, pmem_2, size) \
|
---|
| 1476 | (( (size < 1 ) || \
|
---|
| 1477 | ((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), \
|
---|
| 1478 | (void *)(pmem_2), \
|
---|
| 1479 | (CPU_SIZE_T)(size)) == DEF_YES)) \
|
---|
| 1480 | ? 0 : 1)
|
---|
| 1481 | #define XSNPRINTF snprintf
|
---|
| 1482 | #endif
|
---|
| 1483 |
|
---|
[457] | 1484 | #define XMEMMOVE XMEMCPY
|
---|
| 1485 |
|
---|
| 1486 | #if (OS_CFG_MUTEX_EN == DEF_DISABLED)
|
---|
| 1487 | #define SINGLE_THREADED
|
---|
| 1488 | #endif
|
---|
| 1489 |
|
---|
| 1490 | #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
---|
| 1491 | #define BIG_ENDIAN_ORDER
|
---|
| 1492 | #else
|
---|
| 1493 | #undef BIG_ENDIAN_ORDER
|
---|
| 1494 | #define LITTLE_ENDIAN_ORDER
|
---|
| 1495 | #endif
|
---|
| 1496 | #endif /* MICRIUM */
|
---|
| 1497 |
|
---|
[464] | 1498 | #if defined(sun) || defined(__sun)
|
---|
| 1499 | # if defined(__SVR4) || defined(__svr4__)
|
---|
| 1500 | /* Solaris */
|
---|
| 1501 | #ifndef WOLFSSL_SOLARIS
|
---|
| 1502 | #define WOLFSSL_SOLARIS
|
---|
| 1503 | #endif
|
---|
| 1504 | # else
|
---|
| 1505 | /* SunOS */
|
---|
| 1506 | # endif
|
---|
| 1507 | #endif
|
---|
| 1508 |
|
---|
| 1509 | #ifdef WOLFSSL_SOLARIS
|
---|
| 1510 | /* Avoid naming clash with fp_zero from math.h > ieefp.h */
|
---|
| 1511 | #define WOLFSSL_DH_CONST
|
---|
| 1512 | #endif
|
---|
| 1513 |
|
---|
[457] | 1514 | #ifdef WOLFSSL_MCF5441X
|
---|
| 1515 | #define BIG_ENDIAN_ORDER
|
---|
| 1516 | #ifndef SIZEOF_LONG
|
---|
| 1517 | #define SIZEOF_LONG 4
|
---|
| 1518 | #endif
|
---|
| 1519 | #ifndef SIZEOF_LONG_LONG
|
---|
| 1520 | #define SIZEOF_LONG_LONG 8
|
---|
| 1521 | #endif
|
---|
| 1522 | #endif
|
---|
| 1523 |
|
---|
| 1524 | #ifdef WOLFSSL_QL
|
---|
| 1525 | #ifndef WOLFSSL_SEP
|
---|
| 1526 | #define WOLFSSL_SEP
|
---|
| 1527 | #endif
|
---|
| 1528 | #ifndef OPENSSL_EXTRA
|
---|
| 1529 | #define OPENSSL_EXTRA
|
---|
| 1530 | #endif
|
---|
| 1531 | #ifndef SESSION_CERTS
|
---|
| 1532 | #define SESSION_CERTS
|
---|
| 1533 | #endif
|
---|
| 1534 | #ifndef HAVE_AESCCM
|
---|
| 1535 | #define HAVE_AESCCM
|
---|
| 1536 | #endif
|
---|
| 1537 | #ifndef ATOMIC_USER
|
---|
| 1538 | #define ATOMIC_USER
|
---|
| 1539 | #endif
|
---|
| 1540 | #ifndef WOLFSSL_DER_LOAD
|
---|
| 1541 | #define WOLFSSL_DER_LOAD
|
---|
| 1542 | #endif
|
---|
| 1543 | #ifndef KEEP_PEER_CERT
|
---|
| 1544 | #define KEEP_PEER_CERT
|
---|
| 1545 | #endif
|
---|
| 1546 | #ifndef HAVE_ECC
|
---|
| 1547 | #define HAVE_ECC
|
---|
| 1548 | #endif
|
---|
| 1549 | #ifndef SESSION_INDEX
|
---|
| 1550 | #define SESSION_INDEX
|
---|
| 1551 | #endif
|
---|
| 1552 | #endif /* WOLFSSL_QL */
|
---|
| 1553 |
|
---|
| 1554 |
|
---|
| 1555 | #if defined(WOLFSSL_XILINX)
|
---|
| 1556 | #define NO_WOLFSSL_DIR
|
---|
| 1557 | #define NO_DEV_RANDOM
|
---|
| 1558 | #define HAVE_AESGCM
|
---|
| 1559 | #endif
|
---|
| 1560 |
|
---|
| 1561 | #if defined(WOLFSSL_XILINX_CRYPT) || defined(WOLFSSL_AFALG_XILINX)
|
---|
| 1562 | #if defined(WOLFSSL_ARMASM)
|
---|
| 1563 | #error can not use both ARMv8 instructions and XILINX hardened crypto
|
---|
| 1564 | #endif
|
---|
| 1565 | #if defined(WOLFSSL_SHA3)
|
---|
| 1566 | /* only SHA3-384 is supported */
|
---|
| 1567 | #undef WOLFSSL_NOSHA3_224
|
---|
| 1568 | #undef WOLFSSL_NOSHA3_256
|
---|
| 1569 | #undef WOLFSSL_NOSHA3_512
|
---|
| 1570 | #define WOLFSSL_NOSHA3_224
|
---|
| 1571 | #define WOLFSSL_NOSHA3_256
|
---|
| 1572 | #define WOLFSSL_NOSHA3_512
|
---|
| 1573 | #endif
|
---|
| 1574 | #ifdef WOLFSSL_AFALG_XILINX_AES
|
---|
| 1575 | #undef WOLFSSL_AES_DIRECT
|
---|
| 1576 | #define WOLFSSL_AES_DIRECT
|
---|
| 1577 | #endif
|
---|
| 1578 | #endif /*(WOLFSSL_XILINX_CRYPT)*/
|
---|
| 1579 |
|
---|
| 1580 | #if defined(WOLFSSL_APACHE_MYNEWT)
|
---|
| 1581 | #include "os/os_malloc.h"
|
---|
| 1582 | #if !defined(WOLFSSL_LWIP)
|
---|
| 1583 | #include <mn_socket/mn_socket.h>
|
---|
| 1584 | #endif
|
---|
| 1585 |
|
---|
| 1586 | #if !defined(SIZEOF_LONG)
|
---|
| 1587 | #define SIZEOF_LONG 4
|
---|
| 1588 | #endif
|
---|
| 1589 | #if !defined(SIZEOF_LONG_LONG)
|
---|
| 1590 | #define SIZEOF_LONG_LONG 8
|
---|
| 1591 | #endif
|
---|
| 1592 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
---|
| 1593 | #define BIG_ENDIAN_ORDER
|
---|
| 1594 | #else
|
---|
| 1595 | #undef BIG_ENDIAN_ORDER
|
---|
| 1596 | #define LITTLE_ENDIAN_ORDER
|
---|
| 1597 | #endif
|
---|
| 1598 | #define NO_WRITEV
|
---|
| 1599 | #define WOLFSSL_USER_IO
|
---|
| 1600 | #define SINGLE_THREADED
|
---|
| 1601 | #define NO_DEV_RANDOM
|
---|
| 1602 | #define NO_DH
|
---|
| 1603 | #define NO_WOLFSSL_DIR
|
---|
| 1604 | #define NO_ERROR_STRINGS
|
---|
| 1605 | #define HAVE_ECC
|
---|
| 1606 | #define NO_SESSION_CACHE
|
---|
| 1607 | #define NO_ERROR_STRINGS
|
---|
| 1608 | #define XMALLOC_USER
|
---|
| 1609 | #define XMALLOC(sz, heap, type) os_malloc(sz)
|
---|
| 1610 | #define XREALLOC(p, sz, heap, type) os_realloc(p, sz)
|
---|
| 1611 | #define XFREE(p, heap, type) os_free(p)
|
---|
| 1612 |
|
---|
| 1613 | #endif /*(WOLFSSL_APACHE_MYNEWT)*/
|
---|
| 1614 |
|
---|
| 1615 | #ifdef WOLFSSL_ZEPHYR
|
---|
| 1616 | #include <zephyr.h>
|
---|
| 1617 | #include <misc/printk.h>
|
---|
| 1618 | #include <misc/util.h>
|
---|
| 1619 | #include <stdlib.h>
|
---|
| 1620 |
|
---|
| 1621 | #define WOLFSSL_DH_CONST
|
---|
| 1622 | #define WOLFSSL_HAVE_MIN
|
---|
| 1623 | #define WOLFSSL_HAVE_MAX
|
---|
| 1624 | #define NO_WRITEV
|
---|
| 1625 |
|
---|
| 1626 | #define USE_FLAT_BENCHMARK_H
|
---|
| 1627 | #define USE_FLAT_TEST_H
|
---|
| 1628 | #define EXIT_FAILURE 1
|
---|
| 1629 | #define MAIN_NO_ARGS
|
---|
| 1630 |
|
---|
| 1631 | void *z_realloc(void *ptr, size_t size);
|
---|
| 1632 | #define realloc z_realloc
|
---|
| 1633 |
|
---|
| 1634 | #define CONFIG_NET_SOCKETS_POSIX_NAMES
|
---|
| 1635 | #endif
|
---|
| 1636 |
|
---|
| 1637 | #ifdef WOLFSSL_IMX6
|
---|
| 1638 | #ifndef SIZEOF_LONG_LONG
|
---|
| 1639 | #define SIZEOF_LONG_LONG 8
|
---|
| 1640 | #endif
|
---|
| 1641 | #endif
|
---|
| 1642 |
|
---|
| 1643 | /* if defined turn on all CAAM support */
|
---|
| 1644 | #ifdef WOLFSSL_IMX6_CAAM
|
---|
| 1645 | #undef WOLFSSL_IMX6_CAAM_RNG
|
---|
| 1646 | #define WOLFSSL_IMX6_CAAM_RNG
|
---|
| 1647 |
|
---|
| 1648 | #undef WOLFSSL_IMX6_CAAM_BLOB
|
---|
| 1649 | #define WOLFSSL_IMX6_CAAM_BLOB
|
---|
| 1650 |
|
---|
| 1651 | #if defined(HAVE_AESGCM) || defined(WOLFSSL_AES_XTS)
|
---|
| 1652 | /* large performance gain with HAVE_AES_ECB defined */
|
---|
| 1653 | #undef HAVE_AES_ECB
|
---|
| 1654 | #define HAVE_AES_ECB
|
---|
| 1655 | #endif
|
---|
| 1656 | #endif
|
---|
| 1657 |
|
---|
[464] | 1658 | /* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */
|
---|
| 1659 | #if defined(WOLFSSL_IMXRT_DCP) && !defined(SINGLE_THREADED)
|
---|
| 1660 | #undef WOLFSSL_CRYPT_HW_MUTEX
|
---|
| 1661 | #define WOLFSSL_CRYPT_HW_MUTEX 1
|
---|
| 1662 | #endif
|
---|
| 1663 |
|
---|
[457] | 1664 | #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
---|
| 1665 | !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) && \
|
---|
| 1666 | !defined(XMALLOC_OVERRIDE)
|
---|
| 1667 | #define USE_WOLFSSL_MEMORY
|
---|
| 1668 | #endif
|
---|
| 1669 |
|
---|
| 1670 |
|
---|
| 1671 | #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
---|
| 1672 | #undef KEEP_PEER_CERT
|
---|
| 1673 | #define KEEP_PEER_CERT
|
---|
| 1674 | #endif
|
---|
| 1675 |
|
---|
| 1676 |
|
---|
| 1677 | /* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
---|
| 1678 | #ifndef XSTREAM_ALIGN
|
---|
| 1679 | #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
---|
| 1680 | #define NO_XSTREAM_ALIGN
|
---|
| 1681 | #else
|
---|
| 1682 | #define XSTREAM_ALIGN
|
---|
| 1683 | #endif
|
---|
| 1684 | #endif
|
---|
| 1685 |
|
---|
| 1686 | /* write dup cannot be used with secure renegotiation because write dup
|
---|
| 1687 | * make write side write only and read side read only */
|
---|
| 1688 | #if defined(HAVE_WRITE_DUP) && defined(HAVE_SECURE_RENEGOTIATION)
|
---|
| 1689 | #error "WRITE DUP and SECURE RENEGOTIATION cannot both be on"
|
---|
| 1690 | #endif
|
---|
| 1691 |
|
---|
| 1692 | #ifdef WOLFSSL_SGX
|
---|
| 1693 | #ifdef _MSC_VER
|
---|
| 1694 | #define NO_RC4
|
---|
| 1695 | #ifndef HAVE_FIPS
|
---|
| 1696 | #define WOLFCRYPT_ONLY
|
---|
| 1697 | #define NO_DES3
|
---|
| 1698 | #define NO_SHA
|
---|
| 1699 | #define NO_MD5
|
---|
| 1700 | #else
|
---|
| 1701 | #define TFM_TIMING_RESISTANT
|
---|
| 1702 | #define NO_WOLFSSL_DIR
|
---|
| 1703 | #define NO_WRITEV
|
---|
| 1704 | #define NO_MAIN_DRIVER
|
---|
| 1705 | #define WOLFSSL_LOG_PRINTF
|
---|
| 1706 | #define WOLFSSL_DH_CONST
|
---|
| 1707 | #endif
|
---|
| 1708 | #else
|
---|
| 1709 | #define HAVE_ECC
|
---|
| 1710 | #define NO_WRITEV
|
---|
| 1711 | #define NO_MAIN_DRIVER
|
---|
| 1712 | #define USER_TICKS
|
---|
| 1713 | #define WOLFSSL_LOG_PRINTF
|
---|
| 1714 | #define WOLFSSL_DH_CONST
|
---|
| 1715 | #endif /* _MSC_VER */
|
---|
| 1716 | #if !defined(HAVE_FIPS) && !defined(NO_RSA)
|
---|
| 1717 | #define WC_RSA_BLINDING
|
---|
| 1718 | #endif
|
---|
| 1719 |
|
---|
| 1720 | #define NO_FILESYSTEM
|
---|
| 1721 | #define ECC_TIMING_RESISTANT
|
---|
| 1722 | #define TFM_TIMING_RESISTANT
|
---|
| 1723 | #define SINGLE_THREADED
|
---|
| 1724 | #define NO_ASN_TIME /* can not use headers such as windows.h */
|
---|
| 1725 | #define HAVE_AESGCM
|
---|
| 1726 | #define USE_CERT_BUFFERS_2048
|
---|
| 1727 | #define USE_FAST_MATH
|
---|
| 1728 | #endif /* WOLFSSL_SGX */
|
---|
| 1729 |
|
---|
| 1730 | /* FreeScale MMCAU hardware crypto has 4 byte alignment.
|
---|
| 1731 | However, KSDK fsl_mmcau.h gives API with no alignment
|
---|
| 1732 | requirements (4 byte alignment is managed internally by fsl_mmcau.c) */
|
---|
| 1733 | #ifdef FREESCALE_MMCAU
|
---|
| 1734 | #ifdef FREESCALE_MMCAU_CLASSIC
|
---|
| 1735 | #define WOLFSSL_MMCAU_ALIGNMENT 4
|
---|
| 1736 | #else
|
---|
| 1737 | #define WOLFSSL_MMCAU_ALIGNMENT 0
|
---|
| 1738 | #endif
|
---|
| 1739 | #endif
|
---|
| 1740 |
|
---|
| 1741 | /* if using hardware crypto and have alignment requirements, specify the
|
---|
| 1742 | requirement here. The record header of SSL/TLS will prevent easy alignment.
|
---|
| 1743 | This hint tries to help as much as possible. */
|
---|
| 1744 | #ifndef WOLFSSL_GENERAL_ALIGNMENT
|
---|
| 1745 | #ifdef WOLFSSL_AESNI
|
---|
| 1746 | #define WOLFSSL_GENERAL_ALIGNMENT 16
|
---|
| 1747 | #elif defined(XSTREAM_ALIGN)
|
---|
| 1748 | #define WOLFSSL_GENERAL_ALIGNMENT 4
|
---|
| 1749 | #elif defined(FREESCALE_MMCAU) || defined(FREESCALE_MMCAU_CLASSIC)
|
---|
| 1750 | #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT
|
---|
| 1751 | #else
|
---|
| 1752 | #define WOLFSSL_GENERAL_ALIGNMENT 0
|
---|
| 1753 | #endif
|
---|
| 1754 | #endif
|
---|
| 1755 |
|
---|
| 1756 | #if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0)
|
---|
| 1757 | #if defined(_MSC_VER)
|
---|
| 1758 | #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT))
|
---|
| 1759 | #elif defined(__GNUC__)
|
---|
| 1760 | #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT)))
|
---|
| 1761 | #else
|
---|
| 1762 | #define XGEN_ALIGN
|
---|
| 1763 | #endif
|
---|
| 1764 | #else
|
---|
| 1765 | #define XGEN_ALIGN
|
---|
| 1766 | #endif
|
---|
| 1767 |
|
---|
| 1768 |
|
---|
| 1769 | #ifdef __INTEL_COMPILER
|
---|
| 1770 | #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */
|
---|
| 1771 | #endif
|
---|
| 1772 |
|
---|
| 1773 | /* user can specify what curves they want with ECC_USER_CURVES otherwise
|
---|
| 1774 | * all curves are on by default for now */
|
---|
| 1775 | #ifndef ECC_USER_CURVES
|
---|
| 1776 | #if !defined(WOLFSSL_SP_MATH) && !defined(HAVE_ALL_CURVES)
|
---|
| 1777 | #define HAVE_ALL_CURVES
|
---|
| 1778 | #endif
|
---|
| 1779 | #endif
|
---|
| 1780 |
|
---|
[464] | 1781 | /* The minimum allowed ECC key size */
|
---|
| 1782 | /* Note: 224-bits is equivelant to 2048-bit RSA */
|
---|
| 1783 | #ifndef ECC_MIN_KEY_SZ
|
---|
| 1784 | #ifdef WOLFSSL_MIN_ECC_BITS
|
---|
| 1785 | #define ECC_MIN_KEY_SZ WOLFSSL_MIN_ECC_BITS
|
---|
| 1786 | #else
|
---|
| 1787 | #if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 2
|
---|
| 1788 | /* FIPSv2 and ready (for now) includes 192-bit support */
|
---|
| 1789 | #define ECC_MIN_KEY_SZ 192
|
---|
| 1790 | #else
|
---|
| 1791 | #define ECC_MIN_KEY_SZ 224
|
---|
| 1792 | #endif
|
---|
| 1793 | #endif
|
---|
| 1794 | #endif
|
---|
| 1795 |
|
---|
[457] | 1796 | /* ECC Configs */
|
---|
| 1797 | #ifdef HAVE_ECC
|
---|
| 1798 | /* By default enable Sign, Verify, DHE, Key Import and Key Export unless explicitly disabled */
|
---|
| 1799 | #ifndef NO_ECC_SIGN
|
---|
| 1800 | #undef HAVE_ECC_SIGN
|
---|
| 1801 | #define HAVE_ECC_SIGN
|
---|
| 1802 | #endif
|
---|
| 1803 | #ifndef NO_ECC_VERIFY
|
---|
| 1804 | #undef HAVE_ECC_VERIFY
|
---|
| 1805 | #define HAVE_ECC_VERIFY
|
---|
| 1806 | #endif
|
---|
| 1807 | #ifndef NO_ECC_CHECK_KEY
|
---|
| 1808 | #undef HAVE_ECC_CHECK_KEY
|
---|
| 1809 | #define HAVE_ECC_CHECK_KEY
|
---|
| 1810 | #endif
|
---|
| 1811 | #ifndef NO_ECC_DHE
|
---|
| 1812 | #undef HAVE_ECC_DHE
|
---|
| 1813 | #define HAVE_ECC_DHE
|
---|
| 1814 | #endif
|
---|
| 1815 | #ifndef NO_ECC_KEY_IMPORT
|
---|
| 1816 | #undef HAVE_ECC_KEY_IMPORT
|
---|
| 1817 | #define HAVE_ECC_KEY_IMPORT
|
---|
| 1818 | #endif
|
---|
| 1819 | #ifndef NO_ECC_KEY_EXPORT
|
---|
| 1820 | #undef HAVE_ECC_KEY_EXPORT
|
---|
| 1821 | #define HAVE_ECC_KEY_EXPORT
|
---|
| 1822 | #endif
|
---|
| 1823 | #endif /* HAVE_ECC */
|
---|
| 1824 |
|
---|
| 1825 | /* Curve25519 Configs */
|
---|
| 1826 | #ifdef HAVE_CURVE25519
|
---|
| 1827 | /* By default enable shared secret, key export and import */
|
---|
| 1828 | #ifndef NO_CURVE25519_SHARED_SECRET
|
---|
| 1829 | #undef HAVE_CURVE25519_SHARED_SECRET
|
---|
| 1830 | #define HAVE_CURVE25519_SHARED_SECRET
|
---|
| 1831 | #endif
|
---|
| 1832 | #ifndef NO_CURVE25519_KEY_EXPORT
|
---|
| 1833 | #undef HAVE_CURVE25519_KEY_EXPORT
|
---|
| 1834 | #define HAVE_CURVE25519_KEY_EXPORT
|
---|
| 1835 | #endif
|
---|
| 1836 | #ifndef NO_CURVE25519_KEY_IMPORT
|
---|
| 1837 | #undef HAVE_CURVE25519_KEY_IMPORT
|
---|
| 1838 | #define HAVE_CURVE25519_KEY_IMPORT
|
---|
| 1839 | #endif
|
---|
| 1840 | #endif /* HAVE_CURVE25519 */
|
---|
| 1841 |
|
---|
| 1842 | /* Ed25519 Configs */
|
---|
| 1843 | #ifdef HAVE_ED25519
|
---|
| 1844 | /* By default enable sign, verify, key export and import */
|
---|
| 1845 | #ifndef NO_ED25519_SIGN
|
---|
| 1846 | #undef HAVE_ED25519_SIGN
|
---|
| 1847 | #define HAVE_ED25519_SIGN
|
---|
| 1848 | #endif
|
---|
| 1849 | #ifndef NO_ED25519_VERIFY
|
---|
| 1850 | #undef HAVE_ED25519_VERIFY
|
---|
| 1851 | #define HAVE_ED25519_VERIFY
|
---|
| 1852 | #endif
|
---|
| 1853 | #ifndef NO_ED25519_KEY_EXPORT
|
---|
| 1854 | #undef HAVE_ED25519_KEY_EXPORT
|
---|
| 1855 | #define HAVE_ED25519_KEY_EXPORT
|
---|
| 1856 | #endif
|
---|
| 1857 | #ifndef NO_ED25519_KEY_IMPORT
|
---|
| 1858 | #undef HAVE_ED25519_KEY_IMPORT
|
---|
| 1859 | #define HAVE_ED25519_KEY_IMPORT
|
---|
| 1860 | #endif
|
---|
| 1861 | #endif /* HAVE_ED25519 */
|
---|
| 1862 |
|
---|
| 1863 | /* Curve448 Configs */
|
---|
| 1864 | #ifdef HAVE_CURVE448
|
---|
| 1865 | /* By default enable shared secret, key export and import */
|
---|
| 1866 | #ifndef NO_CURVE448_SHARED_SECRET
|
---|
| 1867 | #undef HAVE_CURVE448_SHARED_SECRET
|
---|
| 1868 | #define HAVE_CURVE448_SHARED_SECRET
|
---|
| 1869 | #endif
|
---|
| 1870 | #ifndef NO_CURVE448_KEY_EXPORT
|
---|
| 1871 | #undef HAVE_CURVE448_KEY_EXPORT
|
---|
| 1872 | #define HAVE_CURVE448_KEY_EXPORT
|
---|
| 1873 | #endif
|
---|
| 1874 | #ifndef NO_CURVE448_KEY_IMPORT
|
---|
| 1875 | #undef HAVE_CURVE448_KEY_IMPORT
|
---|
| 1876 | #define HAVE_CURVE448_KEY_IMPORT
|
---|
| 1877 | #endif
|
---|
| 1878 | #endif /* HAVE_CURVE448 */
|
---|
| 1879 |
|
---|
| 1880 | /* Ed448 Configs */
|
---|
| 1881 | #ifdef HAVE_ED448
|
---|
| 1882 | /* By default enable sign, verify, key export and import */
|
---|
| 1883 | #ifndef NO_ED448_SIGN
|
---|
| 1884 | #undef HAVE_ED448_SIGN
|
---|
| 1885 | #define HAVE_ED448_SIGN
|
---|
| 1886 | #endif
|
---|
| 1887 | #ifndef NO_ED448_VERIFY
|
---|
| 1888 | #undef HAVE_ED448_VERIFY
|
---|
| 1889 | #define HAVE_ED448_VERIFY
|
---|
| 1890 | #endif
|
---|
| 1891 | #ifndef NO_ED448_KEY_EXPORT
|
---|
| 1892 | #undef HAVE_ED448_KEY_EXPORT
|
---|
| 1893 | #define HAVE_ED448_KEY_EXPORT
|
---|
| 1894 | #endif
|
---|
| 1895 | #ifndef NO_ED448_KEY_IMPORT
|
---|
| 1896 | #undef HAVE_ED448_KEY_IMPORT
|
---|
| 1897 | #define HAVE_ED448_KEY_IMPORT
|
---|
| 1898 | #endif
|
---|
| 1899 | #endif /* HAVE_ED448 */
|
---|
| 1900 |
|
---|
| 1901 | /* AES Config */
|
---|
| 1902 | #ifndef NO_AES
|
---|
| 1903 | /* By default enable all AES key sizes, decryption and CBC */
|
---|
| 1904 | #ifndef AES_MAX_KEY_SIZE
|
---|
| 1905 | #undef AES_MAX_KEY_SIZE
|
---|
| 1906 | #define AES_MAX_KEY_SIZE 256
|
---|
| 1907 | #endif
|
---|
| 1908 |
|
---|
| 1909 | #ifndef NO_AES_128
|
---|
| 1910 | #undef WOLFSSL_AES_128
|
---|
| 1911 | #define WOLFSSL_AES_128
|
---|
| 1912 | #endif
|
---|
| 1913 | #if !defined(NO_AES_192) && AES_MAX_KEY_SIZE >= 192
|
---|
| 1914 | #undef WOLFSSL_AES_192
|
---|
| 1915 | #define WOLFSSL_AES_192
|
---|
| 1916 | #endif
|
---|
| 1917 | #if !defined(NO_AES_256) && AES_MAX_KEY_SIZE >= 256
|
---|
| 1918 | #undef WOLFSSL_AES_256
|
---|
| 1919 | #define WOLFSSL_AES_256
|
---|
| 1920 | #endif
|
---|
| 1921 | #if !defined(WOLFSSL_AES_128) && defined(HAVE_ECC_ENCRYPT)
|
---|
| 1922 | #warning HAVE_ECC_ENCRYPT uses AES 128 bit keys
|
---|
| 1923 | #endif
|
---|
| 1924 |
|
---|
| 1925 | #ifndef NO_AES_DECRYPT
|
---|
| 1926 | #undef HAVE_AES_DECRYPT
|
---|
| 1927 | #define HAVE_AES_DECRYPT
|
---|
| 1928 | #endif
|
---|
| 1929 | #ifndef NO_AES_CBC
|
---|
| 1930 | #undef HAVE_AES_CBC
|
---|
| 1931 | #define HAVE_AES_CBC
|
---|
| 1932 | #endif
|
---|
| 1933 | #ifdef WOLFSSL_AES_XTS
|
---|
| 1934 | /* AES-XTS makes calls to AES direct functions */
|
---|
| 1935 | #ifndef WOLFSSL_AES_DIRECT
|
---|
| 1936 | #define WOLFSSL_AES_DIRECT
|
---|
| 1937 | #endif
|
---|
| 1938 | #endif
|
---|
| 1939 | #ifdef WOLFSSL_AES_CFB
|
---|
| 1940 | /* AES-CFB makes calls to AES direct functions */
|
---|
| 1941 | #ifndef WOLFSSL_AES_DIRECT
|
---|
| 1942 | #define WOLFSSL_AES_DIRECT
|
---|
| 1943 | #endif
|
---|
| 1944 | #endif
|
---|
| 1945 | #endif
|
---|
| 1946 |
|
---|
| 1947 | #if (defined(WOLFSSL_TLS13) && defined(WOLFSSL_NO_TLS12)) || \
|
---|
| 1948 | (!defined(HAVE_AES_CBC) && defined(NO_DES3) && defined(NO_RC4) && \
|
---|
| 1949 | !defined(HAVE_CAMELLIA) && !defined(HAVE_IDEA) && \
|
---|
| 1950 | !defined(HAVE_NULL_CIPHER) && !defined(HAVE_HC128))
|
---|
| 1951 | #define WOLFSSL_AEAD_ONLY
|
---|
| 1952 | #endif
|
---|
| 1953 |
|
---|
| 1954 | #if !defined(NO_DH) && !defined(HAVE_FFDHE)
|
---|
| 1955 | #if defined(HAVE_FFDHE_2048) || defined(HAVE_FFDHE_3072) || \
|
---|
| 1956 | defined(HAVE_FFDHE_4096) || defined(HAVE_FFDHE_6144) || \
|
---|
| 1957 | defined(HAVE_FFDHE_8192)
|
---|
| 1958 | #define HAVE_FFDHE
|
---|
| 1959 | #endif
|
---|
| 1960 | #endif
|
---|
| 1961 | #if defined(HAVE_FFDHE_8192)
|
---|
| 1962 | #define MIN_FFDHE_FP_MAX_BITS 16384
|
---|
| 1963 | #elif defined(HAVE_FFDHE_6144)
|
---|
| 1964 | #define MIN_FFDHE_FP_MAX_BITS 12288
|
---|
| 1965 | #elif defined(HAVE_FFDHE_4096)
|
---|
| 1966 | #define MIN_FFDHE_FP_MAX_BITS 8192
|
---|
| 1967 | #elif defined(HAVE_FFDHE_3072)
|
---|
| 1968 | #define MIN_FFDHE_FP_MAX_BITS 6144
|
---|
| 1969 | #elif defined(HAVE_FFDHE_2048)
|
---|
| 1970 | #define MIN_FFDHE_FP_MAX_BITS 4096
|
---|
| 1971 | #else
|
---|
| 1972 | #define MIN_FFDHE_FP_MAX_BITS 0
|
---|
| 1973 | #endif
|
---|
| 1974 | #if defined(HAVE_FFDHE) && defined(FP_MAX_BITS)
|
---|
| 1975 | #if MIN_FFDHE_FP_MAX_BITS > FP_MAX_BITS
|
---|
| 1976 | #error "FFDHE parameters are too large for FP_MAX_BIT as set"
|
---|
| 1977 | #endif
|
---|
| 1978 | #endif
|
---|
[464] | 1979 | #if defined(HAVE_FFDHE) && defined(SP_INT_BITS)
|
---|
| 1980 | #if MIN_FFDHE_FP_MAX_BITS > SP_INT_BITS * 2
|
---|
| 1981 | #error "FFDHE parameters are too large for SP_INT_BIT as set"
|
---|
| 1982 | #endif
|
---|
| 1983 | #endif
|
---|
[457] | 1984 |
|
---|
| 1985 | /* if desktop type system and fastmath increase default max bits */
|
---|
[464] | 1986 | #if defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)
|
---|
[457] | 1987 | #if defined(USE_FAST_MATH) && !defined(FP_MAX_BITS)
|
---|
| 1988 | #if MIN_FFDHE_FP_MAX_BITS <= 8192
|
---|
| 1989 | #define FP_MAX_BITS 8192
|
---|
| 1990 | #else
|
---|
| 1991 | #define FP_MAX_BITS MIN_FFDHE_FP_MAX_BITS
|
---|
| 1992 | #endif
|
---|
| 1993 | #endif
|
---|
[464] | 1994 | #if defined(WOLFSSL_SP_MATH_ALL) && !defined(SP_INT_BITS)
|
---|
| 1995 | #if MIN_FFDHE_FP_MAX_BITS <= 8192
|
---|
| 1996 | #define SP_INT_BITS 4096
|
---|
| 1997 | #else
|
---|
| 1998 | #define PS_INT_BITS MIN_FFDHE_FP_MAX_BITS / 2
|
---|
| 1999 | #endif
|
---|
| 2000 | #endif
|
---|
[457] | 2001 | #endif
|
---|
| 2002 |
|
---|
| 2003 | /* If using the max strength build, ensure OLD TLS is disabled. */
|
---|
| 2004 | #ifdef WOLFSSL_MAX_STRENGTH
|
---|
| 2005 | #undef NO_OLD_TLS
|
---|
| 2006 | #define NO_OLD_TLS
|
---|
| 2007 | #endif
|
---|
| 2008 |
|
---|
| 2009 |
|
---|
| 2010 | /* Default AES minimum auth tag sz, allow user to override */
|
---|
| 2011 | #ifndef WOLFSSL_MIN_AUTH_TAG_SZ
|
---|
| 2012 | #define WOLFSSL_MIN_AUTH_TAG_SZ 12
|
---|
| 2013 | #endif
|
---|
| 2014 |
|
---|
| 2015 |
|
---|
| 2016 | /* sniffer requires:
|
---|
| 2017 | * static RSA cipher suites
|
---|
| 2018 | * session stats and peak stats
|
---|
| 2019 | */
|
---|
| 2020 | #ifdef WOLFSSL_SNIFFER
|
---|
| 2021 | #ifndef WOLFSSL_STATIC_RSA
|
---|
| 2022 | #define WOLFSSL_STATIC_RSA
|
---|
| 2023 | #endif
|
---|
| 2024 | #ifndef WOLFSSL_STATIC_DH
|
---|
| 2025 | #define WOLFSSL_STATIC_DH
|
---|
| 2026 | #endif
|
---|
| 2027 | /* Allow option to be disabled. */
|
---|
| 2028 | #ifndef WOLFSSL_NO_SESSION_STATS
|
---|
| 2029 | #ifndef WOLFSSL_SESSION_STATS
|
---|
| 2030 | #define WOLFSSL_SESSION_STATS
|
---|
| 2031 | #endif
|
---|
| 2032 | #ifndef WOLFSSL_PEAK_SESSIONS
|
---|
| 2033 | #define WOLFSSL_PEAK_SESSIONS
|
---|
| 2034 | #endif
|
---|
| 2035 | #endif
|
---|
| 2036 | #endif
|
---|
| 2037 |
|
---|
| 2038 | /* Decode Public Key extras on by default, user can turn off with
|
---|
| 2039 | * WOLFSSL_NO_DECODE_EXTRA */
|
---|
| 2040 | #ifndef WOLFSSL_NO_DECODE_EXTRA
|
---|
| 2041 | #ifndef RSA_DECODE_EXTRA
|
---|
| 2042 | #define RSA_DECODE_EXTRA
|
---|
| 2043 | #endif
|
---|
| 2044 | #ifndef ECC_DECODE_EXTRA
|
---|
| 2045 | #define ECC_DECODE_EXTRA
|
---|
| 2046 | #endif
|
---|
| 2047 | #endif
|
---|
| 2048 |
|
---|
| 2049 | /* C Sharp wrapper defines */
|
---|
| 2050 | #ifdef HAVE_CSHARP
|
---|
| 2051 | #ifndef WOLFSSL_DTLS
|
---|
| 2052 | #define WOLFSSL_DTLS
|
---|
| 2053 | #endif
|
---|
| 2054 | #undef NO_PSK
|
---|
| 2055 | #undef NO_SHA256
|
---|
| 2056 | #undef NO_DH
|
---|
| 2057 | #endif
|
---|
| 2058 |
|
---|
| 2059 | /* Asynchronous Crypto */
|
---|
| 2060 | #ifdef WOLFSSL_ASYNC_CRYPT
|
---|
| 2061 | /* Make sure wolf events are enabled */
|
---|
| 2062 | #undef HAVE_WOLF_EVENT
|
---|
| 2063 | #define HAVE_WOLF_EVENT
|
---|
| 2064 |
|
---|
| 2065 | #ifdef WOLFSSL_ASYNC_CRYPT_TEST
|
---|
| 2066 | #define WC_ASYNC_DEV_SIZE 168
|
---|
| 2067 | #else
|
---|
| 2068 | #define WC_ASYNC_DEV_SIZE 336
|
---|
| 2069 | #endif
|
---|
| 2070 |
|
---|
| 2071 | #if !defined(HAVE_CAVIUM) && !defined(HAVE_INTEL_QA) && \
|
---|
| 2072 | !defined(WOLFSSL_ASYNC_CRYPT_TEST)
|
---|
| 2073 | #error No async hardware defined with WOLFSSL_ASYNC_CRYPT!
|
---|
| 2074 | #endif
|
---|
| 2075 |
|
---|
| 2076 | /* Enable ECC_CACHE_CURVE for ASYNC */
|
---|
| 2077 | #if !defined(ECC_CACHE_CURVE)
|
---|
| 2078 | #define ECC_CACHE_CURVE
|
---|
| 2079 | #endif
|
---|
| 2080 | #endif /* WOLFSSL_ASYNC_CRYPT */
|
---|
| 2081 | #ifndef WC_ASYNC_DEV_SIZE
|
---|
| 2082 | #define WC_ASYNC_DEV_SIZE 0
|
---|
| 2083 | #endif
|
---|
| 2084 |
|
---|
| 2085 | /* leantls checks */
|
---|
| 2086 | #ifdef WOLFSSL_LEANTLS
|
---|
| 2087 | #ifndef HAVE_ECC
|
---|
| 2088 | #error leantls build needs ECC
|
---|
| 2089 | #endif
|
---|
| 2090 | #endif /* WOLFSSL_LEANTLS*/
|
---|
| 2091 |
|
---|
| 2092 | /* restriction with static memory */
|
---|
| 2093 | #ifdef WOLFSSL_STATIC_MEMORY
|
---|
| 2094 | #if defined(HAVE_IO_POOL) || defined(XMALLOC_USER) || defined(NO_WOLFSSL_MEMORY)
|
---|
| 2095 | #error static memory cannot be used with HAVE_IO_POOL, XMALLOC_USER or NO_WOLFSSL_MEMORY
|
---|
| 2096 | #endif
|
---|
| 2097 | #if !defined(USE_FAST_MATH) && !defined(NO_BIG_INT)
|
---|
| 2098 | #error static memory requires fast math please define USE_FAST_MATH
|
---|
| 2099 | #endif
|
---|
| 2100 | #ifdef WOLFSSL_SMALL_STACK
|
---|
| 2101 | #error static memory does not support small stack please undefine
|
---|
| 2102 | #endif
|
---|
| 2103 | #endif /* WOLFSSL_STATIC_MEMORY */
|
---|
| 2104 |
|
---|
| 2105 | #ifdef HAVE_AES_KEYWRAP
|
---|
| 2106 | #ifndef WOLFSSL_AES_DIRECT
|
---|
| 2107 | #error AES key wrap requires AES direct please define WOLFSSL_AES_DIRECT
|
---|
| 2108 | #endif
|
---|
| 2109 | #endif
|
---|
| 2110 |
|
---|
| 2111 | #ifdef HAVE_PKCS7
|
---|
| 2112 | #if defined(NO_AES) && defined(NO_DES3)
|
---|
| 2113 | #error PKCS7 needs either AES or 3DES enabled, please enable one
|
---|
| 2114 | #endif
|
---|
| 2115 | #ifndef HAVE_AES_KEYWRAP
|
---|
| 2116 | #error PKCS7 requires AES key wrap please define HAVE_AES_KEYWRAP
|
---|
| 2117 | #endif
|
---|
| 2118 | #if defined(HAVE_ECC) && !defined(HAVE_X963_KDF)
|
---|
| 2119 | #error PKCS7 requires X963 KDF please define HAVE_X963_KDF
|
---|
| 2120 | #endif
|
---|
| 2121 | #endif
|
---|
| 2122 |
|
---|
| 2123 | #ifndef NO_PKCS12
|
---|
| 2124 | #undef HAVE_PKCS12
|
---|
| 2125 | #define HAVE_PKCS12
|
---|
| 2126 | #endif
|
---|
| 2127 |
|
---|
| 2128 | #ifndef NO_PKCS8
|
---|
| 2129 | #undef HAVE_PKCS8
|
---|
| 2130 | #define HAVE_PKCS8
|
---|
| 2131 | #endif
|
---|
| 2132 |
|
---|
| 2133 | #if !defined(NO_PBKDF1) || defined(WOLFSSL_ENCRYPTED_KEYS) || defined(HAVE_PKCS8) || defined(HAVE_PKCS12)
|
---|
| 2134 | #undef HAVE_PBKDF1
|
---|
| 2135 | #define HAVE_PBKDF1
|
---|
| 2136 | #endif
|
---|
| 2137 |
|
---|
| 2138 | #if !defined(NO_PBKDF2) || defined(HAVE_PKCS7) || defined(HAVE_SCRYPT)
|
---|
| 2139 | #undef HAVE_PBKDF2
|
---|
| 2140 | #define HAVE_PBKDF2
|
---|
| 2141 | #endif
|
---|
| 2142 |
|
---|
| 2143 |
|
---|
| 2144 | #if !defined(WOLFCRYPT_ONLY) && !defined(NO_OLD_TLS) && \
|
---|
| 2145 | (defined(NO_SHA) || defined(NO_MD5))
|
---|
| 2146 | #error old TLS requires MD5 and SHA
|
---|
| 2147 | #endif
|
---|
| 2148 |
|
---|
| 2149 | /* for backwards compatibility */
|
---|
| 2150 | #if defined(TEST_IPV6) && !defined(WOLFSSL_IPV6)
|
---|
| 2151 | #define WOLFSSL_IPV6
|
---|
| 2152 | #endif
|
---|
| 2153 |
|
---|
| 2154 |
|
---|
[464] | 2155 | #ifdef WOLFSSL_LINUXKM
|
---|
| 2156 | #ifndef NO_DEV_RANDOM
|
---|
| 2157 | #define NO_DEV_RANDOM
|
---|
| 2158 | #endif
|
---|
| 2159 | #ifndef NO_WRITEV
|
---|
| 2160 | #define NO_WRITEV
|
---|
| 2161 | #endif
|
---|
| 2162 | #ifndef NO_FILESYSTEM
|
---|
| 2163 | #define NO_FILESYSTEM
|
---|
| 2164 | #endif
|
---|
| 2165 | #ifndef NO_STDIO_FILESYSTEM
|
---|
| 2166 | #define NO_STDIO_FILESYSTEM
|
---|
| 2167 | #endif
|
---|
| 2168 | #ifndef WOLFSSL_NO_SOCK
|
---|
| 2169 | #define WOLFSSL_NO_SOCK
|
---|
| 2170 | #endif
|
---|
| 2171 | #ifndef WOLFSSL_DH_CONST
|
---|
| 2172 | #define WOLFSSL_DH_CONST
|
---|
| 2173 | #endif
|
---|
| 2174 | #ifndef WOLFSSL_USER_IO
|
---|
| 2175 | #define WOLFSSL_USER_IO
|
---|
| 2176 | #endif
|
---|
| 2177 | #ifndef USE_WOLF_STRTOK
|
---|
| 2178 | #define USE_WOLF_STRTOK
|
---|
| 2179 | #endif
|
---|
| 2180 | #ifndef WOLFSSL_SP_DIV_WORD_HALF
|
---|
| 2181 | #define WOLFSSL_SP_DIV_WORD_HALF
|
---|
| 2182 | #endif
|
---|
| 2183 | #ifndef WOLFSSL_OLD_PRIME_CHECK
|
---|
| 2184 | #define WOLFSSL_OLD_PRIME_CHECK
|
---|
| 2185 | #endif
|
---|
| 2186 | #ifndef WOLFSSL_TEST_SUBROUTINE
|
---|
| 2187 | #define WOLFSSL_TEST_SUBROUTINE static
|
---|
| 2188 | #endif
|
---|
| 2189 | #undef HAVE_STRINGS_H
|
---|
| 2190 | #undef HAVE_ERRNO_H
|
---|
| 2191 | #undef HAVE_THREAD_LS
|
---|
| 2192 | #undef WOLFSSL_HAVE_MIN
|
---|
| 2193 | #undef WOLFSSL_HAVE_MAX
|
---|
| 2194 | #define SIZEOF_LONG 8
|
---|
| 2195 | #define SIZEOF_LONG_LONG 8
|
---|
| 2196 | #define CHAR_BIT 8
|
---|
| 2197 | #ifndef WOLFSSL_SP_DIV_64
|
---|
| 2198 | #define WOLFSSL_SP_DIV_64
|
---|
| 2199 | #endif
|
---|
| 2200 | #ifndef WOLFSSL_SP_DIV_WORD_HALF
|
---|
| 2201 | #define WOLFSSL_SP_DIV_WORD_HALF
|
---|
| 2202 | #endif
|
---|
| 2203 | #endif
|
---|
| 2204 |
|
---|
| 2205 |
|
---|
[457] | 2206 | /* Place any other flags or defines here */
|
---|
| 2207 |
|
---|
| 2208 | #if defined(WOLFSSL_MYSQL_COMPATIBLE) && defined(_WIN32) \
|
---|
| 2209 | && defined(HAVE_GMTIME_R)
|
---|
| 2210 | #undef HAVE_GMTIME_R /* don't trust macro with windows */
|
---|
| 2211 | #endif /* WOLFSSL_MYSQL_COMPATIBLE */
|
---|
| 2212 |
|
---|
[464] | 2213 | #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) \
|
---|
| 2214 | || defined(HAVE_LIGHTY)
|
---|
[457] | 2215 | #define SSL_OP_NO_COMPRESSION SSL_OP_NO_COMPRESSION
|
---|
| 2216 | #define OPENSSL_NO_ENGINE
|
---|
| 2217 | #define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT
|
---|
| 2218 | #ifndef OPENSSL_EXTRA
|
---|
| 2219 | #define OPENSSL_EXTRA
|
---|
| 2220 | #endif
|
---|
| 2221 | #ifndef HAVE_SESSION_TICKET
|
---|
| 2222 | #define HAVE_SESSION_TICKET
|
---|
| 2223 | #endif
|
---|
| 2224 | #ifndef HAVE_OCSP
|
---|
| 2225 | #define HAVE_OCSP
|
---|
| 2226 | #endif
|
---|
| 2227 | #ifndef KEEP_OUR_CERT
|
---|
| 2228 | #define KEEP_OUR_CERT
|
---|
| 2229 | #endif
|
---|
| 2230 | #ifndef HAVE_SNI
|
---|
| 2231 | #define HAVE_SNI
|
---|
| 2232 | #endif
|
---|
| 2233 | #endif
|
---|
| 2234 |
|
---|
[464] | 2235 | #ifdef HAVE_SNI
|
---|
[457] | 2236 | #define SSL_CTRL_SET_TLSEXT_HOSTNAME 55
|
---|
| 2237 | #endif
|
---|
| 2238 |
|
---|
| 2239 |
|
---|
| 2240 | /* both CURVE and ED small math should be enabled */
|
---|
| 2241 | #ifdef CURVED25519_SMALL
|
---|
| 2242 | #define CURVE25519_SMALL
|
---|
| 2243 | #define ED25519_SMALL
|
---|
| 2244 | #endif
|
---|
| 2245 |
|
---|
| 2246 | /* both CURVE and ED small math should be enabled */
|
---|
| 2247 | #ifdef CURVED448_SMALL
|
---|
| 2248 | #define CURVE448_SMALL
|
---|
| 2249 | #define ED448_SMALL
|
---|
| 2250 | #endif
|
---|
| 2251 |
|
---|
| 2252 |
|
---|
| 2253 | #ifndef WOLFSSL_ALERT_COUNT_MAX
|
---|
| 2254 | #define WOLFSSL_ALERT_COUNT_MAX 5
|
---|
| 2255 | #endif
|
---|
| 2256 |
|
---|
| 2257 | /* warning for not using harden build options (default with ./configure) */
|
---|
| 2258 | #ifndef WC_NO_HARDEN
|
---|
| 2259 | #if (defined(USE_FAST_MATH) && !defined(TFM_TIMING_RESISTANT)) || \
|
---|
| 2260 | (defined(HAVE_ECC) && !defined(ECC_TIMING_RESISTANT)) || \
|
---|
| 2261 | (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS) && \
|
---|
| 2262 | !defined(WC_NO_RNG))
|
---|
| 2263 |
|
---|
| 2264 | #ifndef _MSC_VER
|
---|
| 2265 | #warning "For timing resistance / side-channel attack prevention consider using harden options"
|
---|
| 2266 | #else
|
---|
| 2267 | #pragma message("Warning: For timing resistance / side-channel attack prevention consider using harden options")
|
---|
| 2268 | #endif
|
---|
| 2269 | #endif
|
---|
| 2270 | #endif
|
---|
| 2271 |
|
---|
| 2272 | #if defined(NO_OLD_WC_NAMES) || defined(OPENSSL_EXTRA)
|
---|
| 2273 | /* added to have compatibility with SHA256() */
|
---|
| 2274 | #if !defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS)
|
---|
| 2275 | #define NO_OLD_SHA_NAMES
|
---|
| 2276 | #endif
|
---|
| 2277 | #endif
|
---|
| 2278 |
|
---|
| 2279 | /* switch for compatibility layer functionality. Has subparts i.e. BIO/X509
|
---|
| 2280 | * When opensslextra is enabled all subparts should be turned on. */
|
---|
| 2281 | #ifdef OPENSSL_EXTRA
|
---|
| 2282 | #undef OPENSSL_EXTRA_X509_SMALL
|
---|
| 2283 | #define OPENSSL_EXTRA_X509_SMALL
|
---|
| 2284 | #endif /* OPENSSL_EXTRA */
|
---|
| 2285 |
|
---|
| 2286 | /* support for converting DER to PEM */
|
---|
| 2287 | #if (defined(WOLFSSL_KEY_GEN) && !defined(WOLFSSL_NO_DER_TO_PEM)) || \
|
---|
| 2288 | defined(WOLFSSL_CERT_GEN) || defined(OPENSSL_EXTRA)
|
---|
| 2289 | #undef WOLFSSL_DER_TO_PEM
|
---|
| 2290 | #define WOLFSSL_DER_TO_PEM
|
---|
| 2291 | #endif
|
---|
| 2292 |
|
---|
| 2293 | /* keep backwards compatibility enabling encrypted private key */
|
---|
| 2294 | #ifndef WOLFSSL_ENCRYPTED_KEYS
|
---|
| 2295 | #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \
|
---|
| 2296 | defined(HAVE_WEBSERVER)
|
---|
| 2297 | #define WOLFSSL_ENCRYPTED_KEYS
|
---|
| 2298 | #endif
|
---|
| 2299 | #endif
|
---|
| 2300 |
|
---|
| 2301 | /* support for disabling PEM to DER */
|
---|
| 2302 | #if !defined(WOLFSSL_NO_PEM)
|
---|
| 2303 | #undef WOLFSSL_PEM_TO_DER
|
---|
| 2304 | #define WOLFSSL_PEM_TO_DER
|
---|
| 2305 | #endif
|
---|
| 2306 |
|
---|
| 2307 | /* Parts of the openssl compatibility layer require peer certs */
|
---|
[464] | 2308 | #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) \
|
---|
| 2309 | || defined(HAVE_LIGHTY)
|
---|
[457] | 2310 | #undef KEEP_PEER_CERT
|
---|
| 2311 | #define KEEP_PEER_CERT
|
---|
| 2312 | #endif
|
---|
| 2313 |
|
---|
[464] | 2314 | /* RAW hash function APIs are not implemented */
|
---|
| 2315 | #if defined(WOLFSSL_ARMASM) || defined(WOLFSSL_AFALG_HASH)
|
---|
[457] | 2316 | #undef WOLFSSL_NO_HASH_RAW
|
---|
| 2317 | #define WOLFSSL_NO_HASH_RAW
|
---|
| 2318 | #endif
|
---|
| 2319 |
|
---|
[464] | 2320 | /* XChacha not implemented with ARM assembly ChaCha */
|
---|
| 2321 | #if defined(WOLFSSL_ARMASM)
|
---|
| 2322 | #undef HAVE_XCHACHA
|
---|
| 2323 | #endif
|
---|
| 2324 |
|
---|
[457] | 2325 | #if !defined(WOLFSSL_SHA384) && !defined(WOLFSSL_SHA512) && defined(NO_AES) && \
|
---|
| 2326 | !defined(WOLFSSL_SHA3)
|
---|
| 2327 | #undef WOLFSSL_NO_WORD64_OPS
|
---|
| 2328 | #define WOLFSSL_NO_WORD64_OPS
|
---|
| 2329 | #endif
|
---|
| 2330 |
|
---|
| 2331 | #if !defined(WOLFCRYPT_ONLY) && !defined(WOLFSSL_NO_TLS12)
|
---|
| 2332 | #undef WOLFSSL_HAVE_PRF
|
---|
| 2333 | #define WOLFSSL_HAVE_PRF
|
---|
| 2334 | #endif
|
---|
| 2335 |
|
---|
| 2336 | #if defined(NO_AES) && defined(NO_DES3) && !defined(HAVE_CAMELLIA) && \
|
---|
| 2337 | !defined(WOLFSSL_HAVE_PRF) && defined(NO_PWDBASED) && !defined(HAVE_IDEA)
|
---|
| 2338 | #undef WOLFSSL_NO_XOR_OPS
|
---|
| 2339 | #define WOLFSSL_NO_XOR_OPS
|
---|
| 2340 | #endif
|
---|
| 2341 |
|
---|
| 2342 | #if defined(NO_ASN) && defined(WOLFCRYPT_ONLY)
|
---|
| 2343 | #undef WOLFSSL_NO_INT_ENCODE
|
---|
| 2344 | #define WOLFSSL_NO_INT_ENCODE
|
---|
| 2345 | #undef WOLFSSL_NO_INT_DECODE
|
---|
| 2346 | #define WOLFSSL_NO_INT_DECODE
|
---|
| 2347 | #endif
|
---|
| 2348 |
|
---|
| 2349 | #if defined(WOLFCRYPT_ONLY) && defined(WOLFSSL_RSA_VERIFY_ONLY) && \
|
---|
| 2350 | defined(WC_NO_RSA_OAEP)
|
---|
| 2351 | #undef WOLFSSL_NO_CT_OPS
|
---|
| 2352 | #define WOLFSSL_NO_CT_OPS
|
---|
| 2353 | #endif
|
---|
| 2354 |
|
---|
| 2355 | #if defined(WOLFCRYPT_ONLY) && defined(NO_AES) && !defined(HAVE_CURVE25519) && \
|
---|
| 2356 | !defined(HAVE_CURVE448) && defined(WC_NO_RNG) && defined(WC_NO_RSA_OAEP)
|
---|
| 2357 | #undef WOLFSSL_NO_CONST_CMP
|
---|
| 2358 | #define WOLFSSL_NO_CONST_CMP
|
---|
| 2359 | #endif
|
---|
| 2360 |
|
---|
| 2361 | #if defined(WOLFCRYPT_ONLY) && defined(NO_AES) && !defined(WOLFSSL_SHA384) && \
|
---|
| 2362 | !defined(WOLFSSL_SHA512) && defined(WC_NO_RNG) && \
|
---|
[464] | 2363 | (defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)) && \
|
---|
| 2364 | defined(WOLFSSL_RSA_PUBLIC_ONLY)
|
---|
[457] | 2365 | #undef WOLFSSL_NO_FORCE_ZERO
|
---|
| 2366 | #define WOLFSSL_NO_FORCE_ZERO
|
---|
| 2367 | #endif
|
---|
| 2368 |
|
---|
| 2369 | /* Detect old cryptodev name */
|
---|
| 2370 | #if defined(WOLF_CRYPTO_DEV) && !defined(WOLF_CRYPTO_CB)
|
---|
| 2371 | #define WOLF_CRYPTO_CB
|
---|
| 2372 | #endif
|
---|
| 2373 |
|
---|
| 2374 | #if defined(WOLFSSL_TLS13) && defined(WOLFSSL_NO_SIGALG)
|
---|
| 2375 | #error TLS 1.3 requires the Signature Algorithms extension to be enabled
|
---|
| 2376 | #endif
|
---|
| 2377 |
|
---|
| 2378 | #ifndef NO_WOLFSSL_BASE64_DECODE
|
---|
| 2379 | #define WOLFSSL_BASE64_DECODE
|
---|
| 2380 | #endif
|
---|
| 2381 |
|
---|
| 2382 | #if defined(HAVE_EX_DATA) || defined(FORTRESS)
|
---|
| 2383 | #define MAX_EX_DATA 5 /* allow for five items of ex_data */
|
---|
| 2384 | #endif
|
---|
| 2385 |
|
---|
| 2386 | #ifdef NO_WOLFSSL_SMALL_STACK
|
---|
| 2387 | #undef WOLFSSL_SMALL_STACK
|
---|
| 2388 | #endif
|
---|
| 2389 |
|
---|
[464] | 2390 | #ifdef WOLFSSL_SMALL_STACK_STATIC
|
---|
| 2391 | #undef WOLFSSL_SMALL_STACK_STATIC
|
---|
| 2392 | #define WOLFSSL_SMALL_STACK_STATIC static
|
---|
| 2393 | #else
|
---|
| 2394 | #define WOLFSSL_SMALL_STACK_STATIC
|
---|
| 2395 | #endif
|
---|
| 2396 |
|
---|
[457] | 2397 | /* The client session cache requires time for timeout */
|
---|
| 2398 | #if defined(NO_ASN_TIME) && !defined(NO_SESSION_CACHE)
|
---|
| 2399 | #define NO_SESSION_CACHE
|
---|
| 2400 | #endif
|
---|
| 2401 |
|
---|
| 2402 | /* Use static ECC structs for Position Independant Code (PIC) */
|
---|
| 2403 | #if defined(__IAR_SYSTEMS_ICC__) && defined(__ROPI__)
|
---|
| 2404 | #define WOLFSSL_ECC_CURVE_STATIC
|
---|
| 2405 | #define WOLFSSL_NAMES_STATIC
|
---|
| 2406 | #define WOLFSSL_NO_CONSTCHARCONST
|
---|
| 2407 | #endif
|
---|
| 2408 |
|
---|
[464] | 2409 | /* FIPS v1 does not support TLS v1.3 (requires RSA PSS and HKDF) */
|
---|
| 2410 | #if defined(HAVE_FIPS) && !defined(HAVE_FIPS_VERSION)
|
---|
| 2411 | #undef WC_RSA_PSS
|
---|
| 2412 | #undef WOLFSSL_TLS13
|
---|
| 2413 | #endif
|
---|
[457] | 2414 |
|
---|
[464] | 2415 | /* For FIPSv2 make sure the ECDSA encoding allows extra bytes
|
---|
| 2416 | * but make sure users consider enabling it */
|
---|
| 2417 | #if !defined(NO_STRICT_ECDSA_LEN) && defined(HAVE_FIPS) && \
|
---|
| 2418 | defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
|
---|
| 2419 | /* ECDSA length checks off by default for CAVP testing
|
---|
| 2420 | * consider enabling strict checks in production */
|
---|
| 2421 | #define NO_STRICT_ECDSA_LEN
|
---|
| 2422 | #endif
|
---|
| 2423 |
|
---|
| 2424 |
|
---|
[457] | 2425 | #ifdef __cplusplus
|
---|
| 2426 | } /* extern "C" */
|
---|
| 2427 | #endif
|
---|
| 2428 |
|
---|
| 2429 | #endif
|
---|