ssh lib
wolfcrypt/settings.h@1:e4ea39eba2fb, 2019-11-25 (annotated)
- Committer:
- sPymbed
- Date:
- Mon Nov 25 14:23:49 2019 +0000
- Revision:
- 1:e4ea39eba2fb
- Parent:
- 0:1387ff3eed4a
improved
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sPymbed | 0:1387ff3eed4a | 1 | /* settings.h |
sPymbed | 0:1387ff3eed4a | 2 | * |
sPymbed | 0:1387ff3eed4a | 3 | * Copyright (C) 2006-2017 wolfSSL Inc. |
sPymbed | 0:1387ff3eed4a | 4 | * |
sPymbed | 0:1387ff3eed4a | 5 | * This file is part of wolfSSL. |
sPymbed | 0:1387ff3eed4a | 6 | * |
sPymbed | 0:1387ff3eed4a | 7 | * wolfSSL is free software; you can redistribute it and/or modify |
sPymbed | 0:1387ff3eed4a | 8 | * it under the terms of the GNU General Public License as published by |
sPymbed | 0:1387ff3eed4a | 9 | * the Free Software Foundation; either version 2 of the License, or |
sPymbed | 0:1387ff3eed4a | 10 | * (at your option) any later version. |
sPymbed | 0:1387ff3eed4a | 11 | * |
sPymbed | 0:1387ff3eed4a | 12 | * wolfSSL is distributed in the hope that it will be useful, |
sPymbed | 0:1387ff3eed4a | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
sPymbed | 0:1387ff3eed4a | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
sPymbed | 0:1387ff3eed4a | 15 | * GNU General Public License for more details. |
sPymbed | 0:1387ff3eed4a | 16 | * |
sPymbed | 0:1387ff3eed4a | 17 | * You should have received a copy of the GNU General Public License |
sPymbed | 0:1387ff3eed4a | 18 | * along with this program; if not, write to the Free Software |
sPymbed | 0:1387ff3eed4a | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
sPymbed | 0:1387ff3eed4a | 20 | */ |
sPymbed | 0:1387ff3eed4a | 21 | |
sPymbed | 0:1387ff3eed4a | 22 | |
sPymbed | 0:1387ff3eed4a | 23 | /* Place OS specific preprocessor flags, defines, includes here, will be |
sPymbed | 0:1387ff3eed4a | 24 | included into every file because types.h includes it */ |
sPymbed | 0:1387ff3eed4a | 25 | |
sPymbed | 0:1387ff3eed4a | 26 | |
sPymbed | 0:1387ff3eed4a | 27 | #ifndef WOLF_CRYPT_SETTINGS_H |
sPymbed | 0:1387ff3eed4a | 28 | #define WOLF_CRYPT_SETTINGS_H |
sPymbed | 0:1387ff3eed4a | 29 | |
sPymbed | 0:1387ff3eed4a | 30 | #ifdef __cplusplus |
sPymbed | 0:1387ff3eed4a | 31 | extern "C" { |
sPymbed | 0:1387ff3eed4a | 32 | #endif |
sPymbed | 0:1387ff3eed4a | 33 | |
sPymbed | 0:1387ff3eed4a | 34 | /* Uncomment next line if using IPHONE */ |
sPymbed | 0:1387ff3eed4a | 35 | /* #define IPHONE */ |
sPymbed | 0:1387ff3eed4a | 36 | |
sPymbed | 0:1387ff3eed4a | 37 | /* Uncomment next line if using ThreadX */ |
sPymbed | 0:1387ff3eed4a | 38 | /* #define THREADX */ |
sPymbed | 0:1387ff3eed4a | 39 | |
sPymbed | 0:1387ff3eed4a | 40 | /* Uncomment next line if using Micrium uC/OS-III */ |
sPymbed | 0:1387ff3eed4a | 41 | /* #define MICRIUM */ |
sPymbed | 0:1387ff3eed4a | 42 | |
sPymbed | 0:1387ff3eed4a | 43 | /* Uncomment next line if using Mbed */ |
sPymbed | 0:1387ff3eed4a | 44 | /* #define MBED */ |
sPymbed | 0:1387ff3eed4a | 45 | |
sPymbed | 0:1387ff3eed4a | 46 | /* Uncomment next line if using Microchip PIC32 ethernet starter kit */ |
sPymbed | 0:1387ff3eed4a | 47 | /* #define MICROCHIP_PIC32 */ |
sPymbed | 0:1387ff3eed4a | 48 | |
sPymbed | 0:1387ff3eed4a | 49 | /* Uncomment next line if using Microchip TCP/IP stack, version 5 */ |
sPymbed | 0:1387ff3eed4a | 50 | /* #define MICROCHIP_TCPIP_V5 */ |
sPymbed | 0:1387ff3eed4a | 51 | |
sPymbed | 0:1387ff3eed4a | 52 | /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ |
sPymbed | 0:1387ff3eed4a | 53 | /* #define MICROCHIP_TCPIP */ |
sPymbed | 0:1387ff3eed4a | 54 | |
sPymbed | 0:1387ff3eed4a | 55 | /* Uncomment next line if using PIC32MZ Crypto Engine */ |
sPymbed | 0:1387ff3eed4a | 56 | /* #define WOLFSSL_MICROCHIP_PIC32MZ */ |
sPymbed | 0:1387ff3eed4a | 57 | |
sPymbed | 0:1387ff3eed4a | 58 | /* Uncomment next line if using FreeRTOS */ |
sPymbed | 0:1387ff3eed4a | 59 | /* #define FREERTOS */ |
sPymbed | 0:1387ff3eed4a | 60 | |
sPymbed | 0:1387ff3eed4a | 61 | /* Uncomment next line if using FreeRTOS+ TCP */ |
sPymbed | 0:1387ff3eed4a | 62 | /* #define FREERTOS_TCP */ |
sPymbed | 0:1387ff3eed4a | 63 | |
sPymbed | 0:1387ff3eed4a | 64 | /* Uncomment next line if using FreeRTOS Windows Simulator */ |
sPymbed | 0:1387ff3eed4a | 65 | /* #define FREERTOS_WINSIM */ |
sPymbed | 0:1387ff3eed4a | 66 | |
sPymbed | 0:1387ff3eed4a | 67 | /* Uncomment next line if using RTIP */ |
sPymbed | 0:1387ff3eed4a | 68 | /* #define EBSNET */ |
sPymbed | 0:1387ff3eed4a | 69 | |
sPymbed | 0:1387ff3eed4a | 70 | /* Uncomment next line if using lwip */ |
sPymbed | 0:1387ff3eed4a | 71 | /* #define WOLFSSL_LWIP */ |
sPymbed | 0:1387ff3eed4a | 72 | |
sPymbed | 0:1387ff3eed4a | 73 | /* Uncomment next line if building wolfSSL for a game console */ |
sPymbed | 0:1387ff3eed4a | 74 | /* #define WOLFSSL_GAME_BUILD */ |
sPymbed | 0:1387ff3eed4a | 75 | |
sPymbed | 0:1387ff3eed4a | 76 | /* Uncomment next line if building wolfSSL for LSR */ |
sPymbed | 0:1387ff3eed4a | 77 | /* #define WOLFSSL_LSR */ |
sPymbed | 0:1387ff3eed4a | 78 | |
sPymbed | 0:1387ff3eed4a | 79 | /* Uncomment next line if building for Freescale Classic MQX version 4.0 */ |
sPymbed | 0:1387ff3eed4a | 80 | /* #define FREESCALE_MQX_4_0 */ |
sPymbed | 0:1387ff3eed4a | 81 | |
sPymbed | 0:1387ff3eed4a | 82 | /* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */ |
sPymbed | 0:1387ff3eed4a | 83 | /* #define FREESCALE_MQX */ |
sPymbed | 0:1387ff3eed4a | 84 | |
sPymbed | 0:1387ff3eed4a | 85 | /* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */ |
sPymbed | 0:1387ff3eed4a | 86 | /* #define FREESCALE_KSDK_MQX */ |
sPymbed | 0:1387ff3eed4a | 87 | |
sPymbed | 0:1387ff3eed4a | 88 | /* Uncomment next line if building for Freescale KSDK Bare Metal */ |
sPymbed | 0:1387ff3eed4a | 89 | /* #define FREESCALE_KSDK_BM */ |
sPymbed | 0:1387ff3eed4a | 90 | |
sPymbed | 0:1387ff3eed4a | 91 | /* Uncomment next line if building for Freescale KSDK FreeRTOS, */ |
sPymbed | 0:1387ff3eed4a | 92 | /* (old name FREESCALE_FREE_RTOS) */ |
sPymbed | 0:1387ff3eed4a | 93 | /* #define FREESCALE_KSDK_FREERTOS */ |
sPymbed | 0:1387ff3eed4a | 94 | |
sPymbed | 0:1387ff3eed4a | 95 | /* Uncomment next line if using STM32F2 */ |
sPymbed | 0:1387ff3eed4a | 96 | /* #define WOLFSSL_STM32F2 */ |
sPymbed | 0:1387ff3eed4a | 97 | |
sPymbed | 0:1387ff3eed4a | 98 | /* Uncomment next line if using STM32F4 */ |
sPymbed | 0:1387ff3eed4a | 99 | /* #define WOLFSSL_STM32F4 */ |
sPymbed | 0:1387ff3eed4a | 100 | |
sPymbed | 0:1387ff3eed4a | 101 | /* Uncomment next line if using STM32F7 */ |
sPymbed | 0:1387ff3eed4a | 102 | /* #define WOLFSSL_STM32F7 */ |
sPymbed | 0:1387ff3eed4a | 103 | |
sPymbed | 0:1387ff3eed4a | 104 | /* Uncomment next line if using QL SEP settings */ |
sPymbed | 0:1387ff3eed4a | 105 | /* #define WOLFSSL_QL */ |
sPymbed | 0:1387ff3eed4a | 106 | |
sPymbed | 0:1387ff3eed4a | 107 | /* Uncomment next line if building for EROAD */ |
sPymbed | 0:1387ff3eed4a | 108 | /* #define WOLFSSL_EROAD */ |
sPymbed | 0:1387ff3eed4a | 109 | |
sPymbed | 0:1387ff3eed4a | 110 | /* Uncomment next line if building for IAR EWARM */ |
sPymbed | 0:1387ff3eed4a | 111 | /* #define WOLFSSL_IAR_ARM */ |
sPymbed | 0:1387ff3eed4a | 112 | |
sPymbed | 0:1387ff3eed4a | 113 | /* Uncomment next line if building for Rowley CrossWorks ARM */ |
sPymbed | 0:1387ff3eed4a | 114 | /* #define WOLFSSL_ROWLEY_ARM */ |
sPymbed | 0:1387ff3eed4a | 115 | |
sPymbed | 0:1387ff3eed4a | 116 | /* Uncomment next line if using TI-RTOS settings */ |
sPymbed | 0:1387ff3eed4a | 117 | /* #define WOLFSSL_TIRTOS */ |
sPymbed | 0:1387ff3eed4a | 118 | |
sPymbed | 0:1387ff3eed4a | 119 | /* Uncomment next line if building with PicoTCP */ |
sPymbed | 0:1387ff3eed4a | 120 | /* #define WOLFSSL_PICOTCP */ |
sPymbed | 0:1387ff3eed4a | 121 | |
sPymbed | 0:1387ff3eed4a | 122 | /* Uncomment next line if building for PicoTCP demo bundle */ |
sPymbed | 0:1387ff3eed4a | 123 | /* #define WOLFSSL_PICOTCP_DEMO */ |
sPymbed | 0:1387ff3eed4a | 124 | |
sPymbed | 0:1387ff3eed4a | 125 | /* Uncomment next line if building for uITRON4 */ |
sPymbed | 0:1387ff3eed4a | 126 | /* #define WOLFSSL_uITRON4 */ |
sPymbed | 0:1387ff3eed4a | 127 | |
sPymbed | 0:1387ff3eed4a | 128 | /* Uncomment next line if building for uT-Kernel */ |
sPymbed | 0:1387ff3eed4a | 129 | /* #define WOLFSSL_uTKERNEL2 */ |
sPymbed | 0:1387ff3eed4a | 130 | |
sPymbed | 0:1387ff3eed4a | 131 | /* Uncomment next line if using Max Strength build */ |
sPymbed | 0:1387ff3eed4a | 132 | /* #define WOLFSSL_MAX_STRENGTH */ |
sPymbed | 0:1387ff3eed4a | 133 | |
sPymbed | 0:1387ff3eed4a | 134 | /* Uncomment next line if building for VxWorks */ |
sPymbed | 0:1387ff3eed4a | 135 | /* #define WOLFSSL_VXWORKS */ |
sPymbed | 0:1387ff3eed4a | 136 | |
sPymbed | 0:1387ff3eed4a | 137 | /* Uncomment next line if building for Nordic nRF5x platofrm */ |
sPymbed | 0:1387ff3eed4a | 138 | /* #define WOLFSSL_NRF5x */ |
sPymbed | 0:1387ff3eed4a | 139 | |
sPymbed | 0:1387ff3eed4a | 140 | /* Uncomment next line to enable deprecated less secure static DH suites */ |
sPymbed | 0:1387ff3eed4a | 141 | /* #define WOLFSSL_STATIC_DH */ |
sPymbed | 0:1387ff3eed4a | 142 | |
sPymbed | 0:1387ff3eed4a | 143 | /* Uncomment next line to enable deprecated less secure static RSA suites */ |
sPymbed | 0:1387ff3eed4a | 144 | /* #define WOLFSSL_STATIC_RSA */ |
sPymbed | 0:1387ff3eed4a | 145 | |
sPymbed | 0:1387ff3eed4a | 146 | /* Uncomment next line if building for ARDUINO */ |
sPymbed | 0:1387ff3eed4a | 147 | /* Uncomment both lines if building for ARDUINO on INTEL_GALILEO */ |
sPymbed | 0:1387ff3eed4a | 148 | /* #define WOLFSSL_ARDUINO */ |
sPymbed | 0:1387ff3eed4a | 149 | /* #define INTEL_GALILEO */ |
sPymbed | 0:1387ff3eed4a | 150 | |
sPymbed | 0:1387ff3eed4a | 151 | /* Uncomment next line to enable asynchronous crypto WC_PENDING_E */ |
sPymbed | 0:1387ff3eed4a | 152 | /* #define WOLFSSL_ASYNC_CRYPT */ |
sPymbed | 0:1387ff3eed4a | 153 | |
sPymbed | 0:1387ff3eed4a | 154 | /* Uncomment next line if building for uTasker */ |
sPymbed | 0:1387ff3eed4a | 155 | /* #define WOLFSSL_UTASKER */ |
sPymbed | 0:1387ff3eed4a | 156 | |
sPymbed | 0:1387ff3eed4a | 157 | /* Uncomment next line if building for embOS */ |
sPymbed | 0:1387ff3eed4a | 158 | /* #define WOLFSSL_EMBOS */ |
sPymbed | 0:1387ff3eed4a | 159 | |
sPymbed | 0:1387ff3eed4a | 160 | /* Uncomment next line if building for RIOT-OS */ |
sPymbed | 0:1387ff3eed4a | 161 | /* #define WOLFSSL_RIOT_OS */ |
sPymbed | 0:1387ff3eed4a | 162 | |
sPymbed | 0:1387ff3eed4a | 163 | /* Uncomment next line if building for using XILINX hardened crypto */ |
sPymbed | 0:1387ff3eed4a | 164 | /* #define WOLFSSL_XILINX_CRYPT */ |
sPymbed | 0:1387ff3eed4a | 165 | |
sPymbed | 0:1387ff3eed4a | 166 | /* Uncomment next line if building for using XILINX */ |
sPymbed | 0:1387ff3eed4a | 167 | /* #define WOLFSSL_XILINX */ |
sPymbed | 0:1387ff3eed4a | 168 | |
sPymbed | 0:1387ff3eed4a | 169 | /* Uncomment next line if building for Nucleus 1.2 */ |
sPymbed | 0:1387ff3eed4a | 170 | /* #define WOLFSSL_NUCLEUS_1_2 */ |
sPymbed | 0:1387ff3eed4a | 171 | |
sPymbed | 0:1387ff3eed4a | 172 | #include <wolfcrypt/visibility.h> |
sPymbed | 0:1387ff3eed4a | 173 | #define WOLFSSL_USER_SETTINGS |
sPymbed | 0:1387ff3eed4a | 174 | #ifdef WOLFSSL_USER_SETTINGS |
sPymbed | 0:1387ff3eed4a | 175 | #include "user_settings.h" |
sPymbed | 0:1387ff3eed4a | 176 | #endif |
sPymbed | 0:1387ff3eed4a | 177 | |
sPymbed | 0:1387ff3eed4a | 178 | |
sPymbed | 0:1387ff3eed4a | 179 | /* make sure old RNG name is used with CTaoCrypt FIPS */ |
sPymbed | 0:1387ff3eed4a | 180 | #ifdef HAVE_FIPS |
sPymbed | 0:1387ff3eed4a | 181 | #define WC_RNG RNG |
sPymbed | 0:1387ff3eed4a | 182 | /* blinding adds API not available yet in FIPS mode */ |
sPymbed | 0:1387ff3eed4a | 183 | #undef WC_RSA_BLINDING |
sPymbed | 0:1387ff3eed4a | 184 | #endif |
sPymbed | 0:1387ff3eed4a | 185 | |
sPymbed | 0:1387ff3eed4a | 186 | |
sPymbed | 0:1387ff3eed4a | 187 | #if defined(_WIN32) && !defined(_M_X64) && \ |
sPymbed | 0:1387ff3eed4a | 188 | defined(HAVE_AESGCM) && defined(WOLFSSL_AESNI) |
sPymbed | 0:1387ff3eed4a | 189 | |
sPymbed | 0:1387ff3eed4a | 190 | /* The _M_X64 macro is what's used in the headers for MSC to tell if it |
sPymbed | 0:1387ff3eed4a | 191 | * has the 64-bit versions of the 128-bit integers available. If one is |
sPymbed | 0:1387ff3eed4a | 192 | * building on 32-bit Windows with AES-NI, turn off the AES-GCMloop |
sPymbed | 0:1387ff3eed4a | 193 | * unrolling. */ |
sPymbed | 0:1387ff3eed4a | 194 | |
sPymbed | 0:1387ff3eed4a | 195 | #define AES_GCM_AESNI_NO_UNROLL |
sPymbed | 0:1387ff3eed4a | 196 | #endif |
sPymbed | 0:1387ff3eed4a | 197 | |
sPymbed | 0:1387ff3eed4a | 198 | #ifdef IPHONE |
sPymbed | 0:1387ff3eed4a | 199 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 200 | #endif |
sPymbed | 0:1387ff3eed4a | 201 | |
sPymbed | 0:1387ff3eed4a | 202 | #ifdef THREADX |
sPymbed | 0:1387ff3eed4a | 203 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 204 | #endif |
sPymbed | 0:1387ff3eed4a | 205 | |
sPymbed | 0:1387ff3eed4a | 206 | #ifdef HAVE_NETX |
sPymbed | 0:1387ff3eed4a | 207 | #ifdef NEED_THREADX_TYPES |
sPymbed | 0:1387ff3eed4a | 208 | #include <types.h> |
sPymbed | 0:1387ff3eed4a | 209 | #endif |
sPymbed | 0:1387ff3eed4a | 210 | #include <nx_api.h> |
sPymbed | 0:1387ff3eed4a | 211 | #endif |
sPymbed | 0:1387ff3eed4a | 212 | |
sPymbed | 0:1387ff3eed4a | 213 | #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ |
sPymbed | 0:1387ff3eed4a | 214 | #define WOLFSSL_LWIP |
sPymbed | 0:1387ff3eed4a | 215 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 216 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 217 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 218 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 219 | #endif |
sPymbed | 0:1387ff3eed4a | 220 | |
sPymbed | 0:1387ff3eed4a | 221 | #if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM) |
sPymbed | 0:1387ff3eed4a | 222 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 223 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 224 | #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096) |
sPymbed | 0:1387ff3eed4a | 225 | #define USE_CERT_BUFFERS_1024 |
sPymbed | 0:1387ff3eed4a | 226 | #endif |
sPymbed | 0:1387ff3eed4a | 227 | #define BENCH_EMBEDDED |
sPymbed | 0:1387ff3eed4a | 228 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 229 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 230 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 231 | #define BENCH_EMBEDDED |
sPymbed | 0:1387ff3eed4a | 232 | #endif |
sPymbed | 0:1387ff3eed4a | 233 | |
sPymbed | 0:1387ff3eed4a | 234 | #ifdef MICROCHIP_PIC32 |
sPymbed | 0:1387ff3eed4a | 235 | /* #define WOLFSSL_MICROCHIP_PIC32MZ */ |
sPymbed | 0:1387ff3eed4a | 236 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 237 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 238 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 239 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 240 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 241 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 242 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 243 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 244 | #define WOLFSSL_HAVE_MIN |
sPymbed | 0:1387ff3eed4a | 245 | #define WOLFSSL_HAVE_MAX |
sPymbed | 0:1387ff3eed4a | 246 | #define NO_BIG_INT |
sPymbed | 0:1387ff3eed4a | 247 | #endif |
sPymbed | 0:1387ff3eed4a | 248 | |
sPymbed | 0:1387ff3eed4a | 249 | #ifdef WOLFSSL_MICROCHIP_PIC32MZ |
sPymbed | 0:1387ff3eed4a | 250 | #define WOLFSSL_PIC32MZ_CRYPT |
sPymbed | 0:1387ff3eed4a | 251 | #define WOLFSSL_PIC32MZ_RNG |
sPymbed | 0:1387ff3eed4a | 252 | #define WOLFSSL_PIC32MZ_HASH |
sPymbed | 0:1387ff3eed4a | 253 | #endif |
sPymbed | 0:1387ff3eed4a | 254 | |
sPymbed | 0:1387ff3eed4a | 255 | #ifdef MICROCHIP_TCPIP_V5 |
sPymbed | 0:1387ff3eed4a | 256 | /* include timer functions */ |
sPymbed | 0:1387ff3eed4a | 257 | #include "TCPIP Stack/TCPIP.h" |
sPymbed | 0:1387ff3eed4a | 258 | #endif |
sPymbed | 0:1387ff3eed4a | 259 | |
sPymbed | 0:1387ff3eed4a | 260 | #ifdef MICROCHIP_TCPIP |
sPymbed | 0:1387ff3eed4a | 261 | /* include timer, NTP functions */ |
sPymbed | 0:1387ff3eed4a | 262 | #ifdef MICROCHIP_MPLAB_HARMONY |
sPymbed | 0:1387ff3eed4a | 263 | #include "tcpip/tcpip.h" |
sPymbed | 0:1387ff3eed4a | 264 | #else |
sPymbed | 0:1387ff3eed4a | 265 | #include "system/system_services.h" |
sPymbed | 0:1387ff3eed4a | 266 | #include "tcpip/sntp.h" |
sPymbed | 0:1387ff3eed4a | 267 | #endif |
sPymbed | 0:1387ff3eed4a | 268 | #endif |
sPymbed | 0:1387ff3eed4a | 269 | |
sPymbed | 0:1387ff3eed4a | 270 | #ifdef MBED |
sPymbed | 0:1387ff3eed4a | 271 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 272 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 273 | #define NO_CERT |
sPymbed | 0:1387ff3eed4a | 274 | #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096) |
sPymbed | 0:1387ff3eed4a | 275 | #define USE_CERT_BUFFERS_1024 |
sPymbed | 0:1387ff3eed4a | 276 | #endif |
sPymbed | 0:1387ff3eed4a | 277 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 278 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 279 | #define NO_SHA512 |
sPymbed | 0:1387ff3eed4a | 280 | #define NO_DH |
sPymbed | 0:1387ff3eed4a | 281 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 282 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 283 | #define NO_DSA |
sPymbed | 0:1387ff3eed4a | 284 | #define NO_HC128 |
sPymbed | 0:1387ff3eed4a | 285 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 286 | #define NO_SESSION_CACHE |
sPymbed | 0:1387ff3eed4a | 287 | #define WOLFSSL_CMSIS_RTOS |
sPymbed | 0:1387ff3eed4a | 288 | #endif |
sPymbed | 0:1387ff3eed4a | 289 | |
sPymbed | 0:1387ff3eed4a | 290 | |
sPymbed | 0:1387ff3eed4a | 291 | #ifdef WOLFSSL_EROAD |
sPymbed | 0:1387ff3eed4a | 292 | #define FREESCALE_MQX |
sPymbed | 0:1387ff3eed4a | 293 | #define FREESCALE_MMCAU |
sPymbed | 0:1387ff3eed4a | 294 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 295 | #define NO_STDIO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 296 | #define WOLFSSL_LEANPSK |
sPymbed | 0:1387ff3eed4a | 297 | #define HAVE_NULL_CIPHER |
sPymbed | 0:1387ff3eed4a | 298 | #define NO_OLD_TLS |
sPymbed | 0:1387ff3eed4a | 299 | #define NO_ASN |
sPymbed | 0:1387ff3eed4a | 300 | #define NO_BIG_INT |
sPymbed | 0:1387ff3eed4a | 301 | #define NO_RSA |
sPymbed | 0:1387ff3eed4a | 302 | #define NO_DSA |
sPymbed | 0:1387ff3eed4a | 303 | #define NO_DH |
sPymbed | 0:1387ff3eed4a | 304 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 305 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 306 | #define NO_CERTS |
sPymbed | 0:1387ff3eed4a | 307 | #define NO_PWDBASED |
sPymbed | 0:1387ff3eed4a | 308 | #define NO_DES3 |
sPymbed | 0:1387ff3eed4a | 309 | #define NO_MD4 |
sPymbed | 0:1387ff3eed4a | 310 | #define NO_RC4 |
sPymbed | 0:1387ff3eed4a | 311 | #define NO_MD5 |
sPymbed | 0:1387ff3eed4a | 312 | #define NO_SESSION_CACHE |
sPymbed | 0:1387ff3eed4a | 313 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 314 | #endif |
sPymbed | 0:1387ff3eed4a | 315 | |
sPymbed | 0:1387ff3eed4a | 316 | #ifdef WOLFSSL_PICOTCP |
sPymbed | 0:1387ff3eed4a | 317 | #ifndef errno |
sPymbed | 0:1387ff3eed4a | 318 | #define errno pico_err |
sPymbed | 0:1387ff3eed4a | 319 | #endif |
sPymbed | 0:1387ff3eed4a | 320 | #include "pico_defines.h" |
sPymbed | 0:1387ff3eed4a | 321 | #include "pico_stack.h" |
sPymbed | 0:1387ff3eed4a | 322 | #include "pico_constants.h" |
sPymbed | 0:1387ff3eed4a | 323 | #include "pico_protocol.h" |
sPymbed | 0:1387ff3eed4a | 324 | #define CUSTOM_RAND_GENERATE pico_rand |
sPymbed | 0:1387ff3eed4a | 325 | #endif |
sPymbed | 0:1387ff3eed4a | 326 | |
sPymbed | 0:1387ff3eed4a | 327 | #ifdef WOLFSSL_PICOTCP_DEMO |
sPymbed | 0:1387ff3eed4a | 328 | #define WOLFSSL_STM32 |
sPymbed | 0:1387ff3eed4a | 329 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 330 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 331 | #define XMALLOC(s, h, type) PICO_ZALLOC((s)) |
sPymbed | 0:1387ff3eed4a | 332 | #define XFREE(p, h, type) PICO_FREE((p)) |
sPymbed | 0:1387ff3eed4a | 333 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 334 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 335 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 336 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 337 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 338 | #endif |
sPymbed | 0:1387ff3eed4a | 339 | |
sPymbed | 0:1387ff3eed4a | 340 | #ifdef FREERTOS_WINSIM |
sPymbed | 0:1387ff3eed4a | 341 | #define FREERTOS |
sPymbed | 0:1387ff3eed4a | 342 | #define USE_WINDOWS_API |
sPymbed | 0:1387ff3eed4a | 343 | #endif |
sPymbed | 0:1387ff3eed4a | 344 | |
sPymbed | 0:1387ff3eed4a | 345 | |
sPymbed | 0:1387ff3eed4a | 346 | #ifdef WOLFSSL_VXWORKS |
sPymbed | 0:1387ff3eed4a | 347 | /* VxWorks simulator incorrectly detects building for i386 */ |
sPymbed | 0:1387ff3eed4a | 348 | #ifdef VXWORKS_SIM |
sPymbed | 0:1387ff3eed4a | 349 | #define TFM_NO_ASM |
sPymbed | 0:1387ff3eed4a | 350 | #endif |
sPymbed | 0:1387ff3eed4a | 351 | #define WOLFSSL_PTHREADS |
sPymbed | 0:1387ff3eed4a | 352 | #define WOLFSSL_HAVE_MIN |
sPymbed | 0:1387ff3eed4a | 353 | #define WOLFSSL_HAVE_MAX |
sPymbed | 0:1387ff3eed4a | 354 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 355 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 356 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 357 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 358 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 359 | #endif |
sPymbed | 0:1387ff3eed4a | 360 | |
sPymbed | 0:1387ff3eed4a | 361 | |
sPymbed | 0:1387ff3eed4a | 362 | #ifdef WOLFSSL_ARDUINO |
sPymbed | 0:1387ff3eed4a | 363 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 364 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 365 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 366 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 367 | #ifndef INTEL_GALILEO /* Galileo has time.h compatibility */ |
sPymbed | 0:1387ff3eed4a | 368 | #define TIME_OVERRIDES /* must define XTIME and XGMTIME externally */ |
sPymbed | 0:1387ff3eed4a | 369 | #endif |
sPymbed | 0:1387ff3eed4a | 370 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 371 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 372 | #define NO_DH |
sPymbed | 0:1387ff3eed4a | 373 | #define NO_SESSION_CACHE |
sPymbed | 0:1387ff3eed4a | 374 | #define USE_SLOW_SHA |
sPymbed | 0:1387ff3eed4a | 375 | #define NO_WOLFSSL_SERVER |
sPymbed | 0:1387ff3eed4a | 376 | #define NO_ERROR_STRINGS |
sPymbed | 0:1387ff3eed4a | 377 | #endif |
sPymbed | 0:1387ff3eed4a | 378 | |
sPymbed | 0:1387ff3eed4a | 379 | |
sPymbed | 0:1387ff3eed4a | 380 | #ifdef WOLFSSL_UTASKER |
sPymbed | 0:1387ff3eed4a | 381 | /* uTasker configuration - used for fnRandom() */ |
sPymbed | 0:1387ff3eed4a | 382 | #include "config.h" |
sPymbed | 0:1387ff3eed4a | 383 | |
sPymbed | 0:1387ff3eed4a | 384 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 385 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 386 | #define WOLFSSL_HAVE_MIN |
sPymbed | 0:1387ff3eed4a | 387 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 388 | |
sPymbed | 0:1387ff3eed4a | 389 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 390 | #define ALT_ECC_SIZE |
sPymbed | 0:1387ff3eed4a | 391 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 392 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 393 | #define ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 394 | |
sPymbed | 0:1387ff3eed4a | 395 | /* used in wolfCrypt test */ |
sPymbed | 0:1387ff3eed4a | 396 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 397 | #define USE_CERT_BUFFERS_2048 |
sPymbed | 0:1387ff3eed4a | 398 | |
sPymbed | 0:1387ff3eed4a | 399 | /* uTasker port uses RAW sockets, use I/O callbacks |
sPymbed | 0:1387ff3eed4a | 400 | * See wolfSSL uTasker example for sample callbacks */ |
sPymbed | 0:1387ff3eed4a | 401 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 402 | |
sPymbed | 0:1387ff3eed4a | 403 | /* uTasker filesystem not ported */ |
sPymbed | 0:1387ff3eed4a | 404 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 405 | |
sPymbed | 0:1387ff3eed4a | 406 | /* uTasker RNG is abstracted, calls HW RNG when available */ |
sPymbed | 0:1387ff3eed4a | 407 | #define CUSTOM_RAND_GENERATE fnRandom |
sPymbed | 0:1387ff3eed4a | 408 | #define CUSTOM_RAND_TYPE unsigned short |
sPymbed | 0:1387ff3eed4a | 409 | |
sPymbed | 0:1387ff3eed4a | 410 | /* user needs to define XTIME to function that provides |
sPymbed | 0:1387ff3eed4a | 411 | * seconds since Unix epoch */ |
sPymbed | 0:1387ff3eed4a | 412 | #ifndef XTIME |
sPymbed | 0:1387ff3eed4a | 413 | #error XTIME must be defined in wolfSSL settings.h |
sPymbed | 0:1387ff3eed4a | 414 | /* #define XTIME fnSecondsSinceEpoch */ |
sPymbed | 0:1387ff3eed4a | 415 | #endif |
sPymbed | 0:1387ff3eed4a | 416 | |
sPymbed | 0:1387ff3eed4a | 417 | /* use uTasker std library replacements where available */ |
sPymbed | 0:1387ff3eed4a | 418 | #define STRING_USER |
sPymbed | 0:1387ff3eed4a | 419 | #define XMEMCPY(d,s,l) uMemcpy((d),(s),(l)) |
sPymbed | 0:1387ff3eed4a | 420 | #define XMEMSET(b,c,l) uMemset((b),(c),(l)) |
sPymbed | 0:1387ff3eed4a | 421 | #define XMEMCMP(s1,s2,n) uMemcmp((s1),(s2),(n)) |
sPymbed | 0:1387ff3eed4a | 422 | #define XMEMMOVE(d,s,l) memmove((d),(s),(l)) |
sPymbed | 0:1387ff3eed4a | 423 | |
sPymbed | 0:1387ff3eed4a | 424 | #define XSTRLEN(s1) uStrlen((s1)) |
sPymbed | 0:1387ff3eed4a | 425 | #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) |
sPymbed | 0:1387ff3eed4a | 426 | #define XSTRSTR(s1,s2) strstr((s1),(s2)) |
sPymbed | 0:1387ff3eed4a | 427 | #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n)) |
sPymbed | 0:1387ff3eed4a | 428 | #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n)) |
sPymbed | 0:1387ff3eed4a | 429 | #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n)) |
sPymbed | 0:1387ff3eed4a | 430 | #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) |
sPymbed | 0:1387ff3eed4a | 431 | #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN) |
sPymbed | 0:1387ff3eed4a | 432 | #define XSTRTOK strtok_r |
sPymbed | 0:1387ff3eed4a | 433 | #endif |
sPymbed | 0:1387ff3eed4a | 434 | #endif |
sPymbed | 0:1387ff3eed4a | 435 | |
sPymbed | 0:1387ff3eed4a | 436 | #ifdef WOLFSSL_EMBOS |
sPymbed | 0:1387ff3eed4a | 437 | #define NO_FILESYSTEM /* Not ported at this time */ |
sPymbed | 0:1387ff3eed4a | 438 | #define USE_CERT_BUFFERS_2048 /* use when NO_FILESYSTEM */ |
sPymbed | 0:1387ff3eed4a | 439 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 440 | #define NO_RC4 |
sPymbed | 0:1387ff3eed4a | 441 | #define SINGLE_THREADED /* Not ported at this time */ |
sPymbed | 0:1387ff3eed4a | 442 | #endif |
sPymbed | 0:1387ff3eed4a | 443 | |
sPymbed | 0:1387ff3eed4a | 444 | #ifdef WOLFSSL_RIOT_OS |
sPymbed | 0:1387ff3eed4a | 445 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 446 | #define TFM_NO_ASM |
sPymbed | 0:1387ff3eed4a | 447 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 448 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 449 | #define USE_CERT_BUFFERS_2048 |
sPymbed | 0:1387ff3eed4a | 450 | #endif |
sPymbed | 0:1387ff3eed4a | 451 | |
sPymbed | 0:1387ff3eed4a | 452 | #ifdef WOLFSSL_CHIBIOS |
sPymbed | 0:1387ff3eed4a | 453 | /* ChibiOS definitions. This file is distributed with chibiOS. */ |
sPymbed | 0:1387ff3eed4a | 454 | #include "wolfssl_chibios.h" |
sPymbed | 0:1387ff3eed4a | 455 | #endif |
sPymbed | 0:1387ff3eed4a | 456 | |
sPymbed | 0:1387ff3eed4a | 457 | #ifdef WOLFSSL_PB |
sPymbed | 0:1387ff3eed4a | 458 | /* PB is using older 1.2 version of Nucleus */ |
sPymbed | 0:1387ff3eed4a | 459 | #undef WOLFSSL_NUCLEUS |
sPymbed | 0:1387ff3eed4a | 460 | #define WOLFSSL_NUCLEUS_1_2 |
sPymbed | 0:1387ff3eed4a | 461 | #endif |
sPymbed | 0:1387ff3eed4a | 462 | |
sPymbed | 0:1387ff3eed4a | 463 | #ifdef WOLFSSL_NUCLEUS_1_2 |
sPymbed | 0:1387ff3eed4a | 464 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 465 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 466 | |
sPymbed | 0:1387ff3eed4a | 467 | #if !defined(NO_ASN_TIME) && !defined(USER_TIME) |
sPymbed | 0:1387ff3eed4a | 468 | #error User must define XTIME, see manual |
sPymbed | 0:1387ff3eed4a | 469 | #endif |
sPymbed | 0:1387ff3eed4a | 470 | |
sPymbed | 0:1387ff3eed4a | 471 | #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER) |
sPymbed | 0:1387ff3eed4a | 472 | extern void* nucleus_malloc(unsigned long size, void* heap, int type); |
sPymbed | 0:1387ff3eed4a | 473 | extern void* nucleus_realloc(void* ptr, unsigned long size, void* heap, |
sPymbed | 0:1387ff3eed4a | 474 | int type); |
sPymbed | 0:1387ff3eed4a | 475 | extern void nucleus_free(void* ptr, void* heap, int type); |
sPymbed | 0:1387ff3eed4a | 476 | |
sPymbed | 0:1387ff3eed4a | 477 | #define XMALLOC(s, h, type) nucleus_malloc |
sPymbed | 0:1387ff3eed4a | 478 | #define XREALLOC(p, n, h, t) nucleus_realloc |
sPymbed | 0:1387ff3eed4a | 479 | #define XFREE(p, h, type) nucleus_free |
sPymbed | 0:1387ff3eed4a | 480 | #endif |
sPymbed | 0:1387ff3eed4a | 481 | #endif |
sPymbed | 0:1387ff3eed4a | 482 | |
sPymbed | 0:1387ff3eed4a | 483 | #ifdef WOLFSSL_NRF5x |
sPymbed | 0:1387ff3eed4a | 484 | #define SIZEOF_LONG 4 |
sPymbed | 0:1387ff3eed4a | 485 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 486 | #define NO_ASN_TIME |
sPymbed | 0:1387ff3eed4a | 487 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 488 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 489 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 490 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 491 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 492 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 493 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 494 | #define USE_WOLFSSL_MEMORY |
sPymbed | 0:1387ff3eed4a | 495 | #define WOLFSSL_NRF51 |
sPymbed | 0:1387ff3eed4a | 496 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 497 | #define NO_SESSION_CACHE |
sPymbed | 0:1387ff3eed4a | 498 | #endif |
sPymbed | 0:1387ff3eed4a | 499 | |
sPymbed | 0:1387ff3eed4a | 500 | /* Micrium will use Visual Studio for compilation but not the Win32 API */ |
sPymbed | 0:1387ff3eed4a | 501 | #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \ |
sPymbed | 0:1387ff3eed4a | 502 | !defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \ |
sPymbed | 0:1387ff3eed4a | 503 | !defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS) |
sPymbed | 0:1387ff3eed4a | 504 | #define USE_WINDOWS_API |
sPymbed | 0:1387ff3eed4a | 505 | #endif |
sPymbed | 0:1387ff3eed4a | 506 | |
sPymbed | 0:1387ff3eed4a | 507 | #if defined(WOLFSSL_uITRON4) |
sPymbed | 0:1387ff3eed4a | 508 | |
sPymbed | 0:1387ff3eed4a | 509 | #define XMALLOC_USER |
sPymbed | 0:1387ff3eed4a | 510 | #include <stddef.h> |
sPymbed | 0:1387ff3eed4a | 511 | #define ITRON_POOL_SIZE 1024*20 |
sPymbed | 0:1387ff3eed4a | 512 | extern int uITRON4_minit(size_t poolsz) ; |
sPymbed | 0:1387ff3eed4a | 513 | extern void *uITRON4_malloc(size_t sz) ; |
sPymbed | 0:1387ff3eed4a | 514 | extern void *uITRON4_realloc(void *p, size_t sz) ; |
sPymbed | 0:1387ff3eed4a | 515 | extern void uITRON4_free(void *p) ; |
sPymbed | 0:1387ff3eed4a | 516 | |
sPymbed | 0:1387ff3eed4a | 517 | #define XMALLOC(sz, heap, type) uITRON4_malloc(sz) |
sPymbed | 0:1387ff3eed4a | 518 | #define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz) |
sPymbed | 0:1387ff3eed4a | 519 | #define XFREE(p, heap, type) uITRON4_free(p) |
sPymbed | 0:1387ff3eed4a | 520 | #endif |
sPymbed | 0:1387ff3eed4a | 521 | |
sPymbed | 0:1387ff3eed4a | 522 | #if defined(WOLFSSL_uTKERNEL2) |
sPymbed | 0:1387ff3eed4a | 523 | #ifndef NO_TKERNEL_MEM_POOL |
sPymbed | 0:1387ff3eed4a | 524 | #define XMALLOC_OVERRIDE |
sPymbed | 0:1387ff3eed4a | 525 | int uTKernel_init_mpool(unsigned int sz); /* initializing malloc pool */ |
sPymbed | 0:1387ff3eed4a | 526 | void* uTKernel_malloc(unsigned int sz); |
sPymbed | 0:1387ff3eed4a | 527 | void* uTKernel_realloc(void *p, unsigned int sz); |
sPymbed | 0:1387ff3eed4a | 528 | void uTKernel_free(void *p); |
sPymbed | 0:1387ff3eed4a | 529 | #define XMALLOC(s, h, type) uTKernel_malloc((s)) |
sPymbed | 0:1387ff3eed4a | 530 | #define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n)) |
sPymbed | 0:1387ff3eed4a | 531 | #define XFREE(p, h, type) uTKernel_free((p)) |
sPymbed | 0:1387ff3eed4a | 532 | #endif |
sPymbed | 0:1387ff3eed4a | 533 | |
sPymbed | 0:1387ff3eed4a | 534 | #ifndef NO_STDIO_FGETS_REMAP |
sPymbed | 0:1387ff3eed4a | 535 | #include <stdio.h> |
sPymbed | 0:1387ff3eed4a | 536 | #include "tm/tmonitor.h" |
sPymbed | 0:1387ff3eed4a | 537 | |
sPymbed | 0:1387ff3eed4a | 538 | /* static char* gets(char *buff); */ |
sPymbed | 0:1387ff3eed4a | 539 | static char* fgets(char *buff, int sz, FILE *fp) { |
sPymbed | 0:1387ff3eed4a | 540 | char * p = buff; |
sPymbed | 0:1387ff3eed4a | 541 | *p = '\0'; |
sPymbed | 0:1387ff3eed4a | 542 | while (1) { |
sPymbed | 0:1387ff3eed4a | 543 | *p = tm_getchar(-1); |
sPymbed | 0:1387ff3eed4a | 544 | tm_putchar(*p); |
sPymbed | 0:1387ff3eed4a | 545 | if (*p == '\r') { |
sPymbed | 0:1387ff3eed4a | 546 | tm_putchar('\n'); |
sPymbed | 0:1387ff3eed4a | 547 | *p = '\0'; |
sPymbed | 0:1387ff3eed4a | 548 | break; |
sPymbed | 0:1387ff3eed4a | 549 | } |
sPymbed | 0:1387ff3eed4a | 550 | p++; |
sPymbed | 0:1387ff3eed4a | 551 | } |
sPymbed | 0:1387ff3eed4a | 552 | return buff; |
sPymbed | 0:1387ff3eed4a | 553 | } |
sPymbed | 0:1387ff3eed4a | 554 | #endif /* !NO_STDIO_FGETS_REMAP */ |
sPymbed | 0:1387ff3eed4a | 555 | #endif |
sPymbed | 0:1387ff3eed4a | 556 | |
sPymbed | 0:1387ff3eed4a | 557 | |
sPymbed | 0:1387ff3eed4a | 558 | #if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER) |
sPymbed | 0:1387ff3eed4a | 559 | #include <stdlib.h> |
sPymbed | 0:1387ff3eed4a | 560 | #define XMALLOC(s, h, type) malloc((s)) |
sPymbed | 0:1387ff3eed4a | 561 | #define XFREE(p, h, type) free((p)) |
sPymbed | 0:1387ff3eed4a | 562 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
sPymbed | 0:1387ff3eed4a | 563 | #endif |
sPymbed | 0:1387ff3eed4a | 564 | |
sPymbed | 0:1387ff3eed4a | 565 | #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) |
sPymbed | 0:1387ff3eed4a | 566 | #undef XMALLOC |
sPymbed | 0:1387ff3eed4a | 567 | #define XMALLOC yaXMALLOC |
sPymbed | 0:1387ff3eed4a | 568 | #undef XFREE |
sPymbed | 0:1387ff3eed4a | 569 | #define XFREE yaXFREE |
sPymbed | 0:1387ff3eed4a | 570 | #undef XREALLOC |
sPymbed | 0:1387ff3eed4a | 571 | #define XREALLOC yaXREALLOC |
sPymbed | 0:1387ff3eed4a | 572 | #endif |
sPymbed | 0:1387ff3eed4a | 573 | |
sPymbed | 0:1387ff3eed4a | 574 | |
sPymbed | 0:1387ff3eed4a | 575 | #ifdef FREERTOS |
sPymbed | 0:1387ff3eed4a | 576 | #include "FreeRTOS.h" |
sPymbed | 0:1387ff3eed4a | 577 | |
sPymbed | 0:1387ff3eed4a | 578 | /* FreeRTOS pvPortRealloc() only in AVR32_UC3 port */ |
sPymbed | 0:1387ff3eed4a | 579 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \ |
sPymbed | 0:1387ff3eed4a | 580 | !defined(WOLFSSL_STATIC_MEMORY) |
sPymbed | 0:1387ff3eed4a | 581 | #define XMALLOC(s, h, type) pvPortMalloc((s)) |
sPymbed | 0:1387ff3eed4a | 582 | #define XFREE(p, h, type) vPortFree((p)) |
sPymbed | 0:1387ff3eed4a | 583 | #endif |
sPymbed | 0:1387ff3eed4a | 584 | |
sPymbed | 0:1387ff3eed4a | 585 | #ifndef NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 586 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 587 | #endif |
sPymbed | 0:1387ff3eed4a | 588 | #ifndef HAVE_SHA512 |
sPymbed | 0:1387ff3eed4a | 589 | #ifndef NO_SHA512 |
sPymbed | 0:1387ff3eed4a | 590 | #define NO_SHA512 |
sPymbed | 0:1387ff3eed4a | 591 | #endif |
sPymbed | 0:1387ff3eed4a | 592 | #endif |
sPymbed | 0:1387ff3eed4a | 593 | #ifndef HAVE_DH |
sPymbed | 0:1387ff3eed4a | 594 | #ifndef NO_DH |
sPymbed | 0:1387ff3eed4a | 595 | #define NO_DH |
sPymbed | 0:1387ff3eed4a | 596 | #endif |
sPymbed | 0:1387ff3eed4a | 597 | #endif |
sPymbed | 0:1387ff3eed4a | 598 | #ifndef NO_DSA |
sPymbed | 0:1387ff3eed4a | 599 | #define NO_DSA |
sPymbed | 0:1387ff3eed4a | 600 | #endif |
sPymbed | 0:1387ff3eed4a | 601 | #ifndef NO_HC128 |
sPymbed | 0:1387ff3eed4a | 602 | #define NO_HC128 |
sPymbed | 0:1387ff3eed4a | 603 | #endif |
sPymbed | 0:1387ff3eed4a | 604 | |
sPymbed | 0:1387ff3eed4a | 605 | #ifndef SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 606 | #include "semphr.h" |
sPymbed | 0:1387ff3eed4a | 607 | #endif |
sPymbed | 0:1387ff3eed4a | 608 | #endif |
sPymbed | 0:1387ff3eed4a | 609 | |
sPymbed | 0:1387ff3eed4a | 610 | #ifdef FREERTOS_TCP |
sPymbed | 0:1387ff3eed4a | 611 | #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \ |
sPymbed | 0:1387ff3eed4a | 612 | !defined(WOLFSSL_STATIC_MEMORY) |
sPymbed | 0:1387ff3eed4a | 613 | #define XMALLOC(s, h, type) pvPortMalloc((s)) |
sPymbed | 0:1387ff3eed4a | 614 | #define XFREE(p, h, type) vPortFree((p)) |
sPymbed | 0:1387ff3eed4a | 615 | #endif |
sPymbed | 0:1387ff3eed4a | 616 | |
sPymbed | 0:1387ff3eed4a | 617 | #define WOLFSSL_GENSEED_FORTEST |
sPymbed | 0:1387ff3eed4a | 618 | |
sPymbed | 0:1387ff3eed4a | 619 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 620 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 621 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 622 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 623 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 624 | #endif |
sPymbed | 0:1387ff3eed4a | 625 | |
sPymbed | 0:1387ff3eed4a | 626 | #ifdef WOLFSSL_TIRTOS |
sPymbed | 0:1387ff3eed4a | 627 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 628 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 629 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 630 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 631 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 632 | #define ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 633 | #define WC_RSA_BLINDING |
sPymbed | 0:1387ff3eed4a | 634 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 635 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 636 | #define USE_CERT_BUFFERS_2048 |
sPymbed | 0:1387ff3eed4a | 637 | #define NO_ERROR_STRINGS |
sPymbed | 0:1387ff3eed4a | 638 | #define USER_TIME |
sPymbed | 0:1387ff3eed4a | 639 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 640 | #define HAVE_ALPN |
sPymbed | 0:1387ff3eed4a | 641 | #define USE_WOLF_STRTOK /* use with HAVE_ALPN */ |
sPymbed | 0:1387ff3eed4a | 642 | #define HAVE_TLS_EXTENSIONS |
sPymbed | 0:1387ff3eed4a | 643 | #define HAVE_AESGCM |
sPymbed | 0:1387ff3eed4a | 644 | #define HAVE_SUPPORTED_CURVES |
sPymbed | 0:1387ff3eed4a | 645 | #define ALT_ECC_SIZE |
sPymbed | 0:1387ff3eed4a | 646 | |
sPymbed | 0:1387ff3eed4a | 647 | #ifdef __IAR_SYSTEMS_ICC__ |
sPymbed | 0:1387ff3eed4a | 648 | #pragma diag_suppress=Pa089 |
sPymbed | 0:1387ff3eed4a | 649 | #elif !defined(__GNUC__) |
sPymbed | 0:1387ff3eed4a | 650 | /* Suppress the sslpro warning */ |
sPymbed | 0:1387ff3eed4a | 651 | #pragma diag_suppress=11 |
sPymbed | 0:1387ff3eed4a | 652 | #endif |
sPymbed | 0:1387ff3eed4a | 653 | |
sPymbed | 0:1387ff3eed4a | 654 | #include <ti/sysbios/hal/Seconds.h> |
sPymbed | 0:1387ff3eed4a | 655 | #endif |
sPymbed | 0:1387ff3eed4a | 656 | |
sPymbed | 0:1387ff3eed4a | 657 | #ifdef EBSNET |
sPymbed | 0:1387ff3eed4a | 658 | #include "rtip.h" |
sPymbed | 0:1387ff3eed4a | 659 | |
sPymbed | 0:1387ff3eed4a | 660 | /* #define DEBUG_WOLFSSL */ |
sPymbed | 0:1387ff3eed4a | 661 | #define NO_WOLFSSL_DIR /* tbd */ |
sPymbed | 0:1387ff3eed4a | 662 | |
sPymbed | 0:1387ff3eed4a | 663 | #if (POLLOS) |
sPymbed | 0:1387ff3eed4a | 664 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 665 | #endif |
sPymbed | 0:1387ff3eed4a | 666 | |
sPymbed | 0:1387ff3eed4a | 667 | #if (RTPLATFORM) |
sPymbed | 0:1387ff3eed4a | 668 | #if (!RTP_LITTLE_ENDIAN) |
sPymbed | 0:1387ff3eed4a | 669 | #define BIG_ENDIAN_ORDER |
sPymbed | 0:1387ff3eed4a | 670 | #endif |
sPymbed | 0:1387ff3eed4a | 671 | #else |
sPymbed | 0:1387ff3eed4a | 672 | #if (!KS_LITTLE_ENDIAN) |
sPymbed | 0:1387ff3eed4a | 673 | #define BIG_ENDIAN_ORDER |
sPymbed | 0:1387ff3eed4a | 674 | #endif |
sPymbed | 0:1387ff3eed4a | 675 | #endif |
sPymbed | 0:1387ff3eed4a | 676 | |
sPymbed | 0:1387ff3eed4a | 677 | #if (WINMSP3) |
sPymbed | 0:1387ff3eed4a | 678 | #undef SIZEOF_LONG |
sPymbed | 0:1387ff3eed4a | 679 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 680 | #else |
sPymbed | 0:1387ff3eed4a | 681 | #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG |
sPymbed | 0:1387ff3eed4a | 682 | #endif |
sPymbed | 0:1387ff3eed4a | 683 | |
sPymbed | 0:1387ff3eed4a | 684 | #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) |
sPymbed | 0:1387ff3eed4a | 685 | #define XFREE(p, h, type) (rtp_free(p)) |
sPymbed | 0:1387ff3eed4a | 686 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
sPymbed | 0:1387ff3eed4a | 687 | |
sPymbed | 0:1387ff3eed4a | 688 | #endif /* EBSNET */ |
sPymbed | 0:1387ff3eed4a | 689 | |
sPymbed | 0:1387ff3eed4a | 690 | #ifdef WOLFSSL_GAME_BUILD |
sPymbed | 0:1387ff3eed4a | 691 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 692 | #if defined(__PPU) || defined(__XENON) |
sPymbed | 0:1387ff3eed4a | 693 | #define BIG_ENDIAN_ORDER |
sPymbed | 0:1387ff3eed4a | 694 | #endif |
sPymbed | 0:1387ff3eed4a | 695 | #endif |
sPymbed | 0:1387ff3eed4a | 696 | |
sPymbed | 0:1387ff3eed4a | 697 | #ifdef WOLFSSL_LSR |
sPymbed | 0:1387ff3eed4a | 698 | #define HAVE_WEBSERVER |
sPymbed | 0:1387ff3eed4a | 699 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 700 | #define WOLFSSL_LOW_MEMORY |
sPymbed | 0:1387ff3eed4a | 701 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 702 | #define NO_SHA512 |
sPymbed | 0:1387ff3eed4a | 703 | #define NO_DH |
sPymbed | 0:1387ff3eed4a | 704 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 705 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 706 | #define NO_DSA |
sPymbed | 0:1387ff3eed4a | 707 | #define NO_HC128 |
sPymbed | 0:1387ff3eed4a | 708 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 709 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 710 | #define NO_RABBIT |
sPymbed | 0:1387ff3eed4a | 711 | #ifndef NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 712 | #define LSR_FS |
sPymbed | 0:1387ff3eed4a | 713 | #include "inc/hw_types.h" |
sPymbed | 0:1387ff3eed4a | 714 | #include "fs.h" |
sPymbed | 0:1387ff3eed4a | 715 | #endif |
sPymbed | 0:1387ff3eed4a | 716 | #define WOLFSSL_LWIP |
sPymbed | 0:1387ff3eed4a | 717 | #include <errno.h> /* for tcp errno */ |
sPymbed | 0:1387ff3eed4a | 718 | #define WOLFSSL_SAFERTOS |
sPymbed | 0:1387ff3eed4a | 719 | #if defined(__IAR_SYSTEMS_ICC__) |
sPymbed | 0:1387ff3eed4a | 720 | /* enum uses enum */ |
sPymbed | 0:1387ff3eed4a | 721 | #pragma diag_suppress=Pa089 |
sPymbed | 0:1387ff3eed4a | 722 | #endif |
sPymbed | 0:1387ff3eed4a | 723 | #endif |
sPymbed | 0:1387ff3eed4a | 724 | |
sPymbed | 0:1387ff3eed4a | 725 | #ifdef WOLFSSL_SAFERTOS |
sPymbed | 0:1387ff3eed4a | 726 | #ifndef SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 727 | #include "SafeRTOS/semphr.h" |
sPymbed | 0:1387ff3eed4a | 728 | #endif |
sPymbed | 0:1387ff3eed4a | 729 | |
sPymbed | 0:1387ff3eed4a | 730 | #include "SafeRTOS/heap.h" |
sPymbed | 0:1387ff3eed4a | 731 | #define XMALLOC(s, h, type) pvPortMalloc((s)) |
sPymbed | 0:1387ff3eed4a | 732 | #define XFREE(p, h, type) vPortFree((p)) |
sPymbed | 0:1387ff3eed4a | 733 | #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) |
sPymbed | 0:1387ff3eed4a | 734 | #endif |
sPymbed | 0:1387ff3eed4a | 735 | |
sPymbed | 0:1387ff3eed4a | 736 | #ifdef WOLFSSL_LOW_MEMORY |
sPymbed | 0:1387ff3eed4a | 737 | #undef RSA_LOW_MEM |
sPymbed | 0:1387ff3eed4a | 738 | #define RSA_LOW_MEM |
sPymbed | 0:1387ff3eed4a | 739 | #undef WOLFSSL_SMALL_STACK |
sPymbed | 0:1387ff3eed4a | 740 | #define WOLFSSL_SMALL_STACK |
sPymbed | 0:1387ff3eed4a | 741 | #undef TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 742 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 743 | #endif |
sPymbed | 0:1387ff3eed4a | 744 | |
sPymbed | 0:1387ff3eed4a | 745 | #ifdef FREESCALE_MQX_4_0 |
sPymbed | 0:1387ff3eed4a | 746 | /* use normal Freescale MQX port, but with minor changes for 4.0 */ |
sPymbed | 0:1387ff3eed4a | 747 | #define FREESCALE_MQX |
sPymbed | 0:1387ff3eed4a | 748 | #endif |
sPymbed | 0:1387ff3eed4a | 749 | |
sPymbed | 0:1387ff3eed4a | 750 | #ifdef FREESCALE_MQX |
sPymbed | 0:1387ff3eed4a | 751 | #define FREESCALE_COMMON |
sPymbed | 0:1387ff3eed4a | 752 | #include "mqx.h" |
sPymbed | 0:1387ff3eed4a | 753 | #ifndef NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 754 | #include "mfs.h" |
sPymbed | 0:1387ff3eed4a | 755 | #if MQX_USE_IO_OLD |
sPymbed | 0:1387ff3eed4a | 756 | #include "fio.h" |
sPymbed | 0:1387ff3eed4a | 757 | #define NO_STDIO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 758 | #else |
sPymbed | 0:1387ff3eed4a | 759 | #include "nio.h" |
sPymbed | 0:1387ff3eed4a | 760 | #endif |
sPymbed | 0:1387ff3eed4a | 761 | #endif |
sPymbed | 0:1387ff3eed4a | 762 | #ifndef SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 763 | #include "mutex.h" |
sPymbed | 0:1387ff3eed4a | 764 | #endif |
sPymbed | 0:1387ff3eed4a | 765 | |
sPymbed | 0:1387ff3eed4a | 766 | #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER) |
sPymbed | 0:1387ff3eed4a | 767 | #define XMALLOC_OVERRIDE |
sPymbed | 0:1387ff3eed4a | 768 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) |
sPymbed | 0:1387ff3eed4a | 769 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} |
sPymbed | 0:1387ff3eed4a | 770 | /* Note: MQX has no realloc, using fastmath above */ |
sPymbed | 0:1387ff3eed4a | 771 | #endif |
sPymbed | 0:1387ff3eed4a | 772 | #endif |
sPymbed | 0:1387ff3eed4a | 773 | |
sPymbed | 0:1387ff3eed4a | 774 | #ifdef FREESCALE_KSDK_MQX |
sPymbed | 0:1387ff3eed4a | 775 | #define FREESCALE_COMMON |
sPymbed | 0:1387ff3eed4a | 776 | #include <mqx.h> |
sPymbed | 0:1387ff3eed4a | 777 | #ifndef NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 778 | #if MQX_USE_IO_OLD |
sPymbed | 0:1387ff3eed4a | 779 | #include <fio.h> |
sPymbed | 0:1387ff3eed4a | 780 | #else |
sPymbed | 0:1387ff3eed4a | 781 | #include <stdio.h> |
sPymbed | 0:1387ff3eed4a | 782 | #include <nio.h> |
sPymbed | 0:1387ff3eed4a | 783 | #endif |
sPymbed | 0:1387ff3eed4a | 784 | #endif |
sPymbed | 0:1387ff3eed4a | 785 | #ifndef SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 786 | #include <mutex.h> |
sPymbed | 0:1387ff3eed4a | 787 | #endif |
sPymbed | 0:1387ff3eed4a | 788 | |
sPymbed | 0:1387ff3eed4a | 789 | #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) |
sPymbed | 0:1387ff3eed4a | 790 | #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} |
sPymbed | 0:1387ff3eed4a | 791 | #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */ |
sPymbed | 0:1387ff3eed4a | 792 | |
sPymbed | 0:1387ff3eed4a | 793 | #define MQX_FILE_PTR FILE * |
sPymbed | 0:1387ff3eed4a | 794 | #define IO_SEEK_SET SEEK_SET |
sPymbed | 0:1387ff3eed4a | 795 | #define IO_SEEK_END SEEK_END |
sPymbed | 0:1387ff3eed4a | 796 | #endif /* FREESCALE_KSDK_MQX */ |
sPymbed | 0:1387ff3eed4a | 797 | |
sPymbed | 0:1387ff3eed4a | 798 | #if defined(FREESCALE_FREE_RTOS) || defined(FREESCALE_KSDK_FREERTOS) |
sPymbed | 0:1387ff3eed4a | 799 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 800 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 801 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 802 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 803 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 804 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 805 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 806 | #define WOLFSSL_CRYPT_HW_MUTEX 1 |
sPymbed | 0:1387ff3eed4a | 807 | |
sPymbed | 0:1387ff3eed4a | 808 | #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) |
sPymbed | 0:1387ff3eed4a | 809 | #define XMALLOC(s, h, type) pvPortMalloc((s)) |
sPymbed | 0:1387ff3eed4a | 810 | #define XFREE(p, h, type) vPortFree((p)) |
sPymbed | 0:1387ff3eed4a | 811 | #endif |
sPymbed | 0:1387ff3eed4a | 812 | |
sPymbed | 0:1387ff3eed4a | 813 | //#define USER_TICKS |
sPymbed | 0:1387ff3eed4a | 814 | /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ |
sPymbed | 0:1387ff3eed4a | 815 | /* WOLFSSL_DH_CONST */ |
sPymbed | 0:1387ff3eed4a | 816 | #define WOLFSSL_LWIP |
sPymbed | 0:1387ff3eed4a | 817 | #define FREERTOS_TCP |
sPymbed | 0:1387ff3eed4a | 818 | |
sPymbed | 0:1387ff3eed4a | 819 | #define FREESCALE_FREE_RTOS |
sPymbed | 0:1387ff3eed4a | 820 | #define FREERTOS_SOCKET_ERROR ( -1 ) |
sPymbed | 0:1387ff3eed4a | 821 | #define FREERTOS_EWOULDBLOCK ( -2 ) |
sPymbed | 0:1387ff3eed4a | 822 | #define FREERTOS_EINVAL ( -4 ) |
sPymbed | 0:1387ff3eed4a | 823 | #define FREERTOS_EADDRNOTAVAIL ( -5 ) |
sPymbed | 0:1387ff3eed4a | 824 | #define FREERTOS_EADDRINUSE ( -6 ) |
sPymbed | 0:1387ff3eed4a | 825 | #define FREERTOS_ENOBUFS ( -7 ) |
sPymbed | 0:1387ff3eed4a | 826 | #define FREERTOS_ENOPROTOOPT ( -8 ) |
sPymbed | 0:1387ff3eed4a | 827 | #endif /* FREESCALE_FREE_RTOS || FREESCALE_KSDK_FREERTOS */ |
sPymbed | 0:1387ff3eed4a | 828 | |
sPymbed | 0:1387ff3eed4a | 829 | #ifdef FREESCALE_KSDK_BM |
sPymbed | 0:1387ff3eed4a | 830 | #define FREESCALE_COMMON |
sPymbed | 0:1387ff3eed4a | 831 | #define WOLFSSL_USER_IO |
sPymbed | 0:1387ff3eed4a | 832 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 833 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 834 | #ifndef TIME_OVERRIDES |
sPymbed | 0:1387ff3eed4a | 835 | #define USER_TICKS |
sPymbed | 0:1387ff3eed4a | 836 | #endif |
sPymbed | 0:1387ff3eed4a | 837 | #endif /* FREESCALE_KSDK_BM */ |
sPymbed | 0:1387ff3eed4a | 838 | |
sPymbed | 0:1387ff3eed4a | 839 | #ifdef FREESCALE_COMMON |
sPymbed | 0:1387ff3eed4a | 840 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 841 | |
sPymbed | 0:1387ff3eed4a | 842 | /* disable features */ |
sPymbed | 0:1387ff3eed4a | 843 | #undef NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 844 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 845 | #undef NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 846 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 847 | #undef NO_RABBIT |
sPymbed | 0:1387ff3eed4a | 848 | #define NO_RABBIT |
sPymbed | 0:1387ff3eed4a | 849 | #undef NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 850 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 851 | #undef NO_RC4 |
sPymbed | 0:1387ff3eed4a | 852 | #define NO_RC4 |
sPymbed | 0:1387ff3eed4a | 853 | |
sPymbed | 0:1387ff3eed4a | 854 | /* enable features */ |
sPymbed | 0:1387ff3eed4a | 855 | #undef USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 856 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 857 | |
sPymbed | 0:1387ff3eed4a | 858 | #define USE_CERT_BUFFERS_2048 |
sPymbed | 0:1387ff3eed4a | 859 | #define BENCH_EMBEDDED |
sPymbed | 0:1387ff3eed4a | 860 | |
sPymbed | 0:1387ff3eed4a | 861 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 862 | #define ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 863 | |
sPymbed | 0:1387ff3eed4a | 864 | #undef HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 865 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 866 | #ifndef NO_AES |
sPymbed | 0:1387ff3eed4a | 867 | #undef HAVE_AESCCM |
sPymbed | 0:1387ff3eed4a | 868 | #define HAVE_AESCCM |
sPymbed | 0:1387ff3eed4a | 869 | #undef HAVE_AESGCM |
sPymbed | 0:1387ff3eed4a | 870 | #define HAVE_AESGCM |
sPymbed | 0:1387ff3eed4a | 871 | #undef WOLFSSL_AES_COUNTER |
sPymbed | 0:1387ff3eed4a | 872 | #define WOLFSSL_AES_COUNTER |
sPymbed | 0:1387ff3eed4a | 873 | #undef WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 874 | #define WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 875 | #endif |
sPymbed | 0:1387ff3eed4a | 876 | |
sPymbed | 0:1387ff3eed4a | 877 | #ifdef FREESCALE_KSDK_1_3 |
sPymbed | 0:1387ff3eed4a | 878 | #include "fsl_device_registers.h" |
sPymbed | 0:1387ff3eed4a | 879 | #elif !defined(FREESCALE_MQX) |
sPymbed | 0:1387ff3eed4a | 880 | /* Classic MQX does not have fsl_common.h */ |
sPymbed | 0:1387ff3eed4a | 881 | #include "fsl_common.h" |
sPymbed | 0:1387ff3eed4a | 882 | #endif |
sPymbed | 0:1387ff3eed4a | 883 | |
sPymbed | 0:1387ff3eed4a | 884 | /* random seed */ |
sPymbed | 0:1387ff3eed4a | 885 | #define NO_OLD_RNGNAME |
sPymbed | 0:1387ff3eed4a | 886 | #if defined(FSL_FEATURE_SOC_TRNG_COUNT) && (FSL_FEATURE_SOC_TRNG_COUNT > 0) |
sPymbed | 0:1387ff3eed4a | 887 | #define FREESCALE_KSDK_2_0_TRNG |
sPymbed | 0:1387ff3eed4a | 888 | #elif defined(FSL_FEATURE_SOC_RNG_COUNT) && (FSL_FEATURE_SOC_RNG_COUNT > 0) |
sPymbed | 0:1387ff3eed4a | 889 | #ifdef FREESCALE_KSDK_1_3 |
sPymbed | 0:1387ff3eed4a | 890 | #include "fsl_rnga_driver.h" |
sPymbed | 0:1387ff3eed4a | 891 | #define FREESCALE_RNGA |
sPymbed | 0:1387ff3eed4a | 892 | #define RNGA_INSTANCE (0) |
sPymbed | 0:1387ff3eed4a | 893 | #else |
sPymbed | 0:1387ff3eed4a | 894 | #define FREESCALE_KSDK_2_0_RNGA |
sPymbed | 0:1387ff3eed4a | 895 | #endif |
sPymbed | 0:1387ff3eed4a | 896 | #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS) && !defined(FREESCALE_KSDK_FREERTOS) |
sPymbed | 0:1387ff3eed4a | 897 | #define FREESCALE_RNGA |
sPymbed | 0:1387ff3eed4a | 898 | #define RNGA_INSTANCE (0) |
sPymbed | 0:1387ff3eed4a | 899 | /* defaulting to K70 RNGA, user should change if different */ |
sPymbed | 0:1387ff3eed4a | 900 | /* #define FREESCALE_K53_RNGB */ |
sPymbed | 0:1387ff3eed4a | 901 | #define FREESCALE_K70_RNGA |
sPymbed | 0:1387ff3eed4a | 902 | #endif |
sPymbed | 0:1387ff3eed4a | 903 | |
sPymbed | 0:1387ff3eed4a | 904 | /* HW crypto */ |
sPymbed | 0:1387ff3eed4a | 905 | /* automatic enable based on Kinetis feature */ |
sPymbed | 0:1387ff3eed4a | 906 | /* if case manual selection is required, for example for benchmarking purposes, |
sPymbed | 0:1387ff3eed4a | 907 | * just define FREESCALE_USE_MMCAU or FREESCALE_USE_LTC or none of these two macros (for software only) |
sPymbed | 0:1387ff3eed4a | 908 | * both can be enabled simultaneously as LTC has priority over MMCAU in source code. |
sPymbed | 0:1387ff3eed4a | 909 | */ |
sPymbed | 0:1387ff3eed4a | 910 | /* #define FSL_HW_CRYPTO_MANUAL_SELECTION */ |
sPymbed | 0:1387ff3eed4a | 911 | #ifndef FSL_HW_CRYPTO_MANUAL_SELECTION |
sPymbed | 0:1387ff3eed4a | 912 | #if defined(FSL_FEATURE_SOC_MMCAU_COUNT) && FSL_FEATURE_SOC_MMCAU_COUNT |
sPymbed | 0:1387ff3eed4a | 913 | #define FREESCALE_USE_MMCAU |
sPymbed | 0:1387ff3eed4a | 914 | #endif |
sPymbed | 0:1387ff3eed4a | 915 | |
sPymbed | 0:1387ff3eed4a | 916 | #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT |
sPymbed | 0:1387ff3eed4a | 917 | #define FREESCALE_USE_LTC |
sPymbed | 0:1387ff3eed4a | 918 | #endif |
sPymbed | 0:1387ff3eed4a | 919 | #else |
sPymbed | 0:1387ff3eed4a | 920 | /* #define FREESCALE_USE_MMCAU */ |
sPymbed | 0:1387ff3eed4a | 921 | /* #define FREESCALE_USE_LTC */ |
sPymbed | 0:1387ff3eed4a | 922 | #endif |
sPymbed | 0:1387ff3eed4a | 923 | #endif /* FREESCALE_COMMON */ |
sPymbed | 0:1387ff3eed4a | 924 | |
sPymbed | 0:1387ff3eed4a | 925 | /* Classic pre-KSDK mmCAU library */ |
sPymbed | 0:1387ff3eed4a | 926 | #ifdef FREESCALE_USE_MMCAU_CLASSIC |
sPymbed | 0:1387ff3eed4a | 927 | #define FREESCALE_USE_MMCAU |
sPymbed | 0:1387ff3eed4a | 928 | #define FREESCALE_MMCAU_CLASSIC |
sPymbed | 0:1387ff3eed4a | 929 | #define FREESCALE_MMCAU_CLASSIC_SHA |
sPymbed | 0:1387ff3eed4a | 930 | #endif |
sPymbed | 0:1387ff3eed4a | 931 | |
sPymbed | 0:1387ff3eed4a | 932 | /* KSDK mmCAU library */ |
sPymbed | 0:1387ff3eed4a | 933 | #ifdef FREESCALE_USE_MMCAU |
sPymbed | 0:1387ff3eed4a | 934 | /* AES and DES */ |
sPymbed | 0:1387ff3eed4a | 935 | #define FREESCALE_MMCAU |
sPymbed | 0:1387ff3eed4a | 936 | /* MD5, SHA-1 and SHA-256 */ |
sPymbed | 0:1387ff3eed4a | 937 | #define FREESCALE_MMCAU_SHA |
sPymbed | 0:1387ff3eed4a | 938 | #endif /* FREESCALE_USE_MMCAU */ |
sPymbed | 0:1387ff3eed4a | 939 | |
sPymbed | 0:1387ff3eed4a | 940 | #ifdef FREESCALE_USE_LTC |
sPymbed | 0:1387ff3eed4a | 941 | #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT |
sPymbed | 0:1387ff3eed4a | 942 | #define FREESCALE_LTC |
sPymbed | 0:1387ff3eed4a | 943 | #define LTC_BASE LTC0 |
sPymbed | 0:1387ff3eed4a | 944 | |
sPymbed | 0:1387ff3eed4a | 945 | #if defined(FSL_FEATURE_LTC_HAS_DES) && FSL_FEATURE_LTC_HAS_DES |
sPymbed | 0:1387ff3eed4a | 946 | #define FREESCALE_LTC_DES |
sPymbed | 0:1387ff3eed4a | 947 | #endif |
sPymbed | 0:1387ff3eed4a | 948 | |
sPymbed | 0:1387ff3eed4a | 949 | #if defined(FSL_FEATURE_LTC_HAS_GCM) && FSL_FEATURE_LTC_HAS_GCM |
sPymbed | 0:1387ff3eed4a | 950 | #define FREESCALE_LTC_AES_GCM |
sPymbed | 0:1387ff3eed4a | 951 | #endif |
sPymbed | 0:1387ff3eed4a | 952 | |
sPymbed | 0:1387ff3eed4a | 953 | #if defined(FSL_FEATURE_LTC_HAS_SHA) && FSL_FEATURE_LTC_HAS_SHA |
sPymbed | 0:1387ff3eed4a | 954 | #define FREESCALE_LTC_SHA |
sPymbed | 0:1387ff3eed4a | 955 | #endif |
sPymbed | 0:1387ff3eed4a | 956 | |
sPymbed | 0:1387ff3eed4a | 957 | #if defined(FSL_FEATURE_LTC_HAS_PKHA) && FSL_FEATURE_LTC_HAS_PKHA |
sPymbed | 0:1387ff3eed4a | 958 | #define FREESCALE_LTC_ECC |
sPymbed | 0:1387ff3eed4a | 959 | #define FREESCALE_LTC_TFM |
sPymbed | 0:1387ff3eed4a | 960 | |
sPymbed | 0:1387ff3eed4a | 961 | /* the LTC PKHA hardware limit is 2048 bits (256 bytes) for integer arithmetic. |
sPymbed | 0:1387ff3eed4a | 962 | the LTC_MAX_INT_BYTES defines the size of local variables that hold big integers. */ |
sPymbed | 0:1387ff3eed4a | 963 | #ifndef LTC_MAX_INT_BYTES |
sPymbed | 0:1387ff3eed4a | 964 | #define LTC_MAX_INT_BYTES (256) |
sPymbed | 0:1387ff3eed4a | 965 | #endif |
sPymbed | 0:1387ff3eed4a | 966 | |
sPymbed | 0:1387ff3eed4a | 967 | /* This FREESCALE_LTC_TFM_RSA_4096_ENABLE macro can be defined. |
sPymbed | 0:1387ff3eed4a | 968 | * In such a case both software and hardware algorithm |
sPymbed | 0:1387ff3eed4a | 969 | * for TFM is linked in. The decision for which algorithm is used is determined at runtime |
sPymbed | 0:1387ff3eed4a | 970 | * from size of inputs. If inputs and result can fit into LTC (see LTC_MAX_INT_BYTES) |
sPymbed | 0:1387ff3eed4a | 971 | * then we call hardware algorithm, otherwise we call software algorithm. |
sPymbed | 0:1387ff3eed4a | 972 | * |
sPymbed | 0:1387ff3eed4a | 973 | * Chinese reminder theorem is used to break RSA 4096 exponentiations (both public and private key) |
sPymbed | 0:1387ff3eed4a | 974 | * into several computations with 2048-bit modulus and exponents. |
sPymbed | 0:1387ff3eed4a | 975 | */ |
sPymbed | 0:1387ff3eed4a | 976 | /* #define FREESCALE_LTC_TFM_RSA_4096_ENABLE */ |
sPymbed | 0:1387ff3eed4a | 977 | |
sPymbed | 0:1387ff3eed4a | 978 | /* ECC-384, ECC-256, ECC-224 and ECC-192 have been enabled with LTC PKHA acceleration */ |
sPymbed | 0:1387ff3eed4a | 979 | #ifdef HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 980 | #undef ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 981 | #define ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 982 | |
sPymbed | 0:1387ff3eed4a | 983 | /* the LTC PKHA hardware limit is 512 bits (64 bytes) for ECC. |
sPymbed | 0:1387ff3eed4a | 984 | the LTC_MAX_ECC_BITS defines the size of local variables that hold ECC parameters |
sPymbed | 0:1387ff3eed4a | 985 | and point coordinates */ |
sPymbed | 0:1387ff3eed4a | 986 | #ifndef LTC_MAX_ECC_BITS |
sPymbed | 0:1387ff3eed4a | 987 | #define LTC_MAX_ECC_BITS (384) |
sPymbed | 0:1387ff3eed4a | 988 | #endif |
sPymbed | 0:1387ff3eed4a | 989 | |
sPymbed | 0:1387ff3eed4a | 990 | /* Enable curves up to 384 bits */ |
sPymbed | 0:1387ff3eed4a | 991 | #if !defined(ECC_USER_CURVES) && !defined(HAVE_ALL_CURVES) |
sPymbed | 0:1387ff3eed4a | 992 | #define ECC_USER_CURVES |
sPymbed | 0:1387ff3eed4a | 993 | #define HAVE_ECC192 |
sPymbed | 0:1387ff3eed4a | 994 | #define HAVE_ECC224 |
sPymbed | 0:1387ff3eed4a | 995 | #undef NO_ECC256 |
sPymbed | 0:1387ff3eed4a | 996 | #define HAVE_ECC384 |
sPymbed | 0:1387ff3eed4a | 997 | #endif |
sPymbed | 0:1387ff3eed4a | 998 | |
sPymbed | 0:1387ff3eed4a | 999 | /* enable features */ |
sPymbed | 0:1387ff3eed4a | 1000 | #undef HAVE_CURVE25519 |
sPymbed | 0:1387ff3eed4a | 1001 | #define HAVE_CURVE25519 |
sPymbed | 0:1387ff3eed4a | 1002 | #undef HAVE_ED25519 |
sPymbed | 0:1387ff3eed4a | 1003 | #define HAVE_ED25519 |
sPymbed | 0:1387ff3eed4a | 1004 | #undef WOLFSSL_SHA512 |
sPymbed | 0:1387ff3eed4a | 1005 | #define WOLFSSL_SHA512 |
sPymbed | 0:1387ff3eed4a | 1006 | #endif |
sPymbed | 0:1387ff3eed4a | 1007 | #endif |
sPymbed | 0:1387ff3eed4a | 1008 | #endif |
sPymbed | 0:1387ff3eed4a | 1009 | #endif /* FREESCALE_USE_LTC */ |
sPymbed | 0:1387ff3eed4a | 1010 | |
sPymbed | 0:1387ff3eed4a | 1011 | #ifdef FREESCALE_LTC_TFM_RSA_4096_ENABLE |
sPymbed | 0:1387ff3eed4a | 1012 | #undef USE_CERT_BUFFERS_4096 |
sPymbed | 0:1387ff3eed4a | 1013 | #define USE_CERT_BUFFERS_4096 |
sPymbed | 0:1387ff3eed4a | 1014 | #undef FP_MAX_BITS |
sPymbed | 0:1387ff3eed4a | 1015 | #define FP_MAX_BITS (8192) |
sPymbed | 0:1387ff3eed4a | 1016 | |
sPymbed | 0:1387ff3eed4a | 1017 | #undef NO_DH |
sPymbed | 0:1387ff3eed4a | 1018 | #define NO_DH |
sPymbed | 0:1387ff3eed4a | 1019 | #undef NO_DSA |
sPymbed | 0:1387ff3eed4a | 1020 | #define NO_DSA |
sPymbed | 0:1387ff3eed4a | 1021 | #endif /* FREESCALE_LTC_TFM_RSA_4096_ENABLE */ |
sPymbed | 0:1387ff3eed4a | 1022 | |
sPymbed | 0:1387ff3eed4a | 1023 | /* if LTC has AES engine but doesn't have GCM, use software with LTC AES ECB mode */ |
sPymbed | 0:1387ff3eed4a | 1024 | #if defined(FREESCALE_USE_LTC) && !defined(FREESCALE_LTC_AES_GCM) |
sPymbed | 0:1387ff3eed4a | 1025 | #define GCM_TABLE |
sPymbed | 0:1387ff3eed4a | 1026 | #endif |
sPymbed | 0:1387ff3eed4a | 1027 | |
sPymbed | 0:1387ff3eed4a | 1028 | #if defined(WOLFSSL_STM32F2) || defined(WOLFSSL_STM32F4) || \ |
sPymbed | 0:1387ff3eed4a | 1029 | defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32F1) || \ |
sPymbed | 0:1387ff3eed4a | 1030 | defined(WOLFSSL_STM32L4) |
sPymbed | 0:1387ff3eed4a | 1031 | |
sPymbed | 0:1387ff3eed4a | 1032 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 1033 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 1034 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 1035 | #undef NO_RABBIT |
sPymbed | 0:1387ff3eed4a | 1036 | #define NO_RABBIT |
sPymbed | 0:1387ff3eed4a | 1037 | #ifndef NO_STM32_RNG |
sPymbed | 0:1387ff3eed4a | 1038 | #undef STM32_RNG |
sPymbed | 0:1387ff3eed4a | 1039 | #define STM32_RNG |
sPymbed | 0:1387ff3eed4a | 1040 | #ifdef WOLFSSL_STM32F427_RNG |
sPymbed | 0:1387ff3eed4a | 1041 | #include "stm32f427xx.h" |
sPymbed | 0:1387ff3eed4a | 1042 | #endif |
sPymbed | 0:1387ff3eed4a | 1043 | #endif |
sPymbed | 0:1387ff3eed4a | 1044 | #ifndef NO_STM32_CRYPTO |
sPymbed | 0:1387ff3eed4a | 1045 | #undef STM32_CRYPTO |
sPymbed | 0:1387ff3eed4a | 1046 | #define STM32_CRYPTO |
sPymbed | 0:1387ff3eed4a | 1047 | #endif |
sPymbed | 0:1387ff3eed4a | 1048 | #ifndef NO_STM32_HASH |
sPymbed | 0:1387ff3eed4a | 1049 | #undef STM32_HASH |
sPymbed | 0:1387ff3eed4a | 1050 | #define STM32_HASH |
sPymbed | 0:1387ff3eed4a | 1051 | #endif |
sPymbed | 0:1387ff3eed4a | 1052 | #if !defined(__GNUC__) && !defined(__ICCARM__) |
sPymbed | 0:1387ff3eed4a | 1053 | #define KEIL_INTRINSICS |
sPymbed | 0:1387ff3eed4a | 1054 | #endif |
sPymbed | 0:1387ff3eed4a | 1055 | #define NO_OLD_RNGNAME |
sPymbed | 0:1387ff3eed4a | 1056 | #ifdef WOLFSSL_STM32_CUBEMX |
sPymbed | 0:1387ff3eed4a | 1057 | #if defined(WOLFSSL_STM32F2) |
sPymbed | 0:1387ff3eed4a | 1058 | #include "stm32f2xx_hal.h" |
sPymbed | 0:1387ff3eed4a | 1059 | #elif defined(WOLFSSL_STM32L4) |
sPymbed | 0:1387ff3eed4a | 1060 | #include "stm32l4xx_hal.h" |
sPymbed | 0:1387ff3eed4a | 1061 | #elif defined(WOLFSSL_STM32F4) |
sPymbed | 0:1387ff3eed4a | 1062 | #include "stm32f4xx_hal.h" |
sPymbed | 0:1387ff3eed4a | 1063 | #elif defined(WOLFSSL_STM32F7) |
sPymbed | 0:1387ff3eed4a | 1064 | #include "stm32f7xx_hal.h" |
sPymbed | 0:1387ff3eed4a | 1065 | #elif defined(WOLFSSL_STM32F1) |
sPymbed | 0:1387ff3eed4a | 1066 | #include "stm32f1xx_hal.h" |
sPymbed | 0:1387ff3eed4a | 1067 | #endif |
sPymbed | 0:1387ff3eed4a | 1068 | |
sPymbed | 0:1387ff3eed4a | 1069 | #ifndef STM32_HAL_TIMEOUT |
sPymbed | 0:1387ff3eed4a | 1070 | #define STM32_HAL_TIMEOUT 0xFF |
sPymbed | 0:1387ff3eed4a | 1071 | #endif |
sPymbed | 0:1387ff3eed4a | 1072 | #else |
sPymbed | 0:1387ff3eed4a | 1073 | #if defined(WOLFSSL_STM32F2) |
sPymbed | 0:1387ff3eed4a | 1074 | #include "stm32f2xx.h" |
sPymbed | 0:1387ff3eed4a | 1075 | #ifdef STM32_CRYPTO |
sPymbed | 0:1387ff3eed4a | 1076 | #include "stm32f2xx_cryp.h" |
sPymbed | 0:1387ff3eed4a | 1077 | #endif |
sPymbed | 0:1387ff3eed4a | 1078 | #ifdef STM32_HASH |
sPymbed | 0:1387ff3eed4a | 1079 | #include "stm32f2xx_hash.h" |
sPymbed | 0:1387ff3eed4a | 1080 | #endif |
sPymbed | 0:1387ff3eed4a | 1081 | #elif defined(WOLFSSL_STM32F4) |
sPymbed | 0:1387ff3eed4a | 1082 | #include "stm32f4xx.h" |
sPymbed | 0:1387ff3eed4a | 1083 | #ifdef STM32_CRYPTO |
sPymbed | 0:1387ff3eed4a | 1084 | #include "stm32f4xx_cryp.h" |
sPymbed | 0:1387ff3eed4a | 1085 | #endif |
sPymbed | 0:1387ff3eed4a | 1086 | #ifdef STM32_HASH |
sPymbed | 0:1387ff3eed4a | 1087 | #include "stm32f4xx_hash.h" |
sPymbed | 0:1387ff3eed4a | 1088 | #endif |
sPymbed | 0:1387ff3eed4a | 1089 | #elif defined(WOLFSSL_STM32L4) |
sPymbed | 0:1387ff3eed4a | 1090 | #include "stm32l4xx.h" |
sPymbed | 0:1387ff3eed4a | 1091 | #ifdef STM32_CRYPTO |
sPymbed | 0:1387ff3eed4a | 1092 | #include "stm32l4xx_cryp.h" |
sPymbed | 0:1387ff3eed4a | 1093 | #endif |
sPymbed | 0:1387ff3eed4a | 1094 | #ifdef STM32_HASH |
sPymbed | 0:1387ff3eed4a | 1095 | #include "stm32l4xx_hash.h" |
sPymbed | 0:1387ff3eed4a | 1096 | #endif |
sPymbed | 0:1387ff3eed4a | 1097 | #elif defined(WOLFSSL_STM32F7) |
sPymbed | 0:1387ff3eed4a | 1098 | #include "stm32f7xx.h" |
sPymbed | 0:1387ff3eed4a | 1099 | #elif defined(WOLFSSL_STM32F1) |
sPymbed | 0:1387ff3eed4a | 1100 | #include "stm32f1xx.h" |
sPymbed | 0:1387ff3eed4a | 1101 | #endif |
sPymbed | 0:1387ff3eed4a | 1102 | #endif /* WOLFSSL_STM32_CUBEMX */ |
sPymbed | 0:1387ff3eed4a | 1103 | #endif /* WOLFSSL_STM32F2 || WOLFSSL_STM32F4 || WOLFSSL_STM32F7 */ |
sPymbed | 0:1387ff3eed4a | 1104 | |
sPymbed | 0:1387ff3eed4a | 1105 | #ifdef MICRIUM |
sPymbed | 0:1387ff3eed4a | 1106 | #include <stdlib.h> |
sPymbed | 0:1387ff3eed4a | 1107 | #include <os.h> |
sPymbed | 0:1387ff3eed4a | 1108 | #include <net_cfg.h> |
sPymbed | 0:1387ff3eed4a | 1109 | #include <net_sock.h> |
sPymbed | 0:1387ff3eed4a | 1110 | #include <net_err.h> |
sPymbed | 0:1387ff3eed4a | 1111 | #include <lib_mem.h> |
sPymbed | 0:1387ff3eed4a | 1112 | #include <lib_math.h> |
sPymbed | 0:1387ff3eed4a | 1113 | |
sPymbed | 0:1387ff3eed4a | 1114 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 1115 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 1116 | #define ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 1117 | #define WC_RSA_BLINDING |
sPymbed | 0:1387ff3eed4a | 1118 | #define HAVE_HASHDRBG |
sPymbed | 0:1387ff3eed4a | 1119 | |
sPymbed | 0:1387ff3eed4a | 1120 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 1121 | #define ALT_ECC_SIZE |
sPymbed | 0:1387ff3eed4a | 1122 | #define TFM_ECC192 |
sPymbed | 0:1387ff3eed4a | 1123 | #define TFM_ECC224 |
sPymbed | 0:1387ff3eed4a | 1124 | #define TFM_ECC256 |
sPymbed | 0:1387ff3eed4a | 1125 | #define TFM_ECC384 |
sPymbed | 0:1387ff3eed4a | 1126 | #define TFM_ECC521 |
sPymbed | 0:1387ff3eed4a | 1127 | |
sPymbed | 0:1387ff3eed4a | 1128 | #define NO_RC4 |
sPymbed | 0:1387ff3eed4a | 1129 | #define HAVE_TLS_EXTENSIONS |
sPymbed | 0:1387ff3eed4a | 1130 | #define HAVE_SUPPORTED_CURVES |
sPymbed | 0:1387ff3eed4a | 1131 | #define HAVE_EXTENDED_MASTER |
sPymbed | 0:1387ff3eed4a | 1132 | |
sPymbed | 0:1387ff3eed4a | 1133 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 1134 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 1135 | |
sPymbed | 0:1387ff3eed4a | 1136 | #ifndef CUSTOM_RAND_GENERATE |
sPymbed | 0:1387ff3eed4a | 1137 | #define CUSTOM_RAND_TYPE RAND_NBR |
sPymbed | 0:1387ff3eed4a | 1138 | #define CUSTOM_RAND_GENERATE Math_Rand |
sPymbed | 0:1387ff3eed4a | 1139 | #endif |
sPymbed | 0:1387ff3eed4a | 1140 | |
sPymbed | 0:1387ff3eed4a | 1141 | #define WOLFSSL_TYPES |
sPymbed | 0:1387ff3eed4a | 1142 | typedef CPU_INT08U byte; |
sPymbed | 0:1387ff3eed4a | 1143 | typedef CPU_INT16U word16; |
sPymbed | 0:1387ff3eed4a | 1144 | typedef CPU_INT32U word32; |
sPymbed | 0:1387ff3eed4a | 1145 | |
sPymbed | 0:1387ff3eed4a | 1146 | #define STRING_USER |
sPymbed | 0:1387ff3eed4a | 1147 | #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) |
sPymbed | 0:1387ff3eed4a | 1148 | #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ |
sPymbed | 0:1387ff3eed4a | 1149 | ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ |
sPymbed | 0:1387ff3eed4a | 1150 | (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) |
sPymbed | 0:1387ff3eed4a | 1151 | #define XSTRNCMP(pstr_1, pstr_2, len_max) \ |
sPymbed | 0:1387ff3eed4a | 1152 | ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ |
sPymbed | 0:1387ff3eed4a | 1153 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) |
sPymbed | 0:1387ff3eed4a | 1154 | #define XSTRNCASECMP(pstr_1, pstr_2, len_max) \ |
sPymbed | 0:1387ff3eed4a | 1155 | ((CPU_INT16S)Str_CmpIgnoreCase_N((CPU_CHAR *)(pstr_1), \ |
sPymbed | 0:1387ff3eed4a | 1156 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) |
sPymbed | 0:1387ff3eed4a | 1157 | #define XSTRSTR(pstr, pstr_srch) \ |
sPymbed | 0:1387ff3eed4a | 1158 | ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ |
sPymbed | 0:1387ff3eed4a | 1159 | (CPU_CHAR *)(pstr_srch))) |
sPymbed | 0:1387ff3eed4a | 1160 | #define XSTRNSTR(pstr, pstr_srch, len_max) \ |
sPymbed | 0:1387ff3eed4a | 1161 | ((CPU_CHAR *)Str_Str_N((CPU_CHAR *)(pstr), \ |
sPymbed | 0:1387ff3eed4a | 1162 | (CPU_CHAR *)(pstr_srch),(CPU_SIZE_T)(len_max))) |
sPymbed | 0:1387ff3eed4a | 1163 | #define XSTRNCAT(pstr_dest, pstr_cat, len_max) \ |
sPymbed | 0:1387ff3eed4a | 1164 | ((CPU_CHAR *)Str_Cat_N((CPU_CHAR *)(pstr_dest), \ |
sPymbed | 0:1387ff3eed4a | 1165 | (const CPU_CHAR *)(pstr_cat),(CPU_SIZE_T)(len_max))) |
sPymbed | 0:1387ff3eed4a | 1166 | #define XMEMSET(pmem, data_val, size) \ |
sPymbed | 0:1387ff3eed4a | 1167 | ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ |
sPymbed | 0:1387ff3eed4a | 1168 | (CPU_SIZE_T)(size))) |
sPymbed | 0:1387ff3eed4a | 1169 | #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ |
sPymbed | 0:1387ff3eed4a | 1170 | (void *)(psrc), (CPU_SIZE_T)(size))) |
sPymbed | 0:1387ff3eed4a | 1171 | #define XMEMCMP(pmem_1, pmem_2, size) \ |
sPymbed | 0:1387ff3eed4a | 1172 | (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ |
sPymbed | 0:1387ff3eed4a | 1173 | (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) |
sPymbed | 0:1387ff3eed4a | 1174 | #define XMEMMOVE XMEMCPY |
sPymbed | 0:1387ff3eed4a | 1175 | |
sPymbed | 0:1387ff3eed4a | 1176 | #if (OS_CFG_MUTEX_EN == DEF_DISABLED) |
sPymbed | 0:1387ff3eed4a | 1177 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 1178 | #endif |
sPymbed | 0:1387ff3eed4a | 1179 | |
sPymbed | 0:1387ff3eed4a | 1180 | #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) |
sPymbed | 0:1387ff3eed4a | 1181 | #define BIG_ENDIAN_ORDER |
sPymbed | 0:1387ff3eed4a | 1182 | #else |
sPymbed | 0:1387ff3eed4a | 1183 | #undef BIG_ENDIAN_ORDER |
sPymbed | 0:1387ff3eed4a | 1184 | #define LITTLE_ENDIAN_ORDER |
sPymbed | 0:1387ff3eed4a | 1185 | #endif |
sPymbed | 0:1387ff3eed4a | 1186 | #endif /* MICRIUM */ |
sPymbed | 0:1387ff3eed4a | 1187 | |
sPymbed | 0:1387ff3eed4a | 1188 | |
sPymbed | 0:1387ff3eed4a | 1189 | #ifdef WOLFSSL_QL |
sPymbed | 0:1387ff3eed4a | 1190 | #ifndef WOLFSSL_SEP |
sPymbed | 0:1387ff3eed4a | 1191 | #define WOLFSSL_SEP |
sPymbed | 0:1387ff3eed4a | 1192 | #endif |
sPymbed | 0:1387ff3eed4a | 1193 | #ifndef OPENSSL_EXTRA |
sPymbed | 0:1387ff3eed4a | 1194 | #define OPENSSL_EXTRA |
sPymbed | 0:1387ff3eed4a | 1195 | #endif |
sPymbed | 0:1387ff3eed4a | 1196 | #ifndef SESSION_CERTS |
sPymbed | 0:1387ff3eed4a | 1197 | #define SESSION_CERTS |
sPymbed | 0:1387ff3eed4a | 1198 | #endif |
sPymbed | 0:1387ff3eed4a | 1199 | #ifndef HAVE_AESCCM |
sPymbed | 0:1387ff3eed4a | 1200 | #define HAVE_AESCCM |
sPymbed | 0:1387ff3eed4a | 1201 | #endif |
sPymbed | 0:1387ff3eed4a | 1202 | #ifndef ATOMIC_USER |
sPymbed | 0:1387ff3eed4a | 1203 | #define ATOMIC_USER |
sPymbed | 0:1387ff3eed4a | 1204 | #endif |
sPymbed | 0:1387ff3eed4a | 1205 | #ifndef WOLFSSL_DER_LOAD |
sPymbed | 0:1387ff3eed4a | 1206 | #define WOLFSSL_DER_LOAD |
sPymbed | 0:1387ff3eed4a | 1207 | #endif |
sPymbed | 0:1387ff3eed4a | 1208 | #ifndef KEEP_PEER_CERT |
sPymbed | 0:1387ff3eed4a | 1209 | #define KEEP_PEER_CERT |
sPymbed | 0:1387ff3eed4a | 1210 | #endif |
sPymbed | 0:1387ff3eed4a | 1211 | #ifndef HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 1212 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 1213 | #endif |
sPymbed | 0:1387ff3eed4a | 1214 | #ifndef SESSION_INDEX |
sPymbed | 0:1387ff3eed4a | 1215 | #define SESSION_INDEX |
sPymbed | 0:1387ff3eed4a | 1216 | #endif |
sPymbed | 0:1387ff3eed4a | 1217 | #endif /* WOLFSSL_QL */ |
sPymbed | 0:1387ff3eed4a | 1218 | |
sPymbed | 0:1387ff3eed4a | 1219 | |
sPymbed | 0:1387ff3eed4a | 1220 | #if defined(WOLFSSL_XILINX) |
sPymbed | 0:1387ff3eed4a | 1221 | #define USER_TIME /* XTIME in asn.c */ |
sPymbed | 0:1387ff3eed4a | 1222 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 1223 | #define NO_DEV_RANDOM |
sPymbed | 0:1387ff3eed4a | 1224 | #define HAVE_AESGCM |
sPymbed | 0:1387ff3eed4a | 1225 | #endif |
sPymbed | 0:1387ff3eed4a | 1226 | |
sPymbed | 0:1387ff3eed4a | 1227 | #if defined(WOLFSSL_XILINX_CRYPT) |
sPymbed | 0:1387ff3eed4a | 1228 | #if defined(WOLFSSL_ARMASM) |
sPymbed | 0:1387ff3eed4a | 1229 | #error can not use both ARMv8 instructions and XILINX hardened crypto |
sPymbed | 0:1387ff3eed4a | 1230 | #endif |
sPymbed | 0:1387ff3eed4a | 1231 | #if defined(WOLFSSL_SHA3) |
sPymbed | 0:1387ff3eed4a | 1232 | /* only SHA3-384 is supported */ |
sPymbed | 0:1387ff3eed4a | 1233 | #undef WOLFSSL_NOSHA3_224 |
sPymbed | 0:1387ff3eed4a | 1234 | #undef WOLFSSL_NOSHA3_256 |
sPymbed | 0:1387ff3eed4a | 1235 | #undef WOLFSSL_NOSHA3_512 |
sPymbed | 0:1387ff3eed4a | 1236 | #define WOLFSSL_NOSHA3_224 |
sPymbed | 0:1387ff3eed4a | 1237 | #define WOLFSSL_NOSHA3_256 |
sPymbed | 0:1387ff3eed4a | 1238 | #define WOLFSSL_NOSHA3_512 |
sPymbed | 0:1387ff3eed4a | 1239 | #endif |
sPymbed | 0:1387ff3eed4a | 1240 | #endif /*(WOLFSSL_XILINX_CRYPT)*/ |
sPymbed | 0:1387ff3eed4a | 1241 | |
sPymbed | 0:1387ff3eed4a | 1242 | #ifdef WOLFSSL_IMX6 |
sPymbed | 0:1387ff3eed4a | 1243 | #ifndef SIZEOF_LONG_LONG |
sPymbed | 0:1387ff3eed4a | 1244 | #define SIZEOF_LONG_LONG 8 |
sPymbed | 0:1387ff3eed4a | 1245 | #endif |
sPymbed | 0:1387ff3eed4a | 1246 | #endif |
sPymbed | 0:1387ff3eed4a | 1247 | |
sPymbed | 0:1387ff3eed4a | 1248 | /* if defined turn on all CAAM support */ |
sPymbed | 0:1387ff3eed4a | 1249 | #ifdef WOLFSSL_IMX6_CAAM |
sPymbed | 0:1387ff3eed4a | 1250 | #undef WOLFSSL_IMX6_CAAM_RNG |
sPymbed | 0:1387ff3eed4a | 1251 | #define WOLFSSL_IMX6_CAAM_RNG |
sPymbed | 0:1387ff3eed4a | 1252 | |
sPymbed | 0:1387ff3eed4a | 1253 | #undef WOLFSSL_IMX6_CAAM_BLOB |
sPymbed | 0:1387ff3eed4a | 1254 | #define WOLFSSL_IMX6_CAAM_BLOB |
sPymbed | 0:1387ff3eed4a | 1255 | |
sPymbed | 0:1387ff3eed4a | 1256 | #if defined(HAVE_AESGCM) || defined(WOLFSSL_AES_XTS) |
sPymbed | 0:1387ff3eed4a | 1257 | /* large performance gain with HAVE_AES_ECB defined */ |
sPymbed | 0:1387ff3eed4a | 1258 | #undef HAVE_AES_ECB |
sPymbed | 0:1387ff3eed4a | 1259 | #define HAVE_AES_ECB |
sPymbed | 0:1387ff3eed4a | 1260 | #endif |
sPymbed | 0:1387ff3eed4a | 1261 | #endif |
sPymbed | 0:1387ff3eed4a | 1262 | |
sPymbed | 0:1387ff3eed4a | 1263 | #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ |
sPymbed | 0:1387ff3eed4a | 1264 | !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) && \ |
sPymbed | 0:1387ff3eed4a | 1265 | !defined(XMALLOC_OVERRIDE) |
sPymbed | 0:1387ff3eed4a | 1266 | #define USE_WOLFSSL_MEMORY |
sPymbed | 0:1387ff3eed4a | 1267 | #endif |
sPymbed | 0:1387ff3eed4a | 1268 | |
sPymbed | 0:1387ff3eed4a | 1269 | |
sPymbed | 0:1387ff3eed4a | 1270 | #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) |
sPymbed | 0:1387ff3eed4a | 1271 | #undef KEEP_PEER_CERT |
sPymbed | 0:1387ff3eed4a | 1272 | #define KEEP_PEER_CERT |
sPymbed | 0:1387ff3eed4a | 1273 | #endif |
sPymbed | 0:1387ff3eed4a | 1274 | |
sPymbed | 0:1387ff3eed4a | 1275 | |
sPymbed | 0:1387ff3eed4a | 1276 | /* stream ciphers except arc4 need 32bit alignment, intel ok without */ |
sPymbed | 0:1387ff3eed4a | 1277 | #ifndef XSTREAM_ALIGN |
sPymbed | 0:1387ff3eed4a | 1278 | #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) |
sPymbed | 0:1387ff3eed4a | 1279 | #define NO_XSTREAM_ALIGN |
sPymbed | 0:1387ff3eed4a | 1280 | #else |
sPymbed | 0:1387ff3eed4a | 1281 | #define XSTREAM_ALIGN |
sPymbed | 0:1387ff3eed4a | 1282 | #endif |
sPymbed | 0:1387ff3eed4a | 1283 | #endif |
sPymbed | 0:1387ff3eed4a | 1284 | |
sPymbed | 0:1387ff3eed4a | 1285 | /* write dup cannot be used with secure renegotiation because write dup |
sPymbed | 0:1387ff3eed4a | 1286 | * make write side write only and read side read only */ |
sPymbed | 0:1387ff3eed4a | 1287 | #if defined(HAVE_WRITE_DUP) && defined(HAVE_SECURE_RENEGOTIATION) |
sPymbed | 0:1387ff3eed4a | 1288 | #error "WRITE DUP and SECURE RENEGOTIATION cannot both be on" |
sPymbed | 0:1387ff3eed4a | 1289 | #endif |
sPymbed | 0:1387ff3eed4a | 1290 | |
sPymbed | 0:1387ff3eed4a | 1291 | #ifdef WOLFSSL_SGX |
sPymbed | 0:1387ff3eed4a | 1292 | #ifdef _MSC_VER |
sPymbed | 0:1387ff3eed4a | 1293 | #define NO_RC4 |
sPymbed | 0:1387ff3eed4a | 1294 | #ifndef HAVE_FIPS |
sPymbed | 0:1387ff3eed4a | 1295 | #define WOLFCRYPT_ONLY |
sPymbed | 0:1387ff3eed4a | 1296 | #define NO_DES3 |
sPymbed | 0:1387ff3eed4a | 1297 | #define NO_SHA |
sPymbed | 0:1387ff3eed4a | 1298 | #define NO_MD5 |
sPymbed | 0:1387ff3eed4a | 1299 | #else |
sPymbed | 0:1387ff3eed4a | 1300 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 1301 | #define NO_WOLFSSL_DIR |
sPymbed | 0:1387ff3eed4a | 1302 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 1303 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 1304 | #define WOLFSSL_LOG_PRINTF |
sPymbed | 0:1387ff3eed4a | 1305 | #define WOLFSSL_DH_CONST |
sPymbed | 0:1387ff3eed4a | 1306 | #endif |
sPymbed | 0:1387ff3eed4a | 1307 | #else |
sPymbed | 0:1387ff3eed4a | 1308 | #define HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 1309 | #define NO_WRITEV |
sPymbed | 0:1387ff3eed4a | 1310 | #define NO_MAIN_DRIVER |
sPymbed | 0:1387ff3eed4a | 1311 | #define USER_TICKS |
sPymbed | 0:1387ff3eed4a | 1312 | #define WOLFSSL_LOG_PRINTF |
sPymbed | 0:1387ff3eed4a | 1313 | #define WOLFSSL_DH_CONST |
sPymbed | 0:1387ff3eed4a | 1314 | #endif /* _MSC_VER */ |
sPymbed | 0:1387ff3eed4a | 1315 | #if !defined(HAVE_FIPS) && !defined(NO_RSA) |
sPymbed | 0:1387ff3eed4a | 1316 | #define WC_RSA_BLINDING |
sPymbed | 0:1387ff3eed4a | 1317 | #endif |
sPymbed | 0:1387ff3eed4a | 1318 | |
sPymbed | 0:1387ff3eed4a | 1319 | #define NO_FILESYSTEM |
sPymbed | 0:1387ff3eed4a | 1320 | #define ECC_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 1321 | #define TFM_TIMING_RESISTANT |
sPymbed | 0:1387ff3eed4a | 1322 | #define SINGLE_THREADED |
sPymbed | 0:1387ff3eed4a | 1323 | #define NO_ASN_TIME /* can not use headers such as windows.h */ |
sPymbed | 0:1387ff3eed4a | 1324 | #define HAVE_AESGCM |
sPymbed | 0:1387ff3eed4a | 1325 | #define USE_CERT_BUFFERS_2048 |
sPymbed | 0:1387ff3eed4a | 1326 | #define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 1327 | #endif /* WOLFSSL_SGX */ |
sPymbed | 0:1387ff3eed4a | 1328 | |
sPymbed | 0:1387ff3eed4a | 1329 | /* FreeScale MMCAU hardware crypto has 4 byte alignment. |
sPymbed | 0:1387ff3eed4a | 1330 | However, KSDK fsl_mmcau.h gives API with no alignment |
sPymbed | 0:1387ff3eed4a | 1331 | requirements (4 byte alignment is managed internally by fsl_mmcau.c) */ |
sPymbed | 0:1387ff3eed4a | 1332 | #ifdef FREESCALE_MMCAU |
sPymbed | 0:1387ff3eed4a | 1333 | #ifdef FREESCALE_MMCAU_CLASSIC |
sPymbed | 0:1387ff3eed4a | 1334 | #define WOLFSSL_MMCAU_ALIGNMENT 4 |
sPymbed | 0:1387ff3eed4a | 1335 | #else |
sPymbed | 0:1387ff3eed4a | 1336 | #define WOLFSSL_MMCAU_ALIGNMENT 0 |
sPymbed | 0:1387ff3eed4a | 1337 | #endif |
sPymbed | 0:1387ff3eed4a | 1338 | #endif |
sPymbed | 0:1387ff3eed4a | 1339 | |
sPymbed | 0:1387ff3eed4a | 1340 | /* if using hardware crypto and have alignment requirements, specify the |
sPymbed | 0:1387ff3eed4a | 1341 | requirement here. The record header of SSL/TLS will prevent easy alignment. |
sPymbed | 0:1387ff3eed4a | 1342 | This hint tries to help as much as possible. */ |
sPymbed | 0:1387ff3eed4a | 1343 | #ifndef WOLFSSL_GENERAL_ALIGNMENT |
sPymbed | 0:1387ff3eed4a | 1344 | #ifdef WOLFSSL_AESNI |
sPymbed | 0:1387ff3eed4a | 1345 | #define WOLFSSL_GENERAL_ALIGNMENT 16 |
sPymbed | 0:1387ff3eed4a | 1346 | #elif defined(XSTREAM_ALIGN) |
sPymbed | 0:1387ff3eed4a | 1347 | #define WOLFSSL_GENERAL_ALIGNMENT 4 |
sPymbed | 0:1387ff3eed4a | 1348 | #elif defined(FREESCALE_MMCAU) || defined(FREESCALE_MMCAU_CLASSIC) |
sPymbed | 0:1387ff3eed4a | 1349 | #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT |
sPymbed | 0:1387ff3eed4a | 1350 | #else |
sPymbed | 0:1387ff3eed4a | 1351 | #define WOLFSSL_GENERAL_ALIGNMENT 0 |
sPymbed | 0:1387ff3eed4a | 1352 | #endif |
sPymbed | 0:1387ff3eed4a | 1353 | #endif |
sPymbed | 0:1387ff3eed4a | 1354 | |
sPymbed | 0:1387ff3eed4a | 1355 | #if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0) |
sPymbed | 0:1387ff3eed4a | 1356 | #if defined(_MSC_VER) |
sPymbed | 0:1387ff3eed4a | 1357 | #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT)) |
sPymbed | 0:1387ff3eed4a | 1358 | #elif defined(__GNUC__) |
sPymbed | 0:1387ff3eed4a | 1359 | #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT))) |
sPymbed | 0:1387ff3eed4a | 1360 | #else |
sPymbed | 0:1387ff3eed4a | 1361 | #define XGEN_ALIGN |
sPymbed | 0:1387ff3eed4a | 1362 | #endif |
sPymbed | 0:1387ff3eed4a | 1363 | #else |
sPymbed | 0:1387ff3eed4a | 1364 | #define XGEN_ALIGN |
sPymbed | 0:1387ff3eed4a | 1365 | #endif |
sPymbed | 0:1387ff3eed4a | 1366 | |
sPymbed | 0:1387ff3eed4a | 1367 | #ifdef HAVE_CRL |
sPymbed | 0:1387ff3eed4a | 1368 | /* not widely supported yet */ |
sPymbed | 0:1387ff3eed4a | 1369 | #undef NO_SKID |
sPymbed | 0:1387ff3eed4a | 1370 | #define NO_SKID |
sPymbed | 0:1387ff3eed4a | 1371 | #endif |
sPymbed | 0:1387ff3eed4a | 1372 | |
sPymbed | 0:1387ff3eed4a | 1373 | |
sPymbed | 0:1387ff3eed4a | 1374 | #ifdef __INTEL_COMPILER |
sPymbed | 0:1387ff3eed4a | 1375 | #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */ |
sPymbed | 0:1387ff3eed4a | 1376 | #endif |
sPymbed | 0:1387ff3eed4a | 1377 | |
sPymbed | 0:1387ff3eed4a | 1378 | /* user can specify what curves they want with ECC_USER_CURVES otherwise |
sPymbed | 0:1387ff3eed4a | 1379 | * all curves are on by default for now */ |
sPymbed | 0:1387ff3eed4a | 1380 | #ifndef ECC_USER_CURVES |
sPymbed | 0:1387ff3eed4a | 1381 | #if !defined(WOLFSSL_SP_MATH) && !defined(HAVE_ALL_CURVES) |
sPymbed | 0:1387ff3eed4a | 1382 | #define HAVE_ALL_CURVES |
sPymbed | 0:1387ff3eed4a | 1383 | #endif |
sPymbed | 0:1387ff3eed4a | 1384 | #endif |
sPymbed | 0:1387ff3eed4a | 1385 | |
sPymbed | 0:1387ff3eed4a | 1386 | /* ECC Configs */ |
sPymbed | 0:1387ff3eed4a | 1387 | #ifdef HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 1388 | /* By default enable Sign, Verify, DHE, Key Import and Key Export unless explicitly disabled */ |
sPymbed | 0:1387ff3eed4a | 1389 | #ifndef NO_ECC_SIGN |
sPymbed | 0:1387ff3eed4a | 1390 | #undef HAVE_ECC_SIGN |
sPymbed | 0:1387ff3eed4a | 1391 | #define HAVE_ECC_SIGN |
sPymbed | 0:1387ff3eed4a | 1392 | #endif |
sPymbed | 0:1387ff3eed4a | 1393 | #ifndef NO_ECC_VERIFY |
sPymbed | 0:1387ff3eed4a | 1394 | #undef HAVE_ECC_VERIFY |
sPymbed | 0:1387ff3eed4a | 1395 | #define HAVE_ECC_VERIFY |
sPymbed | 0:1387ff3eed4a | 1396 | #endif |
sPymbed | 0:1387ff3eed4a | 1397 | #ifndef NO_ECC_CHECK_KEY |
sPymbed | 0:1387ff3eed4a | 1398 | #undef HAVE_ECC_CHECK_KEY |
sPymbed | 0:1387ff3eed4a | 1399 | #define HAVE_ECC_CHECK_KEY |
sPymbed | 0:1387ff3eed4a | 1400 | #endif |
sPymbed | 0:1387ff3eed4a | 1401 | #ifndef NO_ECC_DHE |
sPymbed | 0:1387ff3eed4a | 1402 | #undef HAVE_ECC_DHE |
sPymbed | 0:1387ff3eed4a | 1403 | #define HAVE_ECC_DHE |
sPymbed | 0:1387ff3eed4a | 1404 | #endif |
sPymbed | 0:1387ff3eed4a | 1405 | #ifndef NO_ECC_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1406 | #undef HAVE_ECC_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1407 | #define HAVE_ECC_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1408 | #endif |
sPymbed | 0:1387ff3eed4a | 1409 | #ifndef NO_ECC_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1410 | #undef HAVE_ECC_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1411 | #define HAVE_ECC_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1412 | #endif |
sPymbed | 0:1387ff3eed4a | 1413 | #endif /* HAVE_ECC */ |
sPymbed | 0:1387ff3eed4a | 1414 | |
sPymbed | 0:1387ff3eed4a | 1415 | /* Curve255519 Configs */ |
sPymbed | 0:1387ff3eed4a | 1416 | #ifdef HAVE_CURVE25519 |
sPymbed | 0:1387ff3eed4a | 1417 | /* By default enable shared secret, key export and import */ |
sPymbed | 0:1387ff3eed4a | 1418 | #ifndef NO_CURVE25519_SHARED_SECRET |
sPymbed | 0:1387ff3eed4a | 1419 | #undef HAVE_CURVE25519_SHARED_SECRET |
sPymbed | 0:1387ff3eed4a | 1420 | #define HAVE_CURVE25519_SHARED_SECRET |
sPymbed | 0:1387ff3eed4a | 1421 | #endif |
sPymbed | 0:1387ff3eed4a | 1422 | #ifndef NO_CURVE25519_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1423 | #undef HAVE_CURVE25519_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1424 | #define HAVE_CURVE25519_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1425 | #endif |
sPymbed | 0:1387ff3eed4a | 1426 | #ifndef NO_CURVE25519_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1427 | #undef HAVE_CURVE25519_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1428 | #define HAVE_CURVE25519_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1429 | #endif |
sPymbed | 0:1387ff3eed4a | 1430 | #endif /* HAVE_CURVE25519 */ |
sPymbed | 0:1387ff3eed4a | 1431 | |
sPymbed | 0:1387ff3eed4a | 1432 | /* Ed255519 Configs */ |
sPymbed | 0:1387ff3eed4a | 1433 | #ifdef HAVE_ED25519 |
sPymbed | 0:1387ff3eed4a | 1434 | /* By default enable sign, verify, key export and import */ |
sPymbed | 0:1387ff3eed4a | 1435 | #ifndef NO_ED25519_SIGN |
sPymbed | 0:1387ff3eed4a | 1436 | #undef HAVE_ED25519_SIGN |
sPymbed | 0:1387ff3eed4a | 1437 | #define HAVE_ED25519_SIGN |
sPymbed | 0:1387ff3eed4a | 1438 | #endif |
sPymbed | 0:1387ff3eed4a | 1439 | #ifndef NO_ED25519_VERIFY |
sPymbed | 0:1387ff3eed4a | 1440 | #undef HAVE_ED25519_VERIFY |
sPymbed | 0:1387ff3eed4a | 1441 | #define HAVE_ED25519_VERIFY |
sPymbed | 0:1387ff3eed4a | 1442 | #endif |
sPymbed | 0:1387ff3eed4a | 1443 | #ifndef NO_ED25519_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1444 | #undef HAVE_ED25519_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1445 | #define HAVE_ED25519_KEY_EXPORT |
sPymbed | 0:1387ff3eed4a | 1446 | #endif |
sPymbed | 0:1387ff3eed4a | 1447 | #ifndef NO_ED25519_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1448 | #undef HAVE_ED25519_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1449 | #define HAVE_ED25519_KEY_IMPORT |
sPymbed | 0:1387ff3eed4a | 1450 | #endif |
sPymbed | 0:1387ff3eed4a | 1451 | #endif /* HAVE_ED25519 */ |
sPymbed | 0:1387ff3eed4a | 1452 | |
sPymbed | 0:1387ff3eed4a | 1453 | /* AES Config */ |
sPymbed | 0:1387ff3eed4a | 1454 | #ifndef NO_AES |
sPymbed | 0:1387ff3eed4a | 1455 | /* By default enable all AES key sizes, decryption and CBC */ |
sPymbed | 0:1387ff3eed4a | 1456 | #ifndef AES_MAX_KEY_SIZE |
sPymbed | 0:1387ff3eed4a | 1457 | #undef AES_MAX_KEY_SIZE |
sPymbed | 0:1387ff3eed4a | 1458 | #define AES_MAX_KEY_SIZE 256 |
sPymbed | 0:1387ff3eed4a | 1459 | #endif |
sPymbed | 0:1387ff3eed4a | 1460 | |
sPymbed | 0:1387ff3eed4a | 1461 | #ifndef NO_AES_128 |
sPymbed | 0:1387ff3eed4a | 1462 | #undef WOLFSSL_AES_128 |
sPymbed | 0:1387ff3eed4a | 1463 | #define WOLFSSL_AES_128 |
sPymbed | 0:1387ff3eed4a | 1464 | #endif |
sPymbed | 0:1387ff3eed4a | 1465 | #if !defined(NO_AES_192) && AES_MAX_KEY_SIZE >= 192 |
sPymbed | 0:1387ff3eed4a | 1466 | #undef WOLFSSL_AES_192 |
sPymbed | 0:1387ff3eed4a | 1467 | #define WOLFSSL_AES_192 |
sPymbed | 0:1387ff3eed4a | 1468 | #endif |
sPymbed | 0:1387ff3eed4a | 1469 | #if !defined(NO_AES_256) && AES_MAX_KEY_SIZE >= 256 |
sPymbed | 0:1387ff3eed4a | 1470 | #undef WOLFSSL_AES_256 |
sPymbed | 0:1387ff3eed4a | 1471 | #define WOLFSSL_AES_256 |
sPymbed | 0:1387ff3eed4a | 1472 | #endif |
sPymbed | 0:1387ff3eed4a | 1473 | #if !defined(WOLFSSL_AES_128) && defined(HAVE_ECC_ENCRYPT) |
sPymbed | 0:1387ff3eed4a | 1474 | #warning HAVE_ECC_ENCRYPT uses AES 128 bit keys |
sPymbed | 0:1387ff3eed4a | 1475 | #endif |
sPymbed | 0:1387ff3eed4a | 1476 | |
sPymbed | 0:1387ff3eed4a | 1477 | #ifndef NO_AES_DECRYPT |
sPymbed | 0:1387ff3eed4a | 1478 | #undef HAVE_AES_DECRYPT |
sPymbed | 0:1387ff3eed4a | 1479 | #define HAVE_AES_DECRYPT |
sPymbed | 0:1387ff3eed4a | 1480 | #endif |
sPymbed | 0:1387ff3eed4a | 1481 | #ifndef NO_AES_CBC |
sPymbed | 0:1387ff3eed4a | 1482 | #undef HAVE_AES_CBC |
sPymbed | 0:1387ff3eed4a | 1483 | #define HAVE_AES_CBC |
sPymbed | 0:1387ff3eed4a | 1484 | #else |
sPymbed | 0:1387ff3eed4a | 1485 | #ifndef WOLFCRYPT_ONLY |
sPymbed | 0:1387ff3eed4a | 1486 | #error "AES CBC is required for TLS and can only be disabled for WOLFCRYPT_ONLY builds" |
sPymbed | 0:1387ff3eed4a | 1487 | #endif |
sPymbed | 0:1387ff3eed4a | 1488 | #endif |
sPymbed | 0:1387ff3eed4a | 1489 | #ifdef WOLFSSL_AES_XTS |
sPymbed | 0:1387ff3eed4a | 1490 | /* AES-XTS makes calls to AES direct functions */ |
sPymbed | 0:1387ff3eed4a | 1491 | #ifndef WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 1492 | #define WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 1493 | #endif |
sPymbed | 0:1387ff3eed4a | 1494 | #endif |
sPymbed | 0:1387ff3eed4a | 1495 | #ifdef WOLFSSL_AES_CFB |
sPymbed | 0:1387ff3eed4a | 1496 | /* AES-CFB makes calls to AES direct functions */ |
sPymbed | 0:1387ff3eed4a | 1497 | #ifndef WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 1498 | #define WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 1499 | #endif |
sPymbed | 0:1387ff3eed4a | 1500 | #endif |
sPymbed | 0:1387ff3eed4a | 1501 | #endif |
sPymbed | 0:1387ff3eed4a | 1502 | |
sPymbed | 0:1387ff3eed4a | 1503 | /* if desktop type system and fastmath increase default max bits */ |
sPymbed | 0:1387ff3eed4a | 1504 | #ifdef WOLFSSL_X86_64_BUILD |
sPymbed | 0:1387ff3eed4a | 1505 | #ifdef USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 1506 | #ifndef FP_MAX_BITS |
sPymbed | 0:1387ff3eed4a | 1507 | #define FP_MAX_BITS 8192 |
sPymbed | 0:1387ff3eed4a | 1508 | #endif |
sPymbed | 0:1387ff3eed4a | 1509 | #endif |
sPymbed | 0:1387ff3eed4a | 1510 | #endif |
sPymbed | 0:1387ff3eed4a | 1511 | |
sPymbed | 0:1387ff3eed4a | 1512 | /* If using the max strength build, ensure OLD TLS is disabled. */ |
sPymbed | 0:1387ff3eed4a | 1513 | #ifdef WOLFSSL_MAX_STRENGTH |
sPymbed | 0:1387ff3eed4a | 1514 | #undef NO_OLD_TLS |
sPymbed | 0:1387ff3eed4a | 1515 | #define NO_OLD_TLS |
sPymbed | 0:1387ff3eed4a | 1516 | #endif |
sPymbed | 0:1387ff3eed4a | 1517 | |
sPymbed | 0:1387ff3eed4a | 1518 | |
sPymbed | 0:1387ff3eed4a | 1519 | /* Default AES minimum auth tag sz, allow user to override */ |
sPymbed | 0:1387ff3eed4a | 1520 | #ifndef WOLFSSL_MIN_AUTH_TAG_SZ |
sPymbed | 0:1387ff3eed4a | 1521 | #define WOLFSSL_MIN_AUTH_TAG_SZ 12 |
sPymbed | 0:1387ff3eed4a | 1522 | #endif |
sPymbed | 0:1387ff3eed4a | 1523 | |
sPymbed | 0:1387ff3eed4a | 1524 | |
sPymbed | 0:1387ff3eed4a | 1525 | /* sniffer requires: |
sPymbed | 0:1387ff3eed4a | 1526 | * static RSA cipher suites |
sPymbed | 0:1387ff3eed4a | 1527 | * session stats and peak stats |
sPymbed | 0:1387ff3eed4a | 1528 | */ |
sPymbed | 0:1387ff3eed4a | 1529 | #ifdef WOLFSSL_SNIFFER |
sPymbed | 0:1387ff3eed4a | 1530 | #ifndef WOLFSSL_STATIC_RSA |
sPymbed | 0:1387ff3eed4a | 1531 | #define WOLFSSL_STATIC_RSA |
sPymbed | 0:1387ff3eed4a | 1532 | #endif |
sPymbed | 0:1387ff3eed4a | 1533 | #ifndef WOLFSSL_SESSION_STATS |
sPymbed | 0:1387ff3eed4a | 1534 | #define WOLFSSL_SESSION_STATS |
sPymbed | 0:1387ff3eed4a | 1535 | #endif |
sPymbed | 0:1387ff3eed4a | 1536 | #ifndef WOLFSSL_PEAK_SESSIONS |
sPymbed | 0:1387ff3eed4a | 1537 | #define WOLFSSL_PEAK_SESSIONS |
sPymbed | 0:1387ff3eed4a | 1538 | #endif |
sPymbed | 0:1387ff3eed4a | 1539 | #endif |
sPymbed | 0:1387ff3eed4a | 1540 | |
sPymbed | 0:1387ff3eed4a | 1541 | /* Decode Public Key extras on by default, user can turn off with |
sPymbed | 0:1387ff3eed4a | 1542 | * WOLFSSL_NO_DECODE_EXTRA */ |
sPymbed | 0:1387ff3eed4a | 1543 | #ifndef WOLFSSL_NO_DECODE_EXTRA |
sPymbed | 0:1387ff3eed4a | 1544 | #ifndef RSA_DECODE_EXTRA |
sPymbed | 0:1387ff3eed4a | 1545 | #define RSA_DECODE_EXTRA |
sPymbed | 0:1387ff3eed4a | 1546 | #endif |
sPymbed | 0:1387ff3eed4a | 1547 | #ifndef ECC_DECODE_EXTRA |
sPymbed | 0:1387ff3eed4a | 1548 | #define ECC_DECODE_EXTRA |
sPymbed | 0:1387ff3eed4a | 1549 | #endif |
sPymbed | 0:1387ff3eed4a | 1550 | #endif |
sPymbed | 0:1387ff3eed4a | 1551 | |
sPymbed | 0:1387ff3eed4a | 1552 | /* C Sharp wrapper defines */ |
sPymbed | 0:1387ff3eed4a | 1553 | #ifdef HAVE_CSHARP |
sPymbed | 0:1387ff3eed4a | 1554 | #ifndef WOLFSSL_DTLS |
sPymbed | 0:1387ff3eed4a | 1555 | #define WOLFSSL_DTLS |
sPymbed | 0:1387ff3eed4a | 1556 | #endif |
sPymbed | 0:1387ff3eed4a | 1557 | #undef NO_PSK |
sPymbed | 0:1387ff3eed4a | 1558 | #undef NO_SHA256 |
sPymbed | 0:1387ff3eed4a | 1559 | #undef NO_DH |
sPymbed | 0:1387ff3eed4a | 1560 | #endif |
sPymbed | 0:1387ff3eed4a | 1561 | |
sPymbed | 0:1387ff3eed4a | 1562 | /* Asynchronous Crypto */ |
sPymbed | 0:1387ff3eed4a | 1563 | #ifdef WOLFSSL_ASYNC_CRYPT |
sPymbed | 0:1387ff3eed4a | 1564 | /* Make sure wolf events are enabled */ |
sPymbed | 0:1387ff3eed4a | 1565 | #undef HAVE_WOLF_EVENT |
sPymbed | 0:1387ff3eed4a | 1566 | #define HAVE_WOLF_EVENT |
sPymbed | 0:1387ff3eed4a | 1567 | |
sPymbed | 0:1387ff3eed4a | 1568 | #ifdef WOLFSSL_ASYNC_CRYPT_TEST |
sPymbed | 0:1387ff3eed4a | 1569 | #define WC_ASYNC_DEV_SIZE 320+24 |
sPymbed | 0:1387ff3eed4a | 1570 | #else |
sPymbed | 0:1387ff3eed4a | 1571 | #define WC_ASYNC_DEV_SIZE 320 |
sPymbed | 0:1387ff3eed4a | 1572 | #endif |
sPymbed | 0:1387ff3eed4a | 1573 | |
sPymbed | 0:1387ff3eed4a | 1574 | #if !defined(HAVE_CAVIUM) && !defined(HAVE_INTEL_QA) && \ |
sPymbed | 0:1387ff3eed4a | 1575 | !defined(WOLFSSL_ASYNC_CRYPT_TEST) |
sPymbed | 0:1387ff3eed4a | 1576 | #error No async hardware defined with WOLFSSL_ASYNC_CRYPT! |
sPymbed | 0:1387ff3eed4a | 1577 | #endif |
sPymbed | 0:1387ff3eed4a | 1578 | |
sPymbed | 0:1387ff3eed4a | 1579 | /* Enable ECC_CACHE_CURVE for ASYNC */ |
sPymbed | 0:1387ff3eed4a | 1580 | #if !defined(ECC_CACHE_CURVE) |
sPymbed | 0:1387ff3eed4a | 1581 | #define ECC_CACHE_CURVE |
sPymbed | 0:1387ff3eed4a | 1582 | #endif |
sPymbed | 0:1387ff3eed4a | 1583 | #endif /* WOLFSSL_ASYNC_CRYPT */ |
sPymbed | 0:1387ff3eed4a | 1584 | #ifndef WC_ASYNC_DEV_SIZE |
sPymbed | 0:1387ff3eed4a | 1585 | #define WC_ASYNC_DEV_SIZE 0 |
sPymbed | 0:1387ff3eed4a | 1586 | #endif |
sPymbed | 0:1387ff3eed4a | 1587 | |
sPymbed | 0:1387ff3eed4a | 1588 | /* leantls checks */ |
sPymbed | 0:1387ff3eed4a | 1589 | #ifdef WOLFSSL_LEANTLS |
sPymbed | 0:1387ff3eed4a | 1590 | #ifndef HAVE_ECC |
sPymbed | 0:1387ff3eed4a | 1591 | #error leantls build needs ECC |
sPymbed | 0:1387ff3eed4a | 1592 | #endif |
sPymbed | 0:1387ff3eed4a | 1593 | #endif /* WOLFSSL_LEANTLS*/ |
sPymbed | 0:1387ff3eed4a | 1594 | |
sPymbed | 0:1387ff3eed4a | 1595 | /* restriction with static memory */ |
sPymbed | 0:1387ff3eed4a | 1596 | #ifdef WOLFSSL_STATIC_MEMORY |
sPymbed | 0:1387ff3eed4a | 1597 | #if defined(HAVE_IO_POOL) || defined(XMALLOC_USER) || defined(NO_WOLFSSL_MEMORY) |
sPymbed | 0:1387ff3eed4a | 1598 | #error static memory cannot be used with HAVE_IO_POOL, XMALLOC_USER or NO_WOLFSSL_MEMORY |
sPymbed | 0:1387ff3eed4a | 1599 | #endif |
sPymbed | 0:1387ff3eed4a | 1600 | #if !defined(USE_FAST_MATH) && !defined(NO_BIG_INT) |
sPymbed | 0:1387ff3eed4a | 1601 | #error static memory requires fast math please define USE_FAST_MATH |
sPymbed | 0:1387ff3eed4a | 1602 | #endif |
sPymbed | 0:1387ff3eed4a | 1603 | #ifdef WOLFSSL_SMALL_STACK |
sPymbed | 0:1387ff3eed4a | 1604 | #error static memory does not support small stack please undefine |
sPymbed | 0:1387ff3eed4a | 1605 | #endif |
sPymbed | 0:1387ff3eed4a | 1606 | #endif /* WOLFSSL_STATIC_MEMORY */ |
sPymbed | 0:1387ff3eed4a | 1607 | |
sPymbed | 0:1387ff3eed4a | 1608 | #ifdef HAVE_AES_KEYWRAP |
sPymbed | 0:1387ff3eed4a | 1609 | #ifndef WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 1610 | #error AES key wrap requires AES direct please define WOLFSSL_AES_DIRECT |
sPymbed | 0:1387ff3eed4a | 1611 | #endif |
sPymbed | 0:1387ff3eed4a | 1612 | #endif |
sPymbed | 0:1387ff3eed4a | 1613 | |
sPymbed | 0:1387ff3eed4a | 1614 | #ifdef HAVE_PKCS7 |
sPymbed | 0:1387ff3eed4a | 1615 | #if defined(NO_AES) && defined(NO_DES3) |
sPymbed | 0:1387ff3eed4a | 1616 | #error PKCS7 needs either AES or 3DES enabled, please enable one |
sPymbed | 0:1387ff3eed4a | 1617 | #endif |
sPymbed | 0:1387ff3eed4a | 1618 | #ifndef HAVE_AES_KEYWRAP |
sPymbed | 0:1387ff3eed4a | 1619 | #error PKCS7 requires AES key wrap please define HAVE_AES_KEYWRAP |
sPymbed | 0:1387ff3eed4a | 1620 | #endif |
sPymbed | 0:1387ff3eed4a | 1621 | #if defined(HAVE_ECC) && !defined(HAVE_X963_KDF) |
sPymbed | 0:1387ff3eed4a | 1622 | #error PKCS7 requires X963 KDF please define HAVE_X963_KDF |
sPymbed | 0:1387ff3eed4a | 1623 | #endif |
sPymbed | 0:1387ff3eed4a | 1624 | #endif |
sPymbed | 0:1387ff3eed4a | 1625 | |
sPymbed | 0:1387ff3eed4a | 1626 | #if !defined(WOLFCRYPT_ONLY) && !defined(NO_OLD_TLS) && \ |
sPymbed | 0:1387ff3eed4a | 1627 | (defined(NO_SHA) || defined(NO_MD5)) |
sPymbed | 0:1387ff3eed4a | 1628 | #error old TLS requires MD5 and SHA |
sPymbed | 0:1387ff3eed4a | 1629 | #endif |
sPymbed | 0:1387ff3eed4a | 1630 | |
sPymbed | 0:1387ff3eed4a | 1631 | /* for backwards compatibility */ |
sPymbed | 0:1387ff3eed4a | 1632 | #if defined(TEST_IPV6) && !defined(WOLFSSL_IPV6) |
sPymbed | 0:1387ff3eed4a | 1633 | #define WOLFSSL_IPV6 |
sPymbed | 0:1387ff3eed4a | 1634 | #endif |
sPymbed | 0:1387ff3eed4a | 1635 | |
sPymbed | 0:1387ff3eed4a | 1636 | |
sPymbed | 0:1387ff3eed4a | 1637 | /* Place any other flags or defines here */ |
sPymbed | 0:1387ff3eed4a | 1638 | |
sPymbed | 0:1387ff3eed4a | 1639 | #if defined(WOLFSSL_MYSQL_COMPATIBLE) && defined(_WIN32) \ |
sPymbed | 0:1387ff3eed4a | 1640 | && defined(HAVE_GMTIME_R) |
sPymbed | 0:1387ff3eed4a | 1641 | #undef HAVE_GMTIME_R /* don't trust macro with windows */ |
sPymbed | 0:1387ff3eed4a | 1642 | #endif /* WOLFSSL_MYSQL_COMPATIBLE */ |
sPymbed | 0:1387ff3eed4a | 1643 | |
sPymbed | 0:1387ff3eed4a | 1644 | #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) |
sPymbed | 0:1387ff3eed4a | 1645 | #define SSL_OP_NO_COMPRESSION SSL_OP_NO_COMPRESSION |
sPymbed | 0:1387ff3eed4a | 1646 | #define OPENSSL_NO_ENGINE |
sPymbed | 0:1387ff3eed4a | 1647 | #define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT |
sPymbed | 0:1387ff3eed4a | 1648 | #ifndef OPENSSL_EXTRA |
sPymbed | 0:1387ff3eed4a | 1649 | #define OPENSSL_EXTRA |
sPymbed | 0:1387ff3eed4a | 1650 | #endif |
sPymbed | 0:1387ff3eed4a | 1651 | #ifndef HAVE_SESSION_TICKET |
sPymbed | 0:1387ff3eed4a | 1652 | #define HAVE_SESSION_TICKET |
sPymbed | 0:1387ff3eed4a | 1653 | #endif |
sPymbed | 0:1387ff3eed4a | 1654 | #ifndef HAVE_OCSP |
sPymbed | 0:1387ff3eed4a | 1655 | #define HAVE_OCSP |
sPymbed | 0:1387ff3eed4a | 1656 | #endif |
sPymbed | 0:1387ff3eed4a | 1657 | #ifndef KEEP_OUR_CERT |
sPymbed | 0:1387ff3eed4a | 1658 | #define KEEP_OUR_CERT |
sPymbed | 0:1387ff3eed4a | 1659 | #endif |
sPymbed | 0:1387ff3eed4a | 1660 | #ifndef HAVE_SNI |
sPymbed | 0:1387ff3eed4a | 1661 | #define HAVE_SNI |
sPymbed | 0:1387ff3eed4a | 1662 | #endif |
sPymbed | 0:1387ff3eed4a | 1663 | #endif |
sPymbed | 0:1387ff3eed4a | 1664 | |
sPymbed | 0:1387ff3eed4a | 1665 | #if defined(WOLFSSL_NGINX) |
sPymbed | 0:1387ff3eed4a | 1666 | #define SSL_CTRL_SET_TLSEXT_HOSTNAME |
sPymbed | 0:1387ff3eed4a | 1667 | #endif |
sPymbed | 0:1387ff3eed4a | 1668 | |
sPymbed | 0:1387ff3eed4a | 1669 | /* both CURVE and ED small math should be enabled */ |
sPymbed | 0:1387ff3eed4a | 1670 | #ifdef CURVED25519_SMALL |
sPymbed | 0:1387ff3eed4a | 1671 | #define CURVE25519_SMALL |
sPymbed | 0:1387ff3eed4a | 1672 | #define ED25519_SMALL |
sPymbed | 0:1387ff3eed4a | 1673 | #endif |
sPymbed | 0:1387ff3eed4a | 1674 | |
sPymbed | 0:1387ff3eed4a | 1675 | |
sPymbed | 0:1387ff3eed4a | 1676 | #ifndef WOLFSSL_ALERT_COUNT_MAX |
sPymbed | 0:1387ff3eed4a | 1677 | #define WOLFSSL_ALERT_COUNT_MAX 5 |
sPymbed | 0:1387ff3eed4a | 1678 | #endif |
sPymbed | 0:1387ff3eed4a | 1679 | |
sPymbed | 0:1387ff3eed4a | 1680 | /* warning for not using harden build options (default with ./configure) */ |
sPymbed | 0:1387ff3eed4a | 1681 | #ifndef WC_NO_HARDEN |
sPymbed | 0:1387ff3eed4a | 1682 | #if (defined(USE_FAST_MATH) && !defined(TFM_TIMING_RESISTANT)) || \ |
sPymbed | 0:1387ff3eed4a | 1683 | (defined(HAVE_ECC) && !defined(ECC_TIMING_RESISTANT)) || \ |
sPymbed | 0:1387ff3eed4a | 1684 | (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS)) |
sPymbed | 0:1387ff3eed4a | 1685 | |
sPymbed | 0:1387ff3eed4a | 1686 | #ifndef _MSC_VER |
sPymbed | 0:1387ff3eed4a | 1687 | #warning "For timing resistance / side-channel attack prevention consider using harden options" |
sPymbed | 0:1387ff3eed4a | 1688 | #else |
sPymbed | 0:1387ff3eed4a | 1689 | #pragma message("Warning: For timing resistance / side-channel attack prevention consider using harden options") |
sPymbed | 0:1387ff3eed4a | 1690 | #endif |
sPymbed | 0:1387ff3eed4a | 1691 | #endif |
sPymbed | 0:1387ff3eed4a | 1692 | #endif |
sPymbed | 0:1387ff3eed4a | 1693 | |
sPymbed | 0:1387ff3eed4a | 1694 | #if defined(NO_OLD_WC_NAMES) || defined(OPENSSL_EXTRA) |
sPymbed | 0:1387ff3eed4a | 1695 | /* added to have compatibility with SHA256() */ |
sPymbed | 0:1387ff3eed4a | 1696 | #if !defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) |
sPymbed | 0:1387ff3eed4a | 1697 | #define NO_OLD_SHA_NAMES |
sPymbed | 0:1387ff3eed4a | 1698 | #endif |
sPymbed | 0:1387ff3eed4a | 1699 | #endif |
sPymbed | 0:1387ff3eed4a | 1700 | |
sPymbed | 0:1387ff3eed4a | 1701 | /* switch for compatibility layer functionality. Has subparts i.e. BIO/X509 |
sPymbed | 0:1387ff3eed4a | 1702 | * When opensslextra is enabled all subparts should be turned on. */ |
sPymbed | 0:1387ff3eed4a | 1703 | #ifdef OPENSSL_EXTRA |
sPymbed | 0:1387ff3eed4a | 1704 | #undef OPENSSL_EXTRA_X509_SMALL |
sPymbed | 0:1387ff3eed4a | 1705 | #define OPENSSL_EXTRA_X509_SMALL |
sPymbed | 0:1387ff3eed4a | 1706 | #endif /* OPENSSL_EXTRA */ |
sPymbed | 0:1387ff3eed4a | 1707 | |
sPymbed | 0:1387ff3eed4a | 1708 | /* support for converting DER to PEM */ |
sPymbed | 0:1387ff3eed4a | 1709 | #if defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN) || \ |
sPymbed | 0:1387ff3eed4a | 1710 | defined(OPENSSL_EXTRA) |
sPymbed | 0:1387ff3eed4a | 1711 | #undef WOLFSSL_DER_TO_PEM |
sPymbed | 0:1387ff3eed4a | 1712 | #define WOLFSSL_DER_TO_PEM |
sPymbed | 0:1387ff3eed4a | 1713 | #endif |
sPymbed | 0:1387ff3eed4a | 1714 | |
sPymbed | 0:1387ff3eed4a | 1715 | /* keep backwards compatibility enabling encrypted private key */ |
sPymbed | 0:1387ff3eed4a | 1716 | #ifndef WOLFSSL_ENCRYPTED_KEYS |
sPymbed | 0:1387ff3eed4a | 1717 | #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ |
sPymbed | 0:1387ff3eed4a | 1718 | defined(HAVE_WEBSERVER) |
sPymbed | 0:1387ff3eed4a | 1719 | #define WOLFSSL_ENCRYPTED_KEYS |
sPymbed | 0:1387ff3eed4a | 1720 | #endif |
sPymbed | 0:1387ff3eed4a | 1721 | #endif |
sPymbed | 0:1387ff3eed4a | 1722 | |
sPymbed | 0:1387ff3eed4a | 1723 | /* support for disabling PEM to DER */ |
sPymbed | 0:1387ff3eed4a | 1724 | #if !defined(WOLFSSL_NO_PEM) |
sPymbed | 0:1387ff3eed4a | 1725 | #undef WOLFSSL_PEM_TO_DER |
sPymbed | 0:1387ff3eed4a | 1726 | #define WOLFSSL_PEM_TO_DER |
sPymbed | 0:1387ff3eed4a | 1727 | #endif |
sPymbed | 0:1387ff3eed4a | 1728 | |
sPymbed | 0:1387ff3eed4a | 1729 | /* Parts of the openssl compatibility layer require peer certs */ |
sPymbed | 0:1387ff3eed4a | 1730 | #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) |
sPymbed | 0:1387ff3eed4a | 1731 | #undef KEEP_PEER_CERT |
sPymbed | 0:1387ff3eed4a | 1732 | #define KEEP_PEER_CERT |
sPymbed | 0:1387ff3eed4a | 1733 | #endif |
sPymbed | 0:1387ff3eed4a | 1734 | |
sPymbed | 0:1387ff3eed4a | 1735 | /* RAW hash function APIs are not implemented with ARMv8 hardware acceleration*/ |
sPymbed | 0:1387ff3eed4a | 1736 | #ifdef WOLFSSL_ARMASM |
sPymbed | 0:1387ff3eed4a | 1737 | #undef WOLFSSL_NO_HASH_RAW |
sPymbed | 0:1387ff3eed4a | 1738 | #define WOLFSSL_NO_HASH_RAW |
sPymbed | 0:1387ff3eed4a | 1739 | #endif |
sPymbed | 0:1387ff3eed4a | 1740 | |
sPymbed | 0:1387ff3eed4a | 1741 | #ifdef __cplusplus |
sPymbed | 0:1387ff3eed4a | 1742 | } /* extern "C" */ |
sPymbed | 0:1387ff3eed4a | 1743 | #endif |
sPymbed | 0:1387ff3eed4a | 1744 | |
sPymbed | 0:1387ff3eed4a | 1745 | #endif |
sPymbed | 0:1387ff3eed4a | 1746 |