Commit Graph

27119 Commits

Author SHA1 Message Date
Daniel Pouzzner
e159c650ea .wolfssl_known_macro_extras: add CONFIG_CRYPTO_DRBG. 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
79d1e6b295 .github/workflows/trackmemory.yml: new workflow testing various configs with -DWC_RNG_SEED_CB -DWOLFSSL_TRACK_MEMORY -DWOLFSSL_DEBUG_MEMORY. 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
fb82bdbc35 wolfcrypt/test/test.c:
* in wolfcrypt_test_main(), when WOLFSSL_TRACK_MEMORY, check and error if wc_MemStats_Ptr->currentBytes > 0;
  * don't call the hash initialization APIs for hash structs that are later copied over with the hash copy API (sha224_test(), sha256_test(), sha512_test(), etc)
  * in hash_test(), either wc_HashNew() or wc_HashInit(), not both (fixes leaks);
  * in hmac_*_test(), add test coverage for wc_HmacCopy();
  * in _rng_test(), when WOLFSSL_TRACK_MEMORY && WOLFSSL_SMALL_STACK_CACHE, check that wc_MemStats_Ptr->totalAllocs doesn't increase when wc_RNG_GenerateBlock() is called, and if HAVE_HASHDRBG) && !CUSTOM_RAND_GENERATE_BLOCK, check that forcing a reseed doesn't result in an increase.
  * add missing context cleanups in openSSL_evpMD_test().
2025-12-17 11:01:10 -06:00
Daniel Pouzzner
8bd0fb0e4b wolfcrypt/src/random.c and wolfssl/wolfcrypt/random.h: refactor WOLFSSL_SMALL_STACK_CACHE support to eliminate all heap calls after init and before cleanup.
* add DRBG_internal.{seed_scratch,digest_scratch}
  * add WC_RNG.{drbg_scratch,health_check_scratch,newSeed_buf}
  * refactor to implement new WOLFSSL_SMALL_STACK_CACHE dynamics:
    * wc_RNG_HealthTestLocal()
    * Hash_df()
    * Hash_gen()
    * Hash_DRBG_Generate()
    * Hash_DRBG_Instantiate()
    * _InitRng()
    * PollAndReSeed()
    * wc_FreeRng()
    * wc_RNG_HealthTest_ex_internal()
    * wc_RNG_HealthTest_ex()
    * wc_RNG_HealthTestLocal()
  * refactor out WOLFSSL_KERNEL_MODE gates (now all WOLFSSL_SMALL_STACK_CACHE)
2025-12-17 11:01:10 -06:00
Daniel Pouzzner
2b28931855 wolfcrypt/src/sha256.c and wolfcrypt/src/sha512.c: in WOLFSSL_SMALL_STACK_CACHE builds, allocate shafoo->W at init or context copy time, rather than in the transform function. for the SHA512 family, allocate additional space in W for "buffer" in wc_Sha512Transform(). 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
525266c467 wolfssl/wolfcrypt/mem_track.h and wolfcrypt/src/memory.c: add WOLFSSL_API extern memoryStats *wc_MemStats_Ptr, set by InitMemoryTracker() and cleared by CleanupMemoryTracker(), allowing public access to the memory statistics.
tests/unit.c: at end of unit_test(), when WOLFSSL_TRACK_MEMORY, explicitly wolfSSL_Cleanup() then check and error if wc_MemStats_Ptr->currentBytes > 0.
2025-12-17 11:01:10 -06:00
Daniel Pouzzner
1e38a1011e wolfcrypt/src/wolfentropy.c: in wc_Entropy_Get():
* use a bss segment allocation for noise, to avoid a heap allocation (access is already mutex-protected), and
  * in the loop, WC_CHECK_FOR_INTR_SIGNALS() and WC_RELAX_LONG_LOOP().
2025-12-17 11:01:10 -06:00
Daniel Pouzzner
38b675ef68 linuxkm/lkcapi_sha_glue.c:
* as for other glue families, when LINUXKM_LKCAPI_REGISTER_ALL_KCONFIG, don't "#error Config conflict" if explicit LINUXKM_LKCAPI_DONT_REGISTER_foo is defined for the missing algorithm;
  * in km_hmac_init(), use wc_HmacCopy() to copy p_ctx->wc_hmac to t_ctx->wc_hmac;
  * in get_drbg(), when tfm == crypto_default_rng, only migrate_disable() and local_bh_disable() if preempt_count() == 0, i.e. if not in already in an uninterruptible context;
  * add can_spin argument to get_drbg_n() -- wc_linuxkm_drbg_seed() can_spin, wc_mix_pool_bytes() !can_spin, and wc_crng_reseed() can_spin;
  * add compile-time assert that WOLFSSL_SMALL_STACK_CACHE is defined if LINUXKM_DRBG_GET_RANDOM_BYTES;

.wolfssl_known_macro_extras: add CONFIG_CRYPTO_DRBG.
2025-12-17 11:01:10 -06:00
Daniel Pouzzner
50b51adc93 wolfcrypt/src/hmac.c and wolfssl/wolfcrypt/hmac.h: implement WOLFSSL_API wc_HmacCopy(), and remove the WOLFSSL_HMAC_COPY_HASH gate on HmacKeyCopyHash(). 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
8090817c11 configure.ac: when KERNEL_MODE_DEFAULTS, set ENABLED_SMALL_STACK_CACHE_DEFAULT=yes regardless of FIPS/version. 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
8e03d0523c wolfssl/test.h: add missing wc_HmacFree()s in myMacEncryptCb(), myDecryptVerifyCb(), myEncryptMacCb(), myVerifyDecryptCb(). 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
15fcf7095f linuxkm/lkcapi_{dh,ecdh,ecdsa,rsa,aes}_glue.c: when LINUXKM_LKCAPI_REGISTER_ALL_KCONFIG, don't "#error Config conflict" if explicit LINUXKM_LKCAPI_DONT_REGISTER_foo is defined for the missing algorithm. 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
dc0fe803a5 src/internal.c: in InitHandshakeHashesAndCopy(), don't call InitHandshakeHashes(), to avoid leaking in the later wc_FooCopy() operation. 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
918b6973bd tests/api.c: in test_wolfSSL_dtls_stateless_HashWOLFSSL(), when WOLFSSL_SMALL_STACK_CACHE, omit ssl->hsHashes from the comparison (init-time heap pointers destabilize its bit signature). 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
2802e2d82b wolfcrypt/src/rsa.c: in RsaUnPad_OAEP(), refactor volatile-based constant time mitigation to fix "using value of assignment with ‘volatile’-qualified left operand is deprecated [-Werror=volatile]" (new warning from gcc-16.0.0_p20251207, not reported by gcc-16.0.0_p20251116-r1). 2025-12-17 11:01:10 -06:00
Daniel Pouzzner
cd3e81a656 src/ssl_load.c: in ProcessBufferCert(), check ctx for nullness before accessing ctx->verifyNone (fixes -Wnull-dereference reported by multi-test dtls-no-rsa-no-dh after merge of 36e66eb763). 2025-12-17 11:01:10 -06:00
JacobBarthelmeh
b42e9a9410 Merge pull request #9529 from SparkiDev/dsa_pg_sp_int_fix
DSA Parameter Generation: init g earlier
2025-12-16 14:52:45 -07:00
JacobBarthelmeh
75fdf959c1 Merge pull request #9514 from kareem-wolfssl/zd20936
Fix uninitialized variable, fix potentially undefined printf reference in HASH_DRBG_Generate.
2025-12-16 14:48:17 -07:00
JacobBarthelmeh
9156b50bbc Merge pull request #9538 from SparkiDev/tls13_dup_ext_alert_code_fix
TLS 1.3: duplicate extension alert code fix
2025-12-16 14:43:19 -07:00
JacobBarthelmeh
95afe9ca06 Merge pull request #9539 from julek-wolfssl/APP_DATA_READY-docs
Update APP_DATA_READY doc string
2025-12-16 14:42:39 -07:00
Sean Parkinson
5512c2d0b4 Merge pull request #9541 from jackctj117/empty-hash-comment
Added comment with empty hash use
2025-12-16 08:34:16 +10:00
Sean Parkinson
85d40c8e9b Merge pull request #9522 from JacobBarthelmeh/time
tie in use of check_time with x509 store
2025-12-16 08:24:49 +10:00
Kareem
968662063d Merge remote-tracking branch 'upstream/master' into zd20936 2025-12-15 14:06:18 -07:00
Sean Parkinson
d3863e5fa3 TLS 1.3: duplicate extension alert code fix
The specification states to return illegal_parameter when a message is
syntactically correct but semantically invalid. (RFC 8446 section 6,
Paragraph 5)
2025-12-15 10:00:56 -08:00
jackctj117
585a8d22aa Added comment with empty hash imofrmation 2025-12-15 10:52:24 -07:00
Daniel Pouzzner
52ee00132d Merge pull request #9528 from SparkiDev/tls13_missing_ext_fix
TLS 1.3 missing extension: return correct alert code
2025-12-15 11:05:02 -06:00
Daniel Pouzzner
901ddab007 Merge pull request #9534 from rlm2002/coverity
20251212 Coverity fix for CID 524467
2025-12-15 11:03:18 -06:00
Daniel Pouzzner
b9368d7a3d Merge pull request #9516 from embhorn/gh3665
Add checking of size param and clarify usage in doc
2025-12-15 10:49:57 -06:00
Daniel Pouzzner
7e5d1d3d6d Merge pull request #9523 from JacobBarthelmeh/bio
remove unimplemented function macro
2025-12-15 10:39:55 -06:00
Daniel Pouzzner
61c72d2406 Merge pull request #9525 from JacobBarthelmeh/docs
public disclosure of CVE-2025-13912
2025-12-15 10:34:39 -06:00
Daniel Pouzzner
a379797482 Merge pull request #9526 from holtrop/rust-wrapper-notes
Rust wrapper: update crate metadata and README
2025-12-15 09:58:25 -06:00
Juliusz Sosinowicz
c73de0d133 Update APP_DATA_READY doc string 2025-12-15 12:18:10 +01:00
Sean Parkinson
dacb3425cd DSA Parameter Generation: init g earlier
Ensure dsa->g is initialized with other mp_ints so that it can be
cleared at the end regardless of failures.

Don't clear tmp or tmp2 if allocation or initialization failed as you
will access uninitialized data.
2025-12-15 09:12:11 +10:00
Sean Parkinson
44be44a509 TLS 1.3 missing extension: return correct alert code
Change TLS 1.3 handling to return missing_extension alert code when
 - KeyShare is present but SupportedGroups is missing and
 - SupportedGroups is present but KeyShare is missing

Added tests for this.
2025-12-15 09:07:13 +10:00
Sean Parkinson
19cba1c462 Merge pull request #9527 from night1rider/CMAC-Compile-Issue
Fix wc_CmacFree() to use correct heap pointer from internal Aes structure
2025-12-15 08:34:11 +10:00
JacobBarthelmeh
5099e6e315 add macro guard on use of time_t 2025-12-12 16:42:19 -07:00
Kaleb Himes
6475106ce7 Merge pull request #9449 from lealem47/hash_script
Use only the first 64 bytes of hash output in fips-hash.sh
2025-12-12 14:47:12 -07:00
Ruby Martin
27b5ac9f84 sanitize loop bound in tls_multi_handshakes_one_record() unit test
add additional check for breaking while loop
2025-12-12 14:18:25 -07:00
JacobBarthelmeh
01442a1460 adjust macro guard around test case 2025-12-12 13:36:14 -07:00
Lealem Amedie
61e58f0f04 Fix for analyzer null dereference 2025-12-12 12:31:07 -07:00
Lealem Amedie
afa56497a8 Use cut command for portability 2025-12-12 12:31:07 -07:00
Lealem Amedie
7e26bc06c5 Use only the first 64 bytes of hash output in fips-hash.sh 2025-12-12 12:31:07 -07:00
Kareem
2d4e589a8d Merge remote-tracking branch 'upstream/master' into zd20936 2025-12-12 11:37:45 -07:00
Kareem
3797c03e6c Merge remote-tracking branch 'upstream/master' into zd20936 2025-12-12 11:37:34 -07:00
night1rider
cf42d14e10 Fix wc_CmacFree() and wc_CMAC_Grow() to use correct heap pointer from internal Aes structure 2025-12-12 11:14:16 -07:00
JacobBarthelmeh
e1bbb71878 tie in use of check_time with x509 store 2025-12-12 09:22:23 -07:00
Daniel Pouzzner
ab2196b4ca Merge pull request #9530 from SparkiDev/arm64_asm_deadcode_fix
Aarch64 AES ASM no hw crypto: no dead code
2025-12-11 23:41:30 -06:00
Sean Parkinson
8e14d4a774 Aarch64 AES ASM no hw crypto: no dead code
Fix code so that there is no dead code compiled.
That is, change if checks to #ifdef checks.
2025-12-12 12:31:36 +10:00
Daniel Pouzzner
38d5dc6c7a Merge pull request #9510 from embhorn/gh7981
Fix test when ECH and harden are enabled
2025-12-11 13:07:29 -06:00
Daniel Pouzzner
3e8c6811c7 Merge pull request #9518 from SparkiDev/api_c_split_3
api.c: Split out more functions
2025-12-11 13:06:58 -06:00