CyaSSL is an SSL library for devices like mbed.

Dependents:   cyassl-client Sync

Committer:
toddouska
Date:
Sat Feb 05 01:09:17 2011 +0000
Revision:
0:5045d2638c29
Beta Version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
toddouska 0:5045d2638c29 1 /* os_settings.h
toddouska 0:5045d2638c29 2 *
toddouska 0:5045d2638c29 3 * Copyright (C) 2006-2010 Sawtooth Consulting Ltd.
toddouska 0:5045d2638c29 4 *
toddouska 0:5045d2638c29 5 * This file is part of CyaSSL.
toddouska 0:5045d2638c29 6 *
toddouska 0:5045d2638c29 7 * CyaSSL is free software; you can redistribute it and/or modify
toddouska 0:5045d2638c29 8 * it under the terms of the GNU General Public License as published by
toddouska 0:5045d2638c29 9 * the Free Software Foundation; either version 2 of the License, or
toddouska 0:5045d2638c29 10 * (at your option) any later version.
toddouska 0:5045d2638c29 11 *
toddouska 0:5045d2638c29 12 * CyaSSL is distributed in the hope that it will be useful,
toddouska 0:5045d2638c29 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
toddouska 0:5045d2638c29 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
toddouska 0:5045d2638c29 15 * GNU General Public License for more details.
toddouska 0:5045d2638c29 16 *
toddouska 0:5045d2638c29 17 * You should have received a copy of the GNU General Public License
toddouska 0:5045d2638c29 18 * along with this program; if not, write to the Free Software
toddouska 0:5045d2638c29 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
toddouska 0:5045d2638c29 20 */
toddouska 0:5045d2638c29 21
toddouska 0:5045d2638c29 22 /* Place OS specific preprocessor flags, defines, includes here, will be
toddouska 0:5045d2638c29 23 included into every file because types.h includes it */
toddouska 0:5045d2638c29 24
toddouska 0:5045d2638c29 25 #ifndef CTAO_CRYPT_OS_SETTINGS_H
toddouska 0:5045d2638c29 26 #define CTAO_CRYPT_OS_SETTINGS_H
toddouska 0:5045d2638c29 27
toddouska 0:5045d2638c29 28 #ifdef __cplusplus
toddouska 0:5045d2638c29 29 extern "C" {
toddouska 0:5045d2638c29 30 #endif
toddouska 0:5045d2638c29 31
toddouska 0:5045d2638c29 32 /* Uncomment next line if using IPHONE */
toddouska 0:5045d2638c29 33 /* #define IPHONE */
toddouska 0:5045d2638c29 34
toddouska 0:5045d2638c29 35 /* Uncomment next line if using ThreadX */
toddouska 0:5045d2638c29 36 /* #define THREADX */
toddouska 0:5045d2638c29 37
toddouska 0:5045d2638c29 38 /* Uncomment next line if using Micrium ucOS */
toddouska 0:5045d2638c29 39 /* #define MICRIUM */
toddouska 0:5045d2638c29 40
toddouska 0:5045d2638c29 41
toddouska 0:5045d2638c29 42 #ifdef IPHONE
toddouska 0:5045d2638c29 43 #define SIZEOF_LONG_LONG 8
toddouska 0:5045d2638c29 44 #endif
toddouska 0:5045d2638c29 45
toddouska 0:5045d2638c29 46 #ifdef THREADX
toddouska 0:5045d2638c29 47 #define SIZEOF_LONG_LONG 8
toddouska 0:5045d2638c29 48 #endif
toddouska 0:5045d2638c29 49
toddouska 0:5045d2638c29 50 #define MBED
toddouska 0:5045d2638c29 51
toddouska 0:5045d2638c29 52 #ifdef MBED
toddouska 0:5045d2638c29 53
toddouska 0:5045d2638c29 54 #define SINGLE_THREADED
toddouska 0:5045d2638c29 55 #define CYASSL_USER_IO
toddouska 0:5045d2638c29 56 #define NO_WRITEV
toddouska 0:5045d2638c29 57 #define NO_DEV_RANDOM
toddouska 0:5045d2638c29 58 #define NO_SHA512
toddouska 0:5045d2638c29 59 #define NO_DH
toddouska 0:5045d2638c29 60 #define NO_DSA
toddouska 0:5045d2638c29 61 #define NO_HC128
toddouska 0:5045d2638c29 62
toddouska 0:5045d2638c29 63 #endif /* MBED */
toddouska 0:5045d2638c29 64
toddouska 0:5045d2638c29 65
toddouska 0:5045d2638c29 66 #ifdef MICRIUM
toddouska 0:5045d2638c29 67
toddouska 0:5045d2638c29 68 #include "net_cfg.h"
toddouska 0:5045d2638c29 69 #include "cyassl_cfg.h"
toddouska 0:5045d2638c29 70 #include "net_secure_os.h"
toddouska 0:5045d2638c29 71
toddouska 0:5045d2638c29 72 #define CYASSL_TYPES
toddouska 0:5045d2638c29 73
toddouska 0:5045d2638c29 74 typedef CPU_INT08U byte;
toddouska 0:5045d2638c29 75 typedef CPU_INT16U word16;
toddouska 0:5045d2638c29 76 typedef CPU_INT32U word32;
toddouska 0:5045d2638c29 77
toddouska 0:5045d2638c29 78 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
toddouska 0:5045d2638c29 79 #define SIZEOF_LONG 8
toddouska 0:5045d2638c29 80 #undef SIZEOF_LONG_LONG
toddouska 0:5045d2638c29 81 #else
toddouska 0:5045d2638c29 82 #undef SIZEOF_LONG
toddouska 0:5045d2638c29 83 #define SIZEOF_LONG_LONG 8
toddouska 0:5045d2638c29 84 #endif
toddouska 0:5045d2638c29 85
toddouska 0:5045d2638c29 86 #define STRING_USER
toddouska 0:5045d2638c29 87
toddouska 0:5045d2638c29 88 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
toddouska 0:5045d2638c29 89 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
toddouska 0:5045d2638c29 90 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
toddouska 0:5045d2638c29 91 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
toddouska 0:5045d2638c29 92 #define XSTRNCMP(pstr_1, pstr_2, len_max) \
toddouska 0:5045d2638c29 93 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
toddouska 0:5045d2638c29 94 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
toddouska 0:5045d2638c29 95 #define XSTRSTR(pstr, pstr_srch) \
toddouska 0:5045d2638c29 96 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
toddouska 0:5045d2638c29 97 (CPU_CHAR *)(pstr_srch)))
toddouska 0:5045d2638c29 98 #define XMEMSET(pmem, data_val, size) \
toddouska 0:5045d2638c29 99 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
toddouska 0:5045d2638c29 100 (CPU_SIZE_T)(size)))
toddouska 0:5045d2638c29 101 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
toddouska 0:5045d2638c29 102 (void *)(psrc), (CPU_SIZE_T)(size)))
toddouska 0:5045d2638c29 103 #define XMEMCMP(pmem_1, pmem_2, size) \
toddouska 0:5045d2638c29 104 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
toddouska 0:5045d2638c29 105 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
toddouska 0:5045d2638c29 106
toddouska 0:5045d2638c29 107 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 108 #define MICRIUM_MALLOC
toddouska 0:5045d2638c29 109 #define XMALLOC(s, h, type) (((type) <= DYNAMIC_TYPE_SIGNER) ? \
toddouska 0:5045d2638c29 110 ((void *)NetSecure_Malloc((CPU_INT08U)(type), \
toddouska 0:5045d2638c29 111 (CPU_SIZE_T)(s))) : malloc(s))
toddouska 0:5045d2638c29 112 #define XFREE(p, h, type) (((type) <= DYNAMIC_TYPE_SIGNER) ? \
toddouska 0:5045d2638c29 113 (NetSecure_Free((CPU_INT08U)(type), (p))) : free((p)))
toddouska 0:5045d2638c29 114 #define XREALLOC(p, n, h, t) realloc((p), (n))
toddouska 0:5045d2638c29 115 #endif
toddouska 0:5045d2638c29 116
toddouska 0:5045d2638c29 117 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 118 #undef NO_FILESYSTEM
toddouska 0:5045d2638c29 119 #else
toddouska 0:5045d2638c29 120 #define NO_FILESYSTEM
toddouska 0:5045d2638c29 121 #endif
toddouska 0:5045d2638c29 122
toddouska 0:5045d2638c29 123 #if (CYASSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
toddouska 0:5045d2638c29 124 #define DEBUG_CYASSL
toddouska 0:5045d2638c29 125 #else
toddouska 0:5045d2638c29 126 #undef DEBUG_CYASSL
toddouska 0:5045d2638c29 127 #endif
toddouska 0:5045d2638c29 128
toddouska 0:5045d2638c29 129 #if (CYASSL_CFG_OPENSSL_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 130 #define OPENSSL_EXTRA
toddouska 0:5045d2638c29 131 #else
toddouska 0:5045d2638c29 132 #undef OPENSSL_EXTRA
toddouska 0:5045d2638c29 133 #endif
toddouska 0:5045d2638c29 134
toddouska 0:5045d2638c29 135 #if (CYASSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 136 #undef SINGLE_THREADED
toddouska 0:5045d2638c29 137 #else
toddouska 0:5045d2638c29 138 #define SINGLE_THREADED
toddouska 0:5045d2638c29 139 #endif
toddouska 0:5045d2638c29 140
toddouska 0:5045d2638c29 141 #if (CYASSL_CFG_DH_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 142 #undef NO_DH
toddouska 0:5045d2638c29 143 #else
toddouska 0:5045d2638c29 144 #define NO_DH
toddouska 0:5045d2638c29 145 #endif
toddouska 0:5045d2638c29 146
toddouska 0:5045d2638c29 147 #if (CYASSL_CFG_DSA_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 148 #undef NO_DSA
toddouska 0:5045d2638c29 149 #else
toddouska 0:5045d2638c29 150 #define NO_DSA
toddouska 0:5045d2638c29 151 #endif
toddouska 0:5045d2638c29 152
toddouska 0:5045d2638c29 153 #if (CYASSL_CFG_PSK_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 154 #undef NO_PSK
toddouska 0:5045d2638c29 155 #else
toddouska 0:5045d2638c29 156 #define NO_PSK
toddouska 0:5045d2638c29 157 #endif
toddouska 0:5045d2638c29 158
toddouska 0:5045d2638c29 159 #if (CYASSL_CFG_3DES_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 160 #undef NO_DES
toddouska 0:5045d2638c29 161 #else
toddouska 0:5045d2638c29 162 #define NO_DES
toddouska 0:5045d2638c29 163 #endif
toddouska 0:5045d2638c29 164
toddouska 0:5045d2638c29 165 #if (CYASSL_CFG_AES_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 166 #undef NO_AES
toddouska 0:5045d2638c29 167 #else
toddouska 0:5045d2638c29 168 #define NO_AES
toddouska 0:5045d2638c29 169 #endif
toddouska 0:5045d2638c29 170
toddouska 0:5045d2638c29 171 #if (CYASSL_CFG_RC4_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 172 #undef NO_RC4
toddouska 0:5045d2638c29 173 #else
toddouska 0:5045d2638c29 174 #define NO_RC4
toddouska 0:5045d2638c29 175 #endif
toddouska 0:5045d2638c29 176
toddouska 0:5045d2638c29 177 #if (CYASSL_CFG_RABBIT_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 178 #undef NO_RABBIT
toddouska 0:5045d2638c29 179 #else
toddouska 0:5045d2638c29 180 #define NO_RABBIT
toddouska 0:5045d2638c29 181 #endif
toddouska 0:5045d2638c29 182
toddouska 0:5045d2638c29 183 #if (CYASSL_CFG_HC128_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 184 #undef NO_HC128
toddouska 0:5045d2638c29 185 #else
toddouska 0:5045d2638c29 186 #define NO_HC128
toddouska 0:5045d2638c29 187 #endif
toddouska 0:5045d2638c29 188
toddouska 0:5045d2638c29 189 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
toddouska 0:5045d2638c29 190 #define BIG_ENDIAN_ORDER
toddouska 0:5045d2638c29 191 #else
toddouska 0:5045d2638c29 192 #undef BIG_ENDIAN_ORDER
toddouska 0:5045d2638c29 193 #define LITTLE_ENDIAN_ORDER
toddouska 0:5045d2638c29 194 #endif
toddouska 0:5045d2638c29 195
toddouska 0:5045d2638c29 196
toddouska 0:5045d2638c29 197 #define NO_MD4
toddouska 0:5045d2638c29 198 #define NO_WRITEV
toddouska 0:5045d2638c29 199 #define NO_DEV_RANDOM
toddouska 0:5045d2638c29 200 #define CYASSL_USER_IO
toddouska 0:5045d2638c29 201 #define LARGE_STATIC_BUFFERS
toddouska 0:5045d2638c29 202 #define CYASSL_DER_LOAD
toddouska 0:5045d2638c29 203 #undef CYASSL_DTLS
toddouska 0:5045d2638c29 204
toddouska 0:5045d2638c29 205 #endif /* MICRIUM */
toddouska 0:5045d2638c29 206
toddouska 0:5045d2638c29 207 /* Place any other flags or defines here */
toddouska 0:5045d2638c29 208
toddouska 0:5045d2638c29 209
toddouska 0:5045d2638c29 210 #ifdef __cplusplus
toddouska 0:5045d2638c29 211 } /* extern "C" */
toddouska 0:5045d2638c29 212 #endif
toddouska 0:5045d2638c29 213
toddouska 0:5045d2638c29 214
toddouska 0:5045d2638c29 215 #endif /* CTAO_CRYPT_OS_SETTINGS_H */
toddouska 0:5045d2638c29 216