1
0

user_settings_stm32.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  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 1
  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 1
  73. /*---------- WOLF_CONF_SHA2_512 -----------*/
  74. #define WOLF_CONF_SHA2_512 1
  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_PQM4 -----------*/
  90. #define WOLF_CONF_PQM4 0
  91. /*---------- WOLF_CONF_ARMASM -----------*/
  92. #define WOLF_CONF_ARMASM 1
  93. /* ------------------------------------------------------------------------- */
  94. /* Hardware platform */
  95. /* ------------------------------------------------------------------------- */
  96. /* Setup default (No crypto hardware acceleration or TLS UART test).
  97. * Use undef in platform section to enable it.
  98. */
  99. #define NO_STM32_HASH
  100. #define NO_STM32_CRYPTO
  101. #define NO_TLS_UART_TEST
  102. #if defined(STM32WB55xx)
  103. #define WOLFSSL_STM32WB
  104. #define WOLFSSL_STM32_PKA
  105. #undef NO_STM32_CRYPTO
  106. #define HAL_CONSOLE_UART huart1
  107. #elif defined(STM32WL55xx)
  108. #define WOLFSSL_STM32WL
  109. #define WOLFSSL_STM32_PKA
  110. #undef NO_STM32_CRYPTO
  111. #define HAL_CONSOLE_UART huart2
  112. #elif defined(STM32F407xx)
  113. #define WOLFSSL_STM32F4
  114. #define HAL_CONSOLE_UART huart2
  115. #elif defined(STM32F437xx)
  116. #define WOLFSSL_STM32F4
  117. #undef NO_STM32_HASH
  118. #undef NO_STM32_CRYPTO
  119. #define STM32_HAL_V2
  120. #define HAL_CONSOLE_UART huart4
  121. #elif defined(STM32F777xx)
  122. #define WOLFSSL_STM32F7
  123. #undef NO_STM32_HASH
  124. #undef NO_STM32_CRYPTO
  125. #define STM32_HAL_V2
  126. #define HAL_CONSOLE_UART huart2
  127. #elif defined(STM32F756xx)
  128. #define WOLFSSL_STM32F7
  129. #undef NO_STM32_HASH
  130. #undef NO_STM32_CRYPTO
  131. #define STM32_HAL_V2
  132. #define HAL_CONSOLE_UART huart3
  133. #elif defined(STM32H753xx)
  134. #define WOLFSSL_STM32H7
  135. #undef NO_STM32_HASH
  136. #undef NO_STM32_CRYPTO
  137. #define HAL_CONSOLE_UART huart3
  138. #elif defined(STM32H723xx) || defined(STM32H725xx) || defined(STM32H743xx)
  139. #define WOLFSSL_STM32H7
  140. #define HAL_CONSOLE_UART huart3
  141. #elif defined(STM32L4A6xx)
  142. #define WOLFSSL_STM32L4
  143. #undef NO_STM32_HASH
  144. #undef NO_STM32_CRYPTO
  145. #define HAL_CONSOLE_UART hlpuart1
  146. #elif defined(STM32L475xx)
  147. #define WOLFSSL_STM32L4
  148. #define HAL_CONSOLE_UART huart1
  149. #elif defined(STM32L562xx)
  150. #define WOLFSSL_STM32L5
  151. #define WOLFSSL_STM32_PKA
  152. #undef NO_STM32_HASH
  153. #undef NO_STM32_CRYPTO
  154. #define HAL_CONSOLE_UART huart1
  155. #elif defined(STM32L552xx)
  156. #define WOLFSSL_STM32L5
  157. #undef NO_STM32_HASH
  158. #define HAL_CONSOLE_UART hlpuart1
  159. #elif defined(STM32F207xx)
  160. #define WOLFSSL_STM32F2
  161. #define HAL_CONSOLE_UART huart3
  162. #elif defined(STM32F217xx)
  163. #define WOLFSSL_STM32F2
  164. #define HAL_CONSOLE_UART huart2
  165. #elif defined(STM32F107xC)
  166. #define WOLFSSL_STM32F1
  167. #define HAL_CONSOLE_UART huart4
  168. #define NO_STM32_RNG
  169. #elif defined(STM32F401xE)
  170. #define WOLFSSL_STM32F4
  171. #define HAL_CONSOLE_UART huart2
  172. #define NO_STM32_RNG
  173. #define WOLFSSL_GENSEED_FORTEST /* no HW RNG is available use test seed */
  174. #elif defined(STM32G071xx)
  175. #define WOLFSSL_STM32G0
  176. #define HAL_CONSOLE_UART huart2
  177. #define NO_STM32_RNG
  178. #define WOLFSSL_GENSEED_FORTEST /* no HW RNG is available use test seed */
  179. #elif defined(STM32G491xx)
  180. #define WOLFSSL_STM32G4
  181. #define HAL_CONSOLE_UART hlpuart1
  182. #elif defined(STM32U575xx) || defined(STM32U585xx) || defined(STM32U5A9xx)
  183. #define HAL_CONSOLE_UART huart1
  184. #define WOLFSSL_STM32U5
  185. #define STM32_HAL_V2
  186. #if defined(STM32U585xx) || defined(STM32U5A9xx)
  187. #undef NO_STM32_HASH
  188. #undef NO_STM32_CRYPTO
  189. #define WOLFSSL_STM32_PKA
  190. #endif
  191. #elif defined(STM32H563xx)
  192. #define WOLFSSL_STM32H5
  193. #define HAL_CONSOLE_UART huart3
  194. #define STM32_HAL_V2
  195. #undef NO_STM32_HASH
  196. #else
  197. #warning Please define a hardware platform!
  198. /* This means there is not a pre-defined platform for your board/CPU */
  199. /* You need to define a CPU type, HW crypto and debug UART */
  200. /* CPU Type: WOLFSSL_STM32F1, WOLFSSL_STM32F2, WOLFSSL_STM32F4,
  201. WOLFSSL_STM32F7, WOLFSSL_STM32H7, WOLFSSL_STM32L4, WOLFSSL_STM32L5,
  202. WOLFSSL_STM32G0, WOLFSSL_STM32WB and WOLFSSL_STM32U5 */
  203. #define WOLFSSL_STM32F4
  204. /* Debug UART used for printf */
  205. /* The UART interface number varies for each board/CPU */
  206. /* Typically this is the UART attached to the ST-Link USB CDC UART port */
  207. #define HAL_CONSOLE_UART huart4
  208. /* Hardware Crypto - uncomment as available on hardware */
  209. //#define WOLFSSL_STM32_PKA
  210. //#define NO_STM32_RNG
  211. //#undef NO_STM32_HASH
  212. //#undef NO_STM32_CRYPTO
  213. /* if no HW RNG is available use test seed */
  214. //#define WOLFSSL_GENSEED_FORTEST
  215. //#define STM32_HAL_V2
  216. #endif
  217. /* ------------------------------------------------------------------------- */
  218. /* Platform */
  219. /* ------------------------------------------------------------------------- */
  220. #define SIZEOF_LONG_LONG 8
  221. #define WOLFSSL_GENERAL_ALIGNMENT 4
  222. #define WOLFSSL_STM32_CUBEMX
  223. #define WOLFSSL_SMALL_STACK
  224. #define WOLFSSL_IGNORE_FILE_WARN
  225. /* ------------------------------------------------------------------------- */
  226. /* Network stack: 1=User IO (custom), 2=LWIP (posix), 3=LWIP (native) */
  227. /* ------------------------------------------------------------------------- */
  228. #if defined(WOLF_CONF_IO) && WOLF_CONF_IO == 2
  229. #define WOLFSSL_LWIP
  230. #elif defined(WOLF_CONF_IO) && WOLF_CONF_IO == 3
  231. #define WOLFSSL_LWIP_NATIVE
  232. #else /* custom */
  233. #define WOLFSSL_USER_IO
  234. #define WOLFSSL_NO_SOCK
  235. #endif
  236. /* ------------------------------------------------------------------------- */
  237. /* Operating System: 1=Bare-metal/Single threaded, 2=FREERTOS */
  238. /* ------------------------------------------------------------------------- */
  239. #if defined(WOLF_CONF_RTOS) && WOLF_CONF_RTOS == 2
  240. #define FREERTOS
  241. #else
  242. #define SINGLE_THREADED
  243. #endif
  244. /* ------------------------------------------------------------------------- */
  245. /* Math Configuration */
  246. /* ------------------------------------------------------------------------- */
  247. /* 1=Fast (stack) (tfm.c)
  248. * 2=Normal (heap) (integer.c)
  249. * 3-5=Single Precision: only common curves/key sizes:
  250. * (ECC 256/384/521 and RSA/DH 2048/3072/4096)
  251. * 3=Single Precision C (sp_c32.c)
  252. * 4=Single Precision ASM Cortex-M3+ (sp_cortexm.c)
  253. * 5=Single Precision ASM Cortex-M0 (sp_armthumb.c)
  254. * 6=Wolf multi-precision C small (sp_int.c)
  255. * 7=Wolf multi-precision C big (sp_int.c)
  256. */
  257. #if defined(WOLF_CONF_MATH) && WOLF_CONF_MATH == 1
  258. /* fast (stack) math - tfm.c */
  259. #define USE_FAST_MATH
  260. #define TFM_TIMING_RESISTANT
  261. #if !defined(NO_RSA) || !defined(NO_DH)
  262. /* Maximum math bits (Max DH/RSA key bits * 2) */
  263. #undef FP_MAX_BITS
  264. #define FP_MAX_BITS 4096
  265. #endif
  266. /* Optimizations (TFM_ARM, TFM_ASM or none) */
  267. //#define TFM_NO_ASM
  268. //#define TFM_ASM
  269. #elif defined(WOLF_CONF_MATH) && WOLF_CONF_MATH == 2
  270. /* heap math - integer.c */
  271. #define USE_INTEGER_HEAP_MATH
  272. #elif defined(WOLF_CONF_MATH) && (WOLF_CONF_MATH >= 3)
  273. /* single precision only */
  274. #define WOLFSSL_SP
  275. #if WOLF_CONF_MATH != 7
  276. #define WOLFSSL_SP_SMALL /* use smaller version of code */
  277. #endif
  278. #if defined(WOLF_CONF_RSA) && WOLF_CONF_RSA == 1
  279. #define WOLFSSL_HAVE_SP_RSA
  280. //#define WOLFSSL_SP_NO_2048
  281. //#define WOLFSSL_SP_NO_3072
  282. //#define WOLFSSL_SP_4096
  283. #endif
  284. #if defined(WOLF_CONF_DH) && WOLF_CONF_DH == 1
  285. #define WOLFSSL_HAVE_SP_DH
  286. #endif
  287. #if defined(WOLF_CONF_ECC) && WOLF_CONF_ECC == 1
  288. #define WOLFSSL_HAVE_SP_ECC
  289. //#define WOLFSSL_SP_NO_256
  290. #define WOLFSSL_SP_384
  291. //#define WOLFSSL_SP_521
  292. #endif
  293. #if WOLF_CONF_MATH == 6 || WOLF_CONF_MATH == 7
  294. #define WOLFSSL_SP_MATH_ALL /* use sp_int.c multi precision math */
  295. //#define WOLFSSL_SP_ARM_THUMB /* enable ARM Thumb ASM speedups */
  296. #else
  297. #define WOLFSSL_SP_MATH /* disable non-standard curves / key sizes */
  298. #endif
  299. #define SP_WORD_SIZE 32 /* force 32-bit mode */
  300. /* Enable to put all math on stack (no heap) */
  301. //#define WOLFSSL_SP_NO_MALLOC
  302. #if WOLF_CONF_MATH == 4 || WOLF_CONF_MATH == 5
  303. #define WOLFSSL_SP_ASM /* required if using the ASM versions */
  304. #if WOLF_CONF_MATH == 4
  305. /* ARM Cortex-M3+ */
  306. #define WOLFSSL_SP_ARM_CORTEX_M_ASM
  307. #endif
  308. #if WOLF_CONF_MATH == 5
  309. /* Generic ARM Thumb (Cortex-M0) Assembly */
  310. #define WOLFSSL_SP_ARM_THUMB_ASM
  311. #endif
  312. #endif
  313. #endif
  314. /* ------------------------------------------------------------------------- */
  315. /* Enable Features */
  316. /* ------------------------------------------------------------------------- */
  317. /* Required for TLS */
  318. #define HAVE_TLS_EXTENSIONS
  319. #define HAVE_SUPPORTED_CURVES
  320. #define HAVE_ENCRYPT_THEN_MAC
  321. #define HAVE_EXTENDED_MASTER
  322. #define WOLFSSL_ASN_TEMPLATE
  323. #define HAVE_SNI
  324. #if defined(WOLF_CONF_TLS13) && WOLF_CONF_TLS13 == 1
  325. #define WOLFSSL_TLS13
  326. #define HAVE_HKDF
  327. #endif
  328. #if defined(WOLF_CONF_DTLS) && WOLF_CONF_DTLS == 1
  329. #define WOLFSSL_DTLS
  330. #endif
  331. #if defined(WOLF_CONF_PSK) && WOLF_CONF_PSK == 0
  332. #define NO_PSK
  333. #endif
  334. #if defined(WOLF_CONF_PWDBASED) && WOLF_CONF_PWDBASED == 0
  335. #define NO_PWDBASED
  336. #endif
  337. #if defined(WOLF_CONF_KEEP_PEER_CERT) && WOLF_CONF_KEEP_PEER_CERT == 1
  338. #define KEEP_PEER_CERT
  339. #endif
  340. #if defined(WOLF_CONF_BASE64_ENCODE) && WOLF_CONF_BASE64_ENCODE == 1
  341. #define WOLFSSL_BASE64_ENCODE
  342. #endif
  343. #if defined(WOLF_CONF_OPENSSL_EXTRA) && WOLF_CONF_OPENSSL_EXTRA >= 1
  344. #define OPENSSL_EXTRA
  345. #if !defined(INT_MAX)
  346. #include <limits.h>
  347. #endif
  348. #endif
  349. #if defined(WOLF_CONF_OPENSSL_EXTRA) && WOLF_CONF_OPENSSL_EXTRA >= 2
  350. #define OPENSSL_ALL
  351. #endif
  352. /* TLS Session Cache */
  353. #if defined(WOLF_CONF_RESUMPTION) && WOLF_CONF_RESUMPTION == 1
  354. #define SMALL_SESSION_CACHE
  355. #define HAVE_SESSION_TICKET
  356. #else
  357. #define NO_SESSION_CACHE
  358. #endif
  359. /* TPM support */
  360. #if defined(WOLF_CONF_TPM) && WOLF_CONF_TPM == 1
  361. #define WOLF_CRYPTO_CB
  362. #define WOLFSSL_PUBLIC_MP
  363. /* also AES CFB - enabled below */
  364. #endif
  365. /* TLS key callbacks */
  366. #if defined(WOLF_CONF_PK) && WOLF_CONF_PK == 1
  367. #define HAVE_PK_CALLBACKS
  368. #endif
  369. /* ------------------------------------------------------------------------- */
  370. /* Crypto */
  371. /* ------------------------------------------------------------------------- */
  372. /* RSA */
  373. #undef NO_RSA
  374. #if defined(WOLF_CONF_RSA) && WOLF_CONF_RSA == 1
  375. /* half as much memory but twice as slow */
  376. #undef RSA_LOW_MEM
  377. //#define RSA_LOW_MEM
  378. /* Enables blinding mode, to prevent timing attacks */
  379. #undef WC_RSA_BLINDING
  380. #define WC_RSA_BLINDING
  381. /* RSA PSS Support (required for TLS v1.3) */
  382. #ifdef WOLFSSL_TLS13
  383. #define WC_RSA_PSS
  384. #endif
  385. #else
  386. #define NO_RSA
  387. #endif
  388. /* ECC */
  389. #undef HAVE_ECC
  390. #if defined(WOLF_CONF_ECC) && WOLF_CONF_ECC == 1
  391. #define HAVE_ECC
  392. /* Manually define enabled curves */
  393. #define ECC_USER_CURVES
  394. //#define HAVE_ECC192
  395. //#define HAVE_ECC224
  396. #undef NO_ECC256
  397. #define HAVE_ECC384
  398. //#define HAVE_ECC521
  399. /* Fixed point cache (speeds repeated operations against same private key) */
  400. #undef FP_ECC
  401. //#define FP_ECC
  402. #ifdef FP_ECC
  403. /* Bits / Entries */
  404. #undef FP_ENTRIES
  405. #define FP_ENTRIES 2
  406. #undef FP_LUT
  407. #define FP_LUT 4
  408. #endif
  409. /* Optional ECC calculation method */
  410. /* Note: doubles heap usage, but slightly faster */
  411. #undef ECC_SHAMIR
  412. #define ECC_SHAMIR
  413. /* Reduces heap usage, but slower */
  414. #define ECC_TIMING_RESISTANT
  415. /* Compressed ECC key support */
  416. //#define HAVE_COMP_KEY
  417. #ifdef USE_FAST_MATH
  418. #if defined(NO_RSA) && defined(NO_DH)
  419. /* Custom fastmath size if not using RSA/DH */
  420. /* MAX = ROUND32(ECC BITS) * 2 */
  421. #define FP_MAX_BITS (256 * 2)
  422. #else
  423. #define ALT_ECC_SIZE
  424. #endif
  425. /* Enable TFM optimizations for ECC */
  426. //#define TFM_ECC192
  427. //#define TFM_ECC224
  428. //#define TFM_ECC256
  429. //#define TFM_ECC384
  430. //#define TFM_ECC521
  431. #endif
  432. #endif
  433. /* DH */
  434. #undef NO_DH
  435. #if defined(WOLF_CONF_DH) && WOLF_CONF_DH == 1
  436. #define HAVE_DH /* freeRTOS settings.h requires this */
  437. #define HAVE_FFDHE_2048
  438. #define HAVE_DH_DEFAULT_PARAMS
  439. #else
  440. #define NO_DH
  441. #endif
  442. /* AES */
  443. #if defined(WOLF_CONF_AESGCM) && WOLF_CONF_AESGCM >= 1
  444. #define HAVE_AESGCM
  445. #define HAVE_AES_DECRYPT
  446. /* GCM Method: GCM_SMALL, GCM_WORD32, GCM_TABLE or GCM_TABLE_4BIT */
  447. /* GCM_TABLE is about 4K larger and 3x faster for GHASH */
  448. #if WOLF_CONF_AESGCM == 2
  449. #define GCM_TABLE_4BIT
  450. #else
  451. #define GCM_SMALL
  452. #endif
  453. #endif
  454. #if defined(WOLF_CONF_AESCBC) && WOLF_CONF_AESCBC == 1
  455. #define HAVE_AES_CBC
  456. #define HAVE_AES_DECRYPT
  457. #else
  458. #define NO_AES_CBC
  459. #endif
  460. /* Other possible AES modes */
  461. #if defined(WOLF_CONF_TPM) && WOLF_CONF_TPM == 1
  462. #define WOLFSSL_AES_CFB /* Used by TPM parameter encryption */
  463. #endif
  464. //#define WOLFSSL_AES_COUNTER
  465. //#define HAVE_AESCCM
  466. //#define WOLFSSL_AES_XTS
  467. //#define WOLFSSL_AES_DIRECT
  468. //#define HAVE_AES_ECB
  469. //#define HAVE_AES_KEYWRAP
  470. //#define AES_MAX_KEY_SIZE 256
  471. /* ChaCha20 / Poly1305 */
  472. #undef HAVE_CHACHA
  473. #undef HAVE_POLY1305
  474. #if defined(WOLF_CONF_CHAPOLY) && WOLF_CONF_CHAPOLY == 1
  475. #define HAVE_CHACHA
  476. #define HAVE_POLY1305
  477. /* Needed for Poly1305 */
  478. #undef HAVE_ONE_TIME_AUTH
  479. #define HAVE_ONE_TIME_AUTH
  480. #endif
  481. /* Ed25519 / Curve25519 */
  482. #undef HAVE_CURVE25519
  483. #undef HAVE_ED25519
  484. #if defined(WOLF_CONF_EDCURVE25519) && WOLF_CONF_EDCURVE25519 == 1
  485. #define HAVE_CURVE25519
  486. #define HAVE_ED25519
  487. /* Optionally use small math (less flash usage, but much slower) */
  488. //#define CURVED25519_SMALL
  489. #endif
  490. /* ------------------------------------------------------------------------- */
  491. /* Hashing */
  492. /* ------------------------------------------------------------------------- */
  493. /* Sha1 */
  494. #undef NO_SHA
  495. #if defined(WOLF_CONF_SHA1) && WOLF_CONF_SHA1 == 1
  496. /* 1k smaller, but 25% slower */
  497. //#define USE_SLOW_SHA
  498. #else
  499. #define NO_SHA
  500. #endif
  501. /* Sha2-256 */
  502. #undef NO_SHA256
  503. #if defined(WOLF_CONF_SHA2_256) && WOLF_CONF_SHA2_256 == 1
  504. /* not unrolled - ~2k smaller and ~25% slower */
  505. //#define USE_SLOW_SHA256
  506. //#define WOLFSSL_SHAKE256
  507. /* Sha2-224 */
  508. #if defined(WOLF_CONF_SHA2_224) && WOLF_CONF_SHA2_224 == 1
  509. #define WOLFSSL_SHA224
  510. #endif
  511. #else
  512. #define NO_SHA256
  513. #endif
  514. /* Sha2-512 */
  515. #undef WOLFSSL_SHA512
  516. #if defined(WOLF_CONF_SHA2_512) && WOLF_CONF_SHA2_512 == 1
  517. /* over twice as small, but 50% slower */
  518. //#define USE_SLOW_SHA512
  519. #define WOLFSSL_SHA512
  520. #define HAVE_SHA512 /* old freeRTOS settings.h requires this */
  521. #endif
  522. /* Sha2-384 */
  523. #undef WOLFSSL_SHA384
  524. #if defined(WOLF_CONF_SHA2_384) && WOLF_CONF_SHA2_384 == 1
  525. #define WOLFSSL_SHA384
  526. #endif
  527. /* Sha3 */
  528. #undef WOLFSSL_SHA3
  529. #if defined(WOLF_CONF_SHA3) && WOLF_CONF_SHA3 == 1
  530. #define WOLFSSL_SHA3
  531. #endif
  532. /* MD5 */
  533. #if defined(WOLF_CONF_MD5) && WOLF_CONF_MD5 == 1
  534. /* enabled */
  535. #else
  536. #define NO_MD5
  537. #endif
  538. /* ------------------------------------------------------------------------- */
  539. /* Post-Quantum Crypto */
  540. /* ------------------------------------------------------------------------- */
  541. /* NOTE: this is after the hashing section to override the potential SHA3 undef
  542. * above. */
  543. #if defined(WOLF_CONF_KYBER) && WOLF_CONF_KYBER == 1
  544. #undef WOLFSSL_EXPERIMENTAL_SETTINGS
  545. #define WOLFSSL_EXPERIMENTAL_SETTINGS
  546. #undef WOLFSSL_HAVE_KYBER
  547. #define WOLFSSL_HAVE_KYBER
  548. #undef WOLFSSL_WC_KYBER
  549. #define WOLFSSL_WC_KYBER
  550. #undef WOLFSSL_NO_SHAKE128
  551. #undef WOLFSSL_SHAKE128
  552. #define WOLFSSL_SHAKE128
  553. #undef WOLFSSL_NO_SHAKE256
  554. #undef WOLFSSL_SHAKE256
  555. #define WOLFSSL_SHAKE256
  556. #undef WOLFSSL_SHA3
  557. #define WOLFSSL_SHA3
  558. #endif /* WOLF_CONF_KYBER */
  559. /* ------------------------------------------------------------------------- */
  560. /* Crypto Acceleration */
  561. /* ------------------------------------------------------------------------- */
  562. /* This enables inline assembly speedups for SHA2, SHA3, AES,
  563. * ChaCha20/Poly1305 and Ed/Curve25519. These settings work for Cortex M4/M7
  564. * and the source code is located in wolfcrypt/src/port/arm/
  565. */
  566. #if defined(WOLF_CONF_ARMASM) && WOLF_CONF_ARMASM == 1
  567. #define WOLFSSL_ARMASM
  568. #define WOLFSSL_ARMASM_INLINE
  569. #define WOLFSSL_ARMASM_NO_HW_CRYPTO
  570. #define WOLFSSL_ARMASM_NO_NEON
  571. #define WOLFSSL_ARM_ARCH 7
  572. /* Disable H/W offloading if accelerating S/W crypto */
  573. #undef NO_STM32_HASH
  574. #define NO_STM32_HASH
  575. #undef NO_STM32_CRYPTO
  576. #define NO_STM32_CRYPTO
  577. #endif
  578. /* ------------------------------------------------------------------------- */
  579. /* Benchmark / Test */
  580. /* ------------------------------------------------------------------------- */
  581. /* Use reduced benchmark / test sizes */
  582. #define BENCH_EMBEDDED
  583. #define USE_CERT_BUFFERS_2048
  584. #define USE_CERT_BUFFERS_256
  585. /* ------------------------------------------------------------------------- */
  586. /* Debugging */
  587. /* ------------------------------------------------------------------------- */
  588. #if defined(WOLF_CONF_DEBUG) && WOLF_CONF_DEBUG == 1
  589. #define DEBUG_WOLFSSL
  590. /* Use this to measure / print heap usage */
  591. #if 0
  592. #define USE_WOLFSSL_MEMORY
  593. #define WOLFSSL_TRACK_MEMORY
  594. #define WOLFSSL_DEBUG_MEMORY
  595. #define WOLFSSL_DEBUG_MEMORY_PRINT
  596. #endif
  597. #else
  598. //#define NO_WOLFSSL_MEMORY
  599. //#define NO_ERROR_STRINGS
  600. #endif
  601. /* ------------------------------------------------------------------------- */
  602. /* Port */
  603. /* ------------------------------------------------------------------------- */
  604. /* Override Current Time */
  605. /* Allows custom "custom_time()" function to be used for benchmark */
  606. #define WOLFSSL_USER_CURRTIME
  607. /* ------------------------------------------------------------------------- */
  608. /* RNG */
  609. /* ------------------------------------------------------------------------- */
  610. #define NO_OLD_RNGNAME /* conflicts with STM RNG macro */
  611. #if !defined(WOLF_CONF_RNG) || WOLF_CONF_RNG == 1
  612. /* default is enabled */
  613. #define HAVE_HASHDRBG
  614. #else /* WOLF_CONF_RNG == 0 */
  615. #define WC_NO_HASHDRBG
  616. #define WC_NO_RNG
  617. #endif
  618. /* ------------------------------------------------------------------------- */
  619. /* Disable Features */
  620. /* ------------------------------------------------------------------------- */
  621. #if defined(WOLF_CONF_TLS12) && WOLF_CONF_TLS12 == 0
  622. #define WOLFSSL_NO_TLS12
  623. #endif
  624. #if defined(WOLF_CONF_WOLFCRYPT_ONLY) && WOLF_CONF_WOLFCRYPT_ONLY == 1
  625. #define WOLFCRYPT_ONLY
  626. #endif
  627. //#define NO_WOLFSSL_SERVER
  628. //#define NO_WOLFSSL_CLIENT
  629. #if defined(WOLF_CONF_TEST) && WOLF_CONF_TEST == 0
  630. #define NO_CRYPT_TEST
  631. #define NO_CRYPT_BENCHMARK
  632. #endif
  633. #define NO_FILESYSTEM
  634. #define NO_WRITEV
  635. #define NO_MAIN_DRIVER
  636. #define NO_DEV_RANDOM
  637. #define NO_OLD_TLS
  638. #define WOLFSSL_NO_CLIENT_AUTH /* disable client auth for Ed25519/Ed448 */
  639. #define NO_DSA
  640. #define NO_RC4
  641. #define NO_MD4
  642. #define NO_DES3
  643. #define WOLFSSL_NO_SHAKE128
  644. #define WOLFSSL_NO_SHAKE256
  645. /* In-lining of misc.c functions */
  646. /* If defined, must include wolfcrypt/src/misc.c in build */
  647. /* Slower, but about 1k smaller */
  648. //#define NO_INLINE
  649. /* Base16 / Base64 encoding */
  650. //#define NO_CODING
  651. /* bypass certificate date checking, due to lack of properly configured RTC source */
  652. #ifndef HAL_RTC_MODULE_ENABLED
  653. #define NO_ASN_TIME
  654. #endif
  655. #ifdef __cplusplus
  656. }
  657. #endif
  658. #endif /* __WOLFSSL_I_CUBE_WOLFSSL_CONF_H__ */