wolf SSL / wolfSSL-TLS13-Beta

Fork of wolfSSL by wolf SSL

Committer:
wolfSSL
Date:
Thu Apr 28 00:56:55 2016 +0000
Revision:
3:6f956bdb3073
Parent:
2:28278596c2a2
wolfSSL 3.9.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 0:d92f9d21154c 1 /* settings.h
wolfSSL 0:d92f9d21154c 2 *
wolfSSL 3:6f956bdb3073 3 * Copyright (C) 2006-2016 wolfSSL Inc.
wolfSSL 0:d92f9d21154c 4 *
wolfSSL 3:6f956bdb3073 5 * This file is part of wolfSSL.
wolfSSL 0:d92f9d21154c 6 *
wolfSSL 0:d92f9d21154c 7 * wolfSSL is free software; you can redistribute it and/or modify
wolfSSL 0:d92f9d21154c 8 * it under the terms of the GNU General Public License as published by
wolfSSL 0:d92f9d21154c 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 0:d92f9d21154c 10 * (at your option) any later version.
wolfSSL 0:d92f9d21154c 11 *
wolfSSL 0:d92f9d21154c 12 * wolfSSL is distributed in the hope that it will be useful,
wolfSSL 0:d92f9d21154c 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 0:d92f9d21154c 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 0:d92f9d21154c 15 * GNU General Public License for more details.
wolfSSL 0:d92f9d21154c 16 *
wolfSSL 0:d92f9d21154c 17 * You should have received a copy of the GNU General Public License
wolfSSL 0:d92f9d21154c 18 * along with this program; if not, write to the Free Software
wolfSSL 3:6f956bdb3073 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
wolfSSL 0:d92f9d21154c 20 */
wolfSSL 0:d92f9d21154c 21
wolfSSL 3:6f956bdb3073 22
wolfSSL 0:d92f9d21154c 23 /* Place OS specific preprocessor flags, defines, includes here, will be
wolfSSL 0:d92f9d21154c 24 included into every file because types.h includes it */
wolfSSL 0:d92f9d21154c 25
wolfSSL 0:d92f9d21154c 26
wolfSSL 0:d92f9d21154c 27 #ifndef WOLF_CRYPT_SETTINGS_H
wolfSSL 0:d92f9d21154c 28 #define WOLF_CRYPT_SETTINGS_H
wolfSSL 0:d92f9d21154c 29
wolfSSL 0:d92f9d21154c 30 #ifdef __cplusplus
wolfSSL 0:d92f9d21154c 31 extern "C" {
wolfSSL 0:d92f9d21154c 32 #endif
wolfSSL 0:d92f9d21154c 33
wolfSSL 0:d92f9d21154c 34 /* Uncomment next line if using IPHONE */
wolfSSL 0:d92f9d21154c 35 /* #define IPHONE */
wolfSSL 0:d92f9d21154c 36
wolfSSL 0:d92f9d21154c 37 /* Uncomment next line if using ThreadX */
wolfSSL 0:d92f9d21154c 38 /* #define THREADX */
wolfSSL 0:d92f9d21154c 39
wolfSSL 0:d92f9d21154c 40 /* Uncomment next line if using Micrium ucOS */
wolfSSL 0:d92f9d21154c 41 /* #define MICRIUM */
wolfSSL 0:d92f9d21154c 42
wolfSSL 0:d92f9d21154c 43 /* Uncomment next line if using Mbed */
wolfSSL 0:d92f9d21154c 44 /* #define MBED */
wolfSSL 0:d92f9d21154c 45
wolfSSL 0:d92f9d21154c 46 /* Uncomment next line if using Microchip PIC32 ethernet starter kit */
wolfSSL 0:d92f9d21154c 47 /* #define MICROCHIP_PIC32 */
wolfSSL 0:d92f9d21154c 48
wolfSSL 0:d92f9d21154c 49 /* Uncomment next line if using Microchip TCP/IP stack, version 5 */
wolfSSL 0:d92f9d21154c 50 /* #define MICROCHIP_TCPIP_V5 */
wolfSSL 0:d92f9d21154c 51
wolfSSL 0:d92f9d21154c 52 /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
wolfSSL 0:d92f9d21154c 53 /* #define MICROCHIP_TCPIP */
wolfSSL 0:d92f9d21154c 54
wolfSSL 0:d92f9d21154c 55 /* Uncomment next line if using PIC32MZ Crypto Engine */
wolfSSL 0:d92f9d21154c 56 /* #define WOLFSSL_MICROCHIP_PIC32MZ */
wolfSSL 0:d92f9d21154c 57
wolfSSL 0:d92f9d21154c 58 /* Uncomment next line if using FreeRTOS */
wolfSSL 0:d92f9d21154c 59 /* #define FREERTOS */
wolfSSL 0:d92f9d21154c 60
wolfSSL 3:6f956bdb3073 61 /* Uncomment next line if using FreeRTOS+ TCP */
wolfSSL 3:6f956bdb3073 62 /* #define FREERTOS_TCP */
wolfSSL 3:6f956bdb3073 63
wolfSSL 0:d92f9d21154c 64 /* Uncomment next line if using FreeRTOS Windows Simulator */
wolfSSL 0:d92f9d21154c 65 /* #define FREERTOS_WINSIM */
wolfSSL 0:d92f9d21154c 66
wolfSSL 0:d92f9d21154c 67 /* Uncomment next line if using RTIP */
wolfSSL 0:d92f9d21154c 68 /* #define EBSNET */
wolfSSL 0:d92f9d21154c 69
wolfSSL 0:d92f9d21154c 70 /* Uncomment next line if using lwip */
wolfSSL 0:d92f9d21154c 71 /* #define WOLFSSL_LWIP */
wolfSSL 0:d92f9d21154c 72
wolfSSL 0:d92f9d21154c 73 /* Uncomment next line if building wolfSSL for a game console */
wolfSSL 0:d92f9d21154c 74 /* #define WOLFSSL_GAME_BUILD */
wolfSSL 0:d92f9d21154c 75
wolfSSL 0:d92f9d21154c 76 /* Uncomment next line if building wolfSSL for LSR */
wolfSSL 0:d92f9d21154c 77 /* #define WOLFSSL_LSR */
wolfSSL 0:d92f9d21154c 78
wolfSSL 3:6f956bdb3073 79 /* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */
wolfSSL 0:d92f9d21154c 80 /* #define FREESCALE_MQX */
wolfSSL 0:d92f9d21154c 81
wolfSSL 3:6f956bdb3073 82 /* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */
wolfSSL 3:6f956bdb3073 83 /* #define FREESCALE_KSDK_MQX */
wolfSSL 3:6f956bdb3073 84
wolfSSL 3:6f956bdb3073 85 /* Uncomment next line if building for Freescale KSDK Bare Metal */
wolfSSL 3:6f956bdb3073 86 /* #define FREESCALE_KSDK_BM */
wolfSSL 3:6f956bdb3073 87
wolfSSL 3:6f956bdb3073 88 /* Uncomment next line if building for Freescale FreeRTOS */
wolfSSL 3:6f956bdb3073 89 /* #define FREESCALE_FREE_RTOS */
wolfSSL 3:6f956bdb3073 90
wolfSSL 0:d92f9d21154c 91 /* Uncomment next line if using STM32F2 */
wolfSSL 0:d92f9d21154c 92 /* #define WOLFSSL_STM32F2 */
wolfSSL 0:d92f9d21154c 93
wolfSSL 0:d92f9d21154c 94 /* Uncomment next line if using Comverge settings */
wolfSSL 0:d92f9d21154c 95 /* #define COMVERGE */
wolfSSL 0:d92f9d21154c 96
wolfSSL 0:d92f9d21154c 97 /* Uncomment next line if using QL SEP settings */
wolfSSL 0:d92f9d21154c 98 /* #define WOLFSSL_QL */
wolfSSL 0:d92f9d21154c 99
wolfSSL 0:d92f9d21154c 100 /* Uncomment next line if building for EROAD */
wolfSSL 0:d92f9d21154c 101 /* #define WOLFSSL_EROAD */
wolfSSL 0:d92f9d21154c 102
wolfSSL 0:d92f9d21154c 103 /* Uncomment next line if building for IAR EWARM */
wolfSSL 0:d92f9d21154c 104 /* #define WOLFSSL_IAR_ARM */
wolfSSL 0:d92f9d21154c 105
wolfSSL 3:6f956bdb3073 106 /* Uncomment next line if building for Rowley CrossWorks ARM */
wolfSSL 3:6f956bdb3073 107 /* #define WOLFSSL_ROWLEY_ARM */
wolfSSL 3:6f956bdb3073 108
wolfSSL 0:d92f9d21154c 109 /* Uncomment next line if using TI-RTOS settings */
wolfSSL 0:d92f9d21154c 110 /* #define WOLFSSL_TIRTOS */
wolfSSL 0:d92f9d21154c 111
wolfSSL 0:d92f9d21154c 112 /* Uncomment next line if building with PicoTCP */
wolfSSL 0:d92f9d21154c 113 /* #define WOLFSSL_PICOTCP */
wolfSSL 0:d92f9d21154c 114
wolfSSL 0:d92f9d21154c 115 /* Uncomment next line if building for PicoTCP demo bundle */
wolfSSL 0:d92f9d21154c 116 /* #define WOLFSSL_PICOTCP_DEMO */
wolfSSL 0:d92f9d21154c 117
wolfSSL 0:d92f9d21154c 118 /* Uncomment next line if building for uITRON4 */
wolfSSL 0:d92f9d21154c 119 /* #define WOLFSSL_uITRON4 */
wolfSSL 0:d92f9d21154c 120
wolfSSL 0:d92f9d21154c 121 /* Uncomment next line if building for uT-Kernel */
wolfSSL 0:d92f9d21154c 122 /* #define WOLFSSL_uTKERNEL2 */
wolfSSL 0:d92f9d21154c 123
wolfSSL 0:d92f9d21154c 124 /* Uncomment next line if using Max Strength build */
wolfSSL 0:d92f9d21154c 125 /* #define WOLFSSL_MAX_STRENGTH */
wolfSSL 0:d92f9d21154c 126
wolfSSL 0:d92f9d21154c 127 /* Uncomment next line if building for VxWorks */
wolfSSL 0:d92f9d21154c 128 /* #define WOLFSSL_VXWORKS */
wolfSSL 0:d92f9d21154c 129
wolfSSL 3:6f956bdb3073 130 /* Uncomment next line to enable deprecated less secure static DH suites */
wolfSSL 3:6f956bdb3073 131 /* #define WOLFSSL_STATIC_DH */
wolfSSL 3:6f956bdb3073 132
wolfSSL 3:6f956bdb3073 133 /* Uncomment next line to enable deprecated less secure static RSA suites */
wolfSSL 3:6f956bdb3073 134 /* #define WOLFSSL_STATIC_RSA */
wolfSSL 3:6f956bdb3073 135
wolfSSL 3:6f956bdb3073 136 /* Uncomment next line if building for ARDUINO */
wolfSSL 3:6f956bdb3073 137 /* #define WOLFSSL_ARDUINO */
wolfSSL 3:6f956bdb3073 138
wolfSSL 0:d92f9d21154c 139 #include <wolfssl/wolfcrypt/visibility.h>
wolfSSL 0:d92f9d21154c 140
wolfSSL 0:d92f9d21154c 141 #define WOLFSSL_USER_SETTINGS
wolfSSL 0:d92f9d21154c 142 #ifdef WOLFSSL_USER_SETTINGS
wolfSSL 0:d92f9d21154c 143 #include <user_settings.h>
wolfSSL 0:d92f9d21154c 144 #endif
wolfSSL 0:d92f9d21154c 145
wolfSSL 0:d92f9d21154c 146
wolfSSL 3:6f956bdb3073 147 /* make sure old RNG name is used with CTaoCrypt FIPS */
wolfSSL 3:6f956bdb3073 148 #ifdef HAVE_FIPS
wolfSSL 3:6f956bdb3073 149 #define WC_RNG RNG
wolfSSL 3:6f956bdb3073 150 #endif
wolfSSL 3:6f956bdb3073 151
wolfSSL 3:6f956bdb3073 152
wolfSSL 0:d92f9d21154c 153 #ifdef IPHONE
wolfSSL 0:d92f9d21154c 154 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 155 #endif
wolfSSL 0:d92f9d21154c 156
wolfSSL 0:d92f9d21154c 157
wolfSSL 0:d92f9d21154c 158 #ifdef COMVERGE
wolfSSL 0:d92f9d21154c 159 #define THREADX
wolfSSL 0:d92f9d21154c 160 #define HAVE_NETX
wolfSSL 0:d92f9d21154c 161 #define WOLFSSL_USER_IO
wolfSSL 0:d92f9d21154c 162 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 163 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 164 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 165 #define NO_SHA512
wolfSSL 0:d92f9d21154c 166 #define NO_DH
wolfSSL 3:6f956bdb3073 167 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
wolfSSL 3:6f956bdb3073 168 /* WOLFSSL_DH_CONST */
wolfSSL 0:d92f9d21154c 169 #define NO_DSA
wolfSSL 0:d92f9d21154c 170 #define NO_HC128
wolfSSL 0:d92f9d21154c 171 #define NO_RSA
wolfSSL 0:d92f9d21154c 172 #define NO_SESSION_CACHE
wolfSSL 0:d92f9d21154c 173 #define HAVE_ECC
wolfSSL 0:d92f9d21154c 174 #endif
wolfSSL 0:d92f9d21154c 175
wolfSSL 0:d92f9d21154c 176
wolfSSL 0:d92f9d21154c 177 #ifdef THREADX
wolfSSL 0:d92f9d21154c 178 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 179 #endif
wolfSSL 0:d92f9d21154c 180
wolfSSL 0:d92f9d21154c 181 #ifdef HAVE_NETX
wolfSSL 0:d92f9d21154c 182 #include "nx_api.h"
wolfSSL 0:d92f9d21154c 183 #endif
wolfSSL 0:d92f9d21154c 184
wolfSSL 0:d92f9d21154c 185 #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
wolfSSL 0:d92f9d21154c 186 #define WOLFSSL_LWIP
wolfSSL 0:d92f9d21154c 187 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 188 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 189 #define WOLFSSL_USER_IO
wolfSSL 0:d92f9d21154c 190 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 191 #endif
wolfSSL 0:d92f9d21154c 192
wolfSSL 3:6f956bdb3073 193 #if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM)
wolfSSL 0:d92f9d21154c 194 #define NO_MAIN_DRIVER
wolfSSL 0:d92f9d21154c 195 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 196 #define USE_CERT_BUFFERS_1024
wolfSSL 0:d92f9d21154c 197 #define BENCH_EMBEDDED
wolfSSL 0:d92f9d21154c 198 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 199 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 200 #define WOLFSSL_USER_IO
wolfSSL 3:6f956bdb3073 201 #define BENCH_EMBEDDED
wolfSSL 0:d92f9d21154c 202 #endif
wolfSSL 0:d92f9d21154c 203
wolfSSL 0:d92f9d21154c 204 #ifdef MICROCHIP_PIC32
wolfSSL 0:d92f9d21154c 205 /* #define WOLFSSL_MICROCHIP_PIC32MZ */
wolfSSL 0:d92f9d21154c 206 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 207 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 208 #define WOLFSSL_USER_IO
wolfSSL 0:d92f9d21154c 209 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 210 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 211 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 212 #define USE_FAST_MATH
wolfSSL 0:d92f9d21154c 213 #define TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 214 #define NEED_AES_TABLES
wolfSSL 3:6f956bdb3073 215 #define WOLFSSL_HAVE_MIN
wolfSSL 0:d92f9d21154c 216 #endif
wolfSSL 0:d92f9d21154c 217
wolfSSL 0:d92f9d21154c 218 #ifdef WOLFSSL_MICROCHIP_PIC32MZ
wolfSSL 0:d92f9d21154c 219 #define WOLFSSL_PIC32MZ_CE
wolfSSL 0:d92f9d21154c 220 #define WOLFSSL_PIC32MZ_CRYPT
wolfSSL 0:d92f9d21154c 221 #define HAVE_AES_ENGINE
wolfSSL 0:d92f9d21154c 222 #define WOLFSSL_PIC32MZ_RNG
wolfSSL 0:d92f9d21154c 223 /* #define WOLFSSL_PIC32MZ_HASH */
wolfSSL 0:d92f9d21154c 224 #define WOLFSSL_AES_COUNTER
wolfSSL 0:d92f9d21154c 225 #define HAVE_AESGCM
wolfSSL 0:d92f9d21154c 226 #define NO_BIG_INT
wolfSSL 0:d92f9d21154c 227 #endif
wolfSSL 0:d92f9d21154c 228
wolfSSL 0:d92f9d21154c 229 #ifdef MICROCHIP_TCPIP_V5
wolfSSL 0:d92f9d21154c 230 /* include timer functions */
wolfSSL 0:d92f9d21154c 231 #include "TCPIP Stack/TCPIP.h"
wolfSSL 0:d92f9d21154c 232 #endif
wolfSSL 0:d92f9d21154c 233
wolfSSL 0:d92f9d21154c 234 #ifdef MICROCHIP_TCPIP
wolfSSL 0:d92f9d21154c 235 /* include timer, NTP functions */
wolfSSL 0:d92f9d21154c 236 #ifdef MICROCHIP_MPLAB_HARMONY
wolfSSL 0:d92f9d21154c 237 #include "tcpip/tcpip.h"
wolfSSL 0:d92f9d21154c 238 #else
wolfSSL 0:d92f9d21154c 239 #include "system/system_services.h"
wolfSSL 0:d92f9d21154c 240 #include "tcpip/sntp.h"
wolfSSL 0:d92f9d21154c 241 #endif
wolfSSL 0:d92f9d21154c 242 #endif
wolfSSL 0:d92f9d21154c 243
wolfSSL 0:d92f9d21154c 244 #ifdef MBED
wolfSSL 0:d92f9d21154c 245 #define WOLFSSL_USER_IO
wolfSSL 3:6f956bdb3073 246 #define NO_FILESYSTEM
wolfSSL 3:6f956bdb3073 247 #define NO_CERT
wolfSSL 3:6f956bdb3073 248 #define USE_CERT_BUFFERS_1024
wolfSSL 0:d92f9d21154c 249 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 250 #define NO_DEV_RANDOM
wolfSSL 3:6f956bdb3073 251 #define NO_SHA512
wolfSSL 3:6f956bdb3073 252 #define NO_DH
wolfSSL 3:6f956bdb3073 253 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
wolfSSL 3:6f956bdb3073 254 /* WOLFSSL_DH_CONST */
wolfSSL 3:6f956bdb3073 255 #define NO_DSA
wolfSSL 3:6f956bdb3073 256 #define NO_HC128
wolfSSL 3:6f956bdb3073 257 #define HAVE_ECC
wolfSSL 3:6f956bdb3073 258 #define NO_SESSION_CACHE
wolfSSL 0:d92f9d21154c 259 #define WOLFSSL_CMSIS_RTOS
wolfSSL 0:d92f9d21154c 260 #endif
wolfSSL 0:d92f9d21154c 261
wolfSSL 3:6f956bdb3073 262
wolfSSL 0:d92f9d21154c 263 #ifdef WOLFSSL_EROAD
wolfSSL 0:d92f9d21154c 264 #define FREESCALE_MQX
wolfSSL 0:d92f9d21154c 265 #define FREESCALE_MMCAU
wolfSSL 0:d92f9d21154c 266 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 267 #define NO_STDIO_FILESYSTEM
wolfSSL 0:d92f9d21154c 268 #define WOLFSSL_LEANPSK
wolfSSL 0:d92f9d21154c 269 #define HAVE_NULL_CIPHER
wolfSSL 0:d92f9d21154c 270 #define NO_OLD_TLS
wolfSSL 0:d92f9d21154c 271 #define NO_ASN
wolfSSL 0:d92f9d21154c 272 #define NO_BIG_INT
wolfSSL 0:d92f9d21154c 273 #define NO_RSA
wolfSSL 0:d92f9d21154c 274 #define NO_DSA
wolfSSL 0:d92f9d21154c 275 #define NO_DH
wolfSSL 3:6f956bdb3073 276 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
wolfSSL 3:6f956bdb3073 277 /* WOLFSSL_DH_CONST */
wolfSSL 0:d92f9d21154c 278 #define NO_CERTS
wolfSSL 0:d92f9d21154c 279 #define NO_PWDBASED
wolfSSL 0:d92f9d21154c 280 #define NO_DES3
wolfSSL 0:d92f9d21154c 281 #define NO_MD4
wolfSSL 0:d92f9d21154c 282 #define NO_RC4
wolfSSL 0:d92f9d21154c 283 #define NO_MD5
wolfSSL 0:d92f9d21154c 284 #define NO_SESSION_CACHE
wolfSSL 0:d92f9d21154c 285 #define NO_MAIN_DRIVER
wolfSSL 0:d92f9d21154c 286 #endif
wolfSSL 0:d92f9d21154c 287
wolfSSL 0:d92f9d21154c 288 #ifdef WOLFSSL_PICOTCP
wolfSSL 0:d92f9d21154c 289 #ifndef errno
wolfSSL 0:d92f9d21154c 290 #define errno pico_err
wolfSSL 0:d92f9d21154c 291 #endif
wolfSSL 0:d92f9d21154c 292 #include "pico_defines.h"
wolfSSL 0:d92f9d21154c 293 #include "pico_stack.h"
wolfSSL 0:d92f9d21154c 294 #include "pico_constants.h"
wolfSSL 0:d92f9d21154c 295 #include "pico_protocol.h"
wolfSSL 0:d92f9d21154c 296 #define CUSTOM_RAND_GENERATE pico_rand
wolfSSL 0:d92f9d21154c 297 #endif
wolfSSL 0:d92f9d21154c 298
wolfSSL 0:d92f9d21154c 299 #ifdef WOLFSSL_PICOTCP_DEMO
wolfSSL 0:d92f9d21154c 300 #define WOLFSSL_STM32
wolfSSL 0:d92f9d21154c 301 #define USE_FAST_MATH
wolfSSL 0:d92f9d21154c 302 #define TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 303 #define XMALLOC(s, h, type) PICO_ZALLOC((s))
wolfSSL 0:d92f9d21154c 304 #define XFREE(p, h, type) PICO_FREE((p))
wolfSSL 0:d92f9d21154c 305 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 306 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 307 #define WOLFSSL_USER_IO
wolfSSL 0:d92f9d21154c 308 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 309 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 310 #endif
wolfSSL 0:d92f9d21154c 311
wolfSSL 0:d92f9d21154c 312 #ifdef FREERTOS_WINSIM
wolfSSL 0:d92f9d21154c 313 #define FREERTOS
wolfSSL 0:d92f9d21154c 314 #define USE_WINDOWS_API
wolfSSL 0:d92f9d21154c 315 #endif
wolfSSL 0:d92f9d21154c 316
wolfSSL 0:d92f9d21154c 317
wolfSSL 0:d92f9d21154c 318 #ifdef WOLFSSL_VXWORKS
wolfSSL 3:6f956bdb3073 319 /* VxWorks simulator incorrectly detects building for i386 */
wolfSSL 3:6f956bdb3073 320 #ifdef VXWORKS_SIM
wolfSSL 3:6f956bdb3073 321 #define TFM_NO_ASM
wolfSSL 3:6f956bdb3073 322 #endif
wolfSSL 3:6f956bdb3073 323 #define WOLFSSL_HAVE_MIN
wolfSSL 3:6f956bdb3073 324 #define USE_FAST_MATH
wolfSSL 3:6f956bdb3073 325 #define TFM_TIMING_RESISTANT
wolfSSL 3:6f956bdb3073 326 #define NO_MAIN_DRIVER
wolfSSL 0:d92f9d21154c 327 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 328 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 329 #endif
wolfSSL 0:d92f9d21154c 330
wolfSSL 0:d92f9d21154c 331
wolfSSL 3:6f956bdb3073 332 #ifdef WOLFSSL_ARDUINO
wolfSSL 3:6f956bdb3073 333 #define NO_WRITEV
wolfSSL 3:6f956bdb3073 334 #define NO_WOLFSSL_DIR
wolfSSL 3:6f956bdb3073 335 #define SINGLE_THREADED
wolfSSL 3:6f956bdb3073 336 #define NO_DEV_RANDOM
wolfSSL 3:6f956bdb3073 337 #ifndef INTEL_GALILEO /* Galileo has time.h compatibility */
wolfSSL 3:6f956bdb3073 338 #define TIME_OVERRIDES /* must define XTIME and XGMTIME externally */
wolfSSL 3:6f956bdb3073 339 #endif
wolfSSL 3:6f956bdb3073 340 #define WOLFSSL_USER_IO
wolfSSL 3:6f956bdb3073 341 #define HAVE_ECC
wolfSSL 3:6f956bdb3073 342 #define NO_DH
wolfSSL 3:6f956bdb3073 343 #define NO_SESSION_CACHE
wolfSSL 3:6f956bdb3073 344 #define USE_SLOW_SHA
wolfSSL 3:6f956bdb3073 345 #define NO_WOLFSSL_SERVER
wolfSSL 3:6f956bdb3073 346 #define NO_ERROR_STRINGS
wolfSSL 3:6f956bdb3073 347 #endif
wolfSSL 3:6f956bdb3073 348
wolfSSL 3:6f956bdb3073 349
wolfSSL 0:d92f9d21154c 350 /* Micrium will use Visual Studio for compilation but not the Win32 API */
wolfSSL 3:6f956bdb3073 351 #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\
wolfSSL 0:d92f9d21154c 352 && !defined(EBSNET) && !defined(WOLFSSL_EROAD)
wolfSSL 0:d92f9d21154c 353 #define USE_WINDOWS_API
wolfSSL 0:d92f9d21154c 354 #endif
wolfSSL 0:d92f9d21154c 355
wolfSSL 3:6f956bdb3073 356 #if defined(WOLFSSL_uITRON4)
wolfSSL 3:6f956bdb3073 357
wolfSSL 3:6f956bdb3073 358 #define XMALLOC_USER
wolfSSL 3:6f956bdb3073 359 #include <stddef.h>
wolfSSL 3:6f956bdb3073 360 #define ITRON_POOL_SIZE 1024*20
wolfSSL 3:6f956bdb3073 361 extern int uITRON4_minit(size_t poolsz) ;
wolfSSL 3:6f956bdb3073 362 extern void *uITRON4_malloc(size_t sz) ;
wolfSSL 3:6f956bdb3073 363 extern void *uITRON4_realloc(void *p, size_t sz) ;
wolfSSL 3:6f956bdb3073 364 extern void uITRON4_free(void *p) ;
wolfSSL 3:6f956bdb3073 365
wolfSSL 3:6f956bdb3073 366 #define XMALLOC(sz, heap, type) uITRON4_malloc(sz)
wolfSSL 3:6f956bdb3073 367 #define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz)
wolfSSL 3:6f956bdb3073 368 #define XFREE(p, heap, type) uITRON4_free(p)
wolfSSL 3:6f956bdb3073 369 #endif
wolfSSL 3:6f956bdb3073 370
wolfSSL 3:6f956bdb3073 371 #if defined(WOLFSSL_uTKERNEL2)
wolfSSL 3:6f956bdb3073 372 #define WOLFSSL_CLOSESOCKET
wolfSSL 3:6f956bdb3073 373 #define XMALLOC_USER
wolfSSL 3:6f956bdb3073 374 int uTKernel_init_mpool(unsigned int sz) ; /* initializing malloc pool */
wolfSSL 3:6f956bdb3073 375 void *uTKernel_malloc(unsigned int sz) ;
wolfSSL 3:6f956bdb3073 376 void *uTKernel_realloc(void *p, unsigned int sz) ;
wolfSSL 3:6f956bdb3073 377 void uTKernel_free(void *p) ;
wolfSSL 3:6f956bdb3073 378 #define XMALLOC(s, h, type) uTKernel_malloc((s))
wolfSSL 3:6f956bdb3073 379 #define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n))
wolfSSL 3:6f956bdb3073 380 #define XFREE(p, h, type) uTKernel_free((p))
wolfSSL 3:6f956bdb3073 381
wolfSSL 3:6f956bdb3073 382 #include <stdio.h>
wolfSSL 3:6f956bdb3073 383 #include "tm/tmonitor.h"
wolfSSL 3:6f956bdb3073 384 static char *fgets(char *buff, int sz, FILE *fp)
wolfSSL 3:6f956bdb3073 385 /*static char * gets(char *buff)*/
wolfSSL 3:6f956bdb3073 386 {
wolfSSL 3:6f956bdb3073 387 char * p = buff ;
wolfSSL 3:6f956bdb3073 388 *p = '\0' ;
wolfSSL 3:6f956bdb3073 389 while(1) {
wolfSSL 3:6f956bdb3073 390 *p = tm_getchar(-1) ;
wolfSSL 3:6f956bdb3073 391 tm_putchar(*p) ;
wolfSSL 3:6f956bdb3073 392 if(*p == '\r') {
wolfSSL 3:6f956bdb3073 393 tm_putchar('\n') ;
wolfSSL 3:6f956bdb3073 394 *p = '\0' ;
wolfSSL 3:6f956bdb3073 395 break ;
wolfSSL 3:6f956bdb3073 396 }
wolfSSL 3:6f956bdb3073 397 p ++ ;
wolfSSL 3:6f956bdb3073 398 }
wolfSSL 3:6f956bdb3073 399 return buff ;
wolfSSL 3:6f956bdb3073 400 }
wolfSSL 3:6f956bdb3073 401
wolfSSL 3:6f956bdb3073 402 #endif
wolfSSL 3:6f956bdb3073 403
wolfSSL 0:d92f9d21154c 404
wolfSSL 0:d92f9d21154c 405 #if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER)
wolfSSL 0:d92f9d21154c 406 #include <stdlib.h>
wolfSSL 0:d92f9d21154c 407 #define XMALLOC(s, h, type) malloc((s))
wolfSSL 0:d92f9d21154c 408 #define XFREE(p, h, type) free((p))
wolfSSL 0:d92f9d21154c 409 #define XREALLOC(p, n, h, t) realloc((p), (n))
wolfSSL 0:d92f9d21154c 410 #endif
wolfSSL 0:d92f9d21154c 411
wolfSSL 0:d92f9d21154c 412 #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
wolfSSL 0:d92f9d21154c 413 #undef XMALLOC
wolfSSL 0:d92f9d21154c 414 #define XMALLOC yaXMALLOC
wolfSSL 0:d92f9d21154c 415 #undef XFREE
wolfSSL 0:d92f9d21154c 416 #define XFREE yaXFREE
wolfSSL 0:d92f9d21154c 417 #undef XREALLOC
wolfSSL 0:d92f9d21154c 418 #define XREALLOC yaXREALLOC
wolfSSL 0:d92f9d21154c 419 #endif
wolfSSL 0:d92f9d21154c 420
wolfSSL 0:d92f9d21154c 421
wolfSSL 0:d92f9d21154c 422 #ifdef FREERTOS
wolfSSL 3:6f956bdb3073 423 #include "FreeRTOS.h"
wolfSSL 3:6f956bdb3073 424
wolfSSL 3:6f956bdb3073 425 /* FreeRTOS pvPortRealloc() only in AVR32_UC3 port */
wolfSSL 3:6f956bdb3073 426 #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY)
wolfSSL 3:6f956bdb3073 427 #define XMALLOC(s, h, type) pvPortMalloc((s))
wolfSSL 3:6f956bdb3073 428 #define XFREE(p, h, type) vPortFree((p))
wolfSSL 3:6f956bdb3073 429 #endif
wolfSSL 3:6f956bdb3073 430
wolfSSL 0:d92f9d21154c 431 #ifndef NO_WRITEV
wolfSSL 0:d92f9d21154c 432 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 433 #endif
wolfSSL 0:d92f9d21154c 434 #ifndef HAVE_SHA512
wolfSSL 0:d92f9d21154c 435 #ifndef NO_SHA512
wolfSSL 0:d92f9d21154c 436 #define NO_SHA512
wolfSSL 0:d92f9d21154c 437 #endif
wolfSSL 0:d92f9d21154c 438 #endif
wolfSSL 0:d92f9d21154c 439 #ifndef HAVE_DH
wolfSSL 0:d92f9d21154c 440 #ifndef NO_DH
wolfSSL 0:d92f9d21154c 441 #define NO_DH
wolfSSL 0:d92f9d21154c 442 #endif
wolfSSL 0:d92f9d21154c 443 #endif
wolfSSL 0:d92f9d21154c 444 #ifndef NO_DSA
wolfSSL 0:d92f9d21154c 445 #define NO_DSA
wolfSSL 0:d92f9d21154c 446 #endif
wolfSSL 0:d92f9d21154c 447 #ifndef NO_HC128
wolfSSL 0:d92f9d21154c 448 #define NO_HC128
wolfSSL 0:d92f9d21154c 449 #endif
wolfSSL 0:d92f9d21154c 450
wolfSSL 0:d92f9d21154c 451 #ifndef SINGLE_THREADED
wolfSSL 0:d92f9d21154c 452 #include "semphr.h"
wolfSSL 0:d92f9d21154c 453 #endif
wolfSSL 0:d92f9d21154c 454 #endif
wolfSSL 0:d92f9d21154c 455
wolfSSL 3:6f956bdb3073 456 #ifdef FREERTOS_TCP
wolfSSL 3:6f956bdb3073 457
wolfSSL 3:6f956bdb3073 458 #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER)
wolfSSL 3:6f956bdb3073 459 #define XMALLOC(s, h, type) pvPortMalloc((s))
wolfSSL 3:6f956bdb3073 460 #define XFREE(p, h, type) vPortFree((p))
wolfSSL 3:6f956bdb3073 461 #endif
wolfSSL 3:6f956bdb3073 462
wolfSSL 3:6f956bdb3073 463 #define WOLFSSL_GENSEED_FORTEST
wolfSSL 3:6f956bdb3073 464
wolfSSL 3:6f956bdb3073 465 #define NO_WOLFSSL_DIR
wolfSSL 3:6f956bdb3073 466 #define NO_WRITEV
wolfSSL 3:6f956bdb3073 467 #define WOLFSSL_HAVE_MIN
wolfSSL 3:6f956bdb3073 468 #define USE_FAST_MATH
wolfSSL 3:6f956bdb3073 469 #define TFM_TIMING_REGISTANT
wolfSSL 3:6f956bdb3073 470 #define NO_MAIN_DRIVER
wolfSSL 3:6f956bdb3073 471
wolfSSL 3:6f956bdb3073 472 #endif
wolfSSL 3:6f956bdb3073 473
wolfSSL 0:d92f9d21154c 474 #ifdef WOLFSSL_TIRTOS
wolfSSL 0:d92f9d21154c 475 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 476 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 477 #define NO_WOLFSSL_DIR
wolfSSL 0:d92f9d21154c 478 #define USE_FAST_MATH
wolfSSL 0:d92f9d21154c 479 #define TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 480 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 481 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 482 #define USE_CERT_BUFFERS_2048
wolfSSL 0:d92f9d21154c 483 #define NO_ERROR_STRINGS
wolfSSL 0:d92f9d21154c 484 #define USER_TIME
wolfSSL 3:6f956bdb3073 485 #define HAVE_ECC
wolfSSL 0:d92f9d21154c 486
wolfSSL 0:d92f9d21154c 487 #ifdef __IAR_SYSTEMS_ICC__
wolfSSL 0:d92f9d21154c 488 #pragma diag_suppress=Pa089
wolfSSL 0:d92f9d21154c 489 #elif !defined(__GNUC__)
wolfSSL 0:d92f9d21154c 490 /* Suppress the sslpro warning */
wolfSSL 0:d92f9d21154c 491 #pragma diag_suppress=11
wolfSSL 0:d92f9d21154c 492 #endif
wolfSSL 0:d92f9d21154c 493
wolfSSL 0:d92f9d21154c 494 #include <ti/sysbios/hal/Seconds.h>
wolfSSL 0:d92f9d21154c 495 #endif
wolfSSL 0:d92f9d21154c 496
wolfSSL 0:d92f9d21154c 497 #ifdef EBSNET
wolfSSL 0:d92f9d21154c 498 #include "rtip.h"
wolfSSL 0:d92f9d21154c 499
wolfSSL 0:d92f9d21154c 500 /* #define DEBUG_WOLFSSL */
wolfSSL 0:d92f9d21154c 501 #define NO_WOLFSSL_DIR /* tbd */
wolfSSL 0:d92f9d21154c 502
wolfSSL 0:d92f9d21154c 503 #if (POLLOS)
wolfSSL 0:d92f9d21154c 504 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 505 #endif
wolfSSL 0:d92f9d21154c 506
wolfSSL 0:d92f9d21154c 507 #if (RTPLATFORM)
wolfSSL 0:d92f9d21154c 508 #if (!RTP_LITTLE_ENDIAN)
wolfSSL 0:d92f9d21154c 509 #define BIG_ENDIAN_ORDER
wolfSSL 0:d92f9d21154c 510 #endif
wolfSSL 0:d92f9d21154c 511 #else
wolfSSL 0:d92f9d21154c 512 #if (!KS_LITTLE_ENDIAN)
wolfSSL 0:d92f9d21154c 513 #define BIG_ENDIAN_ORDER
wolfSSL 0:d92f9d21154c 514 #endif
wolfSSL 0:d92f9d21154c 515 #endif
wolfSSL 0:d92f9d21154c 516
wolfSSL 0:d92f9d21154c 517 #if (WINMSP3)
wolfSSL 0:d92f9d21154c 518 #undef SIZEOF_LONG
wolfSSL 0:d92f9d21154c 519 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 520 #else
wolfSSL 0:d92f9d21154c 521 #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
wolfSSL 0:d92f9d21154c 522 #endif
wolfSSL 0:d92f9d21154c 523
wolfSSL 0:d92f9d21154c 524 #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
wolfSSL 0:d92f9d21154c 525 #define XFREE(p, h, type) (rtp_free(p))
wolfSSL 0:d92f9d21154c 526 #define XREALLOC(p, n, h, t) realloc((p), (n))
wolfSSL 0:d92f9d21154c 527
wolfSSL 0:d92f9d21154c 528 #endif /* EBSNET */
wolfSSL 0:d92f9d21154c 529
wolfSSL 0:d92f9d21154c 530 #ifdef WOLFSSL_GAME_BUILD
wolfSSL 0:d92f9d21154c 531 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 532 #if defined(__PPU) || defined(__XENON)
wolfSSL 0:d92f9d21154c 533 #define BIG_ENDIAN_ORDER
wolfSSL 0:d92f9d21154c 534 #endif
wolfSSL 0:d92f9d21154c 535 #endif
wolfSSL 0:d92f9d21154c 536
wolfSSL 0:d92f9d21154c 537 #ifdef WOLFSSL_LSR
wolfSSL 0:d92f9d21154c 538 #define HAVE_WEBSERVER
wolfSSL 0:d92f9d21154c 539 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 540 #define WOLFSSL_LOW_MEMORY
wolfSSL 0:d92f9d21154c 541 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 542 #define NO_SHA512
wolfSSL 0:d92f9d21154c 543 #define NO_DH
wolfSSL 3:6f956bdb3073 544 /* Allows use of DH with fixed points if uncommented and NO_DH is removed */
wolfSSL 3:6f956bdb3073 545 /* WOLFSSL_DH_CONST */
wolfSSL 0:d92f9d21154c 546 #define NO_DSA
wolfSSL 0:d92f9d21154c 547 #define NO_HC128
wolfSSL 0:d92f9d21154c 548 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 549 #define NO_WOLFSSL_DIR
wolfSSL 0:d92f9d21154c 550 #define NO_RABBIT
wolfSSL 0:d92f9d21154c 551 #ifndef NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 552 #define LSR_FS
wolfSSL 0:d92f9d21154c 553 #include "inc/hw_types.h"
wolfSSL 0:d92f9d21154c 554 #include "fs.h"
wolfSSL 0:d92f9d21154c 555 #endif
wolfSSL 0:d92f9d21154c 556 #define WOLFSSL_LWIP
wolfSSL 0:d92f9d21154c 557 #include <errno.h> /* for tcp errno */
wolfSSL 0:d92f9d21154c 558 #define WOLFSSL_SAFERTOS
wolfSSL 0:d92f9d21154c 559 #if defined(__IAR_SYSTEMS_ICC__)
wolfSSL 0:d92f9d21154c 560 /* enum uses enum */
wolfSSL 0:d92f9d21154c 561 #pragma diag_suppress=Pa089
wolfSSL 0:d92f9d21154c 562 #endif
wolfSSL 0:d92f9d21154c 563 #endif
wolfSSL 0:d92f9d21154c 564
wolfSSL 0:d92f9d21154c 565 #ifdef WOLFSSL_SAFERTOS
wolfSSL 0:d92f9d21154c 566 #ifndef SINGLE_THREADED
wolfSSL 0:d92f9d21154c 567 #include "SafeRTOS/semphr.h"
wolfSSL 0:d92f9d21154c 568 #endif
wolfSSL 0:d92f9d21154c 569
wolfSSL 0:d92f9d21154c 570 #include "SafeRTOS/heap.h"
wolfSSL 0:d92f9d21154c 571 #define XMALLOC(s, h, type) pvPortMalloc((s))
wolfSSL 0:d92f9d21154c 572 #define XFREE(p, h, type) vPortFree((p))
wolfSSL 0:d92f9d21154c 573 #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
wolfSSL 0:d92f9d21154c 574 #endif
wolfSSL 0:d92f9d21154c 575
wolfSSL 0:d92f9d21154c 576 #ifdef WOLFSSL_LOW_MEMORY
wolfSSL 0:d92f9d21154c 577 #undef RSA_LOW_MEM
wolfSSL 0:d92f9d21154c 578 #define RSA_LOW_MEM
wolfSSL 0:d92f9d21154c 579 #undef WOLFSSL_SMALL_STACK
wolfSSL 0:d92f9d21154c 580 #define WOLFSSL_SMALL_STACK
wolfSSL 0:d92f9d21154c 581 #undef TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 582 #define TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 583 #endif
wolfSSL 0:d92f9d21154c 584
wolfSSL 0:d92f9d21154c 585 #ifdef FREESCALE_MQX
wolfSSL 3:6f956bdb3073 586 #define FREESCALE_COMMON
wolfSSL 0:d92f9d21154c 587 #include "mqx.h"
wolfSSL 0:d92f9d21154c 588 #ifndef NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 589 #include "mfs.h"
wolfSSL 3:6f956bdb3073 590 #if MQX_USE_IO_OLD
wolfSSL 3:6f956bdb3073 591 #include "fio.h"
wolfSSL 3:6f956bdb3073 592 #else
wolfSSL 3:6f956bdb3073 593 #include "nio.h"
wolfSSL 3:6f956bdb3073 594 #endif
wolfSSL 0:d92f9d21154c 595 #endif
wolfSSL 0:d92f9d21154c 596 #ifndef SINGLE_THREADED
wolfSSL 0:d92f9d21154c 597 #include "mutex.h"
wolfSSL 0:d92f9d21154c 598 #endif
wolfSSL 0:d92f9d21154c 599
wolfSSL 0:d92f9d21154c 600 #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
wolfSSL 0:d92f9d21154c 601 #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
wolfSSL 0:d92f9d21154c 602 /* Note: MQX has no realloc, using fastmath above */
wolfSSL 0:d92f9d21154c 603 #endif
wolfSSL 0:d92f9d21154c 604
wolfSSL 3:6f956bdb3073 605 #ifdef FREESCALE_KSDK_MQX
wolfSSL 3:6f956bdb3073 606 #define FREESCALE_COMMON
wolfSSL 3:6f956bdb3073 607 #include <mqx.h>
wolfSSL 3:6f956bdb3073 608 #ifndef NO_FILESYSTEM
wolfSSL 3:6f956bdb3073 609 #if MQX_USE_IO_OLD
wolfSSL 3:6f956bdb3073 610 #include <fio.h>
wolfSSL 3:6f956bdb3073 611 #else
wolfSSL 3:6f956bdb3073 612 #include <stdio.h>
wolfSSL 3:6f956bdb3073 613 #include <nio.h>
wolfSSL 3:6f956bdb3073 614 #endif
wolfSSL 3:6f956bdb3073 615 #endif
wolfSSL 3:6f956bdb3073 616 #ifndef SINGLE_THREADED
wolfSSL 3:6f956bdb3073 617 #include <mutex.h>
wolfSSL 3:6f956bdb3073 618 #endif
wolfSSL 3:6f956bdb3073 619
wolfSSL 3:6f956bdb3073 620 #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
wolfSSL 3:6f956bdb3073 621 #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
wolfSSL 3:6f956bdb3073 622 #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
wolfSSL 3:6f956bdb3073 623
wolfSSL 3:6f956bdb3073 624 #define MQX_FILE_PTR FILE *
wolfSSL 3:6f956bdb3073 625 #define IO_SEEK_SET SEEK_SET
wolfSSL 3:6f956bdb3073 626 #define IO_SEEK_END SEEK_END
wolfSSL 3:6f956bdb3073 627 #endif
wolfSSL 3:6f956bdb3073 628
wolfSSL 3:6f956bdb3073 629 #ifdef FREESCALE_KSDK_BM
wolfSSL 3:6f956bdb3073 630 #define FREESCALE_COMMON
wolfSSL 3:6f956bdb3073 631 #define WOLFSSL_USER_IO
wolfSSL 3:6f956bdb3073 632 #define SINGLE_THREADED
wolfSSL 3:6f956bdb3073 633 #define NO_FILESYSTEM
wolfSSL 3:6f956bdb3073 634 #define USE_WOLFSSL_MEMORY
wolfSSL 3:6f956bdb3073 635 #endif
wolfSSL 3:6f956bdb3073 636
wolfSSL 3:6f956bdb3073 637 #ifdef FREESCALE_FREE_RTOS
wolfSSL 3:6f956bdb3073 638 #define FREESCALE_COMMON
wolfSSL 3:6f956bdb3073 639 #define NO_FILESYSTEM
wolfSSL 3:6f956bdb3073 640 #define NO_MAIN_DRIVER
wolfSSL 3:6f956bdb3073 641 #define XMALLOC(s, h, t) OSA_MemAlloc(s);(void)h;(void)t;
wolfSSL 3:6f956bdb3073 642 #define XFREE(p, h, t) {void* xp = (p); if((xp)) OSA_MemFree((xp));}
wolfSSL 3:6f956bdb3073 643 #ifdef FREESCALE_KSDK_BM
wolfSSL 3:6f956bdb3073 644 #error Baremetal and FreeRTOS cannot be both enabled at the same time!
wolfSSL 3:6f956bdb3073 645 #endif
wolfSSL 3:6f956bdb3073 646 #ifndef SINGLE_THREADED
wolfSSL 3:6f956bdb3073 647 #include "FreeRTOS.h"
wolfSSL 3:6f956bdb3073 648 #include "semphr.h"
wolfSSL 3:6f956bdb3073 649 #endif
wolfSSL 3:6f956bdb3073 650 #endif
wolfSSL 3:6f956bdb3073 651
wolfSSL 3:6f956bdb3073 652 #ifdef FREESCALE_COMMON
wolfSSL 3:6f956bdb3073 653 #define SIZEOF_LONG_LONG 8
wolfSSL 3:6f956bdb3073 654
wolfSSL 3:6f956bdb3073 655 /* disable features */
wolfSSL 3:6f956bdb3073 656 #define NO_WRITEV
wolfSSL 3:6f956bdb3073 657 #define NO_DEV_RANDOM
wolfSSL 3:6f956bdb3073 658 #define NO_RABBIT
wolfSSL 3:6f956bdb3073 659 #define NO_WOLFSSL_DIR
wolfSSL 3:6f956bdb3073 660
wolfSSL 3:6f956bdb3073 661 /* enable features */
wolfSSL 3:6f956bdb3073 662 #define USE_FAST_MATH
wolfSSL 3:6f956bdb3073 663 #define HAVE_ECC
wolfSSL 3:6f956bdb3073 664 #define HAVE_AESGCM
wolfSSL 3:6f956bdb3073 665
wolfSSL 3:6f956bdb3073 666 /* memory reduction */
wolfSSL 3:6f956bdb3073 667 #define TFM_TIMING_RESISTANT
wolfSSL 3:6f956bdb3073 668 #define ECC_TIMING_RESISTANT
wolfSSL 3:6f956bdb3073 669 #define ALT_ECC_SIZE
wolfSSL 3:6f956bdb3073 670
wolfSSL 3:6f956bdb3073 671 /* setting for PIT timer */
wolfSSL 3:6f956bdb3073 672 #define PIT_INSTANCE 0
wolfSSL 3:6f956bdb3073 673 #define PIT_CHANNEL 0
wolfSSL 3:6f956bdb3073 674
wolfSSL 3:6f956bdb3073 675 #if defined(FREESCALE_KSDK_MQX) || defined(FREESCALE_KSDK_BM) || \
wolfSSL 3:6f956bdb3073 676 defined(FREESCALE_FREE_RTOS)
wolfSSL 3:6f956bdb3073 677 #include "fsl_device_registers.h"
wolfSSL 3:6f956bdb3073 678 #endif
wolfSSL 3:6f956bdb3073 679
wolfSSL 3:6f956bdb3073 680 /* random seed */
wolfSSL 3:6f956bdb3073 681 #define NO_OLD_RNGNAME
wolfSSL 3:6f956bdb3073 682 #if (FSL_FEATURE_SOC_TRNG_COUNT > 0)
wolfSSL 3:6f956bdb3073 683 #define FREESCALE_TRNG
wolfSSL 3:6f956bdb3073 684 #define TRNG_INSTANCE (0)
wolfSSL 3:6f956bdb3073 685 #elif (FSL_FEATURE_SOC_RNG_COUNT > 0)
wolfSSL 3:6f956bdb3073 686 #include "fsl_rnga_driver.h"
wolfSSL 3:6f956bdb3073 687 #define FREESCALE_RNGA
wolfSSL 3:6f956bdb3073 688 #define RNGA_INSTANCE (0)
wolfSSL 3:6f956bdb3073 689 #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS)
wolfSSL 3:6f956bdb3073 690 /* defaulting to K70 RNGA, user should change if different */
wolfSSL 3:6f956bdb3073 691 /* #define FREESCALE_K53_RNGB */
wolfSSL 3:6f956bdb3073 692 #define FREESCALE_K70_RNGA
wolfSSL 3:6f956bdb3073 693 #endif
wolfSSL 3:6f956bdb3073 694
wolfSSL 3:6f956bdb3073 695 /* HW crypto */
wolfSSL 3:6f956bdb3073 696 /* #define FREESCALE_MMCAU */
wolfSSL 3:6f956bdb3073 697 #endif
wolfSSL 3:6f956bdb3073 698
wolfSSL 0:d92f9d21154c 699 #ifdef WOLFSSL_STM32F2
wolfSSL 0:d92f9d21154c 700 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 701 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 702 #define NO_WOLFSSL_DIR
wolfSSL 0:d92f9d21154c 703 #define NO_RABBIT
wolfSSL 0:d92f9d21154c 704 #define STM32F2_RNG
wolfSSL 0:d92f9d21154c 705 #define STM32F2_CRYPTO
wolfSSL 0:d92f9d21154c 706 #define KEIL_INTRINSICS
wolfSSL 0:d92f9d21154c 707 #endif
wolfSSL 0:d92f9d21154c 708
wolfSSL 0:d92f9d21154c 709 #ifdef MICRIUM
wolfSSL 0:d92f9d21154c 710
wolfSSL 0:d92f9d21154c 711 #include "stdlib.h"
wolfSSL 0:d92f9d21154c 712 #include "net_cfg.h"
wolfSSL 0:d92f9d21154c 713 #include "ssl_cfg.h"
wolfSSL 0:d92f9d21154c 714 #include "net_secure_os.h"
wolfSSL 0:d92f9d21154c 715
wolfSSL 0:d92f9d21154c 716 #define WOLFSSL_TYPES
wolfSSL 0:d92f9d21154c 717
wolfSSL 0:d92f9d21154c 718 typedef CPU_INT08U byte;
wolfSSL 0:d92f9d21154c 719 typedef CPU_INT16U word16;
wolfSSL 0:d92f9d21154c 720 typedef CPU_INT32U word32;
wolfSSL 0:d92f9d21154c 721
wolfSSL 0:d92f9d21154c 722 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
wolfSSL 0:d92f9d21154c 723 #define SIZEOF_LONG 4
wolfSSL 0:d92f9d21154c 724 #undef SIZEOF_LONG_LONG
wolfSSL 0:d92f9d21154c 725 #else
wolfSSL 0:d92f9d21154c 726 #undef SIZEOF_LONG
wolfSSL 0:d92f9d21154c 727 #define SIZEOF_LONG_LONG 8
wolfSSL 0:d92f9d21154c 728 #endif
wolfSSL 0:d92f9d21154c 729
wolfSSL 0:d92f9d21154c 730 #define STRING_USER
wolfSSL 0:d92f9d21154c 731
wolfSSL 0:d92f9d21154c 732 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
wolfSSL 0:d92f9d21154c 733 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
wolfSSL 0:d92f9d21154c 734 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
wolfSSL 0:d92f9d21154c 735 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
wolfSSL 0:d92f9d21154c 736 #define XSTRNCMP(pstr_1, pstr_2, len_max) \
wolfSSL 0:d92f9d21154c 737 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
wolfSSL 0:d92f9d21154c 738 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
wolfSSL 0:d92f9d21154c 739 #define XSTRSTR(pstr, pstr_srch) \
wolfSSL 0:d92f9d21154c 740 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
wolfSSL 0:d92f9d21154c 741 (CPU_CHAR *)(pstr_srch)))
wolfSSL 0:d92f9d21154c 742 #define XMEMSET(pmem, data_val, size) \
wolfSSL 0:d92f9d21154c 743 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
wolfSSL 0:d92f9d21154c 744 (CPU_SIZE_T)(size)))
wolfSSL 0:d92f9d21154c 745 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
wolfSSL 0:d92f9d21154c 746 (void *)(psrc), (CPU_SIZE_T)(size)))
wolfSSL 0:d92f9d21154c 747 #define XMEMCMP(pmem_1, pmem_2, size) \
wolfSSL 0:d92f9d21154c 748 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
wolfSSL 0:d92f9d21154c 749 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
wolfSSL 0:d92f9d21154c 750 #define XMEMMOVE XMEMCPY
wolfSSL 0:d92f9d21154c 751
wolfSSL 0:d92f9d21154c 752 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 753 #define MICRIUM_MALLOC
wolfSSL 0:d92f9d21154c 754 #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
wolfSSL 0:d92f9d21154c 755 (CPU_SIZE_T)(s), (void *)0))
wolfSSL 0:d92f9d21154c 756 #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
wolfSSL 0:d92f9d21154c 757 (p), (void *)0))
wolfSSL 0:d92f9d21154c 758 #define XREALLOC(p, n, h, t) realloc((p), (n))
wolfSSL 0:d92f9d21154c 759 #endif
wolfSSL 0:d92f9d21154c 760
wolfSSL 0:d92f9d21154c 761 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 762 #undef NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 763 #else
wolfSSL 0:d92f9d21154c 764 #define NO_FILESYSTEM
wolfSSL 0:d92f9d21154c 765 #endif
wolfSSL 0:d92f9d21154c 766
wolfSSL 0:d92f9d21154c 767 #if (SSL_CFG_TRACE_LEVEL == WOLFSSL_TRACE_LEVEL_DBG)
wolfSSL 0:d92f9d21154c 768 #define DEBUG_WOLFSSL
wolfSSL 0:d92f9d21154c 769 #else
wolfSSL 0:d92f9d21154c 770 #undef DEBUG_WOLFSSL
wolfSSL 0:d92f9d21154c 771 #endif
wolfSSL 0:d92f9d21154c 772
wolfSSL 0:d92f9d21154c 773 #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 774 #define OPENSSL_EXTRA
wolfSSL 0:d92f9d21154c 775 #else
wolfSSL 0:d92f9d21154c 776 #undef OPENSSL_EXTRA
wolfSSL 0:d92f9d21154c 777 #endif
wolfSSL 0:d92f9d21154c 778
wolfSSL 0:d92f9d21154c 779 #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 780 #undef SINGLE_THREADED
wolfSSL 0:d92f9d21154c 781 #else
wolfSSL 0:d92f9d21154c 782 #define SINGLE_THREADED
wolfSSL 0:d92f9d21154c 783 #endif
wolfSSL 0:d92f9d21154c 784
wolfSSL 0:d92f9d21154c 785 #if (SSL_CFG_DH_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 786 #undef NO_DH
wolfSSL 0:d92f9d21154c 787 #else
wolfSSL 0:d92f9d21154c 788 #define NO_DH
wolfSSL 0:d92f9d21154c 789 #endif
wolfSSL 0:d92f9d21154c 790
wolfSSL 0:d92f9d21154c 791 #if (SSL_CFG_DSA_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 792 #undef NO_DSA
wolfSSL 0:d92f9d21154c 793 #else
wolfSSL 0:d92f9d21154c 794 #define NO_DSA
wolfSSL 0:d92f9d21154c 795 #endif
wolfSSL 0:d92f9d21154c 796
wolfSSL 0:d92f9d21154c 797 #if (SSL_CFG_PSK_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 798 #undef NO_PSK
wolfSSL 0:d92f9d21154c 799 #else
wolfSSL 0:d92f9d21154c 800 #define NO_PSK
wolfSSL 0:d92f9d21154c 801 #endif
wolfSSL 0:d92f9d21154c 802
wolfSSL 0:d92f9d21154c 803 #if (SSL_CFG_3DES_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 804 #undef NO_DES
wolfSSL 0:d92f9d21154c 805 #else
wolfSSL 0:d92f9d21154c 806 #define NO_DES
wolfSSL 0:d92f9d21154c 807 #endif
wolfSSL 0:d92f9d21154c 808
wolfSSL 0:d92f9d21154c 809 #if (SSL_CFG_AES_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 810 #undef NO_AES
wolfSSL 0:d92f9d21154c 811 #else
wolfSSL 0:d92f9d21154c 812 #define NO_AES
wolfSSL 0:d92f9d21154c 813 #endif
wolfSSL 0:d92f9d21154c 814
wolfSSL 0:d92f9d21154c 815 #if (SSL_CFG_RC4_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 816 #undef NO_RC4
wolfSSL 0:d92f9d21154c 817 #else
wolfSSL 0:d92f9d21154c 818 #define NO_RC4
wolfSSL 0:d92f9d21154c 819 #endif
wolfSSL 0:d92f9d21154c 820
wolfSSL 0:d92f9d21154c 821 #if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 822 #undef NO_RABBIT
wolfSSL 0:d92f9d21154c 823 #else
wolfSSL 0:d92f9d21154c 824 #define NO_RABBIT
wolfSSL 0:d92f9d21154c 825 #endif
wolfSSL 0:d92f9d21154c 826
wolfSSL 0:d92f9d21154c 827 #if (SSL_CFG_HC128_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 828 #undef NO_HC128
wolfSSL 0:d92f9d21154c 829 #else
wolfSSL 0:d92f9d21154c 830 #define NO_HC128
wolfSSL 0:d92f9d21154c 831 #endif
wolfSSL 0:d92f9d21154c 832
wolfSSL 0:d92f9d21154c 833 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
wolfSSL 0:d92f9d21154c 834 #define BIG_ENDIAN_ORDER
wolfSSL 0:d92f9d21154c 835 #else
wolfSSL 0:d92f9d21154c 836 #undef BIG_ENDIAN_ORDER
wolfSSL 0:d92f9d21154c 837 #define LITTLE_ENDIAN_ORDER
wolfSSL 0:d92f9d21154c 838 #endif
wolfSSL 0:d92f9d21154c 839
wolfSSL 0:d92f9d21154c 840 #if (SSL_CFG_MD4_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 841 #undef NO_MD4
wolfSSL 0:d92f9d21154c 842 #else
wolfSSL 0:d92f9d21154c 843 #define NO_MD4
wolfSSL 0:d92f9d21154c 844 #endif
wolfSSL 0:d92f9d21154c 845
wolfSSL 0:d92f9d21154c 846 #if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 847 #undef NO_WRITEV
wolfSSL 0:d92f9d21154c 848 #else
wolfSSL 0:d92f9d21154c 849 #define NO_WRITEV
wolfSSL 0:d92f9d21154c 850 #endif
wolfSSL 0:d92f9d21154c 851
wolfSSL 0:d92f9d21154c 852 #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 853 #define NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 854 #else
wolfSSL 0:d92f9d21154c 855 #undef NO_DEV_RANDOM
wolfSSL 0:d92f9d21154c 856 #endif
wolfSSL 0:d92f9d21154c 857
wolfSSL 0:d92f9d21154c 858 #if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 859 #define WOLFSSL_USER_IO
wolfSSL 0:d92f9d21154c 860 #else
wolfSSL 0:d92f9d21154c 861 #undef WOLFSSL_USER_IO
wolfSSL 0:d92f9d21154c 862 #endif
wolfSSL 0:d92f9d21154c 863
wolfSSL 0:d92f9d21154c 864 #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 865 #undef LARGE_STATIC_BUFFERS
wolfSSL 0:d92f9d21154c 866 #undef STATIC_CHUNKS_ONLY
wolfSSL 0:d92f9d21154c 867 #else
wolfSSL 0:d92f9d21154c 868 #define LARGE_STATIC_BUFFERS
wolfSSL 0:d92f9d21154c 869 #define STATIC_CHUNKS_ONLY
wolfSSL 0:d92f9d21154c 870 #endif
wolfSSL 0:d92f9d21154c 871
wolfSSL 0:d92f9d21154c 872 #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 873 #define WOLFSSL_DER_LOAD
wolfSSL 0:d92f9d21154c 874 #else
wolfSSL 0:d92f9d21154c 875 #undef WOLFSSL_DER_LOAD
wolfSSL 0:d92f9d21154c 876 #endif
wolfSSL 0:d92f9d21154c 877
wolfSSL 0:d92f9d21154c 878 #if (SSL_CFG_DTLS_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 879 #define WOLFSSL_DTLS
wolfSSL 0:d92f9d21154c 880 #else
wolfSSL 0:d92f9d21154c 881 #undef WOLFSSL_DTLS
wolfSSL 0:d92f9d21154c 882 #endif
wolfSSL 0:d92f9d21154c 883
wolfSSL 0:d92f9d21154c 884 #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 885 #define WOLFSSL_CALLBACKS
wolfSSL 0:d92f9d21154c 886 #else
wolfSSL 0:d92f9d21154c 887 #undef WOLFSSL_CALLBACKS
wolfSSL 0:d92f9d21154c 888 #endif
wolfSSL 0:d92f9d21154c 889
wolfSSL 0:d92f9d21154c 890 #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 891 #define USE_FAST_MATH
wolfSSL 0:d92f9d21154c 892 #else
wolfSSL 0:d92f9d21154c 893 #undef USE_FAST_MATH
wolfSSL 0:d92f9d21154c 894 #endif
wolfSSL 0:d92f9d21154c 895
wolfSSL 0:d92f9d21154c 896 #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
wolfSSL 0:d92f9d21154c 897 #define TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 898 #else
wolfSSL 0:d92f9d21154c 899 #undef TFM_TIMING_RESISTANT
wolfSSL 0:d92f9d21154c 900 #endif
wolfSSL 0:d92f9d21154c 901
wolfSSL 0:d92f9d21154c 902 #endif /* MICRIUM */
wolfSSL 0:d92f9d21154c 903
wolfSSL 0:d92f9d21154c 904
wolfSSL 0:d92f9d21154c 905 #ifdef WOLFSSL_QL
wolfSSL 0:d92f9d21154c 906 #ifndef WOLFSSL_SEP
wolfSSL 0:d92f9d21154c 907 #define WOLFSSL_SEP
wolfSSL 0:d92f9d21154c 908 #endif
wolfSSL 0:d92f9d21154c 909 #ifndef OPENSSL_EXTRA
wolfSSL 0:d92f9d21154c 910 #define OPENSSL_EXTRA
wolfSSL 0:d92f9d21154c 911 #endif
wolfSSL 0:d92f9d21154c 912 #ifndef SESSION_CERTS
wolfSSL 0:d92f9d21154c 913 #define SESSION_CERTS
wolfSSL 0:d92f9d21154c 914 #endif
wolfSSL 0:d92f9d21154c 915 #ifndef HAVE_AESCCM
wolfSSL 0:d92f9d21154c 916 #define HAVE_AESCCM
wolfSSL 0:d92f9d21154c 917 #endif
wolfSSL 0:d92f9d21154c 918 #ifndef ATOMIC_USER
wolfSSL 0:d92f9d21154c 919 #define ATOMIC_USER
wolfSSL 0:d92f9d21154c 920 #endif
wolfSSL 0:d92f9d21154c 921 #ifndef WOLFSSL_DER_LOAD
wolfSSL 0:d92f9d21154c 922 #define WOLFSSL_DER_LOAD
wolfSSL 0:d92f9d21154c 923 #endif
wolfSSL 0:d92f9d21154c 924 #ifndef KEEP_PEER_CERT
wolfSSL 0:d92f9d21154c 925 #define KEEP_PEER_CERT
wolfSSL 0:d92f9d21154c 926 #endif
wolfSSL 0:d92f9d21154c 927 #ifndef HAVE_ECC
wolfSSL 0:d92f9d21154c 928 #define HAVE_ECC
wolfSSL 0:d92f9d21154c 929 #endif
wolfSSL 0:d92f9d21154c 930 #ifndef SESSION_INDEX
wolfSSL 0:d92f9d21154c 931 #define SESSION_INDEX
wolfSSL 0:d92f9d21154c 932 #endif
wolfSSL 0:d92f9d21154c 933 #endif /* WOLFSSL_QL */
wolfSSL 0:d92f9d21154c 934
wolfSSL 0:d92f9d21154c 935
wolfSSL 0:d92f9d21154c 936 #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
wolfSSL 0:d92f9d21154c 937 !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY)
wolfSSL 0:d92f9d21154c 938 #define USE_WOLFSSL_MEMORY
wolfSSL 0:d92f9d21154c 939 #endif
wolfSSL 0:d92f9d21154c 940
wolfSSL 0:d92f9d21154c 941
wolfSSL 0:d92f9d21154c 942 #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
wolfSSL 0:d92f9d21154c 943 #undef KEEP_PEER_CERT
wolfSSL 0:d92f9d21154c 944 #define KEEP_PEER_CERT
wolfSSL 0:d92f9d21154c 945 #endif
wolfSSL 0:d92f9d21154c 946
wolfSSL 0:d92f9d21154c 947
wolfSSL 0:d92f9d21154c 948 /* stream ciphers except arc4 need 32bit alignment, intel ok without */
wolfSSL 0:d92f9d21154c 949 #ifndef XSTREAM_ALIGN
wolfSSL 0:d92f9d21154c 950 #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
wolfSSL 0:d92f9d21154c 951 #define NO_XSTREAM_ALIGN
wolfSSL 0:d92f9d21154c 952 #else
wolfSSL 0:d92f9d21154c 953 #define XSTREAM_ALIGN
wolfSSL 0:d92f9d21154c 954 #endif
wolfSSL 0:d92f9d21154c 955 #endif
wolfSSL 0:d92f9d21154c 956
wolfSSL 0:d92f9d21154c 957
wolfSSL 0:d92f9d21154c 958 /* FreeScale MMCAU hardware crypto has 4 byte alignment */
wolfSSL 0:d92f9d21154c 959 #ifdef FREESCALE_MMCAU
wolfSSL 0:d92f9d21154c 960 #define WOLFSSL_MMCAU_ALIGNMENT 4
wolfSSL 0:d92f9d21154c 961 #endif
wolfSSL 0:d92f9d21154c 962
wolfSSL 0:d92f9d21154c 963 /* if using hardware crypto and have alignment requirements, specify the
wolfSSL 3:6f956bdb3073 964 requirement here. The record header of SSL/TLS will prevent easy alignment.
wolfSSL 0:d92f9d21154c 965 This hint tries to help as much as possible. */
wolfSSL 0:d92f9d21154c 966 #ifndef WOLFSSL_GENERAL_ALIGNMENT
wolfSSL 0:d92f9d21154c 967 #ifdef WOLFSSL_AESNI
wolfSSL 0:d92f9d21154c 968 #define WOLFSSL_GENERAL_ALIGNMENT 16
wolfSSL 0:d92f9d21154c 969 #elif defined(XSTREAM_ALIGN)
wolfSSL 0:d92f9d21154c 970 #define WOLFSSL_GENERAL_ALIGNMENT 4
wolfSSL 0:d92f9d21154c 971 #elif defined(FREESCALE_MMCAU)
wolfSSL 0:d92f9d21154c 972 #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT
wolfSSL 0:d92f9d21154c 973 #else
wolfSSL 0:d92f9d21154c 974 #define WOLFSSL_GENERAL_ALIGNMENT 0
wolfSSL 0:d92f9d21154c 975 #endif
wolfSSL 0:d92f9d21154c 976 #endif
wolfSSL 0:d92f9d21154c 977
wolfSSL 0:d92f9d21154c 978 #if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0)
wolfSSL 0:d92f9d21154c 979 #if defined(_MSC_VER)
wolfSSL 0:d92f9d21154c 980 #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT))
wolfSSL 0:d92f9d21154c 981 #elif defined(__GNUC__)
wolfSSL 0:d92f9d21154c 982 #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT)))
wolfSSL 0:d92f9d21154c 983 #else
wolfSSL 0:d92f9d21154c 984 #define XGEN_ALIGN
wolfSSL 0:d92f9d21154c 985 #endif
wolfSSL 0:d92f9d21154c 986 #else
wolfSSL 0:d92f9d21154c 987 #define XGEN_ALIGN
wolfSSL 0:d92f9d21154c 988 #endif
wolfSSL 0:d92f9d21154c 989
wolfSSL 0:d92f9d21154c 990 #ifdef HAVE_CRL
wolfSSL 0:d92f9d21154c 991 /* not widely supported yet */
wolfSSL 0:d92f9d21154c 992 #undef NO_SKID
wolfSSL 0:d92f9d21154c 993 #define NO_SKID
wolfSSL 0:d92f9d21154c 994 #endif
wolfSSL 0:d92f9d21154c 995
wolfSSL 0:d92f9d21154c 996
wolfSSL 0:d92f9d21154c 997 #ifdef __INTEL_COMPILER
wolfSSL 0:d92f9d21154c 998 #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */
wolfSSL 0:d92f9d21154c 999 #endif
wolfSSL 0:d92f9d21154c 1000
wolfSSL 0:d92f9d21154c 1001 /* user can specify what curves they want with ECC_USER_CURVES otherwise
wolfSSL 0:d92f9d21154c 1002 * all curves are on by default for now */
wolfSSL 0:d92f9d21154c 1003 #ifndef ECC_USER_CURVES
wolfSSL 0:d92f9d21154c 1004 #ifndef HAVE_ALL_CURVES
wolfSSL 0:d92f9d21154c 1005 #define HAVE_ALL_CURVES
wolfSSL 0:d92f9d21154c 1006 #endif
wolfSSL 0:d92f9d21154c 1007 #endif
wolfSSL 0:d92f9d21154c 1008
wolfSSL 3:6f956bdb3073 1009 /* ECC Configs */
wolfSSL 3:6f956bdb3073 1010 #ifdef HAVE_ECC
wolfSSL 3:6f956bdb3073 1011 /* By default enable Sign, Verify, DHE, Key Import and Key Export unless explicitly disabled */
wolfSSL 3:6f956bdb3073 1012 #ifndef NO_ECC_SIGN
wolfSSL 3:6f956bdb3073 1013 #undef HAVE_ECC_SIGN
wolfSSL 3:6f956bdb3073 1014 #define HAVE_ECC_SIGN
wolfSSL 3:6f956bdb3073 1015 #endif
wolfSSL 3:6f956bdb3073 1016 #ifndef NO_ECC_VERIFY
wolfSSL 3:6f956bdb3073 1017 #undef HAVE_ECC_VERIFY
wolfSSL 3:6f956bdb3073 1018 #define HAVE_ECC_VERIFY
wolfSSL 3:6f956bdb3073 1019 #endif
wolfSSL 3:6f956bdb3073 1020 #ifndef NO_ECC_DHE
wolfSSL 3:6f956bdb3073 1021 #undef HAVE_ECC_DHE
wolfSSL 3:6f956bdb3073 1022 #define HAVE_ECC_DHE
wolfSSL 3:6f956bdb3073 1023 #endif
wolfSSL 3:6f956bdb3073 1024 #ifndef NO_ECC_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1025 #undef HAVE_ECC_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1026 #define HAVE_ECC_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1027 #endif
wolfSSL 3:6f956bdb3073 1028 #ifndef NO_ECC_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1029 #undef HAVE_ECC_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1030 #define HAVE_ECC_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1031 #endif
wolfSSL 3:6f956bdb3073 1032 #endif /* HAVE_ECC */
wolfSSL 3:6f956bdb3073 1033
wolfSSL 3:6f956bdb3073 1034 /* Curve255519 Configs */
wolfSSL 3:6f956bdb3073 1035 #ifdef HAVE_CURVE25519
wolfSSL 3:6f956bdb3073 1036 /* By default enable shared secret, key export and import */
wolfSSL 3:6f956bdb3073 1037 #ifndef NO_CURVE25519_SHARED_SECRET
wolfSSL 3:6f956bdb3073 1038 #undef HAVE_CURVE25519_SHARED_SECRET
wolfSSL 3:6f956bdb3073 1039 #define HAVE_CURVE25519_SHARED_SECRET
wolfSSL 3:6f956bdb3073 1040 #endif
wolfSSL 3:6f956bdb3073 1041 #ifndef NO_CURVE25519_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1042 #undef HAVE_CURVE25519_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1043 #define HAVE_CURVE25519_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1044 #endif
wolfSSL 3:6f956bdb3073 1045 #ifndef NO_CURVE25519_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1046 #undef HAVE_CURVE25519_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1047 #define HAVE_CURVE25519_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1048 #endif
wolfSSL 3:6f956bdb3073 1049 #endif /* HAVE_CURVE25519 */
wolfSSL 3:6f956bdb3073 1050
wolfSSL 3:6f956bdb3073 1051 /* Ed255519 Configs */
wolfSSL 3:6f956bdb3073 1052 #ifdef HAVE_ED25519
wolfSSL 3:6f956bdb3073 1053 /* By default enable sign, verify, key export and import */
wolfSSL 3:6f956bdb3073 1054 #ifndef NO_ED25519_SIGN
wolfSSL 3:6f956bdb3073 1055 #undef HAVE_ED25519_SIGN
wolfSSL 3:6f956bdb3073 1056 #define HAVE_ED25519_SIGN
wolfSSL 3:6f956bdb3073 1057 #endif
wolfSSL 3:6f956bdb3073 1058 #ifndef NO_ED25519_VERIFY
wolfSSL 3:6f956bdb3073 1059 #undef HAVE_ED25519_VERIFY
wolfSSL 3:6f956bdb3073 1060 #define HAVE_ED25519_VERIFY
wolfSSL 3:6f956bdb3073 1061 #endif
wolfSSL 3:6f956bdb3073 1062 #ifndef NO_ED25519_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1063 #undef HAVE_ED25519_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1064 #define HAVE_ED25519_KEY_EXPORT
wolfSSL 3:6f956bdb3073 1065 #endif
wolfSSL 3:6f956bdb3073 1066 #ifndef NO_ED25519_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1067 #undef HAVE_ED25519_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1068 #define HAVE_ED25519_KEY_IMPORT
wolfSSL 3:6f956bdb3073 1069 #endif
wolfSSL 3:6f956bdb3073 1070 #endif /* HAVE_ED25519 */
wolfSSL 3:6f956bdb3073 1071
wolfSSL 3:6f956bdb3073 1072 /* AES Config */
wolfSSL 3:6f956bdb3073 1073 #ifndef NO_AES
wolfSSL 3:6f956bdb3073 1074 /* By default enable all AES key sizes, decryption and CBC */
wolfSSL 3:6f956bdb3073 1075 #ifndef AES_MAX_KEY_SIZE
wolfSSL 3:6f956bdb3073 1076 #undef AES_MAX_KEY_SIZE
wolfSSL 3:6f956bdb3073 1077 #define AES_MAX_KEY_SIZE 256
wolfSSL 3:6f956bdb3073 1078 #endif
wolfSSL 3:6f956bdb3073 1079 #ifndef NO_AES_DECRYPT
wolfSSL 3:6f956bdb3073 1080 #undef HAVE_AES_DECRYPT
wolfSSL 3:6f956bdb3073 1081 #define HAVE_AES_DECRYPT
wolfSSL 3:6f956bdb3073 1082 #endif
wolfSSL 3:6f956bdb3073 1083 #ifndef NO_AES_CBC
wolfSSL 3:6f956bdb3073 1084 #undef HAVE_AES_CBC
wolfSSL 3:6f956bdb3073 1085 #define HAVE_AES_CBC
wolfSSL 3:6f956bdb3073 1086 #else
wolfSSL 3:6f956bdb3073 1087 #ifndef WOLFCRYPT_ONLY
wolfSSL 3:6f956bdb3073 1088 #error "AES CBC is required for TLS and can only be disabled for WOLFCRYPT_ONLY builds"
wolfSSL 3:6f956bdb3073 1089 #endif
wolfSSL 3:6f956bdb3073 1090 #endif
wolfSSL 3:6f956bdb3073 1091 #endif
wolfSSL 3:6f956bdb3073 1092
wolfSSL 0:d92f9d21154c 1093 /* if desktop type system and fastmath increase default max bits */
wolfSSL 0:d92f9d21154c 1094 #ifdef WOLFSSL_X86_64_BUILD
wolfSSL 0:d92f9d21154c 1095 #ifdef USE_FAST_MATH
wolfSSL 0:d92f9d21154c 1096 #ifndef FP_MAX_BITS
wolfSSL 0:d92f9d21154c 1097 #define FP_MAX_BITS 8192
wolfSSL 0:d92f9d21154c 1098 #endif
wolfSSL 0:d92f9d21154c 1099 #endif
wolfSSL 0:d92f9d21154c 1100 #endif
wolfSSL 0:d92f9d21154c 1101
wolfSSL 0:d92f9d21154c 1102 /* If using the max strength build, ensure OLD TLS is disabled. */
wolfSSL 0:d92f9d21154c 1103 #ifdef WOLFSSL_MAX_STRENGTH
wolfSSL 0:d92f9d21154c 1104 #undef NO_OLD_TLS
wolfSSL 0:d92f9d21154c 1105 #define NO_OLD_TLS
wolfSSL 0:d92f9d21154c 1106 #endif
wolfSSL 0:d92f9d21154c 1107
wolfSSL 3:6f956bdb3073 1108 /* If not forcing ARC4 as the DRBG or using custom RNG block gen, enable Hash_DRBG */
wolfSSL 3:6f956bdb3073 1109 #undef HAVE_HASHDRBG
wolfSSL 3:6f956bdb3073 1110 #if !defined(WOLFSSL_FORCE_RC4_DRBG) && !defined(CUSTOM_RAND_GENERATE_BLOCK)
wolfSSL 3:6f956bdb3073 1111 #define HAVE_HASHDRBG
wolfSSL 3:6f956bdb3073 1112 #endif
wolfSSL 3:6f956bdb3073 1113
wolfSSL 3:6f956bdb3073 1114
wolfSSL 3:6f956bdb3073 1115 /* sniffer requires:
wolfSSL 3:6f956bdb3073 1116 * static RSA cipher suites
wolfSSL 3:6f956bdb3073 1117 * session stats and peak stats
wolfSSL 3:6f956bdb3073 1118 */
wolfSSL 3:6f956bdb3073 1119 #ifdef WOLFSSL_SNIFFER
wolfSSL 3:6f956bdb3073 1120 #ifndef WOLFSSL_STATIC_RSA
wolfSSL 3:6f956bdb3073 1121 #define WOLFSSL_STATIC_RSA
wolfSSL 3:6f956bdb3073 1122 #endif
wolfSSL 3:6f956bdb3073 1123 #ifndef WOLFSSL_SESSION_STATS
wolfSSL 3:6f956bdb3073 1124 #define WOLFSSL_SESSION_STATS
wolfSSL 3:6f956bdb3073 1125 #endif
wolfSSL 3:6f956bdb3073 1126 #ifndef WOLFSSL_PEAK_SESSIONS
wolfSSL 3:6f956bdb3073 1127 #define WOLFSSL_PEAK_SESSIONS
wolfSSL 3:6f956bdb3073 1128 #endif
wolfSSL 3:6f956bdb3073 1129 #endif
wolfSSL 3:6f956bdb3073 1130
wolfSSL 3:6f956bdb3073 1131 /* Decode Public Key extras on by default, user can turn off with
wolfSSL 3:6f956bdb3073 1132 * WOLFSSL_NO_DECODE_EXTRA */
wolfSSL 3:6f956bdb3073 1133 #ifndef WOLFSSL_NO_DECODE_EXTRA
wolfSSL 3:6f956bdb3073 1134 #ifndef RSA_DECODE_EXTRA
wolfSSL 3:6f956bdb3073 1135 #define RSA_DECODE_EXTRA
wolfSSL 3:6f956bdb3073 1136 #endif
wolfSSL 3:6f956bdb3073 1137 #ifndef ECC_DECODE_EXTRA
wolfSSL 3:6f956bdb3073 1138 #define ECC_DECODE_EXTRA
wolfSSL 3:6f956bdb3073 1139 #endif
wolfSSL 3:6f956bdb3073 1140 #endif
wolfSSL 3:6f956bdb3073 1141
wolfSSL 3:6f956bdb3073 1142 /* C Sharp wrapper defines */
wolfSSL 3:6f956bdb3073 1143 #ifdef HAVE_CSHARP
wolfSSL 3:6f956bdb3073 1144 #ifndef WOLFSSL_DTLS
wolfSSL 3:6f956bdb3073 1145 #define WOLFSSL_DTLS
wolfSSL 3:6f956bdb3073 1146 #endif
wolfSSL 3:6f956bdb3073 1147 #undef NO_PSK
wolfSSL 3:6f956bdb3073 1148 #undef NO_SHA256
wolfSSL 3:6f956bdb3073 1149 #undef NO_DH
wolfSSL 3:6f956bdb3073 1150 #endif
wolfSSL 3:6f956bdb3073 1151
wolfSSL 0:d92f9d21154c 1152 /* Place any other flags or defines here */
wolfSSL 0:d92f9d21154c 1153
wolfSSL 0:d92f9d21154c 1154
wolfSSL 0:d92f9d21154c 1155 #ifdef __cplusplus
wolfSSL 0:d92f9d21154c 1156 } /* extern "C" */
wolfSSL 0:d92f9d21154c 1157 #endif
wolfSSL 0:d92f9d21154c 1158
wolfSSL 0:d92f9d21154c 1159 #endif
wolfSSL 0:d92f9d21154c 1160