Skip to content

Fix build and test failures found by regression testing - #11936

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
SparkiDev:regression-fixes-20261030
Oct 30, 2026
Merged

philljj merged 1 commit into
wolfSSL:masterfrom
SparkiDev:regression-fixes-20261030

Conversation

@SparkiDev

Copy link
Copy Markdown
Contributor

Description

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).

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

@SparkiDev SparkiDev self-assigned this Oct 30, 2026
Copilot AI balanced review requested due to automatic review settings October 30, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread wolfcrypt/src/rng_bank.c Resolved
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@SparkiDev

SparkiDev commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Jenkins: retest this please

1 similar comment
@SparkiDev

Copy link
Copy Markdown
Contributor Author

Jenkins: retest this please

@philljj philljj self-assigned this Oct 30, 2026
@philljj

philljj commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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) => NULL

I can fix in follow-up PR

@philljj

philljj commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

confirmed all fixed (other than the aforementioned 3-way exception).

tests good with multi-test all-gcc-c89, c89-clang-tidy, wolfssl-all, sp-asm-.*sanitizer, etc.

@philljj
philljj merged commit 472d82a into wolfSSL:master Oct 30, 2026
440 checks passed
@SparkiDev SparkiDev removed their assignment Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants