SSL_CTX_set_cipher_list.pod 4.4 KB

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