2
0

user_settings_stm32.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /* wolfSSL_conf.h (example of generated wolfSSL.I-CUBE-wolfSSL_conf.h using
  2. * default_conf.ftl and STM32CubeIDE or STM32CubeMX tool)
  3. *
  4. * Copyright (C) 2006-2024 wolfSSL Inc.
  5. *
  6. * This file is part of wolfSSL.
  7. *
  8. * wolfSSL is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * wolfSSL is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  21. */
  22. /* STM32 Cube Sample Configuration File
  23. * Generated automatically using `default_conf.ftl` template
  24. *
  25. * Included automatically when USE_HAL_DRIVER is defined
  26. * (and not WOLFSSL_USER_SETTINGS or HAVE_CONFIG_H).
  27. */
  28. #ifndef __WOLFSSL_I_CUBE_WOLFSSL_CONF_H__
  29. #define __WOLFSSL_I_CUBE_WOLFSSL_CONF_H__
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /*---------- WOLF_CONF_DEBUG -----------*/
  34. #define WOLF_CONF_DEBUG 0
  35. /*---------- WOLF_CONF_WOLFCRYPT_ONLY -----------*/
  36. #define WOLF_CONF_WOLFCRYPT_ONLY 0
  37. /*---------- WOLF_CONF_TLS13 -----------*/
  38. #define WOLF_CONF_TLS13 1
  39. /*---------- WOLF_CONF_TLS12 -----------*/
  40. #define WOLF_CONF_TLS12 1
  41. /*---------- WOLF_CONF_DTLS -----------*/
  42. #define WOLF_CONF_DTLS 0
  43. /*---------- WOLF_CONF_MATH -----------*/
  44. #define WOLF_CONF_MATH 4
  45. /*---------- WOLF_CONF_RTOS -----------*/
  46. #define WOLF_CONF_RTOS 2
  47. /*---------- WOLF_CONF_RNG -----------*/
  48. #define WOLF_CONF_RNG 1
  49. /*---------- WOLF_CONF_RSA -----------*/
  50. #define WOLF_CONF_RSA 1
  51. /*---------- WOLF_CONF_ECC -----------*/
  52. #define WOLF_CONF_ECC 1
  53. /*---------- WOLF_CONF_DH -----------*/
  54. #define WOLF_CONF_DH 1
  55. /*---------- WOLF_CONF_AESGCM -----------*/
  56. #define WOLF_CONF_AESGCM 1
  57. /*---------- WOLF_CONF_AESCBC -----------*/
  58. #define WOLF_CONF_AESCBC 0
  59. /*---------- WOLF_CONF_CHAPOLY -----------*/
  60. #define WOLF_CONF_CHAPOLY 1
  61. /*---------- WOLF_CONF_EDCURVE25519 -----------*/
  62. #define WOLF_CONF_EDCURVE25519 0
  63. /*---------- WOLF_CONF_MD5 -----------*/
  64. #define WOLF_CONF_MD5 0
  65. /*---------- WOLF_CONF_SHA1 -----------*/
  66. #define WOLF_CONF_SHA1 0
  67. /*---------- WOLF_CONF_SHA2_224 -----------*/
  68. #define WOLF_CONF_SHA2_224 0
  69. /*---------- WOLF_CONF_SHA2_256 -----------*/
  70. #define WOLF_CONF_SHA2_256 1
  71. /*---------- WOLF_CONF_SHA2_384 -----------*/
  72. #define WOLF_CONF_SHA2_384 0
  73. /*---------- WOLF_CONF_SHA2_512 -----------*/
  74. #define WOLF_CONF_SHA2_512 0
  75. /*---------- WOLF_CONF_SHA3 -----------*/
  76. #define WOLF_CONF_SHA3 0
  77. /*---------- WOLF_CONF_PSK -----------*/
  78. #define WOLF_CONF_PSK 0
  79. /*---------- WOLF_CONF_PWDBASED -----------*/
  80. #define WOLF_CONF_PWDBASED 0
  81. /*---------- WOLF_CONF_KEEP_PEER_CERT -----------*/
  82. #define WOLF_CONF_KEEP_PEER_CERT 0
  83. /*---------- WOLF_CONF_BASE64_ENCODE -----------*/
  84. #define WOLF_CONF_BASE64_ENCODE 0
  85. /*---------- WOLF_CONF_OPENSSL_EXTRA -----------*/
  86. #define WOLF_CONF_OPENSSL_EXTRA 0
  87. /*---------- WOLF_CONF_TEST -----------*/
  88. #define WOLF_CONF_TEST 1
  89. /*---------- WOLF_CONF_KYBER -----------*/
  90. #define WOLF_CONF_kYBER 0
  91. /* ------------------------------------------------------------------------- */
  92. /* Hardware platform */
  93. /* ------------------------------------------------------------------------- */
  94. /* Setup default (No crypto hardware acceleration or TLS UART test).
  95. * Use undef in platform section to enable it.
  96. */
  97. #define NO_STM32_HASH
  98. #define NO_STM32_CRYPTO
  99. #define NO_TLS_UART_TEST
  100. #if defined(STM32WB55xx)
  101. #define WOLFSSL_STM32WB
  102. #define WOLFSSL_STM32_PKA
  103. #undef NO_STM32_CRYPTO
  104. #define HAL_CONSOLE_UART huart1
  105. #elif defined(STM32WL55xx)
  106. #define WOLFSSL_STM32WL
  107. #define WOLFSSL_STM32_PKA
  108. #undef NO_STM32_CRYPTO
  109. #define HAL_CONSOLE_UART huart2
  110. #elif defined(STM32F407xx)
  111. #define WOLFSSL_STM32F4
  112. #define HAL_CONSOLE_UART huart2
  113. #elif defined(STM32F437xx)
  114. #define WOLFSSL_STM32F4
  115. #undef NO_STM32_HASH
  116. #undef NO_STM32_CRYPTO
  117. #define STM32_HAL_V2
  118. #define HAL_CONSOLE_UART huart4
  119. #elif defined(STM32F777xx)
  120. #define WOLFSSL_STM32F7
  121. #undef NO_STM32_HASH
  122. #undef NO_STM32_CRYPTO
  123. #define STM32_HAL_V2
  124. #define HAL_CONSOLE_UART huart2
  125. #elif defined(STM32F756xx)
  126. #define WOLFSSL_STM32F7
  127. #undef NO_STM32_HASH
  128. #undef NO_STM32_CRYPTO
  129. #define STM32_HAL_V2
  130. #define HAL_CONSOLE_UART huart3
  131. #elif defined(STM32H753xx)
  132. #define WOLFSSL_STM32H7
  133. #undef NO_STM32_HASH
  134. #undef NO_STM32_CRYPTO
  135. #define HAL_CONSOLE_UART huart3
  136. #elif defined(STM32H723xx)
  137. #define WOLFSSL_STM32H7
  138. #define HAL_CONSOLE_UART huart3
  139. #elif defined(STM32L4A6xx)
  140. #define WOLFSSL_STM32L4
  141. #undef NO_STM32_HASH
  142. #undef NO_STM32_CRYPTO
  143. #define HAL_CONSOLE_UART hlpuart1
  144. #elif defined(STM32L475xx)
  145. #define WOLFSSL_STM32L4
  146. #define HAL_CONSOLE_UART huart1
  147. #elif defined(STM32L562xx)
  148. #define WOLFSSL_STM32L5
  149. #define WOLFSSL_STM32_PKA
  150. #undef NO_STM32_HASH
  151. #undef NO_STM32_CRYPTO
  152. #define HAL_CONSOLE_UART huart1
  153. #elif defined(STM32L552xx)
  154. #define WOLFSSL_STM32L5
  155. #undef NO_STM32_HASH
  156. #define HAL_CONSOLE_UART hlpuart1
  157. #elif defined(STM32F207xx)
  158. #define WOLFSSL_STM32F2
  159. #define HAL_CONSOLE_UART huart3
  160. #elif defined(STM32F217xx)
  161. #define WOLFSSL_STM32F2
  162. #define HAL_CONSOLE_UART huart2
  163. #elif defined(STM32F107xC)
  164. #define WOLFSSL_STM32F1
  165. #define HAL_CONSOLE_UART huart4
  166. #define NO_STM32_RNG
  167. #elif defined(STM32F401xE)
  168. #define WOLFSSL_STM32F4
  169. #define HAL_CONSOLE_UART huart2
  170. #define NO_STM32_RNG
  171. #define WOLFSSL_GENSEED_FORTEST /* no HW RNG is available use test seed */
  172. #elif defined(STM32G071xx)
  173. #define WOLFSSL_STM32G0
  174. #define HAL_CONSOLE_UART huart2
  175. #define NO_STM32_RNG
  176. #define WOLFSSL_GENSEED_FORTEST /* no HW RNG is available use test seed */
  177. #elif defined(STM32U575xx) || defined(STM32U585xx)
  178. #define HAL_CONSOLE_UART huart1
  179. #define WOLFSSL_STM32U5
  180. #define STM32_HAL_V2
  181. #ifdef STM32U585xx
  182. #undef NO_STM32_HASH
  183. #undef NO_STM32_CRYPTO
  184. #define WOLFSSL_STM32_PKA
  185. #endif
  186. #elif defined(STM32H563xx)
  187. #define WOLFSSL_STM32H5
  188. #define HAL_CONSOLE_UART huart3
  189. #define STM32_HAL_V2
  190. #undef NO_STM32_HASH
  191. #else
  192. #warning Please define a hardware platform!
  193. /* This means there is not a pre-defined platform for your board/CPU */
  194. /* You need to define a CPU type, HW crypto and debug UART */
  195. /* CPU Type: WOLFSSL_STM32F1, WOLFSSL_STM32F2, WOLFSSL_STM32F4,
  196. WOLFSSL_STM32F7, WOLFSSL_STM32H7, WOLFSSL_STM32L4, WOLFSSL_STM32L5,
  197. WOLFSSL_STM32G0, WOLFSSL_STM32WB and WOLFSSL_STM32U5 */
  198. #define WOLFSSL_STM32F4
  199. /* Debug UART used for printf */
  200. /* The UART interface number varies for each board/CPU */
  201. /* Typically this is the UART attached to the ST-Link USB CDC UART port */
  202. #define HAL_CONSOLE_UART huart4
  203. /* Hardware Crypto - uncomment as available on hardware */
  204. //#define WOLFSSL_STM32_PKA
  205. //#define NO_STM32_RNG
  206. //#undef NO_STM32_HASH
  207. //#undef NO_STM32_CRYPTO
  208. /* if no HW RNG is available use test seed */
  209. //#define WOLFSSL_GENSEED_FORTEST
  210. //#define STM32_HAL_V2
  211. #endif
  212. /* ------------------------------------------------------------------------- */
  213. /* Platform */
  214. /* ------------------------------------------------------------------------- */
  215. #define SIZEOF_LONG_LONG 8
  216. #define WOLFSSL_GENERAL_ALIGNMENT 4
  217. #define WOLFSSL_STM32_CUBEMX
  218. #define WOLFSSL_SMALL_STACK
  219. #define WOLFSSL_USER_IO
  220. #define WOLFSSL_NO_SOCK
  221. #define WOLFSSL_IGNORE_FILE_WARN
  222. /* ------------------------------------------------------------------------- */
  223. /* Operating System */
  224. /* ------------------------------------------------------------------------- */
  225. #if defined(WOLF_CONF_RTOS) && WOLF_CONF_RTOS == 2
  226. #define FREERTOS
  227. #else
  228. #define SINGLE_THREADED
  229. #endif
  230. /* ------------------------------------------------------------------------- */
  231. /* Math Configuration */
  232. /* ------------------------------------------------------------------------- */
  233. /* 1=Fast (stack)
  234. * 2=Normal (heap)
  235. * 3=Single Precision C (only common curves/key sizes)
  236. * 4=Single Precision ASM Cortex-M3+
  237. * 5=Single Precision ASM Cortex-M0 (Generic Thumb)
  238. * 6=Single Precision C all small
  239. * 7=Single Precision C all big
  240. */
  241. #if defined(WOLF_CONF_MATH) && WOLF_CONF_MATH == 1
  242. /* fast (stack) math - tfm.c */
  243. #define USE_FAST_MATH
  244. #define TFM_TIMING_RESISTANT
  245. /* Optimizations (TFM_ARM, TFM_ASM or none) */
  246. //#define TFM_NO_ASM
  247. //#define TFM_ASM
  248. #elif defined(WOLF_CONF_MATH) && WOLF_CONF_MATH == 2
  249. /* heap math - integer.c */
  250. #define USE_INTEGER_HEAP_MATH
  251. #elif defined(WOLF_CONF_MATH) && (WOLF_CONF_MATH >= 3)
  252. /* single precision only */
  253. #define WOLFSSL_SP
  254. #if WOLF_CONF_MATH != 7
  255. #define WOLFSSL_SP_SMALL /* use smaller version of code */
  256. #endif
  257. #if defined(WOLF_CONF_RSA) && WOLF_CONF_RSA == 1
  258. #define WOLFSSL_HAVE_SP_RSA
  259. #endif
  260. #if defined(WOLF_CONF_DH) && WOLF_CONF_DH == 1
  261. #define WOLFSSL_HAVE_SP_DH
  262. #endif
  263. #if defined(WOLF_CONF_ECC) && WOLF_CONF_ECC == 1
  264. #define WOLFSSL_HAVE_SP_ECC
  265. #endif
  266. #if WOLF_CONF_MATH == 6 || WOLF_CONF_MATH == 7
  267. #define WOLFSSL_SP_MATH_ALL /* use sp_int.c multi precision math */
  268. #else
  269. #define WOLFSSL_SP_MATH /* disable non-standard curves / key sizes */
  270. #endif
  271. #define SP_WORD_SIZE 32
  272. /* Enable to put all math on stack (no heap) */
  273. //#define WOLFSSL_SP_NO_MALLOC
  274. #if WOLF_CONF_MATH == 4 || WOLF_CONF_MATH == 5
  275. #define WOLFSSL_SP_ASM /* required if using the ASM versions */
  276. #if WOLF_CONF_MATH == 4
  277. /* ARM Cortex-M3+ */
  278. #define WOLFSSL_SP_ARM_CORTEX_M_ASM
  279. #endif
  280. #if WOLF_CONF_MATH == 5
  281. /* Generic ARM Thumb (Cortex-M0) Assembly */
  282. #define WOLFSSL_SP_ARM_THUMB_ASM
  283. #endif
  284. #endif
  285. #endif
  286. /* ------------------------------------------------------------------------- */
  287. /* Enable Features */
  288. /* ------------------------------------------------------------------------- */
  289. /* Required for TLS */
  290. #define HAVE_TLS_EXTENSIONS
  291. #define HAVE_SUPPORTED_CURVES
  292. #define HAVE_ENCRYPT_THEN_MAC
  293. #define HAVE_EXTENDED_MASTER
  294. #if defined(WOLF_CONF_TLS13) && WOLF_CONF_TLS13 == 1
  295. #define WOLFSSL_TLS13
  296. #define HAVE_HKDF
  297. #endif
  298. #if defined(WOLF_CONF_DTLS) && WOLF_CONF_DTLS == 1
  299. #define WOLFSSL_DTLS
  300. #endif
  301. #if defined(WOLF_CONF_PSK) && WOLF_CONF_PSK == 0
  302. #define NO_PSK
  303. #endif
  304. #if defined(WOLF_CONF_PWDBASED) && WOLF_CONF_PWDBASED == 0
  305. #define NO_PWDBASED
  306. #endif
  307. #if defined(WOLF_CONF_KEEP_PEER_CERT) && WOLF_CONF_KEEP_PEER_CERT == 1
  308. #define KEEP_PEER_CERT
  309. #endif
  310. #if defined(WOLF_CONF_BASE64_ENCODE) && WOLF_CONF_BASE64_ENCODE == 1
  311. #define WOLFSSL_BASE64_ENCODE
  312. #endif
  313. #if defined(WOLF_CONF_OPENSSL_EXTRA) && WOLF_CONF_OPENSSL_EXTRA >= 1
  314. #define OPENSSL_EXTRA
  315. #if !defined(INT_MAX)
  316. #include <limits.h>
  317. #endif
  318. #endif
  319. #if defined(WOLF_CONF_OPENSSL_EXTRA) && WOLF_CONF_OPENSSL_EXTRA >= 2
  320. #define OPENSSL_ALL
  321. #endif
  322. /* TLS Session Cache */
  323. #if 0
  324. #define SMALL_SESSION_CACHE
  325. #else
  326. #define NO_SESSION_CACHE
  327. #endif
  328. /* ------------------------------------------------------------------------- */
  329. /* Crypto */
  330. /* ------------------------------------------------------------------------- */
  331. /* RSA */
  332. #undef NO_RSA
  333. #if defined(WOLF_CONF_RSA) && WOLF_CONF_RSA == 1
  334. #ifdef USE_FAST_MATH
  335. /* Maximum math bits (Max RSA key bits * 2) */
  336. #undef FP_MAX_BITS
  337. #define FP_MAX_BITS 4096
  338. #endif
  339. /* half as much memory but twice as slow */
  340. #undef RSA_LOW_MEM
  341. //#define RSA_LOW_MEM
  342. /* Enables blinding mode, to prevent timing attacks */
  343. #undef WC_RSA_BLINDING
  344. #define WC_RSA_BLINDING
  345. /* RSA PSS Support (required for TLS v1.3) */
  346. #ifdef WOLFSSL_TLS13
  347. #define WC_RSA_PSS
  348. #endif
  349. #else
  350. #define NO_RSA
  351. #endif
  352. /* ECC */
  353. #undef HAVE_ECC
  354. #if defined(WOLF_CONF_ECC) && WOLF_CONF_ECC == 1
  355. #define HAVE_ECC
  356. /* Manually define enabled curves */
  357. #define ECC_USER_CURVES
  358. //#define HAVE_ECC192
  359. //#define HAVE_ECC224
  360. #undef NO_ECC256
  361. //#define HAVE_ECC384
  362. //#define HAVE_ECC521
  363. /* Fixed point cache (speeds repeated operations against same private key) */
  364. #undef FP_ECC
  365. //#define FP_ECC
  366. #ifdef FP_ECC
  367. /* Bits / Entries */
  368. #undef FP_ENTRIES
  369. #define FP_ENTRIES 2
  370. #undef FP_LUT
  371. #define FP_LUT 4
  372. #endif
  373. /* Optional ECC calculation method */
  374. /* Note: doubles heap usage, but slightly faster */
  375. #undef ECC_SHAMIR
  376. #define ECC_SHAMIR
  377. /* Reduces heap usage, but slower */
  378. #define ECC_TIMING_RESISTANT
  379. /* Compressed ECC key support */
  380. //#define HAVE_COMP_KEY
  381. #ifdef USE_FAST_MATH
  382. #ifdef NO_RSA
  383. /* Custom fastmath size if not using RSA */
  384. /* MAX = ROUND32(ECC BITS) * 2 */
  385. #define FP_MAX_BITS (256 * 2)
  386. #else
  387. #define ALT_ECC_SIZE
  388. #endif
  389. /* Enable TFM optimizations for ECC */
  390. //#define TFM_ECC192
  391. //#define TFM_ECC224
  392. //#define TFM_ECC256
  393. //#define TFM_ECC384
  394. //#define TFM_ECC521
  395. #endif
  396. #endif
  397. /* DH */
  398. #undef NO_DH
  399. #if defined(WOLF_CONF_DH) && WOLF_CONF_DH == 1
  400. #define HAVE_DH /* freeRTOS settings.h requires this */
  401. #define HAVE_FFDHE_2048
  402. #define HAVE_DH_DEFAULT_PARAMS
  403. #else
  404. #define NO_DH
  405. #endif
  406. /* AES */
  407. #if defined(WOLF_CONF_AESGCM) && WOLF_CONF_AESGCM == 1
  408. #define HAVE_AESGCM
  409. /* GCM Method: GCM_SMALL, GCM_WORD32, GCM_TABLE or GCM_TABLE_4BIT */
  410. /* GCM_TABLE is about 4K larger and 3x faster for GHASH */
  411. #define GCM_SMALL
  412. #define HAVE_AES_DECRYPT
  413. #endif
  414. #if defined(WOLF_CONF_AESCBC) && WOLF_CONF_AESCBC == 1
  415. #define HAVE_AES_CBC
  416. #define HAVE_AES_DECRYPT
  417. #endif
  418. /* Other possible AES modes */
  419. //#define WOLFSSL_AES_COUNTER
  420. //#define HAVE_AESCCM
  421. //#define WOLFSSL_AES_XTS
  422. //#define WOLFSSL_AES_DIRECT
  423. //#define HAVE_AES_ECB
  424. //#define HAVE_AES_KEYWRAP
  425. //#define AES_MAX_KEY_SIZE 256
  426. /* ChaCha20 / Poly1305 */
  427. #undef HAVE_CHACHA
  428. #undef HAVE_POLY1305
  429. #if defined(WOLF_CONF_CHAPOLY) && WOLF_CONF_CHAPOLY == 1
  430. #define HAVE_CHACHA
  431. #define HAVE_POLY1305
  432. /* Needed for Poly1305 */
  433. #undef HAVE_ONE_TIME_AUTH
  434. #define HAVE_ONE_TIME_AUTH
  435. #endif
  436. /* Ed25519 / Curve25519 */
  437. #undef HAVE_CURVE25519
  438. #undef HAVE_ED25519
  439. #if defined(WOLF_CONF_EDCURVE25519) && WOLF_CONF_EDCURVE25519 == 1
  440. #define HAVE_CURVE25519
  441. #define HAVE_ED25519
  442. /* Optionally use small math (less flash usage, but much slower) */
  443. #define CURVED25519_SMALL
  444. #endif
  445. /* ------------------------------------------------------------------------- */
  446. /* Hashing */
  447. /* ------------------------------------------------------------------------- */
  448. /* Sha1 */
  449. #undef NO_SHA
  450. #if defined(WOLF_CONF_SHA1) && WOLF_CONF_SHA1 == 1
  451. /* 1k smaller, but 25% slower */
  452. //#define USE_SLOW_SHA
  453. #else
  454. #define NO_SHA
  455. #endif
  456. /* Sha2-256 */
  457. #undef NO_SHA256
  458. #if defined(WOLF_CONF_SHA2_256) && WOLF_CONF_SHA2_256 == 1
  459. /* not unrolled - ~2k smaller and ~25% slower */
  460. //#define USE_SLOW_SHA256
  461. //#define WOLFSSL_SHAKE256
  462. /* Sha2-224 */
  463. #if defined(WOLF_CONF_SHA2_224) && WOLF_CONF_SHA2_224 == 1
  464. #define WOLFSSL_SHA224
  465. #endif
  466. #else
  467. #define NO_SHA256
  468. #endif
  469. /* Sha2-512 */
  470. #undef WOLFSSL_SHA512
  471. #if defined(WOLF_CONF_SHA2_512) && WOLF_CONF_SHA2_512 == 1
  472. /* over twice as small, but 50% slower */
  473. //#define USE_SLOW_SHA512
  474. #define WOLFSSL_SHA512
  475. #define HAVE_SHA512 /* freeRTOS settings.h requires this */
  476. #endif
  477. /* Sha2-384 */
  478. #undef WOLFSSL_SHA384
  479. #if defined(WOLF_CONF_SHA2_384) && WOLF_CONF_SHA2_384 == 1
  480. #define WOLFSSL_SHA384
  481. #endif
  482. /* Sha3 */
  483. #undef WOLFSSL_SHA3
  484. #if defined(WOLF_CONF_SHA3) && WOLF_CONF_SHA3 == 1
  485. #define WOLFSSL_SHA3
  486. #endif
  487. /* MD5 */
  488. #if defined(WOLF_CONF_MD5) && WOLF_CONF_MD5 == 1
  489. /* enabled */
  490. #else
  491. #define NO_MD5
  492. #endif
  493. /* ------------------------------------------------------------------------- */
  494. /* Post-Quantum Crypto */
  495. /* ------------------------------------------------------------------------- */
  496. /*
  497. * NOTE: this is after the hashing section to override the potential SHA3 undef
  498. * above. */
  499. #if defined(WOLF_CONF_KYBER) && WOLF_CONF_KYBER == 1
  500. #undef WOLFSSL_EXPERIMENTAL_SETTINGS
  501. #define WOLFSSL_EXPERIMENTAL_SETTINGS
  502. #undef WOLFSSL_HAVE_KYBER
  503. #define WOLFSSL_HAVE_KYBER
  504. #undef WOLFSSL_WC_KYBER
  505. #define WOLFSSL_WC_KYBER
  506. #undef WOLFSSL_NO_SHAKE128
  507. #undef WOLFSSL_SHAKE128
  508. #define WOLFSSL_SHAKE128
  509. #undef WOLFSSL_NO_SHAKE256
  510. #undef WOLFSSL_SHAKE256
  511. #define WOLFSSL_SHAKE256
  512. #undef WOLFSSL_SHA3
  513. #define WOLFSSL_SHA3
  514. #endif /* WOLF_CONF_KYBER */
  515. /* ------------------------------------------------------------------------- */
  516. /* Benchmark / Test */
  517. /* ------------------------------------------------------------------------- */
  518. /* Use reduced benchmark / test sizes */
  519. #define BENCH_EMBEDDED
  520. #define USE_CERT_BUFFERS_2048
  521. #define USE_CERT_BUFFERS_256
  522. /* ------------------------------------------------------------------------- */
  523. /* Debugging */
  524. /* ------------------------------------------------------------------------- */
  525. #if defined(WOLF_CONF_DEBUG) && WOLF_CONF_DEBUG == 1
  526. #define DEBUG_WOLFSSL
  527. /* Use this to measure / print heap usage */
  528. #if 0
  529. #define USE_WOLFSSL_MEMORY
  530. #define WOLFSSL_TRACK_MEMORY
  531. #define WOLFSSL_DEBUG_MEMORY
  532. #define WOLFSSL_DEBUG_MEMORY_PRINT
  533. #endif
  534. #else
  535. //#define NO_WOLFSSL_MEMORY
  536. //#define NO_ERROR_STRINGS
  537. #endif
  538. /* ------------------------------------------------------------------------- */
  539. /* Port */
  540. /* ------------------------------------------------------------------------- */
  541. /* Override Current Time */
  542. /* Allows custom "custom_time()" function to be used for benchmark */
  543. #define WOLFSSL_USER_CURRTIME
  544. /* ------------------------------------------------------------------------- */
  545. /* RNG */
  546. /* ------------------------------------------------------------------------- */
  547. #define NO_OLD_RNGNAME /* conflicts with STM RNG macro */
  548. #if !defined(WOLF_CONF_RNG) || WOLF_CONF_RNG == 1
  549. /* default is enabled */
  550. #define HAVE_HASHDRBG
  551. #else /* WOLF_CONF_RNG == 0 */
  552. #define WC_NO_HASHDRBG
  553. #define WC_NO_RNG
  554. #endif
  555. /* ------------------------------------------------------------------------- */
  556. /* Disable Features */
  557. /* ------------------------------------------------------------------------- */
  558. #if defined(WOLF_CONF_TLS12) && WOLF_CONF_TLS12 == 0
  559. #define WOLFSSL_NO_TLS12
  560. #endif
  561. #if defined(WOLF_CONF_WOLFCRYPT_ONLY) && WOLF_CONF_WOLFCRYPT_ONLY == 1
  562. #define WOLFCRYPT_ONLY
  563. #endif
  564. //#define NO_WOLFSSL_SERVER
  565. //#define NO_WOLFSSL_CLIENT
  566. #if defined(WOLF_CONF_TEST) && WOLF_CONF_TEST == 0
  567. #define NO_CRYPT_TEST
  568. #define NO_CRYPT_BENCHMARK
  569. #endif
  570. #define NO_FILESYSTEM
  571. #define NO_WRITEV
  572. #define NO_MAIN_DRIVER
  573. #define NO_DEV_RANDOM
  574. #define NO_OLD_TLS
  575. #define WOLFSSL_NO_CLIENT_AUTH /* disable client auth for Ed25519/Ed448 */
  576. #define NO_DSA
  577. #define NO_RC4
  578. #define NO_MD4
  579. #define NO_DES3
  580. /* In-lining of misc.c functions */
  581. /* If defined, must include wolfcrypt/src/misc.c in build */
  582. /* Slower, but about 1k smaller */
  583. //#define NO_INLINE
  584. /* Base16 / Base64 encoding */
  585. //#define NO_CODING
  586. /* bypass certificate date checking, due to lack of properly configured RTC source */
  587. #ifndef HAL_RTC_MODULE_ENABLED
  588. #define NO_ASN_TIME
  589. #endif
  590. #ifdef __cplusplus
  591. }
  592. #endif
  593. #endif /* __WOLFSSL_I_CUBE_WOLFSSL_CONF_H__ */