SSL_CTX_SET_NUM_TICKETS(3ossl)
π SSL_CTX_SET_NUM_TICKETS π
okay bestie, welcome to the 3ossl manual page, this is the one about controlling how many TLSv1.3 session tickets get handed out ποΈβ¨
β¨ NAME β¨
SSL_set_num_tickets, SSL_get_num_tickets, SSL_CTX_set_num_tickets, SSL_CTX_get_num_tickets, SSL_new_session_ticket β literally the whole friend group that controls the number of TLSv1.3 session tickets that are issued π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
int SSL_set_num_tickets(SSL *s, size_t num_tickets);
size_t SSL_get_num_tickets(const SSL *s);
int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);
size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);
int SSL_new_session_ticket(SSL *s);
π¦ DESCRIPTION π¦
the setters, aka setting the vibe π
SSL_CTX_set_num_tickets() and SSL_set_num_tickets() are for server applications, and they set the number of TLSv1.3 session tickets that get sent to the client after a full handshake. You drop the value you want (and yes, it can be 0, zero is a valid lewk) into the num_tickets argument. Typically you wanna call these before the handshake even starts, no cap.
The default number of tickets is 2 βοΈ. But here's the tea: after a resumption, the number of tickets issued will never be more than 1, no matter what value you set via SSL_set_num_tickets() or SSL_CTX_set_num_tickets(). And if num_tickets is set to 0, then no tickets get issued at all β not for a normal connection, not for a resumption. zero tickets, zero crumbs, periodt π
post-handshake certificates, the plot twist π
Tickets also get issued when the server receives a post-handshake certificate from the client, following a request by the server using SSL_verify_client_post_handshake(3). These new tickets are associated with the updated client identity (i.e. including their certificate and verification status). The number of tickets issued will normally be the same as was used for the initial handshake. And if the initial handshake was a full handshake, then you can call SSL_set_num_tickets() again before calling SSL_verify_client_post_handshake() to update how many tickets will be sent. slay π₯
SSL_new_session_ticket() β the main character ποΈπ
So when you wanna issue tickets after other events (like application-layer changes, iykyk), a server application uses SSL_new_session_ticket() to request that a new ticket be sent when it's safe to do so.
bestie, listen: new tickets are only allowed to be sent this way after the initial handshake has completed, and only for TLS 1.3 connections. that's the rule π
By default, the ticket generation and transmission are delayed until the server is starting a new write operation, so that it gets bundled with other application data being written and properly aligned to a record boundary. Very organized of it π
If the connection was at a record boundary when SSL_new_session_ticket() was called, the ticket can be sent immediately (without waiting for the next application write) by calling SSL_do_handshake().
SSL_new_session_ticket() can be called more than once to request additional tickets be sent; all such requests are queued and written together when it's safe to do so, triggered by SSL_write() or SSL_do_handshake().
β οΈ not me forgetting this: a successful return from SSL_new_session_ticket() indicates only that the request to send a ticket was processed, not that the ticket itself was sent. those are two different things fr fr π
To be notified when the ticket itself is actually sent, register a new-session callback with SSL_CTX_sess_set_new_cb(3) β it'll be invoked as the ticket or tickets are generated. obsessed π«Ά
the getters π
SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets set by a previous call to SSL_CTX_set_num_tickets() or SSL_set_num_tickets() β or 2 if no such call has been made. default behavior, iconic β¨
π RETURN VALUES π
SSL_CTX_set_num_tickets(),SSL_set_num_tickets(), andSSL_new_session_ticket()return 1 on success or 0 on failure. that's it, that's the binary π―SSL_CTX_get_num_tickets()andSSL_get_num_tickets()return the number of tickets that have been previously set.
π SEE ALSO π
π HISTORY π
SSL_new_session_ticket()was added in OpenSSL 3.0.0.SSL_set_num_tickets(),SSL_get_num_tickets(),SSL_CTX_set_num_tickets(), andSSL_CTX_get_num_tickets()were added in OpenSSL 1.1.1.
π COPYRIGHT π
Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page bestie!! this was OpenSSL 3.5.9, dated 2026-09-29, from the SSL_CTX_SET_NUM_TICKETS(3ossl) manual β go forth and ticket responsibly ποΈπβ¨π¦πΈ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms