user_settings.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. #ifndef _WIN_USER_SETTINGS_H_
  2. #define _WIN_USER_SETTINGS_H_
  3. /* For FIPS Ready, uncomment the following: */
  4. /* #define WOLFSSL_FIPS_READY */
  5. #ifdef WOLFSSL_FIPS_READY
  6. #undef HAVE_FIPS_VERSION
  7. #define HAVE_FIPS_VERSION 3
  8. #endif
  9. /* Verify this is Windows */
  10. #ifndef _WIN32
  11. #error This user_settings.h header is only designed for Windows
  12. #endif
  13. /* Configurations */
  14. #define WOLFCRYPT_ONLY
  15. #undef USE_FAST_MATH
  16. #if 1
  17. #define USE_FAST_MATH
  18. #undef TFM_TIMING_RESISTANT
  19. #define TFM_TIMING_RESISTANT
  20. /* Optimizations */
  21. //#define TFM_ARM
  22. #endif
  23. /* Wolf Single Precision Math */
  24. #undef WOLFSSL_SP
  25. #if 0
  26. #define WOLFSSL_SP
  27. //#define WOLFSSL_SP_SMALL /* use smaller version of code */
  28. #define WOLFSSL_HAVE_SP_RSA
  29. #define WOLFSSL_HAVE_SP_DH
  30. #define WOLFSSL_HAVE_SP_ECC
  31. //#define WOLFSSL_SP_CACHE_RESISTANT
  32. //#define WOLFSSL_SP_MATH /* only SP math - eliminates fast math code */
  33. /* SP Assembly Speedups */
  34. //#define WOLFSSL_SP_ASM /* required if using the ASM versions */
  35. //#define WOLFSSL_SP_ARM32_ASM
  36. //#define WOLFSSL_SP_ARM64_ASM
  37. //#define WOLFSSL_SP_ARM_THUMB_ASM
  38. //#define WOLFSSL_SP_ARM_CORTEX_M_ASM
  39. #endif
  40. /* ------------------------------------------------------------------------- */
  41. /* FIPS - Requires eval or license from wolfSSL */
  42. /* ------------------------------------------------------------------------- */
  43. #undef HAVE_FIPS
  44. #if 1
  45. #define HAVE_FIPS
  46. #undef HAVE_FIPS_VERSION
  47. #define HAVE_FIPS_VERSION 2
  48. #ifdef SINGLE_THREADED
  49. #undef NO_THREAD_LS
  50. #define NO_THREAD_LS
  51. #else
  52. #ifndef USE_WINDOWS_API
  53. #define USE_WINDOWS_API
  54. #endif
  55. #endif
  56. #undef NO_ATTRIBUTE_CONSTRUCTOR
  57. //#define NO_ATTRIBUTE_CONSTRUCTOR
  58. #endif
  59. /* FIPS */
  60. //#define OPENSSL_EXTRA
  61. //#define HAVE_THREAD_LS
  62. #define WOLFSSL_KEY_GEN
  63. #define HAVE_AESGCM
  64. #define HAVE_HASHDRBG
  65. #define WOLFSSL_SHA384
  66. #define WOLFSSL_SHA512
  67. #define NO_PSK
  68. #define NO_HC128
  69. #define NO_RC4
  70. #define NO_RABBIT
  71. //#define NO_DSA
  72. #define NO_MD4
  73. #if defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
  74. /* ------------------------------------------------------------------------- */
  75. /* Crypto */
  76. /* ------------------------------------------------------------------------- */
  77. #define USE_CERT_BUFFERS_2048
  78. #define USE_CERT_BUFFERS_256
  79. /* RSA */
  80. #undef NO_RSA
  81. #if 1
  82. #ifdef USE_FAST_MATH
  83. /* Maximum math bits (Max RSA key bits * 2) */
  84. #undef FP_MAX_BITS
  85. #define FP_MAX_BITS 8192
  86. #endif
  87. /* half as much memory but twice as slow */
  88. #undef RSA_LOW_MEM
  89. //#define RSA_LOW_MEM
  90. /* Enables blinding mode, to prevent timing attacks */
  91. #if 0
  92. #undef WC_RSA_BLINDING
  93. #define WC_RSA_BLINDING
  94. #else
  95. #undef WC_NO_HARDEN
  96. #define WC_NO_HARDEN
  97. #endif
  98. /* RSA PSS Support */
  99. #if 1
  100. #define WC_RSA_PSS
  101. #endif
  102. #if 1
  103. #define WC_RSA_NO_PADDING
  104. #endif
  105. #else
  106. #define NO_RSA
  107. #endif
  108. /* ECC */
  109. #undef HAVE_ECC
  110. #if 1
  111. #define HAVE_ECC
  112. /* Manually define enabled curves */
  113. #undef ECC_USER_CURVES
  114. //#define ECC_USER_CURVES
  115. #ifdef ECC_USER_CURVES
  116. /* Manual Curve Selection */
  117. //#define HAVE_ECC192
  118. //#define HAVE_ECC224
  119. #undef NO_ECC256
  120. //#define HAVE_ECC384
  121. //#define HAVE_ECC521
  122. #endif
  123. /* Fixed point cache (speeds repeated operations against same private key) */
  124. #undef FP_ECC
  125. //#define FP_ECC
  126. #ifdef FP_ECC
  127. /* Bits / Entries */
  128. #undef FP_ENTRIES
  129. #define FP_ENTRIES 2
  130. #undef FP_LUT
  131. #define FP_LUT 4
  132. #endif
  133. /* Optional ECC calculation method */
  134. /* Note: doubles heap usage, but slightly faster */
  135. #undef ECC_SHAMIR
  136. #define ECC_SHAMIR
  137. /* Reduces heap usage, but slower */
  138. #undef ECC_TIMING_RESISTANT
  139. #define ECC_TIMING_RESISTANT
  140. #ifdef HAVE_FIPS
  141. #undef HAVE_ECC_CDH
  142. #define HAVE_ECC_CDH /* Enable cofactor support */
  143. #undef NO_STRICT_ECDSA_LEN
  144. #define NO_STRICT_ECDSA_LEN /* Do not force fixed len w/ FIPS */
  145. #undef WOLFSSL_VALIDATE_ECC_IMPORT
  146. #define WOLFSSL_VALIDATE_ECC_IMPORT /* Validate import */
  147. #endif
  148. /* Compressed Key Support */
  149. #undef HAVE_COMP_KEY
  150. //#define HAVE_COMP_KEY
  151. /* Use alternate ECC size for ECC math */
  152. #ifdef USE_FAST_MATH
  153. /* MAX ECC BITS = ROUND8(MAX ECC) * 2 */
  154. #ifdef NO_RSA
  155. /* Custom fastmath size if not using RSA */
  156. #undef FP_MAX_BITS
  157. #define FP_MAX_BITS (256 * 2)
  158. #else
  159. #undef ALT_ECC_SIZE
  160. #define ALT_ECC_SIZE
  161. /* wolfSSL will compute the FP_MAX_BITS_ECC, but it can be overriden */
  162. //#undef FP_MAX_BITS_ECC
  163. //#define FP_MAX_BITS_ECC (256 * 2)
  164. #endif
  165. /* Speedups specific to curve */
  166. #ifndef NO_ECC256
  167. #undef TFM_ECC256
  168. #define TFM_ECC256
  169. #endif
  170. #endif
  171. #endif
  172. /* AES */
  173. #undef NO_AES
  174. #if 1
  175. #undef HAVE_AES_CBC
  176. #define HAVE_AES_CBC
  177. #undef HAVE_AESGCM
  178. #define HAVE_AESGCM
  179. /* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
  180. //#define GCM_SMALL
  181. //#define GCM_WORD32
  182. #define GCM_TABLE
  183. #undef WOLFSSL_AES_DIRECT
  184. #define WOLFSSL_AES_DIRECT
  185. #undef HAVE_AES_ECB
  186. #define HAVE_AES_ECB
  187. #undef WOLFSSL_AES_COUNTER
  188. #define WOLFSSL_AES_COUNTER
  189. #undef HAVE_AESCCM
  190. #define HAVE_AESCCM
  191. #else
  192. #define NO_AES
  193. #endif
  194. /* DES3 */
  195. #undef NO_DES3
  196. #if 1
  197. #else
  198. #define NO_DES3
  199. #endif
  200. /* ------------------------------------------------------------------------- */
  201. /* Hashing */
  202. /* ------------------------------------------------------------------------- */
  203. /* Sha */
  204. #undef NO_SHA
  205. #if 1
  206. /* 1k smaller, but 25% slower */
  207. //#define USE_SLOW_SHA
  208. #else
  209. #define NO_SHA
  210. #endif
  211. /* Sha256 */
  212. #undef NO_SHA256
  213. #if 1
  214. /* not unrolled - ~2k smaller and ~25% slower */
  215. //#define USE_SLOW_SHA256
  216. /* Sha224 */
  217. #if 1
  218. #define WOLFSSL_SHA224
  219. #endif
  220. #else
  221. #define NO_SHA256
  222. #endif
  223. /* Sha512 */
  224. #undef WOLFSSL_SHA512
  225. #if 1
  226. #define WOLFSSL_SHA512
  227. /* Sha384 */
  228. #undef WOLFSSL_SHA384
  229. #if 1
  230. #define WOLFSSL_SHA384
  231. #endif
  232. /* over twice as small, but 50% slower */
  233. //#define USE_SLOW_SHA512
  234. #endif
  235. /* Sha3 */
  236. #undef WOLFSSL_SHA3
  237. #if 1
  238. #define WOLFSSL_SHA3
  239. #endif
  240. /* MD5 */
  241. #undef NO_MD5
  242. #if 0
  243. #else
  244. #define NO_MD5
  245. #endif
  246. /* HKDF */
  247. #undef HAVE_HKDF
  248. #if 1
  249. #define HAVE_HKDF
  250. #endif
  251. /* CMAC */
  252. #undef WOLFSSL_CMAC
  253. #if 1
  254. #define WOLFSSL_CMAC
  255. #endif
  256. /* DH */
  257. #undef NO_DH
  258. #if 1
  259. /* Use table for DH instead of -lm (math) lib dependency */
  260. #if 0
  261. #define WOLFSSL_DH_CONST
  262. #define HAVE_FFDHE_2048
  263. #define HAVE_FFDHE_4096
  264. //#define HAVE_FFDHE_6144
  265. //#define HAVE_FFDHE_8192
  266. #endif
  267. #ifdef HAVE_FIPS
  268. #define WOLFSSL_VALIDATE_FFC_IMPORT
  269. #define HAVE_FFDHE_Q
  270. #endif
  271. #else
  272. #define NO_DH
  273. #endif
  274. #endif /* FIPS v2 */
  275. //#define DEBUG_WOLFSSL
  276. #define NO_MAIN_DRIVER
  277. /* wolfEngine settings */
  278. #define WOLFSSL_PUBLIC_MP
  279. #define NO_WOLFSSL_DIR
  280. //#define WOLFENGINE_DEBUG
  281. /* TODO: Add WE_HAVE_* settings here */
  282. #endif /* _WIN_USER_SETTINGS_H_ */