OPENSSL_VERSION(3SSL)
β¨ OPENSSL_VERSION (3SSL) π
okay bestie, gather round, because today we're learning how to ask OpenSSL who even is she π. This page is the whole vibe check on version numbers and other cute lil info bits β OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA, OPENSSL_VERSION_TEXT, OPENSSL_VERSION_PREREQ, OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version, OPENSSL_VERSION_NUMBER, OpenSSL_version_num, and OPENSSL_info all get their moment here. Basically: get OpenSSL version number and other information. slay.
πΈ NAME πΈ
OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA, OPENSSL_VERSION_TEXT, OPENSSL_VERSION_PREREQ, OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version, OPENSSL_VERSION_NUMBER, OpenSSL_version_num, OPENSSL_info β get OpenSSL version number and other information π¦
π«Ά SYNOPSIS π«Ά
#include <openssl/opensslv.h>
#define OPENSSL_VERSION_MAJOR x
#define OPENSSL_VERSION_MINOR y
#define OPENSSL_VERSION_PATCH z
/* The definitions here are typical release values */
#define OPENSSL_VERSION_PRE_RELEASE ""
#define OPENSSL_VERSION_BUILD_METADATA ""
#define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
#define OPENSSL_VERSION_PREREQ(maj,min)
#include <openssl/crypto.h>
unsigned int OPENSSL_version_major(void);
unsigned int OPENSSL_version_minor(void);
unsigned int OPENSSL_version_patch(void);
const char *OPENSSL_version_pre_release(void);
const char *OPENSSL_version_build_metadata(void);
const char *OpenSSL_version(int t);
const char *OPENSSL_info(int t);
/* from openssl/opensslv.h */
#define OPENSSL_VERSION_NUMBER 0xnnnnnnnnL
/* from openssl/crypto.h */
unsigned long OpenSSL_version_num();
π DESCRIPTION π
π Macros π
the way these three little macros OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR and OPENSSL_VERSION_PATCH are literally the three parts of a version identifier, MAJOR.MINOR.PATCH. iconic.
OPENSSL_VERSION_PRE_RELEASE is that extra lil bit of text that tells you this is a pre-release version β think "-dev" for an ongoing development snapshot, or "-alpha3" for an alpha release. and bestie, the value must be a string. no cap.
OPENSSL_VERSION_BUILD_METADATA is extra info, reserved for other parties β like "+fips", or "+vendor.1". the OpenSSL project will not touch this macro (they leave it an empty string). and yeah, the value must be a string too.
OPENSSL_VERSION_STR is a convenience macro to get the short version identifier string, "MAJOR.MINOR.PATCH".
OPENSSL_FULL_VERSION_STR is a convenience macro to get the longer version identifier string, which combines OPENSSL_VERSION_STR, OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA.
OPENSSL_VERSION_TEXT is a convenience macro to get a full descriptive version text, which includes OPENSSL_FULL_VERSION_STR and the release date.
OPENSSL_VERSION_PREREQ is a genuinely useful macro for checking whether the OpenSSL version for the headers in use is at least at the given pre-requisite major (maj) and minor (min) number or not. it'll evaluate to true if the header version number (OPENSSL_VERSION_MAJOR.OPENSSL_VERSION_MINOR) is greater than or equal to maj.min. periodt.
OPENSSL_VERSION_NUMBER is a combination of the major, minor and patch version into a single integer 0xMNN00PP0L, where:
- M is the number from
OPENSSL_VERSION_MAJOR, in hexadecimal notation - NN is the number from
OPENSSL_VERSION_MINOR, in hexadecimal notation - PP is the number from
OPENSSL_VERSION_PATCH, in hexadecimal notation
π Functions π
OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(), OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return the values of the macros above for the build of the library, respectively. so you're not guessing, you're asking her directly π
OpenSSL_version() returns different strings depending on t:
OPENSSL_VERSIONβ the value ofOPENSSL_VERSION_TEXTOPENSSL_VERSION_STRINGβ the value ofOPENSSL_VERSION_STROPENSSL_FULL_VERSION_STRINGβ the value ofOPENSSL_FULL_VERSION_STROPENSSL_CFLAGSβ the compiler flags set for the compilation process, in the form"compiler: ..."if available, or"compiler: information not available"otherwise.OPENSSL_BUILT_ONβ the date of the build process, in the form"built on: ..."if available, or"built on: date not available"otherwise. fun fact: the date would not be available in a reproducible build, for example πOPENSSL_PLATFORMβ the"Configure"target of the library build, in the form"platform: ..."if available, or"platform: information not available"otherwise.OPENSSL_DIRβ theOPENSSLDIRsetting of the library build, in the form"OPENSSLDIR: "...""if available, or"OPENSSLDIR: N/A"otherwise.OPENSSL_MODULES_DIRβ theMODULESDIRsetting of the library build, in the form"MODULESDIR: "...""if available, or"MODULESDIR: N/A"otherwise.OPENSSL_CPU_INFOβ the current OpenSSL cpu settings. This is the current setting of the cpu capability flags. It is usually automatically configured but may be set via an environment variable. The value has the same syntax as the environment variable. For x86 the string looks like"CPUINFO: OPENSSL_ia32cap=0x123:0x456"or"CPUINFO: N/A"if not available.OPENSSL_WINCTXβ the Windows install context. The Windows install context is used to compute the OpenSSL registry key name on Windows. The full registry key is"SOFTWARE\WOW6432Node\OpenSSL-{major}.{minor}-{context}", where"{major}","{minor}"and"{context}"are OpenSSL's major version number, minor version number and the Windows install context, respectively.
For an unknown t, the text "not available" is returned. shrug π
OPENSSL_info() also returns different strings depending on t:
OPENSSL_INFO_CONFIG_DIRβ the configured"OPENSSLDIR", which is the default location for OpenSSL configuration files.OPENSSL_INFO_MODULES_DIRβ the configured"MODULESDIR", which is the default location for dynamically loadable OpenSSL modules.OPENSSL_INFO_DSO_EXTENSIONβ the configured dynamically loadable module extension.OPENSSL_INFO_DIR_FILENAME_SEPARATORβ the separator between a directory specification and a filename. Note that on some operating systems, this is not the same as the separator between directory elements. lowkey important.OPENSSL_INFO_LIST_SEPARATORβ the OpenSSL list separator. This is typically used in strings that are lists of items, such as the value of the environment variable$PATHon Unix (where the separator is":") or"%PATH%"on Windows (where the separator is";").OPENSSL_INFO_CPU_SETTINGSβ the current OpenSSL cpu settings. This is the current setting of the cpu capability flags. It is usually automatically configured but may be set via an environment variable. The value has the same syntax as the environment variable. For x86 the string looks like"OPENSSL_ia32cap=0x123:0x456".OPENSSL_INFO_WINDOWS_CONTEXTβ the Windows install context. The Windows install context is used to compute the OpenSSL registry key name on Windows. The full registry key is"SOFTWARE\WOW6432Node\OpenSSL-{major}.{minor}-{context}", where"{major}","{minor}"and"{context}"are OpenSSL's major version number, minor version number and the Windows install context, respectively.
For an unknown t, NULL is returned. (different energy from OpenSSL_version(), ik π)
OpenSSL_version_num() returns the value of OPENSSL_VERSION_NUMBER.
π RETURN VALUES π
OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch() return the version number parts as integers. numbers, bestie, actual numbers.
OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return the values of OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA respectively, as constant strings. For any of them that is undefined, the empty string is returned.
OpenSSL_version() returns constant strings.
π SEE ALSO π
π HISTORY π
The macros and functions described here were added in OpenSSL 3.0 β except for OPENSSL_VERSION_NUMBER and OpenSSL_version_num(), which are the ogs π«Ά.
The OPENSSL_ENGINES_DIR and OPENSSL_INFO_ENGINES_DIR strings are no longer supported and, for compatibility reasons, will always return values indicating that engine support was disabled.
The OPENSSL_ENGINES_DIR and OPENSSL_INFO_ENGINES_DIR strings were removed since OpenSSL 4.0.
The ENGINESDIR setting of the library is no longer supported since OpenSSL 4.0.
π BUGS π
not a glow-up moment: there was a discrepancy between this manual and commentary + code in <openssl/opensslv.h>, where the latter suggested that the four least significant bits of OPENSSL_VERSION_NUMBER could be 0x0f in released OpenSSL versions. yeah. we said what we said π
π COPYRIGHT π
Copyright 2018-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie β¨ this was OpenSSL 4.0.3, dated 2026-09-29, filed under OPENSSL_VERSION(3SSL) β go forth and version-check responsibly, ily ππ§π
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms