---
name: "libressl-SSL_get_shared_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_shared_ciphers"
---

# libressl-SSL\_get\_shared\_ciphers(3)

ciphers supported by both client and server

## NAME

**SSL\_get\_shared\_ciphers** – ciphers supported by both client and server

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

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

*char* *\**\

**SSL\_get\_shared\_ciphers**(*const SSL \*ssl*, *char \*buf*, *int len*);

## DESCRIPTION

If *ssl* contains a session in server mode, **SSL\_get\_shared\_ciphers**() puts as many names of ciphers that are supported by both the client and the server into the buffer *buf* as the buffer is long enough to contain. Names are separated by colons. At most *len* bytes are written to *buf* including the terminating NUL character.

## RETURN VALUES

**SSL\_get\_shared\_ciphers**() returns *buf* on success or NULL on failure. The following situations cause failure:

- SSL\_is\_server(3) is false, i.e., *ssl* is not set to server mode.

- SSL\_get\_ciphers(3) is NULL or empty, i.e., no ciphers are available for use by the server.

- SSL\_get\_session(3) is NULL, i.e., *ssl* contains no session.

- SSL\_get\_client\_ciphers(3) is NULL or empty, i.e., *ssl* contains no information about ciphers supported by the client, or the client does not support any ciphers.

- The *len* argument is less than 2.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_get\_ciphers(3)

## HISTORY

**SSL\_get\_shared\_ciphers**() first appeared in SSLeay 0.4.5b and has been available since OpenBSD 2.4.

## BUGS

If the list is too long to fit into *len* bytes, it is silently truncated after the last cipher name that fits, and all following ciphers are skipped. If the buffer is very short such that even the first cipher name does not fit, an empty string is returned even when some shared ciphers are actually available.

There is no easy way to find out how much space is required for *buf* or whether the supplied space was sufficient.
