Skip to content

tests/api: add DTLS 1.3 server CTX reuse ticket regression test#10797

Open
Spongman wants to merge 2 commits into
wolfSSL:masterfrom
Spongman:master
Open

tests/api: add DTLS 1.3 server CTX reuse ticket regression test#10797
Spongman wants to merge 2 commits into
wolfSSL:masterfrom
Spongman:master

Conversation

@Spongman

@Spongman Spongman commented Jun 27, 2026

Copy link
Copy Markdown

test_dtls13_server_ctx_reuse_ticket reproduces a BAD_STATE_E fatal error that occurs when a WOLFSSL_CTX is reused across successive DTLS 1.3 handshakes after issuing a NewSessionTicket.

Root cause: TicketEncCbCtx_ChooseKey() refuses to use a key unless expirary[i] >= now + ticketHint, but only generates a replacement when expirary[i] < now. When ticketHint > WOLFSSL_TICKET_KEY_LIFETIME / 2 (e.g. because wolfSSL_CTX_set_timeout() was called with a large value), both keys can be simultaneously alive yet unable to cover the hint window, hitting the BAD_STATE_E branch and causing wolfSSL_accept() to fail fatally on every handshake after the first.

test_dtls13_server_ctx_reuse_no_ticket_ok is the control: the same scenario with TLS 1.3 tickets suppressed passes, isolating the fault to NewSessionTicket issuance tainting the reused CTX.

Repros #10796

Testing

(see bug report)

Checklist

  • added tests

test_dtls13_server_ctx_reuse_ticket reproduces a BAD_STATE_E fatal error
that occurs when a WOLFSSL_CTX is reused across successive DTLS 1.3
handshakes after issuing a NewSessionTicket.

Root cause: TicketEncCbCtx_ChooseKey() refuses to use a key unless
expirary[i] >= now + ticketHint, but only generates a replacement when
expirary[i] < now.  When ticketHint > WOLFSSL_TICKET_KEY_LIFETIME / 2
(e.g. because wolfSSL_CTX_set_timeout() was called with a large value),
both keys can be simultaneously alive yet unable to cover the hint window,
hitting the BAD_STATE_E branch and causing wolfSSL_accept() to fail fatally
on every handshake after the first.

test_dtls13_server_ctx_reuse_no_ticket_ok is the control: the same
scenario with TLS 1.3 tickets suppressed passes, isolating the fault to
NewSessionTicket issuance tainting the reused CTX.
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

test_dtls13_server_ctx_reuse_ticket reproduces a BAD_STATE_E fatal error
that occurs when a WOLFSSL_CTX is reused across successive DTLS 1.3
handshakes after issuing a NewSessionTicket.

Root cause: TicketEncCbCtx_ChooseKey() refuses to use a key unless
expirary[i] >= now + ticketHint, but only generates a replacement when
expirary[i] < now.  When ticketHint > WOLFSSL_TICKET_KEY_LIFETIME / 2
(e.g. because wolfSSL_CTX_set_timeout() was called with a large value),
both keys can be simultaneously alive yet unable to cover the hint window,
hitting the BAD_STATE_E branch and causing wolfSSL_accept() to fail fatally
on every handshake after the first.

test_dtls13_server_ctx_reuse_no_ticket_ok is the control: the same
scenario with TLS 1.3 tickets suppressed passes, isolating the fault to
NewSessionTicket issuance tainting the reused CTX.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants