Update source files for pre-3.0 deprecation
[openssl.git] / include / openssl / opensslv.h.in
1 /*
2  * {- join("\n * ", @autowarntext) -}
3  *
4  * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
5  *
6  * Licensed under the Apache License 2.0 (the "License").  You may not use
7  * this file except in compliance with the License.  You can obtain a copy
8  * in the file LICENSE in the source distribution or at
9  * https://www.openssl.org/source/license.html
10  */
11
12 #ifndef OPENSSL_OPENSSLV_H
13 # define OPENSSL_OPENSSLV_H
14 # pragma once
15
16 # include <openssl/macros.h>
17 # if !OPENSSL_API_3
18 #  define HEADER_OPENSSLV_H
19 # endif
20
21 # ifdef  __cplusplus
22 extern "C" {
23 # endif
24
25 /*
26  * SECTION 1: VERSION DATA.  These will change for each release
27  */
28
29 /*
30  * Base version macros
31  *
32  * These macros express version number MAJOR.MINOR.PATCH exactly
33  */
34 # define OPENSSL_VERSION_MAJOR  {- $config{major} -}
35 # define OPENSSL_VERSION_MINOR  {- $config{minor} -}
36 # define OPENSSL_VERSION_PATCH  {- $config{patch} -}
37
38 /*
39  * Additional version information, defined only when used.
40  *
41  * These are also part of the new version scheme, but aren't part
42  * of the version number itself.
43  */
44
45 /* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */
46 {- $config{prerelease}
47     ? << "_____"
48 # define OPENSSL_VERSION_PRE_RELEASE "$config{prerelease}"
49 _____
50     : << "_____"
51 # undef OPENSSL_VERSION_PRE_RELEASE
52 _____
53 -}
54 /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */
55 /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */
56 {- $build_metadata
57     ? << "_____"
58 # define OPENSSL_VERSION_BUILD_METADATA "{- $config{build_metadata} -}"
59 _____
60     : << "_____"
61 # undef OPENSSL_VERSION_BUILD_METADATA
62 _____
63 -}
64
65 /*
66  * Note: OPENSSL_VERSION_BUILD_METADATA will never be defined by
67  * the OpenSSL Project, it's entirely reserved for others vendors
68  */
69
70 /*
71  * Absolute string versions of OPENSSL_VERSION_PRE_RELEASE and
72  * OPENSSL_VERSION_BUILD_METADATA.  As opposed to those, which
73  * may be undefined, these are guaranteed to have strings as
74  * values.
75  */
76
77 # ifdef OPENSSL_VERSION_PRE_RELEASE
78 #  define OPENSSL_VERSION_PRE_RELEASE_STR OPENSSL_VERSION_PRE_RELEASE
79 # else
80 #  define OPENSSL_VERSION_PRE_RELEASE_STR ""
81 # endif
82 # ifdef OPENSSL_VERSION_BUILD_METADATA
83 #  define OPENSSL_VERSION_BUILD_METADATA_STR OPENSSL_VERSION_BUILD_METADATA
84 # else
85 #  define OPENSSL_VERSION_BUILD_METADATA_STR ""
86 # endif
87
88 /*
89  * Shared library version
90  *
91  * This is strictly to express ABI version, which may or may not
92  * be related to the API version expressed with the macros above.
93  * This is defined in free form.
94  */
95 # define OPENSSL_SHLIB_VERSION {- $config{shlib_version} -}
96
97 /*
98  * SECTION 2: USEFUL MACROS AND FUNCTIONS
99  */
100
101 /* For checking general API compatibility when preprocessing */
102 # define OPENSSL_VERSION_PREREQ(maj,min)                                \
103     ((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
104
105 /*
106  * Macros to get the version in easily digested string form, both the short
107  * "MAJOR.MINOR.PATCH" variant (where MAJOR, MINOR and PATCH are replaced
108  * with the values from the corresponding OPENSSL_VERSION_ macros) and the
109  * longer variant with OPENSSL_VERSION_PRE_RELEASE_STR and
110  * OPENSSL_VERSION_BUILD_METADATA_STR appended.
111  */
112 # define OPENSSL_VERSION_STR "{- $config{version} -}"
113 # define OPENSSL_FULL_VERSION_STR "{- $config{full_version} -}"
114
115 /*
116  * SECTION 3: ADDITIONAL METADATA
117  *
118  * These strings are defined separately to allow them to be parsable.
119  */
120 # define OPENSSL_RELEASE_DATE "{- $config{release_date} -}"
121 # define OPENSSL_VERSION_TEXT "OpenSSL {- "$config{full_version} $config{release_date}" -}"
122
123 /*
124  * SECTION 4: BACKWARD COMPATIBILITY
125  */
126 /* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */
127 # ifdef OPENSSL_VERSION_PRE_RELEASE
128 #  define _OPENSSL_VERSION_PRE_RELEASE 0x0
129 # else
130 #  define _OPENSSL_VERSION_PRE_RELEASE 0xf
131 # endif
132 # define OPENSSL_VERSION_NUMBER          \
133     ( (OPENSSL_VERSION_MAJOR<<28)        \
134       |(OPENSSL_VERSION_MINOR<<20)       \
135       |(OPENSSL_VERSION_PATCH<<4)        \
136       |_OPENSSL_VERSION_PRE_RELEASE )
137
138 # ifdef  __cplusplus
139 }
140 # endif
141 #endif                          /* OPENSSL_OPENSSLV_H */