Following the license change, modify the boilerplates in doc/man3/
[openssl.git] / doc / man3 / SSL_CTX_set_cipher_list.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_CTX_set_cipher_list,
6 SSL_set_cipher_list,
7 SSL_CTX_set_ciphersuites,
8 SSL_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
23 SSL_CTX_set_cipher_list() sets the list of available ciphers (TLSv1.2 and below)
24 for B<ctx> using the control string B<str>. The format of the string is described
25 in L<ciphers(1)>. The list of ciphers is inherited by all
26 B<ssl> objects created from B<ctx>. This function does not impact TLSv1.3
27 ciphersuites. Use SSL_CTX_set_ciphersuites() to configure those.
28
29 SSL_set_cipher_list() sets the list of ciphers (TLSv1.2 and below) only for
30 B<ssl>.
31
32 SSL_CTX_set_ciphersuites() is used to configure the available TLSv1.3
33 ciphersuites for B<ctx>. This is a simple colon (":") separated list of TLSv1.3
34 ciphersuite names in order of perference. 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
50 An 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
54 SSL_set_ciphersuites() is the same as SSL_CTX_set_ciphersuites() except it
55 configures the ciphersuites for B<ssl>.
56
57 =head1 NOTES
58
59 The control string B<str> for SSL_CTX_set_cipher_list() and
60 SSL_set_cipher_list() should be universally usable and not depend
61 on details of the library configuration (ciphers compiled in). Thus no
62 syntax checking takes place. Items that are not recognized, because the
63 corresponding ciphers are not compiled in or because they are mistyped,
64 are simply ignored. Failure is only flagged if no ciphers could be collected
65 at all.
66
67 It should be noted, that inclusion of a cipher to be used into the list is
68 a necessary condition. On the client side, the inclusion into the list is
69 also sufficient unless the security level excludes it. On the server side,
70 additional restrictions apply. All ciphers have additional requirements.
71 ADH ciphers don't need a certificate, but DH-parameters must have been set.
72 All other ciphers need a corresponding certificate and key.
73
74 A RSA cipher can only be chosen, when a RSA certificate is available.
75 RSA ciphers using DHE need a certificate and key and additional DH-parameters
76 (see L<SSL_CTX_set_tmp_dh_callback(3)>).
77
78 A DSA cipher can only be chosen, when a DSA certificate is available.
79 DSA ciphers always use DH key exchange and therefore need DH-parameters
80 (see L<SSL_CTX_set_tmp_dh_callback(3)>).
81
82 When these conditions are not met for any cipher in the list (e.g. a
83 client only supports export RSA ciphers with an asymmetric key length
84 of 512 bits and the server is not configured to use temporary RSA
85 keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is generated
86 and the handshake will fail.
87
88 =head1 RETURN VALUES
89
90 SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher
91 could be selected and 0 on complete failure.
92
93 SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() return 1 if the requested
94 ciphersuite list was configured, and 0 otherwise.
95
96 =head1 SEE ALSO
97
98 L<ssl(7)>, L<SSL_get_ciphers(3)>,
99 L<SSL_CTX_use_certificate(3)>,
100 L<SSL_CTX_set_tmp_dh_callback(3)>,
101 L<ciphers(1)>
102
103 =head1 COPYRIGHT
104
105 Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
106
107 Licensed under the Apache License 2.0 (the "License").  You may not use
108 this file except in compliance with the License.  You can obtain a copy
109 in the file LICENSE in the source distribution or at
110 L<https://www.openssl.org/source/license.html>.
111
112 =cut