2
0

user_settings.h 9.7 KB

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