Commit Graph

9907 Commits

Author SHA1 Message Date
David Garske
d79ca8a746 Improve some of the build cases around crypto callback only 2025-08-13 21:58:53 +01:00
David Garske
3289b6b3da Merge pull request #9089 from douzzer/20250811-linuxkm-and-other-fixes
20250811-linuxkm-and-other-fixes
2025-08-12 11:40:36 -07:00
Daniel Pouzzner
e24f76bb1e Merge pull request #9057 from SparkiDev/mldsa_x64_asm
ML-DSA/Dilithium: Intel x64 ASM
2025-08-11 23:12:44 -05:00
Daniel Pouzzner
2d1c797b64 fixes from cppcheck-force-source: in src/bio.c:wolfSSL_BIO_vprintf() and
wolfcrypt/src/logging.c:WOLFSSL_MSG_CERT_EX(), add missing gating on
  defined(XVSNPRINTF);

in src/crl.c:CRL_Entry_new(), fix true-positive nullPointerRedundantCheck;

in src/pk.c:_DH_compute_key(), add bounds checking to ForceZero(priv).
2025-08-11 18:12:44 -05:00
Daniel Pouzzner
11d84bea86 wolfcrypt/src/rsa.c: fix improperly handled SAVE_VECTOR_REGISTERS() retval in
wc_CheckProbablePrime_ex(), and in wc_MakeRsaKey(), make sure not to
  RESTORE_VECTOR_REGISTERS() if SAVE_VECTOR_REGISTERS() failed.
2025-08-11 16:14:32 -05:00
Daniel Pouzzner
6617f2edf8 wolfcrypt/src/memory.c, wolfcrypt/src/misc.c, and wolfssl/wolfcrypt/misc.h: move
the new implementation of wc_ForceZero from wolfcrypt/src/memory.c to inline in
  wolfcrypt/src/misc.c replacing old ForceZero() implementation, and add a wrapper
  wc_ForceZero() to wolfcrypt/src/memory.c.
2025-08-11 16:14:32 -05:00
Albert Ribes
e36daf41a4 Store in extensions the full octet string (#8967)
* Store in extensions the full octet string

Store in WOLFSSL_X509_EXTENSION.value always the full contents of the
OCTET STRING of the extension, instead of different type of data
depending on the type of extension. Previously this was only done for
unknown extensions.

* Avoid local variables in 'DecodeExtKeyUsageInternal'

There is a great performance loss on configs using 'WOLFSSL_NO_MALLOC',
'WOLFSSL_STATIC_MEMORY' and 'USE_FAST_MATH' if function
'DecodeExtKeyUsageInternal' uses intermediate variables. This can be
observed running the Zephyr test 'wolfssl_test/prj-no-malloc.conf'.

Avoid using intermediate variables, and use raw pointers to the final
destination instead.

* Add missing calls to 'FreeDecodedCert'

* Return error code from 'wolfSSL_ASN1_STRING_into_old_ext_fmt'

* Fix lines larger than 80

* Allow NULL parameters for 'DecodeAuthKeyId'

* Add comment explaining build option '--enable-old-extdata-fmt'

* Test full OCTET STRING in tests/api.c

* wolfSSL_X509V3_EXT_d2i: Honor 'WOLFSSL_SMALL_STACK'

* zephyr/wolfssl_test_no_malloc: Increase test timeout

* wolfSSL_X509V3_EXT_d2i: Extract repeated code into common part

* wolfcrypt: Remove 'WOLFSSL_LOCAL' from .c files

* wolfcrypt: Change location of functions to make diff easier
2025-08-11 10:33:15 -07:00
Sean Parkinson
55f30adb3e Merge pull request #9077 from douzzer/20250807-wc_ForceZero-and-linuxkm-RHEL9v6
20250807-wc_ForceZero-and-linuxkm-RHEL9v6
2025-08-11 21:06:51 +10:00
Daniel Pouzzner
260fca600a Merge pull request #8902 from gojimmypi/pr-cert-logging
Introduce WOLFSSL_DEBUG_CERTS Certificate Debug Messages
2025-08-08 23:44:03 -05:00
Daniel Pouzzner
9236b81ade Merge pull request #9078 from rlm2002/cppCheck
Changes for cppcheck=force-source errors and warnings
2025-08-08 23:29:30 -05:00
Daniel Pouzzner
db7702f66c Merge pull request #9065 from rlm2002/zd20212
Update fe_448.c from script
2025-08-08 23:28:52 -05:00
Daniel Pouzzner
9dc4b71112 Merge pull request #9069 from holtrop/fix-inconsistent-prototype-parameter-names
Fix inconsistent function prototype parameter names for wolfcrypt
2025-08-08 23:28:10 -05:00
Daniel Pouzzner
e6c6ef64df Merge pull request #9047 from miyazakh/rz_update
Update Renesas RZ examples
2025-08-08 23:27:35 -05:00
Ruby Martin
1cfbc92ce2 initialize info var 2025-08-08 10:40:09 -06:00
Ruby Martin
9e3f726b0e add null checks for function arguments that return BAD_FUNC_ARG
update function comment
2025-08-08 10:40:09 -06:00
Daniel Pouzzner
a821e4cfa2 wolfcrypt/src/memory.c and wolfssl/wolfcrypt/memory.h: add WOLFSSL_API void wc_ForceZero(). 2025-08-07 21:57:56 -05:00
Ruby Martin
948f90251a clear invalidPrintfArgType warnings. initialize wc_Memory* pt to null 2025-08-07 16:48:46 -06:00
Daniel Pouzzner
2dfc7eee89 wolfcrypt/src/sp_int.c: in _sp_exptmod_nct(), use 2 bit window if bits <= 21. 2025-08-07 10:26:34 -05:00
Daniel Pouzzner
40506a6ddf Revert "SP int: modular exponentiation constant time" (fixes regression in benchmark "RSA,2048,public").
This reverts commit 219509d7d9.
2025-08-07 10:14:02 -05:00
David Garske
5a8b86da5d Merge pull request #9054 from gojimmypi/pr-please-use-debug-wolfssl
Please use DEBUG_WOLFSSL not WOLFSSL_DEBUG
2025-08-07 07:42:42 -07:00
Ruby Martin
782d0b9828 remove casts 2025-08-07 08:23:38 -06:00
Josh Holtrop
61f1223f1d Fix inconsistent function prototype parameter names for wolfcrypt 2025-08-07 08:02:56 -04:00
Sean Parkinson
648a057147 ML-DSA/Dilithium: Intel x64 ASM
Optimize code knowing it is for Intel x64.
Change signing to calculate one polynomial at a time so that if it isn't
valid then we fail early.
Other minor improvements.
Move the SHA-3 4 blocks at a time assembly into SHA-3 asm file.
Make constants in assembly the same length (front pad with zeros).
2025-08-07 14:01:50 +10:00
Hideki Miyazaki
07b3695b98 wc_Sha224Final also needs to call cb 2025-08-07 09:50:06 +09:00
Hideki Miyazaki
d1bf35b209 add sha224_test() call to cryptocb test 2025-08-07 08:14:26 +09:00
Hideki Miyazaki
ccdef57e8e add sha224 cryptcb 2025-08-07 07:49:53 +09:00
gojimmypi
d64ef34ef8 Introduce WOLFSSL_DEBUG_CERTS Certificate Debug Messages 2025-08-06 13:57:53 -07:00
Daniel Pouzzner
cc137e99fe Merge pull request #8900 from SparkiDev/rsa_mod_exp_nct
SP int: modular exponentiation constant time
2025-08-06 11:04:28 -05:00
Daniel Pouzzner
753a6b1083 Merge pull request #9063 from SparkiDev/sha3_xorbuf
SHA-3 C code: use xorbuf for little-endian builds
2025-08-06 11:04:10 -05:00
Daniel Pouzzner
76c4ee9ff5 Merge pull request #9056 from SparkiDev/asn_orig_decrypt_content_fix
ASN.1 original: Fix DecryptContent to check sequence len
2025-08-06 11:03:49 -05:00
Daniel Pouzzner
53eedd4b38 Merge pull request #9041 from julek-wolfssl/zero-sha->buffer
Zero sha->buffer
2025-08-06 10:50:53 -05:00
Hideki Miyazaki
53ae865184 Addressed code review 2025-08-06 19:13:20 +09:00
Daniel Pouzzner
034cbb9b97 tests/api.c: fix -Wuninitialized-const-pointer in test_wolfSSL_CertManagerAPI();
wolfcrypt/benchmark/benchmark.c:

* use WC_RELAX_LONG_LOOP() as default definition of TEST_SLEEP(), and remove WC_RELAX_LONG_LOOP() from bench_stats_sym_finish()/bench_stats_asym_finish_ex();
* when WOLFSSL_LINUXKM but !WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS., properly wrap kernel_fpu_begin...end around floating point ops.
2025-08-05 17:05:36 -05:00
Sean Parkinson
dbb75c46c9 ASN.1 original: Fix DecryptContent to check sequence len
Original ASN.1 code wasn't checking that data in a sequence didn't
exceed the length of the sequence.
In particular, the contents of the parameters and the PKCS#5 parameters.
2025-08-06 07:42:09 +10:00
Sean Parkinson
d0f8493c6a SHA-3 C code: use xorbuf for little-endian builds
Instead of loading 64-bits with alignment protection, use xorbuf which
has built in protection.
Only XOR in as much data as cached and XOR padding and rate bit directly
rather than XORing maximum amount after clearing out rest of array and
adding in padding and rate bit.
2025-08-06 07:39:53 +10:00
Sean Parkinson
219509d7d9 SP int: modular exponentiation constant time
Using a 1-bit window size for small exponentsisn't useful.
2025-08-06 07:38:37 +10:00
gojimmypi
7c9327a36b Please use DEBUG_WOLFSSL not WOLFSSL_DEBUG 2025-08-05 12:19:30 -07:00
Koji Takeda
bfb2a817e3 Fix CID 535964 2025-08-05 13:25:42 +09:00
JacobBarthelmeh
040e2102a8 Merge pull request #9049 from kojiws/import_mldsa_seed_pkcs8_reapply
Reapply - Import ML-DSA's seed from PKCS8 file
2025-08-01 14:34:09 -06:00
Hideki Miyazaki
a63bb12f6b Move devId from internal to public
- addressed code review by devin
2025-08-01 16:58:16 +09:00
Daniel Pouzzner
1152d612a6 wolfcrypt/benchmark/benchmark.c: smallstack refactors for bench_mlkem() and bench_dilithiumKeySign(), and globally replace stray uses of fprintf(stderr, ...) with printf(...) for portability. 2025-07-31 11:30:42 -05:00
Koji Takeda
09deacbe8f Revert "Merge pull request #9045 from douzzer/20250730-revert-PR9000"
This reverts commit 70af2be5ab, reversing
changes made to 46347173b2.
2025-07-31 14:14:51 +09:00
Daniel Pouzzner
c353052e54 linuxkm/linuxkm_wc_port.h:
* move enum wc_svr_flags out of BUILDING_WOLFSSL guard;
* add DISABLE_VECTOR_REGISTERS() and REENABLE_VECTOR_REGISTERS() definitions for !BUILDING_WOLFSSL;
* add #include <linux/spinlock.h> to !WOLFSSL_LINUXKM_USE_MUTEXES implementation to fix compilation (and add usability) to caller code;

linuxkm/lkcapi_sha_glue.c: in wc_linuxkm_drbg_ctx_clear(), fix error-path deallocation of locked object;

wolfcrypt/benchmark/benchmark.c:

* in FIPS v6+ builds, and FIPS linuxkm v5+, check retval from wc_AesEncryptDirect() and wc_AesDecryptDirect();
* add WC_RELAX_LONG_LOOP() in bench_stats_sym_finish() and bench_stats_asym_finish_ex();

wolfcrypt/test/test.c: fix rng_seed_test() with correct test vectors for the relevant combinations of features, and gate the test out if there are user override defines for ENTROPY_SCALE_FACTOR or SEED_BLOCK_SZ.
2025-07-30 22:15:05 -05:00
Hideki Miyazaki
9b7caac3ef Update RZ examples
- Use xSPI0 boot mode
 - Update FSP from v1.3 to v2.0.0
 - Simplify UART
 - Migrate new User Ctx
 - Update README
 - Fix SCE TLS on RA6M4
2025-07-31 11:04:06 +09:00
Daniel Pouzzner
26806cda7b Revert "Support importing seed of ML-DSA key"
This reverts commit a82d1a6b12.
2025-07-30 15:39:57 -05:00
Daniel Pouzzner
d0bf9c4b3c Revert "Disable exporting dilithium DER tests without WOLFSSL_ASN_TEMPLATE"
This reverts commit bbcdfe92e0.
2025-07-30 15:39:53 -05:00
Daniel Pouzzner
40646964b4 Revert "Follow copilot review"
This reverts commit 189ba201f3.
2025-07-30 15:39:47 -05:00
JacobBarthelmeh
46347173b2 Merge pull request #9034 from holtrop/allow-pkcs7-without-x963-kdf
Allow building with HAVE_PKCS7 set and HAVE_X963_KDF unset
2025-07-30 10:05:09 -06:00
Josh Holtrop
ccb463dd1d Fix unit test coverity defect in test_wc_PKCS7_SetAESKeyWrapUnwrapCb() 2025-07-30 10:37:28 -04:00
Juliusz Sosinowicz
42e2dd9990 Zero sha->buffer
msan reported it as an uninitialized buffer
2025-07-30 14:16:52 +02:00