openssl-prebuild/linux_amd64/ssl/share/doc/openssl/html/man3/SSL_do_handshake.html

116 lines
4.1 KiB
HTML
Executable File

<?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_do_handshake</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</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="#copyright">COPYRIGHT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>SSL_do_handshake - perform a TLS/SSL handshake</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;openssl/ssl.h&gt;</pre>
<pre>
int SSL_do_handshake(SSL *ssl);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><code>SSL_do_handshake()</code> will wait for a SSL/TLS handshake to take place. If the
connection is in client mode, the handshake will be started. The handshake
routines may have to be explicitly set in advance using either
<em>SSL_set_connect_state(3)</em> or
<em>SSL_set_accept_state(3)</em>.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>The behaviour of <code>SSL_do_handshake()</code> depends on the underlying BIO.</p>
<p>If the underlying BIO is <strong>blocking</strong>, <code>SSL_do_handshake()</code> will only return
once the handshake has been finished or an error occurred.</p>
<p>If the underlying BIO is <strong>non-blocking</strong>, <code>SSL_do_handshake()</code> will also return
when the underlying BIO could not satisfy the needs of <code>SSL_do_handshake()</code>
to continue the handshake. In this case a call to <code>SSL_get_error()</code> with the
return value of <code>SSL_do_handshake()</code> will yield <strong>SSL_ERROR_WANT_READ</strong> or
<strong>SSL_ERROR_WANT_WRITE</strong>. The calling process then must repeat the call after
taking appropriate action to satisfy the needs of <code>SSL_do_handshake()</code>.
The action depends on the underlying BIO. When using a non-blocking socket,
nothing is to be done, but <code>select()</code> can be used to check for the required
condition. When using a buffering BIO, like a BIO pair, data must be written
into or retrieved out of the BIO before being able to continue.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p>The following return values can occur:</p>
<ol>
<li>
<p>The TLS/SSL handshake was not successful but was shut down controlled and
by the specifications of the TLS/SSL protocol. Call <code>SSL_get_error()</code> with the
return value <strong>ret</strong> to find out the reason.</p>
</li>
<li>
<p>The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
established.</p>
</dd>
<dt><strong><a name="_0" class="item">&lt;0</a></strong></dt>
<dd>
<p>The TLS/SSL handshake was not successful because a fatal error occurred either
at the protocol level or a connection failure occurred. The shutdown was
not clean. It can also occur of action is need to continue the operation
for non-blocking BIOs. Call <code>SSL_get_error()</code> with the return value <strong>ret</strong>
to find out the reason.</p>
</li>
</ol>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>SSL_get_error(3)</em>, <em>SSL_connect(3)</em>,
<em>SSL_accept(3)</em>, <em>ssl(7)</em>, <em>bio(7)</em>,
<em>SSL_set_connect_state(3)</em></p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the Apache License 2.0 (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>