Debian Codegraph @

upstream/debian-unstable/man3/SSL_new.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "SSL_NEW 3SSL"
58 .TH SSL_NEW 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 SSL_dup, SSL_new, SSL_up_ref \- create an SSL structure for a connection
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& #include <openssl/ssl.h>
69 \&
70 \& SSL *SSL_dup(SSL *s);
71 \& SSL *SSL_new(SSL_CTX *ctx);
72 \& int SSL_up_ref(SSL *s);
73 .Ve
74 .SH DESCRIPTION
75 .IX Header "DESCRIPTION"
76 \&\fBSSL_new()\fR creates a new \fBSSL\fR structure which is needed to hold the
77 data for a TLS/SSL connection. The new structure inherits the settings
78 of the underlying context \fBctx\fR: connection method,
79 options, verification settings, timeout settings. An \fBSSL\fR structure is
80 reference counted. Creating an \fBSSL\fR structure for the first time increments
81 the reference count. Freeing it (using SSL_free) decrements it. When the
82 reference count drops to zero, any memory or resources allocated to the \fBSSL\fR
83 structure are freed.
84 .PP
85 \&\fBSSL_up_ref()\fR increments the reference count for an
86 existing \fBSSL\fR structure.
87 .PP
88 The function \fBSSL_dup()\fR creates and returns a new \fBSSL\fR structure from the same
89 \&\fBSSL_CTX\fR that was used to create \fIs\fR. It additionally duplicates a subset of
90 the settings in \fIs\fR into the new \fBSSL\fR object.
91 .PP
92 For \fBSSL_dup()\fR to work, the connection MUST be in its initial state and
93 MUST NOT have yet started the SSL handshake. For connections that are not in
94 their initial state \fBSSL_dup()\fR just increments an internal
95 reference count and returns the \fIsame\fR handle. It may be possible to
96 use \fBSSL_clear\fR\|(3) to recycle an SSL handle that is not in its initial
97 state for reuse, but this is best avoided. Instead, save and restore
98 the session, if desired, and construct a fresh handle for each connection.
99 .PP
100 The subset of settings in \fIs\fR that are duplicated are:
101 .IP "any session data if configured (including the session_id_context)" 4
102 .IX Item "any session data if configured (including the session_id_context)"
103 .PD 0
104 .IP "any tmp_dh settings set via \fBSSL_set_tmp_dh\fR\|(3), \fBSSL_set_tmp_dh_callback\fR\|(3), or \fBSSL_set_dh_auto\fR\|(3)" 4
105 .IX Item "any tmp_dh settings set via SSL_set_tmp_dh, SSL_set_tmp_dh_callback, or SSL_set_dh_auto"
106 .IP "any configured certificates, private keys or certificate chains" 4
107 .IX Item "any configured certificates, private keys or certificate chains"
108 .IP "any configured signature algorithms, or client signature algorithms" 4
109 .IX Item "any configured signature algorithms, or client signature algorithms"
110 .IP "any DANE settings" 4
111 .IX Item "any DANE settings"
112 .IP "any Options set via \fBSSL_set_options\fR\|(3)" 4
113 .IX Item "any Options set via SSL_set_options"
114 .IP "any Mode set via \fBSSL_set_mode\fR\|(3)" 4
115 .IX Item "any Mode set via SSL_set_mode"
116 .IP "any minimum or maximum protocol settings set via \fBSSL_set_min_proto_version\fR\|(3) or \fBSSL_set_max_proto_version\fR\|(3) (Note: Only from OpenSSL 1.1.1h and above)" 4
117 .IX Item "any minimum or maximum protocol settings set via SSL_set_min_proto_version or SSL_set_max_proto_version (Note: Only from OpenSSL 1.1.1h and above)"
118 .IP "any verify mode, callback or depth set via \fBSSL_set_verify\fR\|(3) or \fBSSL_set_verify_depth\fR\|(3) or any configured X509 verification parameters" 4
119 .IX Item "any verify mode, callback or depth set via SSL_set_verify or SSL_set_verify_depth or any configured X509 verification parameters"
120 .IP "any msg callback or info callback set via \fBSSL_set_msg_callback\fR\|(3) or \fBSSL_set_info_callback\fR\|(3)" 4
121 .IX Item "any msg callback or info callback set via SSL_set_msg_callback or SSL_set_info_callback"
122 .IP "any default password callback set via \fBSSL_set_default_passwd_cb\fR\|(3)" 4
123 .IX Item "any default password callback set via SSL_set_default_passwd_cb"
124 .IP "any session id generation callback set via \fBSSL_set_generate_session_id\fR\|(3)" 4
125 .IX Item "any session id generation callback set via SSL_set_generate_session_id"
126 .IP "any configured Cipher List" 4
127 .IX Item "any configured Cipher List"
128 .IP "initial accept (server) or connect (client) state" 4
129 .IX Item "initial accept (server) or connect (client) state"
130 .IP "the max cert list value set via \fBSSL_set_max_cert_list\fR\|(3)" 4
131 .IX Item "the max cert list value set via SSL_set_max_cert_list"
132 .IP "the read_ahead value set via \fBSSL_set_read_ahead\fR\|(3)" 4
133 .IX Item "the read_ahead value set via SSL_set_read_ahead"
134 .IP "application specific data set via \fBSSL_set_ex_data\fR\|(3)" 4
135 .IX Item "application specific data set via SSL_set_ex_data"
136 .IP "any CA list or client CA list set via \fBSSL_set0_CA_list\fR\|(3), \fBSSL_set0_client_CA_list()\fR or similar functions" 4
137 .IX Item "any CA list or client CA list set via SSL_set0_CA_list, SSL_set0_client_CA_list() or similar functions"
138 .IP "any security level settings or callbacks" 4
139 .IX Item "any security level settings or callbacks"
140 .IP "any configured serverinfo data" 4
141 .IX Item "any configured serverinfo data"
142 .IP "any configured PSK identity hint" 4
143 .IX Item "any configured PSK identity hint"
144 .IP "any configured custom extensions" 4
145 .IX Item "any configured custom extensions"
146 .IP "any client certificate types configured via SSL_set1_client_certificate_types" 4
147 .IX Item "any client certificate types configured via SSL_set1_client_certificate_types"
148 .PD
149 .PP
150 \&\fBSSL_dup()\fR is not supported on QUIC SSL objects and returns NULL if called on
151 such an object.
152 .SH "RETURN VALUES"
153 .IX Header "RETURN VALUES"
154 The following return values can occur:
155 .IP NULL 4
156 .IX Item "NULL"
157 The creation of a new SSL structure failed. Check the error stack to
158 find out the reason.
159 .IP "Pointer to an SSL structure" 4
160 .IX Item "Pointer to an SSL structure"
161 The return value points to an allocated SSL structure.
162 .Sp
163 \&\fBSSL_up_ref()\fR returns 1 for success and 0 for failure.
164 .SH "SEE ALSO"
165 .IX Header "SEE ALSO"
166 \&\fBSSL_free\fR\|(3), \fBSSL_clear\fR\|(3),
167 \&\fBSSL_CTX_set_options\fR\|(3),
168 \&\fBSSL_get_SSL_CTX\fR\|(3),
169 \&\fBssl\fR\|(7)
170 .SH COPYRIGHT
171 .IX Header "COPYRIGHT"
172 Copyright 2000\-2023 The OpenSSL Project Authors. All Rights Reserved.
173 .PP
174 Licensed under the Apache License 2.0 (the "License"). You may not use
175 this file except in compliance with the License. You can obtain a copy
176 in the file LICENSE in the source distribution or at
177 <https://www.openssl.org/source/license.html>.