Conversation
There was a problem hiding this comment.
Pull request overview
Adds DTLS 1.3/TLS 1.3 write-dup (DupSSL) support so the read-side can delegate post-handshake work (KeyUpdate responses, DTLS13 ACK sending, post-handshake auth) to the write-side, along with new tests and CI coverage.
Changes:
- Extend
WriteDupshared state to transfer DTLS13 ACKs, track KeyUpdate ACKs, and delegate post-handshake auth state. - Update TLS13/DTLS13 processing to delegate write-required actions from read-dup to write-dup.
- Add/expand API tests for write-dup across protocol versions, WANT_WRITE recovery paths, key updates, and post-handshake auth; enable writedup config in CI.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
wolfssl/internal.h |
Adds new write-dup shared fields/flags and new internal function declarations used by delegation paths. |
src/internal.c |
Refactors handshake-hash freeing for reuse and moves DTLS13 epoch init earlier for write-dup early returns. |
src/tls13.c |
Delegates TLS 1.3 KeyUpdate response and post-handshake CertificateRequest handling to write-dup side. |
src/dtls13.c |
Delegates DTLS 1.3 ACK work to write-dup and tracks KeyUpdate ACK arrival; exposes RTX removal helper. |
src/ssl.c |
Copies TLS13 secrets/DTLS13 epoch state into dup; implements write-side execution of delegated work. |
tests/api.c |
Adds/expands tests for write-dup across TLS/DTLS versions, key updates, post-handshake auth, WANT_WRITE. |
.github/workflows/os-check.yml |
Adds --enable-all --enable-writedup to CI matrix to exercise the new feature. |
Comments suppressed due to low confidence (3)
src/internal.c:1
Free_HS_Hashesis declared asWOLFSSL_LOCALinwolfssl/internal.h, but the definition here omitsWOLFSSL_LOCAL, which can cause a linkage/visibility mismatch depending on howWOLFSSL_LOCALis defined. Update the definition to match the header's storage/visibility macro. Also, settinghsHashes = NULLat the end has no effect on the caller (pass-by-value), so either remove that line or change the API to takeHS_Hashes**if caller-nullification is required.
src/internal.c:1Free_HS_Hashesis declared asWOLFSSL_LOCALinwolfssl/internal.h, but the definition here omitsWOLFSSL_LOCAL, which can cause a linkage/visibility mismatch depending on howWOLFSSL_LOCALis defined. Update the definition to match the header's storage/visibility macro. Also, settinghsHashes = NULLat the end has no effect on the caller (pass-by-value), so either remove that line or change the API to takeHS_Hashes**if caller-nullification is required.
tests/api.c:1EXCHANGE_DATAis defined multiple times in this file with very similar bodies (including WANT_WRITE variants). This increases the chance of tests diverging unintentionally when the exchange logic needs updating. Consider using a small helper function (or a single parameterized macro) that takes the relevantsslhandles/test context flags to centralize the exchange behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
Retest this please flaky test. |
- Copy TLS 1.3 traffic secrets and DTLS 1.3 epoch/cipher state to the write-dup side in DupSSL so key updates can be performed. - Delegate KeyUpdate responses from the read side to the write side via the shared WriteDup struct, for both peer-initiated and local key updates. - Delegate DTLS 1.3 ACK sending from the read side to the write side. - Track DTLS 1.3 KeyUpdate ACKs: write side records the in-flight KeyUpdate epoch/seq, read side sets keyUpdateAcked when the matching ACK arrives. - Delegate post-handshake certificate authentication (CertificateRequest processing) from the read side to the write side, transferring transcript hashes, cert context, and signature parameters. - Reset prevSent/plainSz to prevent stale values from SendData to think that data was already sent. - Refactor FreeHandshakeHashes into Free_HS_Hashes for reuse. - Move DTLS 1.3 epoch initialization earlier in InitSSL so the write-dup early-return path has valid epoch state. - Add tests for write dup with all protocol versions, key update, post-handshake auth, and WANT_WRITE recovery. - Add --enable-all --enable-writedup to CI os-check matrix.
There was a problem hiding this comment.
Pull request overview
This PR extends write-dup (DupSSL) support to cover DTLS 1.3/TLS 1.3 post-handshake flows by sharing additional state between read/write sides, enabling key updates, ACK delegation, and post-handshake authentication to be handled by the write side when the read side cannot write.
Changes:
- Share DTLS 1.3 ACK work and KeyUpdate ACK tracking between read/write dup sides; expose RTX record removal to support cleanup.
- Delegate TLS 1.3 KeyUpdate responses and post-handshake CertificateRequest handling from read side to write side (state transfer via
WriteDup). - Add/expand API tests for write-dup across protocol versions, including WANT_WRITE recovery; enable write-dup build in CI matrix.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
wolfssl/internal.h |
Adds WriteDup fields/flags for DTLS 1.3 ACK + KeyUpdate ACK tracking and TLS 1.3 post-handshake auth delegation; adds new internal prototypes/flags. |
src/internal.c |
Refactors handshake-hash freeing into reusable helper; moves DTLS 1.3 epoch init earlier; resets buffered-send tracking fields. |
src/tls13.c |
Delegates KeyUpdate response + post-handshake CertificateRequest handling to write-dup side. |
src/dtls13.c |
Delegates ACK sending to write side; tracks KeyUpdate ACKs; makes RTX removal callable externally. |
src/ssl.c |
Copies TLS 1.3 secrets / DTLS 1.3 epoch+cipher state into write-dup; handles delegated KeyUpdate/ACK/auth work in wolfSSL_write_internal; frees new shared-state allocations. |
tests/api.c |
Extends write-dup tests to DTLS{1.2,1.3}, KeyUpdate, post-handshake auth, and WANT_WRITE scenarios. |
.github/workflows/os-check.yml |
Adds CI job configuration that enables write-dup. |
Comments suppressed due to low confidence (1)
src/internal.c:1
InitHandshakeHashesAndCopy()frees*destinationbut does not null it before attemptingXMALLOC. If allocation fails,*destinationremains a dangling pointer to freed memory, which can lead to a later double-free/use-after-free. Fix by setting*destination = NULLimmediately after freeing, or by changingFree_HS_Hashesto takeHS_Hashes**and null the caller’s pointer.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
write-dup side in DupSSL so key updates can be performed.
the shared WriteDup struct, for both peer-initiated and local key
updates.
KeyUpdate epoch/seq, read side sets keyUpdateAcked when the matching
ACK arrives.
processing) from the read side to the write side, transferring
transcript hashes, cert context, and signature parameters.
that data was already sent.
write-dup early-return path has valid epoch state.
post-handshake auth, and WANT_WRITE recovery.