2 * {- join("\n * ", @autowarntext) -}
4 * Copyright 2016-2018 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 #include <openssl/opensslv.h>
14 #ifndef HEADER_OPENSSLCONF_H
15 # define HEADER_OPENSSLCONF_H
21 # ifdef OPENSSL_ALGORITHM_DEFINES
22 # error OPENSSL_ALGORITHM_DEFINES no longer supported
26 * OpenSSL was configured with the following options:
29 {- if (@{$config{openssl_sys_defines}}) {
30 foreach (@{$config{openssl_sys_defines}}) {
31 $OUT .= "# ifndef $_\n";
32 $OUT .= "# define $_ 1\n";
36 foreach (@{$config{openssl_api_defines}}) {
37 (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/;
38 $OUT .= "# define $macro $value\n";
40 if (@{$config{openssl_feature_defines}}) {
41 foreach (@{$config{openssl_feature_defines}}) {
42 $OUT .= "# ifndef $_\n";
43 $OUT .= "# define $_\n";
51 * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
52 * don't like that. This will hopefully silence them.
54 # define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
57 * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
58 * declarations of functions deprecated in or before <version>. If this is
59 * undefined, the value of the macro OPENSSL_API_MIN above is the default.
61 * For any version number up until version 1.1.x, <version> is expected to be
62 * the calculated version number 0xMNNFFPPSL. For version numbers 3.0.0 and
63 * on, <version> is expected to be only the major version number (i.e. 3 for
66 # ifndef DECLARE_DEPRECATED
67 # define DECLARE_DEPRECATED(f) f;
69 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
70 # undef DECLARE_DEPRECATED
71 # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
77 * We convert the OPENSSL_API_COMPAT value to an API level. The API level
78 * is the major version number for 3.0.0 and on. For earlier versions, it
79 * uses this scheme, which is close enough for our purposes:
81 * 0.x.y 0 (0.9.8 was the last release in this series)
82 * 1.0.x 1 (1.0.2 was the last release in this series)
83 * 1.1.x 2 (1.1.1 was the last release in this series)
86 /* In case someone defined both */
87 # if defined(OPENSSL_API_COMPAT) && defined(OPENSSL_API_LEVEL)
88 # error "Disallowed to defined both OPENSSL_API_COMPAT and OPENSSL_API_LEVEL"
91 # ifndef OPENSSL_API_COMPAT
92 # define OPENSSL_API_LEVEL OPENSSL_MIN_API
94 # if (OPENSSL_API_COMPAT < 0x1000L) /* Major version numbers up to 16777215 */
95 # define OPENSSL_API_LEVEL OPENSSL_API_COMPAT
96 # elif (OPENSSL_API_COMPAT & 0xF0000000L) == 0x00000000L
97 # define OPENSSL_API_LEVEL 0
98 # elif (OPENSSL_API_COMPAT & 0xFFF00000L) == 0x10000000L
99 # define OPENSSL_API_LEVEL 1
100 # elif (OPENSSL_API_COMPAT & 0xFFF00000L) == 0x10100000L
101 # define OPENSSL_API_LEVEL 2
103 / * Major number 3 to 15 */
104 # define OPENSSL_API_LEVEL ((OPENSSL_API_COMPAT >> 28) & 0xF)
109 * Do not deprecate things to be deprecated in version 4.0 before the
110 * OpenSSL version number matches.
112 # if OPENSSL_VERSION_MAJOR < 4
113 # define DEPRECATEDIN_4(f) f;
114 # define OPENSSL_API_4 0
115 # elif OPENSSL_API_LEVEL < 4
116 # define DEPRECATEDIN_4(f) DECLARE_DEPRECATED(f)
117 # define OPENSSL_API_4 0
119 # define DEPRECATEDIN_4(f)
120 # define OPENSSL_API_4 1
123 # if OPENSSL_API_LEVEL < 3
124 # define DEPRECATEDIN_3(f) DECLARE_DEPRECATED(f)
125 # define OPENSSL_API_3 0
127 # define DEPRECATEDIN_3(f)
128 # define OPENSSL_API_3 1
131 # if OPENSSL_API_LEVEL < 2
132 # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
133 # define OPENSSL_API_1_1_0 0
135 # define DEPRECATEDIN_1_1_0(f)
136 # define OPENSSL_API_1_1_0 1
139 # if OPENSSL_API_LEVEL < 1
140 # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
141 # define OPENSSL_API_1_0_0 0
143 # define DEPRECATEDIN_1_0_0(f)
144 # define OPENSSL_API_1_0_0 1
147 # if OPENSSL_API_LEVEL < 0
148 # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
149 # define OPENSSL_API_0_9_8 0
151 # define DEPRECATEDIN_0_9_8(f)
152 # define OPENSSL_API_0_9_8 1
155 # ifndef OPENSSL_FILE
156 # ifdef OPENSSL_NO_FILENAMES
157 # define OPENSSL_FILE ""
158 # define OPENSSL_LINE 0
160 # define OPENSSL_FILE __FILE__
161 # define OPENSSL_LINE __LINE__
165 /* Generate 80386 code? */
166 {- $config{processor} eq "386" ? "# define" : "# undef" -} I386_ONLY
168 # undef OPENSSL_UNISTD
169 # define OPENSSL_UNISTD {- $target{unistd} -}
171 {- $config{export_var_as_fn} ? "# define" : "# undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
174 * The following are cipher-specific, but are part of the public API.
176 # if !defined(OPENSSL_SYS_UEFI)
177 {- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG
178 /* Only one for the following should be defined */
179 {- $config{b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG
180 {- $config{b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT
181 {- $config{b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT
184 # define RC4_INT {- $config{rc4_int} -}
189 #endif /* HEADER_OPENSSLCONF_H */