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