-
Notifications
You must be signed in to change notification settings - Fork 9
STM32Cube
wolfCOSE ships as an STM32Cube pack, I-CUBE-wolfCOSE, so it drops into any
STM32CubeMX or STM32CubeIDE project without manual source integration. The pack
provides wolfCOSE as an STM32 middleware and uses the wolfSSL pack
(I-CUBE-wolfSSL) for all cryptography.
Supported cores: Cortex-M0, M0+, M3, M4, M7, M23, M33, M55, and STM32MP1.
- STM32CubeMX, plus STM32CubeIDE or another toolchain to build.
- The wolfSSL pack,
I-CUBE-wolfSSL5.9.2 or later. wolfCOSE depends on wolfCrypt for hashing, signing, and AEAD. - A board with a hardware RNG and a UART for console output.
- Download the wolfSSL pack (I-CUBE-wolfSSL.pack) and the wolfCOSE pack (I-CUBE-wolfCOSE.pack).
- In STM32CubeMX, open
Help,Manage embedded software packages,From Local..., and install the wolfSSL pack first, then the wolfCOSE pack.
- Open or create a project
.iocfor your board. - Enable the RNG peripheral under
Pinout & Configuration,Security,RNG. Signing needs entropy, andwc_GenerateSeed()fails without it. - Open
Software Packs,Select Components. - Enable
wolfSSLwolfCryptCoreandwolfCOSECore. To run the on device self test, also enablewolfCOSETest. - In the
Software Packsconfiguration category, enable each pack. - Generate code and build with your toolchain.
wolfCOSE reads its configuration from the wolfSSL user_settings.h, included
before wolfcose/settings.h. Enable the wolfCrypt features that match the COSE
algorithms you use:
- ES256:
HAVE_ECC,WOLFSSL_SHA256 - ES384 or ES512: add
WOLFSSL_SHA384orWOLFSSL_SHA512 - ML-DSA (RFC 9964):
WOLFSSL_HAVE_MLDSA - Encrypt0 AEAD:
HAVE_AESGCM, orHAVE_CHACHAwithHAVE_POLY1305 - MAC0: HMAC, which is on by default with SHA support
If a required wolfCrypt feature is missing, wolfcose/settings.h raises a
compile error naming it.
The Test component builds wolfcose_test.c, a self test that runs a
COSE_Sign1 sign and verify and reports the result over your configured
console. Call wolfCOSETest() from your application once main has initialized
the clocks and console.
A ready to run example for the NUCLEO-H563ZI board lives in
wolfssl-examples-stm32,
with a pre-configured .ioc: install the packs, open the .ioc, generate,
add the glue and software-crypto config from that example's README, build,
flash, and watch the console.
Verified on NUCLEO-H563ZI hardware, the console prints:
== wolfCOSE NUCLEO-H563ZI ==
Running wolfCOSE test (COSE_Sign1 ES256)...
wolfCOSE test: PASS (COSE_Sign1 99 bytes)
- Only pack source is kept in the repository. The built pack is posted at wolfssl.com/files/ide/I-CUBE-wolfCOSE.pack.
- On some STM32 families the wolfSSL pack enables hardware hash and RNG by
default. If a build reports a missing HAL module or hash symbol, enable the
matching peripheral in the
.ioc, or select software crypto withNO_STM32_HASHandNO_STM32_RNGin the generatedwolfSSL.I-CUBE-wolfSSL_conf.h. On the STM32H5 the hardware hash block references a HAL enum that does not exist, so software crypto is required there; the NUCLEO-H563ZI example shows the exact edit.