ktls: add method to track key updates #4364
Merged
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:
Add key update count tracking. A customer interesting in TLS1.3 + ktls wants to measure how often they currently update their keys.
I think it's safe to cap the fields at 255. We really don't expect any connections to get anywhere near that many updates. When awslc saw that many, it was because of a bug :) 255 key updates would be enough for using AES to send 50TB of data with average sized records or 100TB with maximum sized records. If I bumped the fields up to uint16_t, it'd be 12PB/25PB.
Callouts:
I can see the argument that this method is pretty useless. If you don't control your clients, it's never going to be safe to assume that no clients will ever require a key update. But maybe the number is low enough that you're willing to take the availability hit? Minimally this should be unstable until we decide it's really necessary for ktls or find another use case.
Testing:
Unit tests.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.