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