cyassl re-port with cellular comms, PSK test
Dependencies: VodafoneUSBModem_bleedingedge2 mbed-rtos mbed-src
settings.h
00001 /* settings.h 00002 * 00003 * Copyright (C) 2006-2012 Sawtooth Consulting Ltd. 00004 * 00005 * This file is part of CyaSSL. 00006 * 00007 * CyaSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * CyaSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 00022 /* Place OS specific preprocessor flags, defines, includes here, will be 00023 included into every file because types.h includes it */ 00024 00025 00026 #ifndef CTAO_CRYPT_SETTINGS_H 00027 #define CTAO_CRYPT_SETTINGS_H 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 /* Uncomment next line if using IPHONE */ 00034 /* #define IPHONE */ 00035 00036 /* Uncomment next line if using ThreadX */ 00037 /* #define THREADX */ 00038 00039 /* Uncomment next line if using Micrium ucOS */ 00040 /* #define MICRIUM */ 00041 00042 /* Uncomment next line if using Mbed */ 00043 #define MBED 00044 00045 /* Uncomment next line if using Microchip PIC32 ethernet starter kit */ 00046 /* #define MICROCHIP_PIC32 */ 00047 00048 /* Uncomment next line if using FreeRTOS */ 00049 /* #define FREERTOS */ 00050 00051 /* Uncomment next line if using FreeRTOS Windows Simulator */ 00052 /* #define FREERTOS_WINSIM */ 00053 00054 /* Uncomment next line if using RTIP */ 00055 /* #define EBSNET */ 00056 00057 /* Uncomment next line if using lwip */ 00058 #define CYASSL_LWIP 00059 00060 /* Uncomment next line if building CyaSSL for a game console */ 00061 /* #define CYASSL_GAME_BUILD */ 00062 00063 /* Uncomment next line if building CyaSSL for LSR */ 00064 /* #define CYASSL_LSR */ 00065 00066 /* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */ 00067 /* #define FREESCALE_MQX */ 00068 00069 /* Uncomment next line if using STM32F2 */ 00070 /* #define CYASSL_STM32F2 */ 00071 00072 00073 #include <cyassl/ctaocrypt/visibility.h> 00074 00075 /* stream ciphers except arc4 need 32bit alignment, intel ok without */ 00076 #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) 00077 #define NO_XSTREAM_ALIGNMENT 00078 #else 00079 #define XSTREAM_ALIGNMENT 00080 #endif 00081 00082 #ifdef IPHONE 00083 #define SIZEOF_LONG_LONG 8 00084 #endif 00085 00086 #ifdef THREADX 00087 #define SIZEOF_LONG_LONG 8 00088 #endif 00089 00090 #ifdef MICROCHIP_PIC32 00091 #define SIZEOF_LONG_LONG 8 00092 #define SINGLE_THREADED 00093 #define CYASSL_USER_IO 00094 #define NO_WRITEV 00095 #define NO_DEV_RANDOM 00096 #define NO_FILESYSTEM 00097 #define USE_FAST_MATH 00098 #define TFM_TIMING_RESISTANT 00099 #endif 00100 00101 #ifdef MBED 00102 #define SINGLE_THREADED 00103 //#define CYASSL_USER_IO 00104 #define NO_WRITEV 00105 #define NO_DEV_RANDOM 00106 #define NO_SHA512 00107 #define NO_DH 00108 #define NO_DSA 00109 //#define NO_RSA 00110 #define NO_HC128 00111 #define NO_FILESYSTEM 00112 #define DEBUG_CYASSL 00113 //#define NO_CERTS 00114 //#define SSL_CFG_PSK_EN 00115 #endif /* MBED */ 00116 00117 #ifdef FREERTOS_WINSIM 00118 #define FREERTOS 00119 #define USE_WINDOWS_API 00120 #endif 00121 00122 00123 #ifdef CYASSL_LEANPSK 00124 #include <stdlib.h> 00125 #define XMALLOC(s, h, type) malloc((s)) 00126 #define XFREE(p, h, type) free((p)) 00127 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00128 #endif 00129 00130 00131 #ifdef FREERTOS 00132 #define NO_WRITEV 00133 #define NO_SHA512 00134 #define NO_DH 00135 #define NO_DSA 00136 #define NO_HC128 00137 00138 #ifndef SINGLE_THREADED 00139 #include "FreeRTOS.h" 00140 #include "semphr.h" 00141 #endif 00142 #endif 00143 00144 #ifdef EBSNET 00145 #include "rtip.h" 00146 00147 /* #define DEBUG_CYASSL */ 00148 #define NO_CYASSL_DIR /* tbd */ 00149 00150 #if (POLLOS) 00151 #define SINGLE_THREADED 00152 #endif 00153 00154 #if (RTPLATFORM) 00155 #if (!RTP_LITTLE_ENDIAN) 00156 #define BIG_ENDIAN_ORDER 00157 #endif 00158 #else 00159 #if (!KS_LITTLE_ENDIAN) 00160 #define BIG_ENDIAN_ORDER 00161 #endif 00162 #endif 00163 00164 #if (WINMSP3) 00165 #undef SIZEOF_LONG 00166 #define SIZEOF_LONG_LONG 8 00167 #else 00168 #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG 00169 #endif 00170 00171 #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) 00172 #define XFREE(p, h, type) (rtp_free(p)) 00173 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00174 00175 #endif /* EBSNET */ 00176 00177 #ifdef CYASSL_GAME_BUILD 00178 #define SIZEOF_LONG_LONG 8 00179 #if defined(__PPU) || defined(__XENON) 00180 #define BIG_ENDIAN_ORDER 00181 #endif 00182 #endif 00183 00184 #ifdef CYASSL_LSR 00185 #define HAVE_WEBSERVER 00186 #define SIZEOF_LONG_LONG 8 00187 #define CYASSL_LOW_MEMORY 00188 #define NO_WRITEV 00189 #define NO_SHA512 00190 #define NO_DH 00191 #define NO_DSA 00192 #define NO_HC128 00193 #define NO_DEV_RANDOM 00194 #define NO_CYASSL_DIR 00195 #define NO_RABBIT 00196 #ifndef NO_FILESYSTEM 00197 #define LSR_FS 00198 #include "inc/hw_types.h" 00199 #include "fs.h" 00200 #endif 00201 #define CYASSL_LWIP 00202 #include <errno.h> /* for tcp errno */ 00203 #define CYASSL_SAFERTOS 00204 #if defined(__IAR_SYSTEMS_ICC__) 00205 /* enum uses enum */ 00206 #pragma diag_suppress=Pa089 00207 #endif 00208 #endif 00209 00210 #ifdef CYASSL_SAFERTOS 00211 #ifndef SINGLE_THREADED 00212 #include "SafeRTOS/semphr.h" 00213 #endif 00214 00215 #include "SafeRTOS/heap.h" 00216 #define XMALLOC(s, h, type) pvPortMalloc((s)) 00217 #define XFREE(p, h, type) vPortFree((p)) 00218 #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) 00219 #endif 00220 00221 #ifdef CYASSL_LOW_MEMORY 00222 #define RSA_LOW_MEM 00223 #define CYASSL_SMALL_STACK 00224 #define TFM_TIMING_RESISTANT 00225 #endif 00226 00227 #ifdef FREESCALE_MQX 00228 #define SIZEOF_LONG_LONG 8 00229 #define NO_WRITEV 00230 #define NO_DEV_RANDOM 00231 #define NO_RABBIT 00232 #define NO_CYASSL_DIR 00233 #define USE_FAST_MATH 00234 #define TFM_TIMING_RESISTANT 00235 #define FREESCALE_K70_RNGA 00236 #ifndef NO_FILESYSTEM 00237 #include "mfs.h" 00238 #include "fio.h" 00239 #endif 00240 #ifndef SINGLE_THREADED 00241 #include "mutex.h" 00242 #endif 00243 00244 #define XMALLOC(s, h, type) (void *)_mem_alloc_system((s)) 00245 #define XFREE(p, h, type) _mem_free(p) 00246 /* Note: MQX has no realloc, using fastmath above */ 00247 #endif 00248 00249 #ifdef CYASSL_STM32F2 00250 #define SIZEOF_LONG_LONG 8 00251 #define NO_DEV_RANDOM 00252 #define NO_CYASSL_DIR 00253 #define NO_RABBIT 00254 #define STM32F2_RNG 00255 #define STM32F2_CRYPTO 00256 #define KEIL_INTRINSICS 00257 #endif 00258 00259 #ifdef MICRIUM 00260 00261 #include "stdlib.h" 00262 #include "net_cfg.h" 00263 #include "ssl_cfg.h" 00264 #include "net_secure_os.h" 00265 00266 #define CYASSL_TYPES 00267 00268 typedef CPU_INT08U byte; 00269 typedef CPU_INT16U word16; 00270 typedef CPU_INT32U word32; 00271 00272 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) 00273 #define SIZEOF_LONG 4 00274 #undef SIZEOF_LONG_LONG 00275 #else 00276 #undef SIZEOF_LONG 00277 #define SIZEOF_LONG_LONG 8 00278 #endif 00279 00280 #define STRING_USER 00281 00282 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) 00283 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ 00284 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ 00285 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) 00286 #define XSTRNCMP(pstr_1, pstr_2, len_max) \ 00287 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ 00288 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) 00289 #define XSTRSTR(pstr, pstr_srch) \ 00290 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ 00291 (CPU_CHAR *)(pstr_srch))) 00292 #define XMEMSET(pmem, data_val, size) \ 00293 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ 00294 (CPU_SIZE_T)(size))) 00295 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ 00296 (void *)(psrc), (CPU_SIZE_T)(size))) 00297 #define XMEMCMP(pmem_1, pmem_2, size) \ 00298 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ 00299 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) 00300 #define XMEMMOVE XMEMCPY 00301 00302 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) 00303 #define MICRIUM_MALLOC 00304 #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ 00305 (CPU_SIZE_T)(s), (void *)0)) 00306 #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ 00307 (p), (void *)0)) 00308 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00309 #endif 00310 00311 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) 00312 #undef NO_FILESYSTEM 00313 #else 00314 #define NO_FILESYSTEM 00315 #endif 00316 00317 #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) 00318 #define DEBUG_CYASSL 00319 #else 00320 #undef DEBUG_CYASSL 00321 #endif 00322 00323 #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) 00324 #define OPENSSL_EXTRA 00325 #else 00326 #undef OPENSSL_EXTRA 00327 #endif 00328 00329 #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) 00330 #undef SINGLE_THREADED 00331 #else 00332 #define SINGLE_THREADED 00333 #endif 00334 00335 #if (SSL_CFG_DH_EN == DEF_ENABLED) 00336 #undef NO_DH 00337 #else 00338 #define NO_DH 00339 #endif 00340 00341 #if (SSL_CFG_DSA_EN == DEF_ENABLED) 00342 #undef NO_DSA 00343 #else 00344 #define NO_DSA 00345 #endif 00346 00347 #if (SSL_CFG_PSK_EN == DEF_ENABLED) 00348 #undef NO_PSK 00349 #else 00350 #define NO_PSK 00351 #endif 00352 00353 #if (SSL_CFG_3DES_EN == DEF_ENABLED) 00354 #undef NO_DES 00355 #else 00356 #define NO_DES 00357 #endif 00358 00359 #if (SSL_CFG_AES_EN == DEF_ENABLED) 00360 #undef NO_AES 00361 #else 00362 #define NO_AES 00363 #endif 00364 00365 #if (SSL_CFG_RC4_EN == DEF_ENABLED) 00366 #undef NO_RC4 00367 #else 00368 #define NO_RC4 00369 #endif 00370 00371 #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) 00372 #undef NO_RABBIT 00373 #else 00374 #define NO_RABBIT 00375 #endif 00376 00377 #if (SSL_CFG_HC128_EN == DEF_ENABLED) 00378 #undef NO_HC128 00379 #else 00380 #define NO_HC128 00381 #endif 00382 00383 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) 00384 #define BIG_ENDIAN_ORDER 00385 #else 00386 #undef BIG_ENDIAN_ORDER 00387 #define LITTLE_ENDIAN_ORDER 00388 #endif 00389 00390 #if (SSL_CFG_MD4_EN == DEF_ENABLED) 00391 #undef NO_MD4 00392 #else 00393 #define NO_MD4 00394 #endif 00395 00396 #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) 00397 #undef NO_WRITEV 00398 #else 00399 #define NO_WRITEV 00400 #endif 00401 00402 #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) 00403 #define NO_DEV_RANDOM 00404 #else 00405 #undef NO_DEV_RANDOM 00406 #endif 00407 00408 #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) 00409 #define CYASSL_USER_IO 00410 #else 00411 #undef CYASSL_USER_IO 00412 #endif 00413 00414 #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) 00415 #undef LARGE_STATIC_BUFFERS 00416 #undef STATIC_CHUNKS_ONLY 00417 #else 00418 #define LARGE_STATIC_BUFFERS 00419 #define STATIC_CHUNKS_ONLY 00420 #endif 00421 00422 #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) 00423 #define CYASSL_DER_LOAD 00424 #else 00425 #undef CYASSL_DER_LOAD 00426 #endif 00427 00428 #if (SSL_CFG_DTLS_EN == DEF_ENABLED) 00429 #define CYASSL_DTLS 00430 #else 00431 #undef CYASSL_DTLS 00432 #endif 00433 00434 #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) 00435 #define CYASSL_CALLBACKS 00436 #else 00437 #undef CYASSL_CALLBACKS 00438 #endif 00439 00440 #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) 00441 #define USE_FAST_MATH 00442 #else 00443 #undef USE_FAST_MATH 00444 #endif 00445 00446 #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) 00447 #define TFM_TIMING_RESISTANT 00448 #else 00449 #undef TFM_TIMING_RESISTANT 00450 #endif 00451 00452 #endif /* MICRIUM */ 00453 00454 00455 #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ 00456 !defined(CYASSL_LEANPSK) 00457 #define USE_CYASSL_MEMORY 00458 #endif 00459 00460 /* Place any other flags or defines here */ 00461 00462 00463 #ifdef __cplusplus 00464 } /* extern "C" */ 00465 #endif 00466 00467 00468 #endif /* CTAO_CRYPT_SETTINGS_H */ 00469
Generated on Thu Jul 14 2022 00:25:23 by 1.7.2