Fix session ticket key rotation when hint exceeds key lifetime#10822
Open
mattia-moffa wants to merge 1 commit into
Open
Fix session ticket key rotation when hint exceeds key lifetime#10822mattia-moffa wants to merge 1 commit into
mattia-moffa wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a session-ticket encryption key rotation edge case where ticketHint can exceed the default ticket key lifetime, previously causing TicketEncCbCtx_ChooseKey() to return BAD_STATE_E and break subsequent handshakes when reusing a server WOLFSSL_CTX.
Changes:
- Update default session ticket key selection/rotation logic to avoid returning
BAD_STATE_Ewhen both keys are decrypt-valid but neither coversticketHint. - Add a new API regression test that reuses server/client contexts across multiple handshakes with an oversized ticket hint.
- Register the new test in the ssl extension test list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/internal.c |
Adjusts default ticket key selection behavior when neither key covers the configured hint window. |
tests/api/test_ssl_ext.c |
Adds a regression test covering repeated handshakes with a reused server context and oversized ticket hint. |
tests/api/test_ssl_ext.h |
Exposes/registers the new regression test in the ssl_ext group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The default ticket encryption callback rotates two keys and can only honor a hint below WOLFSSL_TICKET_KEY_LIFETIME/2; a larger hint previously left no key available for encryption, failing every handshake after the first on a reused server CTX. Now these values are rejected.
3125631 to
9514b21
Compare
Member
Author
|
Jenkins retest this please |
This file contains hidden or 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
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.
Description
Disallows a
ticketHint > WOLFSSL_TICKET_KEY_LIFETIME / 2.The default ticket encryption callback rotates two keys and can only honor a hint below half the ticket key lifetime; a larger hint previously left no key available for encryption, failing every handshake after the first on a reused server CTX. Now these values are rejected.
Fixes #10796
Testing
Checklist