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