OpenBSD manual page server

Manual Page Search Parameters

SSL_CTX_SET_CIPHER_LIST(3) Library Functions Manual SSL_CTX_SET_CIPHER_LIST(3)

SSL_CTX_set_cipher_list, SSL_set_cipher_listchoose list of available SSL_CIPHERs

#include <openssl/ssl.h>

int
SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *control);

int
SSL_set_cipher_list(SSL *ssl, const char *control);

() sets the list of available cipher suites for ctx using the control string. The list of cipher suites is inherited by all ssl objects created from ctx.

() sets the list of cipher suites only for ssl.

The control string consists of one or more control words separated by colon characters (‘:’). Space (‘ ’), semicolon (‘;’), and comma (‘,’) characters can also be used as separators. Each control words selects a set of cipher suites and can take one of the following optional prefix characters:

No prefix:
Those of the selected cipher suites that have not been made available yet are added to the end of the list of available cipher suites, preserving their order.
Prefixed minus sign (‘-’):
Those of the selected cipher suites that have been made available earlier are moved back from the list of available cipher suites to the beginning of the list of unavailable cipher suites, also preserving their order.
Prefixed plus sign (‘+’):
Those of the selected cipher suites have been made available earlier are moved to end of the list of available cipher suites, reducing their priority, but preserving the order among themselves.
Prefixed exclamation mark (‘!’):
The selected cipher suites are permanently deleted, no matter whether they had earlier been made available or not, and can no longer be added or re-added by later words.

The following special words can only be used without a prefix:

An alias for ALL:!aNULL:!eNULL. It can only be used as the first word. The DEFAULT cipher list can be displayed with the openssl(1) ciphers command.
Set the security level to n, which should be a number between zero and five. See SSL_CTX_set_security_level(3) for details.
Sort the list by decreasing encryption strength, preserving the order of cipher suites that have the same strength. It is usually given as the last word.

The following words can be used to select groups of cipher suites, with or without a prefix character. If two or more of these words are joined with plus signs (‘+’) to form a longer word, only the intersection of the specified sets is selected.

Cipher suites using ephemeral DH for key exchange without doing any server authentication. Equivalent to DH+aNULL.
Cipher suites using Authenticated Encryption with Additional Data.
Cipher suites using ephemeral ECDH for key exchange without doing any server authentication. Equivalent to ECDH+aNULL.
Cipher suites using ECDSA server authentication.
Cipher suites using AES or AESGCM for symmetric encryption.
Cipher suites using AES(128) or AESGCM(128) for symmetric encryption.
Cipher suites using AES(256) or AESGCM(256) for symmetric encryption.
Cipher suites using AESGCM for symmetric encryption.
An alias for aGOST01.
Cipher suites using GOST R 34.10-2001 server authentication.
All cipher suites except those selected by eNULL.
Cipher suites that don't do any server authentication. Not enabled by DEFAULT. Beware of man-in-the-middle attacks.
Cipher suites using RSA server authentication.
Cipher suites using Camellia for symmetric encryption.
Cipher suites using Camellia(128) for symmetric encryption.
Cipher suites using Camellia(256) for symmetric encryption.
Cipher suites using ChaCha20-Poly1305 for symmetric encryption.
Cipher suites that are not included in ALL. Currently an alias for eNULL.
Cipher suites that are included in ALL, but not included in DEFAULT. Currently similar to aNULL:!eNULL except for the order of the cipher suites which are not selected.
Cipher suites using triple DES for symmetric encryption.
Cipher suites using ephemeral DH for key exchange.
Cipher suites using ephemeral DH for key exchange, but excluding those that don't do any server authentication. Similar to DH:!aNULL except for the order of the cipher suites which are not selected.
Cipher suites using ephemeral ECDH for key exchange.
Cipher suites using ephemeral ECDH for key exchange, but excluding those that don't do any server authentication. Similar to ECDH:!aNULL except for the order of the cipher suites which are not selected.
An alias for aECDSA.
Cipher suites that do not use any encryption. Not enabled by DEFAULT, and not even included in ALL.
Cipher suites using GOST 28147-89 for message authentication instead of HMAC.
Cipher suites using HMAC based on GOST R 34.11-94 for message authentication.
Cipher suites of high strength.
Cipher suites using VKO 34.10 key exchange, specified in RFC 4357.
Cipher suites using RSA key exchange.
Cipher suites of low strength.
Cipher suites using MD5 for message authentication.
Cipher suites of medium strength.
An alias for eNULL.
Cipher suites using RC4 for symmetric encryption.
Cipher suites using RSA for both key exchange and server authentication. Equivalent to kRSA+aRSA.
An alias for SHA1.
Cipher suites using SHA1 for message authentication.
Cipher suites using SHA256 for message authentication.
Cipher suites using SHA384 for message authentication.
An alias for TLSv1.
Cipher suites using STREEBOG256 for message authentication.
Cipher suites usable with the TLSv1.0, TLSv1.1, and TLSv1.2 protocols.
Cipher suites for the TLSv1.2 protocol.
Cipher suites for the TLSv1.3 protocol. If the control string selects at least one cipher suite but neither contains the word TLSv1.3 nor specifically includes nor excludes any TLSv1.3 cipher suites, all the TLSv1.3 cipher suites are made available, too.

The full words returned by the openssl(1) ciphers command can be used to select individual cipher suites.

The following words do not match anything because LibreSSL no longer provides any such cipher suites:

Cipher suites using single DES for symmetric encryption.
Cipher suites using DSS server authentication.
Cipher suites using IDEA for symmetric encryption.

The following are deprecated aliases:

avoid: use:

Unknown words are silently ignored, selecting no cipher suites. Failure is only flagged if the control string contains invalid bytes or if no matching cipher suites are available at all.

On the client side, including a cipher suite into the list of available cipher suites is sufficient for using it. On the server side, all cipher suites have additional requirements. ADH ciphers don't need a certificate, but DH-parameters must have been set. All other cipher suites need a corresponding certificate and key.

A RSA cipher can only be chosen when an RSA certificate is available. RSA ciphers using DHE need a certificate and key and additional DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

A DSA cipher can only be chosen when a DSA certificate is available. DSA ciphers always use DH key exchange and therefore need DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

When these conditions are not met for any cipher suite in the list (for example, a client only supports export RSA ciphers with an asymmetric key length of 512 bits and the server is not configured to use temporary RSA keys), the “no shared cipher” (SSL_R_NO_SHARED_CIPHER) error is generated and the handshake will fail.

SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher suite could be selected and 0 on complete failure.

ssl(3), SSL_CTX_set1_groups(3), SSL_CTX_set_tmp_dh_callback(3), SSL_CTX_use_certificate(3), SSL_get_ciphers(3)

SSL_CTX_set_cipher_list() and SSL_set_cipher_list() first appeared in SSLeay 0.5.2 and have been available since OpenBSD 2.4.

In LibreSSL, SSL_CTX_set_cipher_list() and SSL_set_cipher_list() can be used to configure the list of available cipher suites for all versions of the TLS protocol, whereas in OpenSSL, they only control cipher suites for protocols up to TLSv1.2. If compatibility with OpenSSL is required, the list of available TLSv1.3 cipher suites can only be changed with SSL_set_ciphersuites().

December 11, 2022 OpenBSD-7.3