Repository navigation
Fix build and test failures found by regression testing - #11936
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The clock-selection logic excludes a valid USER_TIME configuration, causing positive RNG bank timeouts to use retry counts instead of elapsed seconds and potentially expire prematurely under contention.
1 open issue
What changed in this PR
This PR addresses regression failures across wolfSSL feature configurations and corrects borrow propagation in wolfCrypt’s large-Comba arithmetic.
Changes:
- Tightens feature guards for reduced TLS, AES-decrypt-disabled, and session-cache-disabled builds.
- Adds retry-count-based RNG bank timeouts when no clock is available.
- Fixes carry and borrow handling in large-Comba multiplication and squaring.
| File | Description |
|---|---|
wolfcrypt/test/test.c |
Guards AES-GCM decryption tests by feature availability. |
wolfcrypt/src/sp_int.c |
Corrects borrow propagation in multiplication and squaring. |
wolfcrypt/src/rng_bank.c |
Adds no-clock timeout handling for retry loops. |
wolfcrypt/benchmark/benchmark.c |
Suppresses an unused decryption-label warning. |
tests/api/test_tls_parse.c |
Adjusts protocol and role guards; handles unused variables. |
tests/api/test_tls_bounds.c |
Restricts certificate-status request tests to client builds. |
tests/api/test_ssl_cert.c |
Guards session-peer checks when session caching is disabled. |
tests/api/test_dtls13.c |
Skips a clock-dependent handshake test without ASN time support. |
tests/api.c |
Guards a session-setup assertion when caching is disabled. |
src/internal.c |
Compiles ReuseKey() only when relevant callers are enabled. |
Review effort: Balanced
|
NO_AES_DECRYPT:
- benchmark.c: bench_aesccm_internal() - mark decLabel as used when
AES decrypt is not compiled in.
- test.c: aes_no_key_set_test() - only call wc_AesGcmDecrypt() when
HAVE_AES_DECRYPT is defined.
TLS 1.3 only, client only and server only builds:
- internal.c: ReuseKey() - certificate callers need the client or
client authentication compiled in; fixes unused function.
- test_tls_parse.c: guard the KeyShare tests on !NO_WOLFSSL_CLIENT, the
ALPN request direction on !NO_WOLFSSL_SERVER and the PointFormat
blocks using a TLS 1.2 server on !WOLFSSL_NO_TLS12.
- test_tls_bounds.c: TEST_TLS_BOUNDS_CSR2_REQUESTS requires a client.
NO_ASN_TIME:
- rng_bank.c: XTIME is not available. Use XTIME when defined, otherwise
count retries, with WC_RNG_BANK_NO_CLOCK_RETRIES_PER_SEC (default
1000) retries treated as one second, so a positive timeout still
bounds the retry loops.
- api.c, test_ssl_cert.c: NO_ASN_TIME implies NO_SESSION_CACHE; guard
wolfSSL_SessionIsSetup() and wolfSSL_SESSION_get0_peer() uses.
- test_dtls13.c: disable test_dtls13_plaintext_ack_during_handshake as
DTLS 1.3 retransmissions are not rate limited without a clock.
sp_int.c: _sp_mul_{32,48,64,96}() and _sp_sqr_{32,48,64,96}() (built
with WOLFSSL_SP_INT_LARGE_COMBA, e.g. --enable-sp-math-all=huge)
computed z1 = z1 - z0 - z2 keeping the borrow from the previous word
only in the low word. The plain C add of z1->dp[i] could then drop the
borrow, making the product 2^(64*k) too big. Found by the 2048-bit
exptmod test added to mp_test(). Add z1->dp[i] with SP_ASM_ADDC and
sign-extend the borrow into the high word.
test_tls_parse.c: test_TLSX_KeyShare_process() - ctx and ssl are unused
when none of X25519, ECC and FFDHE are compiled in (e.g. RSA + curve448
only).
fbdcd4d to
6b79b5b
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The cryptographic arithmetic changes span eight routines and architecture-specific backends, requiring maintainer review and target-level 32/64-bit regression validation beyond the passing isolated arithmetic model.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
|
Jenkins: retest this please |
1 similar comment
|
Jenkins: retest this please |
|
note: this one still fails in master because of a test just added from a merge: ./configure --disable-asm --disable-sp-asm --enable-all CFLAGS=-DNO_ASN_TIME && make && make check./scripts/unit.test -test_wolfSSL_X509_check_email_san
starting unit tests...
Begin API Tests
Begin Group: ossl_x509
1399: test_wolfSSL_X509_check_email_san :
ERROR - tests/api/test_ossl_x509.c line 646 failed with:
expected: x509 = make_email_cert(&key, &rng, cases[i].subjEmail, cases[i].sans) is not null
result: x509 = make_email_cert(&key, &rng, cases[i].subjEmail, cases[i].sans) => NULLI can fix in follow-up PR |
|
confirmed all fixed (other than the aforementioned 3-way exception). tests good with multi-test |

Description
NO_AES_DECRYPT:
TLS 1.3 only, client only and server only builds:
NO_ASN_TIME:
sp_int.c: sp_mul{32,48,64,96}() and sp_sqr{32,48,64,96}() (built with WOLFSSL_SP_INT_LARGE_COMBA, e.g. --enable-sp-math-all=huge) computed z1 = z1 - z0 - z2 keeping the borrow from the previous word only in the low word. The plain C add of z1->dp[i] could then drop the borrow, making the product 2^(64*k) too big. Found by the 2048-bit exptmod test added to mp_test(). Add z1->dp[i] with SP_ASM_ADDC and sign-extend the borrow into the high word.
test_tls_parse.c: test_TLSX_KeyShare_process() - ctx and ssl are unused when none of X25519, ECC and FFDHE are compiled in (e.g. RSA + curve448 only).
Testing
#: 1
Configure options: --disable-shared --enable-cryptonly --disable-asm
--disable-sp-asm CFLAGS=-DNO_AES_DECRYPT --disable-aescbc --disable-aesofb
--disable-aescfb --enable-aesgcm --enable-aesgcm-stream --enable-aesccm
--disable-aesctr --disable-aesxts --disable-aeseax
Failure: make
Fix: benchmark.c decLabel unused; test.c wc_AesGcmDecrypt() link error
────────────────────────────────────────
#: 2
Configure options: --disable-shared --disable-asm --disable-sp-asm
--disable-tlsv12 --enable-tls13
Failure: make
Fix: test_tls_parse.c PointFormat blocks need TLS 1.2
────────────────────────────────────────
#: 3
Configure options: --disable-shared --disable-asm --disable-sp-asm
--disable-tlsv12 --enable-tls13 CFLAGS="-DNO_WOLFSSL_CLIENT
-DWOLFSSL_NO_CLIENT_AUTH" (tls_test #86)
Failure: make
Fix: internal.c ReuseKey() unused
────────────────────────────────────────
#: 4
Configure options: --disable-shared --enable-all --disable-asm
--disable-sp-asm
--enable-tlsv12 --enable-tls13 CFLAGS=-DNO_WOLFSSL_CLIENT
Failure: make
Fix: KeyShare tests and the CSR2 bounds test need a client
────────────────────────────────────────
#: 5
Configure options: --disable-shared --enable-all --disable-asm
--disable-sp-asm
--enable-tlsv12 --enable-tls13 CFLAGS=-DNO_WOLFSSL_SERVER
Failure: make
Fix: ALPN test's server part needs a server
────────────────────────────────────────
#: 6
Configure options: --disable-asm --disable-sp-asm --enable-all
CFLAGS=-DNO_ASN_TIME (openssl_api_test #38)
Failure: make, then check
Fix: rng_bank.c XTIME missing; session cache checks; DTLS 1.3 ACK test
────────────────────────────────────────
#: 7
Configure options: --disable-shared --enable-cryptonly --disable-rsa
--disable-dh --disable-dsa --disable-curve25519 --disable-ed25519
--disable-curve448 --disable-ed448 --enable-intelasm --enable-rsa
--enable-dh -enable-sakke --enable-eccsi --enable-sp-math-all=huge
(sakke_eccsi #66)
Failure: check (mp test)
Fix: sp_int.c Karatsuba borrow bug
────────────────────────────────────────
#: 8
Configure options: --disable-shared --enable-sp-math-all --disable-asm
--disable-sp-asm --disable-rsa --disable-dh --disable-ecc
--disable-curve25519 --disable-ed25519 --disable-curve448 --disable-ed448
--enable-rsa --enable-curve448 (SP test #5)
Failure: make
Fix: test_TLSX_KeyShare_process() ctx/ssl unused