OPENSSL_VERSION_NUMBER(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… OPENSSL_VERSION_NUMBER(3) β€” Library Functions Manual

okay so bestie, welcome to the manual page where we figure out which version of OpenSSL / LibreSSL you're actually running. it's giving "who am i" but for a crypto library. no cap, this one's important. πŸŽ€


✨ NAME ✨

OPENSSL_VERSION_NUMBER, LIBRESSL_VERSION_NUMBER, LIBRESSL_VERSION_TEXT, OPENSSL_VERSION_TEXT, OpenSSL_version_num, OpenSSL_version, SSLeay, SSLeay_version β€” get OpenSSL version number 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

library "libcrypto"

#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);

πŸ’– DESCRIPTION πŸ’–

so OPENSSL_VERSION_NUMBER and LIBRESSL_VERSION_NUMBER are these numeric release version identifiers β€” literally a number that is the version. here's the tea on how they're laid out:

  • the first two digits = the major release number
  • the third and fourth digits = the minor release number
  • the fifth and sixth digits = the fix release number

for OpenSSL:

  • the seventh and eighth digits = the patch release number
  • 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
  • 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

and like, history lesson time 🫢 β€” 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. iconic but confusing, i know. 😭

for example:

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

and OpenSSL version 0.9.5a had this interim interpretation that's like the current one, except the patch level got the highest bit set, to keep continuity. so the number was therefore 0x0090581f. weird little flex but ok πŸ’€


OpenSSL_version_num() returns OPENSSL_VERSION_NUMBER.

OpenSSL_version() returns different strings depending on t:

  • OPENSSL_VERSION β€” 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. ✨
  • OPENSSL_CFLAGS β€” 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. πŸ™ˆ
  • OPENSSL_BUILT_ON β€” 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.
  • OPENSSL_PLATFORM β€” the Configure target of the library build, in the form "platform: ..." if available, or "platform: information not available" otherwise. LibreSSL never provides platform information.
  • OPENSSL_DIR β€” 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"". πŸ“
  • OPENSSL_ENGINES_DIR β€” 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. rude but fair.

for backward compatibility, SSLEAY_VERSION_NUMBER is an alias for OPENSSL_VERSION_NUMBER, and SSLeay() is an alias for OpenSSL_version_num(). the legacy function SSLeay_version() 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 other numerical values than the corresponding OPENSSL_* macros. so don't mix them up bestie, i'm warning you 🫢

ok lowkey important: SSLeay_version() uses a whole different set of numeric constants than OpenSSL_version(). same vibes, different numbers. keep that straight.

πŸ”₯ RETURN VALUES πŸ”₯

  • OpenSSL_version_num() and SSLeay() return a constant version number.
  • OpenSSL_version() and SSLeay_version() return pointers to static strings.

πŸ‘‘ SEE ALSO πŸ‘‘

crypto(3), OPENSSL_config(3)


🌟 HISTORY 🌟

  • 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. πŸ’œ

and that's the whole page, bestie! 🧚 this lil drop is from Debian, dated June 8, 2025 β€” so if anyone asks, that's the source and the date, periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from