1SSL_CTX_SET_STATELESS_COOKIE_GENERATSEOS_pLCe_BnC(ST3SX)L_SET_STATELESS_COOKIE_GENERATE_CB(3)
2
3
4
6 SSL_CTX_set_stateless_cookie_generate_cb,
7 SSL_CTX_set_stateless_cookie_verify_cb, SSL_CTX_set_cookie_generate_cb,
8 SSL_CTX_set_cookie_verify_cb - Callback functions for stateless TLS1.3
9 cookies
10
12 #include <openssl/ssl.h>
13
14 void SSL_CTX_set_stateless_cookie_generate_cb(
15 SSL_CTX *ctx,
16 int (*gen_stateless_cookie_cb) (SSL *ssl,
17 unsigned char *cookie,
18 size_t *cookie_len));
19 void SSL_CTX_set_stateless_cookie_verify_cb(
20 SSL_CTX *ctx,
21 int (*verify_stateless_cookie_cb) (SSL *ssl,
22 const unsigned char *cookie,
23 size_t cookie_len));
24
25 void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
26 int (*app_gen_cookie_cb) (SSL *ssl,
27 unsigned char
28 *cookie,
29 unsigned int
30 *cookie_len));
31 void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
32 int (*app_verify_cookie_cb) (SSL *ssl,
33 const unsigned
34 char *cookie,
35 unsigned int
36 cookie_len));
37
39 SSL_CTX_set_stateless_cookie_generate_cb() sets the callback used by
40 SSL_stateless(3) to generate the application-controlled portion of the
41 cookie provided to clients in the HelloRetryRequest transmitted as a
42 response to a ClientHello with a missing or invalid cookie.
43 gen_stateless_cookie_cb() must write at most SSL_COOKIE_LENGTH bytes
44 into cookie, and must write the number of bytes written to cookie_len.
45 If a cookie cannot be generated, a zero return value can be used to
46 abort the handshake.
47
48 SSL_CTX_set_stateless_cookie_verify_cb() sets the callback used by
49 SSL_stateless(3) to determine whether the application-controlled
50 portion of a ClientHello cookie is valid. The cookie data is pointed to
51 by cookie and is of length cookie_len. A nonzero return value from
52 verify_stateless_cookie_cb() communicates that the cookie is valid. The
53 integrity of the entire cookie, including the application-controlled
54 portion, is automatically verified by HMAC before
55 verify_stateless_cookie_cb() is called.
56
57 SSL_CTX_set_cookie_generate_cb() sets the callback used by
58 DTLSv1_listen(3) to generate the cookie provided to clients in the
59 HelloVerifyRequest transmitted as a response to a ClientHello with a
60 missing or invalid cookie. app_gen_cookie_cb() must write at most
61 DTLS1_COOKIE_LENGTH bytes into cookie, and must write the number of
62 bytes written to cookie_len. If a cookie cannot be generated, a zero
63 return value can be used to abort the handshake.
64
65 SSL_CTX_set_cookie_verify_cb() sets the callback used by
66 DTLSv1_listen(3) to determine whether the cookie in a ClientHello is
67 valid. The cookie data is pointed to by cookie and is of length
68 cookie_len. A nonzero return value from app_verify_cookie_cb()
69 communicates that the cookie is valid. The integrity of the cookie is
70 not verified by OpenSSL. This is an application responsibility.
71
73 Neither function returns a value.
74
76 SSL_stateless(3), DTLSv1_listen(3)
77
79 SSL_CTX_set_stateless_cookie_generate_cb() and
80 SSL_CTX_set_stateless_cookie_verify_cb() were added in OpenSSL 1.1.1.
81
83 Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
84
85 Licensed under the OpenSSL license (the "License"). You may not use
86 this file except in compliance with the License. You can obtain a copy
87 in the file LICENSE in the source distribution or at
88 <https://www.openssl.org/source/license.html>.
89
90
91
921.1.1i 20S2S1L-_0C7T-X2_2SET_STATELESS_COOKIE_GENERATE_CB(3)