Commit Graph

1808 Commits (f313edb4cfa7227f1bd1bf4fa40bf51162ee2f15)

Author SHA1 Message Date
Daniel Pouzzner 8b8873fb2c
Merge pull request #8553 from kareem-wolfssl/zd19458
Check for whether librt is needed for clock_gettime.
2025-03-26 12:44:24 -05:00
Daniel Pouzzner 576c489b0f
Merge pull request #8583 from lealem47/fips_linuxkm
Remove linuxkm-pie dependency for FIPS linuxkm
2025-03-21 21:09:04 -05:00
Daniel Pouzzner b0a16a3d94 configure.ac: remove PWDBASED and PBKDF2 from fips=lean-aesgcm. 2025-03-21 16:56:24 -05:00
Lealem Amedie 2fdac57a69 Remove linuxkm-pie dependency for FIPS linuxkm 2025-03-21 15:36:31 -06:00
Daniel Pouzzner 1e89002762 fix various -Wdeclaration-after-statements, and add
-Wdeclaration-after-statement to .github/workflows/pq-all.yml.

rearrange code/gating in wolfcrypt/src/wc_mlkem.c:mlkemkey_encapsulate() for
  clarity and to fix a -Wdeclaration-after-statement.

also, made mlkem_encapsulate_c() and mlkem_encapsulate() return error code
  (currently always zero) rather than void, for consistency.

configure.ac: fix Kyber/ML-KEM option setup.
2025-03-21 15:46:44 -05:00
Kareem 91239dc42d Only search for clock_gettime when using RNG with wolfEntropy. 2025-03-21 11:05:24 -07:00
Kareem 17bb8c4c84 Check for whether librt is needed for clock_gettime. 2025-03-21 11:01:37 -07:00
Daniel Pouzzner 57ecd4b246 configure.ac: fix -DNO_BIG_INT setup to recognize $ENABLED_SP_MATH.
wolfcrypt/test/test.c: fix gating around modLen in rsa_test().

wolfssl/openssl/bn.h: remove superfluous WOLFSSL_SP_MATH gate around mp_int mpi
  in struct WOLFSSL_BIGNUM definition.

wolfssl/wolfcrypt/wolfmath.h: add check for "Conflicting MPI settings.", add
  initial check for WOLFSSL_SP_MATH_ALL || WOLFSSL_SP_MATH to include sp_int.h,
  and remove superfluous WOLFSSL_SP_MATH gate on "common math functions".
2025-03-20 22:18:22 -05:00
Daniel Pouzzner e870e7f6d2 configure.ac: in FIPS lean-aesgcm setup, don't lock features that are outside
the FIPS boundary, just set up appropriate defaults.

wolfssl/wolfcrypt/wolfmath.h: if legacy math back ends aren't defined, and
   NO_BIG_INT isn't defined, then always include sp_int.h, for backward compat.
2025-03-20 21:07:15 -05:00
Daniel Pouzzner b544354306 wolfssl/wolfcrypt/wolfmath.h: don't include an MPI header if NO_BIG_INT is
defined, and issue a #error if no MPI backend gate is defined and NO_BIG_INT
   is not defined either.

configure.ac:
* add support for FIPS lean-aesgcm[-{ready,dev}].
* implement handler for --enable-sha256.
* move setup for WOLFSSL_FIPS_DEV and WOLFSSL_FIPS_READY into the applicable
    per-flavor sections.
* fix sensing of $ENABLED_AESGCM in FIPS setup clauses to pivot on `!= "no"`
    rather than `= "yes"`, to accommodate "4bit" and other non-"yes" values.
* fix SNI_DEFAULT to be "no" if $ENABLED_TLS = no.
* fix ENABLED_DHDEFAULTPARAMS default to be $ENABLED_DH rather than yes.

wc_encrypt.c: add missing gates in wc_CryptKey() for NO_SHA256.

wolfcrypt/test/test.c: gating fixes for NO_SHA256.

wolfcrypt/benchmark/benchmark.c: basic fixes for building/running with
  --disable-rng (-DWC_NO_RNG).

With the above additions and fixes, it's now a clean build, test, and benchmark,
  with --disable-sha256 --enable-cryptonly --disable-hashdrbg --disable-rng
  --disable-hmac, though RSA/DH/ECC benches are disabled.
2025-03-20 20:03:34 -05:00
David Garske 2c36ae268f
Merge pull request #8536 from SparkiDev/kyber_to_mlkem
Update Kyber APIs to ML-KEM APIs
2025-03-20 11:07:53 -07:00
David Garske 4c0d4a931e
Merge pull request #8555 from bigbrett/default-devid-disable
Add option to disallow automatic use of "default" devId
2025-03-20 10:56:17 -07:00
Daniel Pouzzner ab7713676e linuxkm/lkcapi_glue.c: for AES-{CBC,CFB,GCM}, treat ctx->aes_{encrypt,decrypt}
as readonly in the encrypt/decrypt handlers -- clone them before setting the IV
-- for thread safety.  also, remove the "experimental" designation of
--enable-linuxkm-lkcapi-register=all.
2025-03-18 22:39:17 -05:00
Daniel Pouzzner ac89fbc9e6 linuxkm: fix AES-GCM shim implementation and self-test. 2025-03-17 17:25:53 -05:00
Brett Nicholas c7db28ef5a merge --no-default-devid configure option into --enable-cryuptocb=no-default-devid 2025-03-17 12:15:32 -06:00
Daniel Pouzzner 87c0ac90b8 configure.ac:
* sense assert.h and define WOLFSSL_HAVE_ASSERT_H accordingly.
* force off enable_aesgcm_stream if 32 bit armasm or riscv-asm (not yet implemented or buildable).
* add AM_CONDITIONAL([BUILD_CHACHA_NOASM, ...]) when --enable-chacha=noasm.

src/include.am: gate armasm/riscv_asm chacha files on !BUILD_CHACHA_NOASM.

tests/api.c: add missing HAVE_CHACHA&&HAVE_POLY1305 gate around test_TLSX_CA_NAMES_bad_extension().

wolfcrypt/src/chacha.c: tweak WOLFSSL_ARMASM and WOLFSSL_RISCV_ASM codepaths to also depend on !NO_CHACHA_ASM.

wolfssl/wolfcrypt/types.h: in setup for wc_static_assert(), #include <assert.h> if WOLFSSL_HAVE_ASSERT_H, >=C11, or >=C++11.
2025-03-13 23:17:57 -05:00
Brett Nicholas b7764e9308 add support for WC_NO_DEFAULT_DEVID to configure 2025-03-13 14:51:05 -06:00
Daniel Pouzzner c80a050c29 linuxkm/lkcapi_glue.c: fix aes-cfb wrappers, and add
WOLFSSL_DEBUG_TRACE_ERROR_CODES support for EINVAL/ENOMEM/EBADMSG;

configure.ac: remove ENABLED_EXPERIMENTAL requirement for
  --enable-linuxkm-lkcapi-register=cfb(aes);

linuxkm/module_hooks.c: omit "skipping full wolfcrypt_test" message if
  wc_RunAllCast_fips() was run.
2025-03-12 17:08:04 -05:00
Daniel Pouzzner 2a4dbbf545 configure.ac: remove mutual exclusion of armasm and WOLFSSL_AESXTS_STREAM --
this now works, and uses armasm-accelerated _AesEcb{En,De}crypt() via
  _AesXtsHelper().  also, add -DNO_CRYPT_TEST to CFLAGS in builds with
  $ENABLED_CRYPT_TESTS = no.
2025-03-11 14:47:32 -05:00
Sean Parkinson a7690ca24b ML-KEM/Kyber: finish name change 2025-03-10 08:37:14 +10:00
Daniel Pouzzner cbcca93fde configure.ac: print a warning, not an error, on "Conflicting asm settings", for backward compatibility. 2025-03-07 19:52:26 -06:00
Daniel Pouzzner 66376bed28 wolfcrypt/src/misc.c: in xorbufout() and xorbuf(), call XorWords() directly via a simplified path if all args are already aligned to WOLFSSL_WORD_SIZE (fixes performance regression from dc2e2631bc).
configure.ac: add a "Conflicting asm settings" error check at end, since our configuration currently blows up if --enable-intelasm and --disable-asm are combined.
2025-03-07 19:52:26 -06:00
Daniel Pouzzner dc2e2631bc linuxkm: various fixes for LKCAPI wrapper for AES-CBC (now passing kernel-native
self-test and crypto fuzzer), and de-experimentalize it.

wolfssl/wolfcrypt/types.h: add definitions for WOLFSSL_WORD_SIZE_LOG2.

wolfcrypt/src/misc.c: fix xorbuf() to make the XorWords() reachable; also,
  refactor integer division and modulus ops as masks and shifts, and add pragma
  to suppress linuxkm FORTIFY_SOURCE false positive -Wmaybe-uninitialized.
2025-03-05 17:56:08 -06:00
Reda Chouk 3e5e81c45f Enable TLS 1.3 middlebox compatibility by default with --enable-jni
Adding -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT flag to the default
compilation flags when --enable-jni is used.

Related PRs in other repositories:
- wolfSSL/wolfssljni#255
- wolfSSL/testing#845
2025-03-03 14:12:20 +01:00
Chris Conlon 9892ae0cb3 Enable DTLS 1.3 by default in --enable-jni build 2025-02-20 15:05:56 -07:00
Sean Parkinson 82b50f19c6 ML-KEM/Kyber: improvements
ML-KEM/Kyber:
  MakeKey call generate random once only for all data.
  Allow MakeKey/Encapsulate/Decapsulate to be compiled separately.
  Pull out public key decoding common to public and private key decode.
Put references to FIPS 140-3 into code. Rename variables to match FIPS
140-3.
  Fix InvNTT assembly code for x64 - more reductions.
  Split out ML-KEM/Kyber tests from api.c.

TLSX:
Store the object instead of the private key when WOLFSSL_MLKEM_CACHE_A
is defined or WOLFSSL_TLSX_PQC_MLKEM_STORE_OBJ. Faster decapsulation
when A is cached and object stored.
To store private key as normal define
WOLFSSL_TLSX_PQC_MLKEM_STORE_PRIV_KEY.

misc.c: when Intel x64 build, assume able to read/write unaligned
2025-02-20 08:14:15 +10:00
Marco Oliverio d7711f04ab openssl compat: skip OCSP response verification in statusCb
This aligns with OpenSSL behavior
2025-02-17 08:58:02 +00:00
Daniel Pouzzner 39ed0eabff configure.ac: fix handling of --enable-wolfEntropy (don't re-default to no in following --enable-entropy-memuse clause). 2025-02-14 15:39:42 -06:00
Daniel Pouzzner e806bd76bb
Merge pull request #8445 from SparkiDev/perf_improv_1
Performance improvements
2025-02-13 23:25:47 -06:00
Sean Parkinson 9253d1d3ac ML-KEM/Kyber: cache A from key generation for decapsulation
Matrix A is expensive to calculate.
Usage of ML-KEM/Kyber is
  1. First peer generates a key and sends public to second peer.
2. Second peer encapsulates secret with public key and sends to first
peer.
3. First peer decapsulates (including encapsulating to ensure same as
seen) with key from key generation.
Caching A keeps the matrix A for encapsulation part of decapsulation.
The matrix needs to be transposed for encapsulation.
2025-02-13 10:12:05 +10:00
Sean Parkinson bfd52decb6 Performance improvements
AES-GCM: don't generate M0 when using assembly unless falling back to C
and then use new assembly code.
HMAC: add option to copy hashes (--enable-hash-copy
-DWOLFSSL_HMAC_COPY_HASH) to improve performance when using the same key
for multiple operations.
2025-02-13 09:55:55 +10:00
Andrew Hutchings 8870b76c26 Fix SE050 Port
The SE050 port won't compile in the latest wolfSSL. This patch:

* Updates the documentation
* Fixes a missing `#ifdef` that breaks the build
* Changes the use of `mp_int` to `MATH_INT_T`
* Fixes compiler error with `ecc.c`
* Adds a tiny bit of extra debugging info
2025-02-10 14:27:28 +00:00
Anthony Hu f86b19dd30 Fix some typoes around Kyber and Dilithium 2025-01-31 10:13:39 -05:00
Juliusz Sosinowicz c5ad780798 Force experimental flag to enable ascon 2025-01-29 11:02:47 +01:00
Juliusz Sosinowicz e3a612300b Initial ASCON hash256 and AEAD128 support based on NIST SP 800-232 ipd
Implemented based on the NIST Initial Public Draft "NIST SP 800-232 ipd". Testing based on KAT's available at https://github.com/ascon/ascon-c. Added configuration for testing in github action.
2025-01-29 11:02:47 +01:00
Daniel Pouzzner 2eb775d5c3 configure.ac: add enable_dtls_mtu, enable_dtlscid, and enable_dtls_frag_ch to features disabled when $ENABLED_TLS" = "no". 2025-01-28 09:46:39 -06:00
Juliusz Sosinowicz 8ca59242a2 Expand enable-all
- Add dtls mtu to enable-all
- Add dtls 1.3 to enable-all
- Add dtls cid to enable-all
- Add dtls ch frag to enable-all
2025-01-27 13:38:00 +01:00
Daniel Pouzzner bd014e02e0 configure.ac: tweaks for clarity 2025-01-24 16:09:43 -06:00
Daniel Pouzzner 6102dafa48 configure.ac: require explicit arg for --enable-fips. 2025-01-22 12:48:52 -06:00
Daniel Pouzzner ad5018ee5d configure.ac: fix --enable-debug-trace-errcodes=backtrace with --enable-reproducible-build: don't add -g0 to CFLAGS when both are enabled, because -g0 makes backtracing impossible. 2025-01-08 15:59:11 -06:00
Sean Parkinson 7d3ee74a71 Aarch64 ASM: Use CPU features for more
AES GCM streaming - fix GHASH_ONE_BLOCK to use CPU feature information.
AES-GCM uses EOR3 (SHA-3 instruction) - split assembly code.
Kyber uses SQRDMLSH - split assembly code.

Changed define from WOLFSSL_AARCH64_NO_SQRMLSH to
WOLFSSL_AARCH64_NO_SQRDMLSH to match instruction.

Improved array data format for inline assembly code.
2025-01-02 19:56:04 +10:00
JacobBarthelmeh 70e41d1ed1 prepare for release 5.7.6 2024-12-31 08:27:53 -07:00
Sean Parkinson 93812e4286
Merge pull request #8289 from JacobBarthelmeh/harden
add option for additional sanity checks
2024-12-24 09:17:08 +10:00
JacobBarthelmeh ee9b88541f change default to no for --enable-faultharden 2024-12-23 13:51:30 -07:00
Daniel Pouzzner 994f218fcb src/ssl.c and wolfssl/internal.h: gate in wolfSSL_get_ciphers_compat() in OPENSSL_EXTRA builds, so that --with-sys-crypto-policy works with OPENSSL_EXTRA but without OPENSSL_ALL.
configure.ac: more fixes for FIPS v6 armasm settings, re ENABLED_ARMASM_CRYPTO.
2024-12-19 14:29:39 -06:00
jordan b5c47d27e0 fedora crypto-policies: initial support. 2024-12-18 16:56:36 -06:00
Sean Parkinson ba050d6a3f
Merge pull request #8296 from douzzer/20241217-FIPS-v6-ENABLED_ARMASM_CRYPTO-fixes
20241217-FIPS-v6-ENABLED_ARMASM_CRYPTO-fixes
2024-12-18 15:27:08 +10:00
David Garske 356889a528 Add `--disable-tls` option that can be used with `--enable-all` to disable TLS features and set `NO_TLS`. Useful for allowing certificate manager and crypto compatibility API's only. 2024-12-17 13:40:03 -08:00
Daniel Pouzzner 7b57ef4912 configure.ac: fix faulty logic in FIPS v6 feature calculation re ENABLED_ARMASM_CRYPTO, originally added in 6e0a90190f. 2024-12-17 12:21:47 -06:00
Daniel Pouzzner 5aeabbfa3c
Merge pull request #8245 from julek-wolfssl/mbed-interop
Add CID interop with mbedtls
2024-12-16 23:04:19 -06:00