2 * {- join("\n * ", @autowarntext) -}
4 * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
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
12 #ifndef OPENSSL_OPENSSLV_H
13 # define OPENSSL_OPENSSLV_H
16 # include <openssl/macros.h>
18 # define HEADER_OPENSSLV_H
26 * SECTION 1: VERSION DATA. These will change for each release
32 * These macros express version number MAJOR.MINOR.PATCH exactly
34 # define OPENSSL_VERSION_MAJOR {- $config{major} -}
35 # define OPENSSL_VERSION_MINOR {- $config{minor} -}
36 # define OPENSSL_VERSION_PATCH {- $config{patch} -}
39 * Additional version information, defined only when used.
41 * These are also part of the new version scheme, but aren't part
42 * of the version number itself.
45 /* Could be: #define OPENSSL_VERSION_PRE_RELEASE "-alpha.1" */
46 {- $config{prerelease}
48 # define OPENSSL_VERSION_PRE_RELEASE "$config{prerelease}"
51 # undef OPENSSL_VERSION_PRE_RELEASE
54 /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */
55 /* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */
58 # define OPENSSL_VERSION_BUILD_METADATA "{- $config{build_metadata} -}"
61 # undef OPENSSL_VERSION_BUILD_METADATA
66 * Note: OPENSSL_VERSION_BUILD_METADATA will never be defined by
67 * the OpenSSL Project, it's entirely reserved for others vendors
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
77 # ifdef OPENSSL_VERSION_PRE_RELEASE
78 # define OPENSSL_VERSION_PRE_RELEASE_STR OPENSSL_VERSION_PRE_RELEASE
80 # define OPENSSL_VERSION_PRE_RELEASE_STR ""
82 # ifdef OPENSSL_VERSION_BUILD_METADATA
83 # define OPENSSL_VERSION_BUILD_METADATA_STR OPENSSL_VERSION_BUILD_METADATA
85 # define OPENSSL_VERSION_BUILD_METADATA_STR ""
89 * Shared library version
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.
95 # define OPENSSL_SHLIB_VERSION {- $config{shlib_version} -}
98 * SECTION 2: USEFUL MACROS AND FUNCTIONS
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))
106 * These return the values of OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR,
107 * OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE and
108 * OPENSSL_VERSION_BUILD_METADATA, respectively.
110 unsigned int OPENSSL_version_major(void);
111 unsigned int OPENSSL_version_minor(void);
112 unsigned int OPENSSL_version_patch(void);
113 const char *OPENSSL_version_pre_release(void);
114 const char *OPENSSL_version_build_metadata(void);
117 * Macros to get the version in easily digested string form, both the short
118 * "MAJOR.MINOR.PATCH" variant (where MAJOR, MINOR and PATCH are replaced
119 * with the values from the corresponding OPENSSL_VERSION_ macros) and the
120 * longer variant with OPENSSL_VERSION_PRE_RELEASE_STR and
121 * OPENSSL_VERSION_BUILD_METADATA_STR appended.
123 # define OPENSSL_VERSION_STR "{- $config{version} -}"
124 # define OPENSSL_FULL_VERSION_STR "{- $config{full_version} -}"
127 * SECTION 3: ADDITIONAL METADATA
129 * These strings are defined separately to allow them to be parsable.
131 # define OPENSSL_RELEASE_DATE "{- $config{release_date} -}"
132 # define OPENSSL_VERSION_TEXT "OpenSSL {- "$config{full_version} $config{release_date}" -}"
135 * SECTION 4: BACKWARD COMPATIBILITY
137 /* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */
138 # ifdef OPENSSL_VERSION_PRE_RELEASE
139 # define _OPENSSL_VERSION_PRE_RELEASE 0x0
141 # define _OPENSSL_VERSION_PRE_RELEASE 0xf
143 # define OPENSSL_VERSION_NUMBER \
144 ( (OPENSSL_VERSION_MAJOR<<28) \
145 |(OPENSSL_VERSION_MINOR<<20) \
146 |(OPENSSL_VERSION_PATCH<<4) \
147 |_OPENSSL_VERSION_PRE_RELEASE )
152 #endif /* OPENSSL_OPENSSLV_H */