1 | /*
|
---|
2 | * {- join("\n * ", @autowarntext) -}
|
---|
3 | *
|
---|
4 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
---|
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
|
---|
10 | */
|
---|
11 |
|
---|
12 | #include <openssl/opensslv.h>
|
---|
13 |
|
---|
14 | #ifdef __cplusplus
|
---|
15 | extern "C" {
|
---|
16 | #endif
|
---|
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}}) {
|
---|
27 | foreach (@{$config{openssl_sys_defines}}) {
|
---|
28 | $OUT .= "#ifndef $_\n";
|
---|
29 | $OUT .= "# define $_ 1\n";
|
---|
30 | $OUT .= "#endif\n";
|
---|
31 | }
|
---|
32 | }
|
---|
33 | foreach (@{$config{openssl_api_defines}}) {
|
---|
34 | (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/;
|
---|
35 | $OUT .= "#define $macro $value\n";
|
---|
36 | }
|
---|
37 | if (@{$config{openssl_algorithm_defines}}) {
|
---|
38 | foreach (@{$config{openssl_algorithm_defines}}) {
|
---|
39 | $OUT .= "#ifndef $_\n";
|
---|
40 | $OUT .= "# define $_\n";
|
---|
41 | $OUT .= "#endif\n";
|
---|
42 | }
|
---|
43 | }
|
---|
44 | if (@{$config{openssl_thread_defines}}) {
|
---|
45 | foreach (@{$config{openssl_thread_defines}}) {
|
---|
46 | $OUT .= "#ifndef $_\n";
|
---|
47 | $OUT .= "# define $_\n";
|
---|
48 | $OUT .= "#endif\n";
|
---|
49 | }
|
---|
50 | }
|
---|
51 | if (@{$config{openssl_other_defines}}) {
|
---|
52 | foreach (@{$config{openssl_other_defines}}) {
|
---|
53 | $OUT .= "#ifndef $_\n";
|
---|
54 | $OUT .= "# define $_\n";
|
---|
55 | $OUT .= "#endif\n";
|
---|
56 | }
|
---|
57 | }
|
---|
58 | "";
|
---|
59 | -}
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
|
---|
63 | * don't like that. This will hopefully silence them.
|
---|
64 | */
|
---|
65 | #define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
|
---|
66 |
|
---|
67 | /*
|
---|
68 | * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
|
---|
69 | * declarations of functions deprecated in or before <version>. Otherwise, they
|
---|
70 | * still won't see them if the library has been built to disable deprecated
|
---|
71 | * functions.
|
---|
72 | */
|
---|
73 | #ifndef DECLARE_DEPRECATED
|
---|
74 | # if defined(_MSC_VER) /* vbox */
|
---|
75 | # ifdef __cplusplus /* vbox */
|
---|
76 | # define DECLARE_DEPRECATED(f) __declspec(deprecated) f; /* vbox */
|
---|
77 | # else /* vbox */
|
---|
78 | # define DECLARE_DEPRECATED(f) f; /* vbox */
|
---|
79 | # endif /* vbox */
|
---|
80 | # else
|
---|
81 | # define DECLARE_DEPRECATED(f) f;
|
---|
82 | # ifdef __GNUC__
|
---|
83 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
|
---|
84 | # undef DECLARE_DEPRECATED
|
---|
85 | # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
|
---|
86 | # endif
|
---|
87 | # endif
|
---|
88 | # endif
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #ifndef OPENSSL_FILE
|
---|
92 | # ifdef OPENSSL_NO_FILENAMES
|
---|
93 | # define OPENSSL_FILE ""
|
---|
94 | # define OPENSSL_LINE 0
|
---|
95 | # else
|
---|
96 | # define OPENSSL_FILE __FILE__
|
---|
97 | # define OPENSSL_LINE __LINE__
|
---|
98 | # endif
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | #ifndef OPENSSL_MIN_API
|
---|
102 | # define OPENSSL_MIN_API 0
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API
|
---|
106 | # undef OPENSSL_API_COMPAT
|
---|
107 | # define OPENSSL_API_COMPAT OPENSSL_MIN_API
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * Do not deprecate things to be deprecated in version 1.2.0 before the
|
---|
112 | * OpenSSL version number matches.
|
---|
113 | */
|
---|
114 | #if OPENSSL_VERSION_NUMBER < 0x10200000L
|
---|
115 | # define DEPRECATEDIN_1_2_0(f) f;
|
---|
116 | #elif OPENSSL_API_COMPAT < 0x10200000L
|
---|
117 | # define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f)
|
---|
118 | #else
|
---|
119 | # define DEPRECATEDIN_1_2_0(f)
|
---|
120 | #endif
|
---|
121 |
|
---|
122 | #if OPENSSL_API_COMPAT < 0x10100000L
|
---|
123 | # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
|
---|
124 | #else
|
---|
125 | # define DEPRECATEDIN_1_1_0(f)
|
---|
126 | #endif
|
---|
127 |
|
---|
128 | #if OPENSSL_API_COMPAT < 0x10000000L
|
---|
129 | # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
|
---|
130 | #else
|
---|
131 | # define DEPRECATEDIN_1_0_0(f)
|
---|
132 | #endif
|
---|
133 |
|
---|
134 | #if OPENSSL_API_COMPAT < 0x00908000L
|
---|
135 | # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
|
---|
136 | #else
|
---|
137 | # define DEPRECATEDIN_0_9_8(f)
|
---|
138 | #endif
|
---|
139 |
|
---|
140 | /* Generate 80386 code? */
|
---|
141 | {- $config{processor} eq "386" ? "#define" : "#undef" -} I386_ONLY
|
---|
142 |
|
---|
143 | #undef OPENSSL_UNISTD
|
---|
144 | #define OPENSSL_UNISTD {- $target{unistd} -}
|
---|
145 |
|
---|
146 | {- $config{export_var_as_fn} ? "#define" : "#undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * The following are cipher-specific, but are part of the public API.
|
---|
150 | */
|
---|
151 | #if !defined(OPENSSL_SYS_UEFI)
|
---|
152 | {- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG
|
---|
153 | /* Only one for the following should be defined */
|
---|
154 | {- $config{b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG
|
---|
155 | {- $config{b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT
|
---|
156 | {- $config{b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT
|
---|
157 | #endif
|
---|
158 |
|
---|
159 | #define RC4_INT {- $config{rc4_int} -}
|
---|
160 |
|
---|
161 | #ifdef __cplusplus
|
---|
162 | }
|
---|
163 | #endif
|
---|