Skip to content

dtls13: epoch mangament improvement and bug fixes - #11016

Open
rizlik wants to merge 1 commit into
wolfSSL:masterfrom
rizlik:dtls_epochs
Open

dtls13: epoch mangament improvement and bug fixes#11016
rizlik wants to merge 1 commit into
wolfSSL:masterfrom
rizlik:dtls_epochs

Conversation

@rizlik

@rizlik rizlik commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
  1. NULL-ify Dtls13DecryptEcpoch if the pointed epoch is evicted
  2. Use only epoch that can decrypt as candidate for decrypting records
  3. Never evict Peer epoch - 1 as it can be active

1. NULL-ify Dtls13DecryptEcpoch if the pointed epoch is evicted
2. Don't use ECRYPT_ONLY epoch as epoch candidates of received records
3. Never evict Peer epoch - 1 as it can be active
Copilot AI review requested due to automatic review settings July 30, 2026 07:08
@rizlik rizlik self-assigned this Jul 30, 2026
@rizlik
rizlik requested a review from julek-wolfssl July 30, 2026 07:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens DTLS 1.3 epoch lifecycle handling to avoid stale/invalid decrypt-epoch pointers, ensure only decrypt-capable epochs are considered for incoming record processing, and prevent eviction of epochs that may still be active due to KeyUpdate/ACK loss. It also adds regression tests covering epoch slot reuse, replay behavior, and rejection of post-handshake plaintext records.

Changes:

  • Enforce a minimum DTLS 1.3 epoch slot count and expose Dtls13NewEpoch for testing/prefix-mapped builds.
  • Make epoch reconstruction and eviction logic DTLS13-aware: skip encrypt-only epochs for decryption and preserve peer epoch − 1; NULL-out dtls13DecryptEpoch when its slot is evicted.
  • Reject DTLSPlaintext records (epoch 0) after handshake completion and add new DTLS13 API tests for the above behaviors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wolfssl/internal.h Enforces DTLS13_EPOCH_SIZE >= 4 and makes Dtls13NewEpoch test-visible/prefix-mapped.
src/dtls13.c Improves epoch candidate selection and eviction safety (preserve peer epoch − 1; NULL decrypt epoch on eviction).
src/internal.c Hardens record header processing for DTLS13 (recover when decrypt epoch is NULL; drop post-handshake plaintext).
tests/api/test_dtls13.h Registers new DTLS13 regression tests.
tests/api/test_dtls13.c Adds regression tests for epoch slot reuse, replay protection continuity, and post-handshake plaintext ACK dropping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rizlik rizlik removed their assignment Jul 30, 2026
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.

4 participants