---
name: "libressl-SSL_get_ciphers"
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_get_ciphers"
---

# libressl-SSL\_get\_ciphers(3)

get lists of available SSL\_CIPHERs

## NAME

**SSL\_get\_ciphers**, **SSL\_CTX\_get\_ciphers**, **SSL\_get1\_supported\_ciphers**, **SSL\_get\_client\_ciphers**, **SSL\_get\_cipher\_list** – get lists of available SSL\_CIPHERs

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

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

*STACK\_OF(SSL\_CIPHER)* *\**\

**SSL\_get\_ciphers**(*const SSL \*ssl*);

*STACK\_OF(SSL\_CIPHER)* *\**\

**SSL\_CTX\_get\_ciphers**(*const SSL\_CTX \*ctx*);

*STACK\_OF(SSL\_CIPHER)* *\**\

**SSL\_get1\_supported\_ciphers**(*SSL \*ssl*);

*STACK\_OF(SSL\_CIPHER)* *\**\

**SSL\_get\_client\_ciphers**(*const SSL \*ssl*);

*const* *char* *\**\

**SSL\_get\_cipher\_list**(*const SSL \*ssl*, *int priority*);

## DESCRIPTION

**SSL\_get\_ciphers**() returns the stack of available *SSL\_CIPHER*s for *ssl*, sorted by preference.

**SSL\_CTX\_get\_ciphers**() returns the stack of available *SSL\_CIPHER*s for *ctx*.

**SSL\_get1\_supported\_ciphers**() returns a stack of enabled *SSL\_CIPHER*s for *ssl* as it would be sent in a ClientHello, sorted by preference. The list depends on settings like the cipher list, the supported protocol versions, the security level, and the enabled signature algorithms. The list of ciphers that would be sent in a ClientHello can differ from the list of ciphers that would be acceptable when acting as a server. For example, additional ciphers may be usable by a server if there is a gap in the list of supported protocols, and some ciphers may not be usable by a server if there is not a suitable certificate configured.

**SSL\_get\_client\_ciphers**() returns the stack of available *SSL\_CIPHER*s matching the list received from the client on *ssl*.

The details of the ciphers obtained by **SSL\_get\_ciphers**(), **SSL\_CTX\_get\_ciphers**(), **SSL\_get1\_supported\_ciphers**(), and **SSL\_get\_client\_ciphers**() can be obtained using the SSL\_CIPHER\_get\_name(3) family of functions.

**SSL\_get\_cipher\_list**() is deprecated — use **SSL\_get\_ciphers**() instead — and badly misnamed; it does not return a list but the name of one element of the return value of **SSL\_get\_ciphers**(), with the index given by the *priority* argument. Passing 0 selects the cipher with the highest priority. To iterate over all available ciphers in decreasing priority, repeatedly increment the argument by 1 until NULL is returned.

## RETURN VALUES

**SSL\_get\_ciphers**() returns an internal pointer to a list of ciphers or NULL if *ssl* is NULL or if no ciphers are available. The returned pointer may not only become invalid when *ssl* is destroyed or when SSL\_set\_cipher\_list(3) is called on it, but also when the *SSL\_CTX* object in use by *ssl* at the time of the call is freed or when SSL\_CTX\_set\_cipher\_list(3) is called on that context object.

**SSL\_CTX\_get\_ciphers**() returns an internal pointer to a list of ciphers or NULL if *ctx* is NULL or if no ciphers are available. The returned pointer becomes invalid when *ctx* is destroyed or when SSL\_CTX\_set\_cipher\_list(3) is called on it.

**SSL\_get1\_supported\_ciphers**() returns a newly allocated list of ciphers or NULL if *ssl* is NULL, if no ciphers are available, or if an error occurs. When the returned pointer is no longer needed, the caller is responsible for freeing it using **sk\_SSL\_CIPHER\_free**().

**SSL\_get\_client\_ciphers**() returns an internal pointer to a list of ciphers or NULL if *ssl* is NULL, has no active session, or is not operating in server mode. The returned pointer becomes invalid when the *SSL\_SESSION* object is destroyed, even if the *ssl* object remains valid. It may also become invalid in other circumstances, for example when processing a new ClientHello.

**SSL\_get\_cipher\_list**() returns an internal pointer to a string or NULL if *ssl* is NULL, if no ciphers are available, or if *priority* is greater than or equal to the number of available ciphers.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_CIPHER\_get\_name(3), SSL\_CTX\_set\_cipher\_list(3)

## HISTORY

**SSL\_get\_cipher\_list**() first appeared in SSLeay 0.5.2. **SSL\_get\_ciphers**() first appeared in SSLeay 0.8.0. Both functions have been available since OpenBSD 2.4.

**SSL\_CTX\_get\_ciphers**() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3.

**SSL\_get1\_supported\_ciphers**() and **SSL\_get\_client\_ciphers**() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.5.
