1=pod 2 3=begin comment 4 5Copyright 2005 Nokia. All rights reserved. 6 7The portions of the attached software ("Contribution") is developed by 8Nokia Corporation and is licensed pursuant to the OpenSSL open source 9license. 10 11The Contribution, originally written by Mika Kousa and Pasi Eronen of 12Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites 13support (see RFC 4279) to OpenSSL. 14 15No patent licenses or other rights except those expressly stated in 16the OpenSSL open source license shall be deemed granted or received 17expressly, by implication, estoppel, or otherwise. 18 19No assurances are provided by Nokia that the Contribution does not 20infringe the patent or other intellectual property rights of any third 21party or that the license provides you with all the necessary rights 22to make use of the Contribution. 23 24THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN 25ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA 26SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY 27OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR 28OTHERWISE. 29 30=end comment 31 32=head1 NAME 33 34SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK client callback 35 36=head1 SYNOPSIS 37 38 #include <openssl/ssl.h> 39 40 void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, 41 unsigned int (*callback)(SSL *ssl, const char *hint, 42 char *identity, unsigned int max_identity_len, 43 unsigned char *psk, unsigned int max_psk_len)); 44 void SSL_set_psk_client_callback(SSL *ssl, 45 unsigned int (*callback)(SSL *ssl, const char *hint, 46 char *identity, unsigned int max_identity_len, 47 unsigned char *psk, unsigned int max_psk_len)); 48 49 50=head1 DESCRIPTION 51 52A client application must provide a callback function which is called 53when the client is sending the ClientKeyExchange message to the server. 54 55The purpose of the callback function is to select the PSK identity and 56the pre-shared key to use during the connection setup phase. 57 58The callback is set using functions SSL_CTX_set_psk_client_callback() 59or SSL_set_psk_client_callback(). The callback function is given the 60connection in parameter B<ssl>, a B<NULL>-terminated PSK identity hint 61sent by the server in parameter B<hint>, a buffer B<identity> of 62length B<max_identity_len> bytes where the the resulting 63B<NULL>-terminated identity is to be stored, and a buffer B<psk> of 64length B<max_psk_len> bytes where the resulting pre-shared key is to 65be stored. 66 67=head1 NOTES 68 69Note that parameter B<hint> given to the callback may be B<NULL>. 70 71=head1 RETURN VALUES 72 73Return values from the client callback are interpreted as follows: 74 75On success (callback found a PSK identity and a pre-shared key to use) 76the length (> 0) of B<psk> in bytes is returned. 77 78Otherwise or on errors callback should return 0. In this case 79the connection setup fails. 80 81=cut 82