2 * {- join("\n * ", @autowarntext) -}
4 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
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
12 #include <openssl/opensslv.h>
18 #ifdef OPENSSL_ALGORITHM_DEFINES
19 # error OPENSSL_ALGORITHM_DEFINES no longer supported
23 * OpenSSL was configured with the following options:
26 {- if (@{$config{openssl_sys_defines}}) {
27 foreach (@{$config{openssl_sys_defines}}) {
28 $OUT .= "#ifndef $_\n";
29 $OUT .= "# define $_ 1\n";
33 foreach (@{$config{openssl_api_defines}}) {
34 (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/;
35 $OUT .= "#define $macro $value\n";
37 if (@{$config{openssl_feature_defines}}) {
38 foreach (@{$config{openssl_feature_defines}}) {
39 $OUT .= "#ifndef $_\n";
40 $OUT .= "# define $_\n";
48 * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
49 * don't like that. This will hopefully silence them.
51 #define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
54 * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
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.
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
63 #ifndef DECLARE_DEPRECATED
64 # define DECLARE_DEPRECATED(f) f;
66 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
67 # undef DECLARE_DEPRECATED
68 # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
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:
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)
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"
88 #ifndef OPENSSL_API_COMPAT
89 # define OPENSSL_API_LEVEL OPENSSL_MIN_API
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
100 / * Major number 3 to 15 */
101 # define OPENSSL_API_LEVEL ((OPENSSL_API_COMPAT >> 28) & 0xF)
106 * Do not deprecate things to be deprecated in version 4.0 before the
107 * OpenSSL version number matches.
109 #if OPENSSL_VERSION_MAJOR < 4
110 # define DEPRECATEDIN_4(f) f;
111 # define OPENSSL_API_4 0
112 #elif OPENSSL_API_LEVEL < 4
113 # define DEPRECATEDIN_4(f) DECLARE_DEPRECATED(f)
114 # define OPENSSL_API_4 0
116 # define DEPRECATEDIN_4(f)
117 # define OPENSSL_API_4 1
120 #if OPENSSL_API_LEVEL < 3
121 # define DEPRECATEDIN_3(f) DECLARE_DEPRECATED(f)
122 # define OPENSSL_API_3 0
124 # define DEPRECATEDIN_3(f)
125 # define OPENSSL_API_3 1
128 #if OPENSSL_API_LEVEL < 2
129 # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
130 # define OPENSSL_API_1_1_0 0
132 # define DEPRECATEDIN_1_1_0(f)
133 # define OPENSSL_API_1_1_0 1
136 #if OPENSSL_API_LEVEL < 1
137 # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
138 # define OPENSSL_API_1_0_0 0
140 # define DEPRECATEDIN_1_0_0(f)
141 # define OPENSSL_API_1_0_0 1
144 #if OPENSSL_API_LEVEL < 0
145 # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
146 # define OPENSSL_API_0_9_8 0
148 # define DEPRECATEDIN_0_9_8(f)
149 # define OPENSSL_API_0_9_8 1
153 # ifdef OPENSSL_NO_FILENAMES
154 # define OPENSSL_FILE ""
155 # define OPENSSL_LINE 0
157 # define OPENSSL_FILE __FILE__
158 # define OPENSSL_LINE __LINE__
162 /* Generate 80386 code? */
163 {- $config{processor} eq "386" ? "#define" : "#undef" -} I386_ONLY
165 #undef OPENSSL_UNISTD
166 #define OPENSSL_UNISTD {- $target{unistd} -}
168 {- $config{export_var_as_fn} ? "#define" : "#undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
171 * The following are cipher-specific, but are part of the public API.
173 #if !defined(OPENSSL_SYS_UEFI)
174 {- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG
175 /* Only one for the following should be defined */
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
181 #define RC4_INT {- $config{rc4_int} -}