Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Critical TLS 1.3 enforcement gaps allow oversized authenticated handshake records to bypass record-size limits during 0-RTT rejection and EncryptedExtensions processing.
5 open issues
Revalidate TLS 1.3 records after negotiating the size limit · New Enforce record size limits after decrypting rejected 0-RTT records · New Disable record size limit support in crypto-only builds · New Split DTLS ACKs to fit the peer’s record size limit · New Keep the issuing context when testing oversized early data · New
What changed in this PR
Adds RFC 8449 record_size_limit support to wolfSSL’s TLS extension and record-processing layers for TLS 1.2 and TLS 1.3.
Changes:
- Adds build options, public configuration APIs, and extension negotiation.
- Enforces record limits and adds handshake fragmentation, compression compatibility checks, and connection-state handling.
- Adds API documentation, regression tests, and Linux CI configurations.
| File | Description |
|---|---|
wolfssl/ssl.h |
Declares record-limit APIs and constants. |
wolfssl/internal.h |
Adds extension identifiers and connection state. |
tests/api/test_tls13.h |
Registers new record-limit tests. |
tests/api/test_tls13.c |
Tests negotiation, overflow, fragmentation, and early data. |
tests/api/test_tls.h |
Registers the TLS 1.2 negotiation test. |
tests/api/test_tls.c |
Tests TLS 1.2 limits and context inheritance. |
tests/api/test_tls_ext.c |
Tests rejection of conflicting custom extensions. |
tests/api/test_dtls13.c |
Increases test MTU for the larger ClientHello. |
tests/api/test_compress.h |
Registers compression compatibility coverage. |
tests/api/test_compress.c |
Tests compression and record-limit conflicts. |
src/tls13.c |
Adds handshake fragmentation and certificate-header bounds checks. |
src/tls.c |
Implements extension encoding, parsing, and negotiation rules. |
src/ssl.c |
Handles compression conflicts, duplication, and state reset. |
src/ssl_api_ext.c |
Implements connection and context setters. |
src/internal.c |
Initializes limits and enforces record-size bounds. |
doc/dox_comments/header_files/ssl.h |
Documents APIs and feature interactions. |
configure.ac |
Adds the Autotools option and feature defines. |
CMakeLists.txt |
Adds CMake configuration and crypto-only handling. |
cmake/options.h.in |
Exposes the feature macro in generated options. |
.github/configs/os-check-linux.json |
Adds focused Linux CI configurations. |
Review effort: Balanced
|
c7123c9 to
42b8e64
Compare
42b8e64 to
fa22a33
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The CBC probe miscalculates the ciphertext boundary and fails in the AES-CBC/SHA-1 configuration without encrypt-then-MAC, while CertificateRequest fragmentation can cause quadratic buffer copying.
2 open issues
4 resolved since last review
Review effort: Balanced
fa22a33 to
290ecf0
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain: imported objects can bypass receive-size enforcement and accept oversized TLS 1.3 records, while enabling record-size limits with TLS disabled and compression enabled can cause consumer link failures.
2 open issues
2 resolved since last review
Review effort: Balanced
290ecf0 to
30e2488
Compare
There was a problem hiding this comment.
🟡 Changes recommended
With WOLFSSL_OLD_UNSUPPORTED_EXTENSION enabled, TLS 1.3 clients incorrectly accept an unsolicited record_size_limit extension instead of aborting with unsupported_extension, and the test must expect rejection.
1 open issue
2 resolved since last review
Review effort: Balanced
Add the record_size_limit extension for TLS 1.3 and TLS 1.2, enabled with --enable-recordsizelimit (CMake WOLFSSL_RECORDSIZELIMIT, macro HAVE_RECORD_SIZE_LIMIT) and by --enable-all and --enable-tlsx. - wolfSSL_UseRecordSizeLimit() / wolfSSL_CTX_UseRecordSizeLimit() set the largest record payload this end accepts (64 to 16384, 0 to not advertise). A limit of 16384 is advertised by default. - The client offers it in the ClientHello; the server answers in EncryptedExtensions under TLS 1.3 and in the ServerHello under TLS 1.2. The TLS 1.3 wire value includes the content type byte. - Records sent are capped to the peer's limit once encryption is on; received records over our advertised limit are refused with record_overflow, checked on the ciphertext length and again on the decrypted plaintext. Early data a server receives is exempt. - RFC 8449 Sect. 5: a server ignores max_fragment_length when both are in a ClientHello, and a client aborts if a server sends both. The built-in default stands aside when the application asked for max_fragment_length. - EncryptedExtensions, CertificateRequest and NewSessionTicket are fragmented across records when the peer's limit is smaller than the message. SendTls13Certificate() refuses a limit too small for the message's fixed header rather than writing past the fragment. - Record compression and a record size limit refuse each other on one connection, and compression is refused once the default limit has been advertised or received. - The limit is copied to a write-dup object and peer state is reset by wolfSSL_clear(). Session export, whose format does not carry the limits, is refused for a connection that negotiated one below the maximum. - An application custom extension cannot be registered for type 28 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-recordsizelimit or -DWOLFSSL_RECORDSIZELIMIT=yes (configure warns). ChangeLog.md records the feature and that --enable-all and --enable-tlsx now advertise it. test_dtls_frag_ch's MTU is raised as the ClientHello grows by 6 bytes.
30e2488 to
431f768
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive TLS/DTLS record enforcement and handshake fragmentation changes require specialist review, with interoperability and retry behavior unvalidated and DTLS 1.3 ACK and TLS 1.2 renegotiation enforcement gaps explicitly deferred.
No open issues 🎉
1 resolved since last review
Review effort: Balanced


Description
Add the record_size_limit extension for TLS 1.3 and TLS 1.2, enabled with --enable-recordsizelimit (CMake WOLFSSL_RECORDSIZELIMIT, macro HAVE_RECORD_SIZE_LIMIT) and by --enable-all and --enable-tlsx.
Crypto-only builds turn the option off, in configure and CMake alike.
test_dtls_frag_ch's MTU is raised as the ClientHello grows by 6 bytes.
Testing
./configure --enable-recordsizelimit --enable-earlydata --enable-session-ticket
./configure --enable-recordsizelimit --disable-tls13
./configure --enable-recordsizelimit --enable-maxfragment
./configure --enable-recordsizelimit --enable-postauth
./configure --enable-recordsizelimit --with-libz
./configure --enable-recordsizelimit --enable-dtls --enable-dtls13
./configure --enable-recordsizelimit --enable-dtls --enable-dtls13 --enable-dtls-frag-ch