2020-03-02 16:50:34 +00:00

116 lines
4.3 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_new</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="#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_dup, SSL_new, SSL_up_ref - create an SSL structure for a connection</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;openssl/ssl.h&gt;</pre>
<pre>
SSL *SSL_dup(SSL *s);
SSL *SSL_new(SSL_CTX *ctx);
int SSL_up_ref(SSL *s);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><code>SSL_new()</code> creates a new <strong>SSL</strong> structure which is needed to hold the
data for a TLS/SSL connection. The new structure inherits the settings
of the underlying context <strong>ctx</strong>: connection method,
options, verification settings, timeout settings. An <strong>SSL</strong> structure is
reference counted. Creating an <strong>SSL</strong> structure for the first time increments
the reference count. Freeing it (using SSL_free) decrements it. When the
reference count drops to zero, any memory or resources allocated to the <strong>SSL</strong>
structure are freed.</p>
<p><code>SSL_up_ref()</code> increments the reference count for an
existing <strong>SSL</strong> structure.</p>
<p><code>SSL_dup()</code> duplicates an existing <strong>SSL</strong> structure into a new allocated one
or just increments the reference count if the connection is active. All
settings are inherited from the original <strong>SSL</strong> structure. Dynamic data (i.e.
existing connection details) are not copied, the new <strong>SSL</strong> is set into an
initial accept (server) or connect (client) state.</p>
<p><code>SSL_dup()</code> allows applications to configure an SSL handle for use in multiple
SSL connections, and then duplicate it prior to initiating each connection
with the duplicated handle. Use of <code>SSL_dup()</code> avoids the need to repeat
the configuration of the handles for each connection.</p>
<p>For <code>SSL_dup()</code> to work, the connection MUST be in its initial state and
MUST NOT have not yet have started the SSL handshake. For connections
that are not in their initial state <code>SSL_dup()</code> just increments an internal
reference count and returns the <em>same</em> handle. It may be possible to
use <em>SSL_clear(3)</em> to recycle an SSL handle that is not in its initial
state for re-use, but this is best avoided. Instead, save and restore
the session, if desired, and construct a fresh handle for each connection.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p>The following return values can occur:</p>
<dl>
<dt><strong><a name="null" class="item">NULL</a></strong></dt>
<dd>
<p>The creation of a new SSL structure failed. Check the error stack to
find out the reason.</p>
</dd>
<dt><strong><a name="pointer_to_an_ssl_structure" class="item">Pointer to an SSL structure</a></strong></dt>
<dd>
<p>The return value points to an allocated SSL structure.</p>
<p><code>SSL_up_ref()</code> returns 1 for success and 0 for failure.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>SSL_free(3)</em>, <em>SSL_clear(3)</em>,
<em>SSL_CTX_set_options(3)</em>,
<em>SSL_get_SSL_CTX(3)</em>,
<em>ssl(7)</em></p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2000-2017 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>