user_settings.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. /* user_settings.h
  2. *
  3. * Copyright (C) 2006-2017 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #define NO_MAIN_DRIVER
  22. #define BENCH_EMBEDDED
  23. #define NO_DEV_RANDOM
  24. #define WOLFSSL_USER_CURRTIME
  25. #define SIZEOF_LONG_LONG 8
  26. #define NO_WRITEV
  27. #define NO_DEV_RANDOM
  28. #define TFM_TIMING_RESISTANT
  29. #define ECC_TIMING_RESISTANT
  30. #define WC_RSA_BLINDING
  31. #define WOLFSSL_USER_CURRTIME /* for benchmark */
  32. #define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
  33. #define WOLFSSL_GMTIME
  34. // <<< Use Configuration Wizard in Context Menu >>>
  35. // <h>Common options
  36. // <o> MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
  37. #define MDK_CONF_MPU 3
  38. #if MDK_CONF_MPU == 0
  39. #elif MDK_CONF_MPU == 1
  40. #define WOLFSSL_STM32_CUBEMX
  41. #define STM32F2xx
  42. #elif MDK_CONF_MPU == 2
  43. #define WOLFSSL_STM32_CUBEMX
  44. #define STM32F4xx
  45. #elif MDK_CONF_MPU == 3
  46. #define WOLFSSL_STM32_CUBEMX
  47. #define STM32F7xx
  48. #endif
  49. // <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows
  50. // <4=>PThread <5=>ThreadX<6=> ThreadX/NetX
  51. // <7=>Micrium <8=>EBSnet<9=>MQX
  52. // <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2
  53. // <13=>Frosted <14=>CMSIS RTOS<15=>Others
  54. #define MDK_CONF_THREAD 14
  55. #if MDK_CONF_THREAD== 0
  56. #define SINGLE_THREADED
  57. #elif MDK_CONF_THREAD == 1
  58. #define FREERTOS
  59. #elif MDK_CONF_THREAD == 3
  60. #define WOLFSSL_SAFERTOS
  61. #elif MDK_CONF_THREAD == 4
  62. #define USE_WINDOWS_API
  63. #elif MDK_CONF_THREAD == 5
  64. #define WOLFSSL_PTHREADS
  65. #elif MDK_CONF_THREAD == 6
  66. #define THREADX
  67. #define NETX
  68. #elif MDK_CONF_THREAD == 7
  69. #define MICRIUM
  70. #elif MDK_CONF_THREAD == 8
  71. #define EBSNET
  72. #elif MDK_CONF_THREAD == 9
  73. #define FREESCALE_MQX
  74. #define FREESCALE_KSDK_MQX
  75. #elif MDK_CONF_THREAD == 10
  76. #define WOLFSSL_TIRTOS
  77. #elif MDK_CONF_THREAD == 11
  78. #define WOLFSSL_uITRON4
  79. #elif MDK_CONF_THREAD == 12
  80. #define WOLFSSL_uTKERNEL2
  81. #elif MDK_CONF_THREAD == 13
  82. #define WOLFSSL_FROSTED
  83. #elif MDK_CONF_THREAD == 14
  84. #define WOLFSSL_CMSIS_RTOS
  85. #elif MDK_CONF_THREAD == 15
  86. #define SINGLE_THREADED
  87. #endif
  88. // <e>File System
  89. #define MDK_CONF_FILESYSTEM 1
  90. #if MDK_CONF_FILESYSTEM == 0
  91. #define NO_FILESYSTEM
  92. #else
  93. #define WOLFSSL_KEIL_FS
  94. #define NO_WOLFSSL_DIR
  95. #endif
  96. // </e>
  97. // <o> Network<0=>None <1=>RLnet <2=>User I/O
  98. #define MDK_CONF_NETWORK 1
  99. #if MDK_CONF_NETWORK == 0
  100. #elif MDK_CONF_NETWORK == 1
  101. #define WOLFSSL_KEIL_TCP_NET
  102. #elif MDK_CONF_NETWORK == 2
  103. #define WOLFSSL_USER_IO
  104. #endif
  105. // <h>Debug options
  106. // <e>Debug Message
  107. #define MDK_CONF_DebugMessage 0
  108. #if MDK_CONF_DebugMessage == 1
  109. #define DEBUG_WOLFSSL
  110. #endif
  111. // </e>
  112. // <e>Check malloc
  113. #define MDK_CONF_CheckMalloc 1
  114. #if MDK_CONF_CheckMalloc == 1
  115. #define WOLFSSL_MALLOC_CHECK
  116. #define USE_WOLFSSL_MEMORY
  117. #endif
  118. // </e>
  119. // <e>ErrNo.h
  120. #define MDK_CONF_ErrNo 1
  121. #if MDK_CONF_ErrNo == 1
  122. #define HAVE_ERRNO
  123. #endif
  124. // </e>
  125. // <e>Error Strings
  126. #define MDK_CONF_ErrorStrings 1
  127. #if MDK_CONF_ErrorStrings == 0
  128. #define NO_ERROR_STRINGS
  129. #endif
  130. // </e>
  131. //</h>
  132. //</h>
  133. // <h> wolfCrypt Configuration
  134. // <h>Hash/Crypt Algrithm
  135. // <e>MD2
  136. #define MDK_CONF_MD2 1
  137. #if MDK_CONF_MD2 == 1
  138. #define WOLFSSL_MD2
  139. #endif
  140. // </e>
  141. // <e>MD4
  142. #define MDK_CONF_MD4 1
  143. #if MDK_CONF_MD4 == 0
  144. #define NO_MD4
  145. #endif
  146. // </e>
  147. // <e>MD5
  148. #define MDK_CONF_MD5 1
  149. #if MDK_CONF_MD5 == 0
  150. #define NO_MD5
  151. #endif
  152. // </e>
  153. // <e>SHA
  154. #define MDK_CONF_SHA 1
  155. #if MDK_CONF_SHA == 0
  156. #define NO_SHA
  157. #endif
  158. // </e>
  159. // <e>SHA-256
  160. #define MDK_CONF_SHA256 1
  161. #if MDK_CONF_SHA256 == 0
  162. #define NO_SHA256
  163. #endif
  164. // </e>
  165. // <e>SHA-384
  166. #define MDK_CONF_SHA384 1
  167. #if MDK_CONF_SHA384 == 1
  168. #define WOLFSSL_SHA384
  169. #endif
  170. // </e>
  171. // <e>SHA-512
  172. #define MDK_CONF_SHA512 1
  173. #if MDK_CONF_SHA512 == 1
  174. #define WOLFSSL_SHA512
  175. #endif
  176. // </e>
  177. // <e>Hash DRBG
  178. #define MDK_CONF_HASHDRBG 1
  179. #if MDK_CONF_HASHDRBG == 1
  180. #define HAVE_HASHDRBG
  181. #endif
  182. // </e>
  183. // <e>RIPEMD
  184. #define MDK_CONF_RIPEMD 1
  185. #if MDK_CONF_RIPEMD == 1
  186. #define WOLFSSL_RIPEMD
  187. #endif
  188. // </e>
  189. // <e>BLAKE2
  190. #define MDK_CONF_BLAKE2 0
  191. #if MDK_CONF_BLAKE2 == 1
  192. #define HAVE_BLAKE2
  193. #endif
  194. // </e>
  195. // <e>HMAC
  196. #define MDK_CONF_HMAC 1
  197. #if MDK_CONF_HMAC == 0
  198. #define NO_HMAC
  199. #endif
  200. // </e>
  201. // <e>HMAC KDF
  202. #define MDK_CONF_HKDF 1
  203. #if MDK_CONF_HKDF == 1
  204. #define HAVE_HKDF
  205. #endif
  206. // </e>
  207. // <e>AES CCM
  208. #define MDK_CONF_AESCCM 1
  209. #if MDK_CONF_AESCCM == 1
  210. #define HAVE_AESCCM
  211. #endif
  212. // </e>
  213. // <e>AES GCM
  214. #define MDK_CONF_AESGCM 1
  215. #if MDK_CONF_AESGCM == 1
  216. #define HAVE_AESGCM
  217. #endif
  218. // </e>
  219. // <e>RC4
  220. #define MDK_CONF_RC4 1
  221. #if MDK_CONF_RC4 == 0
  222. #define NO_RC4
  223. #endif
  224. // </e>
  225. // <e>HC128
  226. #define MDK_CONF_HC128 1
  227. #if MDK_CONF_AESGCM == 0
  228. #define NO_HC128
  229. #endif
  230. // </e>
  231. // <e>RABBIT
  232. #define MDK_CONF_RABBIT 1
  233. #if MDK_CONF_RABBIT == 0
  234. #define NO_RABBIT
  235. #endif
  236. // </e>
  237. // <e>CHACHA
  238. #define MDK_CONF_CHACHA 1
  239. #if MDK_CONF_CHACHA == 1
  240. #define HAVE_CHACHA
  241. #endif
  242. // </e>
  243. // <e>POLY1305
  244. #define MDK_CONF_POLY1305 1
  245. #if MDK_CONF_POLY1305 == 1
  246. #define HAVE_POLY1305
  247. #define HAVE_ONE_TIME_AUTH
  248. #endif
  249. // </e>
  250. // <e>DES3
  251. #define MDK_CONF_DES3 1
  252. #if MDK_CONF_DES3 == 0
  253. #define NO_DES3
  254. #endif
  255. // </e>
  256. // <e>AES
  257. #define MDK_CONF_AES 1
  258. #if MDK_CONF_AES == 0
  259. #define NO_AES
  260. #endif
  261. // </e>
  262. // <e>CAMELLIA
  263. #define MDK_CONF_CAMELLIA 1
  264. #if MDK_CONF_CAMELLIA == 1
  265. #define HAVE_CAMELLIA
  266. #endif
  267. // </e>
  268. // <e>DH
  269. #define MDK_CONF_DH 1
  270. #if MDK_CONF_DH == 0
  271. #define NO_DH
  272. #endif
  273. // </e>
  274. // <e>DSA
  275. #define MDK_CONF_DSA 1
  276. #if MDK_CONF_DSA == 0
  277. #define NO_DSA
  278. #endif
  279. // </e>
  280. // <e>SRP
  281. #define MDK_CONF_SRP 1
  282. #if MDK_CONF_SRP == 1
  283. #define HAVE_SRP
  284. #endif
  285. // </e>
  286. // <e>PWDBASED
  287. #define MDK_CONF_PWDBASED 1
  288. #if MDK_CONF_PWDBASED == 0
  289. #define NO_PWDBASED
  290. #endif
  291. // </e>
  292. // <e>ECC
  293. #define MDK_CONF_ECC 1
  294. #if MDK_CONF_ECC == 1
  295. #define HAVE_ECC
  296. #endif
  297. // </e>
  298. // <e>CURVE25519
  299. #define MDK_CONF_CURVE25519 1
  300. #if MDK_CONF_CURVE25519 == 1
  301. #define HAVE_CURVE25519
  302. #define CURVED25519_SMALL
  303. #endif
  304. // </e>
  305. // <e>CURVE25519 SMALL
  306. #define MDK_CONF_CURVE25519_SMALL 0
  307. #if MDK_CONF_CURVE25519_SMALL == 1
  308. #define CURVED25519_SMALL
  309. #endif
  310. // </e>
  311. // <e>ED25519
  312. #define MDK_CONF_ED25519 1
  313. #if MDK_CONF_ED25519 == 1
  314. #define HAVE_ED25519
  315. #endif
  316. // </e>
  317. // <e>ED25519 SMALL
  318. #define MDK_CONF_ED25519_SMALL 0
  319. #if MDK_CONF_ED25519_SMALL == 1
  320. #define ED25519_SMALL
  321. #endif
  322. // </e>
  323. // <e>PKCS7
  324. #define MDK_CONF_PKCS7 0
  325. #if MDK_CONF_PKCS7 == 1
  326. #define HAVE_PKCS7
  327. #endif
  328. // </e>
  329. // <e>NTRU (need License, "crypto_ntru.h")
  330. #define MDK_CONF_NTRU 0
  331. #if MDK_CONF_NTRU == 1
  332. #define HAVE_NTRU
  333. #endif
  334. // </e>
  335. // </h>
  336. // <e>Random Seed, for TEST Only
  337. #define MDK_CONF_RNDSEED 1
  338. #if MDK_CONF_RNDSEED == 1
  339. #define WOLFSSL_GENSEED_FORTEST
  340. #endif
  341. // </e>
  342. // <h>Hardware Crypt (See document for usage)
  343. // <e>Hardware RNG
  344. #define MDK_CONF_STM32F2_RNG 1
  345. #if MDK_CONF_STM32F2_RNG == 1
  346. #define WOLFSSL_STM32_CUBEMX
  347. #define STM32_RNG
  348. #define WC_ASYNC_DEV_SIZE 320+24
  349. #define STM32_HAL_TIMEOUT 0xFF
  350. #if defined(STM32F2xx)
  351. #define WOLFSSL_STM32F2
  352. #elif defined(STM32F4xx)
  353. #define WOLFSSL_STM32F4
  354. #elif defined(STM32F7xx)
  355. #define WOLFSSL_STM32F7
  356. #endif
  357. #endif
  358. // </e>
  359. // <e>Hardware Crypt
  360. #define MDK_CONF_STM32F2_CRYPTO 1
  361. #if MDK_CONF_STM32F2_CRYPTO == 1
  362. #define WOLFSSL_STM32_CUBEMX
  363. #define STM32_CRYPTO
  364. #define WC_ASYNC_DEV_SIZE 320+24
  365. #define STM32_HAL_TIMEOUT 0xFF
  366. #if defined(STM32F2xx)
  367. #define WOLFSSL_STM32F2
  368. #elif defined(STM32F4xx)
  369. #define WOLFSSL_STM32F4
  370. #elif defined(STM32F7xx)
  371. #define WOLFSSL_STM32F7
  372. #endif
  373. #endif
  374. // </e>
  375. // <e>Hardware Hash
  376. #define MDK_CONF_STM32F2_HASH 1
  377. #if MDK_CONF_STM32F2_HASH == 1
  378. #define WOLFSSL_STM32_CUBEMX
  379. #define STM32_HASH
  380. #define WC_ASYNC_DEV_SIZE 320+24
  381. #define STM32_HAL_TIMEOUT 0xFF
  382. #if defined(STM32F2xx)
  383. #define WOLFSSL_STM32F2
  384. #elif defined(STM32F4xx)
  385. #define WOLFSSL_STM32F4
  386. #elif defined(STM32F7xx)
  387. #define WOLFSSL_STM32F7
  388. #endif
  389. #endif
  390. // </e>
  391. // </h>
  392. // <h>Cert/Key Strage
  393. // <o>Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
  394. #define MDK_CONF_CERT_BUFF 0
  395. #if MDK_CONF_CERT_BUFF== 1
  396. #define USE_CERT_BUFFERS_1024
  397. #elif MDK_CONF_CERT_BUFF == 2
  398. #define USE_CERT_BUFFERS_2048
  399. #endif
  400. //</h>
  401. // <h>Cert/Key Generation
  402. // <e>CertGen
  403. #define MDK_CONF_CERT_GEN 0
  404. #if MDK_CONF_CERT_GEN == 1
  405. #define WOLFSSL_CERT_GEN
  406. #endif
  407. // </e>
  408. // <e>KeyGen
  409. #define MDK_CONF_KEY_GEN 0
  410. #if MDK_CONF_KEY_GEN == 1
  411. #define WOLFSSL_KEY_GEN
  412. #endif
  413. // </e>
  414. // </h>
  415. // <e>Use Fast Math
  416. #define MDK_CONF_FASTMATH 1
  417. #if MDK_CONF_FASTMATH == 1
  418. #define USE_FAST_MATH
  419. #define TFM_TIMING_RESISTANT
  420. #endif
  421. // </e>
  422. // <e>Small Stack
  423. #define MDK_CONF_SmallStack 0
  424. #if MDK_CONF_SmallStack == 0
  425. #define NO_WOLFSSL_SMALL_STACK
  426. #endif
  427. // </e>
  428. // </h>
  429. /**** wolfSSL Configuration ****/
  430. // <h> wolfSSL Configuration
  431. // <e>TLS 1.3
  432. #define MDK_CONF_TLS 0
  433. #if MDK_CONF_TLS == 1
  434. #define WOLFSSL_TLS13
  435. #define HAVE_TLS_EXTENSIONS
  436. #define WC_RSA_PSS
  437. #define HAVE_HKDF
  438. #define HAVE_FFDHE_2048
  439. #endif
  440. // </e>
  441. // <e>Include Old TLS
  442. #define MDK_CONF_NO_OLDTLS 0
  443. #if MDK_CONF_NO_OLDTLS == 0
  444. #define NO_OLD_TLS
  445. #endif
  446. // </e>
  447. // <e>CRL
  448. #define MDK_CONF_CRL 0
  449. #if MDK_CONF_CRL == 1
  450. #define HAVE_CRL
  451. #define WOLFSSL_DER_LOAD
  452. #endif
  453. // </e>
  454. // <e>OCSP
  455. #define MDK_CONF_OCSP 0
  456. #if MDK_CONF_OCSP == 1
  457. #define HAVE_OCSP
  458. #endif
  459. // </e>
  460. // <e>OpenSSL Extra
  461. #define MDK_CONF_OPENSSL_EXTRA 0
  462. #if MDK_CONF_OPENSSL_EXTRA == 1
  463. #define OPENSSL_EXTRA
  464. #endif
  465. // </e>
  466. //</h>