Repository navigation
Client sigalgs cert - #11810
Draft
AlexLanzano wants to merge 2 commits into
Draft
Client sigalgs cert#11810AlexLanzano wants to merge 2 commits into
AlexLanzano wants to merge 2 commits into
Conversation
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
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved buffer sizing, record-limit enforcement, SCT handling, and resource cleanup defects block approval.
7 open issues
Prevent SCT extension size overflow during ServerHello sizing · New Enforce negotiated plaintext limit after CBC authentication · New Use actual advertised record size limit for validation · New Register SCT response for certificates selected by setup callbacks · New Reject limit changes after ClientHello transmission begins · New Free compressed certificate buffer on oversized certificate failure · New Free SCT certificate extension buffers without OCSP stapling · New
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
| #endif | ||
| #ifdef HAVE_SIGNED_CERT_TIMESTAMP | ||
| case TLSX_SIGNED_CERT_TIMESTAMP: | ||
| length += SCTS_GET_SIZE((WOLFSSL*)extension->data, isRequest); |
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 on lines
+14047
to
+14048
| if (ssl->options.side == WOLFSSL_CLIENT_END) | ||
| maxSz += 1; |
Comment on lines
+859
to
+861
| XFREE(ssl->sctList, ssl->heap, DYNAMIC_TYPE_TLSX); | ||
| ssl->sctList = copy; | ||
| ssl->sctListSz = sz; |
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 on lines
+1084
to
+1085
| XFREE(body, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER); | ||
| return WOLFSSL_FAILURE; |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Adds
wolfSSL_get_client_sigalgs_cert()so a certificate setup callback(
wolfSSL_CTX_set_cert_cb()) can see which signature algorithms the clientaccepts on certificates.
wolfSSL_get_client_suites_sigalgs()only exposessignature_algorithms,which governs CertificateVerify. A server with several chains for the same
key could therefore send a chain the client said in
signature_algorithms_certit can't verify, even when it had one the clientwould accept (RFC 8446 4.4.2.2).
The new getter returns the client's
signature_algorithms_certlist, orsignature_algorithmswhen the client didn't send one (RFC 8446 4.2.3). Itis 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 commitbelongs to this PR.
Fixes #11072
Testing
Added
test_wolfSSL_cert_setup_cb_sigalgs_cert. The server has anRSA-signed and an ECDSA-signed chain for the same ECC key:
signature_algorithms_cert= RSA+SHA256: gets the RSA-signedchain.
signature_algorithms_cert: the getter falls back and theclient 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.