Commit Graph
521 Commits
Author SHA1 Message Date
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
Daniel Pouzzner 64a91957af fixes from AI review:
linuxkm/x86_vector_register_glue.c: in wc_save_vector_registers_x86(), properly squelch the hard-IRQ call warning if flags & WC_SVR_FLAG_MAYBE_INHIBIT;

src/internal.c: in AllocKey(), properly set key_inited = 1 if wc_SlhDsaKey_Init() succeeds;

.github/workflows/fips-dev-no-post.yml: test -DWC_FIPS_AESGCM_NO_SHORT_NONCES.
2026-08-05 13:53:47 -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 1404ffbb45 Makefile.am: add HAVE_FIPS_VERSION_MAJOR / _MINOR / _PATCH to the variables
exported to the linuxkm sub-make.

linuxkm/Kbuild:
* Feature-detect $(intcmp) (GNU make >= 4.4) into $(HAVE_INTCMP).
* Derive FIPS_OPTEST_NO_DH from $(HAVE_FIPS_VERSION_MAJOR) via $(intcmp) when
  available; otherwise $(error) with instructions to supply it on the make
  command line. When set, build the optest wrapper with -DNO_DH -- DH is not
  optested at FIPS v7+ even when the module has DH, because its APIs have no
  FIPS wrappers.
* Same $(intcmp)/$(error) treatment for NO_PIE_FLAG (target kernel < 5.11), and
  change its test from `ifdef NO_PIE_FLAG` to an explicit
  `ifeq "$(NO_PIE_FLAG)" "0"` so an explicitly-zero value means what it says.
* Add $(CFLAGS_AUTO_VECTORIZE_DISABLE) to benchmark.o ccflags-y and drop its
  unused asflags-y line.
2026-08-05 13:53:47 -05:00
Daniel Pouzzner c8dae62769 linuxkm/lkcapi_glue.c: make the #error message for defined(CONFIG_CRYPTO_FIPS) != defined(HAVE_FIPS) more informative. 2026-08-05 13:53:47 -05:00
Daniel Pouzzner 348ea894f2 refactor linuxkm_affinity_lock() and linuxkm_affinity_unlock() to use SAVE_VECTOR_REGISTERS_MAYBE_INHIBIT() and RESTORE_VECTOR_REGISTERS_MAYBE_INHIBITED(), and in wc_linuxkm_rng_bank_init(), disable vector ops only if FIPS <v7. 2026-08-05 13:53:46 -05:00
Daniel Pouzzner 47d6666599 linuxkm/x86_vector_register_glue.c, linuxkm/linuxkm_wc_port.h: add a
MAYBE_INHIBIT vector-register save mode for the convenience of the DRBG glue
logic.

Add WC_SVR_FLAG_MAYBE_INHIBIT = 2 (WC_SVR_FLAG_FUZZ becomes 4), and add
SAVE_VECTOR_REGISTERS_MAYBE_INHIBIT() / RESTORE_VECTOR_REGISTERS_MAYBE_INHIBITED()
macros, routing through wc_{save,restore}_vector_registers_x86(WC_SVR_FLAG_MAYBE_INHIBIT).

linuxkm/x86_vector_register_glue.c: implement the mode.  A _MAYBE_INHIBIT call
must be outermost (BAD_STATE_E otherwise, and a warning on the matching restore
at non-outermost depth).  The fuzzer check moves ahead of the inhibit decision
so that a fuzzed failure converts into an inhibited (rather than failed)
acquisition when _MAYBE_INHIBIT is set; a real inability to use SIMD
(preempt_count() != 0 && !may_use_simd()) does the same.  The restore path
treats _MAYBE_INHIBIT like _INHIBIT when deciding whether registers were
actually taken.

Note, under fuzzer vector disablement,
wc_save_vector_registers_x86(WC_SVR_FLAG_MAYBE_INHIBIT) returns 0 with affinity
locked, as though explicit WC_SVR_FLAG_INHIBIT were passed.  Thus on 0 return,
the caller must use `CAN_SAVE_VECTOR_REGISTERS()` to discover whether vector
registers are actually usable.
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 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
Daniele Lacamera 662b7978fc Falcon: enable SSE2 for the fpr asm object in the LinuxKM build
The generated wc_falcon_fpr_x86_64_asm.S implements the fpr seam with SSE2
scalar double math (mulsd/divsd/sqrtsd/ucomisd on xmm; no x87), so its object
needs the vector instructions enabled in the assembler -- the same
ASFLAGS_FPU_DISABLE_SIMD_ENABLE the other vectorized _asm.o files use -- plus
OBJECT_FILES_NON_STANDARD for objtool. Run-time FPU state is handled by the
SAVE_VECTOR_REGISTERS2() wrapping added in falcon.c. The C file falcon.o needs
no rule: the kernel module uses the asm (or emulated) fpr backend, where
falcon.c is integer-only, exactly as the ML-KEM/ML-DSA C poly files do.
2026-07-27 23:48:44 +02:00
Daniel Pouzzner 6325c48030 fixes from AI review:
linuxkm/lkcapi_aes_glue.c and linuxkm/lkcapi_sha_glue.c: add CMAC and SHA-3 to algs warned for incompatibility with kernels <5.6;

linuxkm/lkcapi_aes_glue.c, wolfcrypt/src/aes.c, wolfcrypt/src/memory.c, and wolfssl/wolfcrypt/memory.h: fix WC_DEBUG_CIPHER_LIFECYCLE in kernel mode (km_AesGet() and km_AesCmacMaterialize()), add WARN_UNUSED_RESULT to wc_debug_CipherLifecycle*(), and fix an unchecked wc_debug_CipherLifecycleFree() in wc_AesFree();

linuxkm/lkcapi_aes_glue.c: fix unsafe wc_CmacFree() call in km_AesCmacSetKey();

linuxkm/lkcapi_sha_glue.c: in km_hmac_export(), avoid unlocked access to snapshot->desc_id (possible UAF under extreme pressure).
2026-07-24 16:39:55 -05:00
Daniel Pouzzner 3af441de54 linuxkm/linuxkm_wc_port.h: fix raw_spinlock.magic poison strategy in wc_FreeMutex(). 2026-07-24 16:39:55 -05:00
Daniel Pouzzner 87149fe5a6 linuxkm/: rename enabled_fips to enabled_kernel_fips_enabled, and fix gating on its declaration (add dependency on defined(CONFIG_CRYPTO_FIPS)); use FIPS_NOT_ALLOWED_E rather than NOT_COMPILED_IN to signal FIPS-forbidden keysizes from linuxkm_test_ecdh_nist_driver() and linuxkm_test_ecdsa_nist_driver() to REGISTER_ALG_OPTIONAL(). 2026-07-24 16:39:55 -05:00
Daniel Pouzzner 3d46cf4980 wolfcrypt/src/sha{256,512}.c, wolfssl/wolfcrypt/sha{256,512}.h, wolfssl/wolfcrypt/settings.h:
* Revert earlier changes adding WC_SHA256_W_SIZE and WC_SHA512_W_SIZE.

* Add WC_SHA2_NO_SMALL_STACK to allow the W work buffer to move back onto the
  stack.

* In wolfssl/wolfcrypt/settings.h, define WC_SHA2_NO_SMALL_STACK by default when
  WOLFSSL_KERNEL_MODE, and add a clause to #undef WOLFSSL_SMALL_STACK when
  building the SHA-2 implementations.

linuxkm/lkcapi_sha_glue.c:

* Refactor out superfluous struct km_sha_state.

* Clean up some macro dynamics.

* Add static asserts on HASH_MAX_STATESIZE to WC_LINUXKM_SHA1_IMPLEMENT() and
  WC_LINUXKM_SHA2_IMPLEMENT().
2026-07-24 16:39:54 -05:00
Daniel Pouzzner dd1268eef5 linuxkm/lkcapi_sha_glue.c: refactor HMAC export/import mechanism:
* Eliminate pointer from export blob, replacing it with a TFM-specific random cookie and per-desc serial ID.
* Fixes kernel address disclosure risk, handle forgery risk, cross-TFM confusion risk, and heap pointer reuse risk.
2026-07-24 16:39:54 -05:00
Daniel Pouzzner fcabd0df0b linuxkm/lkcapi_sha_glue.c: add struct km_sha3_state_by_pointer to tighten up SHA-3 allocations, avoiding frivolous struct km_sha_state (with inline wc_Sha512) for SHA-3. 2026-07-24 16:39:54 -05:00
Daniel Pouzzner c039151deb linuxkm/: add defined(CONFIG_CRYPTO_FIPS) condition to a couple macro conjunctions to fix constant-folding-provoked compiler warnings around fips_enabled;
for clarity, rename internal macros WC_LINUXKM_HAVE_SELFTEST and WC_LINUXKM_HAVE_SELFTEST_FULL to WC_LINUX_CONFIG_SELFTESTS and WC_LINUX_CONFIG_SELFTESTS_FULL respectively.
2026-07-24 16:39:54 -05:00
Daniel Pouzzner 1a7bc938ab linuxkm/lkcapi_sha_glue.c: fix export/import for HMAC:
* add to struct km_sha_hmac_pstate members desc_list_lock, desc_list, export_list, and export_list_len;
* add struct km_sha_hmac_export_state;
* add km_hmac_alloc_tstate(), km_hmac_export(), km_hmac_import(), km_hmac_test_export_import();
* and update km_hmac_*() and WC_LINUXKM_HMAC_IMPLEMENT(() to implement.
2026-07-24 16:39:54 -05:00
Daniel Pouzzner e57c56c0f9 linuxkm/lkcapi_sha_glue.c: add struct km_sha3_export_state, and implement km_sha3_export() and per-alg _import() methods, and km_sha3_test_export_import(). 2026-07-24 16:39:54 -05:00
Daniel Pouzzner fc220b75c1 linuxkm/lkcapi_sha_glue.c: refactor SHA-3 state around struct km_Sha3TfmCtx,
adding km_sha3_init_tfm(), km_sha3_exit_tfm(), km_sha3_alloc_tstate(), and
  km_sha3_free_tstate(), implementing garbage collection of abandoned shash_desc
  objects at .exit_tfm.
2026-07-24 16:39:54 -05:00
Daniel Pouzzner 969cd9de5d linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c: implement magic checks on kernel struct wolfSSL_Mutex in WOLFSSL_LINUXKM_VERBOSE_DEBUG builds. 2026-07-24 16:39:54 -05:00
Daniel Pouzzner dc16169cd3 linuxkm/lkcapi_sha_glue.c: fix sha.W lifecycle management to prevent leaks:
* separate WC_LINUXKM_SHA_IMPLEMENT() into WC_LINUXKM_SHA1_IMPLEMENT() (no fixes
  needed) and WC_LINUXKM_SHA2_IMPLEMENT() (with associated new helpers
  WC_LINUXKM_SHA2_FREE_W(), WC_LINUXKM_SHA2_DECL_W(), WC_LINUXKM_SHA2_PUSH_W(),
  and WC_LINUXKM_SHA2_POP_W(), that move .W to a stack buffer).

* Reimplement SHA-2 one-shot digest callback to use only direct wolfCrypt calls
  rather than proxy to other callbacks.
2026-07-24 16:39:54 -05:00
Daniel Pouzzner 51c5df3a25 linuxkm/lkcapi_aes_glue.c, linuxkm/lkcapi_glue.c, configure.ac: implement linuxkm cmac(aes) glue. 2026-07-24 16:39:54 -05: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 ef070bf564 linuxkm/linuxkm-fips-hash-wrapper.sh: fix dependency on SHA-2 coreKey. 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 2cf826f03d KCAPI and linuxkm fixes from peer review:
linuxkm/lkcapi_aes_glue.c: zero the ephemeral ivOut in AesGcmCrypt_1().

wolfcrypt/src/port/kcapi/kcapi_aes.c: tighten the test on the return value from kcapi_aead_decrypt().
2026-07-13 17:12:20 -05:00
Daniel Pouzzner 972fa21b27 linuxkm/lkcapi_aes_glue.c: in non-streaming AesGcmCrypt_1(), use wc_AesGcmSetExtIV() and wc_AesGcmEncrypt_ex(), not wc_AesGcmEncrypt(), to stay inside FIPS boundary. 2026-07-10 17:27:36 -05:00
Daniel Pouzzner 3ef3e980f8 linuxkm/Makefile: move --no-silent kludge into $(NO_SILENT), off by default (apparently unneeded with make 4.4.1 and current Makefile/Kbuild). 2026-07-10 17:24:48 -05:00
Daniel Pouzzner 3965993c6d wolfssl/wolfcrypt/types.h: in fallback definition of DISABLE_VECTOR_REGISTERS(), return NOT_COMPILED_IN rather than (-1), for clarity and traceability.
linuxkm/lkcapi_sha_glue.c: require defined(WOLFSSL_EXPERIMENTAL_SETTINGS) when defined(WOLFSSL_LINUXKM_USE_GET_RANDOM_KPROBES).
2026-07-07 00:19:48 -05:00
Daniel Pouzzner bd977dc0b9 linuxkm/lkcapi_ecdsa_glue.c and linuxkm/lkcapi_glue.c: implement support for ECDSA verify on kernel 6.13+ (struct sig_alg API). 2026-07-07 00:19:48 -05:00
Daniel Pouzzner 09db3a6410 linuxkm/linuxkm_wc_port.h:
* set up WC_LINUXKM_HAVE_SELFTEST and WC_LINUXKM_HAVE_SELFTEST_FULL early.
* replace the forced-downgrade from FIPS 186-5 to 186-4 for SHA-1 support, with a #error if configuration is incompatible.

linuxkm/linuxkm_wc_port.h, linuxkm/lkcapi_glue.c, linuxkm/module_exports.c.template, linuxkm/module_hooks.c, wolfcrypt/src/random.c: consolidate into the warning-masked span of linuxkm_wc_port.h, the #includes for kernel headers linux/fips.h, linux/vmalloc.h, and linux/random.h.
2026-07-07 00:19:48 -05:00
Daniel Pouzzner d7a29f58b4 wolfcrypt/src/aes.c: activate USE_INTEL_SPEEDUP when defined(USE_INTEL_SPEEDUP_FOR_AES) in the WOLFSSL_X86_64_BUILD build path too.
linuxkm/lkcapi_aes_glue.c: tweak WOLFKM_AES_DRIVER_ISA_EXT to reflect AVX512 and VAES capabilities.
2026-07-07 00:19:48 -05:00
Daniel Pouzzner ed4fb32c92 fixes from Fenrir review:
linuxkm/linuxkm_wc_port.h: strcpy() takes 2 args.

wolfcrypt/src/aes.c: add VECTOR_REGISTERS_PUSH2() and use it to free tmp in smallstack path if the push fails.
2026-07-01 13:46:11 -05:00
Daniel Pouzzner 41daf899b3 linuxkm/linuxkm_wc_port.h:
* when including kernel headers with gcc-17+, ignore -Wconstant-logical-operand.

* when CONFIG_KMSAN, explicitly map memcpy(), memset(), memmove(), strcpy(),
  strncpy(), and strncat(), to clang builtins, to get proper __msan
  interception.

* genericize WC_SANITIZE_DISABLE() and WC_SANITIZE_ENABLE() to cover both KASAN
  and KMSAN, and use the generic macros in wc_linuxkm_stack_hwm_prepare() and
  wc_linuxkm_stack_hwm_measure_rel().
2026-07-01 12:35:21 -05:00
philljjandGitHub 3fa342a76c Merge pull request #10812 from douzzer/20260629-linuxkm-fixes
20260629-linuxkm-fixes
2026-06-30 13:36:04 -05:00
Daniel Pouzzner 6560777d05 linuxkm/linuxkm_wc_port.h: fix F-6395 "WC_LINUXKM_ROUND_UP_P_OF_2(1) invokes undefined behavior via __builtin_clzl(0)".
linuxkm/lkcapi_rsa_glue.c: fix F-6120 "RSA PKCS#1 verify paths omit the digest-encode bounds check present in the sign paths (potential heap overflow with sub-default RSA key sizes)".
2026-06-29 19:09:20 -05:00
Daniel Pouzzner 262b0ed3b8 tweaks for linuxkm targeting clang-built kernels:
linuxkm/: when logging PTR_ERR(), cast it to int, and use "%d" as the format.  Globally, `#define PTR_ERR(x) ((int)PTR_ERR(x))` in linuxkm_wc_port.h to fix clang warnings on kernel headers.

linuxkm/lkcapi_aes_glue.c: add casts in linuxkm_test_aesgcm() to mollify clang.

linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c:
* add __clang__ compat code to allow including clang stdatomic.h while masking out kernel-incompatible __CLANG_STDINT_H.
* add clang-specific suppressions for kernel headers (-Wshorten-64-to-32, -Wframe-address).

linuxkm/lkcapi_sha_glue.c:
* in wc__get_random_bytes(), add bounds-checking for len.
* in wc_extract_crng_user(), fix type conflicts.

wolfssl/wolfcrypt/wc_port.h and wolfssl/wolfcrypt/types.h:
* move the old-FIPS compatibility mapping from INLINE to WC_INLINE from types.h to wc_port.h.
* activate stdatomic.h for clang kernel module builds.

linuxkm/Kbuild:
* add clang-specific flags.
* add gcc gate around gcc-specific flags.
* allow override value for MAX_STACK_FRAME_SIZE.

wolfcrypt/src/asn.c: add casts in GetFormattedTime_ex() to mollify clang build of linuxkm.
2026-06-27 14:48:17 -05:00
Daniel Pouzzner 649197d159 replace several nonconformant uses of __FUNCTION__ with __func__ (linuxkm/linuxkm_memory.c, wolfcrypt/src/random.c, wolfcrypt/test/test.c, wolfssl/wolfcrypt/mem_track.h, wolfssl/wolfcrypt/memory.h, wolfssl/wolfcrypt/settings.h). 2026-06-27 14:37:35 -05:00
Daniel Pouzzner bf088dfc3c linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c: on kernel >= 7.2, remove indirect symbol support for strncpy and add backward-compat implementation wc_linuxkm_strncpy(). 2026-06-27 14:34:06 -05:00
Daniel Pouzzner 538262a5dc linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c: add linuxkm-pie support for CheckOcspResponder() (WOLFSSL_NO_OCSP_ISSUER_CHECK is no longer implied by KERNEL_MODE_DEFAULTS). 2026-06-27 14:30:57 -05:00
Daniel Pouzzner 8b5b6af44e linuxkm/x86_vector_register_glue.c, linuxkm/linuxkm_wc_port.h, wolfssl/wolfcrypt/memory.h: add WC_SVR_FLAG_FUZZ, implement support for DEBUG_VECTOR_REGISTER_ACCESS_FUZZING directly in the save/restore implementations, and properly reflect existing save state there and in the _FUZZING variants of SAVE_VECTOR_REGISTERS2(). 2026-06-27 14:21:00 -05:00
Daniel Pouzzner d4eaeb1b2e linuxkm/lkcapi_sha_glue.c: refactor error code handling in wc_linuxkm_drbg_generate() (followup to 3c9996efe0 in #10688). 2026-06-26 14:25:48 -05:00
Daniel Pouzzner c38f11b9a7 fixes for false positives on linuxkm CONFIG_FORTIFY_SOURCE builds on gcc-16:
linuxkm/linuxkm_memory.c: use packed-struct intermediates rather than memcpy()s for wc_get_unaligned() and wc_put_unaligned().

linuxkm/linuxkm_wc_port.h: on old FIPS, retrofit nonnull attribute to GHASH() arg 1, so that it unconditionally writes out the hash.

wolfcrypt/src/aes.c and wolfssl/wolfcrypt/aes.h: in GHASH(), add nonnull attribute to arg 1, and remove runtime nullness check for arg 1 in the implementations.
2026-06-26 14:25:48 -05:00
Sean Parkinson a342eba578 Intel x64 ASM: Add new assembly for AES
Support AES-XTS AVX512/VAES
Support AES-GCM AVX512/VAES
Support AES-ECB/CBC/CTR AVX512/VAES/AVX1/AES-NI.
Remove code from aes_asm.S/aes_asm.asm
Add CPU defines for AVX512 and VAES
Updated ASM files with new defines for AVX512.
Added support for printing out the new CPU Id flags in benchmark.
Added new files to Windows projects.
aes.c: Supports ECB/CBC/CTR in assembly. Supports calling AVX512/VAES assembly.
2026-06-23 20:54:59 +10:00
Daniel Pouzzner 296bfc8a83 wolfcrypt/src/random.c:
* in USE_WINDOWS_API wc_GenerateSeed(), recognize HAVE_AMD_RDSEED, and properly enforce FORCE_FAILURE_RDSEED when CPU support is missing;

* in WOLFSSL_LINUXKM wc_GenerateSeed(), initialize ret to RNG_FAILURE_E, and properly enforce FORCE_FAILURE_RDSEED when CPU support is missing;

* in WOLFSSL_BSDKM wc_GenerateSeed(), properly enforce FORCE_FAILURE_RDSEED when CPU support is missing;
2026-06-18 11:53:44 -05:00
Daniel Pouzzner 5aad1447b6 fix F-1236: Copy-Paste Error in #endif Comment: AESCBC Instead of AESCFB Info Assigned
fix F-3291: Copy-paste error in linuxkm_test_aesgcm error message uses WOLFKM_AESCBC_DRIVER
fix F-1431: AES-GCM RFC4106 SetKey Uses memcpy Instead of XMEMCPY for Nonce Copy

(note, for F-1431, changed all relevant memset() and memcpy() calls in linuxkm/ to XMEMSET() and XMEMCPY() respectively.)
2026-06-15 12:28:23 -05:00
Daniel Pouzzner 3c9996efe0 fix F-5958: wc_linuxkm_drbg_generate returns untranslated wolfCrypt RNG_FAILURE_E on the slen>0 reseed-failure path 2026-06-15 12:28:23 -05:00
Daniel Pouzzner bd804c632c fix F-5957: atomic_t fallback of wc_lkm_refcount_to_int reads address of pointer parameter instead of the refcount 2026-06-15 12:28:23 -05:00