SSL_CTX_set_tlsext_servername_callback.pod 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg,
  4. SSL_get_servername_type, SSL_get_servername,
  5. SSL_set_tlsext_host_name - handle server name indication (SNI)
  6. =head1 SYNOPSIS
  7. #include <openssl/ssl.h>
  8. long SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,
  9. int (*cb)(SSL *, int *, void *));
  10. long SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);
  11. const char *SSL_get_servername(const SSL *s, const int type);
  12. int SSL_get_servername_type(const SSL *s);
  13. int SSL_set_tlsext_host_name(const SSL *s, const char *name);
  14. =head1 DESCRIPTION
  15. The functionality provided by the servername callback is superseded by the
  16. ClientHello callback, which can be set using SSL_CTX_set_client_hello_cb().
  17. The servername callback is retained for historical compatibility.
  18. SSL_CTX_set_tlsext_servername_callback() sets the application callback B<cb>
  19. used by a server to perform any actions or configuration required based on
  20. the servername extension received in the incoming connection. When B<cb>
  21. is NULL, SNI is not used. The B<arg> value is a pointer which is passed to
  22. the application callback.
  23. SSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to be
  24. passed into the callback for this B<SSL_CTX>.
  25. SSL_get_servername() returns a servername extension value of the specified
  26. type if provided in the Client Hello or NULL.
  27. SSL_get_servername_type() returns the servername type or -1 if no servername
  28. is present. Currently the only supported type (defined in RFC3546) is
  29. B<TLSEXT_NAMETYPE_host_name>.
  30. SSL_set_tlsext_host_name() sets the server name indication ClientHello extension
  31. to contain the value B<name>. The type of server name indication extension is set
  32. to B<TLSEXT_NAMETYPE_host_name> (defined in RFC3546).
  33. =head1 NOTES
  34. Several callbacks are executed during ClientHello processing, including
  35. the ClientHello, ALPN, and servername callbacks. The ClientHello callback is
  36. executed first, then the servername callback, followed by the ALPN callback.
  37. The SSL_set_tlsext_host_name() function should only be called on SSL objects
  38. that will act as clients; otherwise the configured B<name> will be ignored.
  39. =head1 RETURN VALUES
  40. SSL_CTX_set_tlsext_servername_callback() and
  41. SSL_CTX_set_tlsext_servername_arg() both always return 1 indicating success.
  42. SSL_set_tlsext_host_name() returns 1 on success, 0 in case of error.
  43. =head1 SEE ALSO
  44. L<ssl(7)>, L<SSL_CTX_set_alpn_select_cb(3)>,
  45. L<SSL_get0_alpn_selected(3)>, L<SSL_CTX_set_client_hello_cb(3)>
  46. =head1 COPYRIGHT
  47. Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
  48. Licensed under the OpenSSL license (the "License"). You may not use
  49. this file except in compliance with the License. You can obtain a copy
  50. in the file LICENSE in the source distribution or at
  51. L<https://www.openssl.org/source/license.html>.
  52. =cut