CyaSSL is an SSL library for devices like mbed.

Dependents:   mbed_cyassl

Fork of CyaSSL by Todd Ouska

Committer:
saranieves92
Date:
Sun May 31 19:30:30 2015 +0000
Revision:
1:04ea34bf3bff
Parent:
0:5045d2638c29
RSA con cyassl

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
saranieves92 1:04ea34bf3bff 62 #define CYASSL_KEY_GEN
toddouska 0:5045d2638c29 63
toddouska 0:5045d2638c29 64 #endif /* MBED */
toddouska 0:5045d2638c29 65
toddouska 0:5045d2638c29 66
toddouska 0:5045d2638c29 67 #ifdef MICRIUM
toddouska 0:5045d2638c29 68
toddouska 0:5045d2638c29 69 #include "net_cfg.h"
toddouska 0:5045d2638c29 70 #include "cyassl_cfg.h"
toddouska 0:5045d2638c29 71 #include "net_secure_os.h"
toddouska 0:5045d2638c29 72
toddouska 0:5045d2638c29 73 #define CYASSL_TYPES
toddouska 0:5045d2638c29 74
toddouska 0:5045d2638c29 75 typedef CPU_INT08U byte;
toddouska 0:5045d2638c29 76 typedef CPU_INT16U word16;
toddouska 0:5045d2638c29 77 typedef CPU_INT32U word32;
toddouska 0:5045d2638c29 78
toddouska 0:5045d2638c29 79 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
toddouska 0:5045d2638c29 80 #define SIZEOF_LONG 8
toddouska 0:5045d2638c29 81 #undef SIZEOF_LONG_LONG
toddouska 0:5045d2638c29 82 #else
toddouska 0:5045d2638c29 83 #undef SIZEOF_LONG
toddouska 0:5045d2638c29 84 #define SIZEOF_LONG_LONG 8
toddouska 0:5045d2638c29 85 #endif
toddouska 0:5045d2638c29 86
toddouska 0:5045d2638c29 87 #define STRING_USER
toddouska 0:5045d2638c29 88
toddouska 0:5045d2638c29 89 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
toddouska 0:5045d2638c29 90 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
toddouska 0:5045d2638c29 91 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
toddouska 0:5045d2638c29 92 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
toddouska 0:5045d2638c29 93 #define XSTRNCMP(pstr_1, pstr_2, len_max) \
toddouska 0:5045d2638c29 94 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
toddouska 0:5045d2638c29 95 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
toddouska 0:5045d2638c29 96 #define XSTRSTR(pstr, pstr_srch) \
toddouska 0:5045d2638c29 97 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
toddouska 0:5045d2638c29 98 (CPU_CHAR *)(pstr_srch)))
toddouska 0:5045d2638c29 99 #define XMEMSET(pmem, data_val, size) \
toddouska 0:5045d2638c29 100 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
toddouska 0:5045d2638c29 101 (CPU_SIZE_T)(size)))
toddouska 0:5045d2638c29 102 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
toddouska 0:5045d2638c29 103 (void *)(psrc), (CPU_SIZE_T)(size)))
toddouska 0:5045d2638c29 104 #define XMEMCMP(pmem_1, pmem_2, size) \
toddouska 0:5045d2638c29 105 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
toddouska 0:5045d2638c29 106 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
toddouska 0:5045d2638c29 107
toddouska 0:5045d2638c29 108 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 109 #define MICRIUM_MALLOC
toddouska 0:5045d2638c29 110 #define XMALLOC(s, h, type) (((type) <= DYNAMIC_TYPE_SIGNER) ? \
toddouska 0:5045d2638c29 111 ((void *)NetSecure_Malloc((CPU_INT08U)(type), \
toddouska 0:5045d2638c29 112 (CPU_SIZE_T)(s))) : malloc(s))
toddouska 0:5045d2638c29 113 #define XFREE(p, h, type) (((type) <= DYNAMIC_TYPE_SIGNER) ? \
toddouska 0:5045d2638c29 114 (NetSecure_Free((CPU_INT08U)(type), (p))) : free((p)))
toddouska 0:5045d2638c29 115 #define XREALLOC(p, n, h, t) realloc((p), (n))
toddouska 0:5045d2638c29 116 #endif
toddouska 0:5045d2638c29 117
toddouska 0:5045d2638c29 118 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 119 #undef NO_FILESYSTEM
toddouska 0:5045d2638c29 120 #else
toddouska 0:5045d2638c29 121 #define NO_FILESYSTEM
toddouska 0:5045d2638c29 122 #endif
toddouska 0:5045d2638c29 123
toddouska 0:5045d2638c29 124 #if (CYASSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
toddouska 0:5045d2638c29 125 #define DEBUG_CYASSL
toddouska 0:5045d2638c29 126 #else
toddouska 0:5045d2638c29 127 #undef DEBUG_CYASSL
toddouska 0:5045d2638c29 128 #endif
toddouska 0:5045d2638c29 129
toddouska 0:5045d2638c29 130 #if (CYASSL_CFG_OPENSSL_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 131 #define OPENSSL_EXTRA
toddouska 0:5045d2638c29 132 #else
toddouska 0:5045d2638c29 133 #undef OPENSSL_EXTRA
toddouska 0:5045d2638c29 134 #endif
toddouska 0:5045d2638c29 135
toddouska 0:5045d2638c29 136 #if (CYASSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 137 #undef SINGLE_THREADED
toddouska 0:5045d2638c29 138 #else
toddouska 0:5045d2638c29 139 #define SINGLE_THREADED
toddouska 0:5045d2638c29 140 #endif
toddouska 0:5045d2638c29 141
toddouska 0:5045d2638c29 142 #if (CYASSL_CFG_DH_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 143 #undef NO_DH
toddouska 0:5045d2638c29 144 #else
toddouska 0:5045d2638c29 145 #define NO_DH
toddouska 0:5045d2638c29 146 #endif
toddouska 0:5045d2638c29 147
toddouska 0:5045d2638c29 148 #if (CYASSL_CFG_DSA_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 149 #undef NO_DSA
toddouska 0:5045d2638c29 150 #else
toddouska 0:5045d2638c29 151 #define NO_DSA
toddouska 0:5045d2638c29 152 #endif
toddouska 0:5045d2638c29 153
toddouska 0:5045d2638c29 154 #if (CYASSL_CFG_PSK_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 155 #undef NO_PSK
toddouska 0:5045d2638c29 156 #else
toddouska 0:5045d2638c29 157 #define NO_PSK
toddouska 0:5045d2638c29 158 #endif
toddouska 0:5045d2638c29 159
toddouska 0:5045d2638c29 160 #if (CYASSL_CFG_3DES_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 161 #undef NO_DES
toddouska 0:5045d2638c29 162 #else
toddouska 0:5045d2638c29 163 #define NO_DES
toddouska 0:5045d2638c29 164 #endif
toddouska 0:5045d2638c29 165
toddouska 0:5045d2638c29 166 #if (CYASSL_CFG_AES_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 167 #undef NO_AES
toddouska 0:5045d2638c29 168 #else
toddouska 0:5045d2638c29 169 #define NO_AES
toddouska 0:5045d2638c29 170 #endif
toddouska 0:5045d2638c29 171
toddouska 0:5045d2638c29 172 #if (CYASSL_CFG_RC4_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 173 #undef NO_RC4
toddouska 0:5045d2638c29 174 #else
toddouska 0:5045d2638c29 175 #define NO_RC4
toddouska 0:5045d2638c29 176 #endif
toddouska 0:5045d2638c29 177
toddouska 0:5045d2638c29 178 #if (CYASSL_CFG_RABBIT_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 179 #undef NO_RABBIT
toddouska 0:5045d2638c29 180 #else
toddouska 0:5045d2638c29 181 #define NO_RABBIT
toddouska 0:5045d2638c29 182 #endif
toddouska 0:5045d2638c29 183
toddouska 0:5045d2638c29 184 #if (CYASSL_CFG_HC128_EN == DEF_ENABLED)
toddouska 0:5045d2638c29 185 #undef NO_HC128
toddouska 0:5045d2638c29 186 #else
toddouska 0:5045d2638c29 187 #define NO_HC128
toddouska 0:5045d2638c29 188 #endif
toddouska 0:5045d2638c29 189
toddouska 0:5045d2638c29 190 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
toddouska 0:5045d2638c29 191 #define BIG_ENDIAN_ORDER
toddouska 0:5045d2638c29 192 #else
toddouska 0:5045d2638c29 193 #undef BIG_ENDIAN_ORDER
toddouska 0:5045d2638c29 194 #define LITTLE_ENDIAN_ORDER
toddouska 0:5045d2638c29 195 #endif
toddouska 0:5045d2638c29 196
toddouska 0:5045d2638c29 197
toddouska 0:5045d2638c29 198 #define NO_MD4
toddouska 0:5045d2638c29 199 #define NO_WRITEV
toddouska 0:5045d2638c29 200 #define NO_DEV_RANDOM
toddouska 0:5045d2638c29 201 #define CYASSL_USER_IO
toddouska 0:5045d2638c29 202 #define LARGE_STATIC_BUFFERS
toddouska 0:5045d2638c29 203 #define CYASSL_DER_LOAD
toddouska 0:5045d2638c29 204 #undef CYASSL_DTLS
toddouska 0:5045d2638c29 205
toddouska 0:5045d2638c29 206 #endif /* MICRIUM */
toddouska 0:5045d2638c29 207
toddouska 0:5045d2638c29 208 /* Place any other flags or defines here */
toddouska 0:5045d2638c29 209
toddouska 0:5045d2638c29 210
toddouska 0:5045d2638c29 211 #ifdef __cplusplus
toddouska 0:5045d2638c29 212 } /* extern "C" */
toddouska 0:5045d2638c29 213 #endif
toddouska 0:5045d2638c29 214
toddouska 0:5045d2638c29 215
toddouska 0:5045d2638c29 216 #endif /* CTAO_CRYPT_OS_SETTINGS_H */
toddouska 0:5045d2638c29 217