Skip to content

fix: fail reads clearly when the peer sends a TLS 1.3 KeyUpdate - #75

Open
ArniDagur wants to merge 1 commit into
rustls:mainfrom
ArniDagur:fix-keyupdate-clear-error
Open

fix: fail reads clearly when the peer sends a TLS 1.3 KeyUpdate#75
ArniDagur wants to merge 1 commit into
rustls:mainfrom
ArniDagur:fix-keyupdate-clear-error

Conversation

@ArniDagur

@ArniDagur ArniDagur commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

We don't support switching traffic keys, so after a peer rekeys every read fails to decrypt with an opaque EBADMSG. Detect the KeyUpdate handshake message and fail the read with an explicit error instead. NewSessionTicket is still ignored.

This matches Facebook's kTLS implementation's handling of both KeyUpdate and NewSessionTicket: https://github.com/facebookincubator/fizz/blob/7fb7075a65ec9e669a6851669502d549e12f9e0f/fizz/experimental/ktls/AsyncKTLSSocket.cpp#L257-L280

We should implement KeyUpdate in the ktls crate at some point. There is already ongoing work (#62). Until that is complete, it's best to return an explicit error.

The kernel cannot switch traffic keys, so after a peer rekeys every
read fails to decrypt with an opaque `EBADMSG`. Detect the KeyUpdate
handshake message and fail the read with an explicit error instead.
NewSessionTicket is still ignored.

This matches Facebook's kTLS implementation: https://github.com/facebookincubator/fizz/blob/7fb7075a65ec9e669a6851669502d549e12f9e0f/fizz/experimental/ktls/AsyncKTLSSocket.cpp#L257-L280

We should implement `KeyUpdate` in the `ktls` crate at some point. There is already ongoing work (rustls#62). Until that is complete, it's best to return an explicit error.
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.

1 participant