OPENSSL_VERSION(3ossl)
๐ OPENSSL_VERSION ๐
okay so bestie, welcome to the OPENSSL_VERSION(3ossl) page โ yes that's the OpenSSL manual, section 3, and it's literally all about how do I find out what version of OpenSSL I'm dealing with and what was it built with ๐ ngl this page is a whole vibe check for your library.
โจ NAME โจ
So like, this one page covers a lot of siblings, and they all live here together:
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 โ phew ๐ฎโ๐จ
and what do they all do? get OpenSSL version number and other information ๐โโ๏ธ that's it, that's the job.
๐ธ SYNOPSIS ๐ธ
like, here's the whole thing verbatim, no cap:
#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 ๐
okay so the big three: OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR and OPENSSL_VERSION_PATCH โ they represent the three parts of a version identifier, and that identifier is MAJOR.MINOR.PATCH โจ iconic format, we love.
OPENSSL_VERSION_PRE_RELEASE is that added bit of text that's like "hey this isn't the final version yet" โ for example "-dev" for an ongoing development snapshot, or "-alpha3" for an alpha release. and bestie, the value must be a string ๐
OPENSSL_VERSION_BUILD_METADATA is extra information that's reserved for other parties, like "+fips", or "+vendor.1". and here's the thing โ the OpenSSL project will not touch this macro (they leave it as an empty string). also the value must be a string ๐ซถ
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 for the longer version identifier string, which combines OPENSSL_VERSION_STR, OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA โ the whole squad together ๐
OPENSSL_VERSION_TEXT is a convenience macro for a full descriptive version text, which includes OPENSSL_FULL_VERSION_STR and the release date ๐
OPENSSL_VERSION_PREREQ is genuinely so useful โ it checks whether the OpenSSL version for the headers you're using 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. like a little bouncer at the club checking IDs ๐ฅ
OPENSSL_VERSION_NUMBER is a combination of the major, minor and patch version into a single integer 0xMNN00PP0L, where:
Mโ is the number fromOPENSSL_VERSION_MAJOR, in hexadecimal notationNNโ is the number fromOPENSSL_VERSION_MINOR, in hexadecimal notationPPโ is the number fromOPENSSL_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 โ i.e. what you actually got compiled, not what you wished for ๐ญ
OpenSSL_version() returns different strings depending on t, so listen up:
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"otherwiseOPENSSL_BUILT_ONโ the date of the build process, in the form"built on: ..."if available, or"built on: date not available"otherwise. and lowkey 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"otherwiseOPENSSL_DIRโ theOPENSSLDIRsetting of the library build, in the form"OPENSSLDIR: "...""if available, or"OPENSSLDIR: N/A"otherwiseOPENSSL_ENGINES_DIRโ theENGINESDIRsetting of the library build, in the form"ENGINESDIR: "...""if available, or"ENGINESDIR: N/A"otherwise. ๐จ heads up: this option is deprecated in OpenSSL 3.0OPENSSL_MODULES_DIRโ theMODULESDIRsetting of the library build, in the form"MODULESDIR: "...""if available, or"MODULESDIR: N/A"otherwiseOPENSSL_CPU_INFOโ the current OpenSSL cpu settings. this is the current setting of the cpu capability flags. it's 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 unknownt, the text"not available"is returned. rude but fair ๐
OPENSSL_info() also returns different strings depending on t:
OPENSSL_INFO_CONFIG_DIRโ the configured"OPENSSLDIR", which is the default location for OpenSSL configuration filesOPENSSL_INFO_ENGINES_DIRโ the configured"ENGINESDIR", which is the default location for OpenSSL enginesOPENSSL_INFO_MODULES_DIRโ the configured"MODULESDIR", which is the default location for dynamically loadable OpenSSL modules other than enginesOPENSSL_INFO_DSO_EXTENSIONโ the configured dynamically loadable module extensionOPENSSL_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 elementsOPENSSL_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's 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 unknownt,NULLis returned. โจ (different fromOpenSSL_version(), don't mix 'em up bestie)
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 ๐ข
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. that's it, don't try to free() them, i'm begging you ๐ญ
๐ SEE ALSO ๐
crypto(7)โ go read it, iykyk ๐ซถ
๐ HISTORY ๐
the macros and functions described here were added in OpenSSL 3.0, except for OPENSSL_VERSION_NUMBER and OpenSSL_version_num() โ those two are the OGs, they were here before ๐
๐ BUGS ๐
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. messy, but we're telling you about it โจ
๐ 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 3.5.6, dated 2026-04-07, OPENSSL_VERSION(3ossl) โ mwah, go check your versions, ily ๐โจ
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms