xref: /freebsd/crypto/openssl/doc/man3/OpenSSL_version.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncheryOPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH,
6*b077aed3SPierre ProncheryOPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA,
7*b077aed3SPierre ProncheryOPENSSL_VERSION_TEXT, OPENSSL_VERSION_PREREQ, OPENSSL_version_major,
8*b077aed3SPierre ProncheryOPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release,
9*b077aed3SPierre ProncheryOPENSSL_version_build_metadata, OpenSSL_version, OPENSSL_VERSION_NUMBER,
10*b077aed3SPierre ProncheryOpenSSL_version_num, OPENSSL_info
11*b077aed3SPierre Pronchery- get OpenSSL version number and other information
12*b077aed3SPierre Pronchery
13*b077aed3SPierre Pronchery=head1 SYNOPSIS
14*b077aed3SPierre Pronchery
15*b077aed3SPierre Pronchery #include <openssl/opensslv.h>
16*b077aed3SPierre Pronchery
17*b077aed3SPierre Pronchery #define OPENSSL_VERSION_MAJOR  x
18*b077aed3SPierre Pronchery #define OPENSSL_VERSION_MINOR  y
19*b077aed3SPierre Pronchery #define OPENSSL_VERSION_PATCH  z
20*b077aed3SPierre Pronchery
21*b077aed3SPierre Pronchery /* The definitions here are typical release values */
22*b077aed3SPierre Pronchery #define OPENSSL_VERSION_PRE_RELEASE ""
23*b077aed3SPierre Pronchery #define OPENSSL_VERSION_BUILD_METADATA ""
24*b077aed3SPierre Pronchery
25*b077aed3SPierre Pronchery #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
26*b077aed3SPierre Pronchery
27*b077aed3SPierre Pronchery #define OPENSSL_VERSION_PREREQ(maj,min)
28*b077aed3SPierre Pronchery
29*b077aed3SPierre Pronchery #include <openssl/crypto.h>
30*b077aed3SPierre Pronchery
31*b077aed3SPierre Pronchery unsigned int OPENSSL_version_major(void);
32*b077aed3SPierre Pronchery unsigned int OPENSSL_version_minor(void);
33*b077aed3SPierre Pronchery unsigned int OPENSSL_version_patch(void);
34*b077aed3SPierre Pronchery const char *OPENSSL_version_pre_release(void);
35*b077aed3SPierre Pronchery const char *OPENSSL_version_build_metadata(void);
36*b077aed3SPierre Pronchery
37*b077aed3SPierre Pronchery const char *OpenSSL_version(int t);
38*b077aed3SPierre Pronchery
39*b077aed3SPierre Pronchery const char *OPENSSL_info(int t);
40*b077aed3SPierre Pronchery
41*b077aed3SPierre Pronchery /* from openssl/opensslv.h */
42*b077aed3SPierre Pronchery #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnL
43*b077aed3SPierre Pronchery
44*b077aed3SPierre Pronchery /* from openssl/crypto.h */
45*b077aed3SPierre Pronchery unsigned long OpenSSL_version_num();
46*b077aed3SPierre Pronchery
47*b077aed3SPierre Pronchery=head1 DESCRIPTION
48*b077aed3SPierre Pronchery
49*b077aed3SPierre Pronchery=head2 Macros
50*b077aed3SPierre Pronchery
51*b077aed3SPierre ProncheryThe three macros B<OPENSSL_VERSION_MAJOR>, B<OPENSSL_VERSION_MINOR> and
52*b077aed3SPierre ProncheryB<OPENSSL_VERSION_PATCH> represent the three parts of a version
53*b077aed3SPierre Proncheryidentifier, B<I<MAJOR>.I<MINOR>.I<PATCH>>.
54*b077aed3SPierre Pronchery
55*b077aed3SPierre ProncheryThe macro B<OPENSSL_VERSION_PRE_RELEASE> is an added bit of text that
56*b077aed3SPierre Proncheryindicates that this is a pre-release version, such as C<"-dev"> for an
57*b077aed3SPierre Proncheryongoing development snapshot or C<"-alpha3"> for an alpha release.
58*b077aed3SPierre ProncheryThe value must be a string.
59*b077aed3SPierre Pronchery
60*b077aed3SPierre ProncheryThe macro B<OPENSSL_VERSION_BUILD_METADATA> is extra information, reserved
61*b077aed3SPierre Proncheryfor other parties, such as C<"+fips">, or C<"+vendor.1">).
62*b077aed3SPierre ProncheryThe OpenSSL project will not touch this macro (will leave it an empty string).
63*b077aed3SPierre ProncheryThe value must be a string.
64*b077aed3SPierre Pronchery
65*b077aed3SPierre ProncheryB<OPENSSL_VERSION_STR> is a convenience macro to get the short version
66*b077aed3SPierre Proncheryidentifier string, C<"I<MAJOR>.I<MINOR>.I<PATCH>">.
67*b077aed3SPierre Pronchery
68*b077aed3SPierre ProncheryB<OPENSSL_FULL_VERSION_STR> is a convenience macro to get the longer
69*b077aed3SPierre Proncheryversion identifier string, which combines B<OPENSSL_VERSION_STR>,
70*b077aed3SPierre ProncheryB<OPENSSL_VERSION_PRE_RELEASE> and B<OPENSSL_VERSION_BUILD_METADATA>.
71*b077aed3SPierre Pronchery
72*b077aed3SPierre ProncheryB<OPENSSL_VERSION_TEXT> is a convenience macro to get a full descriptive
73*b077aed3SPierre Proncheryversion text, which includes B<OPENSSL_FULL_VERSION_STR> and the release
74*b077aed3SPierre Proncherydate.
75*b077aed3SPierre Pronchery
76*b077aed3SPierre ProncheryB<OPENSSL_VERSION_PREREQ> is a useful macro for checking whether the OpenSSL
77*b077aed3SPierre Proncheryversion for the headers in use is at least at the given pre-requisite major
78*b077aed3SPierre Pronchery(B<maj>) and minor (B<min>) number or not. It will evaluate to true if the
79*b077aed3SPierre Proncheryheader version number (B<OPENSSL_VERSION_MAJOR>.B<OPENSSL_VERSION_MINOR>) is
80*b077aed3SPierre Proncherygreater than or equal to B<maj>.B<min>.
81*b077aed3SPierre Pronchery
82*b077aed3SPierre ProncheryB<OPENSSL_VERSION_NUMBER> is a combination of the major, minor and
83*b077aed3SPierre Proncherypatch version into a single integer 0xMNN00PP0L, where:
84*b077aed3SPierre Pronchery
85*b077aed3SPierre Pronchery=over 4
86*b077aed3SPierre Pronchery
87*b077aed3SPierre Pronchery=item M
88*b077aed3SPierre Pronchery
89*b077aed3SPierre Proncheryis the number from B<OPENSSL_VERSION_MAJOR>, in hexadecimal notation
90*b077aed3SPierre Pronchery
91*b077aed3SPierre Pronchery=item NN
92*b077aed3SPierre Pronchery
93*b077aed3SPierre Proncheryis the number from B<OPENSSL_VERSION_MINOR>, in hexadecimal notation
94*b077aed3SPierre Pronchery
95*b077aed3SPierre Pronchery=item PP
96*b077aed3SPierre Pronchery
97*b077aed3SPierre Proncheryis the number from B<OPENSSL_VERSION_PATCH>, in hexadecimal notation
98*b077aed3SPierre Pronchery
99*b077aed3SPierre Pronchery=back
100*b077aed3SPierre Pronchery
101*b077aed3SPierre Pronchery=head2 Functions
102*b077aed3SPierre Pronchery
103*b077aed3SPierre ProncheryOPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(),
104*b077aed3SPierre ProncheryOPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return
105*b077aed3SPierre Proncherythe values of the macros above for the build of the library, respectively.
106*b077aed3SPierre Pronchery
107*b077aed3SPierre ProncheryOpenSSL_version() returns different strings depending on I<t>:
108*b077aed3SPierre Pronchery
109*b077aed3SPierre Pronchery=over 4
110*b077aed3SPierre Pronchery
111*b077aed3SPierre Pronchery=item OPENSSL_VERSION
112*b077aed3SPierre Pronchery
113*b077aed3SPierre ProncheryThe value of B<OPENSSL_VERSION_TEXT>
114*b077aed3SPierre Pronchery
115*b077aed3SPierre Pronchery=item OPENSSL_VERSION_STRING
116*b077aed3SPierre Pronchery
117*b077aed3SPierre ProncheryThe value of B<OPENSSL_VERSION_STR>
118*b077aed3SPierre Pronchery
119*b077aed3SPierre Pronchery=item OPENSSL_FULL_VERSION_STRING
120*b077aed3SPierre Pronchery
121*b077aed3SPierre ProncheryThe value of B<OPENSSL_FULL_VERSION_STR>
122*b077aed3SPierre Pronchery
123*b077aed3SPierre Pronchery=item OPENSSL_CFLAGS
124*b077aed3SPierre Pronchery
125*b077aed3SPierre ProncheryThe compiler flags set for the compilation process in the form
126*b077aed3SPierre ProncheryC<compiler: ...>  if available, or C<compiler: information not available>
127*b077aed3SPierre Proncheryotherwise.
128*b077aed3SPierre Pronchery
129*b077aed3SPierre Pronchery=item OPENSSL_BUILT_ON
130*b077aed3SPierre Pronchery
131*b077aed3SPierre ProncheryThe date of the build process in the form C<built on: ...> if available
132*b077aed3SPierre Proncheryor C<built on: date not available> otherwise.
133*b077aed3SPierre ProncheryThe date would not be available in a reproducible build, for example.
134*b077aed3SPierre Pronchery
135*b077aed3SPierre Pronchery=item OPENSSL_PLATFORM
136*b077aed3SPierre Pronchery
137*b077aed3SPierre ProncheryThe "Configure" target of the library build in the form C<platform: ...>
138*b077aed3SPierre Proncheryif available, or C<platform: information not available> otherwise.
139*b077aed3SPierre Pronchery
140*b077aed3SPierre Pronchery=item OPENSSL_DIR
141*b077aed3SPierre Pronchery
142*b077aed3SPierre ProncheryThe B<OPENSSLDIR> setting of the library build in the form C<OPENSSLDIR: "...">
143*b077aed3SPierre Proncheryif available, or C<OPENSSLDIR: N/A> otherwise.
144*b077aed3SPierre Pronchery
145*b077aed3SPierre Pronchery=item OPENSSL_ENGINES_DIR
146*b077aed3SPierre Pronchery
147*b077aed3SPierre ProncheryThe B<ENGINESDIR> setting of the library build in the form C<ENGINESDIR: "...">
148*b077aed3SPierre Proncheryif available, or C<ENGINESDIR: N/A> otherwise. This option is deprecated in
149*b077aed3SPierre ProncheryOpenSSL 3.0.
150*b077aed3SPierre Pronchery
151*b077aed3SPierre Pronchery=item OPENSSL_MODULES_DIR
152*b077aed3SPierre Pronchery
153*b077aed3SPierre ProncheryThe B<MODULESDIR> setting of the library build in the form C<MODULESDIR: "...">
154*b077aed3SPierre Proncheryif available, or C<MODULESDIR: N/A> otherwise.
155*b077aed3SPierre Pronchery
156*b077aed3SPierre Pronchery=item OPENSSL_CPU_INFO
157*b077aed3SPierre Pronchery
158*b077aed3SPierre ProncheryThe current OpenSSL cpu settings.
159*b077aed3SPierre ProncheryThis is the current setting of the cpu capability flags. It is usually
160*b077aed3SPierre Proncheryautomatically configured but may be set via an environment variable.
161*b077aed3SPierre ProncheryThe value has the same syntax as the environment variable.
162*b077aed3SPierre ProncheryFor x86 the string looks like C<CPUINFO: OPENSSL_ia32cap=0x123:0x456>
163*b077aed3SPierre Proncheryor C<CPUINFO: N/A> if not available.
164*b077aed3SPierre Pronchery
165*b077aed3SPierre Pronchery=back
166*b077aed3SPierre Pronchery
167*b077aed3SPierre ProncheryFor an unknown I<t>, the text C<not available> is returned.
168*b077aed3SPierre Pronchery
169*b077aed3SPierre ProncheryOPENSSL_info() also returns different strings depending on I<t>:
170*b077aed3SPierre Pronchery
171*b077aed3SPierre Pronchery=over 4
172*b077aed3SPierre Pronchery
173*b077aed3SPierre Pronchery=item OPENSSL_INFO_CONFIG_DIR
174*b077aed3SPierre Pronchery
175*b077aed3SPierre ProncheryThe configured C<OPENSSLDIR>, which is the default location for
176*b077aed3SPierre ProncheryOpenSSL configuration files.
177*b077aed3SPierre Pronchery
178*b077aed3SPierre Pronchery=item OPENSSL_INFO_ENGINES_DIR
179*b077aed3SPierre Pronchery
180*b077aed3SPierre ProncheryThe configured C<ENGINESDIR>, which is the default location for
181*b077aed3SPierre ProncheryOpenSSL engines.
182*b077aed3SPierre Pronchery
183*b077aed3SPierre Pronchery=item OPENSSL_INFO_MODULES_DIR
184*b077aed3SPierre Pronchery
185*b077aed3SPierre ProncheryThe configured C<MODULESDIR>, which is the default location for
186*b077aed3SPierre Proncherydynamically loadable OpenSSL modules other than engines.
187*b077aed3SPierre Pronchery
188*b077aed3SPierre Pronchery=item OPENSSL_INFO_DSO_EXTENSION
189*b077aed3SPierre Pronchery
190*b077aed3SPierre ProncheryThe configured dynamically loadable module extension.
191*b077aed3SPierre Pronchery
192*b077aed3SPierre Pronchery=item OPENSSL_INFO_DIR_FILENAME_SEPARATOR
193*b077aed3SPierre Pronchery
194*b077aed3SPierre ProncheryThe separator between a directory specification and a filename.
195*b077aed3SPierre ProncheryNote that on some operating systems, this is not the same as the
196*b077aed3SPierre Proncheryseparator between directory elements.
197*b077aed3SPierre Pronchery
198*b077aed3SPierre Pronchery=item OPENSSL_INFO_LIST_SEPARATOR
199*b077aed3SPierre Pronchery
200*b077aed3SPierre ProncheryThe OpenSSL list separator.
201*b077aed3SPierre ProncheryThis is typically used in strings that are lists of items, such as the
202*b077aed3SPierre Proncheryvalue of the environment variable C<$PATH> on Unix (where the
203*b077aed3SPierre Proncheryseparator is C<:>) or C<%PATH%> on Windows (where the separator is
204*b077aed3SPierre ProncheryC<;>).
205*b077aed3SPierre Pronchery
206*b077aed3SPierre Pronchery=item OPENSSL_INFO_CPU_SETTINGS
207*b077aed3SPierre Pronchery
208*b077aed3SPierre ProncheryThe current OpenSSL cpu settings.
209*b077aed3SPierre ProncheryThis is the current setting of the cpu capability flags. It is usually
210*b077aed3SPierre Proncheryautomatically configured but may be set via an environment variable.
211*b077aed3SPierre ProncheryThe value has the same syntax as the environment variable.
212*b077aed3SPierre ProncheryFor x86 the string looks like C<OPENSSL_ia32cap=0x123:0x456>.
213*b077aed3SPierre Pronchery
214*b077aed3SPierre Pronchery=back
215*b077aed3SPierre Pronchery
216*b077aed3SPierre ProncheryFor an unknown I<t>, NULL is returned.
217*b077aed3SPierre Pronchery
218*b077aed3SPierre ProncheryOpenSSL_version_num() returns the value of B<OPENSSL_VERSION_NUMBER>.
219*b077aed3SPierre Pronchery
220*b077aed3SPierre Pronchery=head1 RETURN VALUES
221*b077aed3SPierre Pronchery
222*b077aed3SPierre ProncheryOPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch()
223*b077aed3SPierre Proncheryreturn the version number parts as integers.
224*b077aed3SPierre Pronchery
225*b077aed3SPierre ProncheryOPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return
226*b077aed3SPierre Proncherythe values of B<OPENSSL_VERSION_PRE_RELEASE> and
227*b077aed3SPierre ProncheryB<OPENSSL_VERSION_BUILD_METADATA> respectively as constant strings.
228*b077aed3SPierre ProncheryFor any of them that is undefined, the empty string is returned.
229*b077aed3SPierre Pronchery
230*b077aed3SPierre ProncheryOpenSSL_version() returns constant strings.
231*b077aed3SPierre Pronchery
232*b077aed3SPierre Pronchery=head1 SEE ALSO
233*b077aed3SPierre Pronchery
234*b077aed3SPierre ProncheryL<crypto(7)>
235*b077aed3SPierre Pronchery
236*b077aed3SPierre Pronchery=head1 HISTORY
237*b077aed3SPierre Pronchery
238*b077aed3SPierre ProncheryThe macros and functions described here were added in OpenSSL 3.0,
239*b077aed3SPierre Proncheryexcept for OPENSSL_VERSION_NUMBER and OpenSSL_version_num().
240*b077aed3SPierre Pronchery
241*b077aed3SPierre Pronchery=head1 COPYRIGHT
242*b077aed3SPierre Pronchery
243*b077aed3SPierre ProncheryCopyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
244*b077aed3SPierre Pronchery
245*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
246*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
247*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
248*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
249*b077aed3SPierre Pronchery
250*b077aed3SPierre Pronchery=cut
251