]>
Commit | Line | Data |
---|---|---|
cde052f5 RS |
1 | /* |
2 | * {- join("\n * ", @autowarntext) -} | |
e0a65194 | 3 | * |
2ad2281a | 4 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. |
e0a65194 RS |
5 | * |
6 | * Licensed under the OpenSSL license (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 | |
cde052f5 | 10 | */ |
dc193c9c | 11 | |
bff0f2ba RL |
12 | #include <openssl/opensslv.h> |
13 | ||
dc193c9c RS |
14 | #ifdef __cplusplus |
15 | extern "C" { | |
16 | #endif | |
cde052f5 RS |
17 | |
18 | #ifdef OPENSSL_ALGORITHM_DEFINES | |
19 | # error OPENSSL_ALGORITHM_DEFINES no longer supported | |
20 | #endif | |
21 | ||
22 | /* | |
23 | * OpenSSL was configured with the following options: | |
24 | */ | |
25 | ||
26 | {- if (@{$config{openssl_sys_defines}}) { | |
dc193c9c RS |
27 | foreach (@{$config{openssl_sys_defines}}) { |
28 | $OUT .= "#ifndef $_\n"; | |
29 | $OUT .= "# define $_ 1\n"; | |
30 | $OUT .= "#endif\n"; | |
dc193c9c RS |
31 | } |
32 | } | |
dc193c9c RS |
33 | foreach (@{$config{openssl_api_defines}}) { |
34 | (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/; | |
cd15cb4d | 35 | $OUT .= "#define $macro $value\n"; |
dc193c9c | 36 | } |
e0bf7c01 RL |
37 | if (@{$config{openssl_feature_defines}}) { |
38 | foreach (@{$config{openssl_feature_defines}}) { | |
dc193c9c RS |
39 | $OUT .= "#ifndef $_\n"; |
40 | $OUT .= "# define $_\n"; | |
41 | $OUT .= "#endif\n"; | |
42 | } | |
43 | } | |
44 | ""; | |
45 | -} | |
46 | ||
effaf4de RS |
47 | /* |
48 | * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers | |
49 | * don't like that. This will hopefully silence them. | |
50 | */ | |
51 | #define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; | |
52 | ||
dc193c9c RS |
53 | /* |
54 | * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the | |
fcd2d5a6 RL |
55 | * declarations of functions deprecated in or before <version>. If this is |
56 | * undefined, the value of the macro OPENSSL_API_MIN above is the default. | |
57 | * | |
58 | * For any version number up until version 1.1.x, <version> is expected to be | |
59 | * the calculated version number 0xMNNFFPPSL. For version numbers 3.0.0 and | |
60 | * on, <version> is expected to be only the major version number (i.e. 3 for | |
61 | * version 3.0.0). | |
dc193c9c | 62 | */ |
4431107d RL |
63 | #ifndef DECLARE_DEPRECATED |
64 | # define DECLARE_DEPRECATED(f) f; | |
65 | # ifdef __GNUC__ | |
66 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) | |
67 | # undef DECLARE_DEPRECATED | |
68 | # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); | |
69 | # endif | |
3550d915 | 70 | # endif |
dc193c9c RS |
71 | #endif |
72 | ||
fcd2d5a6 RL |
73 | /* |
74 | * We convert the OPENSSL_API_COMPAT value to an API level. The API level | |
75 | * is the major version number for 3.0.0 and on. For earlier versions, it | |
76 | * uses this scheme, which is close enough for our purposes: | |
77 | * | |
78 | * 0.x.y 0 (0.9.8 was the last release in this series) | |
79 | * 1.0.x 1 (1.0.2 was the last release in this series) | |
80 | * 1.1.x 2 (1.1.1 was the last release in this series) | |
81 | */ | |
3ba84717 | 82 | |
fcd2d5a6 RL |
83 | /* In case someone defined both */ |
84 | #if defined(OPENSSL_API_COMPAT) && defined(OPENSSL_API_LEVEL) | |
85 | # error "Disallowed to defined both OPENSSL_API_COMPAT and OPENSSL_API_LEVEL" | |
dc193c9c RS |
86 | #endif |
87 | ||
fcd2d5a6 RL |
88 | #ifndef OPENSSL_API_COMPAT |
89 | # define OPENSSL_API_LEVEL OPENSSL_MIN_API | |
90 | #else | |
91 | # if (OPENSSL_API_COMPAT < 0x1000L) /* Major version numbers up to 16777215 */ | |
92 | # define OPENSSL_API_LEVEL OPENSSL_API_COMPAT | |
93 | # elif (OPENSSL_API_COMPAT & 0xF0000000L) == 0x00000000L | |
94 | # define OPENSSL_API_LEVEL 0 | |
95 | # elif (OPENSSL_API_COMPAT & 0xFFF00000L) == 0x10000000L | |
96 | # define OPENSSL_API_LEVEL 1 | |
97 | # elif (OPENSSL_API_COMPAT & 0xFFF00000L) == 0x10100000L | |
98 | # define OPENSSL_API_LEVEL 2 | |
99 | # else | |
100 | / * Major number 3 to 15 */ | |
101 | # define OPENSSL_API_LEVEL ((OPENSSL_API_COMPAT >> 28) & 0xF) | |
102 | # endif | |
dc193c9c RS |
103 | #endif |
104 | ||
478d4f91 RL |
105 | /* |
106 | * Do not deprecate things to be deprecated in version 4.0 before the | |
107 | * OpenSSL version number matches. | |
108 | */ | |
109 | #if OPENSSL_VERSION_MAJOR < 4 | |
110 | # define DEPRECATEDIN_4(f) f; | |
fcd2d5a6 RL |
111 | # define OPENSSL_API_4 0 |
112 | #elif OPENSSL_API_LEVEL < 4 | |
478d4f91 | 113 | # define DEPRECATEDIN_4(f) DECLARE_DEPRECATED(f) |
fcd2d5a6 | 114 | # define OPENSSL_API_4 0 |
478d4f91 RL |
115 | #else |
116 | # define DEPRECATEDIN_4(f) | |
fcd2d5a6 | 117 | # define OPENSSL_API_4 1 |
478d4f91 RL |
118 | #endif |
119 | ||
fcd2d5a6 | 120 | #if OPENSSL_API_LEVEL < 3 |
672f943a | 121 | # define DEPRECATEDIN_3(f) DECLARE_DEPRECATED(f) |
fcd2d5a6 | 122 | # define OPENSSL_API_3 0 |
5ecff87d | 123 | #else |
672f943a | 124 | # define DEPRECATEDIN_3(f) |
fcd2d5a6 | 125 | # define OPENSSL_API_3 1 |
5ecff87d RS |
126 | #endif |
127 | ||
fcd2d5a6 | 128 | #if OPENSSL_API_LEVEL < 2 |
dc193c9c | 129 | # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) |
fcd2d5a6 | 130 | # define OPENSSL_API_1_1_0 0 |
dc193c9c RS |
131 | #else |
132 | # define DEPRECATEDIN_1_1_0(f) | |
fcd2d5a6 | 133 | # define OPENSSL_API_1_1_0 1 |
dc193c9c RS |
134 | #endif |
135 | ||
fcd2d5a6 | 136 | #if OPENSSL_API_LEVEL < 1 |
dc193c9c | 137 | # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) |
fcd2d5a6 | 138 | # define OPENSSL_API_1_0_0 0 |
dc193c9c RS |
139 | #else |
140 | # define DEPRECATEDIN_1_0_0(f) | |
fcd2d5a6 | 141 | # define OPENSSL_API_1_0_0 1 |
dc193c9c RS |
142 | #endif |
143 | ||
fcd2d5a6 | 144 | #if OPENSSL_API_LEVEL < 0 |
dc193c9c | 145 | # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) |
fcd2d5a6 | 146 | # define OPENSSL_API_0_9_8 0 |
dc193c9c RS |
147 | #else |
148 | # define DEPRECATEDIN_0_9_8(f) | |
fcd2d5a6 RL |
149 | # define OPENSSL_API_0_9_8 1 |
150 | #endif | |
151 | ||
152 | #ifndef OPENSSL_FILE | |
153 | # ifdef OPENSSL_NO_FILENAMES | |
154 | # define OPENSSL_FILE "" | |
155 | # define OPENSSL_LINE 0 | |
156 | # else | |
157 | # define OPENSSL_FILE __FILE__ | |
158 | # define OPENSSL_LINE __LINE__ | |
159 | # endif | |
dc193c9c RS |
160 | #endif |
161 | ||
162 | /* Generate 80386 code? */ | |
163 | {- $config{processor} eq "386" ? "#define" : "#undef" -} I386_ONLY | |
164 | ||
dc193c9c RS |
165 | #undef OPENSSL_UNISTD |
166 | #define OPENSSL_UNISTD {- $target{unistd} -} | |
167 | ||
cde052f5 | 168 | {- $config{export_var_as_fn} ? "#define" : "#undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION |
dc193c9c RS |
169 | |
170 | /* | |
171 | * The following are cipher-specific, but are part of the public API. | |
172 | */ | |
dc193c9c | 173 | #if !defined(OPENSSL_SYS_UEFI) |
cde052f5 | 174 | {- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG |
dc193c9c | 175 | /* Only one for the following should be defined */ |
cde052f5 RS |
176 | {- $config{b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG |
177 | {- $config{b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT | |
178 | {- $config{b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT | |
dc193c9c RS |
179 | #endif |
180 | ||
cde052f5 | 181 | #define RC4_INT {- $config{rc4_int} -} |
dc193c9c RS |
182 | |
183 | #ifdef __cplusplus | |
184 | } | |
185 | #endif |