5 OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH,
6 OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA,
7 OPENSSL_VERSION_PRE_RELEASE_STR, OPENSSL_VERSION_BUILD_METADATA_STR,
9 OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch,
10 OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version,
11 OPENSSL_VERSION_NUMBER, OpenSSL_version_num, OPENSSL_info
12 - get OpenSSL version number and other information
16 #include <openssl/opensslv.h>
18 #define OPENSSL_VERSION_MAJOR x
19 #define OPENSSL_VERSION_MINOR y
20 #define OPENSSL_VERSION_PATCH z
22 /* The definitions here are typical release values */
23 #undef OPENSSL_VERSION_PRE_RELEASE
24 #undef OPENSSL_VERSION_BUILD_METADATA
25 #define OPENSSL_VERSION_PRE_RELEASE_STR ""
26 #define OPENSSL_VERSION_BUILD_METADATA_STR ""
28 #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
30 unsigned int OPENSSL_version_major(void);
31 unsigned int OPENSSL_version_minor(void);
32 unsigned int OPENSSL_version_patch(void);
33 const char *OPENSSL_version_pre_release(void);
34 const char *OPENSSL_version_build_metadata(void);
36 #include <openssl/crypto.h>
38 const char *OpenSSL_version(int t);
40 const char *OPENSSL_info(int t);
44 /* from openssl/opensslv.h */
45 #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL
47 /* from openssl/crypto.h */
48 unsigned long OpenSSL_version_num();
54 The three macros B<OPENSSL_VERSION_MAJOR>, B<OPENSSL_VERSION_MINOR> and
55 B<OPENSSL_VERSION_PATCH> represent the three parts of a 3 numbered version
56 number, MAJOR.MINOR.PATCH.
58 The macro B<OPENSSL_VERSION_PRE_RELEASE> is an added bit of text that,
59 when defined, indicates that this is a pre-release version, such as
60 C<"-dev"> for an ongoing development snapshot, C<"-alpha3"> for an
62 The value must be a string.
64 The macro B<OPENSSL_VERSION_BUILD_METADATA> is extra metadata, reserved
65 for other parties (examples: C<"+fips">, C<"+vendor.1">).
66 The OpenSSL project will not touch this macro.
67 The value must be a string.
69 B<OPENSSL_VERSION_STR> is a convenience macro to get the short version
70 number string, "MAJOR.MINOR.PATCH".
72 B<OPENSSL_FULL_VERSION_STR> is a convenience macro to get the longer
73 version number string, which combines B<OPENSSL_VERSION_STR>,
74 B<OPENSSL_VERSION_PRE_RELEASE> and B<OPENSSL_VERSION_BUILD_METADATA>.
76 B<OPENSSL_VERSION_TEXT> is a convenience macro to get a full descriptive
77 version text, which includes B<OPENSSL_FULL_VERSION_STR> and the release
82 OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(),
83 OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return
84 the values of the macros above for the build of the library, respectively.
86 OpenSSL_version() returns different strings depending on B<t>:
92 The value of B<OPENSSL_VERSION_TEXT>
94 =item OPENSSL_VERSION_STRING
96 The value of B<OPENSSL_VERSION_STR>
98 =item OPENSSL_FULL_VERSION_STRING
100 The value of B<OPENSSL_FULL_VERSION_STR>
104 The compiler flags set for the compilation process in the form
105 "compiler: ..." if available or "compiler: information not available"
108 =item OPENSSL_BUILT_ON
110 The date of the build process in the form "built on: ..." if available
111 or "built on: date not available" otherwise.
113 =item OPENSSL_PLATFORM
115 The "Configure" target of the library build in the form "platform: ..."
116 if available or "platform: information not available" otherwise.
120 The "OPENSSLDIR" setting of the library build in the form "OPENSSLDIR: "...""
121 if available or "OPENSSLDIR: N/A" otherwise.
123 =item OPENSSL_ENGINES_DIR
125 The "ENGINESDIR" setting of the library build in the form "ENGINESDIR: "...""
126 if available or "ENGINESDIR: N/A" otherwise.
128 =item OPENSSL_MODULES_DIR
130 The "MODULESDIR" setting of the library build in the form "MODULESDIR: "...""
131 if available or "MODULESDIR: N/A" otherwise.
133 =item OPENSSL_CPU_INFO
135 The current OpenSSL cpu settings.
136 This is the current setting of the cpu capability flags. It is usually
137 automatically configured but may be set via an environment variable.
138 The value has the same syntax as the environment variable.
139 For x86 the string looks like "CPUINFO: OPENSSL_ia32cap=0x123:0x456".
140 Or "CPUINFO: N/A" if not available, e.g. no-asm build.
144 For an unknown B<t>, the text "not available" is returned.
146 OPENSSL_info() also returns different strings depending on B<t>:
150 =item OPENSSL_INFO_CONFIG_DIR
152 The configured C<OPENSSLDIR>, which is the default location for
153 OpenSSL configuration files.
155 =item OPENSSL_INFO_ENGINES_DIR
157 The configured C<ENGINESDIR>, which is the default location for
160 =item OPENSSL_INFO_MODULES_DIR
162 The configured C<MODULESDIR>, which is the default location for
163 dynamically loadable OpenSSL modules other than engines.
165 =item OPENSSL_INFO_DSO_EXTENSION
167 The configured dynamically loadable module extension.
169 =item OPENSSL_INFO_DIR_FILENAME_SEPARATOR
171 The separator between a directory specification and a file name.
172 Note that on some operating systems, this is not the same as the
173 separator between directory elements.
175 =item OPENSSL_INFO_LIST_SEPARATOR
177 The OpenSSL list separator.
178 This is typically used in strings that are lists of items, such as the
179 value of the environment variable C<$PATH> on Unix (where the
180 separator is ":") or C<%PATH%> on Windows (where the separator is
183 =item OPENSSL_INFO_CPU_SETTINGS
185 The current OpenSSL cpu settings.
186 This is the current setting of the cpu capability flags. It is usually
187 automatically configured but may be set via an environment variable.
188 The value has the same syntax as the environment variable.
189 For x86 the string looks like "OPENSSL_ia32cap=0x123:0x456".
193 For an unknown B<t>, NULL is returned.
195 =head1 BACKWARD COMPATIBILITY
197 For compatibility, some older macros and functions are retained or
199 They are all considered deprecated.
203 B<OPENSSL_VERSION_NUMBER> is a combination of the major, minor and
204 patch version into a single integer 0xMNN00PP0L, where:
210 is the number from B<OPENSSL_VERSION_MAJOR>, in hexadecimal notation
214 is the number from B<OPENSSL_VERSION_MINOR>, in hexadecimal notation
218 is the number from B<OPENSSL_VERSION_PATCH>, in hexadecimal notation
224 OpenSSL_version_num() returns the value of B<OPENSSL_VERSION_NUMBER>.
228 OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch()
229 return the version number parts as integers.
231 OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return
232 the values of B<OPENSSL_VERSION_PRE_RELEASE> and
233 B<OPENSSL_VERSION_BUILD_METADATA> respectively as constant strings.
234 For any of them that is undefined, the empty string is returned.
236 OpenSSL_version() returns constant strings.
244 The macros and functions described here were added in OpenSSL 3.0,
245 with the exception of the L</BACKWARD COMPATIBILITY> ones.
249 Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
251 Licensed under the Apache License 2.0 (the "License"). You may not use
252 this file except in compliance with the License. You can obtain a copy
253 in the file LICENSE in the source distribution or at
254 L<https://www.openssl.org/source/license.html>.