1SSL_CTX_USE_PSK_IDENTITY_HINT(3)    OpenSSL   SSL_CTX_USE_PSK_IDENTITY_HINT(3)
2
3
4

NAME

6       SSL_psk_server_cb_func, SSL_psk_find_session_cb_func,
7       SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint,
8       SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback,
9       SSL_CTX_set_psk_find_session_callback,
10       SSL_set_psk_find_session_callback - set PSK identity hint to use
11

SYNOPSIS

13        #include <openssl/ssl.h>
14
15        typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl,
16                                                    const unsigned char *identity,
17                                                    size_t identity_len,
18                                                    SSL_SESSION **sess);
19
20
21        void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx,
22                                                   SSL_psk_find_session_cb_func cb);
23        void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb);
24
25        typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl,
26                                                       const char *identity,
27                                                       unsigned char *psk,
28                                                       unsigned int max_psk_len);
29
30        int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
31        int SSL_use_psk_identity_hint(SSL *ssl, const char *hint);
32
33        void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb);
34        void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb);
35

DESCRIPTION

37       A server application wishing to use TLSv1.3 PSKs should set a callback
38       using either SSL_CTX_set_psk_find_session_callback() or
39       SSL_set_psk_find_session_callback() as appropriate.
40
41       The callback function is given a pointer to the SSL connection in ssl
42       and an identity in identity of length identity_len. The callback
43       function should identify an SSL_SESSION object that provides the PSK
44       details and store it in *sess. The SSL_SESSION object should, as a
45       minimum, set the master key, the ciphersuite and the protocol version.
46       See SSL_CTX_set_psk_use_session_callback(3) for details.
47
48       It is also possible for the callback to succeed but not supply a PSK.
49       In this case no PSK will be used but the handshake will continue. To do
50       this the callback should return successfully and ensure that *sess is
51       NULL.
52
53       Identity hints are not relevant for TLSv1.3. A server application
54       wishing to use PSK ciphersuites for TLSv1.2 and below may call
55       SSL_CTX_use_psk_identity_hint() to set the given NUL-terminated PSK
56       identity hint hint for SSL context object ctx.
57       SSL_use_psk_identity_hint() sets the given NUL-terminated PSK identity
58       hint hint for the SSL connection object ssl. If hint is NULL the
59       current hint from ctx or ssl is deleted.
60
61       In the case where PSK identity hint is NULL, the server does not send
62       the ServerKeyExchange message to the client.
63
64       A server application wishing to use PSKs for TLSv1.2 and below must
65       provide a callback function which is called when the server receives
66       the ClientKeyExchange message from the client. The purpose of the
67       callback function is to validate the received PSK identity and to fetch
68       the pre-shared key used during the connection setup phase. The callback
69       is set using the functions SSL_CTX_set_psk_server_callback() or
70       SSL_set_psk_server_callback(). The callback function is given the
71       connection in parameter ssl, NUL-terminated PSK identity sent by the
72       client in parameter identity, and a buffer psk of length max_psk_len
73       bytes where the pre-shared key is to be stored.
74
75       The callback for use in TLSv1.2 will also work in TLSv1.3 although it
76       is recommended to use SSL_CTX_set_psk_find_session_callback() or
77       SSL_set_psk_find_session_callback() for this purpose instead. If
78       TLSv1.3 has been negotiated then OpenSSL will first check to see if a
79       callback has been set via SSL_CTX_set_psk_find_session_callback() or
80       SSL_set_psk_find_session_callback() and it will use that in preference.
81       If no such callback is present then it will check to see if a callback
82       has been set via SSL_CTX_set_psk_server_callback() or
83       SSL_set_psk_server_callback() and use that. In this case the handshake
84       digest will default to SHA-256 for any returned PSK.
85

NOTES

87       A connection established via a TLSv1.3 PSK will appear as if session
88       resumption has occurred so that SSL_session_reused(3) will return true.
89

RETURN VALUES

91       SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return
92       1 on success, 0 otherwise.
93
94       Return values from the TLSv1.2 and below server callback are
95       interpreted as follows:
96
97       0   PSK identity was not found. An "unknown_psk_identity" alert message
98           will be sent and the connection setup fails.
99
100       >0  PSK identity was found and the server callback has provided the PSK
101           successfully in parameter psk. Return value is the length of psk in
102           bytes. It is an error to return a value greater than max_psk_len.
103
104           If the PSK identity was not found but the callback instructs the
105           protocol to continue anyway, the callback must provide some random
106           data to psk and return the length of the random data, so the
107           connection will fail with decryption_error before it will be
108           finished completely.
109
110       The SSL_psk_find_session_cb_func callback should return 1 on success or
111       0 on failure. In the event of failure the connection setup fails.
112

NOTES

114       There are no known security issues with sharing the same PSK between
115       TLSv1.2 (or below) and TLSv1.3. However the RFC has this note of
116       caution:
117
118       "While there is no known way in which the same PSK might produce
119       related output in both versions, only limited analysis has been done.
120       Implementations can ensure safety from cross-protocol related output by
121       not reusing PSKs between TLS 1.3 and TLS 1.2."
122

SEE ALSO

124       SSL_CTX_set_psk_use_session_callback(3),
125       SSL_set_psk_use_session_callback(3)
126

HISTORY

128       SSL_CTX_set_psk_find_session_callback() and
129       SSL_set_psk_find_session_callback() were added in OpenSSL 1.1.1.
130
132       Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
133
134       Licensed under the OpenSSL license (the "License").  You may not use
135       this file except in compliance with the License.  You can obtain a copy
136       in the file LICENSE in the source distribution or at
137       <https://www.openssl.org/source/license.html>.
138
139
140
1411.1.1g                            2020-04-23  SSL_CTX_USE_PSK_IDENTITY_HINT(3)
Impressum