Skip to content
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

only update the traffic key when a key schedule is available (ie. in 1.3 only) #483

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/picotls.c
Original file line number Diff line number Diff line change
Expand Up @@ -5885,9 +5885,11 @@ int ptls_send(ptls_t *tls, ptls_buffer_t *sendbuf, const void *input, size_t inl
assert(tls->traffic_protection.enc.aead != NULL);

/* "For AES-GCM, up to 2^24.5 full-size records (about 24 million) may be encrypted on a given connection while keeping a
* safety margin of approximately 2^-57 for Authenticated Encryption (AE) security." (RFC 8446 section 5.5)
* safety margin of approximately 2^-57 for Authenticated Encryption (AE) security." (RFC 8446 section 5.5).
*
* Key updates do not happen with tls 1.2, check `key_schedule` to see if we are using tls/1.3
*/
if (tls->traffic_protection.enc.seq >= 16777216)
if (tls->traffic_protection.enc.seq >= 16777216 && tls->key_schedule != NULL)
tls->needs_key_update = 1;

if (tls->needs_key_update) {
Expand Down
Loading