fork of cyassl-lib
Dependents: TLS_cyassl TLS_cyassl
cyassl/ctaocrypt/settings.h@4:f377303c41be, 2013-09-16 (annotated)
- Committer:
- feb11
- Date:
- Mon Sep 16 09:53:35 2013 +0000
- Revision:
- 4:f377303c41be
- Parent:
- 3:d5bd39a52de3
changed settings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 0:714293de3836 | 1 | /* settings.h |
ashleymills | 0:714293de3836 | 2 | * |
ashleymills | 0:714293de3836 | 3 | * Copyright (C) 2006-2013 wolfSSL Inc. |
ashleymills | 0:714293de3836 | 4 | * |
ashleymills | 0:714293de3836 | 5 | * This file is part of CyaSSL. |
ashleymills | 0:714293de3836 | 6 | * |
ashleymills | 0:714293de3836 | 7 | * CyaSSL is free software; you can redistribute it and/or modify |
ashleymills | 0:714293de3836 | 8 | * it under the terms of the GNU General Public License as published by |
ashleymills | 0:714293de3836 | 9 | * the Free Software Foundation; either version 2 of the License, or |
ashleymills | 0:714293de3836 | 10 | * (at your option) any later version. |
ashleymills | 0:714293de3836 | 11 | * |
ashleymills | 0:714293de3836 | 12 | * CyaSSL is distributed in the hope that it will be useful, |
ashleymills | 0:714293de3836 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ashleymills | 0:714293de3836 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ashleymills | 0:714293de3836 | 15 | * GNU General Public License for more details. |
ashleymills | 0:714293de3836 | 16 | * |
ashleymills | 0:714293de3836 | 17 | * You should have received a copy of the GNU General Public License |
ashleymills | 0:714293de3836 | 18 | * along with this program; if not, write to the Free Software |
ashleymills | 0:714293de3836 | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
ashleymills | 0:714293de3836 | 20 | */ |
ashleymills | 0:714293de3836 | 21 | |
ashleymills | 0:714293de3836 | 22 | /* Place OS specific preprocessor flags, defines, includes here, will be |
ashleymills | 0:714293de3836 | 23 | included into every file because types.h includes it */ |
ashleymills | 0:714293de3836 | 24 | |
ashleymills | 0:714293de3836 | 25 | |
ashleymills | 0:714293de3836 | 26 | #ifndef CTAO_CRYPT_SETTINGS_H |
ashleymills | 0:714293de3836 | 27 | #define CTAO_CRYPT_SETTINGS_H |
ashleymills | 0:714293de3836 | 28 | |
ashleymills | 0:714293de3836 | 29 | #ifdef __cplusplus |
ashleymills | 0:714293de3836 | 30 | extern "C" { |
ashleymills | 0:714293de3836 | 31 | #endif |
ashleymills | 0:714293de3836 | 32 | |
ashleymills | 0:714293de3836 | 33 | /* Uncomment next line if using IPHONE */ |
ashleymills | 0:714293de3836 | 34 | /* #define IPHONE */ |
ashleymills | 0:714293de3836 | 35 | |
ashleymills | 0:714293de3836 | 36 | /* Uncomment next line if using ThreadX */ |
ashleymills | 0:714293de3836 | 37 | /* #define THREADX */ |
ashleymills | 0:714293de3836 | 38 | |
ashleymills | 0:714293de3836 | 39 | /* Uncomment next line if using Micrium ucOS */ |
ashleymills | 0:714293de3836 | 40 | /* #define MICRIUM */ |
ashleymills | 0:714293de3836 | 41 | |
ashleymills | 0:714293de3836 | 42 | /* Uncomment next line if using Mbed */ |
ashleymills | 0:714293de3836 | 43 | #define MBED |
ashleymills | 0:714293de3836 | 44 | |
ashleymills | 0:714293de3836 | 45 | /* Uncomment next line if using Microchip PIC32 ethernet starter kit */ |
ashleymills | 0:714293de3836 | 46 | /* #define MICROCHIP_PIC32 */ |
ashleymills | 0:714293de3836 | 47 | |
ashleymills | 0:714293de3836 | 48 | /* Uncomment next line if using Microchip TCP/IP stack, version 5 */ |
ashleymills | 0:714293de3836 | 49 | /* #define MICROCHIP_TCPIP_V5 */ |
ashleymills | 0:714293de3836 | 50 | |
ashleymills | 0:714293de3836 | 51 | /* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ |
ashleymills | 0:714293de3836 | 52 | /* #define MICROCHIP_TCPIP */ |
ashleymills | 0:714293de3836 | 53 | |
ashleymills | 0:714293de3836 | 54 | /* Uncomment next line if using FreeRTOS */ |
ashleymills | 0:714293de3836 | 55 | /* #define FREERTOS */ |
ashleymills | 0:714293de3836 | 56 | |
ashleymills | 0:714293de3836 | 57 | /* Uncomment next line if using FreeRTOS Windows Simulator */ |
ashleymills | 0:714293de3836 | 58 | /* #define FREERTOS_WINSIM */ |
ashleymills | 0:714293de3836 | 59 | |
ashleymills | 0:714293de3836 | 60 | /* Uncomment next line if using RTIP */ |
ashleymills | 0:714293de3836 | 61 | /* #define EBSNET */ |
ashleymills | 0:714293de3836 | 62 | |
ashleymills | 0:714293de3836 | 63 | /* Uncomment next line if using lwip */ |
ashleymills | 0:714293de3836 | 64 | #define CYASSL_LWIP |
ashleymills | 0:714293de3836 | 65 | |
ashleymills | 0:714293de3836 | 66 | /* Uncomment next line if building CyaSSL for a game console */ |
ashleymills | 0:714293de3836 | 67 | /* #define CYASSL_GAME_BUILD */ |
ashleymills | 0:714293de3836 | 68 | |
ashleymills | 0:714293de3836 | 69 | /* Uncomment next line if building CyaSSL for LSR */ |
ashleymills | 0:714293de3836 | 70 | /* #define CYASSL_LSR */ |
ashleymills | 0:714293de3836 | 71 | |
ashleymills | 0:714293de3836 | 72 | /* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */ |
ashleymills | 0:714293de3836 | 73 | /* #define FREESCALE_MQX */ |
ashleymills | 0:714293de3836 | 74 | |
ashleymills | 0:714293de3836 | 75 | /* Uncomment next line if using STM32F2 */ |
ashleymills | 0:714293de3836 | 76 | /* #define CYASSL_STM32F2 */ |
ashleymills | 0:714293de3836 | 77 | |
ashleymills | 0:714293de3836 | 78 | |
ashleymills | 0:714293de3836 | 79 | #include <cyassl/ctaocrypt/visibility.h> |
ashleymills | 0:714293de3836 | 80 | |
ashleymills | 0:714293de3836 | 81 | #ifdef IPHONE |
ashleymills | 0:714293de3836 | 82 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 83 | #endif |
ashleymills | 0:714293de3836 | 84 | |
ashleymills | 0:714293de3836 | 85 | #ifdef THREADX |
ashleymills | 0:714293de3836 | 86 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 87 | #endif |
ashleymills | 0:714293de3836 | 88 | |
ashleymills | 0:714293de3836 | 89 | #ifdef MICROCHIP_PIC32 |
ashleymills | 0:714293de3836 | 90 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 91 | #define SINGLE_THREADED |
ashleymills | 0:714293de3836 | 92 | #define CYASSL_USER_IO |
ashleymills | 0:714293de3836 | 93 | #define NO_WRITEV |
ashleymills | 0:714293de3836 | 94 | #define NO_DEV_RANDOM |
ashleymills | 0:714293de3836 | 95 | #define NO_FILESYSTEM |
ashleymills | 0:714293de3836 | 96 | #define USE_FAST_MATH |
ashleymills | 0:714293de3836 | 97 | #define TFM_TIMING_RESISTANT |
ashleymills | 0:714293de3836 | 98 | #endif |
ashleymills | 0:714293de3836 | 99 | |
ashleymills | 0:714293de3836 | 100 | #ifdef MICROCHIP_TCPIP_V5 |
ashleymills | 0:714293de3836 | 101 | /* include timer functions */ |
ashleymills | 0:714293de3836 | 102 | #include "TCPIP Stack/TCPIP.h" |
ashleymills | 0:714293de3836 | 103 | #endif |
ashleymills | 0:714293de3836 | 104 | |
ashleymills | 0:714293de3836 | 105 | #ifdef MICROCHIP_TCPIP |
ashleymills | 0:714293de3836 | 106 | /* include timer, NTP functions */ |
ashleymills | 0:714293de3836 | 107 | #include "system/system_services.h" |
ashleymills | 0:714293de3836 | 108 | #include "tcpip/sntp.h" |
ashleymills | 0:714293de3836 | 109 | #endif |
ashleymills | 0:714293de3836 | 110 | |
ashleymills | 0:714293de3836 | 111 | #ifdef MBED |
ashleymills | 0:714293de3836 | 112 | #define SINGLE_THREADED |
feb11 | 4:f377303c41be | 113 | #define CYASSL_USER_IO |
ashleymills | 0:714293de3836 | 114 | #define NO_WRITEV |
ashleymills | 0:714293de3836 | 115 | #define NO_DEV_RANDOM // write an OS-specific GenerateSeed() function (found in “ctaocrypt/src/random.c”). |
ashleymills | 0:714293de3836 | 116 | #define NO_SHA512 |
ashleymills | 0:714293de3836 | 117 | //#define NO_DH |
ashleymills | 0:714293de3836 | 118 | #define NO_DSA |
ashleymills | 0:714293de3836 | 119 | #define NO_HC128 |
ashleymills | 0:714293de3836 | 120 | #define NO_FILESYSTEM |
feb11 | 4:f377303c41be | 121 | //#define DEBUG_CYASSL |
ashleymills | 0:714293de3836 | 122 | //#define NO_CERTS |
feb11 | 4:f377303c41be | 123 | #define SSL_CFG_PSK_EN |
feb11 | 4:f377303c41be | 124 | //#define CYASSL_DTLS |
ashleymills | 0:714293de3836 | 125 | #define SSL_CFG_DTLS_EN |
ashleymills | 0:714293de3836 | 126 | #define NO_DES3 // 3 des is being phased out |
ashleymills | 0:714293de3836 | 127 | #define NO_MD4 // MD4 is broken and shouldn't be used |
ashleymills | 0:714293de3836 | 128 | #define SMALL_SESSION_CACHE |
ashleymills | 0:714293de3836 | 129 | //#define CYASSL_CALLBACKS |
ashleymills | 0:714293de3836 | 130 | //#define USER_TIME |
ashleymills | 0:714293de3836 | 131 | //#define USE_FAST_MATH // assembler implementation of bigInt routines |
ashleymills | 0:714293de3836 | 132 | //#define TFM_TIMING_RESISTANT // uses less memory when fast math is enabled |
ashleymills | 0:714293de3836 | 133 | #endif /* MBED */ |
ashleymills | 0:714293de3836 | 134 | |
ashleymills | 0:714293de3836 | 135 | #ifdef FREERTOS_WINSIM |
ashleymills | 0:714293de3836 | 136 | #define FREERTOS |
ashleymills | 0:714293de3836 | 137 | #define USE_WINDOWS_API |
ashleymills | 0:714293de3836 | 138 | #endif |
ashleymills | 0:714293de3836 | 139 | |
ashleymills | 0:714293de3836 | 140 | |
ashleymills | 0:714293de3836 | 141 | #if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER) |
ashleymills | 0:714293de3836 | 142 | #include <stdlib.h> |
ashleymills | 0:714293de3836 | 143 | #define XMALLOC(s, h, type) malloc((s)) |
ashleymills | 0:714293de3836 | 144 | #define XFREE(p, h, type) free((p)) |
ashleymills | 0:714293de3836 | 145 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
ashleymills | 0:714293de3836 | 146 | #endif |
ashleymills | 0:714293de3836 | 147 | |
ashleymills | 0:714293de3836 | 148 | #if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) |
ashleymills | 0:714293de3836 | 149 | #undef XMALLOC |
ashleymills | 0:714293de3836 | 150 | #define XMALLOC yaXMALLOC |
ashleymills | 0:714293de3836 | 151 | #undef XFREE |
ashleymills | 0:714293de3836 | 152 | #define XFREE yaXFREE |
ashleymills | 0:714293de3836 | 153 | #undef XREALLOC |
ashleymills | 0:714293de3836 | 154 | #define XREALLOC yaXREALLOC |
ashleymills | 0:714293de3836 | 155 | #endif |
ashleymills | 0:714293de3836 | 156 | |
ashleymills | 0:714293de3836 | 157 | |
ashleymills | 0:714293de3836 | 158 | #ifdef FREERTOS |
ashleymills | 0:714293de3836 | 159 | #ifndef NO_WRITEV |
ashleymills | 0:714293de3836 | 160 | #define NO_WRITEV |
ashleymills | 0:714293de3836 | 161 | #endif |
ashleymills | 0:714293de3836 | 162 | #ifndef NO_SHA512 |
ashleymills | 0:714293de3836 | 163 | #define NO_SHA512 |
ashleymills | 0:714293de3836 | 164 | #endif |
ashleymills | 0:714293de3836 | 165 | #ifndef NO_DH |
ashleymills | 0:714293de3836 | 166 | #define NO_DH |
ashleymills | 0:714293de3836 | 167 | #endif |
ashleymills | 0:714293de3836 | 168 | #ifndef NO_DSA |
ashleymills | 0:714293de3836 | 169 | #define NO_DSA |
ashleymills | 0:714293de3836 | 170 | #endif |
ashleymills | 0:714293de3836 | 171 | #ifndef NO_HC128 |
ashleymills | 0:714293de3836 | 172 | #define NO_HC128 |
ashleymills | 0:714293de3836 | 173 | #endif |
ashleymills | 0:714293de3836 | 174 | |
ashleymills | 0:714293de3836 | 175 | #ifndef SINGLE_THREADED |
ashleymills | 0:714293de3836 | 176 | #include "FreeRTOS.h" |
ashleymills | 0:714293de3836 | 177 | #include "semphr.h" |
ashleymills | 0:714293de3836 | 178 | #endif |
ashleymills | 0:714293de3836 | 179 | #endif |
ashleymills | 0:714293de3836 | 180 | |
ashleymills | 0:714293de3836 | 181 | #ifdef EBSNET |
ashleymills | 0:714293de3836 | 182 | #include "rtip.h" |
ashleymills | 0:714293de3836 | 183 | |
ashleymills | 0:714293de3836 | 184 | /* #define DEBUG_CYASSL */ |
ashleymills | 0:714293de3836 | 185 | #define NO_CYASSL_DIR /* tbd */ |
ashleymills | 0:714293de3836 | 186 | |
ashleymills | 0:714293de3836 | 187 | #if (POLLOS) |
ashleymills | 0:714293de3836 | 188 | #define SINGLE_THREADED |
ashleymills | 0:714293de3836 | 189 | #endif |
ashleymills | 0:714293de3836 | 190 | |
ashleymills | 0:714293de3836 | 191 | #if (RTPLATFORM) |
ashleymills | 0:714293de3836 | 192 | #if (!RTP_LITTLE_ENDIAN) |
ashleymills | 0:714293de3836 | 193 | #define BIG_ENDIAN_ORDER |
ashleymills | 0:714293de3836 | 194 | #endif |
ashleymills | 0:714293de3836 | 195 | #else |
ashleymills | 0:714293de3836 | 196 | #if (!KS_LITTLE_ENDIAN) |
ashleymills | 0:714293de3836 | 197 | #define BIG_ENDIAN_ORDER |
ashleymills | 0:714293de3836 | 198 | #endif |
ashleymills | 0:714293de3836 | 199 | #endif |
ashleymills | 0:714293de3836 | 200 | |
ashleymills | 0:714293de3836 | 201 | #if (WINMSP3) |
ashleymills | 0:714293de3836 | 202 | #undef SIZEOF_LONG |
ashleymills | 0:714293de3836 | 203 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 204 | #else |
ashleymills | 0:714293de3836 | 205 | #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG |
ashleymills | 0:714293de3836 | 206 | #endif |
ashleymills | 0:714293de3836 | 207 | |
ashleymills | 0:714293de3836 | 208 | #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) |
ashleymills | 0:714293de3836 | 209 | #define XFREE(p, h, type) (rtp_free(p)) |
ashleymills | 0:714293de3836 | 210 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
ashleymills | 0:714293de3836 | 211 | |
ashleymills | 0:714293de3836 | 212 | #endif /* EBSNET */ |
ashleymills | 0:714293de3836 | 213 | |
ashleymills | 0:714293de3836 | 214 | #ifdef CYASSL_GAME_BUILD |
ashleymills | 0:714293de3836 | 215 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 216 | #if defined(__PPU) || defined(__XENON) |
ashleymills | 0:714293de3836 | 217 | #define BIG_ENDIAN_ORDER |
ashleymills | 0:714293de3836 | 218 | #endif |
ashleymills | 0:714293de3836 | 219 | #endif |
ashleymills | 0:714293de3836 | 220 | |
ashleymills | 0:714293de3836 | 221 | #ifdef CYASSL_LSR |
ashleymills | 0:714293de3836 | 222 | #define HAVE_WEBSERVER |
ashleymills | 0:714293de3836 | 223 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 224 | #define CYASSL_LOW_MEMORY |
ashleymills | 0:714293de3836 | 225 | #define NO_WRITEV |
ashleymills | 0:714293de3836 | 226 | #define NO_SHA512 |
ashleymills | 0:714293de3836 | 227 | #define NO_DH |
ashleymills | 0:714293de3836 | 228 | #define NO_DSA |
ashleymills | 0:714293de3836 | 229 | #define NO_HC128 |
ashleymills | 0:714293de3836 | 230 | #define NO_DEV_RANDOM |
ashleymills | 0:714293de3836 | 231 | #define NO_CYASSL_DIR |
ashleymills | 0:714293de3836 | 232 | #define NO_RABBIT |
ashleymills | 0:714293de3836 | 233 | #ifndef NO_FILESYSTEM |
ashleymills | 0:714293de3836 | 234 | #define LSR_FS |
ashleymills | 0:714293de3836 | 235 | #include "inc/hw_types.h" |
ashleymills | 0:714293de3836 | 236 | #include "fs.h" |
ashleymills | 0:714293de3836 | 237 | #endif |
ashleymills | 0:714293de3836 | 238 | #define CYASSL_LWIP |
ashleymills | 0:714293de3836 | 239 | #include <errno.h> /* for tcp errno */ |
ashleymills | 0:714293de3836 | 240 | #define CYASSL_SAFERTOS |
ashleymills | 0:714293de3836 | 241 | #if defined(__IAR_SYSTEMS_ICC__) |
ashleymills | 0:714293de3836 | 242 | /* enum uses enum */ |
ashleymills | 0:714293de3836 | 243 | #pragma diag_suppress=Pa089 |
ashleymills | 0:714293de3836 | 244 | #endif |
ashleymills | 0:714293de3836 | 245 | #endif |
ashleymills | 0:714293de3836 | 246 | |
ashleymills | 0:714293de3836 | 247 | #ifdef CYASSL_SAFERTOS |
ashleymills | 0:714293de3836 | 248 | #ifndef SINGLE_THREADED |
ashleymills | 0:714293de3836 | 249 | #include "SafeRTOS/semphr.h" |
ashleymills | 0:714293de3836 | 250 | #endif |
ashleymills | 0:714293de3836 | 251 | |
ashleymills | 0:714293de3836 | 252 | #include "SafeRTOS/heap.h" |
ashleymills | 0:714293de3836 | 253 | #define XMALLOC(s, h, type) pvPortMalloc((s)) |
ashleymills | 0:714293de3836 | 254 | #define XFREE(p, h, type) vPortFree((p)) |
ashleymills | 0:714293de3836 | 255 | #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) |
ashleymills | 0:714293de3836 | 256 | #endif |
ashleymills | 0:714293de3836 | 257 | |
ashleymills | 0:714293de3836 | 258 | #ifdef CYASSL_LOW_MEMORY |
ashleymills | 0:714293de3836 | 259 | #undef RSA_LOW_MEM |
ashleymills | 0:714293de3836 | 260 | #define RSA_LOW_MEM |
ashleymills | 0:714293de3836 | 261 | #undef CYASSL_SMALL_STACK |
ashleymills | 0:714293de3836 | 262 | #define CYASSL_SMALL_STACK |
ashleymills | 0:714293de3836 | 263 | #undef TFM_TIMING_RESISTANT |
ashleymills | 0:714293de3836 | 264 | #define TFM_TIMING_RESISTANT |
ashleymills | 0:714293de3836 | 265 | #endif |
ashleymills | 0:714293de3836 | 266 | |
ashleymills | 0:714293de3836 | 267 | #ifdef FREESCALE_MQX |
ashleymills | 0:714293de3836 | 268 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 269 | #define NO_WRITEV |
ashleymills | 0:714293de3836 | 270 | #define NO_DEV_RANDOM |
ashleymills | 0:714293de3836 | 271 | #define NO_RABBIT |
ashleymills | 0:714293de3836 | 272 | #define NO_CYASSL_DIR |
ashleymills | 0:714293de3836 | 273 | #define USE_FAST_MATH |
ashleymills | 0:714293de3836 | 274 | #define TFM_TIMING_RESISTANT |
ashleymills | 0:714293de3836 | 275 | #define FREESCALE_K70_RNGA |
ashleymills | 0:714293de3836 | 276 | #ifndef NO_FILESYSTEM |
ashleymills | 0:714293de3836 | 277 | #include "mfs.h" |
ashleymills | 0:714293de3836 | 278 | #include "fio.h" |
ashleymills | 0:714293de3836 | 279 | #endif |
ashleymills | 0:714293de3836 | 280 | #ifndef SINGLE_THREADED |
ashleymills | 0:714293de3836 | 281 | #include "mutex.h" |
ashleymills | 0:714293de3836 | 282 | #endif |
ashleymills | 0:714293de3836 | 283 | |
ashleymills | 0:714293de3836 | 284 | #define XMALLOC(s, h, type) (void *)_mem_alloc_system((s)) |
ashleymills | 0:714293de3836 | 285 | #define XFREE(p, h, type) _mem_free(p) |
ashleymills | 0:714293de3836 | 286 | /* Note: MQX has no realloc, using fastmath above */ |
ashleymills | 0:714293de3836 | 287 | #endif |
ashleymills | 0:714293de3836 | 288 | |
ashleymills | 0:714293de3836 | 289 | #ifdef CYASSL_STM32F2 |
ashleymills | 0:714293de3836 | 290 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 291 | #define NO_DEV_RANDOM |
ashleymills | 0:714293de3836 | 292 | #define NO_CYASSL_DIR |
ashleymills | 0:714293de3836 | 293 | #define NO_RABBIT |
ashleymills | 0:714293de3836 | 294 | #define STM32F2_RNG |
ashleymills | 0:714293de3836 | 295 | #define STM32F2_CRYPTO |
ashleymills | 0:714293de3836 | 296 | #define KEIL_INTRINSICS |
ashleymills | 0:714293de3836 | 297 | #endif |
ashleymills | 0:714293de3836 | 298 | |
ashleymills | 0:714293de3836 | 299 | #ifdef MICRIUM |
ashleymills | 0:714293de3836 | 300 | |
ashleymills | 0:714293de3836 | 301 | #include "stdlib.h" |
ashleymills | 0:714293de3836 | 302 | #include "net_cfg.h" |
ashleymills | 0:714293de3836 | 303 | #include "ssl_cfg.h" |
ashleymills | 0:714293de3836 | 304 | #include "net_secure_os.h" |
ashleymills | 0:714293de3836 | 305 | |
ashleymills | 0:714293de3836 | 306 | #define CYASSL_TYPES |
ashleymills | 0:714293de3836 | 307 | |
ashleymills | 0:714293de3836 | 308 | typedef CPU_INT08U byte; |
ashleymills | 0:714293de3836 | 309 | typedef CPU_INT16U word16; |
ashleymills | 0:714293de3836 | 310 | typedef CPU_INT32U word32; |
ashleymills | 0:714293de3836 | 311 | |
ashleymills | 0:714293de3836 | 312 | #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) |
ashleymills | 0:714293de3836 | 313 | #define SIZEOF_LONG 4 |
ashleymills | 0:714293de3836 | 314 | #undef SIZEOF_LONG_LONG |
ashleymills | 0:714293de3836 | 315 | #else |
ashleymills | 0:714293de3836 | 316 | #undef SIZEOF_LONG |
ashleymills | 0:714293de3836 | 317 | #define SIZEOF_LONG_LONG 8 |
ashleymills | 0:714293de3836 | 318 | #endif |
ashleymills | 0:714293de3836 | 319 | |
ashleymills | 0:714293de3836 | 320 | #define STRING_USER |
ashleymills | 0:714293de3836 | 321 | |
ashleymills | 0:714293de3836 | 322 | #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) |
ashleymills | 0:714293de3836 | 323 | #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ |
ashleymills | 0:714293de3836 | 324 | ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ |
ashleymills | 0:714293de3836 | 325 | (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) |
ashleymills | 0:714293de3836 | 326 | #define XSTRNCMP(pstr_1, pstr_2, len_max) \ |
ashleymills | 0:714293de3836 | 327 | ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ |
ashleymills | 0:714293de3836 | 328 | (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) |
ashleymills | 0:714293de3836 | 329 | #define XSTRSTR(pstr, pstr_srch) \ |
ashleymills | 0:714293de3836 | 330 | ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ |
ashleymills | 0:714293de3836 | 331 | (CPU_CHAR *)(pstr_srch))) |
ashleymills | 0:714293de3836 | 332 | #define XMEMSET(pmem, data_val, size) \ |
ashleymills | 0:714293de3836 | 333 | ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ |
ashleymills | 0:714293de3836 | 334 | (CPU_SIZE_T)(size))) |
ashleymills | 0:714293de3836 | 335 | #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ |
ashleymills | 0:714293de3836 | 336 | (void *)(psrc), (CPU_SIZE_T)(size))) |
ashleymills | 0:714293de3836 | 337 | #define XMEMCMP(pmem_1, pmem_2, size) \ |
ashleymills | 0:714293de3836 | 338 | (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ |
ashleymills | 0:714293de3836 | 339 | (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) |
ashleymills | 0:714293de3836 | 340 | #define XMEMMOVE XMEMCPY |
ashleymills | 0:714293de3836 | 341 | |
ashleymills | 0:714293de3836 | 342 | #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 343 | #define MICRIUM_MALLOC |
ashleymills | 0:714293de3836 | 344 | #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ |
ashleymills | 0:714293de3836 | 345 | (CPU_SIZE_T)(s), (void *)0)) |
ashleymills | 0:714293de3836 | 346 | #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ |
ashleymills | 0:714293de3836 | 347 | (p), (void *)0)) |
ashleymills | 0:714293de3836 | 348 | #define XREALLOC(p, n, h, t) realloc((p), (n)) |
ashleymills | 0:714293de3836 | 349 | #endif |
ashleymills | 0:714293de3836 | 350 | |
ashleymills | 0:714293de3836 | 351 | #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 352 | #undef NO_FILESYSTEM |
ashleymills | 0:714293de3836 | 353 | #else |
ashleymills | 0:714293de3836 | 354 | #define NO_FILESYSTEM |
ashleymills | 0:714293de3836 | 355 | #endif |
ashleymills | 0:714293de3836 | 356 | |
ashleymills | 0:714293de3836 | 357 | #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) |
ashleymills | 0:714293de3836 | 358 | #define DEBUG_CYASSL |
ashleymills | 0:714293de3836 | 359 | #else |
ashleymills | 0:714293de3836 | 360 | #undef DEBUG_CYASSL |
ashleymills | 0:714293de3836 | 361 | #endif |
ashleymills | 0:714293de3836 | 362 | |
ashleymills | 0:714293de3836 | 363 | #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 364 | #define OPENSSL_EXTRA |
ashleymills | 0:714293de3836 | 365 | #else |
ashleymills | 0:714293de3836 | 366 | #undef OPENSSL_EXTRA |
ashleymills | 0:714293de3836 | 367 | #endif |
ashleymills | 0:714293de3836 | 368 | |
ashleymills | 0:714293de3836 | 369 | #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 370 | #undef SINGLE_THREADED |
ashleymills | 0:714293de3836 | 371 | #else |
ashleymills | 0:714293de3836 | 372 | #define SINGLE_THREADED |
ashleymills | 0:714293de3836 | 373 | #endif |
ashleymills | 0:714293de3836 | 374 | |
ashleymills | 0:714293de3836 | 375 | #if (SSL_CFG_DH_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 376 | #undef NO_DH |
ashleymills | 0:714293de3836 | 377 | #else |
ashleymills | 0:714293de3836 | 378 | #define NO_DH |
ashleymills | 0:714293de3836 | 379 | #endif |
ashleymills | 0:714293de3836 | 380 | |
ashleymills | 0:714293de3836 | 381 | #if (SSL_CFG_DSA_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 382 | #undef NO_DSA |
ashleymills | 0:714293de3836 | 383 | #else |
ashleymills | 0:714293de3836 | 384 | #define NO_DSA |
ashleymills | 0:714293de3836 | 385 | #endif |
ashleymills | 0:714293de3836 | 386 | |
ashleymills | 0:714293de3836 | 387 | #if (SSL_CFG_PSK_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 388 | #undef NO_PSK |
ashleymills | 0:714293de3836 | 389 | #else |
ashleymills | 0:714293de3836 | 390 | #define NO_PSK |
ashleymills | 0:714293de3836 | 391 | #endif |
ashleymills | 0:714293de3836 | 392 | |
ashleymills | 0:714293de3836 | 393 | #if (SSL_CFG_3DES_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 394 | #undef NO_DES |
ashleymills | 0:714293de3836 | 395 | #else |
ashleymills | 0:714293de3836 | 396 | #define NO_DES |
ashleymills | 0:714293de3836 | 397 | #endif |
ashleymills | 0:714293de3836 | 398 | |
ashleymills | 0:714293de3836 | 399 | #if (SSL_CFG_AES_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 400 | #undef NO_AES |
ashleymills | 0:714293de3836 | 401 | #else |
ashleymills | 0:714293de3836 | 402 | #define NO_AES |
ashleymills | 0:714293de3836 | 403 | #endif |
ashleymills | 0:714293de3836 | 404 | |
ashleymills | 0:714293de3836 | 405 | #if (SSL_CFG_RC4_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 406 | #undef NO_RC4 |
ashleymills | 0:714293de3836 | 407 | #else |
ashleymills | 0:714293de3836 | 408 | #define NO_RC4 |
ashleymills | 0:714293de3836 | 409 | #endif |
ashleymills | 0:714293de3836 | 410 | |
ashleymills | 0:714293de3836 | 411 | #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 412 | #undef NO_RABBIT |
ashleymills | 0:714293de3836 | 413 | #else |
ashleymills | 0:714293de3836 | 414 | #define NO_RABBIT |
ashleymills | 0:714293de3836 | 415 | #endif |
ashleymills | 0:714293de3836 | 416 | |
ashleymills | 0:714293de3836 | 417 | #if (SSL_CFG_HC128_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 418 | #undef NO_HC128 |
ashleymills | 0:714293de3836 | 419 | #else |
ashleymills | 0:714293de3836 | 420 | #define NO_HC128 |
ashleymills | 0:714293de3836 | 421 | #endif |
ashleymills | 0:714293de3836 | 422 | |
ashleymills | 0:714293de3836 | 423 | #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) |
ashleymills | 0:714293de3836 | 424 | #define BIG_ENDIAN_ORDER |
ashleymills | 0:714293de3836 | 425 | #else |
ashleymills | 0:714293de3836 | 426 | #undef BIG_ENDIAN_ORDER |
ashleymills | 0:714293de3836 | 427 | #define LITTLE_ENDIAN_ORDER |
ashleymills | 0:714293de3836 | 428 | #endif |
ashleymills | 0:714293de3836 | 429 | |
ashleymills | 0:714293de3836 | 430 | #if (SSL_CFG_MD4_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 431 | #undef NO_MD4 |
ashleymills | 0:714293de3836 | 432 | #else |
ashleymills | 0:714293de3836 | 433 | #define NO_MD4 |
ashleymills | 0:714293de3836 | 434 | #endif |
ashleymills | 0:714293de3836 | 435 | |
ashleymills | 0:714293de3836 | 436 | #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 437 | #undef NO_WRITEV |
ashleymills | 0:714293de3836 | 438 | #else |
ashleymills | 0:714293de3836 | 439 | #define NO_WRITEV |
ashleymills | 0:714293de3836 | 440 | #endif |
ashleymills | 0:714293de3836 | 441 | |
ashleymills | 0:714293de3836 | 442 | #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 443 | #define NO_DEV_RANDOM |
ashleymills | 0:714293de3836 | 444 | #else |
ashleymills | 0:714293de3836 | 445 | #undef NO_DEV_RANDOM |
ashleymills | 0:714293de3836 | 446 | #endif |
ashleymills | 0:714293de3836 | 447 | |
ashleymills | 0:714293de3836 | 448 | #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 449 | #define CYASSL_USER_IO |
ashleymills | 0:714293de3836 | 450 | #else |
ashleymills | 0:714293de3836 | 451 | #undef CYASSL_USER_IO |
ashleymills | 0:714293de3836 | 452 | #endif |
ashleymills | 0:714293de3836 | 453 | |
ashleymills | 0:714293de3836 | 454 | #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 455 | #undef LARGE_STATIC_BUFFERS |
ashleymills | 0:714293de3836 | 456 | #undef STATIC_CHUNKS_ONLY |
ashleymills | 0:714293de3836 | 457 | #else |
ashleymills | 0:714293de3836 | 458 | #define LARGE_STATIC_BUFFERS |
ashleymills | 0:714293de3836 | 459 | #define STATIC_CHUNKS_ONLY |
ashleymills | 0:714293de3836 | 460 | #endif |
ashleymills | 0:714293de3836 | 461 | |
ashleymills | 0:714293de3836 | 462 | #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 463 | #define CYASSL_DER_LOAD |
ashleymills | 0:714293de3836 | 464 | #else |
ashleymills | 0:714293de3836 | 465 | #undef CYASSL_DER_LOAD |
ashleymills | 0:714293de3836 | 466 | #endif |
ashleymills | 0:714293de3836 | 467 | |
ashleymills | 0:714293de3836 | 468 | #if (SSL_CFG_DTLS_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 469 | #define CYASSL_DTLS |
ashleymills | 0:714293de3836 | 470 | #else |
ashleymills | 0:714293de3836 | 471 | #undef CYASSL_DTLS |
ashleymills | 0:714293de3836 | 472 | #endif |
ashleymills | 0:714293de3836 | 473 | |
ashleymills | 0:714293de3836 | 474 | #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 475 | #define CYASSL_CALLBACKS |
ashleymills | 0:714293de3836 | 476 | #else |
ashleymills | 0:714293de3836 | 477 | #undef CYASSL_CALLBACKS |
ashleymills | 0:714293de3836 | 478 | #endif |
ashleymills | 0:714293de3836 | 479 | |
ashleymills | 0:714293de3836 | 480 | #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 481 | #define USE_FAST_MATH |
ashleymills | 0:714293de3836 | 482 | #else |
ashleymills | 0:714293de3836 | 483 | #undef USE_FAST_MATH |
ashleymills | 0:714293de3836 | 484 | #endif |
ashleymills | 0:714293de3836 | 485 | |
ashleymills | 0:714293de3836 | 486 | #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) |
ashleymills | 0:714293de3836 | 487 | #define TFM_TIMING_RESISTANT |
ashleymills | 0:714293de3836 | 488 | #else |
ashleymills | 0:714293de3836 | 489 | #undef TFM_TIMING_RESISTANT |
ashleymills | 0:714293de3836 | 490 | #endif |
ashleymills | 0:714293de3836 | 491 | |
ashleymills | 0:714293de3836 | 492 | #endif /* MICRIUM */ |
ashleymills | 0:714293de3836 | 493 | |
ashleymills | 0:714293de3836 | 494 | |
ashleymills | 0:714293de3836 | 495 | #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ |
ashleymills | 0:714293de3836 | 496 | !defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY) |
ashleymills | 0:714293de3836 | 497 | #define USE_CYASSL_MEMORY |
ashleymills | 0:714293de3836 | 498 | #endif |
ashleymills | 0:714293de3836 | 499 | |
ashleymills | 0:714293de3836 | 500 | |
ashleymills | 0:714293de3836 | 501 | #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) |
ashleymills | 0:714293de3836 | 502 | #undef KEEP_PEER_CERT |
ashleymills | 0:714293de3836 | 503 | #define KEEP_PEER_CERT |
ashleymills | 0:714293de3836 | 504 | #endif |
ashleymills | 0:714293de3836 | 505 | |
ashleymills | 0:714293de3836 | 506 | |
ashleymills | 0:714293de3836 | 507 | /* stream ciphers except arc4 need 32bit alignment, intel ok without */ |
ashleymills | 0:714293de3836 | 508 | #ifndef XSTREAM_ALIGNMENT |
ashleymills | 0:714293de3836 | 509 | #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) |
ashleymills | 0:714293de3836 | 510 | #define NO_XSTREAM_ALIGNMENT |
ashleymills | 0:714293de3836 | 511 | #else |
ashleymills | 0:714293de3836 | 512 | #define XSTREAM_ALIGNMENT |
ashleymills | 0:714293de3836 | 513 | #endif |
ashleymills | 0:714293de3836 | 514 | #endif |
ashleymills | 0:714293de3836 | 515 | |
ashleymills | 0:714293de3836 | 516 | |
ashleymills | 0:714293de3836 | 517 | /* if using hardware crypto and have alignment requirements, specify the |
ashleymills | 0:714293de3836 | 518 | requirement here. The record header of SSL/TLS will prvent easy alignment. |
ashleymills | 0:714293de3836 | 519 | This hint tries to help as much as possible. */ |
ashleymills | 0:714293de3836 | 520 | #ifndef CYASSL_GENERAL_ALIGNMENT |
ashleymills | 0:714293de3836 | 521 | #ifdef CYASSL_AESNI |
ashleymills | 0:714293de3836 | 522 | #define CYASSL_GENERAL_ALIGNMENT 16 |
ashleymills | 0:714293de3836 | 523 | #elif defined(XSTREAM_ALIGNMENT) |
ashleymills | 0:714293de3836 | 524 | #define CYASSL_GENERAL_ALIGNMENT 4 |
ashleymills | 0:714293de3836 | 525 | #else |
ashleymills | 0:714293de3836 | 526 | #define CYASSL_GENERAL_ALIGNMENT 0 |
ashleymills | 0:714293de3836 | 527 | #endif |
ashleymills | 0:714293de3836 | 528 | #endif |
ashleymills | 0:714293de3836 | 529 | |
ashleymills | 0:714293de3836 | 530 | #ifdef HAVE_CRL |
ashleymills | 0:714293de3836 | 531 | /* not widely supported yet */ |
ashleymills | 0:714293de3836 | 532 | #undef NO_SKID |
ashleymills | 0:714293de3836 | 533 | #define NO_SKID |
ashleymills | 0:714293de3836 | 534 | #endif |
ashleymills | 0:714293de3836 | 535 | |
ashleymills | 0:714293de3836 | 536 | /* Place any other flags or defines here */ |
ashleymills | 0:714293de3836 | 537 | |
ashleymills | 0:714293de3836 | 538 | |
ashleymills | 0:714293de3836 | 539 | #ifdef __cplusplus |
ashleymills | 0:714293de3836 | 540 | } /* extern "C" */ |
ashleymills | 0:714293de3836 | 541 | #endif |
ashleymills | 0:714293de3836 | 542 | |
ashleymills | 0:714293de3836 | 543 | |
ashleymills | 0:714293de3836 | 544 | #endif /* CTAO_CRYPT_SETTINGS_H */ |
ashleymills | 0:714293de3836 | 545 |