]>
Commit | Line | Data |
---|---|---|
ddac1974 NL |
1 | =pod |
2 | ||
ddac1974 NL |
3 | =head1 NAME |
4 | ||
5 | SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK client callback | |
6 | ||
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/ssl.h> | |
10 | ||
11 | void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, | |
e9b77246 BB |
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)); | |
ddac1974 | 15 | void SSL_set_psk_client_callback(SSL *ssl, |
e9b77246 BB |
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)); | |
ddac1974 NL |
19 | |
20 | ||
21 | =head1 DESCRIPTION | |
22 | ||
23 | A client application must provide a callback function which is called | |
24 | when the client is sending the ClientKeyExchange message to the server. | |
25 | ||
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. | |
28 | ||
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 | |
b9b6a7e5 | 33 | length B<max_identity_len> bytes where the resulting |
ddac1974 NL |
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 | |
36 | be stored. | |
37 | ||
38 | =head1 NOTES | |
39 | ||
40 | Note that parameter B<hint> given to the callback may be B<NULL>. | |
41 | ||
42 | =head1 RETURN VALUES | |
43 | ||
44 | Return values from the client callback are interpreted as follows: | |
45 | ||
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. | |
48 | ||
49 | Otherwise or on errors callback should return 0. In this case | |
50 | the connection setup fails. | |
51 | ||
e2f92610 RS |
52 | =head1 COPYRIGHT |
53 | ||
54 | Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. | |
55 | ||
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>. | |
60 | ||
e2f92610 | 61 | =cut |