]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/CyaSSL/cyassl/ctaocrypt/settings.h
Commit 3 RX100 low power demos.
[freertos] / FreeRTOS-Plus / CyaSSL / cyassl / ctaocrypt / settings.h
1 /* settings.h
2  *
3  * Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
4  *
5  * This file is part of CyaSSL.
6  *
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.
11  *
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.
16  *
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
20  */
21
22 /* Place OS specific preprocessor flags, defines, includes here, will be
23    included into every file because types.h includes it */
24
25
26 #ifndef CTAO_CRYPT_SETTINGS_H
27 #define CTAO_CRYPT_SETTINGS_H
28
29 #ifdef __cplusplus
30     extern "C" {
31 #endif
32
33 /* Uncomment next line if using IPHONE */
34 /* #define IPHONE */
35
36 /* Uncomment next line if using ThreadX */
37 /* #define THREADX */
38
39 /* Uncomment next line if using Micrium ucOS */
40 /* #define MICRIUM */
41
42 /* Uncomment next line if using Mbed */
43 /* #define MBED */
44
45 /* Uncomment next line if using Microchip PIC32 ethernet starter kit */
46 /* #define MICROCHIP_PIC32 */
47
48 /* Uncomment next line if using FreeRTOS */
49 /* #define FREERTOS */
50
51 /* Uncomment next line if using FreeRTOS Windows Simulator */
52 /* #define FREERTOS_WINSIM */
53
54 /* Uncomment next line if using lwip */
55 /* #define CYASSL_LWIP */
56
57 /* Uncomment next line if building CyaSSL for a game console */
58 /* #define CYASSL_GAME_BUILD */
59
60
61 #include <cyassl/ctaocrypt/visibility.h>
62
63 #ifdef IPHONE
64     #define SIZEOF_LONG_LONG 8
65 #endif
66
67 #ifdef THREADX 
68     #define SIZEOF_LONG_LONG 8
69 #endif
70
71 #ifdef MICROCHIP_PIC32
72     /* use MBED plus no filesystem */
73     #define MBED
74     #define NO_FILESYSTEM
75 #endif
76
77 #ifdef MBED
78     #define SINGLE_THREADED
79     #define CYASSL_USER_IO
80     #define NO_WRITEV
81     #define NO_DEV_RANDOM
82     #define NO_SHA512
83     #define NO_DH
84     #define NO_DSA
85     #define NO_HC128
86 #endif /* MBED */
87
88 #ifdef FREERTOS_WINSIM
89     #define FREERTOS
90     #define USE_WINDOWS_API
91 #endif
92
93 #ifdef FREERTOS
94     #define NO_WRITEV
95     #define NO_SHA512
96     #define NO_DH
97     #define NO_DSA
98     #define NO_HC128
99
100     #ifndef SINGLE_THREADED
101         #include "FreeRTOS.h"
102         #include "semphr.h"
103     #endif
104 #endif
105
106 #ifdef CYASSL_GAME_BUILD
107     #define SIZEOF_LONG_LONG 8
108     #if defined(__PPU) || defined(__XENON)
109         #define BIG_ENDIAN_ORDER
110     #endif
111 #endif
112
113 #ifdef MICRIUM
114
115     #include "stdlib.h"
116     #include "net_cfg.h"
117     #include "ssl_cfg.h"
118     #include "net_secure_os.h"
119
120     #define CYASSL_TYPES
121
122     typedef CPU_INT08U byte;
123     typedef CPU_INT16U word16;
124     typedef CPU_INT32U word32;
125
126     #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
127         #define SIZEOF_LONG        4
128         #undef  SIZEOF_LONG_LONG
129     #else
130         #undef  SIZEOF_LONG
131         #define SIZEOF_LONG_LONG   8
132     #endif
133
134     #define STRING_USER
135
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), \
148                     (CPU_SIZE_T)(size)))
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
155
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), \
161                                  (p), (void *)0))
162     #define XREALLOC(p, n, h, t) realloc((p), (n))
163 #endif
164
165     #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
166         #undef  NO_FILESYSTEM
167     #else
168         #define NO_FILESYSTEM
169     #endif
170
171     #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
172         #define DEBUG_CYASSL
173     #else
174         #undef  DEBUG_CYASSL
175     #endif
176
177     #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
178         #define OPENSSL_EXTRA
179     #else
180         #undef  OPENSSL_EXTRA
181     #endif
182
183     #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
184         #undef  SINGLE_THREADED
185     #else
186         #define SINGLE_THREADED
187     #endif
188
189     #if (SSL_CFG_DH_EN == DEF_ENABLED)
190         #undef  NO_DH
191     #else
192         #define NO_DH
193     #endif
194
195     #if (SSL_CFG_DSA_EN == DEF_ENABLED)
196         #undef  NO_DSA
197     #else
198         #define NO_DSA
199     #endif
200
201     #if (SSL_CFG_PSK_EN == DEF_ENABLED)
202         #undef  NO_PSK
203     #else
204         #define NO_PSK
205     #endif
206
207     #if (SSL_CFG_3DES_EN == DEF_ENABLED)
208         #undef  NO_DES
209     #else
210         #define NO_DES
211     #endif
212
213     #if (SSL_CFG_AES_EN == DEF_ENABLED)
214         #undef  NO_AES
215     #else
216         #define NO_AES
217     #endif
218
219     #if (SSL_CFG_RC4_EN == DEF_ENABLED)
220         #undef  NO_RC4
221     #else
222         #define NO_RC4
223     #endif
224
225     #if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
226         #undef  NO_RABBIT
227     #else
228         #define NO_RABBIT
229     #endif
230
231     #if (SSL_CFG_HC128_EN == DEF_ENABLED)
232         #undef  NO_HC128
233     #else
234         #define NO_HC128
235     #endif
236
237     #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
238         #define BIG_ENDIAN_ORDER
239     #else
240         #undef  BIG_ENDIAN_ORDER
241         #define LITTLE_ENDIAN_ORDER
242     #endif
243
244     #if (SSL_CFG_MD4_EN == DEF_ENABLED)
245         #undef  NO_MD4
246     #else
247         #define NO_MD4
248     #endif
249
250     #if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
251         #undef  NO_WRITEV
252     #else
253         #define NO_WRITEV
254     #endif
255
256     #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
257         #define NO_DEV_RANDOM   
258     #else
259         #undef  NO_DEV_RANDOM
260     #endif
261
262     #if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
263         #define CYASSL_USER_IO   
264     #else
265         #undef  CYASSL_USER_IO
266     #endif
267
268     #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
269         #undef  LARGE_STATIC_BUFFERS
270         #undef  STATIC_CHUNKS_ONLY
271     #else
272         #define LARGE_STATIC_BUFFERS
273         #define STATIC_CHUNKS_ONLY
274     #endif
275
276     #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
277         #define  CYASSL_DER_LOAD
278     #else
279         #undef   CYASSL_DER_LOAD
280     #endif
281
282     #if (SSL_CFG_DTLS_EN == DEF_ENABLED)
283         #define  CYASSL_DTLS
284     #else
285         #undef   CYASSL_DTLS
286     #endif
287
288     #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
289          #define CYASSL_CALLBACKS
290     #else
291          #undef  CYASSL_CALLBACKS
292     #endif
293
294     #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
295          #define USE_FAST_MATH
296     #else
297          #undef  USE_FAST_MATH
298     #endif
299
300     #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
301          #define TFM_TIMING_RESISTANT
302     #else
303          #undef  TFM_TIMING_RESISTANT
304     #endif
305
306 #endif /* MICRIUM */
307
308
309 #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC)
310     #define USE_CYASSL_MEMORY
311 #endif
312
313 /* Place any other flags or defines here */
314
315
316 #ifdef __cplusplus
317     }   /* extern "C" */
318 #endif
319
320
321 #endif /* CTAO_CRYPT_SETTINGS_H */
322