1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimSSL_set_num_tickets, 6e71b7053SJung-uk KimSSL_get_num_tickets, 7e71b7053SJung-uk KimSSL_CTX_set_num_tickets, 8*b077aed3SPierre ProncherySSL_CTX_get_num_tickets, 9*b077aed3SPierre ProncherySSL_new_session_ticket 10e71b7053SJung-uk Kim- control the number of TLSv1.3 session tickets that are issued 11e71b7053SJung-uk Kim 12e71b7053SJung-uk Kim=head1 SYNOPSIS 13e71b7053SJung-uk Kim 14e71b7053SJung-uk Kim #include <openssl/ssl.h> 15e71b7053SJung-uk Kim 16e71b7053SJung-uk Kim int SSL_set_num_tickets(SSL *s, size_t num_tickets); 17*b077aed3SPierre Pronchery size_t SSL_get_num_tickets(const SSL *s); 18e71b7053SJung-uk Kim int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); 19*b077aed3SPierre Pronchery size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); 20*b077aed3SPierre Pronchery int SSL_new_session_ticket(SSL *s); 21e71b7053SJung-uk Kim 22e71b7053SJung-uk Kim=head1 DESCRIPTION 23e71b7053SJung-uk Kim 24e71b7053SJung-uk KimSSL_CTX_set_num_tickets() and SSL_set_num_tickets() can be called for a server 256935a639SJung-uk Kimapplication and set the number of TLSv1.3 session tickets that will be sent to 266935a639SJung-uk Kimthe client after a full handshake. Set the desired value (which could be 0) in 276935a639SJung-uk Kimthe B<num_tickets> argument. Typically these functions should be called before 286935a639SJung-uk Kimthe start of the handshake. 29e71b7053SJung-uk Kim 30b2bf0c7eSJung-uk KimThe default number of tickets is 2. Following a resumption the number of tickets 31b2bf0c7eSJung-uk Kimissued will never be more than 1 regardless of the value set via 32b2bf0c7eSJung-uk KimSSL_set_num_tickets() or SSL_CTX_set_num_tickets(). If B<num_tickets> is set to 33b2bf0c7eSJung-uk Kim0 then no tickets will be issued for either a normal connection or a resumption. 34e71b7053SJung-uk Kim 35e71b7053SJung-uk KimTickets are also issued on receipt of a post-handshake certificate from the 36e71b7053SJung-uk Kimclient following a request by the server using 37e71b7053SJung-uk KimL<SSL_verify_client_post_handshake(3)>. These new tickets will be associated 38e71b7053SJung-uk Kimwith the updated client identity (i.e. including their certificate and 39e71b7053SJung-uk Kimverification status). The number of tickets issued will normally be the same as 40e71b7053SJung-uk Kimwas used for the initial handshake. If the initial handshake was a full 41e71b7053SJung-uk Kimhandshake then SSL_set_num_tickets() can be called again prior to calling 42e71b7053SJung-uk KimSSL_verify_client_post_handshake() to update the number of tickets that will be 43e71b7053SJung-uk Kimsent. 44e71b7053SJung-uk Kim 45*b077aed3SPierre ProncheryTo issue tickets after other events (such as application-layer changes), 46*b077aed3SPierre ProncherySSL_new_session_ticket() is used by a server application to request that a new 47*b077aed3SPierre Proncheryticket be sent when it is safe to do so. New tickets are only allowed to be 48*b077aed3SPierre Proncherysent in this manner after the initial handshake has completed, and only for 49*b077aed3SPierre ProncheryTLS 1.3 connections. By default, the ticket generation and transmission are 50*b077aed3SPierre Proncherydelayed until the server is starting a new write operation, so that it is 51*b077aed3SPierre Proncherybundled with other application data being written and properly aligned to a 52*b077aed3SPierre Proncheryrecord boundary. If the connection was at a record boundary when 53*b077aed3SPierre ProncherySSL_new_session_ticket() was called, the ticket can be sent immediately 54*b077aed3SPierre Pronchery(without waiting for the next application write) by calling 55*b077aed3SPierre ProncherySSL_do_handshake(). SSL_new_session_ticket() can be called more than once to 56*b077aed3SPierre Proncheryrequest additional tickets be sent; all such requests are queued and written 57*b077aed3SPierre Proncherytogether when it is safe to do so and triggered by SSL_write() or 58*b077aed3SPierre ProncherySSL_do_handshake(). Note that a successful return from 59*b077aed3SPierre ProncherySSL_new_session_ticket() indicates only that the request to send a ticket was 60*b077aed3SPierre Proncheryprocessed, not that the ticket itself was sent. To be notified when the 61*b077aed3SPierre Proncheryticket itself is sent, a new-session callback can be registered with 62*b077aed3SPierre ProncheryL<SSL_CTX_sess_set_new_cb(3)> that will be invoked as the ticket or tickets 63*b077aed3SPierre Proncheryare generated. 64*b077aed3SPierre Pronchery 65e71b7053SJung-uk KimSSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of 66e71b7053SJung-uk Kimtickets set by a previous call to SSL_CTX_set_num_tickets() or 67e71b7053SJung-uk KimSSL_set_num_tickets(), or 2 if no such call has been made. 68e71b7053SJung-uk Kim 69e71b7053SJung-uk Kim=head1 RETURN VALUES 70e71b7053SJung-uk Kim 71*b077aed3SPierre ProncherySSL_CTX_set_num_tickets(), SSL_set_num_tickets(), and 72*b077aed3SPierre ProncherySSL_new_session_ticket() return 1 on success or 0 on failure. 73e71b7053SJung-uk Kim 74e71b7053SJung-uk KimSSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets 75e71b7053SJung-uk Kimthat have been previously set. 76e71b7053SJung-uk Kim 77*b077aed3SPierre Pronchery=head1 SEE ALSO 78*b077aed3SPierre Pronchery 79*b077aed3SPierre ProncheryL<ssl(7)> 80*b077aed3SPierre Pronchery 81e71b7053SJung-uk Kim=head1 HISTORY 82e71b7053SJung-uk Kim 83*b077aed3SPierre ProncherySSL_new_session_ticket() was added in OpenSSL 3.0.0. 84*b077aed3SPierre ProncherySSL_set_num_tickets(), SSL_get_num_tickets(), SSL_CTX_set_num_tickets(), and 85*b077aed3SPierre ProncherySSL_CTX_get_num_tickets() were added in OpenSSL 1.1.1. 86e71b7053SJung-uk Kim 87e71b7053SJung-uk Kim=head1 COPYRIGHT 88e71b7053SJung-uk Kim 89b2bf0c7eSJung-uk KimCopyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. 90e71b7053SJung-uk Kim 91*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 92e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 93e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 94e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 95e71b7053SJung-uk Kim 96e71b7053SJung-uk Kim=cut 97