Skip to content

Client sigalgs cert - #11810

Draft
AlexLanzano wants to merge 2 commits into
wolfSSL:masterfrom
AlexLanzano:client-sigalgs-cert
Draft

AlexLanzano wants to merge 2 commits into
wolfSSL:masterfrom
AlexLanzano:client-sigalgs-cert

Conversation

@AlexLanzano

Copy link
Copy Markdown
Member

Description

Adds wolfSSL_get_client_sigalgs_cert() so a certificate setup callback
(wolfSSL_CTX_set_cert_cb()) can see which signature algorithms the client
accepts on certificates.

wolfSSL_get_client_suites_sigalgs() only exposes signature_algorithms,
which governs CertificateVerify. A server with several chains for the same
key could therefore send a chain the client said in
signature_algorithms_cert it can't verify, even when it had one the client
would accept (RFC 8446 4.4.2.2).

The new getter returns the client's signature_algorithms_cert list, or
signature_algorithms when the client didn't send one (RFC 8446 4.2.3). It
is a separate function so the existing getter is unchanged.

Depends on #11362, which keeps the client's list alive until the callback
runs and adds wolfSSL_set1_sigalgs_cert_list(). Only the top commit
belongs to this PR.

Fixes #11072

Testing

Added test_wolfSSL_cert_setup_cb_sigalgs_cert. The server has an
RSA-signed and an ECDSA-signed chain for the same ECC key:

  • Client sends signature_algorithms_cert = RSA+SHA256: gets the RSA-signed
    chain.
  • Client sends no signature_algorithms_cert: the getter falls back and the
    client gets the ECDSA-signed chain.

With the callback switched back to the old getter, the first case fails
(the client receives the ECDSA-signed chain). Full API suite passes with
--enable-all.

SparkiDev and others added 2 commits October 8, 2026 08:10
Added support for record_size_limit in TLS 1.3 and TLS 1.2.
Added compress_certificate support for TLS 1.3.
Added signed_certificate_timestamp TLS 1.2 and 1.3.
Added handshake-message fragmentation to EncryptedExtension, CertificateRequest
and NewSessionTicket.
Accepts server_name in CertificateRequest.
Added API for setting signature algorithms for signature_algorithms_cert.

SHA-1 certificate chain fix: a peer advertising ecdsa_sha1 against a chain
with an RSA-SHA1 intermediates will see a failed handshake.

Tests added and interop performed where possible.
Returns the client's signature_algorithms_cert list, falling back to
signature_algorithms, so a cert setup callback can pick a chain the
client can verify (RFC 8446 4.4.2.2). Builds on wolfSSL#11362.

Fixes wolfSSL#11072
Copilot AI balanced review requested due to automatic review settings October 19, 2026 15:00

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

Unresolved buffer sizing, record-limit enforcement, SCT handling, and resource cleanup defects block approval.

7 open issues
What changed in this PR

Adds wolfSSL_get_client_sigalgs_cert() so certificate callbacks can select chains compatible with client preferences, addressing #11072 atop #11362.

Changes:

  • Exposes certificate-signature preferences with fallback to signature_algorithms.
  • Adds callback regression tests and API documentation.
  • Includes prerequisite TLS extension support, configuration, and tests.
File Description
wolfssl/​ssl.h Declares getter and extension APIs.
wolfssl/​openssl/​ssl.h Adds compatibility aliases.
wolfssl/​internal.h Adds extension state and shared guards.
tests/​unit-mcdc/​test_tls13_whitebox.c Adapts signature-algorithm tests.
tests/​api/​test_tls13.h Registers and reorganizes TLS tests.
tests/​api/​test_tls.h Registers record-limit test.
tests/​api/​test_tls.c Tests TLS 1.2 record limits.
tests/​api/​test_tls_parse.c Corrects client-dependent test guards.
tests/​api/​test_tls_msgtype.c Adds TLS 1.3 test guard.
tests/​api/​test_ssl_cert.h Registers callback regression test.
tests/​api/​test_ssl_cert.c Tests certificate selection and fallback.
tests/​api/​test_dtls13.c Adjusts fragmentation-test MTU.
tests/​api/​test_compress.c Guards disabled record-compression tests.
tests/​api.c Aligns callback compilation guards.
src/​x509.c Renames cleanup callback parameter.
src/​tls.c Implements extension negotiation and parsing.
src/​ssl.c Implements getter and extension-state reset.
src/​ssl_sess.c Renames cleanup callback parameter.
src/​ssl_load.c Invalidates compressed certificate caches.
src/​ssl_api_ext.c Implements extension configuration APIs.
src/​sniffer.c Recognizes compressed certificate messages.
src/​internal.c Handles extension state and record limits.
src/​dtls13.c Classifies compressed certificate messages.
doc/​dox_comments/​header_files/​ssl.h Documents getter and extension APIs.
configure.ac Adds extension build options.
CMakeLists.txt Adds extension options and prerequisites.
cmake/​options.h.in Exports extension feature macros.
.github/​configs/​os-check-linux.json Adds extension build configurations.

Review effort: Balanced

Comment thread src/tls.c
#endif
#ifdef HAVE_SIGNED_CERT_TIMESTAMP
case TLSX_SIGNED_CERT_TIMESTAMP:
length += SCTS_GET_SIZE((WOLFSSL*)extension->data, isRequest);
Comment thread src/internal.c
Comment on lines +14034 to +14036
if ((word32)ssl->specs.block_size < MAX_PAD_SIZE) {
suiteExtra += MAX_PAD_SIZE -
(word32)ssl->specs.block_size;
Comment thread src/internal.c
Comment on lines +14047 to +14048
if (ssl->options.side == WOLFSSL_CLIENT_END)
maxSz += 1;
Comment thread src/ssl_api_ext.c
Comment on lines +859 to +861
XFREE(ssl->sctList, ssl->heap, DYNAMIC_TYPE_TLSX);
ssl->sctList = copy;
ssl->sctListSz = sz;
Comment thread src/ssl_api_ext.c
Comment on lines +936 to +938
if (ssl->options.handShakeState != NULL_STATE) {
WOLFSSL_MSG("Record size limit must be set before the handshake");
return BAD_FUNC_ARG;
Comment thread src/ssl_api_ext.c
Comment on lines +1084 to +1085
XFREE(body, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
return WOLFSSL_FAILURE;
Comment thread wolfssl/internal.h
Comment on lines +2096 to +2098
#if (defined(HAVE_CERTIFICATE_STATUS_REQUEST) || \
defined(HAVE_SIGNED_CERT_TIMESTAMP)) && !defined(NO_WOLFSSL_SERVER)
#define WOLFSSL_CERT_ENTRY_EXTS
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.

Server certificate callback can ignore signature_algorithms_cert and send an unacceptable certificate chain

3 participants