| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "SSL_CTX_SET_STATELESS_COOKIE_GENERATE_CB 3SSL" |
| 58 |
.TH SSL_CTX_SET_STATELESS_COOKIE_GENERATE_CB 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
SSL_CTX_set_stateless_cookie_generate_cb, |
| 65 |
SSL_CTX_set_stateless_cookie_verify_cb, |
| 66 |
SSL_CTX_set_cookie_generate_cb, |
| 67 |
SSL_CTX_set_cookie_verify_cb |
| 68 |
\&\- Callback functions for stateless TLS1.3 cookies |
| 69 |
.SH SYNOPSIS |
| 70 |
.IX Header "SYNOPSIS" |
| 71 |
.Vb 1 |
| 72 |
\& #include <openssl/ssl.h> |
| 73 |
\& |
| 74 |
\& void SSL_CTX_set_stateless_cookie_generate_cb( |
| 75 |
\& SSL_CTX *ctx, |
| 76 |
\& int (*gen_stateless_cookie_cb) (SSL *ssl, |
| 77 |
\& unsigned char *cookie, |
| 78 |
\& size_t *cookie_len)); |
| 79 |
\& void SSL_CTX_set_stateless_cookie_verify_cb( |
| 80 |
\& SSL_CTX *ctx, |
| 81 |
\& int (*verify_stateless_cookie_cb) (SSL *ssl, |
| 82 |
\& const unsigned char *cookie, |
| 83 |
\& size_t cookie_len)); |
| 84 |
\& |
| 85 |
\& void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, |
| 86 |
\& int (*app_gen_cookie_cb) (SSL *ssl, |
| 87 |
\& unsigned char |
| 88 |
\& *cookie, |
| 89 |
\& unsigned int |
| 90 |
\& *cookie_len)); |
| 91 |
\& void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, |
| 92 |
\& int (*app_verify_cookie_cb) (SSL *ssl, |
| 93 |
\& const unsigned |
| 94 |
\& char *cookie, |
| 95 |
\& unsigned int |
| 96 |
\& cookie_len)); |
| 97 |
.Ve |
| 98 |
.SH DESCRIPTION |
| 99 |
.IX Header "DESCRIPTION" |
| 100 |
\&\fBSSL_CTX_set_stateless_cookie_generate_cb()\fR sets the callback used by |
| 101 |
\&\fBSSL_stateless\fR\|(3) to generate the application-controlled portion of the cookie |
| 102 |
provided to clients in the HelloRetryRequest transmitted as a response to a |
| 103 |
ClientHello with a missing or invalid cookie. \fBgen_stateless_cookie_cb()\fR must |
| 104 |
write at most SSL_COOKIE_LENGTH bytes into \fBcookie\fR, and must write the number |
| 105 |
of bytes written to \fBcookie_len\fR. If a cookie cannot be generated, a zero |
| 106 |
return value can be used to abort the handshake. |
| 107 |
.PP |
| 108 |
\&\fBSSL_CTX_set_stateless_cookie_verify_cb()\fR sets the callback used by |
| 109 |
\&\fBSSL_stateless\fR\|(3) to determine whether the application-controlled portion of a |
| 110 |
ClientHello cookie is valid. The cookie data is pointed to by \fBcookie\fR and is of |
| 111 |
length \fBcookie_len\fR. A nonzero return value from \fBverify_stateless_cookie_cb()\fR |
| 112 |
communicates that the cookie is valid. The integrity of the entire cookie, |
| 113 |
including the application-controlled portion, is automatically verified by HMAC |
| 114 |
before \fBverify_stateless_cookie_cb()\fR is called. |
| 115 |
.PP |
| 116 |
\&\fBSSL_CTX_set_cookie_generate_cb()\fR sets the callback used by \fBDTLSv1_listen\fR\|(3) |
| 117 |
to generate the cookie provided to clients in the HelloVerifyRequest transmitted |
| 118 |
as a response to a ClientHello with a missing or invalid cookie. |
| 119 |
\&\fBapp_gen_cookie_cb()\fR must write at most DTLS1_COOKIE_LENGTH bytes into |
| 120 |
\&\fBcookie\fR, and must write the number of bytes written to \fBcookie_len\fR. If a |
| 121 |
cookie cannot be generated, a zero return value can be used to abort the |
| 122 |
handshake. |
| 123 |
.PP |
| 124 |
\&\fBSSL_CTX_set_cookie_verify_cb()\fR sets the callback used by \fBDTLSv1_listen\fR\|(3) to |
| 125 |
determine whether the cookie in a ClientHello is valid. The cookie data is |
| 126 |
pointed to by \fBcookie\fR and is of length \fBcookie_len\fR. A nonzero return value |
| 127 |
from \fBapp_verify_cookie_cb()\fR communicates that the cookie is valid. The |
| 128 |
integrity of the cookie is not verified by OpenSSL. This is an application |
| 129 |
responsibility. |
| 130 |
.SH "RETURN VALUES" |
| 131 |
.IX Header "RETURN VALUES" |
| 132 |
Neither function returns a value. |
| 133 |
.SH "SEE ALSO" |
| 134 |
.IX Header "SEE ALSO" |
| 135 |
\&\fBssl\fR\|(7), |
| 136 |
\&\fBSSL_stateless\fR\|(3), |
| 137 |
\&\fBDTLSv1_listen\fR\|(3) |
| 138 |
.SH HISTORY |
| 139 |
.IX Header "HISTORY" |
| 140 |
\&\fBSSL_CTX_set_stateless_cookie_generate_cb()\fR and |
| 141 |
\&\fBSSL_CTX_set_stateless_cookie_verify_cb()\fR were added in OpenSSL 1.1.1. |
| 142 |
.SH COPYRIGHT |
| 143 |
.IX Header "COPYRIGHT" |
| 144 |
Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. |
| 145 |
.PP |
| 146 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 147 |
this file except in compliance with the License. You can obtain a copy |
| 148 |
in the file LICENSE in the source distribution or at |
| 149 |
<https://www.openssl.org/source/license.html>. |