2
0

user_settings.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /* Example custom user settings for wolfSSL */
  2. #ifndef WOLFSSL_USER_SETTINGS_H
  3. #define WOLFSSL_USER_SETTINGS_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #include <stddef.h> /* for size_t */
  8. /* ------------------------------------------------------------------------- */
  9. /* Platform */
  10. /* ------------------------------------------------------------------------- */
  11. #undef WOLFSSL_GENERAL_ALIGNMENT
  12. #define WOLFSSL_GENERAL_ALIGNMENT 4
  13. #undef SINGLE_THREADED
  14. #define SINGLE_THREADED
  15. #undef WOLFSSL_SMALL_STACK
  16. #define WOLFSSL_SMALL_STACK
  17. #undef MICROCHIP_PIC32
  18. #define MICROCHIP_PIC32
  19. #undef WOLFSSL_MICROCHIP_PIC32MZ
  20. #define WOLFSSL_MICROCHIP_PIC32MZ
  21. /* ------------------------------------------------------------------------- */
  22. /* Math Configuration */
  23. /* ------------------------------------------------------------------------- */
  24. #undef USE_FAST_MATH
  25. #define USE_FAST_MATH
  26. #ifdef USE_FAST_MATH
  27. #undef TFM_TIMING_RESISTANT
  28. #define TFM_TIMING_RESISTANT
  29. /* Optimizations */
  30. //#define TFM_MIPS
  31. #endif
  32. /* ------------------------------------------------------------------------- */
  33. /* Crypto */
  34. /* ------------------------------------------------------------------------- */
  35. /* ECC */
  36. #if 1
  37. #undef HAVE_ECC
  38. #define HAVE_ECC
  39. /* Manually define enabled curves */
  40. #undef ECC_USER_CURVES
  41. #define ECC_USER_CURVES
  42. //#define HAVE_ECC192
  43. //#define HAVE_ECC224
  44. #undef NO_ECC256
  45. //#define HAVE_ECC384
  46. //#define HAVE_ECC521
  47. /* Fixed point cache (speeds repeated operations against same private key) */
  48. #undef FP_ECC
  49. //#define FP_ECC
  50. #ifdef FP_ECC
  51. /* Bits / Entries */
  52. #undef FP_ENTRIES
  53. #define FP_ENTRIES 2
  54. #undef FP_LUT
  55. #define FP_LUT 4
  56. #endif
  57. /* Optional ECC calculation method */
  58. /* Note: doubles heap usage, but slightly faster */
  59. #undef ECC_SHAMIR
  60. #define ECC_SHAMIR
  61. /* Reduces heap usage, but slower */
  62. #undef ECC_TIMING_RESISTANT
  63. #define ECC_TIMING_RESISTANT
  64. #ifdef USE_FAST_MATH
  65. /* use reduced size math buffers for ecc points */
  66. #undef ALT_ECC_SIZE
  67. #define ALT_ECC_SIZE
  68. /* Enable TFM optimizations for ECC */
  69. #if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES)
  70. #define TFM_ECC192
  71. #endif
  72. #if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES)
  73. #define TFM_ECC224
  74. #endif
  75. #if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
  76. #define TFM_ECC256
  77. #endif
  78. #if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
  79. #define TFM_ECC384
  80. #endif
  81. #if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES)
  82. #define TFM_ECC521
  83. #endif
  84. #endif
  85. #endif
  86. /* RSA */
  87. #undef NO_RSA
  88. #if 1
  89. #ifdef USE_FAST_MATH
  90. /* Maximum math bits (Max RSA key bits * 2) */
  91. #undef FP_MAX_BITS
  92. #define FP_MAX_BITS 4096
  93. #endif
  94. /* half as much memory but twice as slow */
  95. #undef RSA_LOW_MEM
  96. //#define RSA_LOW_MEM
  97. /* timing resistance */
  98. #undef WC_RSA_BLINDING
  99. #define WC_RSA_BLINDING
  100. #else
  101. #define NO_RSA
  102. #endif
  103. /* AES */
  104. #undef NO_AES
  105. #if 1
  106. #undef HAVE_AES_DECRYPT
  107. #define HAVE_AES_DECRYPT
  108. #undef HAVE_AESGCM
  109. #define HAVE_AESGCM
  110. /* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
  111. #undef GCM_SMALL
  112. #define GCM_SMALL
  113. #undef HAVE_AESCCM
  114. #define HAVE_AESCCM
  115. #undef WOLFSSL_AES_COUNTER
  116. #define WOLFSSL_AES_COUNTER
  117. #undef WOLFSSL_AES_DIRECT
  118. #define WOLFSSL_AES_DIRECT
  119. #else
  120. #define NO_AES
  121. #endif
  122. /* DES3 */
  123. #undef NO_DES3
  124. #if 1
  125. #undef WOLFSSL_DES_ECB
  126. #define WOLFSSL_DES_ECB
  127. #else
  128. #define NO_DES3
  129. #endif
  130. /* ChaCha20 / Poly1305 */
  131. #undef HAVE_CHACHA
  132. #undef HAVE_POLY1305
  133. #if 0
  134. #define HAVE_CHACHA
  135. #define HAVE_POLY1305
  136. /* Needed for Poly1305 */
  137. #undef HAVE_ONE_TIME_AUTH
  138. #define HAVE_ONE_TIME_AUTH
  139. #endif
  140. /* Ed25519 / Curve25519 */
  141. #undef HAVE_CURVE25519
  142. #undef HAVE_ED25519
  143. #if 0
  144. #define HAVE_CURVE25519
  145. #define HAVE_ED25519
  146. /* Optionally use small math (less flash usage, but much slower) */
  147. #if 0
  148. #define CURVED25519_SMALL
  149. #endif
  150. #endif
  151. /* ------------------------------------------------------------------------- */
  152. /* Hashing */
  153. /* ------------------------------------------------------------------------- */
  154. /* Sha */
  155. #undef NO_SHA
  156. #if 1
  157. /* 1k smaller, but 25% slower */
  158. //#define USE_SLOW_SHA
  159. #else
  160. #define NO_SHA
  161. #endif
  162. /* Sha256 */
  163. #undef NO_SHA256
  164. #if 1
  165. #else
  166. #define NO_SHA256
  167. #endif
  168. /* Sha512 */
  169. #undef WOLFSSL_SHA512
  170. #if 1
  171. #define WOLFSSL_SHA512
  172. /* Sha384 */
  173. #undef WOLFSSL_SHA384
  174. #if 1
  175. #define WOLFSSL_SHA384
  176. #endif
  177. /* over twice as small, but 50% slower */
  178. //#define USE_SLOW_SHA2
  179. #endif
  180. /* MD5 */
  181. #undef NO_MD5
  182. #if 1
  183. #else
  184. #define NO_MD5
  185. #endif
  186. /* ------------------------------------------------------------------------- */
  187. /* Benchmark / Test */
  188. /* ------------------------------------------------------------------------- */
  189. /* Use reduced benchmark / test sizes */
  190. #undef BENCH_EMBEDDED
  191. #define BENCH_EMBEDDED
  192. #undef USE_CERT_BUFFERS_2048
  193. #define USE_CERT_BUFFERS_2048
  194. #undef USE_CERT_BUFFERS_1024
  195. //#define USE_CERT_BUFFERS_1024
  196. #undef USE_CERT_BUFFERS_256
  197. #define USE_CERT_BUFFERS_256
  198. /* ------------------------------------------------------------------------- */
  199. /* Time */
  200. /* ------------------------------------------------------------------------- */
  201. #if 0
  202. /* Override Current Time */
  203. /* Allows custom "custom_time()" function to be used for benchmark */
  204. #define WOLFSSL_USER_CURRTIME
  205. #define USER_TICKS
  206. extern unsigned long custom_time(unsigned long* timer);
  207. #define XTIME custom_time
  208. #else
  209. #warning Time/RTC disabled
  210. #undef NO_ASN_TIME
  211. #define NO_ASN_TIME
  212. #endif
  213. /* ------------------------------------------------------------------------- */
  214. /* Debugging */
  215. /* ------------------------------------------------------------------------- */
  216. #undef DEBUG_WOLFSSL
  217. #define DEBUG_WOLFSSL
  218. #ifdef DEBUG_WOLFSSL
  219. /* Use this to measure / print heap usage */
  220. #if 0
  221. #undef USE_WOLFSSL_MEMORY
  222. #define USE_WOLFSSL_MEMORY
  223. #undef WOLFSSL_TRACK_MEMORY
  224. #define WOLFSSL_TRACK_MEMORY
  225. #endif
  226. #else
  227. #undef NO_WOLFSSL_MEMORY
  228. #define NO_WOLFSSL_MEMORY
  229. #undef NO_ERROR_STRINGS
  230. //#define NO_ERROR_STRINGS
  231. #endif
  232. /* ------------------------------------------------------------------------- */
  233. /* Enable Features */
  234. /* ------------------------------------------------------------------------- */
  235. #undef KEEP_PEER_CERT
  236. //#define KEEP_PEER_CERT
  237. #undef HAVE_COMP_KEY
  238. //#define HAVE_COMP_KEY
  239. #undef HAVE_TLS_EXTENSIONS
  240. //#define HAVE_TLS_EXTENSIONS
  241. #undef HAVE_SUPPORTED_CURVES
  242. //#define HAVE_SUPPORTED_CURVES
  243. #undef WOLFSSL_BASE64_ENCODE
  244. //#define WOLFSSL_BASE64_ENCODE
  245. /* TLS Session Cache */
  246. #if 0
  247. #define SMALL_SESSION_CACHE
  248. #else
  249. #define NO_SESSION_CACHE
  250. #endif
  251. /* ------------------------------------------------------------------------- */
  252. /* Disable Features */
  253. /* ------------------------------------------------------------------------- */
  254. #undef NO_WOLFSSL_SERVER
  255. //#define NO_WOLFSSL_SERVER
  256. #undef NO_WOLFSSL_CLIENT
  257. //#define NO_WOLFSSL_CLIENT
  258. #undef NO_CRYPT_TEST
  259. //#define NO_CRYPT_TEST
  260. #undef NO_CRYPT_BENCHMARK
  261. //#define NO_CRYPT_BENCHMARK
  262. /* In-lining of misc.c functions */
  263. /* If defined, must include wolfcrypt/src/misc.c in build */
  264. /* Slower, but about 1k smaller */
  265. #undef NO_INLINE
  266. //#define NO_INLINE
  267. #undef NO_FILESYSTEM
  268. #define NO_FILESYSTEM
  269. #undef NO_WRITEV
  270. #define NO_WRITEV
  271. #undef NO_MAIN_DRIVER
  272. #define NO_MAIN_DRIVER
  273. #undef NO_DEV_RANDOM
  274. #define NO_DEV_RANDOM
  275. #undef NO_DSA
  276. #define NO_DSA
  277. #undef NO_DH
  278. #define NO_DH
  279. #undef NO_RC4
  280. #define NO_RC4
  281. #undef NO_OLD_TLS
  282. #define NO_OLD_TLS
  283. #undef NO_HC128
  284. #define NO_HC128
  285. #undef NO_RABBIT
  286. #define NO_RABBIT
  287. #undef NO_PSK
  288. #define NO_PSK
  289. #undef NO_MD4
  290. #define NO_MD4
  291. #undef NO_PWDBASED
  292. #define NO_PWDBASED
  293. #undef NO_CODING
  294. //#define NO_CODING
  295. /* Suppress array-bounds */
  296. #pragma GCC diagnostic ignored "-Warray-bounds"
  297. #ifdef __cplusplus
  298. }
  299. #endif
  300. #endif /* WOLFSSL_USER_SETTINGS_H */