Home | History | Annotate | Line # | Download | only in man3
      1      1.1  christos =pod
      2      1.1  christos 
      3      1.1  christos =head1 NAME
      4      1.1  christos 
      5      1.1  christos SSL_get1_supported_ciphers,
      6      1.1  christos SSL_get_client_ciphers,
      7      1.1  christos SSL_get_ciphers,
      8      1.1  christos SSL_CTX_get_ciphers,
      9      1.1  christos SSL_bytes_to_cipher_list,
     10      1.1  christos SSL_get_cipher_list,
     11      1.1  christos SSL_get_shared_ciphers
     12      1.1  christos - get list of available SSL_CIPHERs
     13      1.1  christos 
     14      1.1  christos =head1 SYNOPSIS
     15      1.1  christos 
     16      1.1  christos  #include <openssl/ssl.h>
     17      1.1  christos 
     18      1.1  christos  STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
     19      1.1  christos  STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);
     20      1.1  christos  STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);
     21      1.1  christos  STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);
     22      1.1  christos  int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,
     23      1.1  christos                               int isv2format, STACK_OF(SSL_CIPHER) **sk,
     24      1.1  christos                               STACK_OF(SSL_CIPHER) **scsvs);
     25      1.1  christos  const char *SSL_get_cipher_list(const SSL *ssl, int priority);
     26      1.1  christos  char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size);
     27      1.1  christos 
     28      1.1  christos =head1 DESCRIPTION
     29      1.1  christos 
     30      1.1  christos SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>,
     31      1.1  christos sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL
     32      1.1  christos is returned.
     33      1.1  christos 
     34      1.1  christos SSL_CTX_get_ciphers() returns the stack of available SSL_CIPHERs for B<ctx>.
     35      1.1  christos 
     36      1.1  christos SSL_get1_supported_ciphers() returns the stack of enabled SSL_CIPHERs for
     37      1.1  christos B<ssl> as would be sent in a ClientHello (that is, sorted by preference).
     38      1.1  christos The list depends on settings like the cipher list, the supported protocol
     39      1.1  christos versions, the security level, and the enabled signature algorithms.
     40      1.1  christos SRP and PSK ciphers are only enabled if the appropriate callbacks or settings
     41      1.1  christos have been applied.
     42      1.1  christos The list of ciphers that would be sent in a ClientHello can differ from
     43      1.1  christos the list of ciphers that would be acceptable when acting as a server.
     44      1.1  christos For example, additional ciphers may be usable by a server if there is
     45      1.1  christos a gap in the list of supported protocols, and some ciphers may not be
     46      1.1  christos usable by a server if there is not a suitable certificate configured.
     47      1.1  christos If B<ssl> is NULL or no ciphers are available, NULL is returned.
     48      1.1  christos 
     49      1.1  christos SSL_get_client_ciphers() returns the stack of available SSL_CIPHERs matching the
     50      1.1  christos list received from the client on B<ssl>. If B<ssl> is NULL, no ciphers are
     51      1.1  christos available, or B<ssl> is not operating in server mode, NULL is returned.
     52      1.1  christos 
     53      1.1  christos SSL_bytes_to_cipher_list() treats the supplied B<len> octets in B<bytes>
     54      1.1  christos as a wire-protocol cipher suite specification (in the three-octet-per-cipher
     55      1.1  christos SSLv2 wire format if B<isv2format> is nonzero; otherwise the two-octet
     56      1.1  christos SSLv3/TLS wire format), and parses the cipher suites supported by the library
     57      1.1  christos into the returned stacks of SSL_CIPHER objects sk and Signalling Cipher-Suite
     58      1.1  christos Values scsvs.  Unsupported cipher suites are ignored.  Returns 1 on success
     59      1.1  christos and 0 on failure.
     60      1.1  christos 
     61      1.1  christos SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER
     62      1.1  christos listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are
     63      1.1  christos available, or there are less ciphers than B<priority> available, NULL
     64      1.1  christos is returned.
     65      1.1  christos 
     66      1.1  christos SSL_get_shared_ciphers() creates a colon separated and NUL terminated list of
     67      1.1  christos SSL_CIPHER names that are available in both the client and the server. B<buf> is
     68      1.1  christos the buffer that should be populated with the list of names and B<size> is the
     69      1.1  christos size of that buffer. A pointer to B<buf> is returned on success or NULL on
     70      1.1  christos error. If the supplied buffer is not large enough to contain the complete list
     71      1.1  christos of names then a truncated list of names will be returned. Note that just because
     72      1.1  christos a ciphersuite is available (i.e. it is configured in the cipher list) and shared
     73      1.1  christos by both the client and the server it does not mean that it is enabled (see the
     74      1.1  christos description of SSL_get1_supported_ciphers() above). This function will return
     75      1.1  christos available shared ciphersuites whether or not they are enabled. This is a server
     76      1.1  christos side function only and must only be called after the completion of the initial
     77      1.1  christos handshake.
     78      1.1  christos 
     79      1.1  christos =head1 NOTES
     80      1.1  christos 
     81      1.1  christos The details of the ciphers obtained by SSL_get_ciphers(), SSL_CTX_get_ciphers()
     82      1.1  christos SSL_get1_supported_ciphers() and SSL_get_client_ciphers() can be obtained using
     83      1.1  christos the L<SSL_CIPHER_get_name(3)> family of functions.
     84      1.1  christos 
     85      1.1  christos Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the
     86      1.1  christos sorted list of available ciphers, until NULL is returned.
     87      1.1  christos 
     88      1.1  christos Note: SSL_get_ciphers(), SSL_CTX_get_ciphers() and SSL_get_client_ciphers()
     89      1.1  christos return a pointer to an internal cipher stack, which will be freed later on when
     90      1.1  christos the SSL or SSL_SESSION object is freed.  Therefore, the calling code B<MUST NOT>
     91      1.1  christos free the return value itself.
     92      1.1  christos 
     93      1.1  christos The stack returned by SSL_get1_supported_ciphers() should be freed using
     94      1.1  christos sk_SSL_CIPHER_free().
     95      1.1  christos 
     96      1.1  christos The stacks returned by SSL_bytes_to_cipher_list() should be freed using
     97      1.1  christos sk_SSL_CIPHER_free().
     98      1.1  christos 
     99      1.1  christos =head1 RETURN VALUES
    100      1.1  christos 
    101      1.1  christos See DESCRIPTION
    102      1.1  christos 
    103      1.1  christos =head1 SEE ALSO
    104      1.1  christos 
    105      1.1  christos L<ssl(7)>, L<SSL_CTX_set_cipher_list(3)>,
    106      1.1  christos L<SSL_CIPHER_get_name(3)>
    107      1.1  christos 
    108      1.1  christos =head1 COPYRIGHT
    109      1.1  christos 
    110      1.1  christos Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
    111      1.1  christos 
    112  1.1.1.2  christos Licensed under the Apache License 2.0 (the "License").  You may not use
    113      1.1  christos this file except in compliance with the License.  You can obtain a copy
    114      1.1  christos in the file LICENSE in the source distribution or at
    115      1.1  christos L<https://www.openssl.org/source/license.html>.
    116      1.1  christos 
    117      1.1  christos =cut
    118