Skip to content

Zephyr module: wolfPSA provider support + POSIX-free native threading - #32

Closed
Frauschi wants to merge 2 commits into
masterfrom
zephyr_fixes
Closed

Frauschi wants to merge 2 commits into
masterfrom
zephyr_fixes

Conversation

@Frauschi

Copy link
Copy Markdown
Owner

Downstream Zephyr integration fixes carried on zephyr_fixes (vs master).
Five commits, in two themes plus a native_sim time fix.

wolfPSA PSA-provider enablement

  • acbd93526 support wolfPSA as the PSA Crypto provider under CONFIG_WOLFPSA: share one wolfCrypt config between the module and wolfPSA, and compile the extra sources wolfPSA needs (ascon, xmss), all gated on CONFIG_WOLFPSA so the stock TLS build is unaffected.
  • a7ded24e9 the module's user_settings.h now lets the USER drive the wolfCrypt config (their CONFIG_WOLFSSL_SETTINGS_FILE, else the wolfPSA default feature set) and applies the wolfPSA structural baseline on top in both cases.

Native Zephyr threading without POSIX

  • 8ae3d20ee a non-SINGLE_THREADED wolfCrypt build on Zephyr used to require CONFIG_POSIX_THREADS/CONFIG_PTHREAD_IPC via a hard #error, even though mutexes and thread creation were already native. Drop the #error; back wolfSSL_Mutex/threads/condvars with native k_mutex/k_thread/k_condvar from <zephyr/kernel.h>, and pull the POSIX pthread shims only when the app actually enables the POSIX layer. Adds a native k_condvar COND_TYPE + WOLFSSL_COND and implements the six wolfSSL_Cond* functions, plus a zephyr/tests/wolfssl_condvar ztest.
  • 56cf493ac gate WOLFSSL_COND on KERNEL_VERSION_NUMBER >= 0x20400 (k_condvar was introduced in Zephyr 2.4), so pre-2.4 targets build without condition variables exactly as before.

native_sim time

  • 4ea9ac70f read the native simulator RTC in z_time() regardless of libc, so ASN.1 certificate date validation has a real wall clock in simulation.

Validation

  • Full wolfcrypt test suite passes on the POSIX path (wolfssl_test).
  • A no-POSIX multi-threaded build exercises native k_mutex/k_thread/k_condvar (wolfssl_condvar ztest: producer/consumer handshake + NULL guards).
  • wolfSSL Zephyr CI matrix (2.7.4 / 3.4.0 / 3.5.0 / 4.x) is all >= 2.4; verified k_condvar is present with a matching API in the v2.7.4 kernel headers.

Pairs with the wolfPSA module changes (separate repo/PR).

Comment thread wolfssl/wolfcrypt/wc_port.h Outdated
Comment thread wolfssl/wolfcrypt/wc_port.h Outdated
Comment thread zephyr/tests/wolfssl_condvar/testcase.yaml
Comment thread zephyr/CMakeLists.txt Outdated
Comment thread zephyr/user_settings.h
Comment thread wolfssl/wolfcrypt/wc_port.h Outdated
Comment thread zephyr/Kconfig Outdated
Comment thread zephyr/CMakeLists.txt Outdated
Comment thread zephyr/tests/wolfssl_condvar/testcase.yaml Outdated
Comment thread zephyr/Kconfig
Comment thread zephyr/user_settings.h
Comment thread zephyr/user_settings.h
Comment thread zephyr/user_settings.h
Comment thread zephyr/user_settings.h
Comment thread zephyr/user_settings.h Outdated
Comment thread zephyr/user_settings.h Outdated
Comment thread zephyr/user_settings.h
Comment thread zephyr/Kconfig Outdated
Comment thread zephyr/Kconfig Outdated
Comment thread zephyr/user_settings.h Outdated
Comment thread zephyr/user_settings.h Outdated
Comment thread zephyr/user_settings.h Outdated
Comment thread zephyr/user_settings.h
Comment thread zephyr/zephyr_init.c Outdated
@Frauschi
Frauschi force-pushed the zephyr_fixes branch 3 times, most recently from 667dd58 to 92c96b4 Compare July 23, 2026 15:43
Frauschi added 2 commits July 23, 2026 18:46
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant