Skip to content

tls: exclude PKCS#1 v1.5 RSA from TLS 1.3 signature_algorithms extension#5

Draft
kareem-wolfssl with Copilot wants to merge 1 commit into
masterfrom
copilot/avoid-rsa-sa-algo-tls13
Draft

tls: exclude PKCS#1 v1.5 RSA from TLS 1.3 signature_algorithms extension#5
kareem-wolfssl with Copilot wants to merge 1 commit into
masterfrom
copilot/avoid-rsa-sa-algo-tls13

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown

wolfSSL was unconditionally advertising rsa_sa_algo (PKCS#1 v1.5 RSA) in the signature_algorithms extension even for TLS 1.3 ClientHellos, violating RFC 8446 §4.2.3. The fix operates at three layers to handle both TLS 1.3-only and downgrade-capable builds correctly.

Changes

  • src/internal.cInitSuitesHashSigAlgo()
    Under WOLFSSL_NO_TLS12 (TLS 1.3-only builds), gate rsa_sa_algo additions with if (!tls1_3). In mixed-version builds the in-memory list intentionally retains rsa_sa_algo — the ClientHello is sent before version negotiation completes, so it must remain available for a TLS 1.2 fallback.

  • src/tls.cTLSX_SignatureAlgorithms_GetSize() / TLSX_SignatureAlgorithms_Write()
    Runtime wire-level filter: when IsAtLeastTLSv1_3(ssl->version) && !ssl->options.downgrade, strip rsa_sa_algo pairs (list[i+1] == rsa_sa_algo) from the serialised extension without touching the in-memory list. GetSize and Write use the identical condition so the reported and written lengths always agree. When ssl->options.downgrade is set the filter is skipped, preserving TLS 1.2 compatibility.

  • src/tls13.cDoTls13ServerHello() downgrade path
    After ssl->options.tls1_3 = 0 is set on a confirmed TLS 1.3→1.2 downgrade (via supported_versions), scan suites->hashSigAlgo for any rsa_sa_algo entry; if absent, rebuild with InitSuitesHashSigAlgo(..., tls1_3=0) so PickHashSigAlgo and CertificateVerify have the full PKCS#1 v1.5 RSA set for TLS 1.2 processing.

Downgrade flow (preserved)

Step State
TLS 1.3 ClientHello sent, downgrade enabled rsa_sa_algo present on wire (filter skipped)
Server replies TLS 1.2 ssl->version.minor = TLSv1_2_MINOR, tls1_3 = 0
Change 3 fires rsa_sa_algo restored in hashSigAlgo if missing
PickHashSigAlgo Selects PKCS#1 v1.5 RSA correctly for TLS 1.2

Copilot AI changed the title Filter PKCS#1 v1.5 RSA sig algs from TLS 1.3 signature_algorithms extension tls: exclude PKCS#1 v1.5 RSA from TLS 1.3 signature_algorithms extension Jul 23, 2026
Copilot AI requested a review from kareem-wolfssl July 23, 2026 23:31
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.

2 participants