xref: /openssl/include/openssl/opensslv.h.in (revision 454afd98)
1/*
2 * {- join("\n * ", @autowarntext) -}
3 *
4 * Copyright 1999-2020 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
17extern "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
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# define OPENSSL_VERSION_PRE_RELEASE "{- $config{prerelease} -}"
42/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+fips" */
43/* Could be: #define OPENSSL_VERSION_BUILD_METADATA "+vendor.1" */
44# define OPENSSL_VERSION_BUILD_METADATA "{- $config{build_metadata} -}"
45
46/*
47 * Note: The OpenSSL Project will never define OPENSSL_VERSION_BUILD_METADATA
48 * to be anything but the empty string.  Its use is entirely reserved for
49 * others
50 */
51
52/*
53 * Shared library version
54 *
55 * This is strictly to express ABI version, which may or may not
56 * be related to the API version expressed with the macros above.
57 * This is defined in free form.
58 */
59# define OPENSSL_SHLIB_VERSION {- $config{shlib_version} -}
60
61/*
62 * SECTION 2: USEFUL MACROS
63 */
64
65/* For checking general API compatibility when preprocessing */
66# define OPENSSL_VERSION_PREREQ(maj,min)                                \
67    ((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
68
69/*
70 * Macros to get the version in easily digested string form, both the short
71 * "MAJOR.MINOR.PATCH" variant (where MAJOR, MINOR and PATCH are replaced
72 * with the values from the corresponding OPENSSL_VERSION_ macros) and the
73 * longer variant with OPENSSL_VERSION_PRE_RELEASE_STR and
74 * OPENSSL_VERSION_BUILD_METADATA_STR appended.
75 */
76# define OPENSSL_VERSION_STR "{- $config{version} -}"
77# define OPENSSL_FULL_VERSION_STR "{- $config{full_version} -}"
78
79/*
80 * SECTION 3: ADDITIONAL METADATA
81 *
82 * These strings are defined separately to allow them to be parsable.
83 */
84# define OPENSSL_RELEASE_DATE "{- $config{release_date} -}"
85
86/*
87 * SECTION 4: BACKWARD COMPATIBILITY
88 */
89
90# define OPENSSL_VERSION_TEXT "OpenSSL {- "$config{full_version} $config{release_date}" -}"
91
92/* Synthesize OPENSSL_VERSION_NUMBER with the layout 0xMNN00PPSL */
93# ifdef OPENSSL_VERSION_PRE_RELEASE
94#  define _OPENSSL_VERSION_PRE_RELEASE 0x0L
95# else
96#  define _OPENSSL_VERSION_PRE_RELEASE 0xfL
97# endif
98# define OPENSSL_VERSION_NUMBER          \
99    ( (OPENSSL_VERSION_MAJOR<<28)        \
100      |(OPENSSL_VERSION_MINOR<<20)       \
101      |(OPENSSL_VERSION_PATCH<<4)        \
102      |_OPENSSL_VERSION_PRE_RELEASE )
103
104# ifdef  __cplusplus
105}
106# endif
107
108# include <openssl/macros.h>
109# ifndef OPENSSL_NO_DEPRECATED_3_0
110#  define HEADER_OPENSSLV_H
111# endif
112
113#endif                          /* OPENSSL_OPENSSLV_H */
114