SSL_CTX_set_psk_client_callback.pod 2.8 KB

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