Commit Graph
31378 Commits
Author SHA1 Message Date
Daniel Pouzzner 625f39f665 src/internal.c:
* in AllocKey capture and propagate the return of the per-type wc_*_init_ex
  calls (ed25519, ed448, falcon, ML-DSA, ML-KEM, ...) instead of discarding it,
  so an init failure surfaces rather than leaving a partially-constructed key
  for later use.

* The `default:` arm of the type switch now sets `ret = BAD_FUNC_ARG` and
  breaks, instead of returning directly, so it reaches the common cleanup.

* The failure cleanup distinguishes the two states: if the key was initialized,
  FreeKey(); otherwise XFREE(*pKey) and NULL the caller's pointer -- previously
  an allocation that failed before init leaked.

* Two mis-copied #endif comments corrected: HAVE_CURVE25519 -> HAVE_ED25519 and
  HAVE_CURVE448 -> HAVE_ED448.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner 1b5307345d wolfcrypt/src/hmac.c: in wc_HmacSetKey_ex reject WC_MD5 under HAVE_FIPS
(unversioned defined(HAVE_FIPS), not a version arm -- hmac.c is in-boundary and
master's copy only compiles at v7+/MAJOR=8). This structurally closes the
old-TLS MD5 PRF: wc_PRF_TLSv1 -> wc_PRF(md5_mac) -> wc_HmacSetKey(WC_MD5) ->
BAD_FUNC_ARG. Separately, in wc_HKDF_Expand_ex, add `else if (ret == 0) return
BAD_FUNC_ARG;` after the wc_HmacSizeByType call: the existing code guarded
ret < 0 but not ret == 0, and hashSz is the divisor in the
`outSz/hashSz + ((outSz % hashSz) != 0) > 255` check three lines below.

wolfcrypt/src/kdf.c: delete the two WC_HASH_TYPE_MD5_SHA guards in wc_PRF /
wc_PRF_TLS -- they were a domain error (that arg is wc_MACAlgorithm, where
WC_HASH_TYPE_MD5_SHA == 9 == sm3_mac, so the guard blocked SM3, not MD5-SHA),
and the hmac.c reject is the correct layer.

wolfcrypt/src/evp.c: drop the MD5 EVP mapping at FIPS >= 5 (evp.c is out of
boundary, so the version arm is live and correct here).

tests/api/test_kdf.c: derive secLen from MAX_PRF_HALF rather than hardcoding
521/261 -- MAX_PRF_HALF is config-dependent (516 under HAVE_FFDHE_8192, 388
under FFDHE_6144, else 260), so the hardcoded value made the BUFFER_E
expectation config-dependent.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner ec54a29570 wolfssl/wolfcrypt/cmac.h: add WC_CMAC_NONE = 0 to CmacType.
wolfcrypt/src/cmac.c: on _InitCmac_common failure free the Aes and set
cmac->type = WC_CMAC_NONE, so a contract-violating wc_CmacFree on a
never-initialized object hits a no-op arm instead of re-entering wc_AesFree;
add explicit case WC_CMAC_NONE arms to the three type switches
(wc_CmacUpdate, wc_CmacFree, wc_CmacFinalNoFree).
2026-08-05 13:53:45 -05:00
Daniel Pouzzner 290553f006 wolfcrypt/src/aes.c: in FIPS builds, reject ivSz < GCM_NONCE_MID_SZ (12) with
FIPS_BAD_VALUE_E in the GCM IV-construction paths under HAVE_FIPS, overridable
by WC_FIPS_AESGCM_ALLOW_SHORT_NONCES. Decrypt accepts any supported length per
SP 800-38D (IV construction requirements bind encryption only).

The floor takes two shapes, both correct by construction:
  - wc_AesGcmInit_local (reached from wc_AesGcmInit and
    wc_AesGcmEncryptInit_ex, which pass a decrypt_p flag):
        (ret == 0) && (! decrypt_p) && (ivSz > 0) && (ivSz < GCM_NONCE_MID_SZ)
    The `ivSz > 0` clause is load-bearing -- iv is an optional argument there,
    and the key-only re-init form (iv == NULL, ivSz == 0) used for
    module-generated-IV streaming must still pass.
  - wc_AesGcmSetIV / wc_AesGcmSetExtIV: bare `ivSz < GCM_NONCE_MID_SZ`, no
    ivSz>0 clause needed -- CheckAesGcmIvSize() already admits only {8,12,16},
    so ivSz == 0 cannot reach the floor.

tests/api/test_aes.c: update tests for new FIPS nonce size restrictions.

.wolfssl_known_macro_extras: add WC_FIPS_AESGCM_ALLOW_SHORT_NONCES.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner 71d48cf22d wolfcrypt/src/ecc.c: pull in wolfssl/wolfcrypt/wc_compat.h for wc_AesGcmEncrypt() remapping if needed. 2026-08-05 13:53:45 -05:00
Daniel Pouzzner eedceef23d wolfssl/wolfcrypt/dh.h, wolfcrypt/src/dh.c: add wc_dh_enable/disable/
is_enabled, WC_DH_INITIAL_RUNTIME_ENABLEMENT, WC_DH_HAVE_RUNTIME_ENABLEMENT.
Place the enablement check AFTER key->heap/trustedGroup init in the five entry
points (wc_InitDhKey_ex, wc_DhGenerateKeyPair, wc_DhAgree, wc_DhAgree_ct,
_DhSetKey) so a disabled-DH early return never leaves a half-initialized key for
wc_FreeDhKey to mp_clear on garbage.

configure.ac: add --enable-dh=conditional; when DH is enabled (directly or via
all-crypto) set it initially usable under FIPS v7 with
-DWC_DH_INITIAL_RUNTIME_ENABLEMENT=1; remove the FIPS-v7 DH force-off (in FIPS
v7+, disable build by default, unless building in kernel mode with DH
registration enabled).

linuxkm/lkcapi_glue.c: bracket LKCAPI registration with
`need_dh_disable = (wc_dh_enable() == 0)` ... `if (need_dh_disable)
wc_dh_disable();`, so DH is disabled on every exit path, and only by the caller
that actually enabled it (wc_dh_enable returns ALREADY_E if DH was already on,
so this never disables a DH some other context legitimately enabled).

tests/unit.c, wolfcrypt/test/test.c: bracket the DH tests with enable/disable so
they succeed regardless of runtime initial default enablement.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner df972c5266 wolfcrypt/test/test.c: fix PRIVATE_KEY_UNLOCK() call placement to assure unconditional matching of PRIVATE_KEY_UNLOCK() regardless of intervening error code collection. 2026-08-05 13:53:45 -05:00
Daniel Pouzzner be988c508d tests/unit.h: pull in wolfssl/wolfcrypt/fips_test.h, for the WOLFSSL_FIPS_DEV_NO_POST stubs. 2026-08-05 13:53:45 -05:00
Daniel Pouzzner c7a2c6c46d configure.ac: add --enable-fips=dev-no-post (WOLFSSL_FIPS_DEV_NO_POST, MAJOR=8)
and AM_CONDITIONAL BUILD_FIPS_NO_POST. Refactor FIPS dev/ready version setup:
hoist ENABLED_FIPS_DEV / ENABLED_FIPS_READY to set -DWOLFSSL_FIPS_DEV /
-DWOLFSSL_FIPS_READY centrally, and switch the FIPS AS_CASE arms from
`test "$FIPS_VERSION" != "dev"` to `test "$ENABLED_FIPS_DEV" != "yes"` so the
dev semantics extend to v5-dev/v6-dev/lean-aesgcm-dev.

src/include.am: under !BUILD_FIPS_NO_POST, drop fips.c / fips_test.c /
wolfcrypt_first.c / wolfcrypt_last.c from the build (dev-no-post uses no fips
repo content).

wolfssl/wolfcrypt/settings.h, wolfssl/wolfcrypt/wc_compat.h: under
WOLFSSL_FIPS_DEV_NO_POST, squat WOLF_CRYPT_FIPS_H to inhibit fips.h, and change
the FIPS_READY/DEV version block guard to `!defined(HAVE_FIPS_VERSION)`
(required so an externally supplied version is not clobbered).

wolfssl/wolfcrypt/fips_test.h: add WOLFSSL_FIPS_DEV_NO_POST stub block
(fipsCastStatus_get, the PRIVATE_KEY macros) so master builds without the fips
repo.

linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c: accommodate
WOLFSSL_FIPS_DEV_NO_POST (guard verifyCore / CAST / fencepost paths that the
fips repo would otherwise provide; force WC_USE_PIE_FENCEPOSTS_FOR_FIPS).

wolfcrypt/test/test.c: in hmac_sha256_test(), don't expect HMAC_KAT_FIPS_E in
WOLFSSL_FIPS_DEV_NO_POST builds.

wolfssl/wolfcrypt/types.h: add stub macro for
wolfCrypt_SetPrivateKeyReadEnable_fips() when WOLFSSL_FIPS_DEV_NO_POST.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner 46fb6b804d wolfcrypt/src/*.c: define WC_FIPS_LL_CRYPTO in FIPS-controlled sources before
including libwolfssl_sources.h, replacing the previous per-file `#define
FIPS_NO_WRAPPERS` that was placed *after* the include and therefore never took
effect. Low-level crypto TUs stop carrying a per-file opinion about wrapper
generation; settings.h now derives FIPS_NO_WRAPPERS centrally. des3.c and
wolfentropy.c newly acquire FIPS_NO_WRAPPERS (they had none). port/st/stm32.c
converts to the same idiom (drops its HAVE_CONFIG_H/config.h + redundant types.h
block).

Note on scope: FIPS_NO_WRAPPERS governs how the *including* TU resolves its own
outbound calls -- it does not change what the file makes available to others,
beyond defining the FIPS-supported APIs without the `_fips()` extension the
wrappers arrange. The pre-existing effect of the misplacement was that
boundary-internal calls resolved to the wrapped forms, i.e. took an unintended
round-trip back out through the wrappers.

wolfssl/wolfcrypt/settings.h: derive FIPS_NO_WRAPPERS from
(WC_FIPS_LL_CRYPTO || WOLFSSL_FIPS_DEV_NO_POST) under HAVE_FIPS, positioned
after the config-source selection so it sees HAVE_FIPS regardless of whether it
arrived via command line or user_settings.h.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner 9d58c99605 wolfssl/wolfcrypt/libwolfssl_sources_asm.h: define BUILDING_WOLFSSL_ASM when not
already set, so settings.h can distinguish assembly translation units.

wolfssl/wolfcrypt/settings.h: in the config-source selection, when
BUILDING_WOLFSSL_ASM && WOLFSSL_USER_SETTINGS_ASM, include user_settings_asm.h
(the assembly-safe, directives-only header produced by user_settings_asm.sh)
instead of user_settings.h, which may contain C that breaks the assembler.

wolfcrypt/src/aes_asm.S: drop the file's bespoke copy of the user_settings_asm.h
selection block and route through libwolfssl_sources_asm.h, so the choice lives
in one place. (aes_asm.S is the only .S that open-coded this.) Also add `#define
WC_FIPS_LL_CRYPTO` immediately above the new include.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner afc43cd6d8 wolfssl/wolfcrypt/error-crypt.h, wolfcrypt/src/error.c: add FIPS_BAD_VALUE_E
"Supplied value was rejected by FIPS policy" and FIPS_UNAPPROVED_E "Requested
operation succeeded, but supplied parameters are unapproved for FIPS".  The
first is a new fatal error, the second is a new nonfatal error to which
WC_FIPS_NOT_APPROVED will be bound.
2026-08-05 13:53:45 -05:00
Daniel Pouzzner 6e2b6f676c m4/ax_linuxkm.m4: in the AX_SIMD_CC_COMPILER_FLAGS setup, drop the -mavx and
-mavx2 AX_APPEND_COMPILE_FLAGS. gcc emits AVX instructions unbidden under those
flags (e.g. for 128-bit types) in code paths that cannot be runtime-dispatched
on cpuid, leading to invalid-opcode crashes on CPUs lacking AVX (e.g. Westmere).
2026-08-05 13:53:45 -05:00
David GarskeandGitHub e5b3fb118e Merge pull request #11046 from yosuke-wolfssl/fix/f_7352
Zero EncryptedInfo in ProcessChainBufferCRL and reset info->set on parse
2026-08-05 08:49:18 -07:00
David GarskeandGitHub 556b969195 Merge pull request #11045 from yosuke-wolfssl/fix/f_7522
Declare QUIC record length from bytes remaining
2026-08-05 08:47:18 -07:00
David GarskeandGitHub 589b98ff47 Merge pull request #10957 from SparkiDev/arm32_cpuid_flags
ARM32 assembly: Get CPU Id flags to choose assembly.
2026-08-05 07:34:34 -07:00
Tobias FrauenschlägerandGitHub 3072278489 Merge pull request #10942 from LinuxJedi/add-agents-md
Add integrator-focused AGENTS.md and CLAUDE.md
2026-08-05 14:19:25 +02:00
Tobias FrauenschlägerandGitHub b6ae49ce66 Merge pull request #11056 from padelsbach/f7398-mldsa-param-checks
F-7398: add checking in MLDSA
2026-08-05 10:33:46 +02:00
Yosuke Shimizu f6bd188eee Declare QUIC record length from bytes remaining 2026-08-05 14:12:26 +09:00
David GarskeandGitHub 11f79806d1 Merge pull request #11032 from SparkiDev/mldsa_avx512
ML-DSA AVX512: Add new assembly
2026-08-04 22:01:36 -07:00
Sean Parkinson 4444e0cf26 ARM32 assembly: Get CPU Id flags to choose assembly.
Added flag determination for Linux/Android/BSD/Windows/privilege-mode.
Made AES and SHA-256 runtime dispatch.
Updated the ARM32 assembly to support having multiple implementations compiled
in.
2026-08-05 14:45:19 +10:00
David GarskeandGitHub bcabc30fee Merge pull request #11054 from sebastian-carpenter/socket-errors
fix SOCKET_INVALID for linux
2026-08-04 21:25:02 -07:00
Sean Parkinson 8d38984b92 ML-DSA AVX512: Add new assembly
Add implementation of assembly code for AVX512F/BW and AVX512F/BW/VBMI.
Improvements to AVX2 assembly.
Check AVX512BW CPU id flag for base AVX512 assembly for ML-KEM.
2026-08-05 14:08:25 +10:00
Yosuke Shimizu 9909d0226c Zero EncryptedInfo in ProcessChainBufferCRL and reset info->set on parse 2026-08-05 13:02:45 +09:00
David GarskeandGitHub 744951a47b Merge pull request #11034 from night1rider/asu-trng-fixes
Xilinx Versal Gen2 ASU port: trng/wait update
2026-08-04 20:57:21 -07:00
David GarskeandGitHub aa0d44dac5 Merge pull request #11030 from cconlon/csrExtCritical
Encode basicConstraints critical flag and pathlen into generated CSRs
2026-08-04 20:52:21 -07:00
David GarskeandGitHub 90d57ef824 Merge pull request #11043 from SparkiDev/curve25519_avx2
X25519/Ed25519 assembly: AVX512 IFMA
2026-08-04 20:48:58 -07:00
David GarskeandGitHub 34d0a01089 Merge pull request #11040 from embhorn/zd22271
Correct partial-block guards in wc_AesCcmDecrypt
2026-08-04 20:19:10 -07:00
David GarskeandGitHub e51c06e0a6 Merge pull request #10983 from Frauschi/zephyr_fixes
Zephyr: wolfSSL module support for the wolfPSA provider and native RTOS use
2026-08-04 20:04:25 -07:00
David GarskeandGitHub b802e461d8 Merge pull request #10955 from padelsbach/curve25519-cryptocb-only-full
Extend curve25519 crypto cb and cb-only for footprint savings
2026-08-04 18:46:35 -07:00
David GarskeandGitHub 5f272267c0 Merge pull request #10901 from Frauschi/slhdsa_tls_handshake
Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake
2026-08-04 18:46:01 -07:00
David GarskeandGitHub 0ffedd2b69 Merge pull request #10971 from LinuxJedi/se050_applet72_ecdh
SE050: create ECDH derive target object for applet 7.2 middleware
2026-08-04 17:35:23 -07:00
David GarskeandGitHub 36c35c9a49 Merge pull request #11007 from kareem-wolfssl/zd22219
Fix a couple of issues in DTLS ClientHello parsing.
2026-08-04 17:21:39 -07:00
Paul Adelsbach 5d46b4bfe6 Add additional MLDSA checks 2026-08-04 17:02:54 -07:00
Paul Adelsbach 693e4354a3 F-7398: add checks in MLDSA 2026-08-04 16:33:33 -07:00
David GarskeandGitHub d6708600a2 Merge pull request #11027 from Frauschi/fenrir_2
Fixes for OCSP stapling, cert manager, and certificate_status_request_v2 handling
2026-08-04 15:54:59 -07:00
David GarskeandGitHub 684e06df00 Merge pull request #10991 from padelsbach/ccache-init-seed-settings
CI: set ccache path so settings are saved on initial seed
2026-08-04 15:54:14 -07:00
Paul Adelsbach e40f8d8f22 PR feedback: add missing strings and precompiler checks 2026-08-04 14:36:11 -07:00
Tobias FrauenschlägerandGitHub 039d689809 Merge pull request #10975 from aidangarske/x509-tiny-ci
Move WOLFSSL_X509_TINY test to the unit test suite and run
2026-08-04 23:28:52 +02:00
sebastian-carpenter e0dc428a0f fix SOCKET_INVALID for linux 2026-08-04 15:18:45 -06:00
Tobias Frauenschläger 54a71e4a52 Add stack tracking to zephyr benchmark 2026-08-04 23:04:29 +02:00
Tobias Frauenschläger ac75f181cd Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake
Implement SLH-DSA (SPHINCS+, FIPS 205) as an entity authentication
algorithm for the TLS 1.3 and DTLS 1.3 handshake, following
draft-reddy-tls-slhdsa. All twelve parameter sets (SHAKE and SHA2 families,
128/192/256 in the f and s variants) are wired into the handshake for
signing and verifying the CertificateVerify message; test certificates and
configs cover the 128f and 128s sets.

Handshake integration:
- Map the SLH-DSA signature schemes to and from the wire in the
  signature_algorithms extension and CertificateVerify. The mapping,
  advertisement, and OID handling are gated per parameter set so a build
  only offers, accepts, and maps the variants actually compiled in
  (including partial SHA2 builds).
- Sign and verify the CertificateVerify with an SLH-DSA entity key, and
  load SLH-DSA private keys and certificates (ssl_load.c, ssl.c,
  ssl_api_pk.c, asn.c).
- Preserve the verify return code on a failed SLH-DSA CertificateVerify
  rather than flattening every non-zero result to SIG_VERIFY_E.
  wc_SlhDsaKey_Verify already returns SIG_VERIFY_E on a real mismatch, so
  the failure semantics are unchanged while WC_PENDING_E (async crypto
  callbacks) and hard errors now propagate, matching ML-DSA and Falcon.

Protocol version gating:
- SLH-DSA is defined for TLS 1.3 only, so the schemes are no longer offered
  to a TLS 1.2 peer, and MatchSigAlgo and PickHashSigAlgo pin an SLH-DSA
  certificate both to the scheme for its exact parameter set and to
  TLS 1.3.
- Reject a Falcon, ML-DSA or SLH-DSA key in the TLS 1.2 CertificateVerify
  with SIG_TYPE_E. No signature scheme below TLS 1.3 covers a post-quantum
  key, the record is reserved for a classic signature, and the signing
  switches have no post-quantum case, so continuing would have sent the
  reserved buffer's uninitialized tail.

Streamed CertificateVerify send:
- SLH-DSA signatures are large (up to ~50 KB). When the CertificateVerify
  body exceeds a single record, generate the signature into a
  connection-level buffer and emit it one record at a time so the output
  buffer never has to hold the whole signature. This keeps peak memory near
  one signature plus a single fragment and resumes correctly across a
  non-blocking WANT_WRITE without recomputing the randomized signature.
  Gated by WOLFSSL_TLS13_STREAM_CERT_VERIFY (TLS 1.3, non-async, PQC
  signatures); DTLS and WOLFSSL_ASYNC_CRYPT keep the existing in-place
  fragmented path.
- Drop a half-sent streamed CertificateVerify in wolfSSL_clear. Left in
  place, the resume guard would fire on the next handshake and re-send the
  previous one's signature into a different transcript.
- Dual-algorithm (WOLFSSL_DUAL_ALG_CERTS, BOTH) CertificateVerify bodies are
  streamed as well. The combined two-signature body may include a
  variable-length signature, so the body buffer is sized from the
  per-signature upper bounds and the exact length is recorded after signing;
  the small trailing slack is never sent.

Buffer sizing:
- Keep MAX_X509_SIZE a fixed 9 KB for post-quantum builds. It sizes a
  static per-certificate slot embedded by value in every cached session, so
  it must not scale with a post-quantum signature; nor may it derive from
  the enabled ML-DSA level, or a level-restricted build would silently drop
  certificates that a full build keeps.
- Add MAX_CERT_WIRE_SZ for the largest certificate that may appear in a
  handshake message, sized from the enabled post-quantum signatures, and
  derive MAX_CERTIFICATE_SZ from it instead of from MAX_X509_SIZE.
- Add MAX_CERT_MSG_DEPTH for the chain depth assumed when sizing the
  certificate message. MAX_CHAIN_DEPTH bounds how deep a chain may be
  verified, while this sizes a buffer an unauthenticated peer can make us
  allocate, so it is trimmed to 5 when a post-quantum certificate has
  inflated the per-certificate size. Classic builds are unchanged.
- Size the CertificateVerify buffers from the actual signature length
  instead of the worst-case WC_MAX_CERT_VERIFY_SZ, which balloons with
  SLH-DSA. WC_MAX_CERT_VERIFY_SZ is retained for API compatibility and its
  growth is documented in README.md.
- Order Scv13Args widest member first so it carries no interior padding and
  still fits ssl->async->args under WOLFSSL_ASYNC_CRYPT together with
  WOLFSSL_DUAL_ALG_CERTS.

Dual-algorithm certificates:
- Reserve the two signature length prefixes in the in-place
  CertificateVerify sizing that the streamed path already accounted for.
- Build the PreTBS for an alternative signature check from the certificate
  size minus both signatures, and retry once at a size the canonical
  re-encode cannot exceed when that estimate turns out short. The estimate
  keeps the allocation small on constrained targets, and wc_GeneratePreTBS
  reports an encoder failure as WOLFSSL_FAILURE, which is zero, so a
  non-positive result is now an error instead of silently skipping
  ConfirmSignature and reading as a verified signature.

Device held private keys:
- Support an SLH-DSA private key that lives in a device and is referenced
  by id or label. The parameter set cannot be recovered from a device side
  identifier, so it is carried from the key type down to
  wc_SlhDsaKey_Init_id and wc_SlhDsaKey_Init_label, and the key is released
  with wc_SlhDsaKey_Free once the certificate and key pair is checked.

Robustness:
- Check the SlhDsaParamToType, wc_SlhDsaKey_PublicSizeFromParam and
  wc_SlhDsaParamToOid results in the certificate and key load paths.
- Zeroize an SLH-DSA key before wc_SlhDsaKey_Init, which can return
  NOT_COMPILED_IN before it clears the object, in both the certificate load
  path and AllocKey.
- Take the alternative key's parameter set from the certificate's sapkiOID
  rather than keyOID, which describes the native key.
- Re-initialise across hash families in wc_SlhDsaKey_PublicKeyDecode as
  wc_SlhDsaKey_PrivateKeyDecode already does. The hash objects share a union
  selected by family, so importing across families writes the new family's
  state over the old one's and orphans it.
- Copy pkCurveOID in SetSSL_CTX when only SLH-DSA is enabled, matching the
  struct member guard. Without it the field stayed zero and the signature
  scheme matching above was dead in exactly that build.
- Derive the per parameter set WOLFSSL_SLHDSA_PARAM_NO_* macros from the
  group level exclusions, and select WC_SLHDSA_DEFAULT_PARAM with those
  same macros, so the parameter table and the TLS mappings cannot disagree.
- Add SLH-DSA to the lean build WOLFSSL_MAX_SIGALGO carve-out, since twelve
  more entries no longer fit the small list.
- Prefix the new SLHDSA_ALL_NO_* macros in the installed header with WC_.

Tests and certificates:
- Add SLH-DSA entity (client and server) certificates for the SHAKE and
  SHA2 128f and 128s parameter sets, and update the generation script.
- Add TLS 1.3 and DTLS 1.3 entity-cert CertificateVerify test configs
  covering the fragmented (128f) and single-record (128s) send paths for
  both hash families, wired into suites.c. These sign with the entity key,
  so they are excluded from verify-only builds.
- Interrupt the streamed CertificateVerify with one WANT_WRITE and with
  several on the same record, and assert the handshake still completes and
  re-emits identical bytes, which the blocking .conf handshakes never
  exercise. The record to interrupt is counted first, because the server's
  record batching differs between builds. Where the flight is flushed as a
  single write the send is retried below SendTls13CertificateVerify, so
  these do not by themselves cover the fragOffset resume path.
- Drive the streamed path with an ML-DSA leaf under a negotiated
  max_fragment_length, covering it for a non SLH-DSA algorithm.
- Reject a TLS 1.2 handshake that presents an SLH-DSA client certificate.
- Map every compiled-in scheme from its wire code point to the key OID, and
  extend the exhaustive SaToNid coverage with the twelve new algorithms.
- Accept an SLH-DSA private key referenced by id and by label.

Build configuration:
- configure.ac: --enable-slhdsa now keeps the certificate/ASN code enabled
  (as --enable-mldsa does), so an SLH-DSA-only build with RSA, ECC and DH
  disabled configures instead of erroring that ASN is off.
- Guard the WOLFSSL, WOLFSSL_CTX and WOLFSSL_X509 pkCurveOID members for
  WOLFSSL_HAVE_SLHDSA, so an SLH-DSA-only build declares the field the
  handshake and CopyDecodedToX509 already reference under an SLH-DSA guard.
- Mark checkKeySz used in the SLH-DSA branch of ProcessBufferCertPublicKey;
  SLH-DSA is the only certificate signature algorithm with no minimum-size
  check, so an SLH-DSA-only build otherwise tripped -Wunused-parameter.
- Propagate haveSlhDsaSig in wolfSSL_set_SSL_CTX, which copied the Falcon
  and ML-DSA flags but not the SLH-DSA one.
- CI: add a SHA2-only SLH-DSA build (--enable-slhdsa=sha2) so the
  SHAKE-disabled combined-maxima guards are exercised, and an async crypto
  build with dual-algorithm certificates, which is the only configuration
  that compiles the in-place fragmented CertificateVerify send.
2026-08-04 22:23:03 +02:00
Aidan Garske 82cf3d8947 Add x509 tiny certificate test coverage 2026-08-04 12:21:25 -07:00
Paul Adelsbach 1c9ebe1af6 PR feedback: use instead of duplicating path 2026-08-04 12:06:11 -07:00
Tobias Frauenschläger 044f08c0ea Zephyr: wolfSSL module support for the wolfPSA provider and native RTOS 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.
2026-08-04 20:53:36 +02:00
David GarskeandGitHub e100f72548 Merge pull request #10938 from yosuke-wolfssl/fix/f_6767
Avoid writing into caller ikm buffer in wc_Tls13_HKDF_Extract
2026-08-04 10:43:24 -07:00
David GarskeandGitHub 5d5199b01e Merge pull request #10937 from embhorn/zd22160
Fix PKCS7 SignerIdentifier SKID to implicit [0] tagging
2026-08-04 10:33:15 -07:00
David GarskeandGitHub 3656306dd4 Merge pull request #10930 from julek-wolfssl/fenrir-wolfcrypt-tls-fixes
wolfCrypt and TLS 1.3 correctness fixes (F-1376, F-2653, F-1972, F-4593)
2026-08-04 10:31:44 -07:00
David GarskeandGitHub 7e5610debf Merge pull request #10911 from rizlik/der_import_trusted
wolfssl: expose trusted argument in ed25519/ed448 der export
2026-08-04 10:29:42 -07:00
David GarskeandGitHub 0fb71c572f Merge pull request #10949 from SparkiDev/aes_asm_gcm_tables_fixup
AES asm: Add GCM 8-bit tabl, fixes
2026-08-04 09:48:30 -07:00