* ed448: refuse a dom4 flag other than Ed448 or Ed448ph * mldsa: keep one SHAKE256 context across sample_in_ball block refills * Fix comments that contradict the code in sha3, PQ, random, lms and aes * kdf: add wc_SSH_KDF_ex for an SSH shared secret encoded as a string * types: use compiler TLS on Zephyr and FreeRTOS when the kernel makes it per task * Gate SSH string-K test to FIPS v7, FreeRTOS TLS on picolibc only, known macros |
||
|---|---|---|
| .. | ||
| fips-v5-compat | ||
| samples | ||
| tests/wolfssl_condvar | ||
| wolfssl | ||
| CMakeLists.txt | ||
| Kconfig | ||
| README.md | ||
| include.am | ||
| module.yml | ||
| user_settings-fips-v5.2.3.h | ||
| user_settings-fips-v7.h | ||
| user_settings-no-malloc.h | ||
| user_settings.h | ||
| zephyr_init.c | ||
README.md
Zephyr Project Port
Overview
This port is for the Zephyr RTOS Project, available here.
It provides the following zephyr code.
- modules/crypto/wolfssl
- wolfssl library code
- modules/crypto/wolfssl/zephyr/
- Configuration and CMake files for wolfSSL as a Zephyr module
- modules/crypto/wolfssl/zephyr/samples/wolfssl_test
- wolfCrypt test application
- modules/crypto/wolfssl/zephyr/samples/wolfssl_bench
- wolfCrypt benchmark application
- modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_sock
- socket based sample of TLS
- modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_thread
- socket based sample of TLS using threads
How to setup as a Zephyr Module
Modify your project's west manifest
Add wolfssl as a project to your west.yml:
manifest:
remotes:
# <your other remotes>
- name: wolfssl
url-base: https://github.com/wolfssl
projects:
# <your other projects>
- name: wolfssl
path: modules/crypto/wolfssl
revision: master
remote: wolfssl
If you are using the Nordic nRF Connect SDK with Zephyr, the sdk-nrf manifest
file is located at: vX.X.X/nrf/west.yml. On OSX the default installation
location for the nRF Connect SDK is at /opt/nordic/ncs/vX.X.X.
Update west's modules:
west update
Now west recognizes 'wolfssl' as a module, and will include it's Kconfig and CMakeFiles.txt in the build system.
If using the Nordic nRF Connect SDK, to get access to a terminal with west tool access, open "nRF Connect for Desktop", then "Toolchain Manager", and finally next to the SDK version you are using click the drop down arrow, then "Open Terminal".
Build and Run wolfCrypt Test Application
If you want to run build apps without running west zephyr-export then it is
possible by setting the CMAKE_PREFIX_PATH variable to the location of the
zephyr sdk and building from the zephyr directory. For example:
CMAKE_PREFIX_PATH=/path/to/zephyr-sdk-<VERSION> west build -p always -b qemu_x86 ../modules/crypto/wolfssl/zephyr/samples/wolfssl_test/
build and execute wolfssl_test
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_test
west build -t run
Build with a wolfCrypt FIPS v5 bundle
In a tree holding a v5 FIPS bundle, select it in prj.conf:
CONFIG_WOLFCRYPT_FIPS=y
CONFIG_WOLFCRYPT_FIPS_V5=y
CONFIG_WOLFCRYPT_FIPS_V5_2_3=y
CONFIG_LINKER_SORT_BY_ALIGNMENT=n
Leave CONFIG_WOLFCRYPT_FIPS_V5_2_3 out for a 5.2.1 bundle. Every FIPS
boundary needs CONFIG_LINKER_SORT_BY_ALIGNMENT=n, which Zephyr defaults on:
the integrity check hashes the boundary as two ranges, and sorting input
sections by alignment moves code out of them, so the build stops while it is
set.
With 5.2.3, user_settings.h takes the algorithm set of
--enable-fips=v5.2.3 from user_settings-fips-v5.2.3.h; the TLS and
certificate options still follow Kconfig. Both v5 bundles seed the DRBG from
the Zephyr CSPRNG, which has to be CONFIG_HARDWARE_DEVICE_CS_GENERATOR, the
default with an entropy driver, so that the seed comes straight from the
driver and not through a DRBG outside the module; a board with no entropy
driver fails the build unless CONFIG_TEST_RANDOM_GENERATOR is set. Under
FIPS v2, v5 and v6 CONFIG_WOLFCRYPT_ASM accelerates only the SP math: those
boundaries keep their AES and SHA assembly in a form this module does not
build.
The crypto_only scenario of tests/wolfssl_condvar also calls
wc_InitRng(), which under v5 only works once the hook in zephyr_init.c
has registered the seed callback; wolfcrypt_test() registers it itself, so
the test sample cannot tell. CI runs it without a bundle. With one:
west build -p always -b native_sim modules/crypto/wolfssl/zephyr/tests/wolfssl_condvar -- -DCONFIG_WOLFSSL_CRYPTO_ONLY=y -DCONFIG_WOLFCRYPT_FIPS=y -DCONFIG_WOLFCRYPT_FIPS_V5=y -DCONFIG_LINKER_SORT_BY_ALIGNMENT=n
west build -t run
Add -DCONFIG_WOLFCRYPT_FIPS_V5_2_3=y for a 5.2.3 bundle.
Build and Run wolfCrypt Benchmark Application
build and execute wolfssl_benchmark
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_benchmark
west build -t run
Build and Run wolfSSL example wolfssl_tls_sock
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_sock
west build -t run
Build and Run wolfSSL example wolfssl_tls_thread
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/crypto/wolfssl/zephyr/samples/wolfssl_tls_thread
west build -t run
How to setup wolfSSL support for Zephyr TLS Sockets and RNG
wolfSSL can also be used as the underlying implementation for the default Zephyr TLS socket interface. With this enabled, all existing applications using the Zephyr TLS sockets will now use wolfSSL inside for all TLS operations. This will also enable wolfSSL as the default RNG implementation. To enable this feature, use the patch file and instructions found here: