Copyright year updates
[openssl.git] / doc / man3 / SSL_get_version.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_is_tls, SSL_is_quic,
6 SSL_version - get the protocol information of a connection
7
8 =head1 SYNOPSIS
9
10  #include <openssl/ssl.h>
11
12  int SSL_client_version(const SSL *s);
13
14  const char *SSL_get_version(const SSL *ssl);
15
16  int SSL_is_dtls(const SSL *ssl);
17  int SSL_is_tls(const SSL *ssl);
18  int SSL_is_quic(const SSL *ssl);
19
20  int SSL_version(const SSL *s);
21
22 =head1 DESCRIPTION
23
24 For SSL, TLS and DTLS protocols SSL_client_version() returns the numeric
25 protocol version advertised by the client in the legacy_version field of the
26 ClientHello when initiating the connection. Note that, for TLS, this value
27 will never indicate a version greater than TLSv1.2 even if TLSv1.3 is
28 subsequently negotiated. For QUIC connections it returns OSSL_QUIC1_VERSION.
29
30 SSL_get_version() returns the name of the protocol used for the connection.
31 SSL_version() returns the numeric protocol version used for the connection.
32 They should only be called after the initial handshake has been completed.
33 Prior to that the results returned from these functions may be unreliable.
34
35 SSL_is_dtls() returns 1 if the connection is using DTLS or 0 if not.
36
37 SSL_is_tls() returns 1 if the connection is using SSL/TLS or 0 if not.
38
39 SSL_is_quic() returns 1 if the connection is using QUIC or 0 if not.
40
41 =head1 RETURN VALUES
42
43
44 SSL_get_version() returns one of the following strings:
45
46 =over 4
47
48 =item SSLv3
49
50 The connection uses the SSLv3 protocol.
51
52 =item TLSv1
53
54 The connection uses the TLSv1.0 protocol.
55
56 =item TLSv1.1
57
58 The connection uses the TLSv1.1 protocol.
59
60 =item TLSv1.2
61
62 The connection uses the TLSv1.2 protocol.
63
64 =item TLSv1.3
65
66 The connection uses the TLSv1.3 protocol.
67
68 =item DTLSv0.9
69
70 The connection uses an obsolete pre-standardisation DTLS protocol
71
72 =item DTLSv1
73
74 The connection uses the DTLSv1 protocol
75
76 =item DTLSv1.2
77
78 The connection uses the DTLSv1.2 protocol
79
80 =item QUICv1
81
82 The connection uses the QUICv1 protocol.
83
84 =item unknown
85
86 This indicates an unknown protocol version.
87
88 =back
89
90 SSL_version() and SSL_client_version() return an integer which could include any
91 of the following:
92
93 =over 4
94
95 =item SSL3_VERSION
96
97 The connection uses the SSLv3 protocol.
98
99 =item TLS1_VERSION
100
101 The connection uses the TLSv1.0 protocol.
102
103 =item TLS1_1_VERSION
104
105 The connection uses the TLSv1.1 protocol.
106
107 =item TLS1_2_VERSION
108
109 The connection uses the TLSv1.2 protocol.
110
111 =item TLS1_3_VERSION
112
113 The connection uses the TLSv1.3 protocol (never returned for
114 SSL_client_version()).
115
116 =item  DTLS1_BAD_VER
117
118 The connection uses an obsolete pre-standardisation DTLS protocol
119
120 =item DTLS1_VERSION
121
122 The connection uses the DTLSv1 protocol
123
124 =item DTLS1_2_VERSION
125
126 The connection uses the DTLSv1.2 protocol
127
128 =item OSSL_QUIC1_VERSION
129
130 The connection uses the QUICv1 protocol.
131
132 =back
133
134 =head1 SEE ALSO
135
136 L<ssl(7)>
137
138 =head1 HISTORY
139
140 The SSL_is_dtls() function was added in OpenSSL 1.1.0. The SSL_is_tls() and
141 SSL_is_quic() functions were added in OpenSSL 3.2.
142
143 =head1 COPYRIGHT
144
145 Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
146
147 Licensed under the Apache License 2.0 (the "License").  You may not use
148 this file except in compliance with the License.  You can obtain a copy
149 in the file LICENSE in the source distribution or at
150 L<https://www.openssl.org/source/license.html>.
151
152 =cut