Commit Graph

10117 Commits

Author SHA1 Message Date
David Garske
c5ae76e40d Fixed issue with AES ECB offloading to hardware to use full size, not
just block
2025-10-29 15:52:33 -07:00
Daniel Pouzzner
9b90ea83eb src/x509.c: in wolfSSL_X509_get_ext_by_OBJ() and wolfSSL_X509_load_cert_crl_file(), add local protection from null derefs (fixes -Wnull-dereferences);
wolfcrypt/src/chacha.c and wolfssl/wolfcrypt/chacha.h: implement USE_ARM_CHACHA_SPEEDUP gate;

wolfcrypt/src/kdf.c: in wc_SSH_KDF(), add early return if _HashInit() fails (fixes _HashFree() of uninited _hash);

wolfcrypt/src/sha256.c: initialize sha256->W in ARMASM variant of wc_InitSha256_ex(), and pass sha256->heap to XMALLOC/XFREE consistently.
2025-10-28 16:42:14 -05:00
David Garske
a4be322fd6 Merge pull request #9356 from SparkiDev/sp_asm_add_sub_p384_arm
SP ASM ARM32/Thumb2: inline asm for add and subs
2025-10-28 08:55:54 -07:00
Sean Parkinson
50521699af SP ASM ARM32/Thumb2: inline asm for add and subs
Implement add, sub, double and triple in assembly for P384.
2025-10-28 17:49:40 +10:00
Sean Parkinson
d883a950d2 ML-KEM SHA-3: fix r
Constant r wasn't being loaded into register in all assembly functions
that use it - it just got lucky most of the time.
2025-10-28 12:04:12 +10:00
Sean Parkinson
070923a373 AES ARM ASM: user data loaded 1 reg at a time
User key may not be aligned and need to use instructions that don't
require alignment. Change to use ldr instead of ldp or ldrd.
2025-10-28 11:03:58 +10:00
David Garske
e6af5bcd4f Merge pull request #9353 from embhorn/gh9347
Build errors in memtest config and sniffer
2025-10-27 13:15:00 -07:00
JacobBarthelmeh
a1d000cede Merge pull request #9343 from dgarske/silabs_aesdirect
Fixed issue with SiLibs AES Direct (required by DTLS v1.3)
2025-10-27 13:04:12 -06:00
David Garske
76abc43812 Put unused fix in correct location. 2025-10-27 10:25:31 -07:00
David Garske
c825d0b34c Merge pull request #9345 from JacobBarthelmeh/devid
fix for passing devId from WOLFSSL_CTX down to hash operation
2025-10-27 08:47:51 -07:00
Eric Blankenhorn
7ef560c188 Fix build error with memtest and memorylog 2025-10-27 10:47:13 -05:00
Sean Parkinson
093cc04076 Stack API: Pull out implementation into separate file
General stack APIs pulled out into ssl_sk.c.
Other simple APIs also pulled out into ssl_sk.c.
wolfSSL_lh_retrieve also pulled out into ssl_sk.c.

Added tests of public APIs that weren't already tested.
2025-10-27 17:08:41 +10:00
JacobBarthelmeh
1a779b3f73 fix for passing devId from WOLFSSL_CTX down to hash operation 2025-10-24 16:39:25 -06:00
Daniel Pouzzner
c145b7ee81 wolfcrypt/src/aes.c: define GCM_GMULT_LEN() when WOLFSSL_ARMASM, and fix gating on wolfCrypt_FIPS_AES_sanity (always gate in for FIPS v7+);
wolfcrypt/src/port/af_alg/afalg_aes.c: check for null key arg;

configure.ac: rename BUILD_FIPS_CURRENT to BUILD_FIPS_V2_PLUS (no functional change), and remove unused ARMASM_DIST_SOURCES set up code added in #9332;

src/include.am:
* set up $(ARMASM_SHA256_C), and use it to properly include wolfcrypt/src/sha256.c alongside armasm when appropriate;
* fix gating on Curved25519 armasm (BUILD_FIPS_V6_PLUS, not BUILD_FIPS_V6);

tests/api/test_aes.c and wolfcrypt/test/test.c: gate out incompatible coverage for WOLFSSL_AFALG and WOLFSSL_KCAPI (test_wc_AesCbcEncryptDecrypt_MultiBlocks(), test_wc_AesCtrSetKey*(), test_wc_AesCtrEncrypt*(), test_wc_AesGcmEncryptDecrypt_Sizes()).
2025-10-24 15:08:56 -05:00
David Garske
d62b1068d2 Fixed issue with SiLibs AES Direct (required by DTLS v1.3). ZD 20695 2025-10-24 11:58:56 -07:00
JacobBarthelmeh
7f5d02c36b Merge pull request #9317 from SparkiDev/benchmark_asym_cc
Benchmark: add cycle counts for asym ops
2025-10-23 09:31:30 -06:00
Daniel Pouzzner
b1f2ff73ed wolfcrypt/src/sha256.c: in wc_Sha256HashBlock(), use ByteReverseWords() rather than a series of ByteReverseWord32() to get WOLFSSL_USE_ALIGN. 2025-10-22 22:54:20 -05:00
Daniel Pouzzner
be301f93da fixes for autotools config around armasm AES/SHA refactor in #9284: in configure.ac, add BUILD_FIPS_V5_PLUS and BUILD_FIPS_V6_PLUS conditionals, and fix BUILD_FIPS_V6 conditional to match v6 only;
in src/include.am, add LEGACY_ARMASM_foo and NEW_ARMASM_foo helper variables, restore pre-PR9284 armasm clauses, and add or update several FIPS gates as needed;

add empty wolfcrypt/src/port/arm/{armv8-aes.c,armv8-sha256.c,armv8-sha512.c} to mollify autotools, and in wolfcrypt/src/include.am, restore them to EXTRA_DIST if FIPS v5 or v6.
2025-10-22 22:52:24 -05:00
Sean Parkinson
dc45a6f340 Benchmark: add cycle counts for asym ops
Added million of cycles per op information.
Getting cycle count for Aarch64 now too.
2025-10-23 08:43:05 +10:00
JacobBarthelmeh
4daab8a813 Merge pull request #9284 from SparkiDev/aarch64_asm_gen
Aarch64 asm: convert to generated
2025-10-22 11:10:27 -06:00
JacobBarthelmeh
520d9501af Merge pull request #9322 from SparkiDev/crldist_reason_fix
X.509 cert: crl distribution point reasons is IMPLICIT
2025-10-22 09:33:08 -06:00
Sean Parkinson
8533bc803b AES: Improve CFB and OFB and add tests
Improve performance of CFB and OFB.
Only have one implementation that is used by OFB encrypt and decrypt.

Update AES testing in unit.test.

Update benchmarking of CFB and OFb to include decrypt.
2025-10-22 12:19:56 +10:00
philljj
7e6c86a6c3 Merge pull request #9326 from douzzer/20251021-KDF-FIPS-gate-tweaks
20251021-KDF-FIPS-gate-tweaks
2025-10-21 12:49:21 -05:00
David Garske
9c3a0e3a67 Merge pull request #9324 from douzzer/20251020-coverity-WC_SAFE_foo
20251020-coverity-WC_SAFE_foo
2025-10-21 09:41:25 -07:00
JacobBarthelmeh
936e350c63 Merge pull request #9325 from LinuxJedi/zp-fixes
Fix things found with ZeroPath
2025-10-21 10:19:01 -06:00
Brett Nicholas
1134d246f7 Merge pull request #9309 from night1rider/CryptoCbCopy
Add crypto callback support for copy/free operations (SHA-256)
2025-10-21 09:45:18 -06:00
Daniel Pouzzner
b07bc74a71 wolfcrypt/test/test.c: skip nist_sp80056c_kdf_test() and nist_sp800108_cmac() on FIPS <7.0.0. 2025-10-21 10:38:55 -05:00
David Garske
c1339abc05 Merge pull request #9323 from philljj/fix_coverity_onestep
KDF onestep: hashOutSz err check.
2025-10-21 08:23:05 -07:00
David Garske
6f9ca6cb52 Merge pull request #9294 from LinuxJedi/benchmark-ram
Benchmark memory tracking
2025-10-21 08:15:28 -07:00
Andrew Hutchings
be1428d108 Validate AF_ALG RSA inputs
Require the ciphertext length to match the RSA modulus before copying into the AF_ALG Xilinx stack buffer, preventing oversized inputs from overflowing the aligned scratch space.
2025-10-21 13:57:36 +01:00
Sean Parkinson
9c1462a9ec Aarch64 asm: convert to generated
Algorithms now generated:
  SHA-256
  SHA-512
  ChaCha20
  Poly1305
  AES-ECB
  AES-CBC
  AES-CTR
  AES-GCM + streaming
  AES-XTS
  AES SetKey

ARM32 asm algorithms generated now too:
  SHA-256
  SHA-512
  ChaCha20
  AES-ECB
  AES-CBC
  AES-CTR
  AES-GCM
  AES-XTS
  AES SetKey

Removed use of ARM specific implementations of algorithms. (armv8-aes.c)
2025-10-21 17:03:39 +10:00
Daniel Pouzzner
279238ce63 wolfssl/wolfcrypt/types.h:
* fix WC_MIN_SINT_OF().
* add outer cast back to target type in WC_MAX_UINT_OF() and WC_MAX_SINT_OF().
* rename WC_SAFE_SUM_*_NO_WUR to WC_SAFE_SUM_*_CLIP().
* remove clipping assignments from failure paths in WC_WUR_INT() variants.
* add WC_SAFE_SUB_UNSIGNED_CLIP(), WC_SAFE_SUB_UNSIGNED(), WC_SAFE_SUB_SIGNED_CLIP(), and WC_SAFE_SUB_SIGNED().
* add Coverity-specific annotations in WC_SAFE_*() to suppress false-positive overflow warnings.

wolfcrypt/test/test.c:
* implement macro_test().
* fix stray uint32_t's in crypto_ecc_verify() and crypto_ecc_sign() arg lists.

wolfssl/wolfcrypt/ext_xmss.h: fix stray uint32_t.
2025-10-20 23:27:09 -05:00
jordan
c1032a8cb6 KDF onestep: hashOutSz err check. 2025-10-20 22:05:41 -05:00
Sean Parkinson
3f9e2e5baa X.509 cert: crl distribution point reasons is IMPLICIT
The reasons field is IMPLICIT meaning that the value is directly under
the context-specific tag. That is context-specific tag is not
constructed.
2025-10-21 09:30:45 +10:00
Andrew Hutchings
00c936c29e Only change WC_BENCH_MAX_LINE_LEN when we need to 2025-10-20 18:58:16 +01:00
night1rider
f1faefed91 Added callbacks for copy and free to SHA, 224, 384, 512, and SHA3. Also split macros for FREE and COPY Callbacks, and add configure.ac option. 2025-10-20 11:09:35 -06:00
David Garske
d86575c766 Merge pull request #9312 from night1rider/FixCallbackRngInit
Refactor wc_rng_new to use wc_rng_new_ex, and to use WC_USE_DEVID as the devId if set at compile time
2025-10-20 09:19:17 -07:00
night1rider
0dca3bc24d Setup to be opt-in for copy callback, and also added a outline for a free callback 2025-10-20 10:07:24 -06:00
night1rider
4d6418f31a Add crypto callback support for copy operations (SHA-256) 2025-10-20 10:06:30 -06:00
night1rider
bd4099d2d7 Update test.c tests to use global devId instead of INVALID_DEVID 2025-10-20 09:16:23 -06:00
night1rider
28c78b5c0c Use global devId for RNG initialization in tests: mlkem_test, dilithium_test, xmss_test, lms_test 2025-10-20 09:16:23 -06:00
night1rider
fba8cab200 Refactor wc_rng_new to use wc_rng_new_ex, and to use WC_USE_DEVID as the devId if set at compile time 2025-10-20 09:16:23 -06:00
jordan
525c212d1c cmac kdf: add NIST SP 800-108, and NIST SP 800-56C two-step. 2025-10-20 08:20:23 -05:00
Daniel Pouzzner
2bbc3a0ae2 wolfcrypt/test/test.c: fixes for --disable-sha256, --disable-hmac, --disable-rng, and FIPS gating on RSA-PSS. 2025-10-18 02:05:55 -05:00
Andrew Hutchings
d87ca70048 Fix mixed declaration / code 2025-10-18 06:18:29 +01:00
Andrew Hutchings
01dc28ad31 Seperate AES alloc / dealloc phases 2025-10-18 06:13:40 +01:00
Andrew Hutchings
65bb68b6c0 Move heap/stack tracking to before init phase
Start tracking during the setup of the algo, so we can capture the
memory usage of the algo init functions.
2025-10-18 06:13:36 +01:00
Andrew Hutchings
036c66c777 Benchmark memory tracking
This adds heap and stack tracking to wolfCrypt bench so that it is
possible to see RAM usage. It also adds support for stack tracking in
microcontrollers (tested on STM32).
2025-10-18 06:09:01 +01:00
lealem47
5280bfb89a Merge pull request #9297 from douzzer/20251011-more-fips-optest-tweaks
20251011-more-fips-optest-tweaks
2025-10-17 12:44:25 -06:00
David Garske
f492abfe9e Merge pull request #9314 from SparkiDev/silabs_no_hash_raw
SHA-2: No hash raw
2025-10-17 10:19:01 -07:00