user_settings.h 6.9 KB

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