1SSL_CTX_set_psk_client_callback(3) OpenSSL SSL_CTX_set_psk_client_callback(3)
2
3
4
6 SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK
7 client callback
8
10 #include <openssl/ssl.h>
11
12 void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
13 unsigned int (*callback)(SSL *ssl, const char *hint,
14 char *identity, unsigned int max_identity_len,
15 unsigned char *psk, unsigned int max_psk_len));
16 void SSL_set_psk_client_callback(SSL *ssl,
17 unsigned int (*callback)(SSL *ssl, const char *hint,
18 char *identity, unsigned int max_identity_len,
19 unsigned char *psk, unsigned int max_psk_len));
20
22 A client application must provide a callback function which is called
23 when the client is sending the ClientKeyExchange message to the server.
24
25 The purpose of the callback function is to select the PSK identity and
26 the pre-shared key to use during the connection setup phase.
27
28 The callback is set using functions SSL_CTX_set_psk_client_callback()
29 or SSL_set_psk_client_callback(). The callback function is given the
30 connection in parameter ssl, a NULL-terminated PSK identity hint sent
31 by the server in parameter hint, a buffer identity of length
32 max_identity_len bytes where the the resulting NULL-terminated identity
33 is to be stored, and a buffer psk of length max_psk_len bytes where the
34 resulting pre-shared key is to be stored.
35
37 Note that parameter hint given to the callback may be NULL.
38
40 Return values from the client callback are interpreted as follows:
41
42 On success (callback found a PSK identity and a pre-shared key to use)
43 the length (> 0) of psk in bytes is returned.
44
45 Otherwise or on errors callback should return 0. In this case the
46 connection setup fails.
47
48
49
501.0.2o 2019-09-10SSL_CTX_set_psk_client_callback(3)