feat(s2n-quic-transport): discard client initial keys when we have handshake keys #1894
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
QUIC-TLS§4.9.1 makes it clear that Initial secrets should be discarded aggressively:
Currently, the s2n-quic client waits until we have successfully sent a Handshake packet to discard Initial keys. If for some reason we are unable to send the Handshake packet or did not need to send a Handshake packet, the Initial keys are retained, even though they are no longer needed. This could happen, for example, if the Server's Handshake packet was lost.
This change will discard the Initial keys on the client as long as we have installed the Handshake keys, reducing the window in which the type of attacks mentioned in the RFC are possible.
Call-outs:
While making this change, I noticed that in the scenario where the server's handshake packet is lost, we do not arm the PTO timer in the
Handshake
space. This violates this requirement from QUIC-RECOVERY§6.2.2:This becomes more problematic if the Initial space is discarded without sending a Handshake packet, as no PTO timer will be set at all. To address this, I have explicitly reset the PTO timer in the
Handshake
space when theInitial
space is discarded. This should also address the issues that were previously fixed in #1818. Once this PR is merged, we can consider reverting those changes if they are no longer necessary.Testing:
Added an integration test
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.