Commit Graph
2437 Commits
Author SHA1 Message Date
Daniel Pouzzner 067c10d71e Merge pull request #10819 from lealem47/input_validation
Crypto layer: Add missing input validation
2026-08-10 18:29:11 -05:00
David Garske 1e0fa211d0 Merge pull request #10886 from night1rider/cryptocb-hooks-rsapss-ed448-cmac
Cryptocb hooks rsapss ed448 cmac
2026-08-10 15:49:05 -07:00
Lealem Amedie ca06c85ec0 Testing touch-ups to account for error code fix and MIN_AUTH_TAG_SZ update 2026-08-10 13:35:01 -06:00
David Garske 14a72c96e4 wolfCrypt SRAM PUF: configurable error correction and footprint 2026-08-09 09:04:51 +02:00
night1rider 375febc944 Extend the RSA-PSS verify callback and harden the Ed448/CMAC hooks
The PSS hook can hand back the recovered block through out/outSz/outLen.
A device that reports only a verdict leaves outLen at 0; wolfSSL then
zeroes the buffer and returns saltLen + hLen, and rejects a buffer
smaller than that with RSA_BUFFER_E. A reported length is clamped to the
buffer size, and any positive handler return maps to SIG_VERIFY_E.

Move the Ed448 sign WOLFSSL_CHECK_MEM_ZERO registration below the crypto
callback hook so the device path no longer returns past it, and guard the
RSA-PSS test callback against WOLF_CRYPTO_CB_ONLY_RSA.

Adds tests for the recovered-data, over-claimed-length and undersized
buffer paths, and an os-check config that builds the hooks under
WOLFSSL_CHECK_MEM_ZERO.
2026-08-08 15:14:28 -06:00
night1rider 772a62628e Add crypto callback hooks for Ed448, CMAC free, and RSA-PSS verify
Add WOLF_CRYPTO_CB dispatch hooks so a device can service:
* Ed448 sign and verify, mirroring the existing Ed25519 hooks.
* CMAC context free on wc_CmacFree (WOLF_CRYPTO_CB_FREE), letting a device
  release offload state.
* RSA-PSS verify with the digest (WOLF_CRYPTO_CB_RSA_PAD) so the device does
  the full signature and padding check. On that path *out is set to NULL with a
  positive return, documented in rsa.h.

Includes testwolfcrypt and API unit test coverage for each hook.
2026-08-08 15:14:27 -06:00
philljj e71b086fc8 Merge pull request #10724 from dgarske/ti_c25
wolfCrypt on TI C2000 C28x (LAUNCHXL-F28P55X)
2026-08-08 14:26:28 -05:00
David Garske 8d34ef4bde test: guard ecc_test DER key export/import helpers behind !NO_ASN 2026-08-06 16:56:10 -07:00
David Garske 4f2fd9c23c test/benchmark/ci: CHAR_BIT != 8 test vectors, NO_MALLOC benchmark, TI C2000 compile CI and docs 2026-08-06 16:56:10 -07:00
Daniel Pouzzner ee1190cc8c linuxkm/linuxkm_wc_port.h, linuxkm/x86_vector_register_glue.c, wolfcrypt/test/test.c: implement DEBUG_VECTOR_REGISTER_ACCESS_ALWAYS_{ON,OFF}, to allow forcing of asm and C paths for kernel module testing. 2026-08-06 18:20:30 -05:00
Tobias Frauenschläger eab70a1e88 Merge pull request #11031 from douzzer/20260727-fips-dev-no-post
20260727-fips-dev-no-post
2026-08-06 08:47:10 +02:00
Daniel Pouzzner 67df4928c5 fixes from peer review, post-rebase test results, and test coverage expansion:
wolfcrypt/src/wc_mldsa.c: WC_C_DYNAMIC_FALLBACK fixes for AVX512.

tests/api/test_frodokem.c, wolfcrypt/test/test.c: fixes for WC_DEBUG_CIPHER_LIFECYCLE.

wolfcrypt/src/fe_x25519_asm.S, wolfcrypt/src/port/arm/armv8-32-aes-asm.S,
wolfcrypt/src/port/arm/armv8-aes-asm.S, wolfcrypt/src/port/arm/armv8-aes-asm_c.c,
wolfcrypt/src/port/arm/thumb2-aes-asm.S, wolfcrypt/src/sha3_asm.S,
wolfcrypt/src/wc_mldsa_asm.S: regenerate from scripts#647

.github/workflows/fips-dev-no-post.yml:
* update "minutes" for tests using empirical data;
* add --enable-experimental --enable-all-quantum-crypto to kernel-settings-all-asm scenario and rename it kernel-settings-all-pqc-asm; add all-pqc-asm-fallback-fuzzer scenario.

wolfcrypt/src/wolfentropy.c: remove WC_FIPS_LL_CRYPTO (it is not a FIPS file except in FIPS v5.2.4).

wolfcrypt/src/sha256.c: fix for rebase error (stray #endif).
2026-08-05 13:55:14 -05:00
Daniel Pouzzner 83b175ce95 fixes and improvements from AI review:
.github/workflows/fips-dev-no-post.yml: add reporting of fuzzing seed.

wolfcrypt/src/aes.c, tests/api/test_aes.c, .wolfssl_known_macro_extras:

* change FIPS AES-GCM nonce size restrictions from from opt-out (WC_FIPS_AESGCM_ALLOW_SHORT_NONCES) to opt-in (WC_FIPS_AESGCM_NO_SHORT_NONCES).
* apply restrictions only on encryption operations, never on decryption.

configure.ac: fix HAVE_FIPS_VERSION of fips-ready; fix enable_dh setup in KERNEL_MODE_DEFAULTS setup; fix help message for --enable-dh.

linuxkm/x86_vector_register_glue.c: add dump_stack() on each BUG/WARNING message that didn't already have it.

src/tls.c: fix a couple leaks in TLSX_KeyShare_GenDhKey().

tests/swdev/swdev.c: gate src->sha_method access in swdev_sha256_copy_state() and swdev_sha512_copy_state() appropriately.

tests/unit.c: conditionally include dh.h, to assure wc_dh_enable() is available.

wolfcrypt/src/dh.c:
* in wc_InitDhKey_ex(), zero the key at entry unless null, remove duplicate key->trustedGroup = 0, and call wc_FreeDhKey() on error at end.
* add missing wc_dh_enabled checks in  wc_DhGeneratePublic() and wc_DhGenerateParams().

wolfcrypt/src/error.c: fix missing space in FIPS_UNAPPROVED_E string.

b/wolfssl/wolfcrypt/settings.h: sense __SIZEOF_INT128__ and if defined, but HAVE___INT128_T and/or HAVE___UINT128_T are undefined, define them.

wolfcrypt/src/falcon.c: tweak the gate on __uint128_t availability to lean solely on HAVE___UINT128_T.

wolfcrypt/src/random.c: fix a couple missed WC_NO_ERR_TRACE() wrappers.

wolfcrypt/src/rng_bank.c: properly tolerate WC_ACCEL_INHIBIT_E as a retval from bank->affinity_lock_cb().

wolfcrypt/src/sha256.c, wolfcrypt/src/sha512.c: move #undef WC_C_DYNAMIC_FALLBACK for WOLFSSL_AESNI without USE_INTEL_SPEEDUP to follow all includes, assuring no struct layout conflict.

wolfcrypt/src/sha512.c: fix wrong call in intelasm Transform_Sha512() !WC_C_DYNAMIC_FALLBACK SHA512_C path.

wolfcrypt/test/test.c: fix double-WC_TEST_RET_ENC_EC() in mldsa_param_*_vfy_test().
2026-08-05 13:53:47 -05:00
Daniel Pouzzner ec04819695 wolfcrypt/test/test.c: fix error codes in ecc_test_curve_size(), mldsa_param_*_vfy_test(), test_mldsa_decode_level(), and mldsa_test(). 2026-08-05 13:53:47 -05:00
Daniel Pouzzner 0e1a3f91c2 wolfcrypt/src/falcon.c, configure.ac, wolfcrypt/benchmark/benchmark.c, wolfcrypt/test/test.h, wolfcrypt/test/test.c: Falcon fixes and cleanups:
wolfcrypt/src/falcon.c:

* define _WC_BUILDING_FALCON_C;

* add #error arch guards -- WOLFSSL_FALCON_FPR_ASM requires x86-64
(wc_falcon_fpr_x86_64_asm.S), WOLFSSL_FALCON_FFT_AVX2 requires an x86 target,
WOLFSSL_FALCON_FFT_NEON requires AArch64 (ARM32 NEON lacks the double-precision
lanes used by float64x2_t);

* drop the unused FALCON_PRIMES forward declaration;

* fix u->U literals and an (sword64)z0*(sword64)z0 overflow;

* tightened __uint128_t guard.

wolfcrypt/benchmark/benchmark.c:

* falcon message buffer -> WC_ALLOC_VAR;

* bench wiring for the experimental algs.

wolfcrypt/test/test.h: add frodokem_test / falcon_test externs.

wolfcrypt/test/test.c: mldsa/falcon WC_ALLOC_VAR conversions.

configure.ac: update all-quantum-crypto with the experimental algorithms.
2026-08-05 13:53:46 -05:00
Daniel Pouzzner 558d90cb1d wolfcrypt/src/rng_bank.c, wolfssl/wolfcrypt/rng_bank.h, linuxkm/lkcapi_rsa_glue.c, linuxkm/lkcapi_sha_glue.c, wolfcrypt/test/test.c:
* Use defined(WC_HAVE_RNG_BANKREF), not defined(WC_RNG_BANK_SUPPORT), as the feature sensor for RNG bankrefs.

* Add DRBG_KAT_FIPS_E and DRBG_CONT_FIPS_E to the list of immediate-failure errors in wc_rng_bank_init().
2026-08-05 13:53:46 -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 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
Tobias Frauenschläger ff730fec9e Keep the record size probe clear of a suspended build
Second review follow-up on the async record layer series.

Stop the probe reselecting the cipher side. BuildMessage()'s BUILD_MSG_BEGIN
case can call SetKeysSide() for DTLS with secure renegotiation, which swaps
the active encryption state and clears recordSzOverhead. That is not part of a
size calculation, and after the previous commit the suspended build survives
to resume against whatever side the probe last chose, so a DTLS 1.2 record
suspended for PREV_ORDER could resume against the renegotiation keys. Skip it
when sizeOnly is set; the sizes are the same either way.

The probe itself has to keep running. Not re-entering BuildMessage at all
while a build is suspended looks tidier, but wolfssl_local_GetMaxPlaintextSize()
derives the DTLS fragment size from this result, so falling back to the upper
bound there shrinks fragments inconsistently between calls and the MTU
reproducer fails its buffer comparison. Saving and restoring the two fields is
what keeps the answer exact.

Resume inside the record when handshake content is left. The previous commit
declined to skip the padding for a fragmented or coalesced
certificate_request, which was right, but left processReply at doProcessInit
with the index inside the record, so the resume still started a fresh record
parse in the middle of one. Mirror both halves of the end of record block
instead: set runProcessingOneMessage when content remains, advance past the
padding only at the boundary.

Note the shared state at the source. BuildMessage() and BuildTls13Message()
write ssl->options.buildMsgState even for a sizeOnly probe with asyncOkay
clear, where everything else goes to the caller's own arguments. Nothing said
so at those sites, so the next sizeOnly caller would reintroduce this.

Record why only one of the three wc_ecc_make_key_ex() calls in eccsi.c needs
a wait: the other two are preceded by wc_ecc_free(), which clears the marker
their pending path is gated on. Moving either free would make them pend.

Test changes. Force the overhead cache cold before probing, otherwise an AEAD
suite answers from the cache without ever calling BuildMessage and the
assertions hold no matter what the probe did. Compare against BuildMessage's
own figure rather than only checking the size is positive, and run the whole
thing for TLS 1.3 as well as TLS 1.2, since BuildTls13Message() clobbers the
state by a different route: its sizeOnly return bypasses exit_buildmsg
entirely. Checked by stubbing the restore out again, which fails the test.

Also spell the new guard in cryptocb_test() as #if defined(WOLFSSL_ASYNC_CRYPT)
to match the rest of that file, which uses that form 170 times against 4.
2026-08-05 20:39:57 +02:00
Tobias Frauenschläger fe3801b942 Wait for async completion in the cryptocb make-pub test
cryptocb_test() generates a key with wc_ecc_make_key() and assigns the
result straight to ret. In an async build that call returns WC_PENDING_E,
which is not an encoded test result, so the raw -108 propagated out of
the test and printed as "error L=108" with no error code at all.

The key is reached through myCryptoDevCb, which services EC key
generation by calling wc_ecc_make_key_ex() on the same key after setting
key->devId = INVALID_DEVID. That comment says the intent is to force
software, and it does stop the crypto callback from dispatching again,
but the pending path in _ecc_make_key_ex() is gated on asyncDev.marker
rather than devId. The marker is untouched, so the inner call still goes
pending and the callback hands WC_PENDING_E back to its caller.

Wait at the call site rather than in the callback. Every other key
generation in this file already does exactly that, a callback returning
WC_PENDING_E is legitimate for a real asynchronous device, and the same
devId idiom appears 48 times in myCryptoDevCb against 48 different keys,
so there is no single place in the callback to fix.

With this, testwolfcrypt passes in full under --enable-all with
--enable-asynccrypt-sw, where it previously stopped here. Verified
against plain --enable-all as well, which is unaffected: the addition
compiles out entirely without WOLFSSL_ASYNC_CRYPT.

That configuration still cannot complete make check. unit.test fails in
the cipher suite runner on TLS 1.3 post-handshake authentication, which
is a record layer problem in the library rather than a test defect and
is not addressed here. All 2111 API tests pass.
2026-08-05 08:34:08 +02:00
Tobias Frauenschläger 4f523b9f28 Wait for async completion in the ECIES crypto callback test
ecc_encrypt_cryptocb_test() calls wc_ecc_make_key() twice and checks the
return code directly. Under WOLFSSL_ASYNC_CRYPT the software simulator
returns WC_PENDING_E from that call, so the test aborts with -108 before
it reaches a single ECIES operation. The sibling ecc_encrypt_test() right
below it already wraps the same two calls in wc_AsyncWait(); this one was
added later and never got the same treatment.

Mirror the sibling exactly: wc_AsyncWait() on each key's asyncDev with
WC_ASYNC_FLAG_NONE, guarded by WOLFSSL_ASYNC_CRYPT so non-async builds are
untouched by the preprocessor.

The failure needs --enable-all together with the software async simulator.
--enable-all turns on cryptocb, which suppresses the auto-enabled simulator
in configure.ac, so the simulator only appears if --enable-asynccrypt-sw is
passed explicitly. No configuration under .github/ combines the two, which
is why this was never seen in CI.

Verified with --enable-all --enable-asynccrypt-sw under the CFLAGS the
os-check workflow applies: "ECC Enc test failed! error code=-108" before,
"ECC Enc test passed!" after. Rebuilt the same tree as plain --enable-all
to confirm the non-async path is unaffected, where testwolfcrypt passes in
full.

Fixing this uncovers the next test to run, ECCSI, failing the same way.
That one is a library defect rather than a test defect and is fixed in the
following commit.
2026-08-05 08:34:08 +02:00
David Garske 34d0a01089 Merge pull request #11040 from embhorn/zd22271
Correct partial-block guards in wc_AesCcmDecrypt
2026-08-04 20:19:10 -07:00
Tobias Frauenschläger 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
Aidan Garske 82cf3d8947 Add x509 tiny certificate test coverage 2026-08-04 12:21:25 -07:00
Sean Parkinson 03e9107df4 AES asm: Add GCM 8-bit table, fixes
Added assembly to do 8-bit-table GCM_gmult_len.
Wired it into aes.c and wired small to use C code.
Fixed guards around assembly.
2026-08-04 17:48:14 +10:00
Eric Blankenhorn fead192f45 Correct partial-block guards in wc_AesCcmDecrypt 2026-08-03 14:21:16 -05:00
Tobias Frauenschläger 428bfe9f58 Restore the caller's key RNG after an HPKE operation
The encap and decap paths create a temporary RNG, install it into a key that
belongs to the caller so the shared secret computation can blind, and then
free it without taking it back out. Both wc_ecc_set_rng and
wc_curve25519_set_rng only record the pointer, and nothing else ever writes
that field, so the caller's key was left pointing at freed memory. Encap does
this to the ephemeral key and decap to the receiver key, including the
curve25519 branch. Repeated HPKE calls hide it because each one installs a
fresh RNG first, but any other use of the key that consults it, such as an
ECDH or a signature under timing resistance, reads the freed object. ECH
holds exactly such a long lived key.

Save whatever RNG the key already had and put it back before freeing the
temporary one, so the key is handed back to the caller unchanged. Clearing
the field instead would silently drop an RNG the caller had installed for
blinding of their own.

Extend the HPKE round trip test to give both keys an RNG of its own and to
require them to still have it once the seal and open have finished.

Fixes F-7083.
2026-08-01 12:04:56 +02:00
JacobBarthelmeh acff4d62a1 Merge pull request #10883 from night1rider/Extend-ECIES
Add AES-GCM DEM, CryptoCb support, and devId threading to ECIES
2026-07-24 14:02:32 -06:00
night1rider 3062dea0b6 Use the existing KEY32 macro and a named fake overhead constant in the new ECIES tests 2026-07-24 10:21:20 -06:00
night1rider e04b8c74da Enforce the ECIES single-use REQ/RESP state on the hardware CryptoCb path so a device that services encrypt/decrypt without a software fallback cannot reuse the ctx.
Add a testwolfcrypt case that services ECIES entirely in the callback and checks a second op on the same ctx is rejected with BAD_STATE_E.
2026-07-24 10:19:40 -06:00
night1rider c00e7260be Add AES-GCM DEM, CryptoCb support, and devId threading to ECIES
Add AES-GCM (128/256) as an ECIES DEM next to the AES-CBC/CTR+HMAC modes. Only the encryption key comes from the KDF; the mac salt is bound as GCM AAD and the 16-byte tag replaces the HMAC. The GCM DEM honors all three IV build modes, and default fixed-nonce GCM is gated behind the new WOLFSSL_ECIES_STATIC_GCM_NONCE opt-in. Adds ECIES CryptoCb encrypt/decrypt, the WOLF_CRYPTO_CB ctx getters, devId/heap threading into the DEM primitives, and test/benchmark/CI coverage.
2026-07-24 10:19:40 -06:00
Sean Parkinson 35d749da72 Merge pull request #10977 from padelsbach/no-trackmemory-and-staticmemory
Check for --enable-trackmemory and --enable-staticmemory in ./configure
2026-07-24 11:06:47 +10:00
Sean Parkinson 15afad7f8f Merge pull request #10902 from rlm2002/coverity
2020714 Coverity fixes
2026-07-24 10:38:13 +10:00
Sean Parkinson e6c3bb4403 Merge pull request #10827 from danielinux/falcon-native
Falcon: native implementation replacing liboqs, with crypto callbacks and ARM acceleration. Deprecate liboqs support.
2026-07-23 21:17:10 +10:00
Brett Nicholas e6d86b4bbb Merge pull request #10832 from padelsbach/curve25519-cryptocb-only
Add crypto callback only mode for curve25519
2026-07-22 17:35:55 -06:00
Paul Adelsbach fb6140582e Associated test updates for --enable-trackmemory and --enable-staticmemory 2026-07-22 16:25:35 -07:00
David Garske 983e1090d7 Merge pull request #10922 from aidangarske/fenrir-asn-strict
Enforce RFC 5280 extension MUSTs under WOLFSSL_NO_ASN_STRICT and validate DTLS 1.3 legacy_session_id echo
2026-07-22 14:12:33 -07:00
Marco Oliverio cf98494190 se050: key_only_id bug fixes 2026-07-22 10:54:43 +02:00
Daniele Lacamera effc05a171 Falcon: remove FN-DSA / FIPS 206 references from code comments and text
Scrub the temporary "FN-DSA" name and the "FIPS 206" designation from all
in-tree comments, build text, and message strings, leaving the algorithm
named only as "Falcon". The eventual standardized name is not announced.

The differential known-answer test message ("wolfSSL FN-DSA differential
KAT") is a signed input, so the Falcon-512/1024 public keys and signatures
in wolfcrypt/test/test.c (and the mirrored Falcon-512 vector in
IDE/m33mu-falcon-verify/kat.h) were regenerated with liboqs over the new
message "wolfSSL Falcon differential KAT", preserving the differential
property (liboqs-produced signatures verified by the native verifier).

Verified: testwolfcrypt Falcon test passes; the m33mu verify-only harness
passes (BKPT 0x7f) with the regenerated vector.
2026-07-22 09:52:26 +02:00
Daniele Lacamera debc59f70b Falcon: crypto callback (WOLF_CRYPTO_CB) interface + CB_ONLY
Wire Falcon into the crypto callback framework like the other algorithms:

  - wc_falcon_make_key now dispatches to wc_CryptoCb_MakePqcSignatureKey
    (WC_PQC_SIG_TYPE_FALCON); wc_falcon_sign_msg / wc_falcon_verify_msg already
    dispatched to wc_CryptoCb_PqcSign / PqcVerify. All three fall through to the
    software implementation when the callback is unavailable.

  - Add WOLF_CRYPTO_CB_ONLY_FALCON (mirrors WOLF_CRYPTO_CB_ONLY_RSA/ECC): the
    callback becomes authoritative (no software fallback; returns NO_VALID_DEVID
    when no device is registered) and the native core (wc_falcon*.c) is compiled
    out entirely. WC_FALCON_HAVE_NATIVE_SIGN and the falcon_native_* prototypes
    are gated off in that build.

Tests (test.c):
  - myCryptoDevCb gains a Falcon branch for PQC keygen/sign/verify.
  - falcon_test / falcon_verify_kat now use the global test devId, so
    cryptocb_test drives every Falcon operation through the callback and asserts
    (via the exampleVar hit counter) that the cb path was actually taken.
  - Under WOLF_CRYPTO_CB_ONLY_FALCON, falcon_test instead confirms the API
    returns NO_VALID_DEVID with no device registered, and the KAT data/verifier
    (software-only) are compiled out.

Verified: default (no cryptocb), --enable-cryptocb, and
-DWOLF_CRYPTO_CB_ONLY_FALCON all build and pass testwolfcrypt (falcon_test +
crypto callback test); the CB_ONLY library contains no falcon_native_* symbols.
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
Marco Oliverio 3330bdc778 se050: test rsa encrypt/decrypt with SE050_KEY_ID_ONLY 2026-07-22 08:06:35 +02:00
Marco Oliverio 57d42ccb61 se050: implement dynamic hw/sw offload 2026-07-22 08:06:35 +02:00
Ruby Martin 97699a7c57 clear dereference before null check in myCryptoDevCb() 2026-07-21 09:48:51 -06: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
JacobBarthelmeh c1ee61c8d1 Merge pull request #10888 from SparkiDev/kmac_cshake
KMAC and cSHAKE: Add new algorithms
2026-07-17 16:49:25 -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
Paul Adelsbach 2bc5d47ec3 Add missing checks for WOLF_CRYPTO_CB_ONLY_CURVE25519, add test case for no swdev 2026-07-17 10:00:54 -07:00
philljj dc1c77e079 Merge pull request #10830 from padelsbach/ed25519-cryptocb-only
Add crypto callback only mode for ed25519
2026-07-17 11:42:31 -05:00