Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:16

0001 /*
0002  * Copyright (C) 2008-2012 Free Software Foundation, Inc.
0003  *
0004  * Author: Nikos Mavrogiannopoulos
0005  *
0006  * This file is part of GnuTLS.
0007  *
0008  * The GnuTLS is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public License
0010  * as published by the Free Software Foundation; either version 2.1 of
0011  * the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful, but
0014  * WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public License
0019  * along with this program.  If not, see <https://www.gnu.org/licenses/>
0020  *
0021  */
0022 
0023 /* Typedefs for more compatibility with older GnuTLS. */
0024 
0025 #ifndef GNUTLS_COMPAT_H
0026 #define GNUTLS_COMPAT_H
0027 
0028 #ifdef __cplusplus
0029 extern "C" {
0030 #endif
0031 
0032 #ifdef __GNUC__
0033 
0034 #define _GNUTLS_GCC_VERSION \
0035     (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
0036 
0037 #if !defined GNUTLS_INTERNAL_BUILD
0038 #if _GNUTLS_GCC_VERSION >= 30100
0039 #define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__((__deprecated__))
0040 #endif
0041 #endif
0042 
0043 #endif /* __GNUC__ */
0044 
0045 #ifndef _GNUTLS_GCC_ATTR_DEPRECATED
0046 #define _GNUTLS_GCC_ATTR_DEPRECATED
0047 #endif
0048 
0049 /* gnutls_connection_end_t was made redundant in 2.99.0 */
0050 typedef unsigned int gnutls_connection_end_t _GNUTLS_GCC_ATTR_DEPRECATED;
0051 
0052 /* Stuff deprecated in 2.x */
0053 typedef gnutls_cipher_algorithm_t gnutls_cipher_algorithm
0054     _GNUTLS_GCC_ATTR_DEPRECATED;
0055 typedef gnutls_kx_algorithm_t gnutls_kx_algorithm _GNUTLS_GCC_ATTR_DEPRECATED;
0056 typedef gnutls_mac_algorithm_t gnutls_mac_algorithm _GNUTLS_GCC_ATTR_DEPRECATED;
0057 typedef gnutls_digest_algorithm_t gnutls_digest_algorithm
0058     _GNUTLS_GCC_ATTR_DEPRECATED;
0059 typedef gnutls_compression_method_t gnutls_compression_method
0060     _GNUTLS_GCC_ATTR_DEPRECATED;
0061 typedef gnutls_connection_end_t gnutls_connection_end
0062     _GNUTLS_GCC_ATTR_DEPRECATED;
0063 typedef gnutls_x509_crt_fmt_t gnutls_x509_crt_fmt _GNUTLS_GCC_ATTR_DEPRECATED;
0064 typedef gnutls_pk_algorithm_t gnutls_pk_algorithm _GNUTLS_GCC_ATTR_DEPRECATED;
0065 typedef gnutls_sign_algorithm_t gnutls_sign_algorithm
0066     _GNUTLS_GCC_ATTR_DEPRECATED;
0067 typedef gnutls_close_request_t gnutls_close_request _GNUTLS_GCC_ATTR_DEPRECATED;
0068 typedef gnutls_certificate_request_t gnutls_certificate_request
0069     _GNUTLS_GCC_ATTR_DEPRECATED;
0070 typedef gnutls_certificate_status_t gnutls_certificate_status
0071     _GNUTLS_GCC_ATTR_DEPRECATED;
0072 typedef gnutls_session_t gnutls_session _GNUTLS_GCC_ATTR_DEPRECATED;
0073 typedef gnutls_alert_level_t gnutls_alert_level _GNUTLS_GCC_ATTR_DEPRECATED;
0074 typedef gnutls_alert_description_t gnutls_alert_description
0075     _GNUTLS_GCC_ATTR_DEPRECATED;
0076 typedef gnutls_x509_subject_alt_name_t gnutls_x509_subject_alt_name
0077     _GNUTLS_GCC_ATTR_DEPRECATED;
0078 typedef gnutls_openpgp_privkey_t gnutls_openpgp_privkey
0079     _GNUTLS_GCC_ATTR_DEPRECATED;
0080 typedef gnutls_openpgp_keyring_t gnutls_openpgp_keyring
0081     _GNUTLS_GCC_ATTR_DEPRECATED;
0082 typedef gnutls_x509_crt_t gnutls_x509_crt _GNUTLS_GCC_ATTR_DEPRECATED;
0083 typedef gnutls_x509_privkey_t gnutls_x509_privkey _GNUTLS_GCC_ATTR_DEPRECATED;
0084 typedef gnutls_x509_crl_t gnutls_x509_crl _GNUTLS_GCC_ATTR_DEPRECATED;
0085 typedef gnutls_x509_crq_t gnutls_x509_crq _GNUTLS_GCC_ATTR_DEPRECATED;
0086 typedef gnutls_certificate_credentials_t gnutls_certificate_credentials
0087     _GNUTLS_GCC_ATTR_DEPRECATED;
0088 typedef gnutls_anon_server_credentials_t gnutls_anon_server_credentials
0089     _GNUTLS_GCC_ATTR_DEPRECATED;
0090 typedef gnutls_anon_client_credentials_t gnutls_anon_client_credentials
0091     _GNUTLS_GCC_ATTR_DEPRECATED;
0092 typedef gnutls_srp_client_credentials_t gnutls_srp_client_credentials
0093     _GNUTLS_GCC_ATTR_DEPRECATED;
0094 typedef gnutls_srp_server_credentials_t gnutls_srp_server_credentials
0095     _GNUTLS_GCC_ATTR_DEPRECATED;
0096 typedef gnutls_dh_params_t gnutls_dh_params _GNUTLS_GCC_ATTR_DEPRECATED;
0097 typedef gnutls_rsa_params_t gnutls_rsa_params _GNUTLS_GCC_ATTR_DEPRECATED;
0098 typedef gnutls_params_type_t gnutls_params_type _GNUTLS_GCC_ATTR_DEPRECATED;
0099 typedef gnutls_credentials_type_t gnutls_credentials_type
0100     _GNUTLS_GCC_ATTR_DEPRECATED;
0101 typedef gnutls_certificate_type_t gnutls_certificate_type
0102     _GNUTLS_GCC_ATTR_DEPRECATED;
0103 typedef gnutls_datum_t gnutls_datum _GNUTLS_GCC_ATTR_DEPRECATED;
0104 typedef gnutls_transport_ptr_t gnutls_transport_ptr _GNUTLS_GCC_ATTR_DEPRECATED;
0105 
0106 /* Old verification flags */
0107 #define GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT (0)
0108 
0109 /* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was
0110    modified to use the PSK alert. */
0111 #define GNUTLS_A_MISSING_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
0112 #define GNUTLS_A_UNKNOWN_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
0113 
0114 /* OpenPGP stuff renamed in 2.1.x. */
0115 #define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT
0116 #define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT
0117 #define gnutls_openpgp_send_key gnutls_openpgp_send_cert
0118 typedef gnutls_openpgp_crt_status_t gnutls_openpgp_key_status_t
0119     _GNUTLS_GCC_ATTR_DEPRECATED;
0120 typedef gnutls_openpgp_crt_t gnutls_openpgp_key_t _GNUTLS_GCC_ATTR_DEPRECATED;
0121 #define gnutls_openpgp_key_init gnutls_openpgp_crt_init
0122 #define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit
0123 #define gnutls_openpgp_key_import gnutls_openpgp_crt_import
0124 #define gnutls_openpgp_key_export gnutls_openpgp_crt_export
0125 #define gnutls_openpgp_key_get_key_usage gnutls_openpgp_crt_get_key_usage
0126 #define gnutls_openpgp_key_get_fingerprint gnutls_openpgp_crt_get_fingerprint
0127 #define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algorithm
0128 #define gnutls_openpgp_key_get_name gnutls_openpgp_crt_get_name
0129 #define gnutls_openpgp_key_get_version gnutls_openpgp_crt_get_version
0130 #define gnutls_openpgp_key_get_creation_time \
0131     gnutls_openpgp_crt_get_creation_time
0132 #define gnutls_openpgp_key_get_expiration_time \
0133     gnutls_openpgp_crt_get_expiration_time
0134 #define gnutls_openpgp_key_get_id gnutls_openpgp_crt_get_id
0135 #define gnutls_openpgp_key_check_hostname gnutls_openpgp_crt_check_hostname
0136 
0137 /* OpenPGP stuff renamed in 2.3.x. */
0138 #define gnutls_openpgp_crt_get_id gnutls_openpgp_crt_get_key_id
0139 
0140 /* New better names renamed in 2.3.x, add these for backwards
0141    compatibility with old poor names.*/
0142 #define GNUTLS_X509_CRT_FULL GNUTLS_CRT_PRINT_FULL
0143 #define GNUTLS_X509_CRT_ONELINE GNUTLS_CRT_PRINT_ONELINE
0144 #define GNUTLS_X509_CRT_UNSIGNED_FULL GNUTLS_CRT_PRINT_UNSIGNED_FULL
0145 
0146 /* Namespace problems. */
0147 #define LIBGNUTLS_VERSION GNUTLS_VERSION
0148 #define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR
0149 #define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR
0150 #define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH
0151 #define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER
0152 #define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION
0153 
0154 /* This is a very dangerous and error-prone function.
0155  * Use gnutls_privkey_sign_hash() instead.
0156  */
0157 int gnutls_x509_privkey_sign_hash(
0158     gnutls_x509_privkey_t key, const gnutls_datum_t *hash,
0159     gnutls_datum_t *signature) _GNUTLS_GCC_ATTR_DEPRECATED;
0160 
0161 int gnutls_openpgp_privkey_sign_hash(
0162     gnutls_openpgp_privkey_t key, const gnutls_datum_t *hash,
0163     gnutls_datum_t *signature) _GNUTLS_GCC_ATTR_DEPRECATED;
0164 
0165 /* gnutls_pubkey_get_preferred_hash_algorithm() */
0166 int gnutls_x509_crt_get_preferred_hash_algorithm(
0167     gnutls_x509_crt_t crt, gnutls_digest_algorithm_t *hash,
0168     unsigned int *mand) _GNUTLS_GCC_ATTR_DEPRECATED;
0169 
0170 /* use gnutls_privkey_sign_hash() with the GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA flag */
0171 
0172 #ifdef _ISOC99_SOURCE
0173 /* we provide older functions for compatibility as inline functions that
0174  * depend on gnutls_session_get_random. */
0175 
0176 static inline const void *gnutls_session_get_server_random(
0177     gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED;
0178 static inline const void *
0179 gnutls_session_get_server_random(gnutls_session_t session)
0180 {
0181     gnutls_datum_t rnd;
0182     gnutls_session_get_random(session, NULL, &rnd); /*doc-skip */
0183     return rnd.data;
0184 }
0185 
0186 static inline const void *gnutls_session_get_client_random(
0187     gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED;
0188 static inline const void *
0189 gnutls_session_get_client_random(gnutls_session_t session)
0190 {
0191     gnutls_datum_t rnd;
0192     gnutls_session_get_random(session, &rnd, NULL); /*doc-skip */
0193     return rnd.data;
0194 }
0195 #endif
0196 
0197 void gnutls_global_set_mem_functions(gnutls_alloc_function alloc_func,
0198                      gnutls_alloc_function secure_alloc_func,
0199                      gnutls_is_secure_function is_secure_func,
0200                      gnutls_realloc_function realloc_func,
0201                      gnutls_free_function free_func)
0202     _GNUTLS_GCC_ATTR_DEPRECATED;
0203 
0204 /* defined in old headers - unused nevertheless */
0205 #define GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA 0
0206 
0207 /* old compression related functions */
0208 gnutls_compression_method_t
0209 gnutls_compression_get(gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED;
0210 
0211 const char *gnutls_compression_get_name(gnutls_compression_method_t algorithm)
0212     __GNUTLS_CONST__ _GNUTLS_GCC_ATTR_DEPRECATED;
0213 
0214 gnutls_compression_method_t gnutls_compression_get_id(const char *name)
0215     __GNUTLS_CONST__ _GNUTLS_GCC_ATTR_DEPRECATED;
0216 
0217 const gnutls_compression_method_t *
0218 gnutls_compression_list(void) __GNUTLS_PURE__ _GNUTLS_GCC_ATTR_DEPRECATED;
0219 
0220 int gnutls_priority_compression_list(gnutls_priority_t pcache,
0221                      const unsigned int **list)
0222     _GNUTLS_GCC_ATTR_DEPRECATED;
0223 
0224 #ifdef __cplusplus
0225 }
0226 #endif
0227 
0228 #endif /* GNUTLS_COMPAT_H */