Repository navigation
Conversation
|
There was a problem hiding this comment.
🟡 Changes recommended
SCT remains enabled in TLS-disabled builds, risking link failures, and TLS 1.2 renegotiation can retain stale SCT state across handshakes.
2 open issues
What changed in this PR
Adds RFC 6962 signed certificate timestamp (SCT) support to wolfSSL’s TLS 1.2 and TLS 1.3 extension handling. The library transports and checks list framing; applications remain responsible for validating timestamps.
Changes:
- Adds SCT configuration and query APIs, thread-safe context storage, and SNI context-switch handling.
- Implements protocol-specific SCT placement, generalizes TLS 1.3 certificate-entry extensions, and adds response-length overflow checks.
- Adds build options, API documentation, regression tests, and CI configurations.
| File | Description |
|---|---|
wolfssl/ssl.h |
Declares the four public SCT APIs. |
wolfssl/openssl/ssl.h |
Adds BoringSSL-named setter aliases and explains the getter mismatch. |
wolfssl/internal.h |
Defines SCT state, limits, helpers, and certificate-entry extension guards. |
tests/api/test_tls13.h |
Declares and registers the new tests. |
tests/api/test_tls13.c |
Tests SCT delivery, framing, lifecycle, callbacks, chains, and placement. |
tests/api/test_tls_ext.c |
Tests rejection of custom registration for built-in SCT support. |
src/tls13.c |
Writes SCT and OCSP certificate-entry extensions using shared buffer handling. |
src/tls.c |
Implements SCT parsing, serialization, response handling, and length checks. |
src/ssl.c |
Clears SCT handshake state and handles context switches. |
src/ssl_api_ext.c |
Implements SCT setters and query APIs. |
src/internal.c |
Manages SCT initialization, cleanup, and certificate-entry tracking. |
doc/dox_comments/header_files/ssl.h |
Documents SCT APIs, ownership, and validation responsibilities. |
configure.ac |
Adds --enable-sct, bundle defaults, and configuration reporting. |
CMakeLists.txt |
Adds WOLFSSL_SCT, bundle defaults, and crypto-only exclusion. |
cmake/options.h.in |
Exports the SCT feature macro in generated options. |
.github/configs/os-check-linux.json |
Adds SCT-enabled and TLS 1.2-only SCT CI configurations. |
Review effort: Balanced
b5fcc9a to
09972bd
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The TLS 1.2 send path can emit an SCT-bearing ServerHello that exceeds the negotiated fragment limit, requiring a fix and handshake coverage for small-fragment requests.
2 open issues
2 resolved since last review
Review effort: Balanced
09972bd to
c693d2d
Compare
c693d2d to
b9400dd
Compare
Add the signed_certificate_timestamp extension for TLS 1.2 and TLS 1.3, enabled with --enable-sct (CMake WOLFSSL_SCT, macro HAVE_SIGNED_CERT_TIMESTAMP) and by --enable-all and --enable-tlsx. wolfSSL carries the SignedCertificateTimestampList between peers; validating the timestamps is left to the application. - wolfSSL_CTX_set_signed_cert_timestamp_list() and wolfSSL_set_signed_cert_timestamp_list() (BoringSSL names via wolfssl/openssl/ssl.h) set the list a server presents. They take a size_t length, as BoringSSL's do, so the list is structurally checked and bounded by WOLFSSL_MAX_SCT_LIST_SZ before any narrowing. The context list is guarded by a mutex since it can be replaced while handshakes run. At TLS 1.2 a list that would push the ServerHello past a negotiated max_fragment_length is left out rather than the record overflowed. - wolfSSL_get0_signed_cert_timestamp_list() returns the peer's list and wolfSSL_signed_cert_timestamp_requested() reports whether the peer asked. - A client asks with an empty extension. The server answers in the ServerHello at TLS 1.2 (not on resumption) and on the end entity CertificateEntry at TLS 1.3. In a CertificateRequest it is accepted and ignored. - A context switch from an SNI callback moves the list with the certificate, and a list set from a callback after the ClientHello is still answered. - An application custom extension cannot be registered for type 18 when the extension is built in. Crypto-only and no-TLS builds turn the option off, in configure and CMake alike, overriding an explicit --enable-sct or -DWOLFSSL_SCT=yes (configure warns). ChangeLog.md records the feature and that --enable-all and --enable-tlsx now enable it. Per-certificate extensions in the TLS 1.3 Certificate message are now built under WOLFSSL_CERT_ENTRY_EXTS (status_request or SCT, server side), with WriteCSRToBuffer() becoming WriteCertEntryExts(). Every site that builds, indexes or frees those buffers uses the same guard, so the send loop no longer reuses the leaf's entry for every certificate in the chain. TLSX_GetResponseSize() now refuses an extensions block or message whose length no longer fits a word16, instead of wrapping and under-allocating the ServerHello that a large SCT list makes possible.
b9400dd to
9495cc2
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The new TLS wire parsing and certificate-fragment buffer handling require runtime and interoperability validation across SCT-only, OCSP+SCT, and client/server-only builds, which source inspection alone cannot provide.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
julek-wolfssl
left a comment
There was a problem hiding this comment.
Comments are again too verbose.
This only implements SCTs from the server to the client. The TLS 1.3 RFC allows the client to send them too. Let's implement that direction too.
| /* Declared outside the OpenSSL compatibility block: these have their own | ||
| * build options and no dependency on it. */ |
There was a problem hiding this comment.
I don't think mentioning the compat layer is necessary here. I don't see compat types in these API.
| /* Guards the two fields above. A context's list can be replaced while | ||
| * handshakes using that context are running, and the setter frees the | ||
| * buffer it is replacing, so the pointer and its length are only read or | ||
| * written with this held. Compiles to nothing in a SINGLE_THREADED | ||
| * build, where wc_LockMutex() and friends are no-ops. */ | ||
| wolfSSL_Mutex sctLock; |
There was a problem hiding this comment.
Certs can't be safely replaced in the ctx object while ssl objects exist. Isn't the SCT meant to last the lifetime of the cert?
There was a problem hiding this comment.
If you really want to lock the ctx then why introduce a new lock when you could use ctx->ref?
| /* Whether sctLock was initialised. InitSSL_Ctx() can fail before or at | ||
| * that point and the caller then frees the context, which must not | ||
| * destroy a mutex that was never created. */ | ||
| byte sctLockInit:1; |
There was a problem hiding this comment.
Can't we just use the length?
| #endif /* HAVE_SIGNED_CERT_TIMESTAMP */ | ||
|
|
||
| #ifdef HAVE_SIGNED_CERT_TIMESTAMP |



Description
Add the signed_certificate_timestamp extension for TLS 1.2 and TLS 1.3, enabled with --enable-sct (CMake WOLFSSL_SCT, macro HAVE_SIGNED_CERT_TIMESTAMP) and by --enable-all and --enable-tlsx. wolfSSL carries the SignedCertificateTimestampList between peers; validating the timestamps is left to the application.
Crypto-only builds turn the option off, in configure and CMake alike.
Per-certificate extensions in the TLS 1.3 Certificate message are now built under WOLFSSL_CERT_ENTRY_EXTS (status_request or SCT, server side), with WriteCSRToBuffer() becoming WriteCertEntryExts(). Every site that builds, indexes or frees those buffers uses the same guard, so the send loop no longer reuses the leaf's entry for every certificate in the chain.
TLSX_GetResponseSize() now refuses an extensions block or message whose length no longer fits a word16, instead of wrapping and under-allocating the ServerHello that a large SCT list makes possible.
Testing
./configure --enable-sct --disable-tls13
./configure --enable-sct --enable-ocspstapling
./configure --enable-sni --enable-opensslextra
./configure --disable-tls --enable-sct