Adapt OPENSSL_POLICY_DEBUG to the new generic trace API
[openssl.git] / include / openssl / opensslconf.h.in
1 /*
2  * {- join("\n * ", @autowarntext) -}
3  *
4  * Copyright 2016-2018 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 #include <openssl/opensslv.h>
13
14 #ifndef HEADER_OPENSSLCONF_H
15 # define HEADER_OPENSSLCONF_H
16
17 # ifdef  __cplusplus
18 extern "C" {
19 # endif
20
21 # ifdef OPENSSL_ALGORITHM_DEFINES
22 #  error OPENSSL_ALGORITHM_DEFINES no longer supported
23 # endif
24
25 /*
26  * OpenSSL was configured with the following options:
27  */
28
29 {- if (@{$config{openssl_sys_defines}}) {
30       foreach (@{$config{openssl_sys_defines}}) {
31         $OUT .= "# ifndef $_\n";
32         $OUT .= "#  define $_ 1\n";
33         $OUT .= "# endif\n";
34       }
35     }
36     foreach (@{$config{openssl_api_defines}}) {
37         (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/;
38         $OUT .= "# define $macro $value\n";
39     }
40     if (@{$config{openssl_feature_defines}}) {
41       foreach (@{$config{openssl_feature_defines}}) {
42         $OUT .= "# ifndef $_\n";
43         $OUT .= "#  define $_\n";
44         $OUT .= "# endif\n";
45       }
46     }
47     "";
48 -}
49
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  */
54 # define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
55
56 /*
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.
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).
65  */
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
73 #  endif
74 # endif
75
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  */
85
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"
89 # endif
90
91 # ifndef OPENSSL_API_COMPAT
92 #  define OPENSSL_API_LEVEL OPENSSL_MIN_API
93 # else
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
103 / * Major number 3 to 15 */
104 #   define OPENSSL_API_LEVEL ((OPENSSL_API_COMPAT >> 28) & 0xF)
105 #  endif
106 # endif
107
108 /*
109  * Do not deprecate things to be deprecated in version 4.0 before the
110  * OpenSSL version number matches.
111  */
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
134 # else
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
163 # endif
164
165 /* Generate 80386 code? */
166 {- $config{processor} eq "386" ? "# define" : "# undef" -} I386_ONLY
167
168 # undef OPENSSL_UNISTD
169 # define OPENSSL_UNISTD {- $target{unistd} -}
170
171 {- $config{export_var_as_fn} ? "# define" : "# undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
172
173 /*
174  * The following are cipher-specific, but are part of the public API.
175  */
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
182 # endif
183
184 # define RC4_INT {- $config{rc4_int} -}
185
186 # ifdef  __cplusplus
187 }
188 # endif
189 #endif                          /* HEADER_OPENSSLCONF_H */