-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intentionally disable fragmenting KeyUpdates #3708
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83f8dfa
to
2f5091e
Compare
maddeleine
reviewed
Dec 16, 2022
maddeleine
reviewed
Dec 16, 2022
harrisonkaiser
approved these changes
Dec 20, 2022
2f5091e
to
0455969
Compare
0455969
to
d1c04df
Compare
harrisonkaiser
approved these changes
Dec 21, 2022
maddeleine
approved these changes
Jan 3, 2023
camshaft
approved these changes
Jan 3, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolved issues:
Partially addresses #3432
Description of changes:
While working on a more general solution for fragmenting post-handshake messages, I ran into some issues with KeyUpdates.
Our usual fragmentation story is:
With a KeyUpdate, we need to change the encryption key after sending the message. So if the KeyUpdate message is fragmented, then we need to trigger some KeyUpdate-specific logic AFTER moving on to the common fragmentation / record-writing logic.
We could of course do that. I thought of several methods to solve that problem, but all of them-- and I'd argue, any possible solution-- will make KeyUpdates more complex. And we don't gain much from that extra complexity, since the KeyUpdate message is only 5 bytes and the absolute minimum fragment size we support is 2 bytes. We'd be making the code more complex to save 3 bytes, and any solution will cost at least 1 byte of stored state.
So rather than implement fragmentation for KeyUpdate messages, I think it's a cleaner solution to just bump the minimum send buffer size up by 3 bytes so that we always ensure that there's sufficient space for a KeyUpdate message.
The only use case I can think of for setting your send buffer that low is that you know that you'll always only be sending a few bytes of application data. This seems unlikely to break anyone. There's also precedent, since we already bumped the minimum up by 1 byte in 4f3c16d to properly handle alerts.
An alternative that wouldn't change any behavior is to keep the current minimum, but error when sending a KeyUpdate message if the send buffer is too small. Since we currently only send a partial KeyUpdate if the send buffer is too small, the connection already fails if it requires a KeyUpdate and the send buffer is too small. We could note this behavior in the method documentation, but it seems like an unnecessary sharp edge and I'd rather prevent it.
Callouts
Testing:
New unit tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.