SSL_CTX_set_num_tickets.pod 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. =pod
  2. =head1 NAME
  3. SSL_set_num_tickets,
  4. SSL_get_num_tickets,
  5. SSL_CTX_set_num_tickets,
  6. SSL_CTX_get_num_tickets,
  7. SSL_new_session_ticket
  8. - control the number of TLSv1.3 session tickets that are issued
  9. =head1 SYNOPSIS
  10. #include <openssl/ssl.h>
  11. int SSL_set_num_tickets(SSL *s, size_t num_tickets);
  12. size_t SSL_get_num_tickets(const SSL *s);
  13. int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);
  14. size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);
  15. int SSL_new_session_ticket(SSL *s);
  16. =head1 DESCRIPTION
  17. SSL_CTX_set_num_tickets() and SSL_set_num_tickets() can be called for a server
  18. application and set the number of TLSv1.3 session tickets that will be sent to
  19. the client after a full handshake. Set the desired value (which could be 0) in
  20. the B<num_tickets> argument. Typically these functions should be called before
  21. the start of the handshake.
  22. The default number of tickets is 2. Following a resumption the number of tickets
  23. issued will never be more than 1 regardless of the value set via
  24. SSL_set_num_tickets() or SSL_CTX_set_num_tickets(). If B<num_tickets> is set to
  25. 0 then no tickets will be issued for either a normal connection or a resumption.
  26. Tickets are also issued on receipt of a post-handshake certificate from the
  27. client following a request by the server using
  28. L<SSL_verify_client_post_handshake(3)>. These new tickets will be associated
  29. with the updated client identity (i.e. including their certificate and
  30. verification status). The number of tickets issued will normally be the same as
  31. was used for the initial handshake. If the initial handshake was a full
  32. handshake then SSL_set_num_tickets() can be called again prior to calling
  33. SSL_verify_client_post_handshake() to update the number of tickets that will be
  34. sent.
  35. To issue tickets after other events (such as application-layer changes),
  36. SSL_new_session_ticket() is used by a server application to request that a new
  37. ticket be sent when it is safe to do so. New tickets are only allowed to be
  38. sent in this manner after the initial handshake has completed, and only for
  39. TLS 1.3 connections. By default, the ticket generation and transmission are
  40. delayed until the server is starting a new write operation, so that it is
  41. bundled with other application data being written and properly aligned to a
  42. record boundary. If the connection was at a record boundary when
  43. SSL_new_session_ticket() was called, the ticket can be sent immediately
  44. (without waiting for the next application write) by calling
  45. SSL_do_handshake(). SSL_new_session_ticket() can be called more than once to
  46. request additional tickets be sent; all such requests are queued and written
  47. together when it is safe to do so and triggered by SSL_write() or
  48. SSL_do_handshake(). Note that a successful return from
  49. SSL_new_session_ticket() indicates only that the request to send a ticket was
  50. processed, not that the ticket itself was sent. To be notified when the
  51. ticket itself is sent, a new-session callback can be registered with
  52. L<SSL_CTX_sess_set_new_cb(3)> that will be invoked as the ticket or tickets
  53. are generated.
  54. SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of
  55. tickets set by a previous call to SSL_CTX_set_num_tickets() or
  56. SSL_set_num_tickets(), or 2 if no such call has been made.
  57. =head1 RETURN VALUES
  58. SSL_CTX_set_num_tickets(), SSL_set_num_tickets(), and
  59. SSL_new_session_ticket() return 1 on success or 0 on failure.
  60. SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets
  61. that have been previously set.
  62. =head1 SEE ALSO
  63. L<ssl(7)>
  64. =head1 HISTORY
  65. SSL_new_session_ticket() was added in OpenSSL 3.0.0.
  66. SSL_set_num_tickets(), SSL_get_num_tickets(), SSL_CTX_set_num_tickets(), and
  67. SSL_CTX_get_num_tickets() were added in OpenSSL 1.1.1.
  68. =head1 COPYRIGHT
  69. Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
  70. Licensed under the Apache License 2.0 (the "License"). You may not use
  71. this file except in compliance with the License. You can obtain a copy
  72. in the file LICENSE in the source distribution or at
  73. L<https://www.openssl.org/source/license.html>.
  74. =cut