1=pod
2
3=head1 NAME
4
5SSL_CTX_set_cipher_list,
6SSL_set_cipher_list,
7SSL_CTX_set_ciphersuites,
8SSL_set_ciphersuites,
9OSSL_default_cipher_list,
10OSSL_default_ciphersuites
11- choose list of available SSL_CIPHERs
12
13=head1 SYNOPSIS
14
15 #include <openssl/ssl.h>
16
17 int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
18 int SSL_set_cipher_list(SSL *ssl, const char *str);
19
20 int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);
21 int SSL_set_ciphersuites(SSL *s, const char *str);
22
23 const char *OSSL_default_cipher_list(void);
24 const char *OSSL_default_ciphersuites(void);
25
26=head1 DESCRIPTION
27
28SSL_CTX_set_cipher_list() sets the list of available ciphers (TLSv1.2 and below)
29for B<ctx> using the control string B<str>. The format of the string is described
30in L<openssl-ciphers(1)>. The list of ciphers is inherited by all
31B<ssl> objects created from B<ctx>. This function does not impact TLSv1.3
32ciphersuites. Use SSL_CTX_set_ciphersuites() to configure those. B<ctx> B<MUST NOT> be NULL.
33
34SSL_set_cipher_list() sets the list of ciphers (TLSv1.2 and below) only for
35B<ssl>.
36
37SSL_CTX_set_ciphersuites() is used to configure the available TLSv1.3
38ciphersuites for B<ctx>. This is a simple colon (":") separated list of TLSv1.3
39ciphersuite names in order of preference. Valid TLSv1.3 ciphersuite names are:
40
41=over 4
42
43=item TLS_AES_128_GCM_SHA256
44
45=item TLS_AES_256_GCM_SHA384
46
47=item TLS_CHACHA20_POLY1305_SHA256
48
49=item TLS_AES_128_CCM_SHA256
50
51=item TLS_AES_128_CCM_8_SHA256
52
53=item TLS_SHA384_SHA384 - integrity-only
54
55=item TLS_SHA256_SHA256 - integrity-only
56
57=back
58
59An empty list is permissible. The default value for this setting is:
60
61"TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"
62
63SSL_set_ciphersuites() is the same as SSL_CTX_set_ciphersuites() except it
64configures the ciphersuites for B<ssl>.
65
66OSSL_default_cipher_list() returns the default cipher string for TLSv1.2
67(and earlier) ciphers. OSSL_default_ciphersuites() returns the default
68cipher string for TLSv1.3 ciphersuites.
69
70=head1 NOTES
71
72The control string B<str> for SSL_CTX_set_cipher_list(), SSL_set_cipher_list(),
73SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() should be universally
74usable and not depend on details of the library configuration (ciphers compiled
75in). Thus no syntax checking takes place. Items that are not recognized, because
76the corresponding ciphers are not compiled in or because they are mistyped,
77are simply ignored. Failure is only flagged if no ciphers could be collected
78at all.
79
80It should be noted, that inclusion of a cipher to be used into the list is
81a necessary condition. On the client side, the inclusion into the list is
82also sufficient unless the security level excludes it. On the server side,
83additional restrictions apply. All ciphers have additional requirements.
84ADH ciphers don't need a certificate, but DH-parameters must have been set.
85All other ciphers need a corresponding certificate and key.
86
87An RSA cipher can only be chosen, when an RSA certificate is available.
88RSA ciphers using DHE need a certificate and key and additional DH-parameters
89(see L<SSL_CTX_set_tmp_dh_callback(3)>).
90
91A DSA cipher can only be chosen, when a DSA certificate is available.
92DSA ciphers always use DH key exchange and therefore need DH-parameters
93(see L<SSL_CTX_set_tmp_dh_callback(3)>).
94
95When these conditions are not met for any cipher in the list (e.g. a
96client only supports export RSA ciphers with an asymmetric key length
97of 512 bits and the server is not configured to use temporary RSA
98keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is generated
99and the handshake will fail.
100
101OSSL_default_cipher_list() and OSSL_default_ciphersuites() replace
102SSL_DEFAULT_CIPHER_LIST and TLS_DEFAULT_CIPHERSUITES, respectively. The
103cipher list defines are deprecated as of 3.0.
104
105=head1 RETURN VALUES
106
107SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher
108could be selected and 0 on complete failure.
109
110SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() return 1 if the requested
111ciphersuite list was configured, and 0 otherwise.
112
113=head1 SEE ALSO
114
115L<ssl(7)>, L<SSL_get_ciphers(3)>,
116L<SSL_CTX_use_certificate(3)>,
117L<SSL_CTX_set_tmp_dh_callback(3)>,
118L<openssl-ciphers(1)>
119
120=head1 HISTORY
121
122OSSL_default_cipher_list() and OSSL_default_ciphersites() are new in 3.0.
123
124=head1 COPYRIGHT
125
126Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
127
128Licensed under the Apache License 2.0 (the "License").  You may not use
129this file except in compliance with the License.  You can obtain a copy
130in the file LICENSE in the source distribution or at
131L<https://www.openssl.org/source/license.html>.
132
133=cut
134