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