xref: /freebsd/crypto/openssl/doc/man3/SSL_CTX_set_ssl_version.pod (revision 401ab69cff8fa2320a9f8ea4baa114a6da6c952b)
1=pod
2
3=head1 NAME
4
5SSL_CTX_set_ssl_version, SSL_CTX_get_ssl_method, SSL_set_ssl_method, SSL_get_ssl_method
6- choose a new TLS/SSL method
7
8=head1 SYNOPSIS
9
10 #include <openssl/ssl.h>
11
12 int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
13 const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);
14
15 int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
16 const SSL_METHOD *SSL_get_ssl_method(const SSL *ssl);
17
18=head1 DESCRIPTION
19
20SSL_CTX_set_ssl_version() sets a new default TLS/SSL B<method> for SSL objects
21newly created from this B<ctx>.  Most of the configuration attached to the
22SSL_CTX object is retained, with the exception of the configured TLS ciphers,
23which are reset to the default values.  SSL objects already created from this
24SSL_CTX with L<SSL_new(3)> are not affected, except when L<SSL_clear(3)> is
25being called, as described below.
26
27SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the
28SSL_CTX.
29
30SSL_set_ssl_method() sets a new TLS/SSL B<method> for a particular B<ssl>
31object. It may be reset, when SSL_clear() is called.
32
33SSL_get_ssl_method() returns a pointer to the TLS/SSL method
34set in B<ssl>.
35
36=head1 NOTES
37
38The available B<method> choices are described in
39L<SSL_CTX_new(3)>.
40
41When L<SSL_clear(3)> is called and no session is connected to
42an SSL object, the method of the SSL object is reset to the method currently
43set in the corresponding SSL_CTX object.
44
45SSL_CTX_set_version() has unusual semantics and no clear use case;
46it would usually be preferable to create a new SSL_CTX object than to
47try to reuse an existing one in this fashion.  Its usage is considered
48deprecated.
49
50=head1 RETURN VALUES
51
52The following return values can occur for SSL_CTX_set_ssl_version()
53and SSL_set_ssl_method():
54
55=over 4
56
57=item Z<>0
58
59The new choice failed, check the error stack to find out the reason.
60
61=item Z<>1
62
63The operation succeeded.
64
65=back
66
67SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL
68pointers.
69
70=head1 SEE ALSO
71
72L<SSL_CTX_new(3)>, L<SSL_new(3)>,
73L<SSL_clear(3)>, L<ssl(7)>,
74L<SSL_set_connect_state(3)>
75
76=head1 HISTORY
77
78SSL_CTX_set_ssl_version() was deprecated in OpenSSL 3.0.
79
80=head1 COPYRIGHT
81
82Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
83
84Licensed under the Apache License 2.0 (the "License").  You may not use
85this file except in compliance with the License.  You can obtain a copy
86in the file LICENSE in the source distribution or at
87L<https://www.openssl.org/source/license.html>.
88
89=cut
90