1
0
mirror of https://github.com/wolfSSL/wolfssl.git synced 2026-10-24 04:09:07 +03:00
Commit Graph

34259 Commits

Author SHA1 Message Date
Tobias Frauenschläger
9bfeaff061 Merge pull request #11765 from Arpan0995/mldsa-initid-setparams
ML-DSA: set the device key level in InitId/InitLabel only on success
2026-10-16 10:06:08 +02:00
Tobias Frauenschläger
68d83d2a7f Merge pull request #11496 from SparkiDev/aarch64_asm_fixup_1
AArch64 assembly: branch instructions
2026-10-16 08:46:03 +02:00
Tobias Frauenschläger
5e7fc2203d Merge pull request #11749 from twcook86/ghs_guard_for_arch_extension
Exclude .arch_extension directive from ghs builds.

CI failure is unrelated.
2026-10-16 08:36:56 +02:00
Tobias Frauenschläger
47367df731 Merge pull request #11764 from Arpan0995/tls13-x25519-zero-secret-alert
TLS 1.3: send illegal_parameter for an all-zero X25519 shared secret.

Failing CI test is unrelated.
2026-10-16 08:22:25 +02:00
philljj
9f16d3bb98 Merge pull request #11642 from Arpan0995/mldsa-getlen-null-len
ML-DSA: return BAD_FUNC_ARG for a NULL len in the key length getters
2026-10-15 23:26:48 -05:00
philljj
28ab51bb1d Merge pull request #11769 from douzzer/20261015-linuxkm-AES-XTS-NI-fix
20261015-linuxkm-AES-XTS-NI-fix
2026-10-15 22:13:40 -05:00
philljj
eb113cac67 Merge pull request #11547 from padelsbach/cbonly-lmsxmss
Add CB_ONLY mode for LMS+XMSS, add swdev
2026-10-15 17:01:48 -05:00
Tobias Frauenschläger
4da3ecb35a Merge pull request #11736 from dgarske/mldsa_weak_prehash
Add build-time option to support for weak pre-hash with ML-DSA. 

CI failure is unrelated.
2026-10-15 23:31:36 +02:00
Daniel Pouzzner
f3ac849ff2 linuxkm/lkcapi_aes_glue.c: enable WC_LINUXKM_XTS_NO_AESNI only if neither WC_C_DYNAMIC_FALLBACK nor WC_SVR_USE_NATIVE_REG_BUFS. 2026-10-15 15:22:02 -05:00
philljj
e6bc824748 Merge pull request #11718 from holtrop-wolfssl/rust-updates-2026-10-12
Rust updates 2026-10-12
2026-10-15 14:59:30 -05:00
Thomas Cook
1f05bcdcd8 Address pr comments 2026-10-15 14:09:42 -04:00
Arpan Sharma
2aba76ba69 TLS 1.3: map an all-zero X25519 result from an async completion too
With non-blocking X25519 and an async device, the shared secret pends
and its result comes back through wolfSSL_AsyncPop() in
DoTls13ServerHello() and DoTls13ClientHello(), so an all-zero result
skipped the conversion in TLSX_KeyShare_ProcessX25519_ex() and no
alert was sent. Apply the same conversion at those two pops when the
completed operation belongs to an X25519 key.

Run the low-order key share cases again with an async device when
WOLFSSL_ASYNC_CRYPT is defined.
2026-10-15 12:32:26 -05:00
philljj
d139ee0c3a Merge pull request #11750 from sebastian-carpenter/ecc-mutex-fix
fix mutex wrapping for some ecc key exports
2026-10-15 12:29:33 -05:00
Arpan Sharma
f75fbe2cdd ML-DSA: set the device key level in InitId/InitLabel only on success
wc_MlDsaKey_InitId() and wc_MlDsaKey_InitLabel() called
wc_MlDsaKey_SetParams(key, WC_ML_DSA_87) even when their argument
check had failed and the key was never initialized, and ignored its
return value. With ML-DSA-87 compiled in (the default), an argument
error wrote into the caller's uninitialized object, and with the
WC_MLDSA_CACHE_* options or WOLFSSL_MLDSA_DYNAMIC_KEYS it zeroized and
freed whatever pointers that memory held. In builds without
ML-DSA-87 the call failed, so InitId and InitLabel returned 0 with no
parameter set.

Call SetParams only when the key was initialized, return its result,
and use the highest level compiled in, as wc_falcon_init_id() and
wc_falcon_init_label() do with FALCON_MAX_LEVEL.
2026-10-15 11:28:31 -05:00
philljj
a177ac8c6d Merge pull request #11549 from kareem-wolfssl/zd22505
Free old peerSigSpec pointer before allocating. Add length checks for DSA Q buffer in EVP layer.
2026-10-15 11:00:29 -05:00
Arpan Sharma
de63c4ec57 TLS 1.3: send illegal_parameter for an all-zero X25519 shared secret
When the X25519 part of a key share gives an all-zero shared secret,
wc_curve25519_shared_secret_ex() returns ECC_OUT_OF_RANGE_E, and
TLSX_KeyShare_ProcessX25519_ex() passed it on unchanged.
TranslateErrorToAlert() has no case for that code, so a TLS 1.3
handshake was aborted without an alert. Map it to ECC_PEERKEY_ERROR,
as a failed public key check already is, so that an illegal_parameter
alert is sent, as RFC 10024 Section 4.3 requires for the hybrid
groups.

Extend test_tls13_mlkem_bad_key_share with an order-8 X25519 point in
the X25519MLKEM768 ClientHello and ServerHello and in a plain X25519
ServerHello.
2026-10-15 10:55:18 -05:00
David Garske
fa565101ab mldsa: add WOLFSSL_MLDSA_ALLOW_WEAK_PREHASH for SHA-256-only TPM firmware 2026-10-15 08:26:38 -07:00
philljj
3a45cc02e6 Merge pull request #11682 from padelsbach/byteray-med-x509
Compat layer: escape control characters in X509 print output
2026-10-15 09:42:49 -05:00
kaage
22ed3dc401 Merge pull request #11728 from ageprocpp/fix/fenrir-15886
Fix/fenrir 15886
2026-10-15 22:39:42 +09:00
Tobias Frauenschläger
f46cdde15b Merge pull request #11400 from julek-wolfssl/ca-store-loading-fixes
Thread the caller's verify setting into trusted-peer loads and parse multi-valued RDNs
2026-10-15 11:03:36 +02:00
Tobias Frauenschläger
2a5d2ec5eb Merge pull request #11465 from padelsbach/ossl-compat-issue-31
Check expiry for trusted certs
2026-10-15 11:02:42 +02:00
David Garske
bebfdc0293 Merge pull request #11747 from Frauschi/stm32_armasm_aes
Use the Arm AES assembly modes only when aes->key is its key schedule
2026-10-14 22:34:57 -07:00
philljj
72b7471544 Merge pull request #11661 from julek-wolfssl/compat-max-send-fragment
Add SSL_[CTX_]set_max_send_fragment()
2026-10-14 23:01:37 -05:00
Paul Adelsbach
9408cabd8b PR feedback: use XVALIDATE_DATE, remove early return, fix tests 2026-10-14 16:29:37 -07:00
Paul Adelsbach
a19f41c284 Check expiry for trusted certs 2026-10-14 16:27:43 -07:00
Kareem
4479a163fa Add CERT_BUFFERS guards to unit tests. 2026-10-14 16:22:36 -07:00
Kareem
599b8f5ab9 Add length checks for DSA Q buffer in EVP layer.
Thanks to Bright Zhu for the report.
2026-10-14 16:22:36 -07:00
Kareem
7512272c56 Free old peerSigSpec pointer before allocating to prevent overwriting it.
Thanks to Bright Zhu for the report.
2026-10-14 16:22:31 -07:00
Arpan Sharma
360f93b322 SLH-DSA: restore one-byte sigSz probe, sync Japanese doxygen
Go back to the one-byte sigSz probe for SignWithRandom() with a
(NULL, 0) message in test_wc_SlhdsaDecisionCoverage(), so the test
stays argument-check only. The signing path for (NULL, 0) is covered
in test.c.

Update the Japanese doxygen for SignDeterministic, SignWithRandom,
Sign and Verify to match the English header.
2026-10-14 15:27:59 -07:00
Arpan Sharma
d3c1d7a1fd SLH-DSA: update msg docs and empty-message tests per review
- Source comments: msg may be NULL if msgSz is 0 for the sign and
  verify functions, and Sign(), Verify() and slhdsakey_sign_external()
  reject a NULL msg only when msgSz is greater than 0.
- Doxygen: note on the msg parameter, and SignDeterministic() returns
  BAD_LENGTH_E for a too-small signature buffer.
- test.c: SignDeterministic() with (NULL, 0) must match the signature
  for a non-NULL message of length 0.
- test_slhdsa.c: SignWithRandom() with (NULL, 0) and a full-size
  signature buffer signs successfully.
2026-10-14 15:27:59 -07:00
Arpan Sharma
e0806fd809 SLH-DSA: accept (NULL, 0) message in SignWithRandom/SignDeterministic
wc_SlhDsaKey_SignWithRandom() rejected msg == NULL for any length, so it
and wc_SlhDsaKey_SignDeterministic() returned BAD_FUNC_ARG for an empty
message passed as (NULL, 0), unlike wc_SlhDsaKey_Sign() and Verify().
Use the same check as Sign() and, like Sign(), replace a NULL message
with a one-byte static stand-in before the crypto callback dispatch.
Update the doxygen and source comments, and add tests for the (NULL, 0)
case.
2026-10-14 15:27:59 -07:00
philljj
e802f848ee Merge pull request #11463 from kareem-wolfssl/gh11454
Add missing return code handling for mldsa_vec_expand_mask.
2026-10-14 17:09:16 -05:00
philljj
b8db127813 Merge pull request #11746 from Frauschi/bench_hbs_verify_only
Benchmark LMS, XMSS and SLH-DSA in verify-only builds
2026-10-14 16:02:40 -05:00
Emma Stensland
c102b31fde Test the ML-DSA key caches after small-mem key regeneration 2026-10-14 13:48:09 -07:00
Emma Stensland
265e5e5fba Check the ML-DSA inverse NTT input bound in the small-mem UBSan runs 2026-10-14 13:48:09 -07:00
Emma Stensland
9b4d350750 Stop small-mem ML-DSA keygen reducing an unwritten accumulator 2026-10-14 13:48:09 -07:00
Emma Stensland
50491a51b4 Build ML-DSA small-mem under fault hardening in the stack-size run 2026-10-14 13:48:09 -07:00
Emma Stensland
48ee35b831 Fix sword32 overflow before inverse NTT in ML-DSA small-mem 2026-10-14 13:48:09 -07:00
Emma Stensland
aa6c5b7e69 Fix ML-DSA small-mem scratch alignment 2026-10-14 13:48:09 -07:00
philljj
f29ef73831 Merge pull request #11692 from julek-wolfssl/tls13-ticket-nonce-per-connection
TLS 1.3: number session ticket nonces per connection
2026-10-14 15:29:24 -05:00
sebastian-carpenter
475571ff0b fix mutex wrapping for some ecc key exports 2026-10-14 13:11:45 -06:00
philljj
e9a8f62d6e Merge pull request #11181 from kareem-wolfssl/fbatch2
Fix multiple Fenrir issues
2026-10-14 12:31:25 -05:00
Thomas Cook
cc9e86cc40 back out the mlkem changes 2026-10-14 13:26:16 -04:00
Thomas Cook
ab4114de38 Exclude .arch_extension directive from ghs builds 2026-10-14 13:01:38 -04:00
Tobias Frauenschläger
61528edbd5 Build swdev on macOS
tests/swdev/Makefile localized every swdev symbol except the two entry
points with objcopy --keep-global-symbol, which macOS does not ship. On
Darwin, do the same with a second ld64 relocatable link and
-exported_symbol. The export check strips the Mach-O leading underscore
before comparing. The exported names now live in one SWDEV_EXPORTS list
that feeds both localization commands and the check.

The localization step is picked from configure's host_os rather than
uname, so cross-builds use the target's toolchain.

Add a macOS CI config that builds swdev with WOLF_CRYPTO_CB_ONLY_ED25519,
so make check depends on the ld64-localized swdev object.
2026-10-14 09:05:06 -07:00
philljj
fde1138bda Merge pull request #11367 from julek-wolfssl/chain-verify-cb
Add WOLFSSL_CHAIN_VERIFY_CB to replace peer chain verification
2026-10-14 10:16:45 -05:00
Tobias Frauenschläger
782235be7c Merge pull request #11709 from dgarske/imx95_ele
Add NXP EdgeLock Secure Enclave (ELE) crypto callback port with TRNG
2026-10-14 13:59:41 +02:00
Tobias Frauenschläger
32b62d94d5 Use the Arm AES assembly modes only when aes->key is its key schedule
The AES implementation chain at the top of aes.c picks one block cipher
backend, and the hardware ports ahead of WOLFSSL_ARMASM in it (STM32,
LTC, ...) store a raw key in aes->key. ECB, the software CTR mode, GCM
(subkey setup and the bulk encrypt/decrypt) and XTS tested
WOLFSSL_ARMASM directly, so with such a port and WOLFSSL_ARMASM both set
they ran the Arm assembly on the raw key and returned wrong output. On
STM32 this hit ECB and CTR (STM32 selects NEED_AES_CTR_SOFT), and GCM
wherever it falls back to software: WOLFSSL_STM32_BARE with a
non-12-byte IV, or parts without STM32_CRYPTO_AES_GCM. e31e158225 had
excluded STM32_CRYPTO for the GCM subkey only.

Define WC_AES_USE_ARMASM in the WOLFSSL_ARMASM branch of the chain and
test it in those places instead of WOLFSSL_ARMASM. The ports keep their
own block functions there, so ECB goes through wc_AesEncrypt() and
wc_AesDecrypt(), CTR through the port's block transform, GCM through
AES_GCM_encrypt_C() and AES_GCM_decrypt_C() (with IncrementGcmCounter()
now built for them on AArch64) and XTS through its software
implementation. The GHASH-only selectors keep WOLFSSL_ARMASM since they
only use H, and the AArch64 streaming GCM branches also require
use_aes_hw_crypto, which only the Arm assembly SetKey sets. This
replaces the STM32_CRYPTO exclusion from e31e158225. Builds that select
the Arm assembly backend are unchanged.

Tested on an STM32U585 (wolfDemo) with STM32 AES and HASH plus Thumb-2
assembly: the wolfCrypt test passes, including AES, AES-CTR, AES-GCM,
AES-CCM and CMAC. With STM32 AES, aes.o no longer references
AES_ECB_encrypt(), AES_ECB_decrypt() or AES_CTR_encrypt(). An AArch64
--enable-all --enable-armasm build passes the wolfCrypt test and unit
tests, and the same build with WC_AES_USE_ARMASM left undefined (as with
a port ahead of the Arm backend) now compiles and passes all AES tests,
including XTS and the streaming modes. Thumb-2 and AArch32
crypto-extension objects are unchanged.
2026-10-14 11:30:09 +02:00
Tobias Frauenschläger
69291355b6 Benchmark SLH-DSA SHA2-128s verify in verify-only builds
The verify-only SLH-DSA benchmark only had a SHAKE-128s vector, because
that is the only verify-only signature in wolfcrypt/test/test.c. Builds
with only the SHA2 parameter sets showed no SLH-DSA row at all.

Add a SHA2-128s vector: a deterministic, empty-context signature of
"Hello World!" by the existing bench_slhdsa_sha2_128s_key.der. It was
generated with OpenSSL 4.0.3; wolfSSL verifies it, rejects it once a
message bit is flipped, and its own deterministic signature from the
same key is byte-identical. gen-slhdsa-mldsa-certs.sh gains the step
that produces it, and a rerun reproduces the committed files. The pq-all
verify-only benchmark config enables sha2 and requires this row too.

bench_slhdsa_verify() now takes the parameter set and vector. The row
uses the full benchmark's name, SLH-DSA-SHA2-S, and takes its strength
from the public key size, as the full benchmark does. Verify-only
builds accept -slhdsa-sha2-128s when SHA2-128s is built.

Tested on the host with --enable-slhdsa=yes,sha2,verify-only on its
own, with --enable-smallstack and with --disable-rng, with sha2 only,
with SHAKE only and 192f only (no SHA2 row, no warnings), and with the
full sha2 build.
2026-10-14 10:59:13 +02:00
Tobias Frauenschläger
cfdf7bb831 Benchmark LMS, XMSS and SLH-DSA verify in verify-only builds
The benchmark measured LMS, XMSS and SLH-DSA verify only after
generating a key and signing with it, so a build with
WOLFSSL_LMS_VERIFY_ONLY, WOLFSSL_XMSS_VERIFY_ONLY or
WOLFSSL_SLHDSA_VERIFY_ONLY compiled the algorithm out of the benchmark
entirely. Targets that only check signatures, such as a boot loader
verifying an image, got no numbers at all.

Verify-only builds now time verify against a fixed vector: LMS
L1_H10_W8, XMSS-SHA2_10_256 and SLH-DSA-SHAKE-128s. The vectors are the
verify-only KATs already in wolfcrypt/test/test.c, stored as binary
files under certs/lms, certs/xmss and certs/slhdsa and emitted into
certs_test.h by gencertbuf.pl. The rows use the same names as the full
benchmark, and a parameter set without a vector, or one that is not
compiled in, is skipped. If loading the key fails, the failing call is
printed and no row is shown.

In a verify-only build, -lms_hss, -xmss_xmssmt(_sha256),
-slhdsa-shake128s and -slhdsa are accepted only when their vector
applies, and the other XMSS and SLH-DSA parameter options are rejected,
so no option silently runs nothing.

Verify needs no RNG, so the asymmetric result printing is built
whenever one of these vectors applies, also with WC_NO_RNG. A
verify-only build with no vector no longer counts as an asymmetric
algorithm. This also fixes an LMS verify-only build with no other
asymmetric algorithm, which failed -Werror on master with an unused
bench_stats_asym_finish(). The SRTP-KDF, scrypt and Argon2 benchmarks
also call it, so it is now built for them too: on master each of them
failed to compile with no asymmetric algorithm, which an LMS
verify-only build used to hide.

The benchmark exits 0 even when verify fails, so a new pq-all CI config
builds all three verify-only with no other asymmetric algorithm and
-Werror=unused-function, runs the benchmark, and fails on any reported
benchmark error, such as a key that does not import, or on a missing
verify row.

Tested on the host with --enable-{lms,xmss,slhdsa}=yes,verify-only on
its own, with --enable-smallstack, with --disable-rng, and with
--enable-all-crypto; with edge configurations where no vector applies
(SLH-DSA 192f only, LMS max height 5, XMSS min hash size 512), both
with --disable-rng and with RNG but no other asymmetric algorithm; with
SRTP-KDF, scrypt or Argon2 as the only such user, with and without an
RNG and with LMS verify-only; and
with --enable-all and the full LMS/XMSS/SLH-DSA build, whose benchmark
output is unchanged. The new CI config passes under
parallel-make-check.py and fails with a corrupted signature byte, a
truncated public key, a missing row and an unused static function.
2026-10-14 10:59:13 +02:00