---
name: "libressl-SSL_get_version"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SSL_get_version"
---

# libressl-SSL\_get\_version(3)

get the protocol information of a connection

## NAME

**SSL\_get\_version**, **SSL\_is\_dtls**, **SSL\_version** – get the protocol information of a connection

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#include \<openssl/ssl.h\>**

*const* *char* *\**\

**SSL\_get\_version**(*const SSL \*ssl*);

*int*\

**SSL\_is\_dtls**(*const SSL \*ssl*);

*int*\

**SSL\_version**(*const SSL \*ssl*);

## DESCRIPTION

**SSL\_get\_version**() returns the name of the protocol used for the connection *ssl*.

**SSL\_is\_dtls**() returns 1 if the connection is using DTLS, 0 if not.

**SSL\_version**() returns an integer constant representing that protocol.

These functions only return reliable results after the initial handshake has been completed.

## RETURN VALUES

The following strings or integers can be returned by **SSL\_get\_version**() and **SSL\_version**():

- "TLSv1" or TLS1\_VERSION

  The connection uses the TLSv1.0 protocol.

- "TLSv1.1" or TLS1\_1\_VERSION

  The connection uses the TLSv1.1 protocol.

- "TLSv1.2" or TLS1\_2\_VERSION

  The connection uses the TLSv1.2 protocol.

- "TLSv1.3" or TLS1\_3\_VERSION

  The connection uses the TLSv1.3 protocol.

- "DTLSv1" or DTLS1\_VERSION

  The connection uses the Datagram Transport Layer Security 1.0 protocol.

- "DTLSv1.2" or DTLS1\_2\_VERSION

  The connection uses the Datagram Transport Layer Security 1.2 protocol.

- "unknown"

  This indicates an unknown protocol version; it cannot currently happen with LibreSSL.

**SSL\_is\_dtls**() returns 1 if the connection uses DTLS, 0 if not.

## SEE ALSO

[ssl(3)](/ssl/3.md)

## HISTORY

**SSL\_get\_version**() and **SSL\_version**() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4.

**SSL\_is\_dtls**() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.9.
