2
0

default_conf.ftl 21 KB

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