Skip to content

DTLS 1.3 write dup support#10006

Open
julek-wolfssl wants to merge 2 commits intowolfSSL:masterfrom
julek-wolfssl:zd/21329
Open

DTLS 1.3 write dup support#10006
julek-wolfssl wants to merge 2 commits intowolfSSL:masterfrom
julek-wolfssl:zd/21329

Conversation

@julek-wolfssl
Copy link
Member

  • 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.

Copilot AI review requested due to automatic review settings March 18, 2026 17:57
@julek-wolfssl julek-wolfssl self-assigned this Mar 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WriteDup shared 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_Hashes is declared as WOLFSSL_LOCAL in wolfssl/internal.h, but the definition here omits WOLFSSL_LOCAL, which can cause a linkage/visibility mismatch depending on how WOLFSSL_LOCAL is defined. Update the definition to match the header's storage/visibility macro. Also, setting hsHashes = NULL at the end has no effect on the caller (pass-by-value), so either remove that line or change the API to take HS_Hashes** if caller-nullification is required.
    src/internal.c:1
  • Free_HS_Hashes is declared as WOLFSSL_LOCAL in wolfssl/internal.h, but the definition here omits WOLFSSL_LOCAL, which can cause a linkage/visibility mismatch depending on how WOLFSSL_LOCAL is defined. Update the definition to match the header's storage/visibility macro. Also, setting hsHashes = NULL at the end has no effect on the caller (pass-by-value), so either remove that line or change the API to take HS_Hashes** if caller-nullification is required.
    tests/api.c:1
  • EXCHANGE_DATA is 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 relevant ssl handles/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.

- 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.
@julek-wolfssl
Copy link
Member Author

Retest this please flaky test

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.

2 participants