OpenBSD manual page server

Manual Page Search Parameters

OPENSSL_VERSION_NUMBER(3) Library Functions Manual OPENSSL_VERSION_NUMBER(3)

OPENSSL_VERSION_NUMBER, LIBRESSL_VERSION_NUMBER, LIBRESSL_VERSION_TEXT, OPENSSL_VERSION_TEXT, OpenSSL_version_num, OpenSSL_version, SSLeay, SSLeay_versionget OpenSSL version number

#include <openssl/opensslv.h>

#define OPENSSL_VERSION_NUMBER 0x020000000L
#define LIBRESSL_VERSION_NUMBER 0x02nnnn00fL
#define LIBRESSL_VERSION_TEXT "LibreSSL 2.n.n"
#define OPENSSL_VERSION_TEXT LIBRESSL_VERSION_TEXT

#include <openssl/crypto.h>

unsigned long
OpenSSL_version_num(void);

const char *
OpenSSL_version(int t);

long
SSLeay(void);

const char *
SSLeay_version(int t);

OPENSSL_VERSION_NUMBER and LIBRESSL_VERSION_NUMBER are numeric release version identifiers. The first two digits contain the major release number, the third and fourth digits the minor release number, and the fifth and sixth digits the fix release number. For OpenSSL, the seventh and eight digits contain the patch release number and the final digit is 0 for development, 1 to e for betas 1 to 14, or f for release. For LibreSSL, OPENSSL_VERSION_NUMBER is always 0x020000000, and LIBRESSL_VERSION_NUMBER always ends with 00f.

For example:

OPENSSL_VERSION_NUMBER:
0x000906000 == 0.9.6 dev
0x000906023 == 0.9.6b beta 3
0x00090605f == 0.9.6e release
0x020000000 == 2.0.0 for any version of LibreSSL

LIBRESSL_VERSION_NUMBER:
0x02070000f == LibreSSL 2.7.0

OpenSSL versions prior to 0.9.3 had identifiers < 0x0930. For versions between 0.9.3 and 0.9.5, the seventh digit was 1 for release and 0 otherwise, and the eighth and ninth digits were the patch release number.

For example:

0x000904100 == 0.9.4 release
0x000905000 == 0.9.5 dev

OpenSSL version 0.9.5a had an interim interpretation that is like the current one, except the patch level got the highest bit set, to keep continuity. The number was therefore 0x0090581f.

() returns OPENSSL_VERSION_NUMBER.

() returns different strings depending on t:

The text variant of the version number, OPENSSL_VERSION_TEXT. For OpenSSL, it includes the release date, for example "OpenSSL 0.9.5a 1 Apr 2000". For LibreSSL, LIBRESSL_VERSION_TEXT is returned.
The compiler flags set for the compilation process in the form "compiler: ..." if available or "compiler: information not available" otherwise. LibreSSL never provides compiler information.
The date of the build process in the form "built on: ..." if available or "built on: date not available" otherwise. LibreSSL never provides information on the build date.
The Configure target of the library build in the form "platform: ..." if available or "platform: information not available" otherwise. LibreSSL never provides platform information.
The OPENSSLDIR setting of the library build in the form "OPENSSLDIR: "..."" if available or "OPENSSLDIR: N/A" otherwise. For LibreSSL, the default is "OPENSSLDIR: "/etc/ssl"".
The ENGINESDIR setting of the library build in the form "ENGINESDIR: "..."" if available or "ENGINESDIR: N/A" otherwise. LibreSSL never provides or uses an ENGINESDIR.

For an unknown t, the text "not available" is returned.

For backward compatibility, SSLEAY_VERSION_NUMBER is an alias for OPENSSL_VERSION_NUMBER and () for OpenSSL_version_num(). The legacy function () is similar to OpenSSL_version() except that it takes arguments SSLEAY_VERSION, SSLEAY_CFLAGS, SSLEAY_BUILT_ON, SSLEAY_PLATFORM, and SSLEAY_DIR which expand to numerical values than the corresponding OPENSSL_* macros.

OpenSSL_version_num() and SSLeay() return a constant version number.

OpenSSL_version() and SSLeay_version() return pointers to static strings.

crypto(3), OPENSSL_config(3)

SSLeay(), SSLeay_version(), and SSLEAY_VERSION_NUMBER first appeared in SSLeay 0.6.0 and have been available since OpenBSD 2.4.

OPENSSL_VERSION_NUMBER first appeared in the first OpenSSL release, OpenSSL 0.9.1c, and has been available since OpenBSD 2.6.

SSLEAY_DIR first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.

LIBRESSL_VERSION_NUMBER first appeared in LibreSSL 2.0.0 and OpenBSD 5.6 and got its final format in LibreSSL 2.3.2 and OpenBSD 5.9. LIBRESSL_VERSION_TEXT first appeared in LibreSSL 2.2.2 and OpenBSD 5.8.

OpenSSL_version_num() and OpenSSL_version() first appeared in OpenSSL 1.1.0 and have been available since LibreSSL 2.7.1 and OpenBSD 6.3.

November 16, 2023 OpenBSD-current