]>
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 | 5 | * |
48f4ad77 | 6 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
e0a65194 RS |
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 | ||
95b7926b MC |
14 | #ifndef HEADER_OPENSSLCONF_H |
15 | # define HEADER_OPENSSLCONF_H | |
16 | ||
17 | # ifdef __cplusplus | |
dc193c9c | 18 | extern "C" { |
95b7926b | 19 | # endif |
cde052f5 | 20 | |
95b7926b MC |
21 | # ifdef OPENSSL_ALGORITHM_DEFINES |
22 | # error OPENSSL_ALGORITHM_DEFINES no longer supported | |
23 | # endif | |
cde052f5 RS |
24 | |
25 | /* | |
26 | * OpenSSL was configured with the following options: | |
27 | */ | |
28 | ||
29 | {- if (@{$config{openssl_sys_defines}}) { | |
dc193c9c | 30 | foreach (@{$config{openssl_sys_defines}}) { |
95b7926b MC |
31 | $OUT .= "# ifndef $_\n"; |
32 | $OUT .= "# define $_ 1\n"; | |
33 | $OUT .= "# endif\n"; | |
dc193c9c RS |
34 | } |
35 | } | |
dc193c9c RS |
36 | foreach (@{$config{openssl_api_defines}}) { |
37 | (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/; | |
95b7926b | 38 | $OUT .= "# define $macro $value\n"; |
dc193c9c | 39 | } |
e0bf7c01 RL |
40 | if (@{$config{openssl_feature_defines}}) { |
41 | foreach (@{$config{openssl_feature_defines}}) { | |
95b7926b MC |
42 | $OUT .= "# ifndef $_\n"; |
43 | $OUT .= "# define $_\n"; | |
44 | $OUT .= "# endif\n"; | |
dc193c9c RS |
45 | } |
46 | } | |
47 | ""; | |
48 | -} | |
49 | ||
effaf4de RS |
50 | /* |
51 | * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers | |
52 | * don't like that. This will hopefully silence them. | |
53 | */ | |
95b7926b | 54 | # define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; |
effaf4de | 55 | |
dc193c9c RS |
56 | /* |
57 | * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the | |
fcd2d5a6 RL |
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. | |
60 | * | |
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 | |
64 | * version 3.0.0). | |
dc193c9c | 65 | */ |
95b7926b MC |
66 | # ifndef DECLARE_DEPRECATED |
67 | # define DECLARE_DEPRECATED(f) f; | |
68 | # ifdef __GNUC__ | |
69 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) | |
70 | # undef DECLARE_DEPRECATED | |
71 | # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); | |
72 | # endif | |
4431107d | 73 | # endif |
3550d915 | 74 | # endif |
dc193c9c | 75 | |
fcd2d5a6 RL |
76 | /* |
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: | |
80 | * | |
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) | |
84 | */ | |
3ba84717 | 85 | |
fcd2d5a6 | 86 | /* In case someone defined both */ |
95b7926b MC |
87 | # if defined(OPENSSL_API_COMPAT) && defined(OPENSSL_API_LEVEL) |
88 | # error "Disallowed to defined both OPENSSL_API_COMPAT and OPENSSL_API_LEVEL" | |
89 | # endif | |
90 | ||
91 | # ifndef OPENSSL_API_COMPAT | |
92 | # define OPENSSL_API_LEVEL OPENSSL_MIN_API | |
fcd2d5a6 | 93 | # else |
95b7926b MC |
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 | |
102 | # else | |
fcd2d5a6 | 103 | / * Major number 3 to 15 */ |
95b7926b MC |
104 | # define OPENSSL_API_LEVEL ((OPENSSL_API_COMPAT >> 28) & 0xF) |
105 | # endif | |
fcd2d5a6 | 106 | # endif |
dc193c9c | 107 | |
478d4f91 RL |
108 | /* |
109 | * Do not deprecate things to be deprecated in version 4.0 before the | |
110 | * OpenSSL version number matches. | |
111 | */ | |
95b7926b MC |
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 | |
118 | # else | |
119 | # define DEPRECATEDIN_4(f) | |
120 | # define OPENSSL_API_4 1 | |
121 | # endif | |
122 | ||
123 | # if OPENSSL_API_LEVEL < 3 | |
124 | # define DEPRECATEDIN_3(f) DECLARE_DEPRECATED(f) | |
125 | # define OPENSSL_API_3 0 | |
126 | # else | |
127 | # define DEPRECATEDIN_3(f) | |
128 | # define OPENSSL_API_3 1 | |
129 | # endif | |
130 | ||
131 | # if OPENSSL_API_LEVEL < 2 | |
132 | # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) | |
133 | # define OPENSSL_API_1_1_0 0 | |
fcd2d5a6 | 134 | # else |
95b7926b MC |
135 | # define DEPRECATEDIN_1_1_0(f) |
136 | # define OPENSSL_API_1_1_0 1 | |
137 | # endif | |
138 | ||
139 | # if OPENSSL_API_LEVEL < 1 | |
140 | # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) | |
141 | # define OPENSSL_API_1_0_0 0 | |
142 | # else | |
143 | # define DEPRECATEDIN_1_0_0(f) | |
144 | # define OPENSSL_API_1_0_0 1 | |
145 | # endif | |
146 | ||
147 | # if OPENSSL_API_LEVEL < 0 | |
148 | # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) | |
149 | # define OPENSSL_API_0_9_8 0 | |
150 | # else | |
151 | # define DEPRECATEDIN_0_9_8(f) | |
152 | # define OPENSSL_API_0_9_8 1 | |
153 | # endif | |
154 | ||
155 | # ifndef OPENSSL_FILE | |
156 | # ifdef OPENSSL_NO_FILENAMES | |
157 | # define OPENSSL_FILE "" | |
158 | # define OPENSSL_LINE 0 | |
159 | # else | |
160 | # define OPENSSL_FILE __FILE__ | |
161 | # define OPENSSL_LINE __LINE__ | |
162 | # endif | |
fcd2d5a6 | 163 | # endif |
dc193c9c RS |
164 | |
165 | /* Generate 80386 code? */ | |
95b7926b | 166 | {- $config{processor} eq "386" ? "# define" : "# undef" -} I386_ONLY |
dc193c9c | 167 | |
dc193c9c RS |
168 | /* |
169 | * The following are cipher-specific, but are part of the public API. | |
170 | */ | |
95b7926b MC |
171 | # if !defined(OPENSSL_SYS_UEFI) |
172 | {- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG | |
dc193c9c | 173 | /* Only one for the following should be defined */ |
95b7926b MC |
174 | {- $config{b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG |
175 | {- $config{b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT | |
176 | {- $config{b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT | |
177 | # endif | |
dc193c9c | 178 | |
95b7926b | 179 | # define RC4_INT {- $config{rc4_int} -} |
dc193c9c | 180 | |
95b7926b | 181 | # ifdef __cplusplus |
dc193c9c | 182 | } |
95b7926b MC |
183 | # endif |
184 | #endif /* HEADER_OPENSSLCONF_H */ |