CyaSSL is an SSL library for devices like mbed.
Fork of CyaSSL by
Embed:
(wiki syntax)
Show/hide line numbers
os_settings.h
00001 /* os_settings.h 00002 * 00003 * Copyright (C) 2006-2010 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 #ifndef CTAO_CRYPT_OS_SETTINGS_H 00026 #define CTAO_CRYPT_OS_SETTINGS_H 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /* Uncomment next line if using IPHONE */ 00033 /* #define IPHONE */ 00034 00035 /* Uncomment next line if using ThreadX */ 00036 /* #define THREADX */ 00037 00038 /* Uncomment next line if using Micrium ucOS */ 00039 /* #define MICRIUM */ 00040 00041 00042 #ifdef IPHONE 00043 #define SIZEOF_LONG_LONG 8 00044 #endif 00045 00046 #ifdef THREADX 00047 #define SIZEOF_LONG_LONG 8 00048 #endif 00049 00050 #define MBED 00051 00052 #ifdef MBED 00053 00054 #define SINGLE_THREADED 00055 #define CYASSL_USER_IO 00056 #define NO_WRITEV 00057 #define NO_DEV_RANDOM 00058 #define NO_SHA512 00059 #define NO_DH 00060 #define NO_DSA 00061 #define NO_HC128 00062 #define CYASSL_KEY_GEN 00063 00064 #endif /* MBED */ 00065 00066 00067 #ifdef MICRIUM 00068 00069 #include "net_cfg.h" 00070 #include "cyassl_cfg.h" 00071 #include "net_secure_os.h" 00072 00073 #define CYASSL_TYPES 00074 00075 typedef CPU_INT08U byte; 00076 typedef CPU_INT16U word16; 00077 typedef CPU_INT32U word32; 00078 00079 #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) 00080 #define SIZEOF_LONG 8 00081 #undef SIZEOF_LONG_LONG 00082 #else 00083 #undef SIZEOF_LONG 00084 #define SIZEOF_LONG_LONG 8 00085 #endif 00086 00087 #define STRING_USER 00088 00089 #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) 00090 #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ 00091 ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ 00092 (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) 00093 #define XSTRNCMP(pstr_1, pstr_2, len_max) \ 00094 ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ 00095 (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) 00096 #define XSTRSTR(pstr, pstr_srch) \ 00097 ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ 00098 (CPU_CHAR *)(pstr_srch))) 00099 #define XMEMSET(pmem, data_val, size) \ 00100 ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ 00101 (CPU_SIZE_T)(size))) 00102 #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ 00103 (void *)(psrc), (CPU_SIZE_T)(size))) 00104 #define XMEMCMP(pmem_1, pmem_2, size) \ 00105 (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ 00106 (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) 00107 00108 #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) 00109 #define MICRIUM_MALLOC 00110 #define XMALLOC(s, h, type) (((type) <= DYNAMIC_TYPE_SIGNER) ? \ 00111 ((void *)NetSecure_Malloc((CPU_INT08U)(type), \ 00112 (CPU_SIZE_T)(s))) : malloc(s)) 00113 #define XFREE(p, h, type) (((type) <= DYNAMIC_TYPE_SIGNER) ? \ 00114 (NetSecure_Free((CPU_INT08U)(type), (p))) : free((p))) 00115 #define XREALLOC(p, n, h, t) realloc((p), (n)) 00116 #endif 00117 00118 #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) 00119 #undef NO_FILESYSTEM 00120 #else 00121 #define NO_FILESYSTEM 00122 #endif 00123 00124 #if (CYASSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) 00125 #define DEBUG_CYASSL 00126 #else 00127 #undef DEBUG_CYASSL 00128 #endif 00129 00130 #if (CYASSL_CFG_OPENSSL_EN == DEF_ENABLED) 00131 #define OPENSSL_EXTRA 00132 #else 00133 #undef OPENSSL_EXTRA 00134 #endif 00135 00136 #if (CYASSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) 00137 #undef SINGLE_THREADED 00138 #else 00139 #define SINGLE_THREADED 00140 #endif 00141 00142 #if (CYASSL_CFG_DH_EN == DEF_ENABLED) 00143 #undef NO_DH 00144 #else 00145 #define NO_DH 00146 #endif 00147 00148 #if (CYASSL_CFG_DSA_EN == DEF_ENABLED) 00149 #undef NO_DSA 00150 #else 00151 #define NO_DSA 00152 #endif 00153 00154 #if (CYASSL_CFG_PSK_EN == DEF_ENABLED) 00155 #undef NO_PSK 00156 #else 00157 #define NO_PSK 00158 #endif 00159 00160 #if (CYASSL_CFG_3DES_EN == DEF_ENABLED) 00161 #undef NO_DES 00162 #else 00163 #define NO_DES 00164 #endif 00165 00166 #if (CYASSL_CFG_AES_EN == DEF_ENABLED) 00167 #undef NO_AES 00168 #else 00169 #define NO_AES 00170 #endif 00171 00172 #if (CYASSL_CFG_RC4_EN == DEF_ENABLED) 00173 #undef NO_RC4 00174 #else 00175 #define NO_RC4 00176 #endif 00177 00178 #if (CYASSL_CFG_RABBIT_EN == DEF_ENABLED) 00179 #undef NO_RABBIT 00180 #else 00181 #define NO_RABBIT 00182 #endif 00183 00184 #if (CYASSL_CFG_HC128_EN == DEF_ENABLED) 00185 #undef NO_HC128 00186 #else 00187 #define NO_HC128 00188 #endif 00189 00190 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) 00191 #define BIG_ENDIAN_ORDER 00192 #else 00193 #undef BIG_ENDIAN_ORDER 00194 #define LITTLE_ENDIAN_ORDER 00195 #endif 00196 00197 00198 #define NO_MD4 00199 #define NO_WRITEV 00200 #define NO_DEV_RANDOM 00201 #define CYASSL_USER_IO 00202 #define LARGE_STATIC_BUFFERS 00203 #define CYASSL_DER_LOAD 00204 #undef CYASSL_DTLS 00205 00206 #endif /* MICRIUM */ 00207 00208 /* Place any other flags or defines here */ 00209 00210 00211 #ifdef __cplusplus 00212 } /* extern "C" */ 00213 #endif 00214 00215 00216 #endif /* CTAO_CRYPT_OS_SETTINGS_H */ 00217
Generated on Wed Jul 13 2022 00:57:02 by 1.7.2