1=pod 2 3=head1 NAME 4 5SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_version - get the 6protocol 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 18 int SSL_version(const SSL *s); 19 20=head1 DESCRIPTION 21 22SSL_client_version() returns the numeric protocol version advertised by the 23client in the legacy_version field of the ClientHello when initiating the 24connection. Note that, for TLS, this value will never indicate a version greater 25than TLSv1.2 even if TLSv1.3 is subsequently negotiated. SSL_get_version() 26returns the name of the protocol used for the connection. SSL_version() returns 27the numeric protocol version used for the connection. They should only be called 28after the initial handshake has been completed. Prior to that the results 29returned from these functions may be unreliable. 30 31SSL_is_dtls() returns one if the connection is using DTLS, zero if not. 32 33=head1 RETURN VALUES 34 35 36SSL_get_version() returns one of the following strings: 37 38=over 4 39 40=item SSLv3 41 42The connection uses the SSLv3 protocol. 43 44=item TLSv1 45 46The connection uses the TLSv1.0 protocol. 47 48=item TLSv1.1 49 50The connection uses the TLSv1.1 protocol. 51 52=item TLSv1.2 53 54The connection uses the TLSv1.2 protocol. 55 56=item TLSv1.3 57 58The connection uses the TLSv1.3 protocol. 59 60=item unknown 61 62This indicates an unknown protocol version. 63 64=back 65 66SSL_version() and SSL_client_version() return an integer which could include any 67of the following: 68 69=over 4 70 71=item SSL3_VERSION 72 73The connection uses the SSLv3 protocol. 74 75=item TLS1_VERSION 76 77The connection uses the TLSv1.0 protocol. 78 79=item TLS1_1_VERSION 80 81The connection uses the TLSv1.1 protocol. 82 83=item TLS1_2_VERSION 84 85The connection uses the TLSv1.2 protocol. 86 87=item TLS1_3_VERSION 88 89The connection uses the TLSv1.3 protocol (never returned for 90SSL_client_version()). 91 92=back 93 94=head1 SEE ALSO 95 96L<ssl(7)> 97 98=head1 HISTORY 99 100The SSL_is_dtls() function was added in OpenSSL 1.1.0. 101 102=head1 COPYRIGHT 103 104Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. 105 106Licensed under the Apache License 2.0 (the "License"). You may not use 107this file except in compliance with the License. You can obtain a copy 108in the file LICENSE in the source distribution or at 109L<https://www.openssl.org/source/license.html>. 110 111=cut 112