Commit Graph

30980 Commits

Author SHA1 Message Date
Daniele Lacamera 509b29bc9c Remove liboqs dependency
Falcon was the last algorithm backed by liboqs; now that wolfCrypt has a
native Falcon implementation, liboqs is no longer needed. Remove the
integration entirely so liboqs does not appear as a build or SBOM dependency:

  - configure: drop --with-liboqs (and the -loqs link), the BUILD_LIBOQS
    conditional and the summary line.
  - CMake: drop WOLFSSL_OQS, the duplicate liboqs-backed WOLFSSL_FALCON
    option, the OQS cross-validation / find_package(OQS) block, the
    FindOQS.cmake module, BUILD_OQS_HELPER, and HAVE_LIBOQS from options.h.in.
  - Remove the wolfcrypt/src/port/liboqs port layer (liboqs.c/.h) and its
    wolfSSL_liboqsInit/Close calls in wc_port.c.
  - settings.h: drop HAVE_LIBOQS from the asym key import/export aggregates
    (HAVE_FALCON already covers them) and from the experimental gate; add
    HAVE_FALCON to the experimental gate so the unstandardized Falcon requires
    WOLFSSL_EXPERIMENTAL_SETTINGS in every build system.
  - Drop liboqs.c from the VS/Zephyr/INTIME project files, remove the liboqs
    install from Docker, and update INSTALL/tls.c text (Falcon is native now).

No functional change to non-Falcon builds; the library links no liboqs.
2026-07-22 09:52:26 +02:00
Daniele Lacamera 20a838aac3 Falcon: native wolfCrypt implementation (no liboqs)
Add a complete native Falcon post-quantum lattice signature implementation to
wolfCrypt, replacing the liboqs wrapper. Full key generation, signing and
verification for Falcon-512 (level 1) and Falcon-1024 (level 5).

  - Public API wc_falcon_* / falcon_key in falcon.c wraps the native core
    (falcon_native_* in wc_falcon.c) plus wc_falcon_{fpr,fft,poly,sampler,
    codec,keygen,sign,bigint}.c. No liboqs dependency.
  - Portable, constant-time integer-emulated floating-point (fpr) backend is
    the default; opt-in per-architecture acceleration:
      --enable-falcon-double  inline native double
      --enable-falcon-asm     x86-64 SSE2 out-of-line fpr asm
      --enable-falcon-avx2    x86-64 AVX2 (4-wide) FFT
  - Division-free (Barrett) integer NTT on the verify path, so no hardware
    divide is required on Cortex-M / embedded targets.
  - Verify uses a cached twiddle-factor NTT; signing uses the FFT / ffLDL tree
    and discrete Gaussian sampler over the abstract fpr seam.
  - test.c falcon_test (KAT verify + native keygen/sign/verify roundtrip);
    scripts/falcon-interop.c and a CI workflow cross-check native<->liboqs in
    both directions.
2026-07-22 09:52:26 +02:00
Sean Parkinson f18ebef1c2 Merge pull request #10959 from lealem47/WC_FIPS_NOT_APPROVED
Testing: AES GCM opps with IV < 96-bits now returns WC_FIPS_NOT_APPROVED with FIPS
2026-07-22 17:07:31 +10:00
Lealem Amedie 9548753bb3 Remove embedding of macros within a function call 2026-07-21 18:40:13 -06:00
night1rider 7b7ce703c7 .wolfssl_known_macro_extras: restore C lexical sort order for fipsCastStatus_get and wc_Des3_SetKey. 2026-07-21 14:04:37 -06:00
Lealem Amedie 527154dc85 Testing: AES GCM opps with IV < 96-bits now returns WC_FIPS_NOT_APPROVED with FIPS 2026-07-21 13:59:57 -06:00
philljj 4a7695ef13 Merge pull request #10928 from Frauschi/pkcs7_fix
Fix two PKCS#7/CMS Go-interop gaps: SignedData DigestInfo verify + EnvelopedData definite [0] decrypt
2026-07-21 09:46:57 -05:00
Sean Parkinson a048395345 Merge pull request #10941 from Frauschi/rfc_compliance
Compliance to new RFCs
2026-07-21 16:19:33 +10:00
Sean Parkinson 425d8f8c2e Merge pull request #10943 from Frauschi/crl_pqc
Add post-quantum and EdDSA CRL signing
2026-07-21 15:57:06 +10:00
philljj 104f685ca9 Merge pull request #10948 from SparkiDev/ed25519_fixes_2
Ed25519 tests: Fix to pass regression testing
2026-07-20 21:54:32 -05:00
Sean Parkinson 69eb81a76e Merge pull request #10936 from aidangarske/fix-tls13-ctx-status-request
Check ctx extensions before rejecting a TLS1.3 certificate message extension
2026-07-21 10:13:26 +10:00
Sean Parkinson ca53afe35d Merge pull request #10785 from stenslae/ml-dsa-ssl-error-queue-fix
openssl compat errors and mldsa oid fix
2026-07-21 10:08:11 +10:00
Daniel Pouzzner bd6388c0b6 Merge pull request #10951 from Frauschi/fix-dist-argmax
build: distribute IDE project trees per-directory to fix "make dist"
2026-07-20 17:06:10 -05:00
Daniel Pouzzner 69a994e62b Merge pull request #10945 from ejohnstown/ocsp-fail
OCSP: opt-in fail-closed on missing responder
2026-07-20 16:42:04 -05:00
JacobBarthelmeh 39a607384c Merge pull request #10920 from douzzer/20260713-WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED-etc
20260713-WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED-etc
2026-07-20 13:27:24 -06:00
aidan garske f62aa55284 Check ctx extensions before rejecting a TLS1.3 certificate message extension 2026-07-20 09:31:27 -07:00
JacobBarthelmeh e19a1a4dc4 Merge pull request #10912 from danielinux/mcdc-test-coverage
MC/DC coverage for wolfCrypt modules - Part 3
2026-07-20 10:10:39 -06:00
Daniel Pouzzner 3f9bc8c775 linuxkm/Makefile: fix module-update-fips-hash recipe to allow SHA512 verifyCore. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 6fcfadfee2 configure.ac: more FIPS v7/ready/dev DH purging: omit HAVE_FFDHE_* too. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner f79b203745 wolfcrypt/src/sha3.c, wolfssl/wolfcrypt/sha3.h, wolfssl/wolfcrypt/error-crypt.h, wolfcrypt/src/error.c:
* Fix vector register restore on error paths in Sha3Update().

* Add SP 800-185 check against KMAC_FIPS_MIN_KEY in KmacInit() and
  KMAC_FIPS_MIN_OUTPUT in KmacFinal(), returning KMAC_MIN_KEYLEN_E and
  BAD_LENGTH_E respectively on failure.

* Use word32 rather than byte for wc_Sha3.i, wc_Cshake.count, wc_Kmac.count, and
  related, and add explicit range checking where needed, to fix a -Wconversion,
  fix possible overruns, obviate 14 casts, and eliminate (negligible) runtime
  overhead from masking and promotions.
2026-07-20 11:09:53 -05:00
Daniel Pouzzner ef070bf564 linuxkm/linuxkm-fips-hash-wrapper.sh: fix dependency on SHA-2 coreKey. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner b4a9326842 configure.ac: fix DH dependencies for FIPS v7 (implicit --disable-dh). 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 755220792e wolfcrypt/src/kdf.c, wolfssl/wolfcrypt/kdf.h: use "hash_type", not "hash", for the hash type in wc_PRF_fips(), for clarity and consistency. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner d494864965 wolfssl/wolfcrypt/settings.h: add assert that WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED isn't defined in old FIPS builds. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 7897c335e0 configure.ac: don't include CShake or KMAC in enable-all-crypto when building FIPS < v7. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner a7511940ff wolfssl/wolfcrypt/wc_compat.h: in non-streaming wc_AesGcmEncrypt_compat_shim(), restore aes->reg to the supplied IV after wc_AesGcmEncrypt_ex() increments it, supporting the EVP access pattern. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 09bcd2f391 wolfssl/wolfcrypt/wc_compat.h: FIPS v2 compatibility. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 00368d1cc4 wolfssl/wolfcrypt/error-crypt.h: #include <wolfssl/wolfcrypt/wc_port.h> where previously #include <wolfssl/wolfcrypt/types.h>, to retain standalone compilability without provoking circular dependencies via wc_compat.h. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner b4095f0578 wolfcrypt/src/ed25519.c: whitespace fix (from AI review). 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 08b5b65c26 configure.ac: add --enable-all-quantum-crypto "Enable all quantum-resistant asymmetric algorithms (default: disabled)". 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 3db433a31a wolfcrypt/src/ed25519.c, tests/api/test_ed25519.c:
* add missing null key checks to wc_ed25519_verify_msg_init(), wc_ed25519_verify_msg_update(), and wc_ed25519_verify_msg_final().
* add WC_ARG_NOT_NULL() attributes to args of static functions as appropriate.
* add FIPS >v6 gates to new null key tests and a new invalid hash size test in test_wc_ed25519_sign_verify_ctx_ph() and test_wc_ed25519_verify_streaming().
2026-07-20 11:09:53 -05:00
Daniel Pouzzner 2628676b28 wolfssl/wolfcrypt/wc_compat.h, wolfssl/wolfcrypt/fips_test.h, .wolfssl_known_macro_extras:
* also inhibit recursive evaluation midway through random.h, fips.h, and fips_test.h (circular dependencies).
* add WC_FIPS_ENUM_CAST_ID_DEFINED to allow detection of fips_test.h incomplete evaluation.
2026-07-20 11:09:53 -05:00
Daniel Pouzzner 6f1e5a93d4 wolfcrypt/src/aes.c: revert atomic refactor of checkedAESNI, haveAESNI, and intel_flags (3f3ebcac58 / #10871) to avoid frivolous atomic access overhead. Also use regular int, not cpuid_flags_atomic_t, for cpuid_flags in the WOLFSSL_ARMASM path, and similarly use a regular int for aes_ppc64_use_crypto in the WOLFSSL_PPC64_ASM_CRYPTO path. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 9b30443288 linuxkm/lkcapi_aes_glue.c: in the inner streaming loops for AES-GCM and AES-XTS (AesGcmCrypt_1(), km_AesXtsEncrypt(), and km_AesXtsDecrypt()), bypass FIPS wrappers to avoid frivolous overhead, with decisive check after looping by the Final function. 2026-07-20 11:09:53 -05:00
Daniel Pouzzner 40623dada0 Implement FIPS shimming for wc_AesGcmEncrypt():
wolfssl/wolfcrypt/aes.h: if HAVE_FIPS && !WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED, make wc_AesGcmEncrypt() a WOLFSSL_LOCAL, and if !_WC_BUILDING_AES_C, add a WC_DEPRECATED() attribute to it.

wolfssl/wolfcrypt/wc_compat.h, wolfssl/wolfcrypt/include.am, .wolfssl_known_macro_extras: add wc_compat.h: when HAVE_FIPS and !WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED, shim wc_AesGcmEncrypt() to remap it to FIPS-allowed APIs.

wolfssl/wolfcrypt/types.h: at the end, #ifndef BUILDING_WOLFSSL, #include <wolfssl/wolfcrypt/wc_compat.h>, to assure transparent shimming of wc_AesGcmEncrypt() for all outside callers.

wolfcrypt/src/evp.c, wolfcrypt/src/hpke.c, wolfcrypt/src/pkcs7.c, wolfcrypt/benchmark/benchmark.c, wolfcrypt/test/test.c, wolfssl/ssl.h: #include <wolfssl/wolfcrypt/wc_compat.h> to shim in-library/in-module calls to wc_AesGcmEncrypt().

src/internal.c: in TicketEncDec(), add const attributes to constable input args, and fix swapped out/in in calls to wc_AesGcmEncrypt().

tests/api/test_aes.c: in test_wc_AesGcmEncryptDecrypt(), skip longIV test if WC_TEST_AES_GCM_ENCRYPT_NO_NONSTD_IV (defined by wc_compat.h when needed).

wolfssl/wolfcrypt/error-crypt.h, wolfssl/error-ssl.h, wolfcrypt/src/error.c, src/internal.c:
* add FIPS_WRONG_API_E;
* put several error codes back into sequence in wc_GetErrorString() switch().
* move wc_static_assert()s from headers to corresponding .c files, to eliminate dependency on wolfcrypt/types.h;
* remove unneeded #include <wolfssl/wolfcrypt/types.h> from error-crypt.h.
2026-07-20 11:09:53 -05:00
Tobias Frauenschläger 29506d2cac build: distribute IDE project trees per-directory to fix "make dist"
The non-recursive automake "distdir" recipe inlines the entire $(DISTFILES)
list into a single shell command. Enumerating every IDE integration file
individually made that list large enough (~123 KB) that the recipe exceeded
the Linux MAX_ARG_STRLEN (128 KB) single-argument exec limit, so "make dist"
failed with:

    /bin/bash: Argument list too long
    make[2]: *** [distdir-am] Error 127

Replace the per-file EXTRA_DIST enumeration of the IDE directories with one
wholesale "EXTRA_DIST += IDE/<dir>" entry per directory (automake copies the
tree recursively). This collapses ~745 file entries into ~52 directory
entries and shrinks the top-level DISTFILES from ~123 KB to ~97 KB, well
under the limit.

The set of distributed IDE files is unchanged: a before/after "make dist"
diff shows no project file added or removed (only the now-unused include.am
build fragments are gone). Three directories that intentionally omit some
tracked files (apple-universal, MPLABX16, Renesas - private IDE configs,
.gitkeep placeholders, helper scripts) stay enumerated file-by-file.
2026-07-20 17:22:10 +02:00
Tobias Frauenschläger 5012d1d6e7 check-source-text: whitelist WOLFSSL_OCSP_SCREEN_RESPONDER
WOLFSSL_OCSP_SCREEN_RESPONDER (from the OCSP AIA responder SSRF
screening work) is only ever enabled via
CPPFLAGS=-DWOLFSSL_OCSP_SCREEN_RESPONDER, a form the check-source-text
"unknown macros" -D pattern does not match, so the subtest reports it as
an unrecognized macro and fails. Add it to .wolfssl_known_macro_extras.

Also fix the C lexical ordering of HWCAP2_SME, which sorted after
HWCAP_ASIMDRDM ('2' precedes '_' in the C locale) and tripped the "not
in C lexical order" warning.
2026-07-20 15:28:41 +02:00
Sean Parkinson 7b5970b9b5 Merge pull request #10898 from danielinux/sp-from-mp-const-time
Regenerate SP sources: constant-time sp_*_from_mp
2026-07-20 23:06:41 +10:00
Tobias Frauenschläger c30e8d6116 Add post-quantum and EdDSA CRL signing via wc_SignCRL_ex2
CRL signature verification already supported post-quantum algorithms
through the shared ConfirmSignature() engine, but CRL generation did not:
wc_SignCRL_ex accepted only RSA and ECC keys and sized its signature
buffer for a classic signature.

Add wc_SignCRL_ex2, which takes an untyped key plus a keyType selector,
the same scheme wc_MakeCert_ex and wc_SignCert_ex use. It resolves the key
and reuses the existing CheckSigTypeForKey, GetSignatureBufferSz and
MakeSignature helpers, so the signature buffer is sized from the key and
post-quantum signatures get enough room. wc_SignCRL_ex keeps its original
RSA/ECC signature and becomes a thin wrapper, preserving the public API.

This enables CRL signing with ML-DSA, SLH-DSA, Ed25519, Ed448 and Falcon.
Stateful hash-based schemes (LMS/XMSS) are rejected with ALGO_ID_E, since a
CRL is reissued periodically and would exhaust the key's one-time signature
state. Under WOLFSSL_NO_MALLOC the signature must still fit the fixed
CertSignCtx.sig buffer, consistent with the certificate signing path.

Tests cover CRL sign and verify through the certificate manager for ML-DSA
(44/65/87), SLH-DSA (SHAKE and SHA2 128s), Ed25519 and Ed448, plus negative
cases for a tampered signature, a sigType and key-family mismatch, and
rejection of LMS/XMSS.
2026-07-20 14:05:45 +02:00
Tobias Frauenschläger 503b51f663 check-source-text: whitelist WOLFSSL_OCSP_SCREEN_RESPONDER
WOLFSSL_OCSP_SCREEN_RESPONDER (from the OCSP AIA responder SSRF
screening work) is only ever enabled via
CPPFLAGS=-DWOLFSSL_OCSP_SCREEN_RESPONDER, a form the check-source-text
"unknown macros" -D pattern does not match, so the subtest reports it as
an unrecognized macro and fails. Add it to .wolfssl_known_macro_extras.

Also fix the C lexical ordering of HWCAP2_SME, which sorted after
HWCAP_ASIMDRDM ('2' precedes '_' in the C locale) and tripped the "not
in C lexical order" warning.
2026-07-20 14:05:45 +02:00
Sean Parkinson 07353cc6e8 Ed25519 tests: Fix to pass regression testing 2026-07-20 16:11:48 +10:00
philljj 5dd7717d11 Merge pull request #10933 from holtrop-wolfssl/f-6445
Rust wrapper: Add ChaCha20Poly1305::finalize_verify()
2026-07-19 11:04:41 -05:00
JacobBarthelmeh c1ee61c8d1 Merge pull request #10888 from SparkiDev/kmac_cshake
KMAC and cSHAKE: Add new algorithms
2026-07-17 16:49:25 -06:00
JacobBarthelmeh 25b5636c30 Merge pull request #10808 from aidankeefe2022/fenrir-fixes-jun29-ak
Fix: WolfCrypt 7 fenrir fixes
2026-07-17 15:49:14 -06:00
JacobBarthelmeh d65b9ebf68 Merge pull request #10723 from ejohnstown/ocsp-fix
OCSP: opt-in SSRF screening of AIA responder
2026-07-17 14:45:18 -06:00
philljj 98f4d6f955 Merge pull request #10721 from JacobBarthelmeh/dev_2
Defensive code additions for sanity checks on input arguments with Base64, PEM write, mp_read_unsigned_bin
2026-07-17 15:34:35 -05:00
John Safranek ae0bac50c9 OCSP: opt-in fail-closed on missing responder
WOLFSSL_OCSP_CHECKALL is a scope flag ("always leaf, but all ?"), selecting
which certs are checked, not how hard to fail when one advertises no OCSP
responder in its AIA. Treating a missing responder as a hard failure breaks
any chain whose CA publishes no OCSP URI (e.g. Google GTS WR2), a
configuration that only grows as CAs drop responders. Strictness belongs in
its own opt-in flag.

- Keep CHECKALL scope-only; a cert with no responder soft-fails by default.
- Return distinct OCSP_NO_URL for "no responder", separate from a failed
  lookup; stapling response handling stays best-effort (mapped to CERT_GOOD).
- Add WOLFSSL_OCSP_FAIL_IF_NOT_SUPPORTED (via OcspNoUrlPolicy) to refuse such
  certs; independent of CHECKALL.
- Add test_ocsp_no_url_policy covering both halves.
2026-07-17 13:21:01 -07:00
John Safranek 6f087a502e OCSP: opt-in SSRF screening of AIA responder
- Add wolfIO_OcspDestAllowed(); block internal-range responder hosts
- Call it in EmbedOcspLookup before connect (CWE-918)
- Gate on WOLFSSL_OCSP_SCREEN_RESPONDER (off by default)
- Add unit tests and CI for both resolver paths
2026-07-17 13:11:16 -07:00
JacobBarthelmeh 6283bd6db8 Merge pull request #10891 from rlm2002/fipsEcc
add mp_clear(order) before freeing in _ecc_import_private_key_ex()
2026-07-17 13:35:41 -06:00
JacobBarthelmeh 2281459e2b Merge pull request #10923 from miyazakh/mldsa_verifyonly_op
Fix configure.ac so --enable-mldsa=verify-only
2026-07-17 13:26:43 -06:00