1
0

ctc_settings.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. /* ctc_settings.h
  2. *
  3. * Copyright (C) 2006-2011 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. /* Place OS specific preprocessor flags, defines, includes here, will be
  22. included into every file because ctc_types.h includes it */
  23. #ifndef CTAO_CRYPT_SETTINGS_H
  24. #define CTAO_CRYPT_SETTINGS_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Uncomment next line if using IPHONE */
  29. /* #define IPHONE */
  30. /* Uncomment next line if using ThreadX */
  31. /* #define THREADX */
  32. /* Uncomment next line if using Micrium ucOS */
  33. /* #define MICRIUM */
  34. /* Uncomment next line if using Mbed */
  35. /* #define MBED */
  36. /* Uncomment next line if using FreeRTOS */
  37. /* #define FREERTOS */
  38. /* Uncomment next line if using lwip */
  39. /* #define CYASSL_LWIP */
  40. /* Uncomment next line if building CyaSSL for a game console */
  41. /* #define CYASSL_GAME_BUILD */
  42. #if defined(USE_CYASSL_CONFIG) || defined(HAVE_CONFIG_H)
  43. #include "ctc_config.h" /* may not want global HAVE_CONFIG_H */
  44. #endif
  45. #include "ctc_visibility.h"
  46. #ifdef IPHONE
  47. #define SIZEOF_LONG_LONG 8
  48. #endif
  49. #ifdef THREADX
  50. #define SIZEOF_LONG_LONG 8
  51. #endif
  52. #ifdef MBED
  53. #define SINGLE_THREADED
  54. #define CYASSL_USER_IO
  55. #define NO_WRITEV
  56. #define NO_DEV_RANDOM
  57. #define NO_SHA512
  58. #define NO_DH
  59. #define NO_DSA
  60. #define NO_HC128
  61. #endif /* MBED */
  62. #ifdef FREERTOS
  63. #define SINGLE_THREADED
  64. #define NO_WRITEV
  65. #define NO_SHA512
  66. #define NO_DH
  67. #define NO_DSA
  68. #define NO_HC128
  69. #endif
  70. #ifdef CYASSL_GAME_BUILD
  71. #define SIZEOF_LONG_LONG 8
  72. #if defined(__PPU) || defined(__XENON)
  73. #define BIG_ENDIAN_ORDER
  74. #endif
  75. #endif
  76. #ifdef MICRIUM
  77. #include "stdlib.h"
  78. #include "net_cfg.h"
  79. #include "ssl_cfg.h"
  80. #include "net_secure_os.h"
  81. #define CYASSL_TYPES
  82. typedef CPU_INT08U byte;
  83. typedef CPU_INT16U word16;
  84. typedef CPU_INT32U word32;
  85. #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
  86. #define SIZEOF_LONG 4
  87. #undef SIZEOF_LONG_LONG
  88. #else
  89. #undef SIZEOF_LONG
  90. #define SIZEOF_LONG_LONG 8
  91. #endif
  92. #define STRING_USER
  93. #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
  94. #define XSTRNCPY(pstr_dest, pstr_src, len_max) \
  95. ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
  96. (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
  97. #define XSTRNCMP(pstr_1, pstr_2, len_max) \
  98. ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
  99. (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
  100. #define XSTRSTR(pstr, pstr_srch) \
  101. ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
  102. (CPU_CHAR *)(pstr_srch)))
  103. #define XMEMSET(pmem, data_val, size) \
  104. ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
  105. (CPU_SIZE_T)(size)))
  106. #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
  107. (void *)(psrc), (CPU_SIZE_T)(size)))
  108. #define XMEMCMP(pmem_1, pmem_2, size) \
  109. (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
  110. (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
  111. #define XMEMMOVE XMEMCPY
  112. #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
  113. #define MICRIUM_MALLOC
  114. #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
  115. (CPU_SIZE_T)(s), (void *)0))
  116. #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
  117. (p), (void *)0))
  118. #define XREALLOC(p, n, h, t) realloc((p), (n))
  119. #endif
  120. #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
  121. #undef NO_FILESYSTEM
  122. #else
  123. #define NO_FILESYSTEM
  124. #endif
  125. #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
  126. #define DEBUG_CYASSL
  127. #else
  128. #undef DEBUG_CYASSL
  129. #endif
  130. #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
  131. #define OPENSSL_EXTRA
  132. #else
  133. #undef OPENSSL_EXTRA
  134. #endif
  135. #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
  136. #undef SINGLE_THREADED
  137. #else
  138. #define SINGLE_THREADED
  139. #endif
  140. #if (SSL_CFG_DH_EN == DEF_ENABLED)
  141. #undef NO_DH
  142. #else
  143. #define NO_DH
  144. #endif
  145. #if (SSL_CFG_DSA_EN == DEF_ENABLED)
  146. #undef NO_DSA
  147. #else
  148. #define NO_DSA
  149. #endif
  150. #if (SSL_CFG_PSK_EN == DEF_ENABLED)
  151. #undef NO_PSK
  152. #else
  153. #define NO_PSK
  154. #endif
  155. #if (SSL_CFG_3DES_EN == DEF_ENABLED)
  156. #undef NO_DES
  157. #else
  158. #define NO_DES
  159. #endif
  160. #if (SSL_CFG_AES_EN == DEF_ENABLED)
  161. #undef NO_AES
  162. #else
  163. #define NO_AES
  164. #endif
  165. #if (SSL_CFG_RC4_EN == DEF_ENABLED)
  166. #undef NO_RC4
  167. #else
  168. #define NO_RC4
  169. #endif
  170. #if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
  171. #undef NO_RABBIT
  172. #else
  173. #define NO_RABBIT
  174. #endif
  175. #if (SSL_CFG_HC128_EN == DEF_ENABLED)
  176. #undef NO_HC128
  177. #else
  178. #define NO_HC128
  179. #endif
  180. #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
  181. #define BIG_ENDIAN_ORDER
  182. #else
  183. #undef BIG_ENDIAN_ORDER
  184. #define LITTLE_ENDIAN_ORDER
  185. #endif
  186. #if (SSL_CFG_MD4_EN == DEF_ENABLED)
  187. #undef NO_MD4
  188. #else
  189. #define NO_MD4
  190. #endif
  191. #if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
  192. #undef NO_WRITEV
  193. #else
  194. #define NO_WRITEV
  195. #endif
  196. #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
  197. #define NO_DEV_RANDOM
  198. #else
  199. #undef NO_DEV_RANDOM
  200. #endif
  201. #if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
  202. #define CYASSL_USER_IO
  203. #else
  204. #undef CYASSL_USER_IO
  205. #endif
  206. #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
  207. #undef LARGE_STATIC_BUFFERS
  208. #undef STATIC_CHUNKS_ONLY
  209. #else
  210. #define LARGE_STATIC_BUFFERS
  211. #define STATIC_CHUNKS_ONLY
  212. #endif
  213. #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
  214. #define CYASSL_DER_LOAD
  215. #else
  216. #undef CYASSL_DER_LOAD
  217. #endif
  218. #if (SSL_CFG_DTLS_EN == DEF_ENABLED)
  219. #define CYASSL_DTLS
  220. #else
  221. #undef CYASSL_DTLS
  222. #endif
  223. #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
  224. #define CYASSL_CALLBACKS
  225. #else
  226. #undef CYASSL_CALLBACKS
  227. #endif
  228. #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
  229. #define USE_FAST_MATH
  230. #else
  231. #undef USE_FAST_MATH
  232. #endif
  233. #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
  234. #define TFM_TIMING_RESISTANT
  235. #else
  236. #undef TFM_TIMING_RESISTANT
  237. #endif
  238. #endif /* MICRIUM */
  239. #if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC)
  240. #define USE_CYASSL_MEMORY
  241. #endif
  242. /* Place any other flags or defines here */
  243. #ifdef __cplusplus
  244. } /* extern "C" */
  245. #endif
  246. #endif /* CTAO_CRYPT_SETTINGS_H */