130 lines
5.0 KiB
HTML
Executable File
130 lines
5.0 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_connect</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_connect - initiate the TLS/SSL handshake with an TLS/SSL server</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
|
<pre>
|
|
#include <openssl/ssl.h></pre>
|
|
<pre>
|
|
int SSL_connect(SSL *ssl);</pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p><code>SSL_connect()</code> initiates the TLS/SSL handshake with a server. The communication
|
|
channel must already have been set and assigned to the <strong>ssl</strong> by setting an
|
|
underlying <strong>BIO</strong>.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="notes">NOTES</a></h1>
|
|
<p>The behaviour of <code>SSL_connect()</code> depends on the underlying BIO.</p>
|
|
<p>If the underlying BIO is <strong>blocking</strong>, <code>SSL_connect()</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_connect()</code> will also return
|
|
when the underlying BIO could not satisfy the needs of <code>SSL_connect()</code>
|
|
to continue the handshake, indicating the problem by the return value -1.
|
|
In this case a call to <code>SSL_get_error()</code> with the
|
|
return value of <code>SSL_connect()</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_connect()</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>Many systems implement Nagle's algorithm by default which means that it will
|
|
buffer outgoing TCP data if a TCP packet has already been sent for which no
|
|
corresponding ACK has been received yet from the peer. This can have performance
|
|
impacts after a successful TLSv1.3 handshake or a successful TLSv1.2 (or below)
|
|
resumption handshake, because the last peer to communicate in the handshake is
|
|
the client. If the client is also the first to send application data (as is
|
|
typical for many protocols) then this data could be buffered until an ACK has
|
|
been received for the final handshake message.</p>
|
|
<p>The <strong>TCP_NODELAY</strong> socket option is often available to disable Nagle's
|
|
algorithm. If an application opts to disable Nagle's algorithm consideration
|
|
should be given to turning it back on again later if appropriate. The helper
|
|
function <code>BIO_set_tcp_ndelay()</code> can be used to turn on or off the <strong>TCP_NODELAY</strong>
|
|
option.</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"><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_accept(3)</em>,
|
|
<em>SSL_shutdown(3)</em>, <em>ssl(7)</em>, <em>bio(7)</em>,
|
|
<em>SSL_set_connect_state(3)</em>,
|
|
<em>SSL_do_handshake(3)</em>,
|
|
<em>SSL_CTX_new(3)</em></p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
|
<p>Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.</p>
|
|
<p>Licensed under the Apache License 2.0 (the "License"). 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>
|