user_settings.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. /* user_settings.h
  2. *
  3. * Copyright (C) 2006-2024 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL 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. * wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #if defined(RENESAS_T4_USE)
  22. #include "wolfssl_simple_demo.h"
  23. #endif
  24. /*-- Renesas MCU type ---------------------------------------------------------
  25. *
  26. *
  27. *----------------------------------------------------------------------------*/
  28. #define WOLFSSL_RENESAS_RX72N
  29. /*-- Renesas TSIP usage and its version ---------------------------------------
  30. *
  31. * "WOLFSSL_RENESAS_TSIP" definition makes wolfSSL to use H/W acceleration
  32. * for cipher operations.
  33. * TSIP definition asks to have its version number.
  34. * "WOLFSSL_RENESAS_TSIP_VER" takes following value:
  35. * 106: TSIPv1.06
  36. * 109: TSIPv1.09
  37. * 113: TSIPv1.13
  38. * 114: TSIPv1.14
  39. * 115: TSIPv1.15
  40. * 117: TSIPv1.17
  41. * 121: TSIPv1.21
  42. *----------------------------------------------------------------------------*/
  43. #define WOLFSSL_RENESAS_TSIP
  44. #define WOLFSSL_RENESAS_TSIP_VER 121
  45. #if defined(SIMPLE_TLS_CLIENT) || defined(SIMPLE_TLS_SERVER)
  46. #undef WOLFSSL_RENESAS_TSIP
  47. #undef WOLFSSL_RENESAS_TSIP_VER
  48. #endif
  49. /*-- TLS version definitions --------------------------------------------------
  50. *
  51. * wolfSSL supports TLSv1.2 by default. In case you want your system to support
  52. * TLSv1.3, uncomment line below.
  53. *
  54. *----------------------------------------------------------------------------*/
  55. #define WOLFSSL_TLS13
  56. /*-- Operating System related definitions --------------------------------------
  57. *
  58. * In case any real-time OS is used, define its name(e.g. FREERTOS).
  59. * Otherwise, define "SINGLE_THREADED". They are exclusive each other.
  60. *
  61. *----------------------------------------------------------------------------*/
  62. #if !defined(RENESAS_T4_USE)
  63. #define FREERTOS
  64. #define FREERTOS_TCP
  65. #else
  66. #define SINGLE_THREADED
  67. #endif
  68. #if !defined(FREERTOS_TCP)
  69. #define WOLFSSL_NO_SOCK
  70. #define WOLFSSL_USER_IO
  71. #endif
  72. /*-- Compiler related definitions ---------------------------------------------
  73. *
  74. * CC-RX is C99 compliant, but may not provide the features wolfSSL requires.
  75. * This section defines macros for such cases to avoid build-time or run-time
  76. * failures.
  77. *
  78. *----------------------------------------------------------------------------*/
  79. /* CC-RX does not support variable length array */
  80. #define WOLFSSL_SP_NO_DYN_STACK
  81. /*-- Cipher related definitions -----------------------------------------------
  82. *
  83. *
  84. *----------------------------------------------------------------------------*/
  85. #define NO_DEV_RANDOM
  86. #define NO_MD4
  87. #define WOLFSSL_DH_CONST
  88. #define HAVE_TLS_EXTENSIONS
  89. #define HAVE_AESGCM
  90. #define HAVE_AESCCM
  91. #define HAVE_AES_CBC
  92. #define WOLFSSL_SHA512
  93. #define HAVE_SUPPORTED_CURVES
  94. #define HAVE_ECC
  95. #define HAVE_CURVE25519
  96. #define CURVE25519_SMALL
  97. #define WOLFSSL_STATIC_RSA
  98. /* USE_ECC_CERT
  99. * This macro is for selecting root CA certificate to load, it is valid only
  100. * in example applications. wolfSSL does not refer this macro.
  101. * If you want to use cipher suites including ECDSA authentication in
  102. * the example applications with TSIP, enable this macro.
  103. * In TSIP 1.13 or later version, following cipher suites are
  104. * available:
  105. * - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
  106. * - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SAH256
  107. *
  108. * Note that, this macro disables cipher suites including RSA
  109. * authentication such as:
  110. * - TLS_RSA_WITH_AES_128_CBC_SHA
  111. * - TLS_RSA_WITH_AES_256_CBC_SHA
  112. * - TLS_RSA_WITH_AES_128_CBC_SHA256
  113. * - TLS_RSA_WITH_AES_256_CBC_SHA256
  114. * - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
  115. * - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA256
  116. *
  117. */
  118. #define USE_ECC_CERT
  119. /* Enable WOLFSSL_CHECK_SIG_FAULTS definition when self-verify for
  120. * Ecc signature is required. It is disabled by default.
  121. */
  122. /*#define WOLFSSL_CHECK_SIG_FAULTS*/
  123. /* In this example application, Root CA cert buffer named
  124. * "ca_ecc_cert_der_256" is used under the following macro definition
  125. * for ECDSA.
  126. */
  127. #define USE_CERT_BUFFERS_256
  128. /* In this example application, Root CA cert buffer named
  129. * "ca_cert_der_2048" is used under the following macro definition
  130. * for RSA authentication.
  131. */
  132. #define USE_CERT_BUFFERS_2048
  133. /*-- Misc definitions ---------------------------------------------------------
  134. *
  135. *
  136. *----------------------------------------------------------------------------*/
  137. #define SIZEOF_LONG_LONG 8
  138. #define WOLFSSL_SMALL_STACK
  139. /*
  140. * -- "NO_ASN_TIME" macro is to avoid certificate expiration validation --
  141. *
  142. * Note. In your actual products, do not forget to comment-out
  143. * "NO_ASN_TIME" macro. And prepare time function to get calendar time,
  144. * otherwise, certificate expiration validation will not work.
  145. */
  146. /*#define NO_ASN_TIME*/
  147. #define NO_MAIN_DRIVER
  148. #define BENCH_EMBEDDED
  149. #define NO_WOLFSSL_DIR
  150. #define WOLFSSL_NO_CURRDIR
  151. #define NO_FILESYSTEM
  152. #define WOLFSSL_LOG_PRINTF
  153. #define WOLFSSL_HAVE_MIN
  154. #define WOLFSSL_HAVE_MAX
  155. #define NO_WRITEV
  156. #define WOLFSSL_USER_CURRTIME /* for benchmark */
  157. #define TIME_OVERRIDES
  158. #define XTIME time
  159. #define WOLFSSL_GMTIME
  160. #define XGMTIME(c,t) gmtime(c)
  161. #define USE_WOLF_SUSECONDS_T
  162. #define USE_WOLF_TIMEVAL_T
  163. #define XSTRNCASECMP(s1,s2,n) strncmp(s1,s2,n)
  164. #define WC_RSA_BLINDING
  165. #define TFM_TIMING_RESISTANT
  166. #define ECC_TIMING_RESISTANT
  167. #define FP_MAX_BITS 4096
  168. #define WOLFSSL_SP_MATH
  169. #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
  170. #define WOLFSSL_HAVE_SP_RSA
  171. #define WOLFSSL_HAVE_SP_DH
  172. #define WOLFSSL_HAVE_SP_ECC
  173. /*-- Debugging options ------------------------------------------------------
  174. *
  175. * "DEBUG_WOLFSSL" definition enables log to output into stdout.
  176. * Note: wolfSSL_Debugging_ON() must be called just after wolfSSL_Init().
  177. *----------------------------------------------------------------------------*/
  178. /*#define DEBUG_WOLFSSL*/
  179. /*-- Definitions for functionality negation -----------------------------------
  180. *
  181. *
  182. *----------------------------------------------------------------------------*/
  183. /*#define NO_RENESAS_TSIP_CRYPT*/
  184. /*#define NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION*/
  185. #if defined(WOLFCRYPT_ONLY)
  186. #undef WOLFSSL_RENESAS_TSIP
  187. #endif
  188. /*-- Consistency checking between definitions ---------------------------------
  189. *
  190. *
  191. *----------------------------------------------------------------------------*/
  192. /*-- TSIP TLS specific definitions --*/
  193. #if defined(WOLFSSL_RENESAS_TSIP)
  194. #if !defined(WOLFSSL_RENESAS_TSIP_VER)
  195. #error "WOLFSSL_RENESAS_TSIP_VER is required to be defined and have value"
  196. #endif
  197. #endif
  198. /*-- Complementary definitions ------------------------------------------------
  199. *
  200. *
  201. *----------------------------------------------------------------------------*/
  202. #if defined(WOLFSSL_RENESAS_TSIP)
  203. /*-- TSIP TLS and/or CRYPTONLY Definition --------------------------------*/
  204. /* Enable TSIP TLS (default)
  205. * TSIP CRYPTONLY is also enabled.
  206. * Disable TSIP TLS
  207. * TSIP CRYPTONLY is only enabled.
  208. */
  209. #define WOLFSSL_RENESAS_TSIP_TLS
  210. #if !defined(NO_RENESAS_TSIP_CRYPT)
  211. #define HAVE_PK_CALLBACKS
  212. #define WOLF_CRYPTO_CB
  213. #if defined(WOLFSSL_RENESAS_TSIP_TLS)
  214. #define WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT
  215. #define WOLF_PRIVATE_KEY_ID
  216. #endif
  217. #endif
  218. #if !defined(WOLFSSL_RENESAS_TSIP_TLS) && \
  219. defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
  220. # undef WOLFSSL_RENESAS_TSIP_TLS
  221. # undef WOLFSSL_RENESAS_TSIP_CRYPT
  222. #endif
  223. /*-------------------------------------------------------------------------
  224. * TSIP generates random numbers using the CRT-DRBG described
  225. * in NIST SP800-90A. Recommend to define the CUSTOM_RAND_GENERATE_BLOCK
  226. * so that wc_RNG_GenerateByte/Block() call TSIP random generatoion API
  227. * directly. Comment out the macro will generate random number by
  228. * wolfSSL Hash DRBG by using a seed which is generated by TSIP API.
  229. *-----------------------------------------------------------------------*/
  230. #define CUSTOM_RAND_GENERATE_BLOCK wc_tsip_GenerateRandBlock
  231. #else
  232. #define OPENSSL_EXTRA
  233. #define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */
  234. #if !defined(min)
  235. #define min(data1, data2) _builtin_min(data1, data2)
  236. #endif
  237. #endif
  238. /*-- TLS version and required definitions --*/
  239. #if defined(WOLFSSL_TLS13)
  240. #define HAVE_FFDHE_2048
  241. #define HAVE_HKDF
  242. #define WC_RSA_PSS
  243. #endif
  244. /*-- strcasecmp */
  245. #define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
  246. /* use original ASN parsing */
  247. #define WOLFSSL_ASN_ORIGINAL