5 SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK client callback
9 #include <openssl/ssl.h>
11 void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
12 unsigned int (*callback)(SSL *ssl, const char *hint,
13 char *identity, unsigned int max_identity_len,
14 unsigned char *psk, unsigned int max_psk_len));
15 void SSL_set_psk_client_callback(SSL *ssl,
16 unsigned int (*callback)(SSL *ssl, const char *hint,
17 char *identity, unsigned int max_identity_len,
18 unsigned char *psk, unsigned int max_psk_len));
23 A client application must provide a callback function which is called
24 when the client is sending the ClientKeyExchange message to the server.
26 The purpose of the callback function is to select the PSK identity and
27 the pre-shared key to use during the connection setup phase.
29 The callback is set using functions SSL_CTX_set_psk_client_callback()
30 or SSL_set_psk_client_callback(). The callback function is given the
31 connection in parameter B<ssl>, a B<NULL>-terminated PSK identity hint
32 sent by the server in parameter B<hint>, a buffer B<identity> of
33 length B<max_identity_len> bytes where the resulting
34 B<NULL>-terminated identity is to be stored, and a buffer B<psk> of
35 length B<max_psk_len> bytes where the resulting pre-shared key is to
40 Note that parameter B<hint> given to the callback may be B<NULL>.
44 Return values from the client callback are interpreted as follows:
46 On success (callback found a PSK identity and a pre-shared key to use)
47 the length (> 0) of B<psk> in bytes is returned.
49 Otherwise or on errors callback should return 0. In this case
50 the connection setup fails.
54 Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
56 Licensed under the OpenSSL license (the "License"). You may not use
57 this file except in compliance with the License. You can obtain a copy
58 in the file LICENSE in the source distribution or at
59 L<https://www.openssl.org/source/license.html>.