/src/wget2_deps/include/gnutls/compat.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2008-2012 Free Software Foundation, Inc. |
3 | | * |
4 | | * Author: Nikos Mavrogiannopoulos |
5 | | * |
6 | | * This file is part of GnuTLS. |
7 | | * |
8 | | * The GnuTLS is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU Lesser General Public License |
10 | | * as published by the Free Software Foundation; either version 2.1 of |
11 | | * the License, or (at your option) any later version. |
12 | | * |
13 | | * This library is distributed in the hope that it will be useful, but |
14 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | * Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
20 | | * |
21 | | */ |
22 | | |
23 | | /* Typedefs for more compatibility with older GnuTLS. */ |
24 | | |
25 | | #ifndef GNUTLS_COMPAT_H |
26 | | #define GNUTLS_COMPAT_H |
27 | | |
28 | | #ifdef __cplusplus |
29 | | extern "C" { |
30 | | #endif |
31 | | |
32 | | #ifdef __GNUC__ |
33 | | |
34 | | #define _GNUTLS_GCC_VERSION \ |
35 | | (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
36 | | |
37 | | #if !defined GNUTLS_INTERNAL_BUILD |
38 | | #if _GNUTLS_GCC_VERSION >= 30100 |
39 | | #define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__((__deprecated__)) |
40 | | #endif |
41 | | #endif |
42 | | |
43 | | #endif /* __GNUC__ */ |
44 | | |
45 | | #ifndef _GNUTLS_GCC_ATTR_DEPRECATED |
46 | | #define _GNUTLS_GCC_ATTR_DEPRECATED |
47 | | #endif |
48 | | |
49 | | /* gnutls_connection_end_t was made redundant in 2.99.0 */ |
50 | | typedef unsigned int gnutls_connection_end_t _GNUTLS_GCC_ATTR_DEPRECATED; |
51 | | |
52 | | /* Stuff deprecated in 2.x */ |
53 | | typedef gnutls_cipher_algorithm_t gnutls_cipher_algorithm |
54 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
55 | | typedef gnutls_kx_algorithm_t gnutls_kx_algorithm _GNUTLS_GCC_ATTR_DEPRECATED; |
56 | | typedef gnutls_mac_algorithm_t gnutls_mac_algorithm _GNUTLS_GCC_ATTR_DEPRECATED; |
57 | | typedef gnutls_digest_algorithm_t gnutls_digest_algorithm |
58 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
59 | | typedef gnutls_compression_method_t gnutls_compression_method |
60 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
61 | | typedef gnutls_connection_end_t gnutls_connection_end |
62 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
63 | | typedef gnutls_x509_crt_fmt_t gnutls_x509_crt_fmt _GNUTLS_GCC_ATTR_DEPRECATED; |
64 | | typedef gnutls_pk_algorithm_t gnutls_pk_algorithm _GNUTLS_GCC_ATTR_DEPRECATED; |
65 | | typedef gnutls_sign_algorithm_t gnutls_sign_algorithm |
66 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
67 | | typedef gnutls_close_request_t gnutls_close_request _GNUTLS_GCC_ATTR_DEPRECATED; |
68 | | typedef gnutls_certificate_request_t gnutls_certificate_request |
69 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
70 | | typedef gnutls_certificate_status_t gnutls_certificate_status |
71 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
72 | | typedef gnutls_session_t gnutls_session _GNUTLS_GCC_ATTR_DEPRECATED; |
73 | | typedef gnutls_alert_level_t gnutls_alert_level _GNUTLS_GCC_ATTR_DEPRECATED; |
74 | | typedef gnutls_alert_description_t gnutls_alert_description |
75 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
76 | | typedef gnutls_x509_subject_alt_name_t gnutls_x509_subject_alt_name |
77 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
78 | | typedef gnutls_openpgp_privkey_t gnutls_openpgp_privkey |
79 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
80 | | typedef gnutls_openpgp_keyring_t gnutls_openpgp_keyring |
81 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
82 | | typedef gnutls_x509_crt_t gnutls_x509_crt _GNUTLS_GCC_ATTR_DEPRECATED; |
83 | | typedef gnutls_x509_privkey_t gnutls_x509_privkey _GNUTLS_GCC_ATTR_DEPRECATED; |
84 | | typedef gnutls_x509_crl_t gnutls_x509_crl _GNUTLS_GCC_ATTR_DEPRECATED; |
85 | | typedef gnutls_x509_crq_t gnutls_x509_crq _GNUTLS_GCC_ATTR_DEPRECATED; |
86 | | typedef gnutls_certificate_credentials_t gnutls_certificate_credentials |
87 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
88 | | typedef gnutls_anon_server_credentials_t gnutls_anon_server_credentials |
89 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
90 | | typedef gnutls_anon_client_credentials_t gnutls_anon_client_credentials |
91 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
92 | | typedef gnutls_srp_client_credentials_t gnutls_srp_client_credentials |
93 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
94 | | typedef gnutls_srp_server_credentials_t gnutls_srp_server_credentials |
95 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
96 | | typedef gnutls_dh_params_t gnutls_dh_params _GNUTLS_GCC_ATTR_DEPRECATED; |
97 | | typedef gnutls_rsa_params_t gnutls_rsa_params _GNUTLS_GCC_ATTR_DEPRECATED; |
98 | | typedef gnutls_params_type_t gnutls_params_type _GNUTLS_GCC_ATTR_DEPRECATED; |
99 | | typedef gnutls_credentials_type_t gnutls_credentials_type |
100 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
101 | | typedef gnutls_certificate_type_t gnutls_certificate_type |
102 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
103 | | typedef gnutls_datum_t gnutls_datum _GNUTLS_GCC_ATTR_DEPRECATED; |
104 | | typedef gnutls_transport_ptr_t gnutls_transport_ptr _GNUTLS_GCC_ATTR_DEPRECATED; |
105 | | |
106 | | /* Old verification flags */ |
107 | | #define GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT (0) |
108 | | |
109 | | /* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was |
110 | | modified to use the PSK alert. */ |
111 | | #define GNUTLS_A_MISSING_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY |
112 | | #define GNUTLS_A_UNKNOWN_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY |
113 | | |
114 | | /* OpenPGP stuff renamed in 2.1.x. */ |
115 | | #define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT |
116 | | #define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT |
117 | | #define gnutls_openpgp_send_key gnutls_openpgp_send_cert |
118 | | typedef gnutls_openpgp_crt_status_t gnutls_openpgp_key_status_t |
119 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
120 | | typedef gnutls_openpgp_crt_t gnutls_openpgp_key_t _GNUTLS_GCC_ATTR_DEPRECATED; |
121 | | #define gnutls_openpgp_key_init gnutls_openpgp_crt_init |
122 | | #define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit |
123 | | #define gnutls_openpgp_key_import gnutls_openpgp_crt_import |
124 | | #define gnutls_openpgp_key_export gnutls_openpgp_crt_export |
125 | | #define gnutls_openpgp_key_get_key_usage gnutls_openpgp_crt_get_key_usage |
126 | | #define gnutls_openpgp_key_get_fingerprint gnutls_openpgp_crt_get_fingerprint |
127 | | #define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algorithm |
128 | | #define gnutls_openpgp_key_get_name gnutls_openpgp_crt_get_name |
129 | | #define gnutls_openpgp_key_get_version gnutls_openpgp_crt_get_version |
130 | | #define gnutls_openpgp_key_get_creation_time \ |
131 | | gnutls_openpgp_crt_get_creation_time |
132 | | #define gnutls_openpgp_key_get_expiration_time \ |
133 | | gnutls_openpgp_crt_get_expiration_time |
134 | | #define gnutls_openpgp_key_get_id gnutls_openpgp_crt_get_id |
135 | | #define gnutls_openpgp_key_check_hostname gnutls_openpgp_crt_check_hostname |
136 | | |
137 | | /* OpenPGP stuff renamed in 2.3.x. */ |
138 | | #define gnutls_openpgp_crt_get_id gnutls_openpgp_crt_get_key_id |
139 | | |
140 | | /* New better names renamed in 2.3.x, add these for backwards |
141 | | compatibility with old poor names.*/ |
142 | | #define GNUTLS_X509_CRT_FULL GNUTLS_CRT_PRINT_FULL |
143 | | #define GNUTLS_X509_CRT_ONELINE GNUTLS_CRT_PRINT_ONELINE |
144 | | #define GNUTLS_X509_CRT_UNSIGNED_FULL GNUTLS_CRT_PRINT_UNSIGNED_FULL |
145 | | |
146 | | /* Namespace problems. */ |
147 | | #define LIBGNUTLS_VERSION GNUTLS_VERSION |
148 | | #define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR |
149 | | #define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR |
150 | | #define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH |
151 | | #define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER |
152 | | #define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION |
153 | | |
154 | | /* This is a very dangerous and error-prone function. |
155 | | * Use gnutls_privkey_sign_hash() instead. |
156 | | */ |
157 | | int gnutls_x509_privkey_sign_hash( |
158 | | gnutls_x509_privkey_t key, const gnutls_datum_t *hash, |
159 | | gnutls_datum_t *signature) _GNUTLS_GCC_ATTR_DEPRECATED; |
160 | | |
161 | | int gnutls_openpgp_privkey_sign_hash( |
162 | | gnutls_openpgp_privkey_t key, const gnutls_datum_t *hash, |
163 | | gnutls_datum_t *signature) _GNUTLS_GCC_ATTR_DEPRECATED; |
164 | | |
165 | | /* gnutls_pubkey_get_preferred_hash_algorithm() */ |
166 | | int gnutls_x509_crt_get_preferred_hash_algorithm( |
167 | | gnutls_x509_crt_t crt, gnutls_digest_algorithm_t *hash, |
168 | | unsigned int *mand) _GNUTLS_GCC_ATTR_DEPRECATED; |
169 | | |
170 | | /* use gnutls_privkey_sign_hash() with the GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA flag */ |
171 | | |
172 | | #ifdef _ISOC99_SOURCE |
173 | | /* we provide older functions for compatibility as inline functions that |
174 | | * depend on gnutls_session_get_random. */ |
175 | | |
176 | | static inline const void *gnutls_session_get_server_random( |
177 | | gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED; |
178 | | static inline const void * |
179 | | gnutls_session_get_server_random(gnutls_session_t session) |
180 | 0 | { |
181 | 0 | gnutls_datum_t rnd; |
182 | 0 | gnutls_session_get_random(session, NULL, &rnd); /*doc-skip */ |
183 | 0 | return rnd.data; |
184 | 0 | } |
185 | | |
186 | | static inline const void *gnutls_session_get_client_random( |
187 | | gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED; |
188 | | static inline const void * |
189 | | gnutls_session_get_client_random(gnutls_session_t session) |
190 | 0 | { |
191 | 0 | gnutls_datum_t rnd; |
192 | 0 | gnutls_session_get_random(session, &rnd, NULL); /*doc-skip */ |
193 | 0 | return rnd.data; |
194 | 0 | } |
195 | | #endif |
196 | | |
197 | | void gnutls_global_set_mem_functions(gnutls_alloc_function alloc_func, |
198 | | gnutls_alloc_function secure_alloc_func, |
199 | | gnutls_is_secure_function is_secure_func, |
200 | | gnutls_realloc_function realloc_func, |
201 | | gnutls_free_function free_func) |
202 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
203 | | |
204 | | /* defined in old headers - unused nevertheless */ |
205 | | #define GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA 0 |
206 | | |
207 | | /* old compression related functions */ |
208 | | gnutls_compression_method_t |
209 | | gnutls_compression_get(gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED; |
210 | | |
211 | | const char *gnutls_compression_get_name(gnutls_compression_method_t algorithm) |
212 | | __GNUTLS_CONST__ _GNUTLS_GCC_ATTR_DEPRECATED; |
213 | | |
214 | | gnutls_compression_method_t gnutls_compression_get_id(const char *name) |
215 | | __GNUTLS_CONST__ _GNUTLS_GCC_ATTR_DEPRECATED; |
216 | | |
217 | | const gnutls_compression_method_t * |
218 | | gnutls_compression_list(void) __GNUTLS_PURE__ _GNUTLS_GCC_ATTR_DEPRECATED; |
219 | | |
220 | | int gnutls_priority_compression_list(gnutls_priority_t pcache, |
221 | | const unsigned int **list) |
222 | | _GNUTLS_GCC_ATTR_DEPRECATED; |
223 | | |
224 | | #ifdef __cplusplus |
225 | | } |
226 | | #endif |
227 | | |
228 | | #endif /* GNUTLS_COMPAT_H */ |