Zephyr: wolfSSL module support for the wolfPSA provider and native RTOS use#10983
Zephyr: wolfSSL module support for the wolfPSA provider and native RTOS use#10983Frauschi wants to merge 2 commits into
Conversation
224dbaa to
2000bc2
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10983
Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
| XFREE(threadStack, wolfsslThreadHeapHint, | ||
| DYNAMIC_TYPE_TMP_BUFFER); | ||
|
|
||
| return ret; |
There was a problem hiding this comment.
🟠 [Medium] StackSizeCheck returns uninitialized ret on success path · Logic errors
ret is declared at line 741 without initialization. All error branches set ret = MEMORY_E before goto out, but the success path uses a separate err variable for k_thread_join and never assigns ret = 0, so return ret returns an indeterminate value on success.
Fix: Initialize ret to 0 at its declaration (int ret = 0;) to match the intended success return value.
…OS use
Extend the wolfSSL Zephyr module for the wolfPSA-provider and secure-sockets
efforts:
- Native RTOS threading: wolfCrypt's Zephyr port uses k_mutex/k_thread/
k_condvar directly (no CONFIG_POSIX_THREADS), with k_condvar gated on the
kernel version, covered by a native-threading ztest wired into CI.
- Config interface: a user-supplied CONFIG_WOLFSSL_SETTINGS_FILE is
authoritative and the module never layers Kconfig #defines over it. The
module-default block is shaped by build-profile knobs (WOLFSSL_CRYPTO_ONLY,
WOLFSSL_SINGLE_THREADED, which now defaults from !MULTITHREADING) plus new
classic-crypto/TLS/PQC feature knobs (RSA/ECC/ChaCha-Poly/Curve25519/SNI/
session-cache/session-ticket and ML-KEM/ML-DSA/LMS/XMSS/Falcon, each with
its memory-reduction "small" options). A consumer such as wolfPSA validates
its own requirements rather than the module injecting them.
- DRBG seeding: wc_GenerateSeed() on Zephyr draws seed material from the
hardware entropy driver when present (chunked to the entropy API's uint16_t
length, DT_HAS_CHOSEN-guarded) and falls back to sys_rand_get() otherwise;
HAVE_HASHDRBG stays guarded by WC_NO_HASHDRBG.
- z_time(): read the native_sim simulator RTC for a real wall clock on the
native targets regardless of libc.
Verified on native_sim/native/64 and nucleo_h743zi.
Summary
Extends the wolfSSL Zephyr module to support two coupled efforts: wolfPSA as Zephyr's PSA Crypto provider and the wolfSSL secure-sockets TLS backend.
What's included
Native RTOS threading
k_mutex/k_thread/k_condvardirectly, with no dependency onCONFIG_POSIX_THREADS;k_condvaruse is gated on the kernel version.WOLFSSL_SINGLE_THREADEDdefaults from!MULTITHREADING, so single-threaded kernels need no manual opt-in and consumers (wolfPSA) don't have to select it.zephyr/tests/wolfssl_condvarztest exercises the native condvar path, wired into CI.Configuration interface
CONFIG_WOLFSSL_SETTINGS_FILEis authoritative; the module never layers Kconfig#defines over it.WOLFSSL_CRYPTO_ONLY,WOLFSSL_SINGLE_THREADED) plus new classic-crypto / TLS / PQC feature knobs — RSA, ECC, ChaCha20-Poly1305, Curve25519, SNI, session cache/tickets, and ML-KEM / ML-DSA / LMS / XMSS / Falcon — each with its memory-reduction "small" option.HAVE_FIPS_VERSION 5/_MINOR 3with a KconfigchoiceunderWOLFCRYPT_FIPS(default v6). Version triples mirrorconfigure.ac's--enable-fips=mapping exactly. Also defines theHAVE_FIPSmaster switch, which was previously missing and left the version macros inert.DRBG seeding
wc_GenerateSeed()on Zephyr draws seed material from the hardware entropy driver when present (chunked to the entropy API'suint16_tlength,DT_HAS_CHOSEN-guarded), falling back tosys_rand_get().HAVE_HASHDRBGstays guarded byWC_NO_HASHDRBG.Misc
z_time()reads the native_sim simulator RTC for a real wall clock on native targets, regardless of libc.mem_track.hgains a ZephyrStackSizeCheckthat runs the benchmark in a measuredk_threadand reports high-water-mark stack usage.