Fix some wording and markup
[openssl.git] / doc / man3 / OpenSSL_version.pod
1 =pod
2
3 =head1 NAME
4
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,
8 OPENSSL_VERSION_TEXT,
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
13
14 =head1 SYNOPSIS
15
16  #include <openssl/opensslv.h>
17
18  #define OPENSSL_VERSION_MAJOR  x
19  #define OPENSSL_VERSION_MINOR  y
20  #define OPENSSL_VERSION_PATCH  z
21
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 ""
27
28  #define OPENSSL_VERSION_TEXT "OpenSSL x.y.z xx XXX xxxx"
29
30  #include <openssl/crypto.h>
31
32  unsigned int OPENSSL_version_major(void);
33  unsigned int OPENSSL_version_minor(void);
34  unsigned int OPENSSL_version_patch(void);
35  const char *OPENSSL_version_pre_release(void);
36  const char *OPENSSL_version_build_metadata(void);
37
38  const char *OpenSSL_version(int t);
39
40  const char *OPENSSL_info(int t);
41
42 Deprecated:
43
44  /* from openssl/opensslv.h */
45  #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL
46
47  /* from openssl/crypto.h */
48  unsigned long OpenSSL_version_num();
49
50 =head1 DESCRIPTION
51
52 =head2 Macros
53
54 The three macros B<OPENSSL_VERSION_MAJOR>, B<OPENSSL_VERSION_MINOR> and
55 B<OPENSSL_VERSION_PATCH> represent the three parts of a version
56 identifier, B<I<MAJOR>.I<MINOR>.I<PATCH>>.
57
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 or C<"-alpha3"> for an
61 alpha release.
62 The value must be a string.
63
64 The macro B<OPENSSL_VERSION_BUILD_METADATA> is extra information, reserved
65 for other parties, such as C<"+fips">, or C<"+vendor.1">.
66 The OpenSSL project will not touch this macro.
67 The value must be a string.
68
69 B<OPENSSL_VERSION_STR> is a convenience macro to get the short version
70 identifier string, C<"I<MAJOR>.I<MINOR>.I<PATCH>">.
71
72 B<OPENSSL_FULL_VERSION_STR> is a convenience macro to get the longer
73 version identifier string, which combines B<OPENSSL_VERSION_STR>,
74 B<OPENSSL_VERSION_PRE_RELEASE> and B<OPENSSL_VERSION_BUILD_METADATA>.
75
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
78 date.
79
80 =head2 Functions
81
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.
85
86 OpenSSL_version() returns different strings depending on I<t>:
87
88 =over 4
89
90 =item OPENSSL_VERSION
91
92 The value of B<OPENSSL_VERSION_TEXT>
93
94 =item OPENSSL_VERSION_STRING
95
96 The value of B<OPENSSL_VERSION_STR>
97
98 =item OPENSSL_FULL_VERSION_STRING
99
100 The value of B<OPENSSL_FULL_VERSION_STR>
101
102 =item OPENSSL_CFLAGS
103
104 The compiler flags set for the compilation process in the form
105 C<compiler: ...>  if available, or C<compiler: information not available>
106 otherwise.
107
108 =item OPENSSL_BUILT_ON
109
110 The date of the build process in the form C<built on: ...> if available
111 or C<built on: date not available> otherwise.
112 The date would not be available in a reproducible build, for example.
113
114 =item OPENSSL_PLATFORM
115
116 The "Configure" target of the library build in the form C<platform: ...>
117 if available, or C<platform: information not available> otherwise.
118
119 =item OPENSSL_DIR
120
121 The B<OPENSSLDIR> setting of the library build in the form C<OPENSSLDIR: "...">
122 if available, or C<OPENSSLDIR: N/A> otherwise.
123
124 =item OPENSSL_ENGINES_DIR
125
126 The B<ENGINESDIR> setting of the library build in the form C<ENGINESDIR: "...">
127 if available, or C<ENGINESDIR: N/A> otherwise.
128
129 =item OPENSSL_MODULES_DIR
130
131 The B<MODULESDIR> setting of the library build in the form C<MODULESDIR: "...">
132 if available, or C<MODULESDIR: N/A> otherwise.
133
134 =item OPENSSL_CPU_INFO
135
136 The current OpenSSL cpu settings.
137 This is the current setting of the cpu capability flags. It is usually
138 automatically configured but may be set via an environment variable.
139 The value has the same syntax as the environment variable.
140 For x86 the string looks like C<CPUINFO: OPENSSL_ia32cap=0x123:0x456>.
141 Or C<CPUINFO: N/A> if not available, such as when configured with B<no-asm>.
142
143 =back
144
145 For an unknown I<t>, the text C<not available> is returned.
146
147 OPENSSL_info() also returns different strings depending on I<t>:
148
149 =over 4
150
151 =item OPENSSL_INFO_CONFIG_DIR
152
153 The configured C<OPENSSLDIR>, which is the default location for
154 OpenSSL configuration files.
155
156 =item OPENSSL_INFO_ENGINES_DIR
157
158 The configured C<ENGINESDIR>, which is the default location for
159 OpenSSL engines.
160
161 =item OPENSSL_INFO_MODULES_DIR
162
163 The configured C<MODULESDIR>, which is the default location for
164 dynamically loadable OpenSSL modules other than engines.
165
166 =item OPENSSL_INFO_DSO_EXTENSION
167
168 The configured dynamically loadable module extension.
169
170 =item OPENSSL_INFO_DIR_FILENAME_SEPARATOR
171
172 The separator between a directory specification and a filename.
173 Note that on some operating systems, this is not the same as the
174 separator between directory elements.
175
176 =item OPENSSL_INFO_LIST_SEPARATOR
177
178 The OpenSSL list separator.
179 This is typically used in strings that are lists of items, such as the
180 value of the environment variable C<$PATH> on Unix (where the
181 separator is C<:>) or C<%PATH%> on Windows (where the separator is
182 C<;>).
183
184 =item OPENSSL_INFO_CPU_SETTINGS
185
186 The current OpenSSL cpu settings.
187 This is the current setting of the cpu capability flags. It is usually
188 automatically configured but may be set via an environment variable.
189 The value has the same syntax as the environment variable.
190 For x86 the string looks like C<OPENSSL_ia32cap=0x123:0x456>.
191
192 =back
193
194 For an unknown I<t>, NULL is returned.
195
196 =head1 BACKWARD COMPATIBILITY
197
198 For compatibility, some older macros and functions are retained or
199 synthesised.
200 They are all considered deprecated.
201
202 =head2 Macros
203
204 B<OPENSSL_VERSION_NUMBER> is a combination of the major, minor and
205 patch version into a single integer 0xMNN00PP0L, where:
206
207 =over 4
208
209 =item M
210
211 is the number from B<OPENSSL_VERSION_MAJOR>, in hexadecimal notation
212
213 =item NN
214
215 is the number from B<OPENSSL_VERSION_MINOR>, in hexadecimal notation
216
217 =item PP
218
219 is the number from B<OPENSSL_VERSION_PATCH>, in hexadecimal notation
220
221 =back
222
223 =head2 Functions
224
225 OpenSSL_version_num() returns the value of B<OPENSSL_VERSION_NUMBER>.
226
227 =head1 RETURN VALUES
228
229 OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch()
230 return the version number parts as integers.
231
232 OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return
233 the values of B<OPENSSL_VERSION_PRE_RELEASE> and
234 B<OPENSSL_VERSION_BUILD_METADATA> respectively as constant strings.
235 For any of them that is undefined, the empty string is returned.
236
237 OpenSSL_version() returns constant strings.
238
239 =head1 SEE ALSO
240
241 L<crypto(7)>
242
243 =head1 HISTORY
244
245 The macros and functions described here were added in OpenSSL 3.0,
246 with the exception of the L</BACKWARD COMPATIBILITY> ones.
247
248 =head1 COPYRIGHT
249
250 Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
251
252 Licensed under the Apache License 2.0 (the "License").  You may not use
253 this file except in compliance with the License.  You can obtain a copy
254 in the file LICENSE in the source distribution or at
255 L<https://www.openssl.org/source/license.html>.
256
257 =cut