---
name: "libressl-SSL_CTX_set_ssl_version"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SSL_CTX_set_ssl_version"
---

# libressl-SSL\_CTX\_set\_ssl\_version(3)

choose a new TLS/SSL method

## NAME

**SSL\_CTX\_set\_ssl\_version**, **SSL\_set\_ssl\_method**, **SSL\_CTX\_get\_ssl\_method**, **SSL\_get\_ssl\_method** – choose a new TLS/SSL method

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#include \<openssl/ssl.h\>**

*int*\

**SSL\_CTX\_set\_ssl\_version**(*SSL\_CTX \*ctx*, *const SSL\_METHOD \*method*);

*int*\

**SSL\_set\_ssl\_method**(*SSL \*s*, *const SSL\_METHOD \*method*);

*const* *SSL\_METHOD* *\**\

**SSL\_CTX\_get\_ssl\_method**(*SSL\_CTX \*ctx*);

*const* *SSL\_METHOD* *\**\

**SSL\_get\_ssl\_method**(*SSL \*ssl*);

## DESCRIPTION

**SSL\_CTX\_set\_ssl\_version**() sets a new default TLS/SSL *method* for *SSL* objects newly created from this *ctx*. *SSL* objects already created with SSL\_new(3) are not affected, except when SSL\_clear(3) is called.

**SSL\_set\_ssl\_method**() sets a new TLS/SSL *method* for a particular *SSL* object *s*. It may be reset when SSL\_clear(3) is called.

**SSL\_CTX\_get\_ssl\_method**() and **SSL\_get\_ssl\_method**() return a function pointer to the TLS/SSL method set in *ctx* and *ssl*, respectively.

The available *method* choices are described in SSL\_CTX\_new(3).

When SSL\_clear(3) is called and no session is connected to an *SSL* object, the method of the *SSL* object is reset to the method currently set in the corresponding *SSL\_CTX* object.

## RETURN VALUES

The following return values can occur for **SSL\_CTX\_set\_ssl\_version**() and **SSL\_set\_ssl\_method**():

- 0

  The new choice failed. Check the error stack to find out the reason.

- 1

  The operation succeeded.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_clear(3), SSL\_CTX\_new(3), SSL\_new(3), SSL\_set\_connect\_state(3)

## HISTORY

**SSL\_CTX\_set\_ssl\_version**(), **SSL\_set\_ssl\_method**(), and **SSL\_get\_ssl\_method**() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4. **SSL\_CTX\_get\_ssl\_method**() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 7.0.
