2
0

default_conf.ftl 21 KB

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