user_settings.h 7.9 KB

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