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