1.\" $OpenBSD: OPENSSL_VERSION_NUMBER.3,v 1.12 2019/06/06 01:06:58 schwarze Exp $
2.\" full merge up to: OpenSSL 1f13ad31 Dec 25 17:50:39 2017 +0800
3.\"
4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Ulf Moeller <ulf@openssl.org>,
22.\" Richard Levitte <levitte@openssl.org>, and
23.\" Bodo Moeller <bodo@openssl.org>.
24.\" Copyright (c) 2000, 2002, 2015, 2016, 2017 The OpenSSL Project.
25.\" All rights reserved.
26.\"
27.\" Redistribution and use in source and binary forms, with or without
28.\" modification, are permitted provided that the following conditions
29.\" are met:
30.\"
31.\" 1. Redistributions of source code must retain the above copyright
32.\"    notice, this list of conditions and the following disclaimer.
33.\"
34.\" 2. Redistributions in binary form must reproduce the above copyright
35.\"    notice, this list of conditions and the following disclaimer in
36.\"    the documentation and/or other materials provided with the
37.\"    distribution.
38.\"
39.\" 3. All advertising materials mentioning features or use of this
40.\"    software must display the following acknowledgment:
41.\"    "This product includes software developed by the OpenSSL Project
42.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
43.\"
44.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
45.\"    endorse or promote products derived from this software without
46.\"    prior written permission. For written permission, please contact
47.\"    openssl-core@openssl.org.
48.\"
49.\" 5. Products derived from this software may not be called "OpenSSL"
50.\"    nor may "OpenSSL" appear in their names without prior written
51.\"    permission of the OpenSSL Project.
52.\"
53.\" 6. Redistributions of any form whatsoever must retain the following
54.\"    acknowledgment:
55.\"    "This product includes software developed by the OpenSSL Project
56.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
57.\"
58.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
59.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
61.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
62.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
63.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
65.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
67.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\"
71.Dd $Mdocdate: June 6 2019 $
72.Dt OPENSSL_VERSION_NUMBER 3
73.Os
74.Sh NAME
75.Nm OPENSSL_VERSION_NUMBER ,
76.Nm LIBRESSL_VERSION_NUMBER ,
77.Nm LIBRESSL_VERSION_TEXT ,
78.Nm OPENSSL_VERSION_TEXT ,
79.Nm OpenSSL_version_num ,
80.Nm OpenSSL_version ,
81.Nm SSLeay ,
82.Nm SSLeay_version
83.Nd get OpenSSL version number
84.Sh SYNOPSIS
85.In openssl/opensslv.h
86.Fd #define OPENSSL_VERSION_NUMBER 0x020000000L
87.Fd #define LIBRESSL_VERSION_NUMBER 0x02nnnn00fL
88.Fd #define LIBRESSL_VERSION_TEXT \(dqLibreSSL 2.n.n\(dq
89.Fd #define OPENSSL_VERSION_TEXT LIBRESSL_VERSION_TEXT
90.In openssl/crypto.h
91.Ft unsigned long
92.Fn OpenSSL_version_num void
93.Ft const char *
94.Fo OpenSSL_version
95.Fa "int t"
96.Fc
97.Ft long
98.Fn SSLeay void
99.Ft const char *
100.Fo SSLeay_version
101.Fa "int t"
102.Fc
103.Sh DESCRIPTION
104.Dv OPENSSL_VERSION_NUMBER
105and
106.Dv LIBRESSL_VERSION_NUMBER
107are numeric release version identifiers.
108The first two digits contain the major release number,
109the third and fourth digits the minor release number,
110and the fifth and sixth digits the fix release number.
111For OpenSSL, the seventh and eight digits contain the patch release number
112and the final digit is 0 for development, 1 to e for betas 1 to 14, or f
113for release.
114For LibreSSL,
115.Dv OPENSSL_VERSION_NUMBER
116is always 0x020000000,
117and
118.Dv LIBRESSL_VERSION_NUMBER
119always ends with 00f.
120.Pp
121For example:
122.Bd -literal -offset indent
123OPENSSL_VERSION_NUMBER:
1240x000906000 == 0.9.6 dev
1250x000906023 == 0.9.6b beta 3
1260x00090605f == 0.9.6e release
1270x020000000 == 2.0.0 for any version of LibreSSL
128
129LIBRESSL_VERSION_NUMBER:
1300x02070000f == LibreSSL 2.7.0
131.Ed
132.Pp
133OpenSSL versions prior to 0.9.3 had identifiers < 0x0930.
134For versions between 0.9.3 and 0.9.5,
135the seventh digit was 1 for release and 0 otherwise,
136and the eighth and ninth digits were the patch release number.
137.Pp
138For example:
139.Bd -literal
1400x000904100 == 0.9.4 release
1410x000905000 == 0.9.5 dev
142.Ed
143.Pp
144OpenSSL version 0.9.5a had an interim interpretation that is like the current
145one, except the patch level got the highest bit set, to keep continuity.
146The number was therefore 0x0090581f.
147.Pp
148.Fn OpenSSL_version_num
149returns
150.Dv OPENSSL_VERSION_NUMBER .
151.Pp
152.Fn OpenSSL_version
153returns different strings depending on
154.Fa t :
155.Bl -tag -width Ds
156.It Dv OPENSSL_VERSION
157The text variant of the version number,
158.Dv OPENSSL_VERSION_TEXT .
159For OpenSSL, it includes the release date, for example
160.Qq OpenSSL 0.9.5a 1 Apr 2000 .
161For LibreSSL,
162.Dv LIBRESSL_VERSION_TEXT
163is returned.
164.It Dv OPENSSL_CFLAGS
165The compiler flags set for the compilation process in the form
166.Qq compiler: ...
167if available or
168.Qq compiler: information not available
169otherwise.
170LibreSSL never provides compiler information.
171.It Dv OPENSSL_BUILT_ON
172The date of the build process in the form
173.Qq built on: ...
174if available or
175.Qq built on: date not available
176otherwise.
177LibreSSL never provides information on the build date.
178.It Dv OPENSSL_PLATFORM
179The Configure target of the library build in the form
180.Qq platform: ...
181if available or
182.Qq platform: information not available
183otherwise.
184LibreSSL never provides platform information.
185.It Dv OPENSSL_DIR
186The
187.Dv OPENSSLDIR
188setting of the library build in the form
189.Qq OPENSSLDIR: Qq ...
190if available or
191.Qq OPENSSLDIR: N/A
192otherwise.
193For LibreSSL, the default is
194.Qq OPENSSLDIR: Qq /etc/ssl .
195.It Dv OPENSSL_ENGINES_DIR
196The
197.Dv ENGINESDIR
198setting of the library build in the form
199.Qq ENGINESDIR: Qq ...
200if available or
201.Qq ENGINESDIR: N/A
202otherwise.
203LibreSSL never provides or uses an
204.Dv ENGINESDIR .
205.El
206.Pp
207For an unknown
208.Fa t ,
209the text
210.Qq not available
211is returned.
212.Pp
213For backward compatibility,
214.Dv SSLEAY_VERSION_NUMBER
215is an alias for
216.Dv OPENSSL_VERSION_NUMBER
217and
218.Fn SSLeay
219for
220.Dv OpenSSL_version_num .
221The legacy function
222.Fn SSLeay_version
223is similar to
224.Fn OpenSSL_version
225except that it takes arguments
226.Dv SSLEAY_VERSION ,
227.Dv SSLEAY_CFLAGS ,
228.Dv SSLEAY_BUILT_ON ,
229.Dv SSLEAY_PLATFORM ,
230and
231.Dv SSLEAY_DIR
232which expand to
233.Em other
234numerical values than the corresponding
235.Dv OPENSSL_*
236macros.
237.Sh RETURN VALUES
238.Fn OpenSSL_version_num
239and
240.Fn SSLeay
241return a constant version number.
242.Pp
243.Fn OpenSSL_version
244and
245.Fn SSLeay_version
246return pointers to static strings.
247.Sh SEE ALSO
248.Xr crypto 3 ,
249.Xr OPENSSL_config 3
250.Sh HISTORY
251.Fn SSLeay ,
252.Fn SSLeay_version ,
253and
254.Dv SSLEAY_VERSION_NUMBER
255first appeared in SSLeay 0.6.0 and have been available since
256.Ox 2.4 .
257.Pp
258.Dv OPENSSL_VERSION_NUMBER
259first appeared in the first OpenSSL release, OpenSSL 0.9.1c,
260and has been available since
261.Ox 2.6 .
262.Pp
263.Dv SSLEAY_DIR
264first appeared in OpenSSL 0.9.7 and have been available since
265.Ox 3.2 .
266.Pp
267.Dv LIBRESSL_VERSION_NUMBER
268first appeared in LibreSSL 2.0.0 and
269.Ox 5.6
270and got its final format in LibreSSL 2.3.2 and
271.Ox 5.9 .
272.Dv LIBRESSL_VERSION_TEXT
273first appeared in LibreSSL 2.2.2 and
274.Ox 5.8 .
275.Pp
276.Fn OpenSSL_version_num
277and
278.Fn OpenSSL_version
279first appeared in OpenSSL 1.1.0
280and have been available since LibreSSL 2.7.1 and
281.Ox 6.3 .
282