]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/opensslv.h
Fix header file include guard names
[thirdparty/openssl.git] / include / openssl / opensslv.h
CommitLineData
21dcbebc 1/*
11642f35 2 * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
21dcbebc 3 *
48f4ad77 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
21dcbebc
RS
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
ae4186b0
DMSP
10#ifndef OPENSSL_OPENSSLV_H
11# define OPENSSL_OPENSSLV_H
09ad8001 12
3a63dbef 13# ifdef __cplusplus
17e80c6b 14extern "C" {
3a63dbef
RL
15# endif
16
17/*
18 * SECTION 1: VERSION DATA. These will change for each release
e90c7729 19 */
3a63dbef
RL
20
21/*
22 * Base version macros
b436a982 23 *
3a63dbef
RL
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.
b436a982 32 *
3a63dbef
RL
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
b436a982 68 *
3a63dbef
RL
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) \
bf5b04ea 81 ((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
3a63dbef
RL
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 */
92unsigned int OPENSSL_version_major(void);
93unsigned int OPENSSL_version_minor(void);
94unsigned int OPENSSL_version_patch(void);
95const char *OPENSSL_version_pre_release(void);
96const 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/*
d6e9ddac 122 * SECTION 4: BACKWARD COMPATIBILITY
b436a982 123 */
3a63dbef 124/* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */
7e8c3381
VD
125# ifdef OPENSSL_VERSION_PRE_RELEASE
126# define _OPENSSL_VERSION_PRE_RELEASE 0x0
127# else
128# define _OPENSSL_VERSION_PRE_RELEASE 0xf
3a63dbef 129# endif
7e8c3381
VD
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 )
b436a982 135
3a63dbef 136# ifdef __cplusplus
17e80c6b 137}
3a63dbef 138# endif
ae4186b0 139#endif /* OPENSSL_OPENSSLV_H */