3 * Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
5 * This file is part of CyaSSL.
7 * CyaSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * CyaSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 /* Place OS specific preprocessor flags, defines, includes here, will be
23 included into every file because types.h includes it */
26 #ifndef CTAO_CRYPT_SETTINGS_H
27 #define CTAO_CRYPT_SETTINGS_H
33 /* Uncomment next line if using IPHONE */
36 /* Uncomment next line if using ThreadX */
39 /* Uncomment next line if using Micrium ucOS */
42 /* Uncomment next line if using Mbed */
45 /* Uncomment next line if using Microchip PIC32 ethernet starter kit */
46 /* #define MICROCHIP_PIC32 */
48 /* Uncomment next line if using FreeRTOS */
49 /* #define FREERTOS */
51 /* Uncomment next line if using FreeRTOS Windows Simulator */
52 /* #define FREERTOS_WINSIM */
54 /* Uncomment next line if using lwip */
55 /* #define CYASSL_LWIP */
57 /* Uncomment next line if building CyaSSL for a game console */
58 /* #define CYASSL_GAME_BUILD */
61 #include <cyassl/ctaocrypt/visibility.h>
64 #define SIZEOF_LONG_LONG 8
68 #define SIZEOF_LONG_LONG 8
71 #ifdef MICROCHIP_PIC32
72 /* use MBED plus no filesystem */
78 #define SINGLE_THREADED
79 #define CYASSL_USER_IO
88 #ifdef FREERTOS_WINSIM
90 #define USE_WINDOWS_API
100 #ifndef SINGLE_THREADED
101 #include "FreeRTOS.h"
106 #ifdef CYASSL_GAME_BUILD
107 #define SIZEOF_LONG_LONG 8
108 #if defined(__PPU) || defined(__XENON)
109 #define BIG_ENDIAN_ORDER
118 #include "net_secure_os.h"
122 typedef CPU_INT08U byte;
123 typedef CPU_INT16U word16;
124 typedef CPU_INT32U word32;
126 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
127 #define SIZEOF_LONG 4
128 #undef SIZEOF_LONG_LONG
131 #define SIZEOF_LONG_LONG 8
136 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
137 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
138 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
139 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
140 #define XSTRNCMP(pstr_1, pstr_2, len_max) \
141 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
142 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
143 #define XSTRSTR(pstr, pstr_srch) \
144 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
145 (CPU_CHAR *)(pstr_srch)))
146 #define XMEMSET(pmem, data_val, size) \
147 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
149 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
150 (void *)(psrc), (CPU_SIZE_T)(size)))
151 #define XMEMCMP(pmem_1, pmem_2, size) \
152 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
153 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
154 #define XMEMMOVE XMEMCPY
156 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
157 #define MICRIUM_MALLOC
158 #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
159 (CPU_SIZE_T)(s), (void *)0))
160 #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
162 #define XREALLOC(p, n, h, t) realloc((p), (n))
165 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
168 #define NO_FILESYSTEM
171 #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
177 #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
178 #define OPENSSL_EXTRA
183 #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
184 #undef SINGLE_THREADED
186 #define SINGLE_THREADED
189 #if (SSL_CFG_DH_EN == DEF_ENABLED)
195 #if (SSL_CFG_DSA_EN == DEF_ENABLED)
201 #if (SSL_CFG_PSK_EN == DEF_ENABLED)
207 #if (SSL_CFG_3DES_EN == DEF_ENABLED)
213 #if (SSL_CFG_AES_EN == DEF_ENABLED)
219 #if (SSL_CFG_RC4_EN == DEF_ENABLED)
225 #if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
231 #if (SSL_CFG_HC128_EN == DEF_ENABLED)
237 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
238 #define BIG_ENDIAN_ORDER
240 #undef BIG_ENDIAN_ORDER
241 #define LITTLE_ENDIAN_ORDER
244 #if (SSL_CFG_MD4_EN == DEF_ENABLED)
250 #if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
256 #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
257 #define NO_DEV_RANDOM
262 #if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
263 #define CYASSL_USER_IO
265 #undef CYASSL_USER_IO
268 #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
269 #undef LARGE_STATIC_BUFFERS
270 #undef STATIC_CHUNKS_ONLY
272 #define LARGE_STATIC_BUFFERS
273 #define STATIC_CHUNKS_ONLY
276 #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
277 #define CYASSL_DER_LOAD
279 #undef CYASSL_DER_LOAD
282 #if (SSL_CFG_DTLS_EN == DEF_ENABLED)
288 #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
289 #define CYASSL_CALLBACKS
291 #undef CYASSL_CALLBACKS
294 #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
295 #define USE_FAST_MATH
300 #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
301 #define TFM_TIMING_RESISTANT
303 #undef TFM_TIMING_RESISTANT
309 #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC)
310 #define USE_CYASSL_MEMORY
313 /* Place any other flags or defines here */
321 #endif /* CTAO_CRYPT_SETTINGS_H */