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