1 /* Typedefs for more compatibility with older GnuTLS. */
3 #ifndef _GNUTLS_COMPAT_H
4 #define _GNUTLS_COMPAT_H
13 #define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
15 #if !defined GNUTLS_INTERNAL_BUILD
16 #if _GNUTLS_GCC_VERSION >= 30100
17 #define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
23 #ifndef _GNUTLS_GCC_ATTR_DEPRECATED
24 #define _GNUTLS_GCC_ATTR_DEPRECATED
27 #define gnutls_cipher_algorithm gnutls_cipher_algorithm_t
28 #define gnutls_kx_algorithm gnutls_kx_algorithm_t
29 #define gnutls_paramsype gnutls_paramsype_t
30 #define gnutls_mac_algorithm gnutls_mac_algorithm_t
31 #define gnutls_digest_algorithm gnutls_digest_algorithm_t
32 #define gnutls_compression_method gnutls_compression_method_t
33 #define gnutls_connection_end gnutls_connection_end_t
34 #define gnutls_credentialsype gnutls_credentialsype_t
35 #define gnutls_certificateype gnutls_certificateype_t
36 #define gnutls_x509_crt_fmt gnutls_x509_crt_fmt_t
37 #define gnutls_openpgp_key_fmt gnutls_openpgp_key_fmt_t
38 #define gnutls_pk_algorithm gnutls_pk_algorithm_t
39 #define gnutls_sign_algorithm gnutls_sign_algorithm_t
40 #define gnutls_server_name gnutls_server_nameype_t
41 #define gnutls_protocol gnutls_protocol_version_t
42 #define gnutls_close_request gnutls_close_request_t
43 #define gnutls_openpgp_key_status gnutls_openpgp_key_status_t
44 #define gnutls_certificate_request gnutls_certificate_request_t
45 #define gnutls_certificate_status gnutls_certificate_status_t
46 #define gnutls_session gnutls_session_t
47 #define gnutls_alert_level gnutls_alert_level_t
48 #define gnutls_alert_description gnutls_alert_description_t
49 #define gnutls_x509_subject_alt_name gnutls_x509_subject_alt_name_t
50 #define gnutls_openpgp_key gnutls_openpgp_key_t
51 #define gnutls_openpgp_privkey gnutls_openpgp_privkey_t
52 #define gnutls_openpgp_keyring gnutls_openpgp_keyring_t
53 #define gnutls_x509_crt gnutls_x509_crt_t
54 #define gnutls_x509_privkey gnutls_x509_privkey_t
55 #define gnutls_x509_crl gnutls_x509_crl_t
56 #define gnutls_pkcs7 gnutls_pkcs7_t
57 #define gnutls_x509_crq gnutls_x509_crq_t
58 #define gnutls_pkcs_encrypt_flags gnutls_pkcs_encrypt_flags_t
59 #define gnutls_pkcs12_bag_type gnutls_pkcs12_bag_type_t
60 #define gnutls_pkcs12_bag gnutls_pkcs12_bag_t
61 #define gnutls_pkcs12 gnutls_pkcs12_t
62 #define gnutls_certificate_credentials gnutls_certificate_credentials_t
63 #define gnutls_anon_server_credentials gnutls_anon_server_credentials_t
64 #define gnutls_anon_client_credentials gnutls_anon_client_credentials_t
65 #define gnutls_srp_client_credentials gnutls_srp_client_credentials_t
66 #define gnutls_srp_server_credentials gnutls_srp_server_credentials_t
67 #define gnutls_dh_params gnutls_dh_params_t
68 #define gnutls_rsa_params gnutls_rsa_params_t
69 #define gnutls_params_type gnutls_params_type_t
70 #define gnutls_credentials_type gnutls_credentials_type_t
71 #define gnutls_certificate_type gnutls_certificate_type_t
72 #define gnutls_datum gnutls_datum_t
73 #define gnutls_transport_ptr gnutls_transport_ptr_t
75 /* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was
76 modified to use the PSK alert. */
77 #define GNUTLS_A_MISSING_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
78 #define GNUTLS_A_UNKNOWN_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
80 /* OpenPGP stuff renamed in 2.1.x. */
81 #define gnutls_openpgp_key_fmt_t gnutls_openpgp_crt_fmt_t
82 #define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT
83 #define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT
84 #define gnutls_openpgp_send_key gnutls_openpgp_send_cert
85 #define gnutls_openpgp_key_status_t gnutls_openpgp_crt_status_t
86 #define gnutls_openpgp_key_t gnutls_openpgp_crt_t
87 #define gnutls_openpgp_key_init gnutls_openpgp_crt_init
88 #define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit
89 #define gnutls_openpgp_key_import gnutls_openpgp_crt_import
90 #define gnutls_openpgp_key_export gnutls_openpgp_crt_export
91 #define gnutls_openpgp_key_get_key_usage gnutls_openpgp_crt_get_key_usage
92 #define gnutls_openpgp_key_get_fingerprint gnutls_openpgp_crt_get_fingerprint
93 #define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algorithm
94 #define gnutls_openpgp_key_get_name gnutls_openpgp_crt_get_name
95 #define gnutls_openpgp_key_get_version gnutls_openpgp_crt_get_version
96 #define gnutls_openpgp_key_get_creation_time gnutls_openpgp_crt_get_creation_time
97 #define gnutls_openpgp_key_get_expiration_time gnutls_openpgp_crt_get_expiration_time
98 #define gnutls_openpgp_key_get_id gnutls_openpgp_crt_get_id
99 #define gnutls_openpgp_key_check_hostname gnutls_openpgp_crt_check_hostname
101 /* OpenPGP stuff renamed in 2.3.x. */
102 #define gnutls_openpgp_crt_get_id gnutls_openpgp_crt_get_key_id
104 /* New better names renamed in 2.3.x, add these for backwards
105 compatibility with old poor names.*/
106 #define GNUTLS_X509_CRT_FULL GNUTLS_CRT_PRINT_FULL
107 #define GNUTLS_X509_CRT_ONELINE GNUTLS_CRT_PRINT_ONELINE
108 #define GNUTLS_X509_CRT_UNSIGNED_FULL GNUTLS_CRT_PRINT_UNSIGNED_FULL
110 /* These old #define's violate the gnutls_* namespace. */
111 #define TLS_MASTER_SIZE GNUTLS_MASTER_SIZE
112 #define TLS_RANDOM_SIZE GNUTLS_RANDOM_SIZE
114 /* Namespace problems. */
115 #define LIBGNUTLS_VERSION GNUTLS_VERSION
116 #define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR
117 #define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR
118 #define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH
119 #define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER
120 #define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION
122 /* The gnutls_retr_st was deprecated by gnutls_certificate_retrieve_function()
123 * and gnutls_retr2_st.
125 typedef struct gnutls_retr_st
127 gnutls_certificate_type_t type;
130 gnutls_x509_crt_t *x509;
131 gnutls_openpgp_crt_t pgp;
133 unsigned int ncerts; /* one for pgp keys */
137 gnutls_x509_privkey_t x509;
138 gnutls_openpgp_privkey_t pgp;
141 unsigned int deinit_all; /* if non zero all keys will be deinited */
144 typedef int gnutls_certificate_client_retrieve_function (gnutls_session_t,
150 gnutls_pk_algorithm_t
155 typedef int gnutls_certificate_server_retrieve_function (gnutls_session_t,
158 void gnutls_certificate_client_set_retrieve_function
159 (gnutls_certificate_credentials_t cred,
160 gnutls_certificate_client_retrieve_function *
161 func) _GNUTLS_GCC_ATTR_DEPRECATED;
163 gnutls_certificate_server_set_retrieve_function
164 (gnutls_certificate_credentials_t cred,
165 gnutls_certificate_server_retrieve_function *
166 func) _GNUTLS_GCC_ATTR_DEPRECATED;
168 /* External signing callback. No longer supported because it
169 * was deprecated by the PKCS #11 API. */
170 typedef int (*gnutls_sign_func) (gnutls_session_t session,
172 gnutls_certificate_type_t cert_type,
173 const gnutls_datum_t * cert,
174 const gnutls_datum_t * hash,
175 gnutls_datum_t * signature);
178 gnutls_sign_callback_set (gnutls_session_t session,
179 gnutls_sign_func sign_func, void *userdata)
180 _GNUTLS_GCC_ATTR_DEPRECATED;
182 gnutls_sign_callback_get (gnutls_session_t session, void **userdata)
183 _GNUTLS_GCC_ATTR_DEPRECATED;
185 /* Extension API is no longer exported because a lot of internal
186 * structures are used. Currently it works due to a compatibility
187 * layer, but will be removed in later versions.
189 int gnutls_ext_register (int type,
191 gnutls_ext_parse_type_t parse_type,
192 gnutls_ext_recv_func recv_func,
193 gnutls_ext_send_func send_func)
194 _GNUTLS_GCC_ATTR_DEPRECATED;
196 /* We no longer support the finished callback. Use
197 * gnutls_session_channel_binding for similar functionality.
199 typedef void (*gnutls_finished_callback_func) (gnutls_session_t session,
200 const void *finished,
202 void gnutls_session_set_finished_function (gnutls_session_t session,
203 gnutls_finished_callback_func
205 _GNUTLS_GCC_ATTR_DEPRECATED;
207 /* returns security values.
208 * Do not use them unless you know what you're doing. Those are dangerous since
209 * they depend on a particular TLS version number
211 #define GNUTLS_MASTER_SIZE 48
212 #define GNUTLS_RANDOM_SIZE 32
213 const void *gnutls_session_get_server_random (gnutls_session_t session)
214 _GNUTLS_GCC_ATTR_DEPRECATED;
215 const void *gnutls_session_get_client_random (gnutls_session_t session)
216 _GNUTLS_GCC_ATTR_DEPRECATED;
217 const void *gnutls_session_get_master_secret (gnutls_session_t session)
218 _GNUTLS_GCC_ATTR_DEPRECATED;
220 int gnutls_psk_netconf_derive_key (const char *password,
221 const char *psk_identity,
222 const char *psk_identity_hint,
225 _GNUTLS_GCC_ATTR_DEPRECATED;
227 /* This is a very dangerous and error-prone function.
228 * Use gnutls_privkey_sign_hash() instead.
230 int gnutls_x509_privkey_sign_hash (gnutls_x509_privkey_t key,
231 const gnutls_datum_t * hash,
232 gnutls_datum_t * signature)
233 _GNUTLS_GCC_ATTR_DEPRECATED;
235 int gnutls_openpgp_privkey_sign_hash (gnutls_openpgp_privkey_t key,
236 const gnutls_datum_t * hash,
237 gnutls_datum_t * signature)
238 _GNUTLS_GCC_ATTR_DEPRECATED;
241 /* Deprecated because verify_* functions are moved to public
242 * keys. Check abstract.h for similar functionality.
244 int gnutls_x509_privkey_verify_data (gnutls_x509_privkey_t key,
246 const gnutls_datum_t * data,
247 const gnutls_datum_t * signature)
248 _GNUTLS_GCC_ATTR_DEPRECATED;
250 /* we support the gnutls_privkey_sign_data() instead.
252 int gnutls_x509_privkey_sign_data (gnutls_x509_privkey_t key,
253 gnutls_digest_algorithm_t digest,
255 const gnutls_datum_t * data,
257 size_t * signature_size)
258 _GNUTLS_GCC_ATTR_DEPRECATED;
260 /* gnutls_pubkey_verify_data() */
261 int gnutls_x509_crt_verify_data (gnutls_x509_crt_t crt,
263 const gnutls_datum_t * data,
264 const gnutls_datum_t * signature)
265 _GNUTLS_GCC_ATTR_DEPRECATED;
268 /* gnutls_pubkey_verify_hash() */
269 int gnutls_x509_crt_verify_hash (gnutls_x509_crt_t crt,
271 const gnutls_datum_t * hash,
272 const gnutls_datum_t * signature)
273 _GNUTLS_GCC_ATTR_DEPRECATED;
275 /* gnutls_pubkey_get_verify_algorithm() */
276 int gnutls_x509_crt_get_verify_algorithm (gnutls_x509_crt_t crt,
277 const gnutls_datum_t * signature,
278 gnutls_digest_algorithm_t * hash)
279 _GNUTLS_GCC_ATTR_DEPRECATED;
281 /* gnutls_pubkey_get_preferred_hash_algorithm() */
282 int gnutls_x509_crt_get_preferred_hash_algorithm (gnutls_x509_crt_t crt,
283 gnutls_digest_algorithm_t
286 _GNUTLS_GCC_ATTR_DEPRECATED;
288 /* gnutls_x509_crq_privkey_sign() */
289 int gnutls_x509_crq_sign2 (gnutls_x509_crq_t crq,
290 gnutls_x509_privkey_t key,
291 gnutls_digest_algorithm_t dig,
293 _GNUTLS_GCC_ATTR_DEPRECATED;
294 int gnutls_x509_crq_sign (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key)
295 _GNUTLS_GCC_ATTR_DEPRECATED;
299 /* gnutls_x509_crl_privkey_sign */
300 int gnutls_x509_crl_sign (gnutls_x509_crl_t crl,
301 gnutls_x509_crt_t issuer,
302 gnutls_x509_privkey_t issuer_key)
303 _GNUTLS_GCC_ATTR_DEPRECATED;
304 int gnutls_x509_crl_sign2 (gnutls_x509_crl_t crl,
305 gnutls_x509_crt_t issuer,
306 gnutls_x509_privkey_t issuer_key,
307 gnutls_digest_algorithm_t dig,
309 _GNUTLS_GCC_ATTR_DEPRECATED;
312 void gnutls_certificate_get_x509_cas (gnutls_certificate_credentials_t sc,
313 gnutls_x509_crt_t ** x509_ca_list,
315 _GNUTLS_GCC_ATTR_DEPRECATED;
317 void gnutls_certificate_get_x509_crls (gnutls_certificate_credentials_t sc,
318 gnutls_x509_crl_t ** x509_crl_list,
320 _GNUTLS_GCC_ATTR_DEPRECATED;
323 gnutls_certificate_get_openpgp_keyring (gnutls_certificate_credentials_t
325 gnutls_openpgp_keyring_t *
327 _GNUTLS_GCC_ATTR_DEPRECATED;
329 /* this is obsolete (?). */
330 int gnutls_certificate_verify_peers (gnutls_session_t session)
331 _GNUTLS_GCC_ATTR_DEPRECATED;
333 /* functions to set priority of cipher suites
335 int gnutls_cipher_set_priority (gnutls_session_t session, const int *list)
336 _GNUTLS_GCC_ATTR_DEPRECATED;
337 int gnutls_mac_set_priority (gnutls_session_t session, const int *list)
338 _GNUTLS_GCC_ATTR_DEPRECATED;
339 int gnutls_compression_set_priority (gnutls_session_t session,
341 _GNUTLS_GCC_ATTR_DEPRECATED;
342 int gnutls_kx_set_priority (gnutls_session_t session, const int *list)
343 _GNUTLS_GCC_ATTR_DEPRECATED;
344 int gnutls_protocol_set_priority (gnutls_session_t session,
346 _GNUTLS_GCC_ATTR_DEPRECATED;
347 int gnutls_certificate_type_set_priority (gnutls_session_t session,
349 _GNUTLS_GCC_ATTR_DEPRECATED;
351 void gnutls_transport_set_lowat (gnutls_session_t session, int num) _GNUTLS_GCC_ATTR_DEPRECATED;
353 void gnutls_transport_set_global_errno (int err) _GNUTLS_GCC_ATTR_DEPRECATED;
359 #endif /* _GNUTLS_COMPAT_H */