config root man

Current Path : /usr/opt/openssl11/share/doc/openssl/html/man3/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/openssl11/share/doc/openssl/html/man3/SSL_set_tlsext_host_name.html

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SSL_CTX_set_tlsext_servername_callback</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@hsxx.drive.ne.jp" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#notes">NOTES</a></li>
	<li><a href="#return_values">RETURN VALUES</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#history">HISTORY</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>SSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg,
SSL_get_servername_type, SSL_get_servername,
SSL_set_tlsext_host_name - handle server name indication (SNI)</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
 #include &lt;openssl/ssl.h&gt;</pre>
<pre>
 long SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,
                                   int (*cb)(SSL *s, int *al, void *arg));
 long SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);</pre>
<pre>
 const char *SSL_get_servername(const SSL *s, const int type);
 int SSL_get_servername_type(const SSL *s);</pre>
<pre>
 int SSL_set_tlsext_host_name(const SSL *s, const char *name);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The functionality provided by the servername callback is mostly superseded by
the ClientHello callback, which can be set using <code>SSL_CTX_set_client_hello_cb()</code>.
However, even where the ClientHello callback is used, the servername callback is
still necessary in order to acknowledge the servername requested by the client.</p>
<p><code>SSL_CTX_set_tlsext_servername_callback()</code> sets the application callback <strong>cb</strong>
used by a server to perform any actions or configuration required based on
the servername extension received in the incoming connection. When <strong>cb</strong>
is NULL, SNI is not used.</p>
<p>The servername callback should return one of the following values:</p>
<dl>
<dt><strong><a name="ssl_tlsext_err_ok" class="item">SSL_TLSEXT_ERR_OK</a></strong></dt>

<dd>
<p>This is used to indicate that the servername requested by the client has been
accepted. Typically a server will call <code>SSL_set_SSL_CTX()</code> in the callback to set
up a different configuration for the selected servername in this case.</p>
</dd>
<dt><strong><a name="ssl_tlsext_err_alert_fatal" class="item">SSL_TLSEXT_ERR_ALERT_FATAL</a></strong></dt>

<dd>
<p>In this case the servername requested by the client is not accepted and the
handshake will be aborted. The value of the alert to be used should be stored in
the location pointed to by the <strong>al</strong> parameter to the callback. By default this
value is initialised to SSL_AD_UNRECOGNIZED_NAME.</p>
</dd>
<dt><strong><a name="ssl_tlsext_err_alert_warning" class="item">SSL_TLSEXT_ERR_ALERT_WARNING</a></strong></dt>

<dd>
<p>If this value is returned then the servername is not accepted by the server.
However, the handshake will continue and send a warning alert instead. The value
of the alert should be stored in the location pointed to by the <strong>al</strong> parameter
as for SSL_TLSEXT_ERR_ALERT_FATAL above. Note that TLSv1.3 does not support
warning alerts, so if TLSv1.3 has been negotiated then this return value is
treated the same way as SSL_TLSEXT_ERR_NOACK.</p>
</dd>
<dt><strong><a name="ssl_tlsext_err_noack" class="item">SSL_TLSEXT_ERR_NOACK</a></strong></dt>

<dd>
<p>This return value indicates that the servername is not accepted by the server.
No alerts are sent and the server will not acknowledge the requested servername.</p>
</dd>
</dl>
<p><code>SSL_CTX_set_tlsext_servername_arg()</code> sets a context-specific argument to be
passed into the callback (via the <strong>arg</strong> parameter) for this <strong>SSL_CTX</strong>.</p>
<p>The behaviour of <code>SSL_get_servername()</code> depends on a number of different factors.
In particular note that in TLSv1.3 the servername is negotiated in every
handshake. In TLSv1.2 the servername is only negotiated on initial handshakes
and not on resumption handshakes.</p>
<dl>
<dt><strong><a name="on_the_client_before_the_handshake" class="item">On the client, before the handshake</a></strong></dt>

<dd>
<p>If a servername has been set via a call to <code>SSL_set_tlsext_host_name()</code> then it
will return that servername.</p>
<p>If one has not been set, but a TLSv1.2 resumption is being attempted and the
session from the original handshake had a servername accepted by the server then
it will return that servername.</p>
<p>Otherwise it returns NULL.</p>
</dd>
<dt><strong><a name="2" class="item">On the client, during or after the handshake and a TLSv1.2 (or below)
resumption occurred</a></strong></dt>

<dd>
<p>If the session from the original handshake had a servername accepted by the
server then it will return that servername.</p>
<p>Otherwise it returns the servername set via <code>SSL_set_tlsext_host_name()</code> or NULL
if it was not called.</p>
</dd>
<dt><strong>On the client, during or after the handshake and a TLSv1.2 (or below)
resumption did not occur</strong></dt>

<dd>
<p>It will return the servername set via <code>SSL_set_tlsext_host_name()</code> or NULL if it
was not called.</p>
</dd>
<dt><strong><a name="on_the_server_before_the_handshake" class="item">On the server, before the handshake</a></strong></dt>

<dd>
<p>The function will always return NULL before the handshake</p>
</dd>
<dt><strong>On the server, after the servername extension has been processed and a
TLSv1.2 (or below) resumption occurred</strong></dt>

<dd>
<p>If a servername was accepted by the server in the original handshake then it
will return that servername, or NULL otherwise.</p>
</dd>
<dt><strong>On the server, after the servername extension has been processed and a
TLSv1.2 (or below) resumption did not occur</strong></dt>

<dd>
<p>The function will return the servername requested by the client in this
handshake or NULL if none was requested.</p>
</dd>
</dl>
<p>Note that the ClientHello callback occurs before a servername extension from the
client is processed. The servername, certificate and ALPN callbacks occur after
a servername extension from the client is processed.</p>
<p><code>SSL_get_servername_type()</code> returns the servername type or -1 if no servername
is present. Currently the only supported type (defined in <a href="http://www.ietf.org/rfc/rfc3546.txt" class="rfc">RFC3546</a>) is
<strong>TLSEXT_NAMETYPE_host_name</strong>.</p>
<p><code>SSL_set_tlsext_host_name()</code> sets the server name indication ClientHello extension
to contain the value <strong>name</strong>. The type of server name indication extension is set
to <strong>TLSEXT_NAMETYPE_host_name</strong> (defined in <a href="http://www.ietf.org/rfc/rfc3546.txt" class="rfc">RFC3546</a>).</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>Several callbacks are executed during ClientHello processing, including
the ClientHello, ALPN, and servername callbacks.  The ClientHello callback is
executed first, then the servername callback, followed by the ALPN callback.</p>
<p>The <code>SSL_set_tlsext_host_name()</code> function should only be called on SSL objects
that will act as clients; otherwise the configured <strong>name</strong> will be ignored.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p><code>SSL_CTX_set_tlsext_servername_callback()</code> and
<code>SSL_CTX_set_tlsext_servername_arg()</code> both always return 1 indicating success.
<code>SSL_set_tlsext_host_name()</code> returns 1 on success, 0 in case of error.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>ssl(7)</em>, <em>SSL_CTX_set_alpn_select_cb(3)</em>,
<em>SSL_get0_alpn_selected(3)</em>, <em>SSL_CTX_set_client_hello_cb(3)</em></p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p><code>SSL_get_servername()</code> historically provided some unexpected results in certain
corner cases. This has been fixed from OpenSSL 1.1.1e.</p>
<p>Prior to 1.1.1e, when the client requested a servername in an initial TLSv1.2
handshake, the server accepted it, and then the client successfully resumed but
set a different explicit servername in the second handshake then when called by
the client it returned the servername from the second handshake. This has now
been changed to return the servername requested in the original handshake.</p>
<p>Also prior to 1.1.1e, if the client sent a servername in the first handshake but
the server did not accept it, and then a second handshake occurred where TLSv1.2
resumption was successful then when called by the server it returned the
servername requested in the original handshake. This has now been changed to
NULL.</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the OpenSSL license (the &quot;License&quot;).  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>

</body>

</html>

Man Man