xref: /freebsd/crypto/openssl/doc/man3/SSL_get_current_cipher.pod (revision 64cbf7cebc3b80a971e1d15124831d84604b9370)
1=pod
2
3=head1 NAME
4
5SSL_get_current_cipher, SSL_get_cipher_name, SSL_get_cipher,
6SSL_get_cipher_bits, SSL_get_cipher_version,
7SSL_get_pending_cipher - get SSL_CIPHER of a connection
8
9=head1 SYNOPSIS
10
11 #include <openssl/ssl.h>
12
13 const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl);
14 const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);
15
16 const char *SSL_get_cipher_name(const SSL *s);
17 const char *SSL_get_cipher(const SSL *s);
18 int SSL_get_cipher_bits(const SSL *s, int *np);
19 const char *SSL_get_cipher_version(const SSL *s);
20
21=head1 DESCRIPTION
22
23SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing
24the description of the actually used cipher of a connection established with
25the B<ssl> object.
26See L<SSL_CIPHER_get_name(3)> for more details.
27
28SSL_get_cipher_name() obtains the
29name of the currently used cipher.
30SSL_get_cipher() is identical to SSL_get_cipher_name().
31SSL_get_cipher_bits() is a
32macro to obtain the number of secret/algorithm bits used and
33SSL_get_cipher_version() returns the protocol name.
34
35SSL_get_pending_cipher() returns a pointer to an SSL_CIPHER object containing
36the description of the cipher (if any) that has been negotiated for future use
37on the connection established with the B<ssl> object, but is not yet in use.
38This may be the case during handshake processing, when control flow can be
39returned to the application via any of several callback methods.  The internal
40sequencing of handshake processing and callback invocation is not guaranteed
41to be stable from release to release, and at present only the callback set
42by SSL_CTX_set_alpn_select_cb() is guaranteed to have a non-NULL return value.
43Other callbacks may be added to this list over time.
44
45=head1 RETURN VALUES
46
47SSL_get_current_cipher() returns the cipher actually used, or NULL if
48no session has been established.
49
50SSL_get_pending_cipher() returns the cipher to be used at the next change
51of cipher suite, or NULL if no such cipher is known.
52
53=head1 NOTES
54
55SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, and
56SSL_get_cipher_name are implemented as macros.
57
58=head1 SEE ALSO
59
60L<ssl(7)>, L<SSL_CIPHER_get_name(3)>
61
62=head1 COPYRIGHT
63
64Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
65
66Licensed under the OpenSSL license (the "License").  You may not use
67this file except in compliance with the License.  You can obtain a copy
68in the file LICENSE in the source distribution or at
69L<https://www.openssl.org/source/license.html>.
70
71=cut
72