1.\" $OpenBSD: SSL_CTX_set_ssl_version.3,v 1.5 2021/05/11 19:48:56 tb Exp $ 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 3.\" 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. 5.\" Copyright (c) 2000, 2001, 2005 The OpenSSL Project. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in 16.\" the documentation and/or other materials provided with the 17.\" distribution. 18.\" 19.\" 3. All advertising materials mentioning features or use of this 20.\" software must display the following acknowledgment: 21.\" "This product includes software developed by the OpenSSL Project 22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 23.\" 24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 25.\" endorse or promote products derived from this software without 26.\" prior written permission. For written permission, please contact 27.\" openssl-core@openssl.org. 28.\" 29.\" 5. Products derived from this software may not be called "OpenSSL" 30.\" nor may "OpenSSL" appear in their names without prior written 31.\" permission of the OpenSSL Project. 32.\" 33.\" 6. Redistributions of any form whatsoever must retain the following 34.\" acknowledgment: 35.\" "This product includes software developed by the OpenSSL Project 36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 37.\" 38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" 51.Dd $Mdocdate: May 11 2021 $ 52.Dt SSL_CTX_SET_SSL_VERSION 3 53.Os 54.Sh NAME 55.Nm SSL_CTX_set_ssl_version , 56.Nm SSL_set_ssl_method , 57.Nm SSL_CTX_get_ssl_method , 58.Nm SSL_get_ssl_method 59.Nd choose a new TLS/SSL method 60.Sh SYNOPSIS 61.In openssl/ssl.h 62.Ft int 63.Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" 64.Ft int 65.Fn SSL_set_ssl_method "SSL *s" "const SSL_METHOD *method" 66.Ft const SSL_METHOD * 67.Fn SSL_CTX_get_ssl_method "SSL_CTX *ctx" 68.Ft const SSL_METHOD * 69.Fn SSL_get_ssl_method "SSL *ssl" 70.Sh DESCRIPTION 71.Fn SSL_CTX_set_ssl_version 72sets a new default TLS/SSL 73.Fa method 74for 75.Vt SSL 76objects newly created from this 77.Fa ctx . 78.Vt SSL 79objects already created with 80.Xr SSL_new 3 81are not affected, except when 82.Xr SSL_clear 3 83is called. 84.Pp 85.Fn SSL_set_ssl_method 86sets a new TLS/SSL 87.Fa method 88for a particular 89.Vt SSL 90object 91.Fa s . 92It may be reset when 93.Xr SSL_clear 3 94is called. 95.Pp 96.Fn SSL_CTX_get_ssl_method 97and 98.Fn SSL_get_ssl_method 99return a function pointer to the TLS/SSL method set in 100.Fa ctx 101and 102.Fa ssl , 103respectively. 104.Pp 105The available 106.Fa method 107choices are described in 108.Xr SSL_CTX_new 3 . 109.Pp 110When 111.Xr SSL_clear 3 112is called and no session is connected to an 113.Vt SSL 114object, the method of the 115.Vt SSL 116object is reset to the method currently set in the corresponding 117.Vt SSL_CTX 118object. 119.Sh RETURN VALUES 120The following return values can occur for 121.Fn SSL_CTX_set_ssl_version 122and 123.Fn SSL_set_ssl_method : 124.Bl -tag -width Ds 125.It 0 126The new choice failed. 127Check the error stack to find out the reason. 128.It 1 129The operation succeeded. 130.El 131.Sh SEE ALSO 132.Xr ssl 3 , 133.Xr SSL_clear 3 , 134.Xr SSL_CTX_new 3 , 135.Xr SSL_new 3 , 136.Xr SSL_set_connect_state 3 137.Sh HISTORY 138.Fn SSL_CTX_set_ssl_version , 139.Fn SSL_set_ssl_method , 140and 141.Fn SSL_get_ssl_method 142first appeared in SSLeay 0.8.0 and have been available since 143.Ox 2.4 . 144.Fn SSL_CTX_get_ssl_method 145first appeared in OpenSSL 1.1.0 and has been available since 146.Ox 7.0 . 147