1
0

user_settings.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /* user_settings.h
  2. *
  3. * Copyright (C) 2006-2024 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 SIZEOF_LONG_LONG 8
  24. #define NO_WRITEV
  25. #define NO_DEV_RANDOM
  26. #define WOLFSSL_IGNORE_FILE_WARN
  27. #define TFM_TIMING_RESISTANT
  28. #define ECC_TIMING_RESISTANT
  29. #define WC_RSA_BLINDING
  30. #define WOLFSSL_USER_CURRTIME /* for benchmark */
  31. #define WOLFSSL_CURRTIME_OSTICK /* use OS tick for current_time */
  32. #define WOLFSSL_GMTIME
  33. #define NO_MULTIBYTE_PRINT
  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 <3=>SafeRTOS <4=>Windows
  50. // <5=>PThread <6=>ThreadX
  51. // <7=>Micrium <8=>EBSnet <9=>MQX
  52. // <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
  53. // <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
  54. #define MDK_CONF_THREAD 15
  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 WOLFSSL_CMSIS_RTOSv2
  87. #elif MDK_CONF_THREAD == 16
  88. #define SINGLE_THREADED
  89. #endif
  90. // <e>File System
  91. #define MDK_CONF_FILESYSTEM 0
  92. #if MDK_CONF_FILESYSTEM == 0
  93. #define NO_FILESYSTEM
  94. #else
  95. #define WOLFSSL_KEIL_FS
  96. #define NO_WOLFSSL_DIR
  97. #endif
  98. // </e>
  99. // <o> Network<0=>None <1=>RLnet <2=>User I/O
  100. #ifndef MDK_CONF_NETWORK
  101. #define MDK_CONF_NETWORK 1
  102. #endif
  103. #if MDK_CONF_NETWORK == 0
  104. #elif MDK_CONF_NETWORK == 1
  105. #define WOLFSSL_KEIL_TCP_NET
  106. #elif MDK_CONF_NETWORK == 2
  107. #define WOLFSSL_USER_IO
  108. #endif
  109. // <h>Debug options
  110. // <e>Debug Message
  111. #define MDK_CONF_DebugMessage 0
  112. #if MDK_CONF_DebugMessage == 1
  113. #define DEBUG_WOLFSSL
  114. #endif
  115. // </e>
  116. // <e>Check malloc
  117. #define MDK_CONF_CheckMalloc 1
  118. #if MDK_CONF_CheckMalloc == 1
  119. #define WOLFSSL_MALLOC_CHECK
  120. #define USE_WOLFSSL_MEMORY
  121. #endif
  122. // </e>
  123. // <e>ErrNo.h
  124. #define MDK_CONF_ErrNo 1
  125. #if MDK_CONF_ErrNo == 1
  126. #define HAVE_ERRNO
  127. #endif
  128. // </e>
  129. // <e>Error Strings
  130. #define MDK_CONF_ErrorStrings 1
  131. #if MDK_CONF_ErrorStrings == 0
  132. #define NO_ERROR_STRINGS
  133. #endif
  134. // </e>
  135. //</h>
  136. //</h>
  137. // <h> wolfCrypt Configuration
  138. // <h>Hash/Crypt Algorithm
  139. // <e>MD2
  140. #define MDK_CONF_MD2 0
  141. #if MDK_CONF_MD2 == 1
  142. #define WOLFSSL_MD2
  143. #endif
  144. // </e>
  145. // <e>MD4
  146. #define MDK_CONF_MD4 0
  147. #if MDK_CONF_MD4 == 0
  148. #define NO_MD4
  149. #endif
  150. // </e>
  151. // <e>MD5
  152. #define MDK_CONF_MD5 1
  153. #if MDK_CONF_MD5 == 0
  154. #define NO_MD5
  155. #endif
  156. // </e>
  157. // <e>SHA
  158. #define MDK_CONF_SHA 1
  159. #if MDK_CONF_SHA == 0
  160. #define NO_SHA
  161. #endif
  162. // </e>
  163. // <e>SHA-256
  164. #define MDK_CONF_SHA256 1
  165. #if MDK_CONF_SHA256 == 0
  166. #define NO_SHA256
  167. #endif
  168. // </e>
  169. // <e>SHA-384
  170. #define MDK_CONF_SHA384 1
  171. #if MDK_CONF_SHA384 == 1
  172. #define WOLFSSL_SHA384
  173. #endif
  174. // </e>
  175. // <e>SHA-512
  176. #define MDK_CONF_SHA512 1
  177. #if MDK_CONF_SHA512 == 1
  178. #define WOLFSSL_SHA512
  179. #endif
  180. // </e>
  181. // <e>Hash DRBG
  182. #define MDK_CONF_HASHDRBG 1
  183. #if MDK_CONF_HASHDRBG == 1
  184. #define HAVE_HASHDRBG
  185. #endif
  186. // </e>
  187. // <e>RIPEMD
  188. #define MDK_CONF_RIPEMD 0
  189. #if MDK_CONF_RIPEMD == 1
  190. #define WOLFSSL_RIPEMD
  191. #endif
  192. // </e>
  193. // <e>BLAKE2
  194. #define MDK_CONF_BLAKE2 0
  195. #if MDK_CONF_BLAKE2 == 1
  196. #define HAVE_BLAKE2
  197. #endif
  198. // </e>
  199. // <e>HMAC
  200. #define MDK_CONF_HMAC 1
  201. #if MDK_CONF_HMAC == 0
  202. #define NO_HMAC
  203. #endif
  204. // </e>
  205. // <e>HMAC KDF
  206. #define MDK_CONF_HKDF 1
  207. #if MDK_CONF_HKDF == 1
  208. #define HAVE_HKDF
  209. #endif
  210. // </e>
  211. // <e>AES CCM
  212. #define MDK_CONF_AESCCM 1
  213. #if MDK_CONF_AESCCM == 1
  214. #define HAVE_AESCCM
  215. #endif
  216. // </e>
  217. // <e>AES GCM
  218. #define MDK_CONF_AESGCM 1
  219. #if MDK_CONF_AESGCM == 1
  220. #define HAVE_AESGCM
  221. #endif
  222. // </e>
  223. // <e>RC4
  224. #define MDK_CONF_RC4 0
  225. #if MDK_CONF_RC4 == 0
  226. #define NO_RC4
  227. #endif
  228. // </e>
  229. // <e>CHACHA
  230. #define MDK_CONF_CHACHA 1
  231. #if MDK_CONF_CHACHA == 1
  232. #define HAVE_CHACHA
  233. #endif
  234. // </e>
  235. // <e>POLY1305
  236. #define MDK_CONF_POLY1305 1
  237. #if MDK_CONF_POLY1305 == 1
  238. #define HAVE_POLY1305
  239. #define HAVE_ONE_TIME_AUTH
  240. #endif
  241. // </e>
  242. // <e>DES3
  243. #define MDK_CONF_DES3 1
  244. #if MDK_CONF_DES3 == 0
  245. #define NO_DES3
  246. #endif
  247. // </e>
  248. // <e>AES
  249. #define MDK_CONF_AES 1
  250. #if MDK_CONF_AES == 0
  251. #define NO_AES
  252. #endif
  253. // </e>
  254. // <e>CAMELLIA
  255. #define MDK_CONF_CAMELLIA 0
  256. #if MDK_CONF_CAMELLIA == 1
  257. #define HAVE_CAMELLIA
  258. #endif
  259. // </e>
  260. // <e>DH
  261. #define MDK_CONF_DH 1
  262. #if MDK_CONF_DH == 0
  263. #define NO_DH
  264. #endif
  265. // </e>
  266. // <e>RSA
  267. #define MDK_CONF_RSA 1
  268. #if MDK_CONF_RSA == 1
  269. /* #define RSA_LOW_MEM */
  270. #else
  271. #define NO_RSA
  272. #endif
  273. // </e>
  274. // <e>DSA
  275. #define MDK_CONF_DSA 0
  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 WOLFCRYPT_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. // </h>
  330. // <e>Random Seed, for TEST Only
  331. #define MDK_CONF_RNDSEED 1
  332. #if MDK_CONF_RNDSEED == 1
  333. #define WOLFSSL_GENSEED_FORTEST
  334. #endif
  335. // </e>
  336. // <h>Hardware Crypt (See document for usage)
  337. // <e>Hardware RNG
  338. #define MDK_CONF_STM32F2_RNG 0
  339. #if MDK_CONF_STM32F2_RNG == 1
  340. #define WOLFSSL_STM32_CUBEMX
  341. #define STM32_RNG
  342. #define WC_ASYNC_DEV_SIZE 320+24
  343. #define STM32_HAL_TIMEOUT 0xFF
  344. #if defined(STM32F2xx)
  345. #define WOLFSSL_STM32F2
  346. #elif defined(STM32F4xx)
  347. #define WOLFSSL_STM32F4
  348. #elif defined(STM32F7xx)
  349. #define WOLFSSL_STM32F7
  350. #endif
  351. #endif
  352. // </e>
  353. // <e>Hardware Crypt
  354. #define MDK_CONF_STM32F2_CRYPTO 0
  355. #if MDK_CONF_STM32F2_CRYPTO == 1
  356. #define WOLFSSL_STM32_CUBEMX
  357. #define STM32_CRYPTO
  358. #define WC_ASYNC_DEV_SIZE 320+24
  359. #define STM32_HAL_TIMEOUT 0xFF
  360. #if defined(STM32F2xx)
  361. #define WOLFSSL_STM32F2
  362. #elif defined(STM32F4xx)
  363. #define WOLFSSL_STM32F4
  364. #elif defined(STM32F7xx)
  365. #define WOLFSSL_STM32F7
  366. #endif
  367. #endif
  368. // </e>
  369. // <e>Hardware Hash
  370. #define MDK_CONF_STM32F2_HASH 0
  371. #if MDK_CONF_STM32F2_HASH == 1
  372. #define WOLFSSL_STM32_CUBEMX
  373. #define STM32_HASH
  374. #define WC_ASYNC_DEV_SIZE 320+24
  375. #define STM32_HAL_TIMEOUT 0xFF
  376. #if defined(STM32F2xx)
  377. #define WOLFSSL_STM32F2
  378. #elif defined(STM32F4xx)
  379. #define WOLFSSL_STM32F4
  380. #elif defined(STM32F7xx)
  381. #define WOLFSSL_STM32F7
  382. #endif
  383. #endif
  384. // </e>
  385. // </h>
  386. // <h>Cert/Key Storage
  387. // <o>Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
  388. #define MDK_CONF_CERT_BUFF 0
  389. #if MDK_CONF_CERT_BUFF== 1
  390. #define USE_CERT_BUFFERS_1024
  391. #elif MDK_CONF_CERT_BUFF == 2
  392. #define USE_CERT_BUFFERS_2048
  393. #endif
  394. //</h>
  395. // <h>Cert/Key Generation
  396. // <e>CertGen
  397. #define MDK_CONF_CERT_GEN 0
  398. #if MDK_CONF_CERT_GEN == 1
  399. #define WOLFSSL_CERT_GEN
  400. #endif
  401. // </e>
  402. // <e>KeyGen
  403. #define MDK_CONF_KEY_GEN 0
  404. #if MDK_CONF_KEY_GEN == 1
  405. #define WOLFSSL_KEY_GEN
  406. #define WOLFSSL_OLD_PRIME_CHECK /* use older prime check (faster) */
  407. #endif
  408. // </e>
  409. // </h>
  410. // <h>Math / Memory
  411. // <o> Math Library
  412. // <0=>SP Math All (sp_int.c)
  413. // <1=>Fast Math (tfm.c)
  414. // <2=>Heap Math (integer.c)
  415. // <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
  416. // <4=>SP Math +ASM (faster)
  417. #define MDK_CONF_MATH 0
  418. #if MDK_CONF_MATH == 0
  419. #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
  420. #elif MDK_CONF_MATH == 1
  421. #define USE_FAST_MATH
  422. #elif MDK_CONF_MATH == 2
  423. #define USE_INTEGER_HEAP_MATH
  424. #elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
  425. #define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
  426. #define WOLFSSL_HAVE_SP_RSA
  427. #define WOLFSSL_HAVE_SP_DH
  428. #define WOLFSSL_HAVE_SP_ECC
  429. //#define WOLFSSL_SP_NO_2048
  430. //#define WOLFSSL_SP_NO_3072
  431. #define WOLFSSL_SP_4096
  432. //#define WOLFSSL_SP_NO_256
  433. //#define WOLFSSL_SP_384
  434. //#define WOLFSSL_SP_521
  435. #define WOLFSSL_SP_SMALL /* use smaller version of code */
  436. //#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
  437. //#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
  438. #if MDK_CONF_MATH == 4
  439. /* SP Assembly Speedups - specific to chip type */
  440. #define WOLFSSL_SP_ASM
  441. //#define WOLFSSL_SP_ARM32_ASM
  442. //#define WOLFSSL_SP_ARM64_ASM
  443. //#define WOLFSSL_SP_ARM_THUMB_ASM
  444. //#define WOLFSSL_SP_ARM_CORTEX_M_ASM
  445. #endif
  446. #endif
  447. // <e>Small Stack
  448. #define MDK_CONF_SmallStack 1
  449. #if MDK_CONF_SmallStack == 0
  450. #define NO_WOLFSSL_SMALL_STACK
  451. #else
  452. #define WOLFSSL_SMALL_STACK
  453. #endif
  454. // </e>
  455. // </h>
  456. // </h>
  457. /**** wolfSSL Configuration ****/
  458. // <h> wolfSSL Configuration
  459. // <e>TLS 1.3
  460. #define MDK_CONF_TLS 1
  461. #if MDK_CONF_TLS == 1
  462. #define WOLFSSL_TLS13
  463. #define HAVE_TLS_EXTENSIONS
  464. #define HAVE_SUPPORTED_CURVES
  465. #define WC_RSA_PSS
  466. #define HAVE_HKDF
  467. #define HAVE_FFDHE_2048
  468. //#define HAVE_FFDHE_3072
  469. #endif
  470. // </e>
  471. // <e>Include Old TLS
  472. #define MDK_CONF_NO_OLDTLS 0
  473. #if MDK_CONF_NO_OLDTLS == 0
  474. #define NO_OLD_TLS
  475. #endif
  476. // </e>
  477. // <e>CRL
  478. #define MDK_CONF_CRL 0
  479. #if MDK_CONF_CRL == 1
  480. #define HAVE_CRL
  481. #define WOLFSSL_DER_LOAD
  482. #endif
  483. // </e>
  484. // <e>OCSP
  485. #define MDK_CONF_OCSP 0
  486. #if MDK_CONF_OCSP == 1
  487. #define HAVE_OCSP
  488. #endif
  489. // </e>
  490. // <e>OpenSSL Extra
  491. #define MDK_CONF_OPENSSL_EXTRA 0
  492. #if MDK_CONF_OPENSSL_EXTRA == 1
  493. #define OPENSSL_EXTRA
  494. #endif
  495. // </e>
  496. //</h>