-.\" $OpenBSD: SSL_get_version.3,v 1.8 2021/03/31 18:03:13 tb Exp $
-.\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
+.\" $OpenBSD: SSL_get_version.3,v 1.9 2021/04/15 16:13:22 tb Exp $
+.\" full merge up to: OpenSSL e417070c Jun 8 11:37:06 2016 -0400
.\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 31 2021 $
+.Dd $Mdocdate: April 15 2021 $
.Dt SSL_GET_VERSION 3
.Os
.Sh NAME
.Nm SSL_get_version ,
+.Nm SSL_is_dtls ,
.Nm SSL_version
.\" The following are intentionally undocumented because
.\" - the longer term plan is to remove them
.\" - and they have the wrong namespace prefix
.\" Nm TLS1_get_version
.\" Nm TLS1_get_client_version
-.Nd get the protocol version of a connection
+.Nd get the protocol information of a connection
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft const char *
.Fn SSL_get_version "const SSL *ssl"
.Ft int
+.Fn SSL_is_dtls "const SSL *ssl"
+.Ft int
.Fn SSL_version "const SSL *ssl"
.Sh DESCRIPTION
.Fn SSL_get_version
returns the name of the protocol used for the connection
.Fa ssl .
.Pp
+.Fn SSL_is_dtls
+returns 1 if the connection is using DTLS, 0 if not.
+.Pp
.Fn SSL_version
returns an integer constant representing that protocol.
.Pp
These functions only return reliable results
after the initial handshake has been completed.
.Sh RETURN VALUES
-The following strings or integers can be returned:
+The following strings or integers can be returned by
+.Fn SSL_get_version
+and
+.Fn SSL_version :
.Bl -tag -width Ds
.It Qo TLSv1 Qc No or Dv TLS1_VERSION
The connection uses the TLSv1.0 protocol.
This indicates an unknown protocol version;
it cannot currently happen with LibreSSL.
.El
+.Pp
+.Fn SSL_is_dtls
+returns 1 if the connection uses DTLS, 0 if not.
.Sh SEE ALSO
.Xr ssl 3
.Sh HISTORY
.Fn SSL_version
first appeared in SSLeay 0.8.0 and have been available since
.Ox 2.4 .
+.Pp
+.Fn SSL_is_dtls
+first appeared in OpenSSL 1.1.0 and has been available since
+.Ox 6.9 .