2
0

user_settings.h 8.7 KB

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