diff options
author | lv-426 <oxcafebaby@yahoo.com> | 2008-08-11 03:40:22 +0000 |
---|---|---|
committer | lv-426 <oxcafebaby@yahoo.com> | 2008-08-11 03:40:22 +0000 |
commit | 1c893a971fa8d04ada6c66aa9ebf525b03ed4426 (patch) | |
tree | 7a4b22d2bd11a55aa2bd2bc01495572dd260e7d6 /src/daemon/https | |
parent | 41886bcf92e8e6b943c9f0697a75f4a380952f52 (diff) | |
download | libmicrohttpd-1c893a971fa8d04ada6c66aa9ebf525b03ed4426.tar.gz libmicrohttpd-1c893a971fa8d04ada6c66aa9ebf525b03ed4426.zip |
gnutls code cleanup
symbol refactoring
Diffstat (limited to 'src/daemon/https')
120 files changed, 3752 insertions, 6656 deletions
diff --git a/src/daemon/https/compat.h b/src/daemon/https/compat.h index 32f5d2bd..137c6f94 100644 --- a/src/daemon/https/compat.h +++ b/src/daemon/https/compat.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #define gnutls_openpgp_key_status gnutls_openpgp_key_status_t | 40 | #define gnutls_openpgp_key_status gnutls_openpgp_key_status_t |
41 | #define gnutls_certificate_request gnutls_certificate_request_t | 41 | #define gnutls_certificate_request gnutls_certificate_request_t |
42 | #define gnutls_certificate_status gnutls_certificate_status_t | 42 | #define gnutls_certificate_status gnutls_certificate_status_t |
43 | #define gnutls_session gnutls_session_t | 43 | #define gnutls_session mhd_gtls_session_t |
44 | #define gnutls_alert_level gnutls_alert_level_t | 44 | #define gnutls_alert_level gnutls_alert_level_t |
45 | #define gnutls_alert_description gnutls_alert_description_t | 45 | #define gnutls_alert_description gnutls_alert_description_t |
46 | #define gnutls_x509_subject_alt_name gnutls_x509_subject_alt_name_t | 46 | #define gnutls_x509_subject_alt_name gnutls_x509_subject_alt_name_t |
@@ -56,13 +56,13 @@ | |||
56 | #define gnutls_pkcs12_bag_type gnutls_pkcs12_bag_type_t | 56 | #define gnutls_pkcs12_bag_type gnutls_pkcs12_bag_type_t |
57 | #define gnutls_pkcs12_bag gnutls_pkcs12_bag_t | 57 | #define gnutls_pkcs12_bag gnutls_pkcs12_bag_t |
58 | #define gnutls_pkcs12 gnutls_pkcs12_t | 58 | #define gnutls_pkcs12 gnutls_pkcs12_t |
59 | #define gnutls_certificate_credentials gnutls_certificate_credentials_t | 59 | #define gnutls_certificate_credentials mhd_gtls_cert_credentials_t |
60 | #define gnutls_anon_server_credentials gnutls_anon_server_credentials_t | 60 | #define gnutls_anon_server_credentials mhd_gtls_anon_server_credentials_t |
61 | #define gnutls_anon_client_credentials gnutls_anon_client_credentials_t | 61 | #define gnutls_anon_client_credentials mhd_gtls_anon_client_credentials_t |
62 | #define gnutls_srp_client_credentials gnutls_srp_client_credentials_t | 62 | #define gnutls_srp_client_credentials gnutls_srp_client_credentials_t |
63 | #define gnutls_srp_server_credentials gnutls_srp_server_credentials_t | 63 | #define gnutls_srp_server_credentials gnutls_srp_server_credentials_t |
64 | #define gnutls_dh_params gnutls_dh_params_t | 64 | #define gnutls_dh_params mhd_gtls_dh_params_t |
65 | #define gnutls_rsa_params gnutls_rsa_params_t | 65 | #define gnutls_rsa_params mhd_gtls_rsa_params_t |
66 | #define gnutls_params_type gnutls_params_type_t | 66 | #define gnutls_params_type gnutls_params_type_t |
67 | #define gnutls_credentials_type gnutls_credentials_type_t | 67 | #define gnutls_credentials_type gnutls_credentials_type_t |
68 | #define gnutls_certificate_type gnutls_certificate_type_t | 68 | #define gnutls_certificate_type gnutls_certificate_type_t |
@@ -78,7 +78,7 @@ | |||
78 | #define gnutls_openpgp_key_fmt_t gnutls_openpgp_crt_fmt_t | 78 | #define gnutls_openpgp_key_fmt_t gnutls_openpgp_crt_fmt_t |
79 | #define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT | 79 | #define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT |
80 | #define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT | 80 | #define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT |
81 | #define gnutls_openpgp_send_key gnutls_openpgp_send_cert | 81 | #define gnutls_openpgp_send_key MHD_gtls_openpgp_send_cert |
82 | #define gnutls_openpgp_key_status_t gnutls_openpgp_crt_status_t | 82 | #define gnutls_openpgp_key_status_t gnutls_openpgp_crt_status_t |
83 | #define gnutls_openpgp_key_t gnutls_openpgp_crt_t | 83 | #define gnutls_openpgp_key_t gnutls_openpgp_crt_t |
84 | #define gnutls_openpgp_key_init gnutls_openpgp_crt_init | 84 | #define gnutls_openpgp_key_init gnutls_openpgp_crt_init |
diff --git a/src/daemon/https/extra.h b/src/daemon/https/extra.h index 0c363259..1abca155 100644 --- a/src/daemon/https/extra.h +++ b/src/daemon/https/extra.h | |||
@@ -47,7 +47,7 @@ extern "C" | |||
47 | } gnutls_openpgp_crt_fmt_t; | 47 | } gnutls_openpgp_crt_fmt_t; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * gnutls_openpgp_recv_key_func - Callback prototype to get OpenPGP keys | 50 | * mhd_gtls_openpgp_recv_key_func - Callback prototype to get OpenPGP keys |
51 | * @session: a TLS session | 51 | * @session: a TLS session |
52 | * @keyfpr: key fingerprint | 52 | * @keyfpr: key fingerprint |
53 | * @keyfpr_length: length of key fingerprint | 53 | * @keyfpr_length: length of key fingerprint |
@@ -59,32 +59,32 @@ extern "C" | |||
59 | * gnutls_openpgp_set_recv_key_function(). | 59 | * gnutls_openpgp_set_recv_key_function(). |
60 | * | 60 | * |
61 | */ | 61 | */ |
62 | typedef int (*gnutls_openpgp_recv_key_func) (gnutls_session_t session, | 62 | typedef int (*mhd_gtls_openpgp_recv_key_func) (mhd_gtls_session_t session, |
63 | const unsigned char *keyfpr, | 63 | const unsigned char *keyfpr, |
64 | unsigned int keyfpr_length, | 64 | unsigned int keyfpr_length, |
65 | gnutls_datum_t * key); | 65 | gnutls_datum_t * key); |
66 | 66 | ||
67 | void gnutls_openpgp_set_recv_key_function (gnutls_session_t session, | 67 | void gnutls_openpgp_set_recv_key_function (mhd_gtls_session_t session, |
68 | gnutls_openpgp_recv_key_func | 68 | mhd_gtls_openpgp_recv_key_func |
69 | func); | 69 | func); |
70 | 70 | ||
71 | int | 71 | int |
72 | gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t | 72 | gnutls_certificate_set_openpgp_key_file (mhd_gtls_cert_credentials_t |
73 | res, const char *CERTFILE, | 73 | res, const char *CERTFILE, |
74 | const char *KEYFILE, gnutls_openpgp_crt_fmt_t); | 74 | const char *KEYFILE, gnutls_openpgp_crt_fmt_t); |
75 | int gnutls_certificate_set_openpgp_key_mem (gnutls_certificate_credentials_t | 75 | int gnutls_certificate_set_openpgp_key_mem (mhd_gtls_cert_credentials_t |
76 | res, | 76 | res, |
77 | const gnutls_datum_t * CERT, | 77 | const gnutls_datum_t * CERT, |
78 | const gnutls_datum_t * KEY, gnutls_openpgp_crt_fmt_t); | 78 | const gnutls_datum_t * KEY, gnutls_openpgp_crt_fmt_t); |
79 | 79 | ||
80 | int | 80 | int |
81 | gnutls_certificate_set_openpgp_keyring_mem | 81 | gnutls_certificate_set_openpgp_keyring_mem |
82 | (gnutls_certificate_credentials_t c, const unsigned char *data, | 82 | (mhd_gtls_cert_credentials_t c, const unsigned char *data, |
83 | size_t dlen, gnutls_openpgp_crt_fmt_t); | 83 | size_t dlen, gnutls_openpgp_crt_fmt_t); |
84 | 84 | ||
85 | int | 85 | int |
86 | gnutls_certificate_set_openpgp_keyring_file | 86 | gnutls_certificate_set_openpgp_keyring_file |
87 | (gnutls_certificate_credentials_t c, const char *file, gnutls_openpgp_crt_fmt_t); | 87 | (mhd_gtls_cert_credentials_t c, const char *file, gnutls_openpgp_crt_fmt_t); |
88 | 88 | ||
89 | /* TLS/IA stuff | 89 | /* TLS/IA stuff |
90 | */ | 90 | */ |
@@ -99,7 +99,7 @@ extern "C" | |||
99 | /* TLS/IA credential | 99 | /* TLS/IA credential |
100 | */ | 100 | */ |
101 | 101 | ||
102 | typedef int (*gnutls_ia_avp_func) (gnutls_session_t session, void *ptr, | 102 | typedef int (*gnutls_ia_avp_func) (mhd_gtls_session_t session, void *ptr, |
103 | const char *last, size_t lastlen, | 103 | const char *last, size_t lastlen, |
104 | char **next, size_t * nextlen); | 104 | char **next, size_t * nextlen); |
105 | 105 | ||
@@ -142,35 +142,35 @@ extern "C" | |||
142 | cred); | 142 | cred); |
143 | 143 | ||
144 | /* TLS/IA handshake. */ | 144 | /* TLS/IA handshake. */ |
145 | extern int gnutls_ia_handshake_p (gnutls_session_t session); | 145 | extern int gnutls_ia_handshake_p (mhd_gtls_session_t session); |
146 | 146 | ||
147 | extern int gnutls_ia_handshake (gnutls_session_t session); | 147 | extern int gnutls_ia_handshake (mhd_gtls_session_t session); |
148 | 148 | ||
149 | /* TLS/IA low level interface. */ | 149 | /* TLS/IA low level interface. */ |
150 | extern int | 150 | extern int |
151 | gnutls_ia_permute_inner_secret (gnutls_session_t session, | 151 | gnutls_ia_permute_inner_secret (mhd_gtls_session_t session, |
152 | size_t session_keys_size, | 152 | size_t session_keys_size, |
153 | const char *session_keys); | 153 | const char *session_keys); |
154 | extern int gnutls_ia_endphase_send (gnutls_session_t session, | 154 | extern int gnutls_ia_endphase_send (mhd_gtls_session_t session, |
155 | int final_p); | 155 | int final_p); |
156 | 156 | ||
157 | extern int gnutls_ia_verify_endphase (gnutls_session_t session, | 157 | extern int gnutls_ia_verify_endphase (mhd_gtls_session_t session, |
158 | const char *checksum); | 158 | const char *checksum); |
159 | 159 | ||
160 | extern ssize_t gnutls_ia_send (gnutls_session_t session, | 160 | extern ssize_t gnutls_ia_send (mhd_gtls_session_t session, |
161 | const char *data, size_t sizeofdata); | 161 | const char *data, size_t sizeofdata); |
162 | extern ssize_t gnutls_ia_recv (gnutls_session_t session, | 162 | extern ssize_t gnutls_ia_recv (mhd_gtls_session_t session, |
163 | char *data, size_t sizeofdata); | 163 | char *data, size_t sizeofdata); |
164 | 164 | ||
165 | /* Utility stuff. */ | 165 | /* Utility stuff. */ |
166 | extern int gnutls_ia_generate_challenge (gnutls_session_t session, | 166 | extern int gnutls_ia_generate_challenge (mhd_gtls_session_t session, |
167 | size_t buffer_size, | 167 | size_t buffer_size, |
168 | char *buffer); | 168 | char *buffer); |
169 | extern void gnutls_ia_extract_inner_secret (gnutls_session_t session, | 169 | extern void gnutls_ia_extract_inner_secret (mhd_gtls_session_t session, |
170 | char *buffer); | 170 | char *buffer); |
171 | 171 | ||
172 | /* Define whether inner phases are wanted. */ | 172 | /* Define whether inner phases are wanted. */ |
173 | extern void gnutls_ia_enable (gnutls_session_t session, | 173 | extern void gnutls_ia_enable (mhd_gtls_session_t session, |
174 | int allow_skip_on_resume); | 174 | int allow_skip_on_resume); |
175 | 175 | ||
176 | int gnutls_global_init_extra (void); | 176 | int gnutls_global_init_extra (void); |
diff --git a/src/daemon/https/gnutls.h b/src/daemon/https/gnutls.h index ec2c2977..61b64e99 100644 --- a/src/daemon/https/gnutls.h +++ b/src/daemon/https/gnutls.h | |||
@@ -42,21 +42,8 @@ extern "C" | |||
42 | 42 | ||
43 | #define LIBGNUTLS_VERSION "2.2.3" | 43 | #define LIBGNUTLS_VERSION "2.2.3" |
44 | 44 | ||
45 | #define LIBGNUTLS_VERSION_MAJOR 2 | ||
46 | #define LIBGNUTLS_VERSION_MINOR 2 | ||
47 | #define LIBGNUTLS_VERSION_PATCH 3 | ||
48 | |||
49 | #define LIBGNUTLS_VERSION_NUMBER 0x020203 | ||
50 | |||
51 | /* Get size_t. */ | 45 | /* Get size_t. */ |
52 | #include <stddef.h> | 46 | #include <stddef.h> |
53 | /* Get ssize_t. */ | ||
54 | #ifndef HAVE_SSIZE_T | ||
55 | # define HAVE_SSIZE_T | ||
56 | #include <sys/types.h> | ||
57 | #endif | ||
58 | /* Get time_t. */ | ||
59 | #include <time.h> | ||
60 | #include <compat.h> | 47 | #include <compat.h> |
61 | 48 | ||
62 | #define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC | 49 | #define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC |
@@ -64,6 +51,10 @@ extern "C" | |||
64 | #define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC | 51 | #define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC |
65 | #define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128 | 52 | #define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128 |
66 | 53 | ||
54 | #define GNUTLS_MAX_SESSION_ID 32 | ||
55 | #define TLS_MASTER_SIZE 48 | ||
56 | #define TLS_RANDOM_SIZE 32 | ||
57 | |||
67 | #include "microhttpd.h" | 58 | #include "microhttpd.h" |
68 | 59 | ||
69 | typedef enum | 60 | typedef enum |
@@ -72,11 +63,6 @@ extern "C" | |||
72 | GNUTLS_PARAMS_DH | 63 | GNUTLS_PARAMS_DH |
73 | } gnutls_params_type_t; | 64 | } gnutls_params_type_t; |
74 | 65 | ||
75 | /* TODO clean | ||
76 | #define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1 | ||
77 | #define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1 | ||
78 | */ | ||
79 | |||
80 | /* exported for other gnutls headers. This is the maximum number of | 66 | /* exported for other gnutls headers. This is the maximum number of |
81 | * algorithms (ciphers, kx or macs). | 67 | * algorithms (ciphers, kx or macs). |
82 | */ | 68 | */ |
@@ -148,11 +134,11 @@ extern "C" | |||
148 | */ | 134 | */ |
149 | typedef enum | 135 | typedef enum |
150 | { | 136 | { |
151 | GNUTLS_CERT_INVALID = 2, /* will be set if the certificate | 137 | GNUTLS_CERT_INVALID = 2, /* will be set if the certificate |
152 | * was not verified. | 138 | * was not verified. |
153 | */ | 139 | */ |
154 | GNUTLS_CERT_REVOKED = 32, /* in X.509 this will be set only if CRLs are checked | 140 | GNUTLS_CERT_REVOKED = 32, /* in X.509 this will be set only if CRLs are checked |
155 | */ | 141 | */ |
156 | 142 | ||
157 | /* Those are extra information about the verification | 143 | /* Those are extra information about the verification |
158 | * process. Will be set only if the certificate was | 144 | * process. Will be set only if the certificate was |
@@ -187,10 +173,6 @@ extern "C" | |||
187 | GNUTLS_X509_FMT_PEM | 173 | GNUTLS_X509_FMT_PEM |
188 | } gnutls_x509_crt_fmt_t; | 174 | } gnutls_x509_crt_fmt_t; |
189 | 175 | ||
190 | const char *gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm); | ||
191 | |||
192 | #define GNUTLS_SIGN_RSA_SHA GNUTLS_SIGN_RSA_SHA1 | ||
193 | #define GNUTLS_SIGN_DSA_SHA GNUTLS_SIGN_DSA_SHA1 | ||
194 | typedef enum | 176 | typedef enum |
195 | { | 177 | { |
196 | GNUTLS_SIGN_UNKNOWN = 0, | 178 | GNUTLS_SIGN_UNKNOWN = 0, |
@@ -204,25 +186,22 @@ extern "C" | |||
204 | GNUTLS_SIGN_RSA_SHA512 | 186 | GNUTLS_SIGN_RSA_SHA512 |
205 | } gnutls_sign_algorithm_t; | 187 | } gnutls_sign_algorithm_t; |
206 | 188 | ||
207 | const char *gnutls_sign_algorithm_get_name (gnutls_sign_algorithm_t | ||
208 | algorithm); | ||
209 | |||
210 | /* If you want to change this, then also change the define in | 189 | /* If you want to change this, then also change the define in |
211 | * gnutls_int.h, and recompile. | 190 | * gnutls_int.h, and recompile. |
212 | */ | 191 | */ |
213 | typedef void * gnutls_transport_ptr_t; | 192 | typedef void *gnutls_transport_ptr_t; |
214 | 193 | ||
215 | struct gnutls_session_int; | 194 | struct MHD_gtls_session_int; |
216 | typedef struct gnutls_session_int * gnutls_session_t; | 195 | typedef struct MHD_gtls_session_int * mhd_gtls_session_t; |
217 | 196 | ||
218 | struct gnutls_dh_params_int; | 197 | struct MHD_gtls_dh_params_int; |
219 | typedef struct gnutls_dh_params_int *gnutls_dh_params_t; | 198 | typedef struct MHD_gtls_dh_params_int * mhd_gtls_dh_params_t; |
220 | 199 | ||
221 | struct gnutls_x509_privkey_int; /* XXX ugly. */ | 200 | struct MHD_gtls_x509_privkey_int; /* XXX ugly. */ |
222 | typedef struct gnutls_x509_privkey_int *gnutls_rsa_params_t; /* XXX ugly. */ | 201 | typedef struct MHD_gtls_x509_privkey_int * mhd_gtls_rsa_params_t; /* XXX ugly. */ |
223 | 202 | ||
224 | struct gnutls_priority_st; | 203 | struct MHD_gtls_priority_st; |
225 | typedef struct gnutls_priority_st * gnutls_priority_t; | 204 | typedef struct MHD_gtls_priority_st *gnutls_priority_t; |
226 | 205 | ||
227 | typedef struct | 206 | typedef struct |
228 | { | 207 | { |
@@ -236,387 +215,330 @@ extern "C" | |||
236 | gnutls_params_type_t type; | 215 | gnutls_params_type_t type; |
237 | union params | 216 | union params |
238 | { | 217 | { |
239 | gnutls_dh_params_t dh; | 218 | mhd_gtls_dh_params_t dh; |
240 | gnutls_rsa_params_t rsa_export; | 219 | mhd_gtls_rsa_params_t rsa_export; |
241 | } params; | 220 | } params; |
242 | int deinit; | 221 | int deinit; |
243 | } gnutls_params_st; | 222 | } gnutls_params_st; |
244 | 223 | ||
245 | typedef int gnutls_params_function (gnutls_session_t, gnutls_params_type_t, | 224 | typedef int gnutls_params_function (mhd_gtls_session_t, gnutls_params_type_t, |
246 | gnutls_params_st *); | 225 | gnutls_params_st *); |
247 | 226 | ||
248 | /* internal functions */ | 227 | /* internal functions */ |
249 | 228 | int MHD_gnutls_global_init (void); | |
250 | int gnutls_init (gnutls_session_t * session, | 229 | void MHD_gnutls_global_deinit (void); |
251 | gnutls_connection_end_t con_end); | 230 | |
252 | void gnutls_deinit (gnutls_session_t session); | 231 | int MHD_gnutls_init (mhd_gtls_session_t * session, |
253 | #define _gnutls_deinit(x) gnutls_deinit(x) | 232 | gnutls_connection_end_t con_end); |
254 | 233 | void MHD_gnutls_deinit (mhd_gtls_session_t session); | |
255 | int gnutls_bye (gnutls_session_t session, gnutls_close_request_t how); | 234 | |
256 | 235 | int MHD_gnutls_bye (mhd_gtls_session_t session, gnutls_close_request_t how); | |
257 | int gnutls_handshake (gnutls_session_t session); | 236 | int MHD_gnutls_handshake (mhd_gtls_session_t session); |
258 | int gnutls_rehandshake (gnutls_session_t session); | 237 | int MHD_gnutls_rehandshake (mhd_gtls_session_t session); |
259 | 238 | gnutls_alert_description_t gnutls_alert_get (mhd_gtls_session_t session); | |
260 | gnutls_alert_description_t gnutls_alert_get (gnutls_session_t session); | 239 | int MHD_gnutls_alert_send (mhd_gtls_session_t session, |
261 | int gnutls_alert_send (gnutls_session_t session, | 240 | gnutls_alert_level_t level, |
262 | gnutls_alert_level_t level, | 241 | gnutls_alert_description_t desc); |
263 | gnutls_alert_description_t desc); | 242 | int MHD_gnutls_alert_send_appropriate (mhd_gtls_session_t session, int err); |
264 | int gnutls_alert_send_appropriate (gnutls_session_t session, int err); | 243 | const char * MHD_gnutls_alert_get_name (gnutls_alert_description_t alert); |
265 | const char *gnutls_alert_get_name (gnutls_alert_description_t alert); | 244 | |
266 | 245 | // gnutls_cipher_algorithm_t gnutls_cipher_get (mhd_gtls_session_t session); | |
267 | /* get information on the current session */ | 246 | // gnutls_kx_algorithm_t gnutls_kx_get (mhd_gtls_session_t session); |
268 | gnutls_cipher_algorithm_t gnutls_cipher_get (gnutls_session_t session); | 247 | // gnutls_mac_algorithm_t gnutls_mac_get (mhd_gtls_session_t session); |
269 | gnutls_kx_algorithm_t gnutls_kx_get (gnutls_session_t session); | 248 | // gnutls_compression_method_t gnutls_compression_get (mhd_gtls_session_t |
270 | gnutls_mac_algorithm_t gnutls_mac_get (gnutls_session_t session); | 249 | // session); |
271 | gnutls_compression_method_t gnutls_compression_get (gnutls_session_t | 250 | // gnutls_certificate_type_t gnutls_certificate_type_get (mhd_gtls_session_t |
272 | session); | 251 | // session); |
273 | gnutls_certificate_type_t gnutls_certificate_type_get (gnutls_session_t | 252 | |
274 | session); | 253 | size_t MHD_gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm); |
275 | 254 | size_t MHD_gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm); | |
276 | size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm); | ||
277 | size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm); | ||
278 | 255 | ||
279 | /* the name of the specified algorithms */ | 256 | /* the name of the specified algorithms */ |
280 | const char *gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm); | 257 | const char * MHD_gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm); |
281 | const char *gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm); | 258 | const char * MHD_gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm); |
282 | const char *gnutls_compression_get_name (gnutls_compression_method_t | 259 | const char * MHD_gnutls_compression_get_name (gnutls_compression_method_t |
283 | algorithm); | 260 | algorithm); |
284 | const char *gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm); | 261 | const char * MHD_gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm); |
285 | const char *gnutls_certificate_type_get_name (gnutls_certificate_type_t | 262 | const char * MHD_gnutls_certificate_type_get_name (gnutls_certificate_type_t |
286 | type); | 263 | type); |
287 | 264 | ||
288 | gnutls_mac_algorithm_t gnutls_mac_get_id (const char* name); | 265 | gnutls_mac_algorithm_t MHD_gtls_mac_get_id (const char *name); |
289 | gnutls_compression_method_t gnutls_compression_get_id (const char* name); | 266 | gnutls_compression_method_t MHD_gtls_compression_get_id (const char *name); |
290 | gnutls_cipher_algorithm_t gnutls_cipher_get_id (const char* name); | 267 | gnutls_cipher_algorithm_t MHD_gtls_cipher_get_id (const char *name); |
291 | gnutls_kx_algorithm_t gnutls_kx_get_id (const char* name); | 268 | gnutls_kx_algorithm_t MHD_gtls_kx_get_id (const char *name); |
292 | gnutls_protocol_t gnutls_protocol_get_id (const char* name); | 269 | gnutls_protocol_t MHD_gtls_protocol_get_id (const char *name); |
293 | gnutls_certificate_type_t gnutls_certificate_type_get_id (const char* name); | 270 | gnutls_certificate_type_t MHD_gtls_certificate_type_get_id (const char *name); |
294 | |||
295 | 271 | ||
296 | /* list supported algorithms */ | 272 | /* list supported algorithms */ |
297 | const gnutls_cipher_algorithm_t *gnutls_cipher_list (void); | 273 | const gnutls_cipher_algorithm_t * MHD_gtls_cipher_list (void); |
298 | const gnutls_mac_algorithm_t *gnutls_mac_list (void); | 274 | const gnutls_mac_algorithm_t * MHD_gtls_mac_list (void); |
299 | const gnutls_compression_method_t *gnutls_compression_list (void); | 275 | const gnutls_compression_method_t * MHD_gtls_compression_list (void); |
300 | const gnutls_protocol_t *gnutls_protocol_list (void); | 276 | const gnutls_protocol_t * MHD_gtls_protocol_list (void); |
301 | const gnutls_certificate_type_t *gnutls_certificate_type_list (void); | 277 | const gnutls_certificate_type_t * MHD_gtls_certificate_type_list (void); |
302 | const gnutls_kx_algorithm_t *gnutls_kx_list (void); | 278 | const gnutls_kx_algorithm_t * MHD_gtls_kx_list (void); |
303 | const char *gnutls_cipher_suite_info (size_t i, | ||
304 | char *id, | ||
305 | gnutls_kx_algorithm_t *kx, | ||
306 | gnutls_cipher_algorithm_t *cipher, | ||
307 | gnutls_mac_algorithm_t *mac, | ||
308 | gnutls_protocol_t *version); | ||
309 | 279 | ||
310 | /* error functions */ | 280 | /* error functions */ |
311 | int gnutls_error_is_fatal (int error); | 281 | int MHD_gtls_error_is_fatal (int error); |
312 | int gnutls_error_to_alert (int err, int *level); | 282 | int MHD_gtls_error_to_alert (int err, int *level); |
313 | 283 | void MHD_gtls_perror (int error); | |
314 | void gnutls_perror (int error); | 284 | const char * MHD_gtls_strerror (int error); |
315 | const char *gnutls_strerror (int error); | 285 | |
316 | 286 | void MHD_gtls_handshake_set_private_extensions (mhd_gtls_session_t session, | |
317 | /* Semi-internal functions. | 287 | int allow); |
318 | */ | 288 | gnutls_handshake_description_t |
319 | void gnutls_handshake_set_private_extensions (gnutls_session_t session, | 289 | MHD_gtls_handshake_get_last_out (mhd_gtls_session_t session); |
320 | int allow); | 290 | gnutls_handshake_description_t |
321 | gnutls_handshake_description_t | 291 | MHD_gtls_handshake_get_last_in (mhd_gtls_session_t session); |
322 | gnutls_handshake_get_last_out (gnutls_session_t session); | 292 | |
323 | gnutls_handshake_description_t | 293 | /* |
324 | gnutls_handshake_get_last_in (gnutls_session_t session); | 294 | * Record layer functions. |
325 | |||
326 | /* Record layer functions. | ||
327 | */ | 295 | */ |
328 | ssize_t gnutls_record_send (gnutls_session_t session, const void *data, | 296 | ssize_t MHD_gnutls_record_send (mhd_gtls_session_t session, const void *data, |
329 | size_t sizeofdata); | 297 | size_t sizeofdata); |
330 | ssize_t gnutls_record_recv (gnutls_session_t session, void *data, | 298 | ssize_t MHD_gnutls_record_recv (mhd_gtls_session_t session, void *data, |
331 | size_t sizeofdata); | 299 | size_t sizeofdata); |
332 | #define gnutls_read gnutls_record_recv | ||
333 | #define gnutls_write gnutls_record_send | ||
334 | 300 | ||
335 | void gnutls_session_enable_compatibility_mode (gnutls_session_t session); | 301 | /* provides extra compatibility */ |
302 | void MHD_gtls_record_disable_padding (mhd_gtls_session_t session); | ||
303 | size_t MHD_gtls_record_check_pending (mhd_gtls_session_t session); | ||
336 | 304 | ||
337 | void gnutls_record_disable_padding (gnutls_session_t session); | 305 | int MHD_gnutls_record_get_direction (mhd_gtls_session_t session); |
306 | size_t MHD_gnutls_record_get_max_size (mhd_gtls_session_t session); | ||
307 | ssize_t MHD_gnutls_record_set_max_size (mhd_gtls_session_t session, size_t size); | ||
338 | 308 | ||
339 | int gnutls_record_get_direction (gnutls_session_t session); | ||
340 | 309 | ||
341 | size_t gnutls_record_get_max_size (gnutls_session_t session); | 310 | int MHD_gnutls_prf (mhd_gtls_session_t session, |
342 | ssize_t gnutls_record_set_max_size (gnutls_session_t session, size_t size); | 311 | size_t label_size, const char *label, |
312 | int server_random_first, | ||
313 | size_t extra_size, const char *extra, | ||
314 | size_t outsize, char *out); | ||
343 | 315 | ||
344 | size_t gnutls_record_check_pending (gnutls_session_t session); | 316 | int MHD_gnutls_prf_raw (mhd_gtls_session_t session, |
345 | 317 | size_t label_size, const char *label, | |
346 | int gnutls_prf (gnutls_session_t session, | 318 | size_t seed_size, const char *seed, |
347 | size_t label_size, const char *label, | 319 | size_t outsize, char *out); |
348 | int server_random_first, | ||
349 | size_t extra_size, const char *extra, | ||
350 | size_t outsize, char *out); | ||
351 | |||
352 | int gnutls_prf_raw (gnutls_session_t session, | ||
353 | size_t label_size, const char *label, | ||
354 | size_t seed_size, const char *seed, | ||
355 | size_t outsize, char *out); | ||
356 | |||
357 | /* TLS Extensions */ | ||
358 | 320 | ||
321 | /* | ||
322 | * TLS Extensions | ||
323 | */ | ||
359 | typedef enum | 324 | typedef enum |
360 | { | 325 | { |
361 | GNUTLS_NAME_DNS = 1 | 326 | GNUTLS_NAME_DNS = 1 |
362 | } gnutls_server_name_type_t; | 327 | } gnutls_server_name_type_t; |
363 | 328 | ||
364 | int gnutls_server_name_set (gnutls_session_t session, | 329 | int MHD_gnutls_server_name_set (mhd_gtls_session_t session, |
365 | gnutls_server_name_type_t type, | 330 | gnutls_server_name_type_t type, |
366 | const void *name, size_t name_length); | 331 | const void *name, size_t name_length); |
367 | 332 | ||
368 | int gnutls_server_name_get (gnutls_session_t session, | 333 | int MHD_gnutls_server_name_get (mhd_gtls_session_t session, |
369 | void *data, size_t * data_length, | 334 | void *data, size_t * data_length, |
370 | unsigned int *type, unsigned int indx); | 335 | unsigned int *type, unsigned int indx); |
371 | 336 | ||
372 | /* Opaque PRF Input | 337 | /* Opaque PRF Input |
373 | * http://tools.ietf.org/id/draft-rescorla-tls-opaque-prf-input-00.txt | 338 | * http://tools.ietf.org/id/draft-rescorla-tls-opaque-prf-input-00.txt |
374 | */ | 339 | */ |
375 | 340 | ||
376 | void | 341 | void |
377 | gnutls_oprfi_enable_client (gnutls_session_t session, | 342 | MHD_gtls_oprfi_enable_client (mhd_gtls_session_t session, |
378 | size_t len, | 343 | size_t len, unsigned char *data); |
379 | unsigned char *data); | ||
380 | 344 | ||
381 | typedef int (*gnutls_oprfi_callback_func) (gnutls_session_t session, | 345 | typedef int (*gnutls_oprfi_callback_func) (mhd_gtls_session_t session, |
382 | void *userdata, | 346 | void *userdata, |
383 | size_t oprfi_len, | 347 | size_t oprfi_len, |
384 | const unsigned char *in_oprfi, | 348 | const unsigned char *in_oprfi, |
385 | unsigned char *out_oprfi); | 349 | unsigned char *out_oprfi); |
386 | 350 | ||
387 | void | 351 | void |
388 | gnutls_oprfi_enable_server (gnutls_session_t session, | 352 | MHD_gtls_oprfi_enable_server (mhd_gtls_session_t session, |
389 | gnutls_oprfi_callback_func cb, | 353 | gnutls_oprfi_callback_func cb, |
390 | void *userdata); | 354 | void *userdata); |
391 | 355 | ||
392 | /* Supplemental data, RFC 4680. */ | 356 | /* Supplemental data, RFC 4680. */ |
393 | typedef enum | 357 | typedef enum |
394 | { | 358 | { |
395 | GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA = 0 | 359 | GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA = 0 |
396 | } gnutls_supplemental_data_format_type_t; | 360 | } gnutls_supplemental_data_format_type_t; |
397 | 361 | ||
398 | const char *gnutls_supplemental_get_name | 362 | const char * MHD_gtls_supplemental_get_name |
399 | (gnutls_supplemental_data_format_type_t type); | 363 | (gnutls_supplemental_data_format_type_t type); |
400 | 364 | ||
401 | /* functions to set priority of cipher suites | 365 | int MHD_gnutls_cipher_set_priority (mhd_gtls_session_t session, const int *list); |
402 | */ | 366 | int MHD_gnutls_mac_set_priority (mhd_gtls_session_t session, const int *list); |
403 | int gnutls_cipher_set_priority (gnutls_session_t session, const int *list); | 367 | int MHD_gnutls_compression_set_priority (mhd_gtls_session_t session, |
404 | int gnutls_mac_set_priority (gnutls_session_t session, const int *list); | 368 | const int *list); |
405 | int gnutls_compression_set_priority (gnutls_session_t session, | 369 | int MHD_gnutls_kx_set_priority (mhd_gtls_session_t session, const int *list); |
406 | const int *list); | 370 | int MHD_gnutls_protocol_set_priority (mhd_gtls_session_t session, |
407 | int gnutls_kx_set_priority (gnutls_session_t session, const int *list); | 371 | const int *list); |
408 | int gnutls_protocol_set_priority (gnutls_session_t session, | 372 | int MHD_gnutls_certificate_type_set_priority (mhd_gtls_session_t session, |
409 | const int *list); | 373 | const int *list); |
410 | int gnutls_certificate_type_set_priority (gnutls_session_t session, | 374 | |
411 | const int *list); | 375 | int MHD_tls_set_default_priority (gnutls_priority_t *, const char *priority, |
412 | 376 | const char **err_pos); | |
413 | /* if you just want some defaults, use the following. | 377 | void MHD_gnutls_priority_deinit (gnutls_priority_t); |
414 | */ | 378 | |
415 | int gnutls_priority_init( gnutls_priority_t * , const char *priority, const char** err_pos); | 379 | int MHD_gnutls_priority_set (mhd_gtls_session_t session, gnutls_priority_t); |
416 | void gnutls_priority_deinit( gnutls_priority_t); | 380 | int MHD_gnutls_priority_set_direct (mhd_gtls_session_t session, |
417 | 381 | const char *priority, const char **err_pos); | |
418 | int gnutls_priority_set(gnutls_session_t session, gnutls_priority_t); | ||
419 | int gnutls_priority_set_direct(gnutls_session_t session, const char *priority, const char** err_pos); | ||
420 | |||
421 | /* for compatibility | ||
422 | */ | ||
423 | int gnutls_set_default_priority (gnutls_session_t session); | ||
424 | int gnutls_set_default_export_priority (gnutls_session_t session); | ||
425 | |||
426 | /* Returns the name of a cipher suite */ | ||
427 | const char *gnutls_cipher_suite_get_name (gnutls_kx_algorithm_t | ||
428 | kx_algorithm, | ||
429 | gnutls_cipher_algorithm_t | ||
430 | cipher_algorithm, | ||
431 | gnutls_mac_algorithm_t | ||
432 | mac_algorithm); | ||
433 | 382 | ||
434 | /* get the currently used protocol version */ | 383 | /* get the currently used protocol version */ |
435 | gnutls_protocol_t gnutls_protocol_get_version (gnutls_session_t session); | 384 | gnutls_protocol_t MHD_gnutls_protocol_get_version (mhd_gtls_session_t session); |
436 | |||
437 | const char *gnutls_protocol_get_name (gnutls_protocol_t version); | ||
438 | 385 | ||
386 | const char * MHD_gnutls_protocol_get_name (gnutls_protocol_t version); | ||
439 | 387 | ||
440 | /* get/set session | 388 | /* |
389 | * get/set session | ||
441 | */ | 390 | */ |
442 | int gnutls_session_set_data (gnutls_session_t session, | 391 | // int gnutls_session_set_data (mhd_gtls_session_t session, |
443 | const void *session_data, | 392 | // const void *session_data, |
444 | size_t session_data_size); | 393 | // size_t session_data_size); |
445 | int gnutls_session_get_data (gnutls_session_t session, void *session_data, | 394 | // int gnutls_session_get_data (mhd_gtls_session_t session, void *session_data, |
446 | size_t * session_data_size); | 395 | // size_t * session_data_size); |
447 | int gnutls_session_get_data2 (gnutls_session_t session, | 396 | // int gnutls_session_get_data2 (mhd_gtls_session_t session, |
448 | gnutls_datum_t * data); | 397 | // gnutls_datum_t * data); |
449 | 398 | ||
450 | /* returns the session ID */ | 399 | int MHD_gtls_session_get_id (mhd_gtls_session_t session, void *session_id, |
451 | #define GNUTLS_MAX_SESSION_ID 32 | 400 | size_t * session_id_size); |
452 | int gnutls_session_get_id (gnutls_session_t session, void *session_id, | ||
453 | size_t * session_id_size); | ||
454 | 401 | ||
455 | /* returns security values. | 402 | /* returns security values. |
456 | * Do not use them unless you know what you're doing. | 403 | * Do not use them unless you know what you're doing. |
457 | */ | 404 | */ |
458 | #define TLS_MASTER_SIZE 48 | 405 | const void * MHD_gtls_session_get_server_random (mhd_gtls_session_t session); |
459 | #define TLS_RANDOM_SIZE 32 | 406 | const void * MHD_gtls_session_get_client_random (mhd_gtls_session_t session); |
460 | const void *gnutls_session_get_server_random (gnutls_session_t session); | 407 | const void * MHD_gtls_session_get_master_secret (mhd_gtls_session_t session); |
461 | const void *gnutls_session_get_client_random (gnutls_session_t session); | ||
462 | const void *gnutls_session_get_master_secret (gnutls_session_t session); | ||
463 | 408 | ||
464 | /* checks if this session is a resumed one | 409 | int MHD_gtls_session_is_resumed (mhd_gtls_session_t session); |
465 | */ | ||
466 | int gnutls_session_is_resumed (gnutls_session_t session); | ||
467 | |||
468 | typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key, | ||
469 | gnutls_datum_t data); | ||
470 | typedef int (*gnutls_db_remove_func) (void *, gnutls_datum_t key); | ||
471 | typedef gnutls_datum_t (*gnutls_db_retr_func) (void *, gnutls_datum_t key); | ||
472 | |||
473 | void gnutls_db_set_cache_expiration (gnutls_session_t session, int seconds); | ||
474 | |||
475 | void gnutls_db_remove_session (gnutls_session_t session); | ||
476 | void gnutls_db_set_retrieve_function (gnutls_session_t session, | ||
477 | gnutls_db_retr_func retr_func); | ||
478 | void gnutls_db_set_remove_function (gnutls_session_t session, | ||
479 | gnutls_db_remove_func rem_func); | ||
480 | void gnutls_db_set_store_function (gnutls_session_t session, | ||
481 | gnutls_db_store_func store_func); | ||
482 | void gnutls_db_set_ptr (gnutls_session_t session, void *ptr); | ||
483 | void *gnutls_db_get_ptr (gnutls_session_t session); | ||
484 | int gnutls_db_check_entry (gnutls_session_t session, | ||
485 | gnutls_datum_t session_entry); | ||
486 | |||
487 | typedef int (*gnutls_handshake_post_client_hello_func)(gnutls_session_t); | ||
488 | void gnutls_handshake_set_post_client_hello_function(gnutls_session_t, | ||
489 | gnutls_handshake_post_client_hello_func); | ||
490 | |||
491 | void gnutls_handshake_set_max_packet_length (gnutls_session_t session, | ||
492 | size_t max); | ||
493 | |||
494 | /* Functions for setting/clearing credentials | ||
495 | */ | ||
496 | void gnutls_credentials_clear (gnutls_session_t session); | ||
497 | |||
498 | /* cred is a structure defined by the kx algorithm | ||
499 | */ | ||
500 | int gnutls_credentials_set (gnutls_session_t session, | ||
501 | gnutls_credentials_type_t type, void *cred); | ||
502 | #define gnutls_cred_set gnutls_credentials_set | ||
503 | 410 | ||
504 | /* Credential structures - used in gnutls_credentials_set(); */ | 411 | typedef int (*gnutls_handshake_post_client_hello_func) (mhd_gtls_session_t); |
412 | void MHD_gnutls_handshake_set_post_client_hello_function (mhd_gtls_session_t, | ||
413 | gnutls_handshake_post_client_hello_func); | ||
505 | 414 | ||
506 | struct gnutls_certificate_credentials_st; | 415 | void MHD_gnutls_handshake_set_max_packet_length (mhd_gtls_session_t session, |
507 | typedef struct gnutls_certificate_credentials_st | 416 | size_t max); |
508 | *gnutls_certificate_credentials_t; | ||
509 | typedef gnutls_certificate_credentials_t | ||
510 | gnutls_certificate_server_credentials; | ||
511 | typedef gnutls_certificate_credentials_t | ||
512 | gnutls_certificate_client_credentials; | ||
513 | 417 | ||
514 | typedef struct gnutls_anon_server_credentials_st | 418 | /* |
515 | *gnutls_anon_server_credentials_t; | 419 | * Functions for setting/clearing credentials |
516 | typedef struct gnutls_anon_client_credentials_st | 420 | */ |
517 | *gnutls_anon_client_credentials_t; | 421 | void MHD_gnutls_credentials_clear (mhd_gtls_session_t session); |
518 | 422 | ||
519 | void gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc); | 423 | /* |
520 | int gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials_t * sc); | 424 | * cred is a structure defined by the kx algorithm |
425 | */ | ||
426 | int MHD_gnutls_credentials_set (mhd_gtls_session_t session, | ||
427 | gnutls_credentials_type_t type, void *cred); | ||
428 | |||
429 | /* Credential structures - used in MHD_gnutls_credentials_set(); */ | ||
430 | struct mhd_gtls_certificate_credentials_st; | ||
431 | typedef struct mhd_gtls_certificate_credentials_st | ||
432 | * mhd_gtls_cert_credentials_t; | ||
433 | typedef mhd_gtls_cert_credentials_t | ||
434 | mhd_gtls_cert_server_credentials; | ||
435 | typedef mhd_gtls_cert_credentials_t | ||
436 | mhd_gtls_cert_client_credentials; | ||
437 | |||
438 | typedef struct mhd_gtls_anon_server_credentials_st | ||
439 | * mhd_gtls_anon_server_credentials_t; | ||
440 | typedef struct mhd_gtls_anon_client_credentials_st | ||
441 | * mhd_gtls_anon_client_credentials_t; | ||
442 | |||
443 | void MHD_gnutls_anon_free_server_credentials (mhd_gtls_anon_server_credentials_t | ||
444 | sc); | ||
445 | int | ||
446 | MHD_gnutls_anon_allocate_server_credentials (mhd_gtls_anon_server_credentials_t | ||
447 | * sc); | ||
521 | 448 | ||
522 | void gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res, | 449 | void MHD_gnutls_anon_set_server_dh_params (mhd_gtls_anon_server_credentials_t res, |
523 | gnutls_dh_params_t dh_params); | 450 | mhd_gtls_dh_params_t dh_params); |
524 | 451 | ||
525 | void | 452 | void |
526 | gnutls_anon_set_server_params_function (gnutls_anon_server_credentials_t | 453 | MHD_gnutls_anon_set_server_params_function (mhd_gtls_anon_server_credentials_t |
527 | res, | 454 | res, |
528 | gnutls_params_function * func); | 455 | gnutls_params_function * func); |
529 | 456 | ||
530 | void gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t | 457 | void MHD_gnutls_anon_free_client_credentials (mhd_gtls_anon_client_credentials_t |
531 | sc); | 458 | sc); |
532 | int | 459 | int |
533 | gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t | 460 | MHD_gnutls_anon_allocate_client_credentials (mhd_gtls_anon_client_credentials_t |
534 | * sc); | 461 | * sc); |
535 | 462 | ||
536 | /* CERTFILE is an x509 certificate in PEM form. | 463 | void MHD_gnutls_certificate_free_credentials (mhd_gtls_cert_credentials_t |
537 | * KEYFILE is a pkcs-1 private key in PEM form (for RSA keys). | 464 | sc); |
538 | */ | ||
539 | void gnutls_certificate_free_credentials (gnutls_certificate_credentials_t | ||
540 | sc); | ||
541 | int | 465 | int |
542 | gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t | 466 | MHD_gnutls_certificate_allocate_credentials (mhd_gtls_cert_credentials_t |
543 | * res); | 467 | * res); |
544 | 468 | ||
545 | void gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc); | 469 | void MHD_gnutls_certificate_free_keys (mhd_gtls_cert_credentials_t sc); |
546 | void gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc); | 470 | void MHD_gnutls_certificate_free_cas (mhd_gtls_cert_credentials_t sc); |
547 | void gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc); | 471 | void MHD_gnutls_certificate_free_ca_names (mhd_gtls_cert_credentials_t sc); |
548 | void gnutls_certificate_free_crls (gnutls_certificate_credentials_t sc); | 472 | void MHD_gnutls_certificate_free_crls (mhd_gtls_cert_credentials_t sc); |
549 | 473 | ||
550 | void gnutls_certificate_set_dh_params (gnutls_certificate_credentials_t res, | 474 | void MHD_gnutls_certificate_set_dh_params (mhd_gtls_cert_credentials_t res, |
551 | gnutls_dh_params_t dh_params); | 475 | mhd_gtls_dh_params_t dh_params); |
552 | void | 476 | void |
553 | gnutls_certificate_set_rsa_export_params (gnutls_certificate_credentials_t | 477 | MHD_gnutls_certificate_set_rsa_export_params (mhd_gtls_cert_credentials_t |
554 | res, | 478 | res, |
555 | gnutls_rsa_params_t rsa_params); | 479 | mhd_gtls_rsa_params_t rsa_params); |
556 | void gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_t | 480 | void MHD_gnutls_certificate_set_verify_flags (mhd_gtls_cert_credentials_t |
557 | res, unsigned int flags); | 481 | res, unsigned int flags); |
558 | void gnutls_certificate_set_verify_limits (gnutls_certificate_credentials_t | 482 | void MHD_gnutls_certificate_set_verify_limits (mhd_gtls_cert_credentials_t |
559 | res, unsigned int max_bits, | 483 | res, unsigned int max_bits, |
560 | unsigned int max_depth); | 484 | unsigned int max_depth); |
561 | 485 | ||
562 | int gnutls_certificate_set_x509_trust_file (gnutls_certificate_credentials_t | 486 | int MHD_gnutls_certificate_set_x509_trust_file (mhd_gtls_cert_credentials_t |
563 | res, const char *CAFILE, | 487 | res, const char *CAFILE, |
564 | gnutls_x509_crt_fmt_t type); | 488 | gnutls_x509_crt_fmt_t type); |
565 | int gnutls_certificate_set_x509_trust_mem (gnutls_certificate_credentials_t | 489 | int MHD_gnutls_certificate_set_x509_trust_mem (mhd_gtls_cert_credentials_t |
566 | res, const gnutls_datum_t * CA, | 490 | res, const gnutls_datum_t * CA, |
567 | gnutls_x509_crt_fmt_t type); | 491 | gnutls_x509_crt_fmt_t type); |
568 | 492 | ||
569 | int gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t | 493 | int MHD_gnutls_certificate_set_x509_crl_file (mhd_gtls_cert_credentials_t |
570 | res, const char *crlfile, | 494 | res, const char *crlfile, |
571 | gnutls_x509_crt_fmt_t type); | 495 | gnutls_x509_crt_fmt_t type); |
572 | int gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_t | 496 | int MHD_gnutls_certificate_set_x509_crl_mem (mhd_gtls_cert_credentials_t |
573 | res, const gnutls_datum_t * CRL, | 497 | res, const gnutls_datum_t * CRL, |
574 | gnutls_x509_crt_fmt_t type); | 498 | gnutls_x509_crt_fmt_t type); |
575 | 499 | ||
576 | int gnutls_certificate_set_x509_key_file (gnutls_certificate_credentials_t | 500 | /* |
577 | res, const char *CERTFILE, | 501 | * CERTFILE is an x509 certificate in PEM form. |
578 | const char *KEYFILE, | 502 | * KEYFILE is a pkcs-1 private key in PEM form (for RSA keys). |
579 | gnutls_x509_crt_fmt_t type); | 503 | */ |
580 | int gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t | 504 | int MHD_gnutls_certificate_set_x509_key_file (mhd_gtls_cert_credentials_t |
581 | res, const gnutls_datum_t * CERT, | 505 | res, const char *CERTFILE, |
582 | const gnutls_datum_t * KEY, | 506 | const char *KEYFILE, |
583 | gnutls_x509_crt_fmt_t type); | 507 | gnutls_x509_crt_fmt_t type); |
584 | 508 | int MHD_gnutls_certificate_set_x509_key_mem (mhd_gtls_cert_credentials_t | |
585 | void gnutls_certificate_send_x509_rdn_sequence (gnutls_session_t session, | 509 | res, const gnutls_datum_t * CERT, |
586 | int status); | 510 | const gnutls_datum_t * KEY, |
587 | 511 | gnutls_x509_crt_fmt_t type); | |
588 | 512 | ||
589 | extern int | 513 | void MHD_gnutls_certificate_send_x509_rdn_sequence (mhd_gtls_session_t session, |
590 | gnutls_certificate_set_x509_simple_pkcs12_file | 514 | int status); |
591 | (gnutls_certificate_credentials_t res, const char *pkcs12file, | 515 | |
592 | gnutls_x509_crt_fmt_t type, const char *password); | 516 | /* |
593 | 517 | * New functions to allow setting already parsed X.509 stuff. | |
594 | /* New functions to allow setting already parsed X.509 stuff. | ||
595 | */ | 518 | */ |
596 | struct gnutls_x509_privkey_int; | 519 | struct MHD_gtls_x509_privkey_int; |
597 | typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t; | 520 | typedef struct MHD_gtls_x509_privkey_int *gnutls_x509_privkey_t; |
598 | 521 | ||
599 | struct gnutls_x509_crl_int; | 522 | struct gnutls_x509_crl_int; |
600 | typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t; | 523 | typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t; |
601 | 524 | ||
602 | struct gnutls_x509_crt_int; | 525 | struct gnutls_x509_crt_int; |
603 | typedef struct gnutls_x509_crt_int * gnutls_x509_crt_t; | 526 | typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t; |
604 | 527 | ||
605 | int gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res, | 528 | // int gnutls_certificate_set_x509_key (mhd_gtls_cert_credentials_t res, |
606 | gnutls_x509_crt_t * cert_list, | 529 | // gnutls_x509_crt_t * cert_list, |
607 | int cert_list_size, | 530 | // int cert_list_size, |
608 | gnutls_x509_privkey_t key); | 531 | // gnutls_x509_privkey_t key); |
609 | int gnutls_certificate_set_x509_trust (gnutls_certificate_credentials_t res, | 532 | // int gnutls_certificate_set_x509_trust (mhd_gtls_cert_credentials_t res, |
610 | gnutls_x509_crt_t * ca_list, | 533 | // gnutls_x509_crt_t * ca_list, |
611 | int ca_list_size); | 534 | // int ca_list_size); |
612 | int gnutls_certificate_set_x509_crl (gnutls_certificate_credentials_t res, | 535 | // int gnutls_certificate_set_x509_crl (mhd_gtls_cert_credentials_t res, |
613 | gnutls_x509_crl_t * crl_list, | 536 | // gnutls_x509_crl_t * crl_list, |
614 | int crl_list_size); | 537 | // int crl_list_size); |
615 | 538 | ||
616 | /* global state functions | 539 | /* global state functions |
617 | */ | 540 | */ |
618 | int gnutls_global_init (void); | 541 | |
619 | void gnutls_global_deinit (void); | ||
620 | 542 | ||
621 | typedef void *(*gnutls_alloc_function) (size_t); | 543 | typedef void *(*gnutls_alloc_function) (size_t); |
622 | typedef void *(*gnutls_calloc_function) (size_t, size_t); | 544 | typedef void *(*gnutls_calloc_function) (size_t, size_t); |
@@ -625,13 +547,13 @@ extern "C" | |||
625 | typedef void *(*gnutls_realloc_function) (void *, size_t); | 547 | typedef void *(*gnutls_realloc_function) (void *, size_t); |
626 | 548 | ||
627 | extern void | 549 | extern void |
628 | gnutls_global_set_mem_functions (gnutls_alloc_function gt_alloc_func, | 550 | MHD_gtls_global_set_mem_functions (gnutls_alloc_function gt_alloc_func, |
629 | gnutls_alloc_function | 551 | gnutls_alloc_function |
630 | gt_secure_alloc_func, | 552 | gt_secure_alloc_func, |
631 | gnutls_is_secure_function | 553 | gnutls_is_secure_function |
632 | gt_is_secure_func, | 554 | gt_is_secure_func, |
633 | gnutls_realloc_function gt_realloc_func, | 555 | gnutls_realloc_function gt_realloc_func, |
634 | gnutls_free_function gt_free_func); | 556 | gnutls_free_function gt_free_func); |
635 | 557 | ||
636 | /* For use in callbacks */ | 558 | /* For use in callbacks */ |
637 | extern gnutls_alloc_function gnutls_malloc; | 559 | extern gnutls_alloc_function gnutls_malloc; |
@@ -643,235 +565,225 @@ extern "C" | |||
643 | extern char *(*gnutls_strdup) (const char *); | 565 | extern char *(*gnutls_strdup) (const char *); |
644 | 566 | ||
645 | typedef void (*gnutls_log_func) (int, const char *); | 567 | typedef void (*gnutls_log_func) (int, const char *); |
646 | void gnutls_global_set_log_function (gnutls_log_func log_func); | 568 | void MHD_gtls_global_set_log_function (gnutls_log_func log_func); |
647 | void gnutls_global_set_log_level (int level); | 569 | void MHD_gtls_global_set_log_level (int level); |
648 | 570 | ||
649 | /* Diffie Hellman parameter handling. | 571 | /* |
650 | */ | 572 | * Diffie Hellman parameter handling. |
651 | int gnutls_dh_params_init (gnutls_dh_params_t * dh_params); | ||
652 | void gnutls_dh_params_deinit (gnutls_dh_params_t dh_params); | ||
653 | int gnutls_dh_params_import_raw (gnutls_dh_params_t dh_params, | ||
654 | const gnutls_datum_t * prime, | ||
655 | const gnutls_datum_t * generator); | ||
656 | int gnutls_dh_params_import_pkcs3 (gnutls_dh_params_t params, | ||
657 | const gnutls_datum_t * pkcs3_params, | ||
658 | gnutls_x509_crt_fmt_t format); | ||
659 | int gnutls_dh_params_generate2 (gnutls_dh_params_t params, | ||
660 | unsigned int bits); | ||
661 | int gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params, | ||
662 | gnutls_x509_crt_fmt_t format, | ||
663 | unsigned char *params_data, | ||
664 | size_t * params_data_size); | ||
665 | int gnutls_dh_params_export_raw (gnutls_dh_params_t params, | ||
666 | gnutls_datum_t * prime, | ||
667 | gnutls_datum_t * generator, | ||
668 | unsigned int *bits); | ||
669 | int gnutls_dh_params_cpy (gnutls_dh_params_t dst, gnutls_dh_params_t src); | ||
670 | |||
671 | |||
672 | /* RSA params | ||
673 | */ | 573 | */ |
674 | int gnutls_rsa_params_init (gnutls_rsa_params_t * rsa_params); | 574 | int MHD_gnutls_dh_params_init (mhd_gtls_dh_params_t * dh_params); |
675 | void gnutls_rsa_params_deinit (gnutls_rsa_params_t rsa_params); | 575 | void MHD_gnutls_dh_params_deinit (mhd_gtls_dh_params_t dh_params); |
676 | int gnutls_rsa_params_cpy (gnutls_rsa_params_t dst, | 576 | int MHD_gnutls_dh_params_generate2 (mhd_gtls_dh_params_t params, |
677 | gnutls_rsa_params_t src); | 577 | unsigned int bits); |
678 | int gnutls_rsa_params_import_raw (gnutls_rsa_params_t rsa_params, | 578 | // int MHD_gnutls_dh_params_import_raw (mhd_gtls_dh_params_t dh_params, |
679 | const gnutls_datum_t * m, | 579 | // const gnutls_datum_t * prime, |
680 | const gnutls_datum_t * e, | 580 | // const gnutls_datum_t * generator); |
681 | const gnutls_datum_t * d, | 581 | // int MHD_gnutls_dh_params_export_raw (mhd_gtls_dh_params_t params, |
682 | const gnutls_datum_t * p, | 582 | // gnutls_datum_t * prime, |
683 | const gnutls_datum_t * q, | 583 | // gnutls_datum_t * generator, |
684 | const gnutls_datum_t * u); | 584 | // unsigned int *bits); |
685 | int gnutls_rsa_params_generate2 (gnutls_rsa_params_t params, | 585 | // int gnutls_dh_params_import_pkcs3 (mhd_gtls_dh_params_t params, |
686 | unsigned int bits); | 586 | // const gnutls_datum_t * pkcs3_params, |
687 | int gnutls_rsa_params_export_raw (gnutls_rsa_params_t params, | 587 | // gnutls_x509_crt_fmt_t format); |
688 | gnutls_datum_t * m, gnutls_datum_t * e, | 588 | |
689 | gnutls_datum_t * d, gnutls_datum_t * p, | 589 | // int gnutls_dh_params_export_pkcs3 (mhd_gtls_dh_params_t params, |
690 | gnutls_datum_t * q, gnutls_datum_t * u, | 590 | // gnutls_x509_crt_fmt_t format, |
691 | unsigned int *bits); | 591 | // unsigned char *params_data, |
692 | int gnutls_rsa_params_export_pkcs1 (gnutls_rsa_params_t params, | 592 | // size_t * params_data_size); |
693 | gnutls_x509_crt_fmt_t format, | 593 | |
694 | unsigned char *params_data, | 594 | /* RSA params */ |
695 | size_t * params_data_size); | 595 | int MHD_gnutls_rsa_params_init (mhd_gtls_rsa_params_t * rsa_params); |
696 | int gnutls_rsa_params_import_pkcs1 (gnutls_rsa_params_t params, | 596 | void MHD_gnutls_rsa_params_deinit (mhd_gtls_rsa_params_t rsa_params); |
697 | const gnutls_datum_t * pkcs1_params, | 597 | int MHD_gnutls_rsa_params_generate2 (mhd_gtls_rsa_params_t params, |
698 | gnutls_x509_crt_fmt_t format); | 598 | unsigned int bits); |
699 | 599 | ||
700 | /* Session stuff | 600 | // int gnutls_rsa_params_import_raw (mhd_gtls_rsa_params_t rsa_params, |
601 | // const gnutls_datum_t * m, | ||
602 | // const gnutls_datum_t * e, | ||
603 | // const gnutls_datum_t * d, | ||
604 | // const gnutls_datum_t * p, | ||
605 | // const gnutls_datum_t * q, | ||
606 | // const gnutls_datum_t * u); | ||
607 | // int gnutls_rsa_params_export_raw (mhd_gtls_rsa_params_t params, | ||
608 | // gnutls_datum_t * m, gnutls_datum_t * e, | ||
609 | // gnutls_datum_t * d, gnutls_datum_t * p, | ||
610 | // gnutls_datum_t * q, gnutls_datum_t * u, | ||
611 | // unsigned int *bits); | ||
612 | |||
613 | /* | ||
614 | * Session stuff | ||
701 | */ | 615 | */ |
702 | typedef ssize_t (*gnutls_pull_func) (gnutls_transport_ptr_t, void *, | 616 | typedef ssize_t (* mhd_gtls_pull_func) (gnutls_transport_ptr_t, void *, |
703 | size_t); | 617 | size_t); |
704 | typedef ssize_t (*gnutls_push_func) (gnutls_transport_ptr_t, const void *, | 618 | typedef ssize_t (* mhd_gtls_push_func) (gnutls_transport_ptr_t, const void *, |
705 | size_t); | 619 | size_t); |
706 | void gnutls_transport_set_ptr (gnutls_session_t session, | 620 | void MHD_gnutls_transport_set_ptr (mhd_gtls_session_t session, |
707 | gnutls_transport_ptr_t ptr); | 621 | gnutls_transport_ptr_t ptr); |
708 | void gnutls_transport_set_ptr2 (gnutls_session_t session, | 622 | void MHD_gnutls_transport_set_ptr2 (mhd_gtls_session_t session, |
709 | gnutls_transport_ptr_t recv_ptr, | 623 | gnutls_transport_ptr_t recv_ptr, |
710 | gnutls_transport_ptr_t send_ptr); | 624 | gnutls_transport_ptr_t send_ptr); |
711 | 625 | ||
712 | gnutls_transport_ptr_t gnutls_transport_get_ptr (gnutls_session_t session); | 626 | void MHD_gnutls_transport_set_lowat (mhd_gtls_session_t session, int num); |
713 | void gnutls_transport_get_ptr2 (gnutls_session_t session, | ||
714 | gnutls_transport_ptr_t * recv_ptr, | ||
715 | gnutls_transport_ptr_t * send_ptr); | ||
716 | 627 | ||
717 | void gnutls_transport_set_lowat (gnutls_session_t session, int num); | ||
718 | 628 | ||
629 | void MHD_gnutls_transport_set_push_function (mhd_gtls_session_t session, | ||
630 | mhd_gtls_push_func push_func); | ||
631 | void MHD_gnutls_transport_set_pull_function (mhd_gtls_session_t session, | ||
632 | mhd_gtls_pull_func pull_func); | ||
719 | 633 | ||
720 | void gnutls_transport_set_push_function (gnutls_session_t session, | 634 | void MHD_gnutls_transport_set_errno (mhd_gtls_session_t session, int err); |
721 | gnutls_push_func push_func); | 635 | void MHD_gnutls_transport_set_global_errno (int err); |
722 | void gnutls_transport_set_pull_function (gnutls_session_t session, | ||
723 | gnutls_pull_func pull_func); | ||
724 | 636 | ||
725 | void gnutls_transport_set_errno (gnutls_session_t session, int err); | 637 | /* |
726 | void gnutls_transport_set_global_errno (int err); | 638 | * session specific |
727 | |||
728 | /* session specific | ||
729 | */ | 639 | */ |
730 | void gnutls_session_set_ptr (gnutls_session_t session, void *ptr); | 640 | void MHD_gnutls_session_set_ptr (mhd_gtls_session_t session, void *ptr); |
731 | void *gnutls_session_get_ptr (gnutls_session_t session); | 641 | void * MHD_gtls_session_get_ptr (mhd_gtls_session_t session); |
732 | 642 | ||
733 | void gnutls_openpgp_send_cert (gnutls_session_t session, | 643 | void MHD_gtls_openpgp_send_cert (mhd_gtls_session_t session, |
734 | gnutls_openpgp_crt_status_t status); | 644 | gnutls_openpgp_crt_status_t status); |
735 | 645 | ||
736 | /* fingerprint | 646 | /* |
737 | * Actually this function returns the hash of the given data. | 647 | * this function returns the hash of the given data. |
738 | */ | 648 | */ |
739 | int gnutls_fingerprint (gnutls_digest_algorithm_t algo, | 649 | int MHD_gnutls_fingerprint (gnutls_digest_algorithm_t algo, |
740 | const gnutls_datum_t * data, void *result, | 650 | const gnutls_datum_t * data, void *result, |
741 | size_t * result_size); | 651 | size_t * result_size); |
742 | |||
743 | 652 | ||
744 | /* SRP | 653 | /* |
654 | * SRP | ||
745 | */ | 655 | */ |
746 | 656 | // typedef struct gnutls_srp_server_credentials_st | |
747 | typedef struct gnutls_srp_server_credentials_st | 657 | // *gnutls_srp_server_credentials_t; |
748 | *gnutls_srp_server_credentials_t; | 658 | // typedef struct gnutls_srp_client_credentials_st |
749 | typedef struct gnutls_srp_client_credentials_st | 659 | // *gnutls_srp_client_credentials_t; |
750 | *gnutls_srp_client_credentials_t; | 660 | // |
751 | 661 | // void gnutls_srp_free_client_credentials (gnutls_srp_client_credentials_t | |
752 | void gnutls_srp_free_client_credentials (gnutls_srp_client_credentials_t | 662 | // sc); |
753 | sc); | 663 | // int gnutls_srp_allocate_client_credentials (gnutls_srp_client_credentials_t |
754 | int gnutls_srp_allocate_client_credentials (gnutls_srp_client_credentials_t | 664 | // * sc); |
755 | * sc); | 665 | // int gnutls_srp_set_client_credentials (gnutls_srp_client_credentials_t res, |
756 | int gnutls_srp_set_client_credentials (gnutls_srp_client_credentials_t res, | 666 | // const char *username, |
757 | const char *username, const char *password); | 667 | // const char *password); |
758 | 668 | // | |
759 | void gnutls_srp_free_server_credentials (gnutls_srp_server_credentials_t | 669 | // void gnutls_srp_free_server_credentials (gnutls_srp_server_credentials_t |
760 | sc); | 670 | // sc); |
761 | int gnutls_srp_allocate_server_credentials (gnutls_srp_server_credentials_t | 671 | // int gnutls_srp_allocate_server_credentials (gnutls_srp_server_credentials_t |
762 | * sc); | 672 | // * sc); |
763 | int gnutls_srp_set_server_credentials_file (gnutls_srp_server_credentials_t | 673 | // int gnutls_srp_set_server_credentials_file (gnutls_srp_server_credentials_t |
764 | res, const char *password_file, | 674 | // res, const char *password_file, |
765 | const char *password_conf_file); | 675 | // const char *password_conf_file); |
766 | 676 | // | |
767 | const char *gnutls_srp_server_get_username (gnutls_session_t session); | 677 | // const char *gnutls_srp_server_get_username (mhd_gtls_session_t session); |
768 | 678 | // | |
769 | extern int gnutls_srp_verifier (const char *username, | 679 | // extern int gnutls_srp_verifier (const char *username, |
770 | const char *password, | 680 | // const char *password, |
771 | const gnutls_datum_t * salt, | 681 | // const gnutls_datum_t * salt, |
772 | const gnutls_datum_t * generator, | 682 | // const gnutls_datum_t * generator, |
773 | const gnutls_datum_t * prime, | 683 | // const gnutls_datum_t * prime, |
774 | gnutls_datum_t * res); | 684 | // gnutls_datum_t * res); |
775 | 685 | // | |
776 | /* The static parameters defined in draft-ietf-tls-srp-05 | 686 | ///* The static parameters defined in draft-ietf-tls-srp-05 |
777 | * Those should be used as input to gnutls_srp_verifier(). | 687 | // * Those should be used as input to gnutls_srp_verifier(). |
688 | // */ | ||
689 | // extern const gnutls_datum_t gnutls_srp_2048_group_prime; | ||
690 | // extern const gnutls_datum_t gnutls_srp_2048_group_generator; | ||
691 | // | ||
692 | // extern const gnutls_datum_t gnutls_srp_1536_group_prime; | ||
693 | // extern const gnutls_datum_t gnutls_srp_1536_group_generator; | ||
694 | // | ||
695 | // extern const gnutls_datum_t gnutls_srp_1024_group_prime; | ||
696 | // extern const gnutls_datum_t gnutls_srp_1024_group_generator; | ||
697 | // | ||
698 | // typedef int gnutls_srp_server_credentials_function (mhd_gtls_session_t, | ||
699 | // const char *username, | ||
700 | // gnutls_datum_t * salt, | ||
701 | // gnutls_datum_t * | ||
702 | // verifier, | ||
703 | // gnutls_datum_t * | ||
704 | // generator, | ||
705 | // gnutls_datum_t * prime); | ||
706 | // void | ||
707 | // gnutls_srp_set_server_credentials_function | ||
708 | // (gnutls_srp_server_credentials_t cred, | ||
709 | // gnutls_srp_server_credentials_function * func); | ||
710 | // | ||
711 | // typedef int gnutls_srp_client_credentials_function (mhd_gtls_session_t, | ||
712 | // char **, char **); | ||
713 | // void | ||
714 | // gnutls_srp_set_client_credentials_function | ||
715 | // (gnutls_srp_client_credentials_t cred, | ||
716 | // gnutls_srp_client_credentials_function * func); | ||
717 | // | ||
718 | // int gnutls_srp_base64_encode (const gnutls_datum_t * data, char *result, | ||
719 | // size_t * result_size); | ||
720 | // int gnutls_srp_base64_encode_alloc (const gnutls_datum_t * data, | ||
721 | // gnutls_datum_t * result); | ||
722 | // | ||
723 | // int gnutls_srp_base64_decode (const gnutls_datum_t * b64_data, char *result, | ||
724 | // size_t * result_size); | ||
725 | // int gnutls_srp_base64_decode_alloc (const gnutls_datum_t * b64_data, | ||
726 | // gnutls_datum_t * result); | ||
727 | |||
728 | /* | ||
729 | * PSK stuff | ||
778 | */ | 730 | */ |
779 | extern const gnutls_datum_t gnutls_srp_2048_group_prime; | 731 | // typedef struct gnutls_psk_server_credentials_st |
780 | extern const gnutls_datum_t gnutls_srp_2048_group_generator; | 732 | // *gnutls_psk_server_credentials_t; |
781 | 733 | // typedef struct gnutls_psk_client_credentials_st | |
782 | extern const gnutls_datum_t gnutls_srp_1536_group_prime; | 734 | // *gnutls_psk_client_credentials_t; |
783 | extern const gnutls_datum_t gnutls_srp_1536_group_generator; | 735 | // |
784 | 736 | // typedef enum gnutls_psk_key_flags | |
785 | extern const gnutls_datum_t gnutls_srp_1024_group_prime; | 737 | // { |
786 | extern const gnutls_datum_t gnutls_srp_1024_group_generator; | 738 | // GNUTLS_PSK_KEY_RAW = 0, |
787 | 739 | // GNUTLS_PSK_KEY_HEX | |
788 | typedef int gnutls_srp_server_credentials_function (gnutls_session_t, | 740 | // } gnutls_psk_key_flags; |
789 | const char *username, | 741 | // |
790 | gnutls_datum_t * salt, | 742 | // void gnutls_psk_free_client_credentials (gnutls_psk_client_credentials_t |
791 | gnutls_datum_t * | 743 | // sc); |
792 | verifier, | 744 | // int gnutls_psk_allocate_client_credentials (gnutls_psk_client_credentials_t |
793 | gnutls_datum_t * | 745 | // * sc); |
794 | generator, | 746 | // int gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, |
795 | gnutls_datum_t * prime); | 747 | // const char *username, |
796 | void | 748 | // const gnutls_datum_t * key, |
797 | gnutls_srp_set_server_credentials_function | 749 | // gnutls_psk_key_flags format); |
798 | (gnutls_srp_server_credentials_t cred, | 750 | // |
799 | gnutls_srp_server_credentials_function * func); | 751 | // void gnutls_psk_free_server_credentials (gnutls_psk_server_credentials_t |
800 | 752 | // sc); | |
801 | typedef int gnutls_srp_client_credentials_function (gnutls_session_t, | 753 | // int gnutls_psk_allocate_server_credentials (gnutls_psk_server_credentials_t |
802 | char **, char **); | 754 | // * sc); |
803 | void | 755 | // int gnutls_psk_set_server_credentials_file (gnutls_psk_server_credentials_t |
804 | gnutls_srp_set_client_credentials_function | 756 | // res, const char *password_file); |
805 | (gnutls_srp_client_credentials_t cred, | 757 | // |
806 | gnutls_srp_client_credentials_function * func); | 758 | // const char *gnutls_psk_server_get_username (mhd_gtls_session_t session); |
807 | 759 | // | |
808 | int gnutls_srp_base64_encode (const gnutls_datum_t * data, char *result, | 760 | // typedef int gnutls_psk_server_credentials_function (mhd_gtls_session_t, |
809 | size_t * result_size); | 761 | // const char *username, |
810 | int gnutls_srp_base64_encode_alloc (const gnutls_datum_t * data, | 762 | // gnutls_datum_t * key); |
811 | gnutls_datum_t * result); | 763 | // void |
812 | 764 | // gnutls_psk_set_server_credentials_function | |
813 | int gnutls_srp_base64_decode (const gnutls_datum_t * b64_data, char *result, | 765 | // (gnutls_psk_server_credentials_t cred, |
814 | size_t * result_size); | 766 | // gnutls_psk_server_credentials_function * func); |
815 | int gnutls_srp_base64_decode_alloc (const gnutls_datum_t * b64_data, | 767 | // |
816 | gnutls_datum_t * result); | 768 | // typedef int gnutls_psk_client_credentials_function (mhd_gtls_session_t, |
817 | 769 | // char **username, | |
818 | /* PSK stuff */ | 770 | // gnutls_datum_t * key); |
819 | typedef struct gnutls_psk_server_credentials_st | 771 | // void |
820 | *gnutls_psk_server_credentials_t; | 772 | // gnutls_psk_set_client_credentials_function |
821 | typedef struct gnutls_psk_client_credentials_st | 773 | // (gnutls_psk_client_credentials_t cred, |
822 | *gnutls_psk_client_credentials_t; | 774 | // gnutls_psk_client_credentials_function * func); |
823 | 775 | // | |
824 | typedef enum gnutls_psk_key_flags | 776 | // int gnutls_hex_encode (const gnutls_datum_t * data, char *result, |
825 | { | 777 | // size_t * result_size); |
826 | GNUTLS_PSK_KEY_RAW = 0, | 778 | // int gnutls_hex_decode (const gnutls_datum_t * hex_data, char *result, |
827 | GNUTLS_PSK_KEY_HEX | 779 | // size_t * result_size); |
828 | } gnutls_psk_key_flags; | 780 | // |
829 | 781 | // void gnutls_psk_set_server_dh_params (gnutls_psk_server_credentials_t res, | |
830 | void gnutls_psk_free_client_credentials (gnutls_psk_client_credentials_t | 782 | // mhd_gtls_dh_params_t dh_params); |
831 | sc); | 783 | // |
832 | int gnutls_psk_allocate_client_credentials (gnutls_psk_client_credentials_t | 784 | // void gnutls_psk_set_server_params_function (gnutls_psk_server_credentials_t |
833 | * sc); | 785 | // res, |
834 | int gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, | 786 | // gnutls_params_function * func); |
835 | const char *username, | ||
836 | const gnutls_datum_t * key, | ||
837 | gnutls_psk_key_flags format); | ||
838 | |||
839 | void gnutls_psk_free_server_credentials (gnutls_psk_server_credentials_t | ||
840 | sc); | ||
841 | int gnutls_psk_allocate_server_credentials (gnutls_psk_server_credentials_t | ||
842 | * sc); | ||
843 | int gnutls_psk_set_server_credentials_file (gnutls_psk_server_credentials_t | ||
844 | res, const char *password_file); | ||
845 | |||
846 | const char *gnutls_psk_server_get_username (gnutls_session_t session); | ||
847 | |||
848 | typedef int gnutls_psk_server_credentials_function (gnutls_session_t, | ||
849 | const char *username, | ||
850 | gnutls_datum_t * key); | ||
851 | void | ||
852 | gnutls_psk_set_server_credentials_function | ||
853 | (gnutls_psk_server_credentials_t cred, | ||
854 | gnutls_psk_server_credentials_function * func); | ||
855 | |||
856 | typedef int gnutls_psk_client_credentials_function (gnutls_session_t, | ||
857 | char **username, | ||
858 | gnutls_datum_t * key); | ||
859 | void | ||
860 | gnutls_psk_set_client_credentials_function | ||
861 | (gnutls_psk_client_credentials_t cred, | ||
862 | gnutls_psk_client_credentials_function * func); | ||
863 | |||
864 | int gnutls_hex_encode (const gnutls_datum_t * data, char *result, | ||
865 | size_t * result_size); | ||
866 | int gnutls_hex_decode (const gnutls_datum_t * hex_data, char *result, | ||
867 | size_t * result_size); | ||
868 | |||
869 | void gnutls_psk_set_server_dh_params (gnutls_psk_server_credentials_t res, | ||
870 | gnutls_dh_params_t dh_params); | ||
871 | |||
872 | void gnutls_psk_set_server_params_function (gnutls_psk_server_credentials_t | ||
873 | res, | ||
874 | gnutls_params_function * func); | ||
875 | 787 | ||
876 | typedef enum gnutls_x509_subject_alt_name_t | 788 | typedef enum gnutls_x509_subject_alt_name_t |
877 | { | 789 | { |
@@ -901,7 +813,7 @@ extern "C" | |||
901 | gnutls_x509_crt_t *x509; | 813 | gnutls_x509_crt_t *x509; |
902 | gnutls_openpgp_crt_t pgp; | 814 | gnutls_openpgp_crt_t pgp; |
903 | } cert; | 815 | } cert; |
904 | unsigned int ncerts; /* one for pgp keys */ | 816 | unsigned int ncerts; /* one for pgp keys */ |
905 | 817 | ||
906 | union key | 818 | union key |
907 | { | 819 | { |
@@ -909,118 +821,122 @@ extern "C" | |||
909 | gnutls_openpgp_privkey_t pgp; | 821 | gnutls_openpgp_privkey_t pgp; |
910 | } key; | 822 | } key; |
911 | 823 | ||
912 | unsigned int deinit_all; /* if non zero all keys will be deinited */ | 824 | unsigned int deinit_all; /* if non zero all keys will be deinited */ |
913 | } gnutls_retr_st; | 825 | } gnutls_retr_st; |
914 | 826 | ||
915 | typedef int gnutls_certificate_client_retrieve_function (gnutls_session_t, | 827 | typedef int gnutls_certificate_client_retrieve_function (mhd_gtls_session_t, |
916 | const | 828 | const |
917 | gnutls_datum_t * | 829 | gnutls_datum_t * |
918 | req_ca_rdn, | 830 | req_ca_rdn, |
919 | int nreqs, | 831 | int nreqs, |
920 | const | 832 | const |
921 | gnutls_pk_algorithm_t | 833 | gnutls_pk_algorithm_t |
922 | * pk_algos, | 834 | * pk_algos, |
923 | int | 835 | int |
924 | pk_algos_length, | 836 | pk_algos_length, |
925 | gnutls_retr_st *); | 837 | gnutls_retr_st *); |
926 | typedef int gnutls_certificate_server_retrieve_function (gnutls_session_t, | 838 | |
927 | gnutls_retr_st *); | 839 | typedef int gnutls_certificate_server_retrieve_function (mhd_gtls_session_t, |
928 | 840 | gnutls_retr_st *); | |
929 | 841 | ||
930 | /* Functions that allow auth_info_t structures handling | 842 | /* |
843 | * Functions that allow auth_info_t structures handling | ||
931 | */ | 844 | */ |
932 | 845 | gnutls_credentials_type_t MHD_gtls_auth_get_type (mhd_gtls_session_t session); | |
933 | gnutls_credentials_type_t gnutls_auth_get_type (gnutls_session_t session); | ||
934 | gnutls_credentials_type_t | 846 | gnutls_credentials_type_t |
935 | gnutls_auth_server_get_type (gnutls_session_t session); | 847 | MHD_gtls_auth_server_get_type (mhd_gtls_session_t session); |
936 | gnutls_credentials_type_t | 848 | gnutls_credentials_type_t |
937 | gnutls_auth_client_get_type (gnutls_session_t session); | 849 | MHD_gtls_auth_client_get_type (mhd_gtls_session_t session); |
938 | |||
939 | /* DH */ | ||
940 | 850 | ||
941 | void gnutls_dh_set_prime_bits (gnutls_session_t session, unsigned int bits); | 851 | /* |
942 | int gnutls_dh_get_secret_bits (gnutls_session_t session); | 852 | * DH |
943 | int gnutls_dh_get_peers_public_bits (gnutls_session_t session); | 853 | */ |
944 | int gnutls_dh_get_prime_bits (gnutls_session_t session); | 854 | void MHD_gnutls_dh_set_prime_bits (mhd_gtls_session_t session, unsigned int bits); |
945 | 855 | int MHD_gnutls_dh_get_secret_bits (mhd_gtls_session_t session); | |
946 | int gnutls_dh_get_group (gnutls_session_t session, gnutls_datum_t * raw_gen, | 856 | int MHD_gnutls_dh_get_peers_public_bits (mhd_gtls_session_t session); |
947 | gnutls_datum_t * raw_prime); | 857 | int MHD_gnutls_dh_get_prime_bits (mhd_gtls_session_t session); |
948 | int gnutls_dh_get_pubkey (gnutls_session_t session, | 858 | |
949 | gnutls_datum_t * raw_key); | 859 | int MHD_gnutls_dh_get_group (mhd_gtls_session_t session, gnutls_datum_t * raw_gen, |
950 | 860 | gnutls_datum_t * raw_prime); | |
951 | /* RSA */ | 861 | int MHD_gnutls_dh_get_pubkey (mhd_gtls_session_t session, |
952 | int gnutls_rsa_export_get_pubkey (gnutls_session_t session, | 862 | gnutls_datum_t * raw_key); |
953 | gnutls_datum_t * exponent, | 863 | |
954 | gnutls_datum_t * modulus); | 864 | /* |
955 | int gnutls_rsa_export_get_modulus_bits (gnutls_session_t session); | 865 | * RSA |
956 | 866 | */ | |
957 | /* X509PKI */ | 867 | int MHD_gtls_rsa_export_get_pubkey (mhd_gtls_session_t session, |
868 | gnutls_datum_t * exponent, | ||
869 | gnutls_datum_t * modulus); | ||
870 | int MHD_gtls_rsa_export_get_modulus_bits (mhd_gtls_session_t session); | ||
958 | 871 | ||
959 | /* External signing callback. Experimental. */ | 872 | /* External signing callback. Experimental. */ |
960 | typedef int (*gnutls_sign_func) (gnutls_session_t session, | 873 | typedef int (*gnutls_sign_func) (mhd_gtls_session_t session, |
961 | void *userdata, | 874 | void *userdata, |
962 | gnutls_certificate_type_t cert_type, | 875 | gnutls_certificate_type_t cert_type, |
963 | const gnutls_datum_t * cert, | 876 | const gnutls_datum_t * cert, |
964 | const gnutls_datum_t * hash, | 877 | const gnutls_datum_t * hash, |
965 | gnutls_datum_t * signature); | 878 | gnutls_datum_t * signature); |
966 | 879 | ||
967 | void gnutls_sign_callback_set (gnutls_session_t session, | 880 | void MHD_gtls_sign_callback_set (mhd_gtls_session_t session, |
968 | gnutls_sign_func sign_func, | 881 | gnutls_sign_func sign_func, void *userdata); |
969 | void *userdata); | 882 | gnutls_sign_func |
970 | gnutls_sign_func | 883 | MHD_gtls_sign_callback_get (mhd_gtls_session_t session, void **userdata); |
971 | gnutls_sign_callback_get (gnutls_session_t session, | ||
972 | void **userdata); | ||
973 | 884 | ||
974 | /* These are set on the credentials structure. | 885 | /* These are set on the credentials structure. |
975 | */ | 886 | */ |
976 | void gnutls_certificate_client_set_retrieve_function | 887 | void MHD_gtls_certificate_client_set_retrieve_function |
977 | (gnutls_certificate_credentials_t cred, | 888 | (mhd_gtls_cert_credentials_t cred, |
978 | gnutls_certificate_client_retrieve_function * func); | 889 | gnutls_certificate_client_retrieve_function * func); |
979 | void gnutls_certificate_server_set_retrieve_function | 890 | void MHD_gtls_certificate_server_set_retrieve_function |
980 | (gnutls_certificate_credentials_t cred, | 891 | (mhd_gtls_cert_credentials_t cred, |
981 | gnutls_certificate_server_retrieve_function * func); | 892 | gnutls_certificate_server_retrieve_function * func); |
982 | 893 | ||
983 | void gnutls_certificate_server_set_request (gnutls_session_t session, | 894 | void MHD_gtls_certificate_server_set_request (mhd_gtls_session_t session, |
984 | gnutls_certificate_request_t | 895 | gnutls_certificate_request_t |
985 | req); | 896 | req); |
986 | 897 | ||
987 | /* get data from the session | 898 | /* get data from the session */ |
988 | */ | 899 | const gnutls_datum_t * MHD_gtls_certificate_get_peers (mhd_gtls_session_t |
989 | const gnutls_datum_t *gnutls_certificate_get_peers (gnutls_session_t | 900 | session, |
990 | session, | 901 | unsigned int |
991 | unsigned int | 902 | *list_size); |
992 | *list_size); | 903 | const gnutls_datum_t * MHD_gtls_certificate_get_ours (mhd_gtls_session_t |
993 | const gnutls_datum_t *gnutls_certificate_get_ours (gnutls_session_t | 904 | session); |
994 | session); | ||
995 | 905 | ||
996 | time_t gnutls_certificate_activation_time_peers (gnutls_session_t session); | 906 | time_t MHD_gtls_certificate_activation_time_peers (mhd_gtls_session_t session); |
997 | time_t gnutls_certificate_expiration_time_peers (gnutls_session_t session); | 907 | time_t MHD_gtls_certificate_expiration_time_peers (mhd_gtls_session_t session); |
998 | 908 | ||
999 | int gnutls_certificate_client_get_request_status (gnutls_session_t session); | 909 | int MHD_gtls_certificate_client_get_request_status (mhd_gtls_session_t session); |
1000 | int gnutls_certificate_verify_peers2 (gnutls_session_t session, | 910 | int MHD_gtls_certificate_verify_peers2 (mhd_gtls_session_t session, |
1001 | unsigned int *status); | 911 | unsigned int *status); |
1002 | 912 | ||
1003 | /* this is obsolete (?). */ | 913 | /* this is obsolete (?). */ |
1004 | int gnutls_certificate_verify_peers (gnutls_session_t session); | 914 | int MHD_gtls_certificate_verify_peers (mhd_gtls_session_t session); |
1005 | 915 | ||
1006 | int gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, | 916 | int MHD_gtls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, |
1007 | char *result, size_t * result_size); | 917 | char *result, size_t * result_size); |
1008 | int gnutls_pem_base64_decode (const char *header, | 918 | int MHD_gtls_pem_base64_decode (const char *header, |
1009 | const gnutls_datum_t * b64_data, | 919 | const gnutls_datum_t * b64_data, |
1010 | unsigned char *result, size_t * result_size); | 920 | unsigned char *result, size_t * result_size); |
1011 | 921 | ||
1012 | int gnutls_pem_base64_encode_alloc (const char *msg, | 922 | int MHD_gtls_pem_base64_encode_alloc (const char *msg, |
1013 | const gnutls_datum_t * data, | 923 | const gnutls_datum_t * data, |
1014 | gnutls_datum_t * result); | 924 | gnutls_datum_t * result); |
1015 | int gnutls_pem_base64_decode_alloc (const char *header, | 925 | int MHD_gtls_pem_base64_decode_alloc (const char *header, |
1016 | const gnutls_datum_t * b64_data, | 926 | const gnutls_datum_t * b64_data, |
1017 | gnutls_datum_t * result); | 927 | gnutls_datum_t * result); |
1018 | 928 | ||
1019 | int gnutls_global_init (void); | 929 | // void |
1020 | 930 | // gnutls_certificate_set_params_function (mhd_gtls_cert_credentials_t | |
1021 | /* key_usage will be an OR of the following values: | 931 | // res, |
1022 | */ | 932 | // gnutls_params_function * func); |
1023 | 933 | // void gnutls_anon_set_params_function (mhd_gtls_anon_server_credentials_t res, | |
934 | // gnutls_params_function * func); | ||
935 | // void gnutls_psk_set_params_function (gnutls_psk_server_credentials_t res, | ||
936 | // gnutls_params_function * func); | ||
937 | |||
938 | |||
939 | /* key_usage will be an OR of the following values: */ | ||
1024 | /* when the key is to be used for signing: */ | 940 | /* when the key is to be used for signing: */ |
1025 | #define GNUTLS_KEY_DIGITAL_SIGNATURE 128 | 941 | #define GNUTLS_KEY_DIGITAL_SIGNATURE 128 |
1026 | #define GNUTLS_KEY_NON_REPUDIATION 64 | 942 | #define GNUTLS_KEY_NON_REPUDIATION 64 |
@@ -1033,51 +949,42 @@ extern "C" | |||
1033 | #define GNUTLS_KEY_ENCIPHER_ONLY 1 | 949 | #define GNUTLS_KEY_ENCIPHER_ONLY 1 |
1034 | #define GNUTLS_KEY_DECIPHER_ONLY 32768 | 950 | #define GNUTLS_KEY_DECIPHER_ONLY 32768 |
1035 | 951 | ||
1036 | void | 952 | /* |
1037 | gnutls_certificate_set_params_function (gnutls_certificate_credentials_t res, | 953 | * Error codes. TLS alert mapping shown in comments. |
1038 | gnutls_params_function * func); | ||
1039 | void gnutls_anon_set_params_function (gnutls_anon_server_credentials_t res, | ||
1040 | gnutls_params_function * func); | ||
1041 | void gnutls_psk_set_params_function (gnutls_psk_server_credentials_t res, | ||
1042 | gnutls_params_function * func); | ||
1043 | |||
1044 | /* Gnutls error codes. The mapping to a TLS alert is also shown in | ||
1045 | * comments. | ||
1046 | */ | 954 | */ |
1047 | |||
1048 | #define GNUTLS_E_SUCCESS 0 | 955 | #define GNUTLS_E_SUCCESS 0 |
1049 | #define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3 | 956 | #define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3 |
1050 | #define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6 | 957 | #define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6 |
1051 | #define GNUTLS_E_LARGE_PACKET -7 | 958 | #define GNUTLS_E_LARGE_PACKET -7 |
1052 | #define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSION */ | 959 | #define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSION */ |
1053 | #define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_RECORD_OVERFLOW */ | 960 | #define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_RECORD_OVERFLOW */ |
1054 | #define GNUTLS_E_INVALID_SESSION -10 | 961 | #define GNUTLS_E_INVALID_SESSION -10 |
1055 | #define GNUTLS_E_FATAL_ALERT_RECEIVED -12 | 962 | #define GNUTLS_E_FATAL_ALERT_RECEIVED -12 |
1056 | #define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */ | 963 | #define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */ |
1057 | #define GNUTLS_E_WARNING_ALERT_RECEIVED -16 | 964 | #define GNUTLS_E_WARNING_ALERT_RECEIVED -16 |
1058 | #define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18 | 965 | #define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18 |
1059 | #define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19 | 966 | #define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19 |
1060 | #define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAKE_FAILURE */ | 967 | #define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAKE_FAILURE */ |
1061 | #define GNUTLS_E_UNWANTED_ALGORITHM -22 | 968 | #define GNUTLS_E_UNWANTED_ALGORITHM -22 |
1062 | #define GNUTLS_E_MPI_SCAN_FAILED -23 | 969 | #define GNUTLS_E_MPI_SCAN_FAILED -23 |
1063 | #define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_BAD_RECORD_MAC */ | 970 | #define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_BAD_RECORD_MAC */ |
1064 | #define GNUTLS_E_MEMORY_ERROR -25 | 971 | #define GNUTLS_E_MEMORY_ERROR -25 |
1065 | #define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_FAILURE */ | 972 | #define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_FAILURE */ |
1066 | #define GNUTLS_E_COMPRESSION_FAILED -27 | 973 | #define GNUTLS_E_COMPRESSION_FAILED -27 |
1067 | #define GNUTLS_E_AGAIN -28 | 974 | #define GNUTLS_E_AGAIN -28 |
1068 | #define GNUTLS_E_EXPIRED -29 | 975 | #define GNUTLS_E_EXPIRED -29 |
1069 | #define GNUTLS_E_DB_ERROR -30 | 976 | #define GNUTLS_E_DB_ERROR -30 |
1070 | #define GNUTLS_E_SRP_PWD_ERROR -31 | 977 | #define GNUTLS_E_SRP_PWD_ERROR -31 |
1071 | #define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32 | 978 | #define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32 |
1072 | #define GNUTLS_E_INSUFICIENT_CREDENTIALS GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ | 979 | #define GNUTLS_E_INSUFICIENT_CREDENTIALS GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ |
1073 | #define GNUTLS_E_INSUFFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS | 980 | #define GNUTLS_E_INSUFFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS |
1074 | #define GNUTLS_E_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ | 981 | #define GNUTLS_E_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ |
1075 | 982 | ||
1076 | #define GNUTLS_E_HASH_FAILED -33 | 983 | #define GNUTLS_E_HASH_FAILED -33 |
1077 | #define GNUTLS_E_BASE64_DECODING_ERROR -34 | 984 | #define GNUTLS_E_BASE64_DECODING_ERROR -34 |
1078 | 985 | ||
1079 | #define GNUTLS_E_MPI_PRINT_FAILED -35 | 986 | #define GNUTLS_E_MPI_PRINT_FAILED -35 |
1080 | #define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */ | 987 | #define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */ |
1081 | #define GNUTLS_E_GOT_APPLICATION_DATA -38 | 988 | #define GNUTLS_E_GOT_APPLICATION_DATA -38 |
1082 | #define GNUTLS_E_RECORD_LIMIT_REACHED -39 | 989 | #define GNUTLS_E_RECORD_LIMIT_REACHED -39 |
1083 | #define GNUTLS_E_ENCRYPTION_FAILED -40 | 990 | #define GNUTLS_E_ENCRYPTION_FAILED -40 |
@@ -1087,13 +994,13 @@ extern "C" | |||
1087 | #define GNUTLS_E_PK_SIGN_FAILED -46 | 994 | #define GNUTLS_E_PK_SIGN_FAILED -46 |
1088 | #define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47 | 995 | #define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47 |
1089 | #define GNUTLS_E_KEY_USAGE_VIOLATION -48 | 996 | #define GNUTLS_E_KEY_USAGE_VIOLATION -48 |
1090 | #define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */ | 997 | #define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */ |
1091 | #define GNUTLS_E_INVALID_REQUEST -50 | 998 | #define GNUTLS_E_INVALID_REQUEST -50 |
1092 | #define GNUTLS_E_SHORT_MEMORY_BUFFER -51 | 999 | #define GNUTLS_E_SHORT_MEMORY_BUFFER -51 |
1093 | #define GNUTLS_E_INTERRUPTED -52 | 1000 | #define GNUTLS_E_INTERRUPTED -52 |
1094 | #define GNUTLS_E_PUSH_ERROR -53 | 1001 | #define GNUTLS_E_PUSH_ERROR -53 |
1095 | #define GNUTLS_E_PULL_ERROR -54 | 1002 | #define GNUTLS_E_PULL_ERROR -54 |
1096 | #define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_PARAMETER */ | 1003 | #define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_PARAMETER */ |
1097 | #define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56 | 1004 | #define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56 |
1098 | #define GNUTLS_E_PKCS1_WRONG_PAD -57 | 1005 | #define GNUTLS_E_PKCS1_WRONG_PAD -57 |
1099 | #define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58 | 1006 | #define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58 |
@@ -1144,7 +1051,7 @@ extern "C" | |||
1144 | #define GNUTLS_E_CERTIFICATE_ERROR -43 | 1051 | #define GNUTLS_E_CERTIFICATE_ERROR -43 |
1145 | #define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR | 1052 | #define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR |
1146 | #define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60 | 1053 | #define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60 |
1147 | #define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */ | 1054 | #define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */ |
1148 | #define GNUTLS_E_X509_UNKNOWN_SAN -62 | 1055 | #define GNUTLS_E_X509_UNKNOWN_SAN -62 |
1149 | #define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94 | 1056 | #define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94 |
1150 | #define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95 | 1057 | #define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95 |
@@ -1152,7 +1059,7 @@ extern "C" | |||
1152 | #define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97 | 1059 | #define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97 |
1153 | #define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98 | 1060 | #define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98 |
1154 | #define GNUTLS_E_INVALID_PASSWORD -99 | 1061 | #define GNUTLS_E_INVALID_PASSWORD -99 |
1155 | #define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */ | 1062 | #define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */ |
1156 | #define GNUTLS_E_CONSTRAINT_ERROR -101 | 1063 | #define GNUTLS_E_CONSTRAINT_ERROR -101 |
1157 | 1064 | ||
1158 | #define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102 | 1065 | #define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102 |
@@ -1163,7 +1070,7 @@ extern "C" | |||
1163 | #define GNUTLS_E_UNKNOWN_ALGORITHM -105 | 1070 | #define GNUTLS_E_UNKNOWN_ALGORITHM -105 |
1164 | 1071 | ||
1165 | #define GNUTLS_E_BASE64_ENCODING_ERROR -201 | 1072 | #define GNUTLS_E_BASE64_ENCODING_ERROR -201 |
1166 | #define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */ | 1073 | #define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */ |
1167 | #define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202 | 1074 | #define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202 |
1168 | #define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203 | 1075 | #define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203 |
1169 | 1076 | ||
@@ -1183,4 +1090,4 @@ extern "C" | |||
1183 | } | 1090 | } |
1184 | #endif | 1091 | #endif |
1185 | 1092 | ||
1186 | #endif /* GNUTLS_H */ | 1093 | #endif /* GNUTLS_H */ |
diff --git a/src/daemon/https/list.h b/src/daemon/https/list.h deleted file mode 100644 index f1c2faa1..00000000 --- a/src/daemon/https/list.h +++ /dev/null | |||
@@ -1,449 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001,2002 Paul Sheer | ||
3 | * | ||
4 | * This file is part of GNUTLS. | ||
5 | * | ||
6 | * GNUTLS is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 3 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * GNUTLS is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | SOAP: | ||
23 | |||
24 | Academics always want to implement hash tables (i.e. dictionaries), | ||
25 | singly or doubly linked lists, and queues, because ... well ... they | ||
26 | know how. | ||
27 | |||
28 | These datatypes are nonsense for the following reasons: | ||
29 | hash tables: Hash tables are a mapping of some | ||
30 | string to some data, where that data is going to | ||
31 | be accessed COMPLETELY RANDOMLY. This is what it | ||
32 | is for. However it is extremely rare to have a | ||
33 | large number of data elements which really are | ||
34 | being accessed in a completely random way. | ||
35 | |||
36 | lists: appending and searching through lists is always | ||
37 | slow because these operations search all the way | ||
38 | through the list. | ||
39 | |||
40 | queues: whats the difference between a queue and a list? | ||
41 | very little really. | ||
42 | |||
43 | The system implemented here is a doubly linked list with previous | ||
44 | search index that can be appended or prepended with no overhead, | ||
45 | implemented entirely in macros. It is hence as versatile as a | ||
46 | doubly/singly linked list or queue and blazingly fast. Hence doing | ||
47 | sequential searches where the next search result is likely to be | ||
48 | closely indexed to the previous (usual case), is efficient. | ||
49 | |||
50 | Of course this doesn't mean you should use this as a hash table | ||
51 | where you REALLY need a hash table. | ||
52 | |||
53 | */ | ||
54 | |||
55 | /********** example usage **********/ | ||
56 | /* | ||
57 | |||
58 | #include "list.h" | ||
59 | |||
60 | extern void free (void *x); | ||
61 | extern char *strdup (char *s); | ||
62 | |||
63 | // consider a list of elements containing an `int' and a `char *' | ||
64 | LIST_TYPE_DECLARE (names, char *s; int i;); | ||
65 | |||
66 | // for sorting, to compare elements | ||
67 | static int cm (names **a, names **b) | ||
68 | { | ||
69 | return strcmp ((*a)->s, (*b)->s); | ||
70 | } | ||
71 | |||
72 | // to free the contents of an element | ||
73 | static void free_item (names *a) | ||
74 | { | ||
75 | free (a->s); | ||
76 | a->s = 0; // say | ||
77 | a->i = 0; // say | ||
78 | } | ||
79 | |||
80 | int main (int argc, char **argv) | ||
81 | { | ||
82 | // you can separate these into LIST_TYPE_DECLARE(), LIST_DECLARE() and linit() if needed. | ||
83 | LIST_DECLARE_INIT (l, names, free_item); | ||
84 | names *j; | ||
85 | |||
86 | lappend (l); | ||
87 | l.tail->s = strdup ("hello"); | ||
88 | l.tail->i = 1; | ||
89 | lappend (l); | ||
90 | l.tail->s = strdup ("there"); | ||
91 | l.tail->i = 2; | ||
92 | lappend (l); | ||
93 | l.tail->s = strdup ("my"); | ||
94 | l.tail->i = 3; | ||
95 | lappend (l); | ||
96 | l.tail->s = strdup ("name"); | ||
97 | l.tail->i = 4; | ||
98 | lappend (l); | ||
99 | l.tail->s = strdup ("is"); | ||
100 | l.tail->i = 5; | ||
101 | lappend (l); | ||
102 | l.tail->s = strdup ("fred"); | ||
103 | l.tail->i = 6; | ||
104 | |||
105 | printf ("%ld\n\n", lcount (l)); | ||
106 | lloopforward (l, j, printf ("%d %s\n", j->i, j->s)); | ||
107 | printf ("\n"); | ||
108 | |||
109 | lsort (l, cm); | ||
110 | lloopforward (l, j, printf ("%d %s\n", j->i, j->s)); | ||
111 | |||
112 | lloopreverse (l, j, if (j->i <= 3) ldeleteinc (l, j);); | ||
113 | |||
114 | printf ("\n"); | ||
115 | lloopforward (l, j, printf ("%d %s\n", j->i, j->s)); | ||
116 | |||
117 | ldeleteall (l); | ||
118 | |||
119 | printf ("\n"); | ||
120 | lloopforward (l, j, printf ("%d %s\n", j->i, j->s)); | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | */ | ||
125 | |||
126 | |||
127 | #ifndef _LIST_H | ||
128 | #define _LIST_H | ||
129 | |||
130 | /* the `search' member points to the last found. | ||
131 | this speeds up repeated searches on the same list-item, | ||
132 | the consecutive list-item, or the pre-consecutive list-item. | ||
133 | this obviates the need for a hash table for 99% of | ||
134 | cercumstances the time */ | ||
135 | struct list | ||
136 | { | ||
137 | long length; | ||
138 | long item_size; | ||
139 | struct list_item | ||
140 | { | ||
141 | struct list_item *next; | ||
142 | struct list_item *prev; | ||
143 | char data[1]; | ||
144 | } *head, *tail, *search; | ||
145 | void (*free_func) (struct list_item *); | ||
146 | }; | ||
147 | |||
148 | /* declare a list of type `x', also called `x' having members `typelist' */ | ||
149 | |||
150 | #define LIST_TYPE_DECLARE(type,typelist) \ | ||
151 | typedef struct type { \ | ||
152 | struct type *next; \ | ||
153 | struct type *prev; \ | ||
154 | typelist \ | ||
155 | } type | ||
156 | |||
157 | #define LIST_DECLARE(l,type) \ | ||
158 | struct { \ | ||
159 | long length; \ | ||
160 | long item_size; \ | ||
161 | type *head, *tail, *search; \ | ||
162 | void (*free_func) (type *); \ | ||
163 | } l | ||
164 | |||
165 | #define LIST_DECLARE_INIT(l,type,free) \ | ||
166 | struct { \ | ||
167 | long length; \ | ||
168 | long item_size; \ | ||
169 | type *head, *tail, *search; \ | ||
170 | void (*free_func) (type *); \ | ||
171 | } l = {0, sizeof (type), 0, 0, 0, (void (*) (type *)) free} | ||
172 | |||
173 | #define linit(l,type,free) \ | ||
174 | { \ | ||
175 | memset (&(l), 0, sizeof (l)); \ | ||
176 | (l).item_size = sizeof (type); \ | ||
177 | (l).free_func = free; \ | ||
178 | } | ||
179 | |||
180 | /* returns a pointer to the data of an item */ | ||
181 | #define ldata(i) ((void *) &((i)->data[0])) | ||
182 | |||
183 | /* returns a pointer to the list head */ | ||
184 | #define lhead(l) ((l).head) | ||
185 | |||
186 | /* returns a pointer to the list tail */ | ||
187 | #define ltail(l) ((l).tail) | ||
188 | |||
189 | #define lnewsearch(l) \ | ||
190 | (l).search = 0; | ||
191 | |||
192 | /* adds to the beginning of the list */ | ||
193 | #define lprepend(l) \ | ||
194 | { \ | ||
195 | struct list_item *__t; \ | ||
196 | __t = (struct list_item *) malloc ((l).item_size); \ | ||
197 | memset (__t, 0, (l).item_size); \ | ||
198 | __t->next = (l).head; \ | ||
199 | if (__t->next) \ | ||
200 | __t->next->prev = __t; \ | ||
201 | __t->prev = 0; \ | ||
202 | if (!(l).tail) \ | ||
203 | (l).tail = __t; \ | ||
204 | (l).head = __t; \ | ||
205 | length++; \ | ||
206 | } | ||
207 | |||
208 | /* adds to the end of the list */ | ||
209 | #define lappend(l) \ | ||
210 | { \ | ||
211 | struct list_item *__t; \ | ||
212 | __t = (struct list_item *) malloc ((l).item_size); \ | ||
213 | memset (__t, 0, (l).item_size); \ | ||
214 | __t->prev = (struct list_item *) (l).tail; \ | ||
215 | if (__t->prev) \ | ||
216 | __t->prev->next = __t; \ | ||
217 | __t->next = 0; \ | ||
218 | if (!(l).head) \ | ||
219 | (l).head = (void *) __t; \ | ||
220 | (l).tail = (void *) __t; \ | ||
221 | (l).length++; \ | ||
222 | } | ||
223 | |||
224 | /* you should free these manually */ | ||
225 | #define lunlink(l,e) \ | ||
226 | { \ | ||
227 | struct list_item *__t; \ | ||
228 | (l).search = 0; \ | ||
229 | __t = (void *) e; \ | ||
230 | if ((void *) (l).head == (void *) __t) \ | ||
231 | (l).head = (l).head->next; \ | ||
232 | if ((void *) (l).tail == (void *) __t) \ | ||
233 | (l).tail = (l).tail->prev; \ | ||
234 | if (__t->next) \ | ||
235 | __t->next->prev = __t->prev; \ | ||
236 | if (__t->prev) \ | ||
237 | __t->prev->next = __t->next; \ | ||
238 | (l).length--; \ | ||
239 | } | ||
240 | |||
241 | /* deletes list entry at point e, and increments e to the following list entry */ | ||
242 | #define ldeleteinc(l,e) \ | ||
243 | { \ | ||
244 | struct list_item *__t; \ | ||
245 | (l).search = 0; \ | ||
246 | __t = (void *) e; \ | ||
247 | if ((void *) (l).head == (void *) __t) \ | ||
248 | (l).head = (l).head->next; \ | ||
249 | if ((void *) (l).tail == (void *) __t) \ | ||
250 | (l).tail = (l).tail->prev; \ | ||
251 | if (__t->next) \ | ||
252 | __t->next->prev = __t->prev; \ | ||
253 | if (__t->prev) \ | ||
254 | __t->prev->next = __t->next; \ | ||
255 | __t = __t->next; \ | ||
256 | if ((l).free_func) \ | ||
257 | (*(l).free_func) ((void *) e); \ | ||
258 | free (e); \ | ||
259 | e = (void *) __t; \ | ||
260 | (l).length--; \ | ||
261 | } | ||
262 | |||
263 | /* deletes list entry at point e, and deccrements e to the preceding list emtry */ | ||
264 | #define ldeletedec(l,e) \ | ||
265 | { \ | ||
266 | struct list_item *__t; \ | ||
267 | (l).search = 0; \ | ||
268 | __t = (void *) e; \ | ||
269 | if ((void *) (l).head == (void *) __t) \ | ||
270 | (l).head = (l).head->next; \ | ||
271 | if ((void *) (l).tail == (void *) __t) \ | ||
272 | (l).tail = (l).tail->prev; \ | ||
273 | if (__t->next) \ | ||
274 | __t->next->prev = __t->prev; \ | ||
275 | if (__t->prev) \ | ||
276 | __t->prev->next = __t->next; \ | ||
277 | __t = __t->prev; \ | ||
278 | if ((l).free_func) \ | ||
279 | (*(l).free_func) ((void *) e); \ | ||
280 | free (e); \ | ||
281 | e = (void *) __t; \ | ||
282 | (l).length--; \ | ||
283 | } | ||
284 | |||
285 | /* p and q must be consecutive and neither must be zero */ | ||
286 | #define linsert(l,p,q) \ | ||
287 | { \ | ||
288 | struct list_item *__t; \ | ||
289 | __t = (struct list_item *) malloc ((l).item_size); \ | ||
290 | memset (__t, 0, (l).item_size); \ | ||
291 | __t->prev = (void *) p; \ | ||
292 | __t->next = (void *) q; \ | ||
293 | q->prev = (void *) __t; \ | ||
294 | p->next = (void *) __t; \ | ||
295 | (l).length++; \ | ||
296 | } | ||
297 | |||
298 | /* p and q must be consecutive and neither must be zero */ | ||
299 | #define ldeleteall(l) \ | ||
300 | { \ | ||
301 | (l).search = 0; \ | ||
302 | while ((l).head) { \ | ||
303 | struct list_item *__p; \ | ||
304 | __p = (struct list_item *) (l).head; \ | ||
305 | lunlink(l, __p); \ | ||
306 | if ((l).free_func) \ | ||
307 | (*(l).free_func) ((void *) __p); \ | ||
308 | free (__p); \ | ||
309 | } \ | ||
310 | } | ||
311 | |||
312 | #define lloopstart(l,i) \ | ||
313 | for (i = (void *) (l).head; i;) { \ | ||
314 | struct list_item *__tl; \ | ||
315 | __tl = (void *) i->next; \ | ||
316 | |||
317 | #define lloopend(l,i) \ | ||
318 | i = (void *) __tl; \ | ||
319 | } \ | ||
320 | |||
321 | #define lloopforward(l,i,op) \ | ||
322 | { \ | ||
323 | for (i = (void *) (l).head; i;) { \ | ||
324 | struct list_item *__t; \ | ||
325 | __t = (void *) i->next; \ | ||
326 | op; \ | ||
327 | i = (void *) __t; \ | ||
328 | } \ | ||
329 | } | ||
330 | |||
331 | #define lloopreverse(l,i,op) \ | ||
332 | { \ | ||
333 | for (i = (void *) (l).tail; i;) { \ | ||
334 | struct list_item *__t; \ | ||
335 | __t = (void *) i->prev; \ | ||
336 | op; \ | ||
337 | i = (void *) __t; \ | ||
338 | } \ | ||
339 | } | ||
340 | |||
341 | #define lindex(l,i,n) \ | ||
342 | { \ | ||
343 | int __k; \ | ||
344 | for (__k = 0, i = (void *) (l).head; i && __k != n; i = i->next, __k++); \ | ||
345 | } | ||
346 | |||
347 | #define lsearchforward(l,i,op) \ | ||
348 | { \ | ||
349 | int __found = 0; \ | ||
350 | if (!__found) \ | ||
351 | if ((i = (void *) (l).search)) { \ | ||
352 | if (op) { \ | ||
353 | __found = 1; \ | ||
354 | (l).search = (void *) i; \ | ||
355 | } \ | ||
356 | if (!__found) \ | ||
357 | if ((i = (void *) (l).search->next)) \ | ||
358 | if (op) { \ | ||
359 | __found = 1; \ | ||
360 | (l).search = (void *) i; \ | ||
361 | } \ | ||
362 | if (!__found) \ | ||
363 | if ((i = (void *) (l).search->prev)) \ | ||
364 | if (op) { \ | ||
365 | __found = 1; \ | ||
366 | (l).search = (void *) i; \ | ||
367 | } \ | ||
368 | } \ | ||
369 | if (!__found) \ | ||
370 | for (i = (void *) (l).head; i; i = i->next) \ | ||
371 | if (op) { \ | ||
372 | __found = 1; \ | ||
373 | (l).search = (void *) i; \ | ||
374 | break; \ | ||
375 | } \ | ||
376 | } | ||
377 | |||
378 | #define lsearchreverse(l,i,op) \ | ||
379 | { \ | ||
380 | int __found = 0; \ | ||
381 | if (!__found) \ | ||
382 | if ((i = (void *) (l).search)) { \ | ||
383 | if (op) { \ | ||
384 | __found = 1; \ | ||
385 | (l).search = (void *) i; \ | ||
386 | } \ | ||
387 | if (!__found) \ | ||
388 | if ((i = (void *) (l).search->prev)) \ | ||
389 | if (op) { \ | ||
390 | __found = 1; \ | ||
391 | (l).search = (void *) i; \ | ||
392 | } \ | ||
393 | if (!__found) \ | ||
394 | if ((i = (void *) (l).search->next)) \ | ||
395 | if (op) { \ | ||
396 | __found = 1; \ | ||
397 | (l).search = (void *) i; \ | ||
398 | } \ | ||
399 | } \ | ||
400 | if (!__found) \ | ||
401 | for (i = (void *) (l).tail; i; i = i->prev) \ | ||
402 | if (op) { \ | ||
403 | __found = 1; \ | ||
404 | (l).search = (void *) i; \ | ||
405 | break; \ | ||
406 | } \ | ||
407 | } | ||
408 | |||
409 | #define lcount(l) ((l).length) | ||
410 | |||
411 | /* sort with comparison function see qsort(3) */ | ||
412 | #define larray(l,a) \ | ||
413 | { \ | ||
414 | long __i; \ | ||
415 | struct list_item *__p; \ | ||
416 | a = (void *) malloc (((l).length + 1) * sizeof (void *)); \ | ||
417 | for (__i = 0, __p = (void *) (l).head; __p; __p = __p->next, __i++) \ | ||
418 | a[__i] = (void *) __p; \ | ||
419 | a[__i] = 0; \ | ||
420 | } \ | ||
421 | |||
422 | /* sort with comparison function see qsort(3) */ | ||
423 | #define llist(l,a) \ | ||
424 | { \ | ||
425 | struct list_item *__p; \ | ||
426 | (l).head = (void *) a[0]; \ | ||
427 | (l).search = 0; \ | ||
428 | __p = (void *) a[0]; \ | ||
429 | __p->prev = 0; \ | ||
430 | for (__j = 1; a[__j]; __j++, __p = __p->next) { \ | ||
431 | __p->next = (void *) a[__j]; \ | ||
432 | __p->next->prev = __p; \ | ||
433 | } \ | ||
434 | (l).tail = (void *) __p; \ | ||
435 | __p->next = 0; \ | ||
436 | } \ | ||
437 | |||
438 | /* sort with comparison function see qsort(3) */ | ||
439 | #define lsort(l,compare) \ | ||
440 | { \ | ||
441 | void **__t; \ | ||
442 | long __j; \ | ||
443 | larray (l,__t); \ | ||
444 | qsort (__t, (l).length, sizeof (void *), (int (*) (const void *, const void *)) compare); \ | ||
445 | llist (l,__t); \ | ||
446 | free (__t); \ | ||
447 | } \ | ||
448 | |||
449 | #endif /* _LIST_H */ | ||
diff --git a/src/daemon/https/openpgp/compat.c b/src/daemon/https/openpgp/compat.c index 1ba7177a..f6ef5b0b 100644 --- a/src/daemon/https/openpgp/compat.c +++ b/src/daemon/https/openpgp/compat.c | |||
@@ -42,7 +42,7 @@ | |||
42 | * may use GnuPG for that purpose, or any other external PGP application. | 42 | * may use GnuPG for that purpose, or any other external PGP application. |
43 | -*/ | 43 | -*/ |
44 | int | 44 | int |
45 | _gnutls_openpgp_verify_key (const gnutls_certificate_credentials_t cred, | 45 | _gnutls_openpgp_verify_key (const mhd_gtls_cert_credentials_t cred, |
46 | const gnutls_datum_t * cert_list, | 46 | const gnutls_datum_t * cert_list, |
47 | int cert_list_length, unsigned int *status) | 47 | int cert_list_length, unsigned int *status) |
48 | { | 48 | { |
diff --git a/src/daemon/https/openpgp/extras.c b/src/daemon/https/openpgp/extras.c index 42b564ed..de883fa2 100644 --- a/src/daemon/https/openpgp/extras.c +++ b/src/daemon/https/openpgp/extras.c | |||
@@ -100,8 +100,8 @@ gnutls_openpgp_keyring_check_id (gnutls_openpgp_keyring_t ring, | |||
100 | cdk_pkt_pubkey_t pk; | 100 | cdk_pkt_pubkey_t pk; |
101 | uint32_t id[2]; | 101 | uint32_t id[2]; |
102 | 102 | ||
103 | id[0] = _gnutls_read_uint32 (keyid); | 103 | id[0] = mhd_gtls_read_uint32 (keyid); |
104 | id[1] = _gnutls_read_uint32 (&keyid[4]); | 104 | id[1] = mhd_gtls_read_uint32 (&keyid[4]); |
105 | 105 | ||
106 | if (!cdk_keydb_get_pk (ring->db, id, &pk)) | 106 | if (!cdk_keydb_get_pk (ring->db, id, &pk)) |
107 | { | 107 | { |
diff --git a/src/daemon/https/openpgp/gnutls_extra.c b/src/daemon/https/openpgp/gnutls_extra.c index 55166644..9ae4d6a3 100644 --- a/src/daemon/https/openpgp/gnutls_extra.c +++ b/src/daemon/https/openpgp/gnutls_extra.c | |||
@@ -43,7 +43,7 @@ static int _gnutls_init_extra = 0; | |||
43 | * This function initializes the global state of gnutls-extra library | 43 | * This function initializes the global state of gnutls-extra library |
44 | * to defaults. Returns zero on success. | 44 | * to defaults. Returns zero on success. |
45 | * | 45 | * |
46 | * Note that gnutls_global_init() has to be called before this | 46 | * Note that MHD_gnutls_global_init() has to be called before this |
47 | * function. If this function is not called then the gnutls-extra | 47 | * function. If this function is not called then the gnutls-extra |
48 | * library will not be usable. | 48 | * library will not be usable. |
49 | * | 49 | * |
diff --git a/src/daemon/https/openpgp/gnutls_extra.h b/src/daemon/https/openpgp/gnutls_extra.h index de7fc889..f9d88c1c 100644 --- a/src/daemon/https/openpgp/gnutls_extra.h +++ b/src/daemon/https/openpgp/gnutls_extra.h | |||
@@ -25,14 +25,14 @@ | |||
25 | #include <auth_cert.h> | 25 | #include <auth_cert.h> |
26 | 26 | ||
27 | typedef int (*OPENPGP_VERIFY_KEY_FUNC) (const | 27 | typedef int (*OPENPGP_VERIFY_KEY_FUNC) (const |
28 | gnutls_certificate_credentials_t, | 28 | mhd_gtls_cert_credentials_t, |
29 | const gnutls_datum_t *, int, | 29 | const gnutls_datum_t *, int, |
30 | unsigned int *); | 30 | unsigned int *); |
31 | 31 | ||
32 | typedef time_t (*OPENPGP_KEY_CREATION_TIME_FUNC) (const gnutls_datum_t *); | 32 | typedef time_t (*OPENPGP_KEY_CREATION_TIME_FUNC) (const gnutls_datum_t *); |
33 | typedef time_t (*OPENPGP_KEY_EXPIRATION_TIME_FUNC) (const gnutls_datum_t *); | 33 | typedef time_t (*OPENPGP_KEY_EXPIRATION_TIME_FUNC) (const gnutls_datum_t *); |
34 | typedef int (*OPENPGP_KEY_REQUEST) (gnutls_session_t, gnutls_datum_t *, | 34 | typedef int (*OPENPGP_KEY_REQUEST) (mhd_gtls_session_t, gnutls_datum_t *, |
35 | const gnutls_certificate_credentials_t, | 35 | const mhd_gtls_cert_credentials_t, |
36 | opaque *, int); | 36 | opaque *, int); |
37 | 37 | ||
38 | typedef int (*OPENPGP_FINGERPRINT) (const gnutls_datum_t *, | 38 | typedef int (*OPENPGP_FINGERPRINT) (const gnutls_datum_t *, |
diff --git a/src/daemon/https/openpgp/gnutls_ia.c b/src/daemon/https/openpgp/gnutls_ia.c index def4a589..b0751e85 100644 --- a/src/daemon/https/openpgp/gnutls_ia.c +++ b/src/daemon/https/openpgp/gnutls_ia.c | |||
@@ -71,7 +71,7 @@ static const char challenge_label[] = "inner application challenge"; | |||
71 | this return E_AGAIN and E_INTERRUPTED, call this function again | 71 | this return E_AGAIN and E_INTERRUPTED, call this function again |
72 | with data==NULL&&sizeofdata=0NULL until it returns successfully. */ | 72 | with data==NULL&&sizeofdata=0NULL until it returns successfully. */ |
73 | static ssize_t | 73 | static ssize_t |
74 | _gnutls_send_inner_application (gnutls_session_t session, | 74 | _gnutls_send_inner_application (mhd_gtls_session_t session, |
75 | gnutls_ia_apptype_t msg_type, | 75 | gnutls_ia_apptype_t msg_type, |
76 | const char *data, size_t sizeofdata) | 76 | const char *data, size_t sizeofdata) |
77 | { | 77 | { |
@@ -90,11 +90,11 @@ _gnutls_send_inner_application (gnutls_session_t session, | |||
90 | } | 90 | } |
91 | 91 | ||
92 | *(unsigned char *) p = (unsigned char) (msg_type & 0xFF); | 92 | *(unsigned char *) p = (unsigned char) (msg_type & 0xFF); |
93 | _gnutls_write_uint24 (sizeofdata, p + 1); | 93 | mhd_gtls_write_uint24 (sizeofdata, p + 1); |
94 | memcpy (p + 4, data, sizeofdata); | 94 | memcpy (p + 4, data, sizeofdata); |
95 | } | 95 | } |
96 | 96 | ||
97 | len = _gnutls_send_int (session, GNUTLS_INNER_APPLICATION, -1, p, plen); | 97 | len = mhd_gtls_send_int (session, GNUTLS_INNER_APPLICATION, -1, p, plen); |
98 | 98 | ||
99 | if (p) | 99 | if (p) |
100 | gnutls_free (p); | 100 | gnutls_free (p); |
@@ -106,14 +106,14 @@ _gnutls_send_inner_application (gnutls_session_t session, | |||
106 | *MSG_TYPE, and the data in DATA of max SIZEOFDATA size. Return the | 106 | *MSG_TYPE, and the data in DATA of max SIZEOFDATA size. Return the |
107 | number of bytes read, or an error code. */ | 107 | number of bytes read, or an error code. */ |
108 | static ssize_t | 108 | static ssize_t |
109 | _gnutls_recv_inner_application (gnutls_session_t session, | 109 | _gnutls_recv_inner_application (mhd_gtls_session_t session, |
110 | gnutls_ia_apptype_t * msg_type, | 110 | gnutls_ia_apptype_t * msg_type, |
111 | opaque * data, size_t sizeofdata) | 111 | opaque * data, size_t sizeofdata) |
112 | { | 112 | { |
113 | ssize_t len; | 113 | ssize_t len; |
114 | opaque pkt[4]; | 114 | opaque pkt[4]; |
115 | 115 | ||
116 | len = _gnutls_recv_int (session, GNUTLS_INNER_APPLICATION, -1, pkt, 4); | 116 | len = mhd_gtls_recv_int (session, GNUTLS_INNER_APPLICATION, -1, pkt, 4); |
117 | if (len != 4) | 117 | if (len != 4) |
118 | { | 118 | { |
119 | gnutls_assert (); | 119 | gnutls_assert (); |
@@ -121,7 +121,7 @@ _gnutls_recv_inner_application (gnutls_session_t session, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | *msg_type = pkt[0]; | 123 | *msg_type = pkt[0]; |
124 | len = _gnutls_read_uint24 (&pkt[1]); | 124 | len = mhd_gtls_read_uint24 (&pkt[1]); |
125 | 125 | ||
126 | if (*msg_type != GNUTLS_IA_APPLICATION_PAYLOAD && len != CHECKSUM_SIZE) | 126 | if (*msg_type != GNUTLS_IA_APPLICATION_PAYLOAD && len != CHECKSUM_SIZE) |
127 | { | 127 | { |
@@ -140,7 +140,7 @@ _gnutls_recv_inner_application (gnutls_session_t session, | |||
140 | { | 140 | { |
141 | int tmplen = len; | 141 | int tmplen = len; |
142 | 142 | ||
143 | len = _gnutls_recv_int (session, GNUTLS_INNER_APPLICATION, -1, | 143 | len = mhd_gtls_recv_int (session, GNUTLS_INNER_APPLICATION, -1, |
144 | data, tmplen); | 144 | data, tmplen); |
145 | if (len != tmplen) | 145 | if (len != tmplen) |
146 | { | 146 | { |
@@ -159,7 +159,7 @@ _gnutls_recv_inner_application (gnutls_session_t session, | |||
159 | respectively). LABEL and LABEL_SIZE is used as the label. The | 159 | respectively). LABEL and LABEL_SIZE is used as the label. The |
160 | result is placed in pre-allocated OUT of OUTSIZE length. */ | 160 | result is placed in pre-allocated OUT of OUTSIZE length. */ |
161 | static int | 161 | static int |
162 | _gnutls_ia_prf (gnutls_session_t session, | 162 | _gnutls_ia_prf (mhd_gtls_session_t session, |
163 | size_t label_size, | 163 | size_t label_size, |
164 | const char *label, | 164 | const char *label, |
165 | size_t extra_size, | 165 | size_t extra_size, |
@@ -181,7 +181,7 @@ _gnutls_ia_prf (gnutls_session_t session, | |||
181 | TLS_RANDOM_SIZE); | 181 | TLS_RANDOM_SIZE); |
182 | memcpy (seed + 2 * TLS_RANDOM_SIZE, extra, extra_size); | 182 | memcpy (seed + 2 * TLS_RANDOM_SIZE, extra, extra_size); |
183 | 183 | ||
184 | ret = _gnutls_PRF (session, session->security_parameters.inner_secret, | 184 | ret = mhd_gtls_PRF (session, session->security_parameters.inner_secret, |
185 | TLS_MASTER_SIZE, | 185 | TLS_MASTER_SIZE, |
186 | label, label_size, seed, seedsize, outsize, out); | 186 | label, label_size, seed, seedsize, outsize, out); |
187 | 187 | ||
@@ -192,7 +192,7 @@ _gnutls_ia_prf (gnutls_session_t session, | |||
192 | 192 | ||
193 | /** | 193 | /** |
194 | * gnutls_ia_permute_inner_secret: | 194 | * gnutls_ia_permute_inner_secret: |
195 | * @session: is a #gnutls_session_t structure. | 195 | * @session: is a #mhd_gtls_session_t structure. |
196 | * @session_keys_size: Size of generated session keys (0 if none). | 196 | * @session_keys_size: Size of generated session keys (0 if none). |
197 | * @session_keys: Generated session keys, used to permute inner secret | 197 | * @session_keys: Generated session keys, used to permute inner secret |
198 | * (NULL if none). | 198 | * (NULL if none). |
@@ -205,7 +205,7 @@ _gnutls_ia_prf (gnutls_session_t session, | |||
205 | * Return value: Return zero on success, or a negative error code. | 205 | * Return value: Return zero on success, or a negative error code. |
206 | **/ | 206 | **/ |
207 | int | 207 | int |
208 | gnutls_ia_permute_inner_secret (gnutls_session_t session, | 208 | gnutls_ia_permute_inner_secret (mhd_gtls_session_t session, |
209 | size_t session_keys_size, | 209 | size_t session_keys_size, |
210 | const char *session_keys) | 210 | const char *session_keys) |
211 | { | 211 | { |
@@ -220,7 +220,7 @@ gnutls_ia_permute_inner_secret (gnutls_session_t session, | |||
220 | 220 | ||
221 | /** | 221 | /** |
222 | * gnutls_ia_generate_challenge: | 222 | * gnutls_ia_generate_challenge: |
223 | * @session: is a #gnutls_session_t structure. | 223 | * @session: is a #mhd_gtls_session_t structure. |
224 | * @buffer_size: size of output buffer. | 224 | * @buffer_size: size of output buffer. |
225 | * @buffer: pre-allocated buffer to contain @buffer_size bytes of output. | 225 | * @buffer: pre-allocated buffer to contain @buffer_size bytes of output. |
226 | * | 226 | * |
@@ -230,7 +230,7 @@ gnutls_ia_permute_inner_secret (gnutls_session_t session, | |||
230 | * Return value: Returns 0 on success, or an negative error code. | 230 | * Return value: Returns 0 on success, or an negative error code. |
231 | **/ | 231 | **/ |
232 | int | 232 | int |
233 | gnutls_ia_generate_challenge (gnutls_session_t session, | 233 | gnutls_ia_generate_challenge (mhd_gtls_session_t session, |
234 | size_t buffer_size, char *buffer) | 234 | size_t buffer_size, char *buffer) |
235 | { | 235 | { |
236 | return _gnutls_ia_prf (session, | 236 | return _gnutls_ia_prf (session, |
@@ -240,7 +240,7 @@ gnutls_ia_generate_challenge (gnutls_session_t session, | |||
240 | 240 | ||
241 | /** | 241 | /** |
242 | * gnutls_ia_extract_inner_secret: | 242 | * gnutls_ia_extract_inner_secret: |
243 | * @session: is a #gnutls_session_t structure. | 243 | * @session: is a #mhd_gtls_session_t structure. |
244 | * @buffer: pre-allocated buffer to hold 48 bytes of inner secret. | 244 | * @buffer: pre-allocated buffer to hold 48 bytes of inner secret. |
245 | * | 245 | * |
246 | * Copy the 48 bytes large inner secret into the specified buffer | 246 | * Copy the 48 bytes large inner secret into the specified buffer |
@@ -255,14 +255,14 @@ gnutls_ia_generate_challenge (gnutls_session_t session, | |||
255 | * key from the inner secret. | 255 | * key from the inner secret. |
256 | **/ | 256 | **/ |
257 | void | 257 | void |
258 | gnutls_ia_extract_inner_secret (gnutls_session_t session, char *buffer) | 258 | gnutls_ia_extract_inner_secret (mhd_gtls_session_t session, char *buffer) |
259 | { | 259 | { |
260 | memcpy (buffer, session->security_parameters.inner_secret, TLS_MASTER_SIZE); | 260 | memcpy (buffer, session->security_parameters.inner_secret, TLS_MASTER_SIZE); |
261 | } | 261 | } |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * gnutls_ia_endphase_send: | 264 | * gnutls_ia_endphase_send: |
265 | * @session: is a #gnutls_session_t structure. | 265 | * @session: is a #mhd_gtls_session_t structure. |
266 | * @final_p: Set iff this should signal the final phase. | 266 | * @final_p: Set iff this should signal the final phase. |
267 | * | 267 | * |
268 | * Send a TLS/IA end phase message. | 268 | * Send a TLS/IA end phase message. |
@@ -276,7 +276,7 @@ gnutls_ia_extract_inner_secret (gnutls_session_t session, char *buffer) | |||
276 | * Return value: Return 0 on success, or an error code. | 276 | * Return value: Return 0 on success, or an error code. |
277 | **/ | 277 | **/ |
278 | int | 278 | int |
279 | gnutls_ia_endphase_send (gnutls_session_t session, int final_p) | 279 | gnutls_ia_endphase_send (mhd_gtls_session_t session, int final_p) |
280 | { | 280 | { |
281 | opaque local_checksum[CHECKSUM_SIZE]; | 281 | opaque local_checksum[CHECKSUM_SIZE]; |
282 | int client = session->security_parameters.entity == GNUTLS_CLIENT; | 282 | int client = session->security_parameters.entity == GNUTLS_CLIENT; |
@@ -286,7 +286,7 @@ gnutls_ia_endphase_send (gnutls_session_t session, int final_p) | |||
286 | ssize_t len; | 286 | ssize_t len; |
287 | int ret; | 287 | int ret; |
288 | 288 | ||
289 | ret = _gnutls_PRF (session, session->security_parameters.inner_secret, | 289 | ret = mhd_gtls_PRF (session, session->security_parameters.inner_secret, |
290 | TLS_MASTER_SIZE, label, size_of_label - 1, | 290 | TLS_MASTER_SIZE, label, size_of_label - 1, |
291 | /* XXX specification unclear on seed. */ | 291 | /* XXX specification unclear on seed. */ |
292 | "", 0, CHECKSUM_SIZE, local_checksum); | 292 | "", 0, CHECKSUM_SIZE, local_checksum); |
@@ -300,7 +300,7 @@ gnutls_ia_endphase_send (gnutls_session_t session, int final_p) | |||
300 | 300 | ||
301 | /* XXX Instead of calling this function over and over...? | 301 | /* XXX Instead of calling this function over and over...? |
302 | * while (len == GNUTLS_E_AGAIN || len == GNUTLS_E_INTERRUPTED) | 302 | * while (len == GNUTLS_E_AGAIN || len == GNUTLS_E_INTERRUPTED) |
303 | * len = _gnutls_io_write_flush(session); | 303 | * len = mhd_gtls_io_write_flush(session); |
304 | */ | 304 | */ |
305 | 305 | ||
306 | if (len < 0) | 306 | if (len < 0) |
@@ -314,7 +314,7 @@ gnutls_ia_endphase_send (gnutls_session_t session, int final_p) | |||
314 | 314 | ||
315 | /** | 315 | /** |
316 | * gnutls_ia_verify_endphase: | 316 | * gnutls_ia_verify_endphase: |
317 | * @session: is a #gnutls_session_t structure. | 317 | * @session: is a #mhd_gtls_session_t structure. |
318 | * @checksum: 12-byte checksum data, received from gnutls_ia_recv(). | 318 | * @checksum: 12-byte checksum data, received from gnutls_ia_recv(). |
319 | * | 319 | * |
320 | * Verify TLS/IA end phase checksum data. If verification fails, the | 320 | * Verify TLS/IA end phase checksum data. If verification fails, the |
@@ -330,7 +330,7 @@ gnutls_ia_endphase_send (gnutls_session_t session, int final_p) | |||
330 | * %GNUTLS_E_IA_VERIFY_FAILED is returned. | 330 | * %GNUTLS_E_IA_VERIFY_FAILED is returned. |
331 | **/ | 331 | **/ |
332 | int | 332 | int |
333 | gnutls_ia_verify_endphase (gnutls_session_t session, const char *checksum) | 333 | gnutls_ia_verify_endphase (mhd_gtls_session_t session, const char *checksum) |
334 | { | 334 | { |
335 | char local_checksum[CHECKSUM_SIZE]; | 335 | char local_checksum[CHECKSUM_SIZE]; |
336 | int client = session->security_parameters.entity == GNUTLS_CLIENT; | 336 | int client = session->security_parameters.entity == GNUTLS_CLIENT; |
@@ -339,7 +339,7 @@ gnutls_ia_verify_endphase (gnutls_session_t session, const char *checksum) | |||
339 | sizeof (client_finished_label); | 339 | sizeof (client_finished_label); |
340 | int ret; | 340 | int ret; |
341 | 341 | ||
342 | ret = _gnutls_PRF (session, session->security_parameters.inner_secret, | 342 | ret = mhd_gtls_PRF (session, session->security_parameters.inner_secret, |
343 | TLS_MASTER_SIZE, | 343 | TLS_MASTER_SIZE, |
344 | label, size_of_label - 1, | 344 | label, size_of_label - 1, |
345 | "", 0, CHECKSUM_SIZE, local_checksum); | 345 | "", 0, CHECKSUM_SIZE, local_checksum); |
@@ -351,7 +351,7 @@ gnutls_ia_verify_endphase (gnutls_session_t session, const char *checksum) | |||
351 | 351 | ||
352 | if (memcmp (local_checksum, checksum, CHECKSUM_SIZE) != 0) | 352 | if (memcmp (local_checksum, checksum, CHECKSUM_SIZE) != 0) |
353 | { | 353 | { |
354 | ret = gnutls_alert_send (session, GNUTLS_AL_FATAL, | 354 | ret = MHD_gnutls_alert_send (session, GNUTLS_AL_FATAL, |
355 | GNUTLS_A_INNER_APPLICATION_VERIFICATION); | 355 | GNUTLS_A_INNER_APPLICATION_VERIFICATION); |
356 | if (ret < 0) | 356 | if (ret < 0) |
357 | { | 357 | { |
@@ -367,7 +367,7 @@ gnutls_ia_verify_endphase (gnutls_session_t session, const char *checksum) | |||
367 | 367 | ||
368 | /** | 368 | /** |
369 | * gnutls_ia_send: Send peer the specified TLS/IA data. | 369 | * gnutls_ia_send: Send peer the specified TLS/IA data. |
370 | * @session: is a #gnutls_session_t structure. | 370 | * @session: is a #mhd_gtls_session_t structure. |
371 | * @data: contains the data to send | 371 | * @data: contains the data to send |
372 | * @sizeofdata: is the length of the data | 372 | * @sizeofdata: is the length of the data |
373 | * | 373 | * |
@@ -393,7 +393,7 @@ gnutls_ia_verify_endphase (gnutls_session_t session, const char *checksum) | |||
393 | * Returns the number of bytes sent, or a negative error code. | 393 | * Returns the number of bytes sent, or a negative error code. |
394 | **/ | 394 | **/ |
395 | ssize_t | 395 | ssize_t |
396 | gnutls_ia_send (gnutls_session_t session, const char *data, size_t sizeofdata) | 396 | gnutls_ia_send (mhd_gtls_session_t session, const char *data, size_t sizeofdata) |
397 | { | 397 | { |
398 | ssize_t len; | 398 | ssize_t len; |
399 | 399 | ||
@@ -406,7 +406,7 @@ gnutls_ia_send (gnutls_session_t session, const char *data, size_t sizeofdata) | |||
406 | 406 | ||
407 | /** | 407 | /** |
408 | * gnutls_ia_recv - read data from the TLS/IA protocol | 408 | * gnutls_ia_recv - read data from the TLS/IA protocol |
409 | * @session: is a #gnutls_session_t structure. | 409 | * @session: is a #mhd_gtls_session_t structure. |
410 | * @data: the buffer that the data will be read into, must hold >= 12 bytes. | 410 | * @data: the buffer that the data will be read into, must hold >= 12 bytes. |
411 | * @sizeofdata: the number of requested bytes, must be >= 12. | 411 | * @sizeofdata: the number of requested bytes, must be >= 12. |
412 | * | 412 | * |
@@ -433,7 +433,7 @@ gnutls_ia_send (gnutls_session_t session, const char *data, size_t sizeofdata) | |||
433 | * application phase finished message has been sent by the server. | 433 | * application phase finished message has been sent by the server. |
434 | **/ | 434 | **/ |
435 | ssize_t | 435 | ssize_t |
436 | gnutls_ia_recv (gnutls_session_t session, char *data, size_t sizeofdata) | 436 | gnutls_ia_recv (mhd_gtls_session_t session, char *data, size_t sizeofdata) |
437 | { | 437 | { |
438 | gnutls_ia_apptype_t msg_type; | 438 | gnutls_ia_apptype_t msg_type; |
439 | ssize_t len; | 439 | ssize_t len; |
@@ -453,7 +453,7 @@ gnutls_ia_recv (gnutls_session_t session, char *data, size_t sizeofdata) | |||
453 | though. */ | 453 | though. */ |
454 | 454 | ||
455 | int | 455 | int |
456 | _gnutls_ia_client_handshake (gnutls_session_t session) | 456 | _gnutls_ia_client_handshake (mhd_gtls_session_t session) |
457 | { | 457 | { |
458 | char *buf = NULL; | 458 | char *buf = NULL; |
459 | size_t buflen = 0; | 459 | size_t buflen = 0; |
@@ -461,7 +461,7 @@ _gnutls_ia_client_handshake (gnutls_session_t session) | |||
461 | ssize_t len; | 461 | ssize_t len; |
462 | int ret; | 462 | int ret; |
463 | const struct gnutls_ia_client_credentials_st *cred = | 463 | const struct gnutls_ia_client_credentials_st *cred = |
464 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); | 464 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); |
465 | 465 | ||
466 | if (cred == NULL) | 466 | if (cred == NULL) |
467 | return GNUTLS_E_INTERNAL_ERROR; | 467 | return GNUTLS_E_INTERNAL_ERROR; |
@@ -476,7 +476,7 @@ _gnutls_ia_client_handshake (gnutls_session_t session) | |||
476 | if (ret) | 476 | if (ret) |
477 | { | 477 | { |
478 | int tmpret; | 478 | int tmpret; |
479 | tmpret = gnutls_alert_send (session, GNUTLS_AL_FATAL, | 479 | tmpret = MHD_gnutls_alert_send (session, GNUTLS_AL_FATAL, |
480 | GNUTLS_A_INNER_APPLICATION_FAILURE); | 480 | GNUTLS_A_INNER_APPLICATION_FAILURE); |
481 | if (tmpret < 0) | 481 | if (tmpret < 0) |
482 | gnutls_assert (); | 482 | gnutls_assert (); |
@@ -522,14 +522,14 @@ _gnutls_ia_client_handshake (gnutls_session_t session) | |||
522 | } | 522 | } |
523 | 523 | ||
524 | int | 524 | int |
525 | _gnutls_ia_server_handshake (gnutls_session_t session) | 525 | _gnutls_ia_server_handshake (mhd_gtls_session_t session) |
526 | { | 526 | { |
527 | gnutls_ia_apptype_t msg_type; | 527 | gnutls_ia_apptype_t msg_type; |
528 | ssize_t len; | 528 | ssize_t len; |
529 | char buf[1024]; | 529 | char buf[1024]; |
530 | int ret; | 530 | int ret; |
531 | const struct gnutls_ia_server_credentials_st *cred = | 531 | const struct gnutls_ia_server_credentials_st *cred = |
532 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); | 532 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); |
533 | 533 | ||
534 | if (cred == NULL) | 534 | if (cred == NULL) |
535 | return GNUTLS_E_INTERNAL_ERROR; | 535 | return GNUTLS_E_INTERNAL_ERROR; |
@@ -563,7 +563,7 @@ _gnutls_ia_server_handshake (gnutls_session_t session) | |||
563 | if (ret < 0) | 563 | if (ret < 0) |
564 | { | 564 | { |
565 | int tmpret; | 565 | int tmpret; |
566 | tmpret = gnutls_alert_send (session, GNUTLS_AL_FATAL, | 566 | tmpret = MHD_gnutls_alert_send (session, GNUTLS_AL_FATAL, |
567 | GNUTLS_A_INNER_APPLICATION_FAILURE); | 567 | GNUTLS_A_INNER_APPLICATION_FAILURE); |
568 | if (tmpret < 0) | 568 | if (tmpret < 0) |
569 | gnutls_assert (); | 569 | gnutls_assert (); |
@@ -594,18 +594,18 @@ _gnutls_ia_server_handshake (gnutls_session_t session) | |||
594 | 594 | ||
595 | /** | 595 | /** |
596 | * gnutls_ia_handshake_p: | 596 | * gnutls_ia_handshake_p: |
597 | * @session: is a #gnutls_session_t structure. | 597 | * @session: is a #mhd_gtls_session_t structure. |
598 | * | 598 | * |
599 | * Predicate to be used after gnutls_handshake() to decide whether to | 599 | * Predicate to be used after MHD_gnutls_handshake() to decide whether to |
600 | * invoke gnutls_ia_handshake(). Usable by both clients and servers. | 600 | * invoke gnutls_ia_handshake(). Usable by both clients and servers. |
601 | * | 601 | * |
602 | * Return value: non-zero if TLS/IA handshake is expected, zero | 602 | * Return value: non-zero if TLS/IA handshake is expected, zero |
603 | * otherwise. | 603 | * otherwise. |
604 | **/ | 604 | **/ |
605 | int | 605 | int |
606 | gnutls_ia_handshake_p (gnutls_session_t session) | 606 | gnutls_ia_handshake_p (mhd_gtls_session_t session) |
607 | { | 607 | { |
608 | tls_ext_st *ext = &session->security_parameters.extensions; | 608 | mhd_gtls_ext_st *ext = &session->security_parameters.extensions; |
609 | 609 | ||
610 | /* Either local side or peer doesn't do TLS/IA: don't do IA */ | 610 | /* Either local side or peer doesn't do TLS/IA: don't do IA */ |
611 | 611 | ||
@@ -614,7 +614,7 @@ gnutls_ia_handshake_p (gnutls_session_t session) | |||
614 | 614 | ||
615 | /* Not resuming or we don't allow skipping on resumption locally: do IA */ | 615 | /* Not resuming or we don't allow skipping on resumption locally: do IA */ |
616 | 616 | ||
617 | if (!ext->gnutls_ia_allowskip || !gnutls_session_is_resumed (session)) | 617 | if (!ext->gnutls_ia_allowskip || !MHD_gtls_session_is_resumed (session)) |
618 | return 1; | 618 | return 1; |
619 | 619 | ||
620 | /* If we're resuming and we and the peer both allow skipping on resumption: | 620 | /* If we're resuming and we and the peer both allow skipping on resumption: |
@@ -626,15 +626,15 @@ gnutls_ia_handshake_p (gnutls_session_t session) | |||
626 | 626 | ||
627 | /** | 627 | /** |
628 | * gnutls_ia_handshake: | 628 | * gnutls_ia_handshake: |
629 | * @session: is a #gnutls_session_t structure. | 629 | * @session: is a #mhd_gtls_session_t structure. |
630 | * | 630 | * |
631 | * Perform a TLS/IA handshake. This should be called after | 631 | * Perform a TLS/IA handshake. This should be called after |
632 | * gnutls_handshake() iff gnutls_ia_handshake_p(). | 632 | * MHD_gnutls_handshake() iff gnutls_ia_handshake_p(). |
633 | * | 633 | * |
634 | * Return 0 on success, or an error code. | 634 | * Return 0 on success, or an error code. |
635 | **/ | 635 | **/ |
636 | int | 636 | int |
637 | gnutls_ia_handshake (gnutls_session_t session) | 637 | gnutls_ia_handshake (mhd_gtls_session_t session) |
638 | { | 638 | { |
639 | int ret; | 639 | int ret; |
640 | 640 | ||
@@ -696,11 +696,11 @@ gnutls_ia_free_client_credentials (gnutls_ia_client_credentials_t sc) | |||
696 | * server, and to get a new AVP to send to the server. | 696 | * server, and to get a new AVP to send to the server. |
697 | * | 697 | * |
698 | * The callback's function form is: | 698 | * The callback's function form is: |
699 | * int (*avp_func) (gnutls_session_t session, void *ptr, | 699 | * int (*avp_func) (mhd_gtls_session_t session, void *ptr, |
700 | * const char *last, size_t lastlen, | 700 | * const char *last, size_t lastlen, |
701 | * char **next, size_t *nextlen); | 701 | * char **next, size_t *nextlen); |
702 | * | 702 | * |
703 | * The @session parameter is the #gnutls_session_t structure | 703 | * The @session parameter is the #mhd_gtls_session_t structure |
704 | * corresponding to the current session. The @ptr parameter is the | 704 | * corresponding to the current session. The @ptr parameter is the |
705 | * application hook pointer, set through | 705 | * application hook pointer, set through |
706 | * gnutls_ia_set_client_avp_ptr(). The AVP received from the server | 706 | * gnutls_ia_set_client_avp_ptr(). The AVP received from the server |
@@ -802,11 +802,11 @@ gnutls_ia_free_server_credentials (gnutls_ia_server_credentials_t sc) | |||
802 | * Set the TLS/IA AVP callback handler used for the session. | 802 | * Set the TLS/IA AVP callback handler used for the session. |
803 | * | 803 | * |
804 | * The callback's function form is: | 804 | * The callback's function form is: |
805 | * int (*avp_func) (gnutls_session_t session, void *ptr, | 805 | * int (*avp_func) (mhd_gtls_session_t session, void *ptr, |
806 | * const char *last, size_t lastlen, | 806 | * const char *last, size_t lastlen, |
807 | * char **next, size_t *nextlen); | 807 | * char **next, size_t *nextlen); |
808 | * | 808 | * |
809 | * The @session parameter is the #gnutls_session_t structure | 809 | * The @session parameter is the #mhd_gtls_session_t structure |
810 | * corresponding to the current session. The @ptr parameter is the | 810 | * corresponding to the current session. The @ptr parameter is the |
811 | * application hook pointer, set through | 811 | * application hook pointer, set through |
812 | * gnutls_ia_set_server_avp_ptr(). The AVP received from the client | 812 | * gnutls_ia_set_server_avp_ptr(). The AVP received from the client |
@@ -873,7 +873,7 @@ gnutls_ia_get_server_avp_ptr (gnutls_ia_server_credentials_t cred) | |||
873 | 873 | ||
874 | /** | 874 | /** |
875 | * gnutls_ia_enable - Indicate willingness for TLS/IA application phases | 875 | * gnutls_ia_enable - Indicate willingness for TLS/IA application phases |
876 | * @session: is a #gnutls_session_t structure. | 876 | * @session: is a #mhd_gtls_session_t structure. |
877 | * @allow_skip_on_resume: non-zero if local party allows to skip the | 877 | * @allow_skip_on_resume: non-zero if local party allows to skip the |
878 | * TLS/IA application phases for a resumed session. | 878 | * TLS/IA application phases for a resumed session. |
879 | * | 879 | * |
@@ -897,7 +897,7 @@ gnutls_ia_get_server_avp_ptr (gnutls_ia_server_credentials_t cred) | |||
897 | * functions. | 897 | * functions. |
898 | **/ | 898 | **/ |
899 | void | 899 | void |
900 | gnutls_ia_enable (gnutls_session_t session, int allow_skip_on_resume) | 900 | gnutls_ia_enable (mhd_gtls_session_t session, int allow_skip_on_resume) |
901 | { | 901 | { |
902 | session->security_parameters.extensions.gnutls_ia_enable = 1; | 902 | session->security_parameters.extensions.gnutls_ia_enable = 1; |
903 | session->security_parameters.extensions.gnutls_ia_allowskip = | 903 | session->security_parameters.extensions.gnutls_ia_allowskip = |
diff --git a/src/daemon/https/openpgp/gnutls_openpgp.c b/src/daemon/https/openpgp/gnutls_openpgp.c index 61f79da8..f323b75b 100644 --- a/src/daemon/https/openpgp/gnutls_openpgp.c +++ b/src/daemon/https/openpgp/gnutls_openpgp.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #define OPENPGP_NAME_SIZE 256 | 37 | #define OPENPGP_NAME_SIZE 256 |
38 | 38 | ||
39 | #define datum_append(x, y, z) _gnutls_datum_append_m (x, y, z, gnutls_realloc) | 39 | #define datum_append(x, y, z) mhd_gtls_datum_append_m (x, y, z, gnutls_realloc) |
40 | 40 | ||
41 | static void | 41 | static void |
42 | release_mpi_array (mpi_t * arr, size_t n) | 42 | release_mpi_array (mpi_t * arr, size_t n) |
@@ -46,7 +46,7 @@ release_mpi_array (mpi_t * arr, size_t n) | |||
46 | while (arr && n--) | 46 | while (arr && n--) |
47 | { | 47 | { |
48 | x = *arr; | 48 | x = *arr; |
49 | _gnutls_mpi_release (&x); | 49 | mhd_gtls_mpi_release (&x); |
50 | *arr = NULL; | 50 | *arr = NULL; |
51 | arr++; | 51 | arr++; |
52 | } | 52 | } |
@@ -137,7 +137,7 @@ openpgp_pk_to_gnutls_cert (gnutls_cert * cert, cdk_pkt_pubkey_t pk) | |||
137 | { | 137 | { |
138 | nbytes = sizeof (buf) / sizeof (buf[0]); | 138 | nbytes = sizeof (buf) / sizeof (buf[0]); |
139 | cdk_pk_get_mpi (pk, i, buf, nbytes, &nbytes, NULL); | 139 | cdk_pk_get_mpi (pk, i, buf, nbytes, &nbytes, NULL); |
140 | rc = _gnutls_mpi_scan_pgp (&cert->params[i], buf, &nbytes); | 140 | rc = mhd_gtls_mpi_scan_pgp (&cert->params[i], buf, &nbytes); |
141 | if (rc) | 141 | if (rc) |
142 | { | 142 | { |
143 | rc = GNUTLS_E_MPI_SCAN_FAILED; | 143 | rc = GNUTLS_E_MPI_SCAN_FAILED; |
@@ -221,7 +221,7 @@ _gnutls_openpgp_raw_privkey_to_gkey (gnutls_privkey * pkey, | |||
221 | { | 221 | { |
222 | nbytes = sizeof (buf) / sizeof (buf[0]); | 222 | nbytes = sizeof (buf) / sizeof (buf[0]); |
223 | cdk_pk_get_mpi (sk->pk, i, buf, nbytes, &nbytes, NULL); | 223 | cdk_pk_get_mpi (sk->pk, i, buf, nbytes, &nbytes, NULL); |
224 | rc = _gnutls_mpi_scan_pgp (&pkey->params[i], buf, &nbytes); | 224 | rc = mhd_gtls_mpi_scan_pgp (&pkey->params[i], buf, &nbytes); |
225 | if (rc) | 225 | if (rc) |
226 | { | 226 | { |
227 | rc = GNUTLS_E_MPI_SCAN_FAILED; | 227 | rc = GNUTLS_E_MPI_SCAN_FAILED; |
@@ -235,7 +235,7 @@ _gnutls_openpgp_raw_privkey_to_gkey (gnutls_privkey * pkey, | |||
235 | { | 235 | { |
236 | nbytes = sizeof (buf) / sizeof (buf[0]); | 236 | nbytes = sizeof (buf) / sizeof (buf[0]); |
237 | cdk_sk_get_mpi (sk, j, buf, nbytes, &nbytes, NULL); | 237 | cdk_sk_get_mpi (sk, j, buf, nbytes, &nbytes, NULL); |
238 | rc = _gnutls_mpi_scan_pgp (&pkey->params[i], buf, &nbytes); | 238 | rc = mhd_gtls_mpi_scan_pgp (&pkey->params[i], buf, &nbytes); |
239 | if (rc) | 239 | if (rc) |
240 | { | 240 | { |
241 | rc = GNUTLS_E_MPI_SCAN_FAILED; | 241 | rc = GNUTLS_E_MPI_SCAN_FAILED; |
@@ -298,19 +298,19 @@ _gnutls_openpgp_raw_key_to_gcert (gnutls_cert * cert, | |||
298 | } | 298 | } |
299 | 299 | ||
300 | /** | 300 | /** |
301 | * gnutls_certificate_set_openpgp_key - Used to set keys in a gnutls_certificate_credentials_t structure | 301 | * gnutls_certificate_set_openpgp_key - Used to set keys in a mhd_gtls_cert_credentials_t structure |
302 | * @res: is an #gnutls_certificate_credentials_t structure. | 302 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
303 | * @key: contains an openpgp public key | 303 | * @key: contains an openpgp public key |
304 | * @pkey: is an openpgp private key | 304 | * @pkey: is an openpgp private key |
305 | * | 305 | * |
306 | * This function sets a certificate/private key pair in the | 306 | * This function sets a certificate/private key pair in the |
307 | * gnutls_certificate_credentials_t structure. This function may be called | 307 | * mhd_gtls_cert_credentials_t structure. This function may be called |
308 | * more than once (in case multiple keys/certificates exist for the | 308 | * more than once (in case multiple keys/certificates exist for the |
309 | * server). | 309 | * server). |
310 | * | 310 | * |
311 | **/ | 311 | **/ |
312 | int | 312 | int |
313 | gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t | 313 | gnutls_certificate_set_openpgp_key (mhd_gtls_cert_credentials_t |
314 | res, gnutls_openpgp_crt_t crt, | 314 | res, gnutls_openpgp_crt_t crt, |
315 | gnutls_openpgp_privkey_t pkey) | 315 | gnutls_openpgp_privkey_t pkey) |
316 | { | 316 | { |
@@ -318,7 +318,7 @@ gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t | |||
318 | 318 | ||
319 | /* this should be first */ | 319 | /* this should be first */ |
320 | 320 | ||
321 | res->pkey = gnutls_realloc_fast (res->pkey, | 321 | res->pkey = mhd_gtls_realloc_fast (res->pkey, |
322 | (res->ncerts + 1) * | 322 | (res->ncerts + 1) * |
323 | sizeof (gnutls_privkey)); | 323 | sizeof (gnutls_privkey)); |
324 | if (res->pkey == NULL) | 324 | if (res->pkey == NULL) |
@@ -334,7 +334,7 @@ gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t | |||
334 | return ret; | 334 | return ret; |
335 | } | 335 | } |
336 | 336 | ||
337 | res->cert_list = gnutls_realloc_fast (res->cert_list, | 337 | res->cert_list = mhd_gtls_realloc_fast (res->cert_list, |
338 | (1 + | 338 | (1 + |
339 | res->ncerts) * | 339 | res->ncerts) * |
340 | sizeof (gnutls_cert *)); | 340 | sizeof (gnutls_cert *)); |
@@ -344,7 +344,7 @@ gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t | |||
344 | return GNUTLS_E_MEMORY_ERROR; | 344 | return GNUTLS_E_MEMORY_ERROR; |
345 | } | 345 | } |
346 | 346 | ||
347 | res->cert_list_length = gnutls_realloc_fast (res->cert_list_length, | 347 | res->cert_list_length = mhd_gtls_realloc_fast (res->cert_list_length, |
348 | (1 + | 348 | (1 + |
349 | res->ncerts) * sizeof (int)); | 349 | res->ncerts) * sizeof (int)); |
350 | if (res->cert_list_length == NULL) | 350 | if (res->cert_list_length == NULL) |
@@ -489,7 +489,7 @@ stream_to_datum (cdk_stream_t inp, gnutls_datum_t * raw) | |||
489 | * should only contain one key which should not be encrypted. | 489 | * should only contain one key which should not be encrypted. |
490 | **/ | 490 | **/ |
491 | int | 491 | int |
492 | gnutls_certificate_set_openpgp_key_mem (gnutls_certificate_credentials_t | 492 | gnutls_certificate_set_openpgp_key_mem (mhd_gtls_cert_credentials_t |
493 | res, const gnutls_datum_t * icert, | 493 | res, const gnutls_datum_t * icert, |
494 | const gnutls_datum_t * ikey, | 494 | const gnutls_datum_t * ikey, |
495 | gnutls_openpgp_crt_fmt_t format) | 495 | gnutls_openpgp_crt_fmt_t format) |
@@ -551,7 +551,7 @@ gnutls_certificate_set_openpgp_key_mem (gnutls_certificate_credentials_t | |||
551 | * should only contain one key which should not be encrypted. | 551 | * should only contain one key which should not be encrypted. |
552 | **/ | 552 | **/ |
553 | int | 553 | int |
554 | gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t | 554 | gnutls_certificate_set_openpgp_key_file (mhd_gtls_cert_credentials_t |
555 | res, const char *certfile, | 555 | res, const char *certfile, |
556 | const char *keyfile, | 556 | const char *keyfile, |
557 | gnutls_openpgp_crt_fmt_t format) | 557 | gnutls_openpgp_crt_fmt_t format) |
@@ -652,7 +652,7 @@ gnutls_openpgp_count_key_names (const gnutls_datum_t * cert) | |||
652 | * | 652 | * |
653 | **/ | 653 | **/ |
654 | int | 654 | int |
655 | gnutls_certificate_set_openpgp_keyring_file (gnutls_certificate_credentials_t | 655 | gnutls_certificate_set_openpgp_keyring_file (mhd_gtls_cert_credentials_t |
656 | c, const char *file, | 656 | c, const char *file, |
657 | gnutls_openpgp_crt_fmt_t format) | 657 | gnutls_openpgp_crt_fmt_t format) |
658 | { | 658 | { |
@@ -696,7 +696,7 @@ gnutls_certificate_set_openpgp_keyring_file (gnutls_certificate_credentials_t | |||
696 | * | 696 | * |
697 | **/ | 697 | **/ |
698 | int | 698 | int |
699 | gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t | 699 | gnutls_certificate_set_openpgp_keyring_mem (mhd_gtls_cert_credentials_t |
700 | c, const opaque * data, | 700 | c, const opaque * data, |
701 | size_t dlen, | 701 | size_t dlen, |
702 | gnutls_openpgp_crt_fmt_t format) | 702 | gnutls_openpgp_crt_fmt_t format) |
@@ -749,7 +749,7 @@ gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t | |||
749 | /*- | 749 | /*- |
750 | * _gnutls_openpgp_request_key - Receives a key from a database, key server etc | 750 | * _gnutls_openpgp_request_key - Receives a key from a database, key server etc |
751 | * @ret - a pointer to gnutls_datum_t structure. | 751 | * @ret - a pointer to gnutls_datum_t structure. |
752 | * @cred - a gnutls_certificate_credentials_t structure. | 752 | * @cred - a mhd_gtls_cert_credentials_t structure. |
753 | * @key_fingerprint - The keyFingerprint | 753 | * @key_fingerprint - The keyFingerprint |
754 | * @key_fingerprint_size - the size of the fingerprint | 754 | * @key_fingerprint_size - the size of the fingerprint |
755 | * | 755 | * |
@@ -758,8 +758,8 @@ gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t | |||
758 | * | 758 | * |
759 | -*/ | 759 | -*/ |
760 | int | 760 | int |
761 | _gnutls_openpgp_request_key (gnutls_session_t session, gnutls_datum_t * ret, | 761 | _gnutls_openpgp_request_key (mhd_gtls_session_t session, gnutls_datum_t * ret, |
762 | const gnutls_certificate_credentials_t cred, | 762 | const mhd_gtls_cert_credentials_t cred, |
763 | opaque * key_fpr, int key_fpr_size) | 763 | opaque * key_fpr, int key_fpr_size) |
764 | { | 764 | { |
765 | int rc = 0; | 765 | int rc = 0; |
@@ -836,8 +836,8 @@ error: | |||
836 | * | 836 | * |
837 | **/ | 837 | **/ |
838 | void | 838 | void |
839 | gnutls_openpgp_set_recv_key_function (gnutls_session_t session, | 839 | gnutls_openpgp_set_recv_key_function (mhd_gtls_session_t session, |
840 | gnutls_openpgp_recv_key_func func) | 840 | mhd_gtls_openpgp_recv_key_func func) |
841 | { | 841 | { |
842 | session->internals.openpgp_recv_key_func = func; | 842 | session->internals.openpgp_recv_key_func = func; |
843 | } | 843 | } |
@@ -870,7 +870,7 @@ _gnutls_openpgp_privkey_to_gkey (gnutls_privkey * dest, | |||
870 | 870 | ||
871 | cleanup: | 871 | cleanup: |
872 | for (i = 0; i < src->pkey.params_size; i++) | 872 | for (i = 0; i < src->pkey.params_size; i++) |
873 | _gnutls_mpi_release (&dest->params[i]); | 873 | mhd_gtls_mpi_release (&dest->params[i]); |
874 | return ret; | 874 | return ret; |
875 | } | 875 | } |
876 | 876 | ||
@@ -954,7 +954,7 @@ gnutls_openpgp_privkey_sign_hash (gnutls_openpgp_privkey_t key, | |||
954 | return GNUTLS_E_INVALID_REQUEST; | 954 | return GNUTLS_E_INVALID_REQUEST; |
955 | } | 955 | } |
956 | 956 | ||
957 | result = _gnutls_sign (key->pkey.pk_algorithm, key->pkey.params, | 957 | result = mhd_gtls_sign (key->pkey.pk_algorithm, key->pkey.params, |
958 | key->pkey.params_size, hash, signature); | 958 | key->pkey.params_size, hash, signature); |
959 | if (result < 0) | 959 | if (result < 0) |
960 | { | 960 | { |
diff --git a/src/daemon/https/openpgp/gnutls_openpgp.h b/src/daemon/https/openpgp/gnutls_openpgp.h index 130c0077..f2930c92 100644 --- a/src/daemon/https/openpgp/gnutls_openpgp.h +++ b/src/daemon/https/openpgp/gnutls_openpgp.h | |||
@@ -31,17 +31,17 @@ typedef enum | |||
31 | }key_attr_t; | 31 | }key_attr_t; |
32 | 32 | ||
33 | int | 33 | int |
34 | gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t | 34 | gnutls_certificate_set_openpgp_key_file (mhd_gtls_cert_credentials_t |
35 | res, const char *CERTFILE, | 35 | res, const char *CERTFILE, |
36 | const char *KEYFILE, gnutls_openpgp_crt_fmt_t); | 36 | const char *KEYFILE, gnutls_openpgp_crt_fmt_t); |
37 | 37 | ||
38 | int gnutls_openpgp_count_key_names (const gnutls_datum_t * cert); | 38 | int gnutls_openpgp_count_key_names (const gnutls_datum_t * cert); |
39 | 39 | ||
40 | int gnutls_certificate_set_openpgp_keyring_file | 40 | int gnutls_certificate_set_openpgp_keyring_file |
41 | (gnutls_certificate_credentials_t c, const char *file, gnutls_openpgp_crt_fmt_t); | 41 | (mhd_gtls_cert_credentials_t c, const char *file, gnutls_openpgp_crt_fmt_t); |
42 | 42 | ||
43 | int | 43 | int |
44 | gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t | 44 | gnutls_certificate_set_openpgp_keyring_mem (mhd_gtls_cert_credentials_t |
45 | c, const opaque * data, | 45 | c, const opaque * data, |
46 | size_t dlen, gnutls_openpgp_crt_fmt_t); | 46 | size_t dlen, gnutls_openpgp_crt_fmt_t); |
47 | 47 | ||
@@ -63,12 +63,12 @@ _gnutls_openpgp_raw_privkey_to_gkey (gnutls_privkey * pkey, | |||
63 | gnutls_openpgp_crt_fmt_t format); | 63 | gnutls_openpgp_crt_fmt_t format); |
64 | 64 | ||
65 | int | 65 | int |
66 | _gnutls_openpgp_request_key (gnutls_session_t, | 66 | _gnutls_openpgp_request_key (mhd_gtls_session_t, |
67 | gnutls_datum_t * ret, | 67 | gnutls_datum_t * ret, |
68 | const gnutls_certificate_credentials_t cred, | 68 | const mhd_gtls_cert_credentials_t cred, |
69 | opaque * key_fpr, int key_fpr_size); | 69 | opaque * key_fpr, int key_fpr_size); |
70 | 70 | ||
71 | int _gnutls_openpgp_verify_key (const gnutls_certificate_credentials_t, | 71 | int _gnutls_openpgp_verify_key (const mhd_gtls_cert_credentials_t, |
72 | const gnutls_datum_t * cert_list, | 72 | const gnutls_datum_t * cert_list, |
73 | int cert_list_length, unsigned int *status); | 73 | int cert_list_length, unsigned int *status); |
74 | int _gnutls_openpgp_fingerprint (const gnutls_datum_t * cert, | 74 | int _gnutls_openpgp_fingerprint (const gnutls_datum_t * cert, |
diff --git a/src/daemon/https/openpgp/openpgp.h b/src/daemon/https/openpgp/openpgp.h index d6ed9aae..9f0216b5 100644 --- a/src/daemon/https/openpgp/openpgp.h +++ b/src/daemon/https/openpgp/openpgp.h | |||
@@ -117,7 +117,7 @@ int gnutls_openpgp_crt_verify_self(gnutls_openpgp_crt_t key, | |||
117 | 117 | ||
118 | /* certificate authentication stuff. | 118 | /* certificate authentication stuff. |
119 | */ | 119 | */ |
120 | int gnutls_certificate_set_openpgp_key(gnutls_certificate_credentials_t | 120 | int gnutls_certificate_set_openpgp_key(mhd_gtls_cert_credentials_t |
121 | res, | 121 | res, |
122 | gnutls_openpgp_crt_t key, | 122 | gnutls_openpgp_crt_t key, |
123 | gnutls_openpgp_privkey_t pkey); | 123 | gnutls_openpgp_privkey_t pkey); |
diff --git a/src/daemon/https/openpgp/pgp_privkey.c b/src/daemon/https/openpgp/pgp_privkey.c index aee3599b..1c892fa6 100644 --- a/src/daemon/https/openpgp/pgp_privkey.c +++ b/src/daemon/https/openpgp/pgp_privkey.c | |||
@@ -64,7 +64,7 @@ gnutls_openpgp_privkey_deinit (gnutls_openpgp_privkey_t key) | |||
64 | if (!key) | 64 | if (!key) |
65 | return; | 65 | return; |
66 | 66 | ||
67 | _gnutls_gkey_deinit (&key->pkey); | 67 | mhd_gtls_gkey_deinit (&key->pkey); |
68 | gnutls_free (key); | 68 | gnutls_free (key); |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/src/daemon/https/tests.c b/src/daemon/https/tests.c index 08db1dad..4a3520f5 100644 --- a/src/daemon/https/tests.c +++ b/src/daemon/https/tests.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #include <tests.h> | 37 | #include <tests.h> |
38 | 38 | ||
39 | extern gnutls_srp_client_credentials_t srp_cred; | 39 | extern gnutls_srp_client_credentials_t srp_cred; |
40 | extern gnutls_anon_client_credentials_t anon_cred; | 40 | extern mhd_gtls_anon_client_credentials_t anon_cred; |
41 | extern gnutls_certificate_credentials_t xcred; | 41 | extern mhd_gtls_cert_credentials_t xcred; |
42 | 42 | ||
43 | extern int verbose; | 43 | extern int verbose; |
44 | 44 | ||
@@ -54,13 +54,13 @@ static int sfree = 0; | |||
54 | static int handshake_output = 0; | 54 | static int handshake_output = 0; |
55 | 55 | ||
56 | int | 56 | int |
57 | do_handshake (gnutls_session_t session) | 57 | do_handshake (mhd_gtls_session_t session) |
58 | { | 58 | { |
59 | int ret, alert; | 59 | int ret, alert; |
60 | 60 | ||
61 | do | 61 | do |
62 | { | 62 | { |
63 | ret = gnutls_handshake (session); | 63 | ret = MHD_gnutls_handshake (session); |
64 | } | 64 | } |
65 | while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN); | 65 | while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN); |
66 | 66 | ||
@@ -74,7 +74,7 @@ do_handshake (gnutls_session_t session) | |||
74 | alert = gnutls_alert_get (session); | 74 | alert = gnutls_alert_get (session); |
75 | printf ("\n"); | 75 | printf ("\n"); |
76 | printf ("*** Received alert [%d]: %s\n", | 76 | printf ("*** Received alert [%d]: %s\n", |
77 | alert, gnutls_alert_get_name (alert)); | 77 | alert, MHD_gnutls_alert_get_name (alert)); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
@@ -98,7 +98,7 @@ do_handshake (gnutls_session_t session) | |||
98 | gnutls_session_get_data (session, session_data, &session_data_size); | 98 | gnutls_session_get_data (session, session_data, &session_data_size); |
99 | 99 | ||
100 | session_id_size = sizeof (session_id); | 100 | session_id_size = sizeof (session_id); |
101 | gnutls_session_get_id (session, session_id, &session_id_size); | 101 | MHD_gtls_session_get_id (session, session_id, &session_id_size); |
102 | 102 | ||
103 | return TEST_SUCCEED; | 103 | return TEST_SUCCEED; |
104 | } | 104 | } |
@@ -118,43 +118,43 @@ static const int mac_priority[16] = | |||
118 | { MHD_GNUTLS_MAC_SHA1, MHD_GNUTLS_MAC_MD5, 0 }; | 118 | { MHD_GNUTLS_MAC_SHA1, MHD_GNUTLS_MAC_MD5, 0 }; |
119 | static const int cert_type_priority[16] = { MHD_GNUTLS_CRT_X509, 0 }; | 119 | static const int cert_type_priority[16] = { MHD_GNUTLS_CRT_X509, 0 }; |
120 | 120 | ||
121 | #define ADD_ALL_CIPHERS(session) gnutls_cipher_set_priority(session, cipher_priority) | 121 | #define ADD_ALL_CIPHERS(session) MHD_gnutls_cipher_set_priority(session, cipher_priority) |
122 | #define ADD_ALL_COMP(session) gnutls_compression_set_priority(session, comp_priority) | 122 | #define ADD_ALL_COMP(session) MHD_gnutls_compression_set_priority(session, comp_priority) |
123 | #define ADD_ALL_MACS(session) gnutls_mac_set_priority(session, mac_priority) | 123 | #define ADD_ALL_MACS(session) MHD_gnutls_mac_set_priority(session, mac_priority) |
124 | #define ADD_ALL_KX(session) gnutls_kx_set_priority(session, kx_priority) | 124 | #define ADD_ALL_KX(session) MHD_gnutls_kx_set_priority(session, kx_priority) |
125 | #define ADD_ALL_PROTOCOLS(session) gnutls_protocol_set_priority(session, protocol_priority) | 125 | #define ADD_ALL_PROTOCOLS(session) MHD_gnutls_protocol_set_priority(session, protocol_priority) |
126 | #define ADD_ALL_CERTTYPES(session) gnutls_certificate_type_set_priority(session, cert_type_priority) | 126 | #define ADD_ALL_CERTTYPES(session) MHD_gnutls_certificate_type_set_priority(session, cert_type_priority) |
127 | 127 | ||
128 | static void | 128 | static void |
129 | ADD_KX (gnutls_session_t session, int kx) | 129 | ADD_KX (mhd_gtls_session_t session, int kx) |
130 | { | 130 | { |
131 | static int _kx_priority[] = { 0, 0 }; | 131 | static int _kx_priority[] = { 0, 0 }; |
132 | _kx_priority[0] = kx; | 132 | _kx_priority[0] = kx; |
133 | 133 | ||
134 | gnutls_kx_set_priority (session, _kx_priority); | 134 | MHD_gnutls_kx_set_priority (session, _kx_priority); |
135 | } | 135 | } |
136 | 136 | ||
137 | static void | 137 | static void |
138 | ADD_KX2 (gnutls_session_t session, int kx1, int kx2) | 138 | ADD_KX2 (mhd_gtls_session_t session, int kx1, int kx2) |
139 | { | 139 | { |
140 | static int _kx_priority[] = { 0, 0, 0 }; | 140 | static int _kx_priority[] = { 0, 0, 0 }; |
141 | _kx_priority[0] = kx1; | 141 | _kx_priority[0] = kx1; |
142 | _kx_priority[1] = kx2; | 142 | _kx_priority[1] = kx2; |
143 | 143 | ||
144 | gnutls_kx_set_priority (session, _kx_priority); | 144 | MHD_gnutls_kx_set_priority (session, _kx_priority); |
145 | } | 145 | } |
146 | 146 | ||
147 | static void | 147 | static void |
148 | ADD_CIPHER (gnutls_session_t session, int cipher) | 148 | ADD_CIPHER (mhd_gtls_session_t session, int cipher) |
149 | { | 149 | { |
150 | static int _cipher_priority[] = { 0, 0 }; | 150 | static int _cipher_priority[] = { 0, 0 }; |
151 | _cipher_priority[0] = cipher; | 151 | _cipher_priority[0] = cipher; |
152 | 152 | ||
153 | gnutls_cipher_set_priority (session, _cipher_priority); | 153 | MHD_gnutls_cipher_set_priority (session, _cipher_priority); |
154 | } | 154 | } |
155 | 155 | ||
156 | static void | 156 | static void |
157 | ADD_CIPHER4 (gnutls_session_t session, int cipher1, int cipher2, int cipher3, | 157 | ADD_CIPHER4 (mhd_gtls_session_t session, int cipher1, int cipher2, int cipher3, |
158 | int cipher4) | 158 | int cipher4) |
159 | { | 159 | { |
160 | static int _cipher_priority[] = { 0, 0, 0, 0, 0 }; | 160 | static int _cipher_priority[] = { 0, 0, 0, 0, 0 }; |
@@ -163,61 +163,61 @@ ADD_CIPHER4 (gnutls_session_t session, int cipher1, int cipher2, int cipher3, | |||
163 | _cipher_priority[2] = cipher3; | 163 | _cipher_priority[2] = cipher3; |
164 | _cipher_priority[3] = cipher4; | 164 | _cipher_priority[3] = cipher4; |
165 | 165 | ||
166 | gnutls_cipher_set_priority (session, _cipher_priority); | 166 | MHD_gnutls_cipher_set_priority (session, _cipher_priority); |
167 | } | 167 | } |
168 | 168 | ||
169 | static void | 169 | static void |
170 | ADD_MAC (gnutls_session_t session, int mac) | 170 | ADD_MAC (mhd_gtls_session_t session, int mac) |
171 | { | 171 | { |
172 | static int _mac_priority[] = { 0, 0 }; | 172 | static int _mac_priority[] = { 0, 0 }; |
173 | _mac_priority[0] = mac; | 173 | _mac_priority[0] = mac; |
174 | 174 | ||
175 | gnutls_mac_set_priority (session, _mac_priority); | 175 | MHD_gnutls_mac_set_priority (session, _mac_priority); |
176 | } | 176 | } |
177 | 177 | ||
178 | static void | 178 | static void |
179 | ADD_COMP (gnutls_session_t session, int c) | 179 | ADD_COMP (mhd_gtls_session_t session, int c) |
180 | { | 180 | { |
181 | static int _comp_priority[] = { 0, 0 }; | 181 | static int _comp_priority[] = { 0, 0 }; |
182 | _comp_priority[0] = c; | 182 | _comp_priority[0] = c; |
183 | 183 | ||
184 | gnutls_compression_set_priority (session, _comp_priority); | 184 | MHD_gnutls_compression_set_priority (session, _comp_priority); |
185 | } | 185 | } |
186 | 186 | ||
187 | static void | 187 | static void |
188 | ADD_CERTTYPE (gnutls_session_t session, int ctype) | 188 | ADD_CERTTYPE (mhd_gtls_session_t session, int ctype) |
189 | { | 189 | { |
190 | static int _ct_priority[] = { 0, 0 }; | 190 | static int _ct_priority[] = { 0, 0 }; |
191 | _ct_priority[0] = ctype; | 191 | _ct_priority[0] = ctype; |
192 | 192 | ||
193 | gnutls_certificate_type_set_priority (session, _ct_priority); | 193 | MHD_gnutls_certificate_type_set_priority (session, _ct_priority); |
194 | } | 194 | } |
195 | 195 | ||
196 | static void | 196 | static void |
197 | ADD_PROTOCOL (gnutls_session_t session, int protocol) | 197 | ADD_PROTOCOL (mhd_gtls_session_t session, int protocol) |
198 | { | 198 | { |
199 | static int _proto_priority[] = { 0, 0 }; | 199 | static int _proto_priority[] = { 0, 0 }; |
200 | _proto_priority[0] = protocol; | 200 | _proto_priority[0] = protocol; |
201 | 201 | ||
202 | gnutls_protocol_set_priority (session, _proto_priority); | 202 | MHD_gnutls_protocol_set_priority (session, _proto_priority); |
203 | } | 203 | } |
204 | 204 | ||
205 | static void | 205 | static void |
206 | ADD_PROTOCOL3 (gnutls_session_t session, int p1, int p2, int p3) | 206 | ADD_PROTOCOL3 (mhd_gtls_session_t session, int p1, int p2, int p3) |
207 | { | 207 | { |
208 | static int _proto_priority[] = { 0, 0, 0, 0 }; | 208 | static int _proto_priority[] = { 0, 0, 0, 0 }; |
209 | _proto_priority[0] = p1; | 209 | _proto_priority[0] = p1; |
210 | _proto_priority[1] = p2; | 210 | _proto_priority[1] = p2; |
211 | _proto_priority[2] = p3; | 211 | _proto_priority[2] = p3; |
212 | 212 | ||
213 | gnutls_protocol_set_priority (session, _proto_priority); | 213 | MHD_gnutls_protocol_set_priority (session, _proto_priority); |
214 | } | 214 | } |
215 | 215 | ||
216 | #ifdef ENABLE_SRP | 216 | #ifdef ENABLE_SRP |
217 | static int srp_detected; | 217 | static int srp_detected; |
218 | 218 | ||
219 | int | 219 | int |
220 | _test_srp_username_callback (gnutls_session_t session, | 220 | _test_srp_username_callback (mhd_gtls_session_t session, |
221 | char **username, char **password) | 221 | char **username, char **password) |
222 | { | 222 | { |
223 | srp_detected = 1; | 223 | srp_detected = 1; |
@@ -226,7 +226,7 @@ _test_srp_username_callback (gnutls_session_t session, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | test_code_t | 228 | test_code_t |
229 | test_srp (gnutls_session_t session) | 229 | test_srp (mhd_gtls_session_t session) |
230 | { | 230 | { |
231 | int ret; | 231 | int ret; |
232 | 232 | ||
@@ -242,7 +242,7 @@ test_srp (gnutls_session_t session) | |||
242 | gnutls_srp_set_client_credentials_function (srp_cred, | 242 | gnutls_srp_set_client_credentials_function (srp_cred, |
243 | _test_srp_username_callback); | 243 | _test_srp_username_callback); |
244 | 244 | ||
245 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_SRP, srp_cred); | 245 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_SRP, srp_cred); |
246 | 246 | ||
247 | ret = do_handshake (session); | 247 | ret = do_handshake (session); |
248 | 248 | ||
@@ -256,7 +256,7 @@ test_srp (gnutls_session_t session) | |||
256 | #endif | 256 | #endif |
257 | 257 | ||
258 | test_code_t | 258 | test_code_t |
259 | test_server (gnutls_session_t session) | 259 | test_server (mhd_gtls_session_t session) |
260 | { | 260 | { |
261 | int ret, i = 0; | 261 | int ret, i = 0; |
262 | char buf[5 * 1024]; | 262 | char buf[5 * 1024]; |
@@ -275,14 +275,14 @@ test_server (gnutls_session_t session) | |||
275 | ADD_ALL_MACS (session); | 275 | ADD_ALL_MACS (session); |
276 | ADD_ALL_KX (session); | 276 | ADD_ALL_KX (session); |
277 | 277 | ||
278 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 278 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
279 | 279 | ||
280 | ret = do_handshake (session); | 280 | ret = do_handshake (session); |
281 | if (ret != TEST_SUCCEED) | 281 | if (ret != TEST_SUCCEED) |
282 | return TEST_FAILED; | 282 | return TEST_FAILED; |
283 | 283 | ||
284 | gnutls_record_send (session, snd_buf, sizeof (snd_buf) - 1); | 284 | MHD_gnutls_record_send (session, snd_buf, sizeof (snd_buf) - 1); |
285 | ret = gnutls_record_recv (session, buf, sizeof (buf) - 1); | 285 | ret = MHD_gnutls_record_recv (session, buf, sizeof (buf) - 1); |
286 | if (ret < 0) | 286 | if (ret < 0) |
287 | return TEST_FAILED; | 287 | return TEST_FAILED; |
288 | 288 | ||
@@ -313,7 +313,7 @@ static gnutls_datum_t exp = { NULL, 0 }, mod = | |||
313 | NULL, 0}; | 313 | NULL, 0}; |
314 | 314 | ||
315 | test_code_t | 315 | test_code_t |
316 | test_export (gnutls_session_t session) | 316 | test_export (mhd_gtls_session_t session) |
317 | { | 317 | { |
318 | int ret; | 318 | int ret; |
319 | 319 | ||
@@ -324,21 +324,21 @@ test_export (gnutls_session_t session) | |||
324 | 324 | ||
325 | ADD_KX (session, MHD_GNUTLS_KX_RSA_EXPORT); | 325 | ADD_KX (session, MHD_GNUTLS_KX_RSA_EXPORT); |
326 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_40); | 326 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_40); |
327 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 327 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
328 | 328 | ||
329 | ret = do_handshake (session); | 329 | ret = do_handshake (session); |
330 | 330 | ||
331 | if (ret == TEST_SUCCEED) | 331 | if (ret == TEST_SUCCEED) |
332 | { | 332 | { |
333 | export_true = 1; | 333 | export_true = 1; |
334 | gnutls_rsa_export_get_pubkey (session, &exp, &mod); | 334 | MHD_gtls_rsa_export_get_pubkey (session, &exp, &mod); |
335 | } | 335 | } |
336 | 336 | ||
337 | return ret; | 337 | return ret; |
338 | } | 338 | } |
339 | 339 | ||
340 | test_code_t | 340 | test_code_t |
341 | test_export_info (gnutls_session_t session) | 341 | test_export_info (mhd_gtls_session_t session) |
342 | { | 342 | { |
343 | int ret2, ret; | 343 | int ret2, ret; |
344 | gnutls_datum_t exp2, mod2; | 344 | gnutls_datum_t exp2, mod2; |
@@ -354,13 +354,13 @@ test_export_info (gnutls_session_t session) | |||
354 | 354 | ||
355 | ADD_KX (session, MHD_GNUTLS_KX_RSA_EXPORT); | 355 | ADD_KX (session, MHD_GNUTLS_KX_RSA_EXPORT); |
356 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_40); | 356 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_40); |
357 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 357 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
358 | 358 | ||
359 | ret = do_handshake (session); | 359 | ret = do_handshake (session); |
360 | 360 | ||
361 | if (ret == TEST_SUCCEED) | 361 | if (ret == TEST_SUCCEED) |
362 | { | 362 | { |
363 | ret2 = gnutls_rsa_export_get_pubkey (session, &exp2, &mod2); | 363 | ret2 = MHD_gtls_rsa_export_get_pubkey (session, &exp2, &mod2); |
364 | if (ret2 >= 0) | 364 | if (ret2 >= 0) |
365 | { | 365 | { |
366 | printf ("\n"); | 366 | printf ("\n"); |
@@ -390,7 +390,7 @@ test_export_info (gnutls_session_t session) | |||
390 | static gnutls_datum_t pubkey = { NULL, 0 }; | 390 | static gnutls_datum_t pubkey = { NULL, 0 }; |
391 | 391 | ||
392 | test_code_t | 392 | test_code_t |
393 | test_dhe (gnutls_session_t session) | 393 | test_dhe (mhd_gtls_session_t session) |
394 | { | 394 | { |
395 | int ret; | 395 | int ret; |
396 | 396 | ||
@@ -401,17 +401,17 @@ test_dhe (gnutls_session_t session) | |||
401 | ADD_ALL_MACS (session); | 401 | ADD_ALL_MACS (session); |
402 | 402 | ||
403 | ADD_KX2 (session, MHD_GNUTLS_KX_DHE_RSA, MHD_GNUTLS_KX_DHE_DSS); | 403 | ADD_KX2 (session, MHD_GNUTLS_KX_DHE_RSA, MHD_GNUTLS_KX_DHE_DSS); |
404 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 404 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
405 | 405 | ||
406 | ret = do_handshake (session); | 406 | ret = do_handshake (session); |
407 | 407 | ||
408 | gnutls_dh_get_pubkey (session, &pubkey); | 408 | MHD_gnutls_dh_get_pubkey (session, &pubkey); |
409 | 409 | ||
410 | return ret; | 410 | return ret; |
411 | } | 411 | } |
412 | 412 | ||
413 | test_code_t | 413 | test_code_t |
414 | test_dhe_group (gnutls_session_t session) | 414 | test_dhe_group (mhd_gtls_session_t session) |
415 | { | 415 | { |
416 | int ret, ret2; | 416 | int ret, ret2; |
417 | gnutls_datum_t gen, prime, pubkey2; | 417 | gnutls_datum_t gen, prime, pubkey2; |
@@ -427,11 +427,11 @@ test_dhe_group (gnutls_session_t session) | |||
427 | ADD_ALL_MACS (session); | 427 | ADD_ALL_MACS (session); |
428 | 428 | ||
429 | ADD_KX2 (session, MHD_GNUTLS_KX_DHE_RSA, MHD_GNUTLS_KX_DHE_DSS); | 429 | ADD_KX2 (session, MHD_GNUTLS_KX_DHE_RSA, MHD_GNUTLS_KX_DHE_DSS); |
430 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 430 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
431 | 431 | ||
432 | ret = do_handshake (session); | 432 | ret = do_handshake (session); |
433 | 433 | ||
434 | ret2 = gnutls_dh_get_group (session, &gen, &prime); | 434 | ret2 = MHD_gnutls_dh_get_group (session, &gen, &prime); |
435 | if (ret2 >= 0) | 435 | if (ret2 >= 0) |
436 | { | 436 | { |
437 | printf ("\n"); | 437 | printf ("\n"); |
@@ -444,7 +444,7 @@ test_dhe_group (gnutls_session_t session) | |||
444 | if (print) | 444 | if (print) |
445 | printf (" Prime [%d bits]: %s\n", prime.size * 8, print); | 445 | printf (" Prime [%d bits]: %s\n", prime.size * 8, print); |
446 | 446 | ||
447 | gnutls_dh_get_pubkey (session, &pubkey2); | 447 | MHD_gnutls_dh_get_pubkey (session, &pubkey2); |
448 | print = raw_to_string (pubkey2.data, pubkey2.size); | 448 | print = raw_to_string (pubkey2.data, pubkey2.size); |
449 | if (print) | 449 | if (print) |
450 | printf (" Pubkey [%d bits]: %s\n", pubkey2.size * 8, print); | 450 | printf (" Pubkey [%d bits]: %s\n", pubkey2.size * 8, print); |
@@ -459,7 +459,7 @@ test_dhe_group (gnutls_session_t session) | |||
459 | } | 459 | } |
460 | 460 | ||
461 | test_code_t | 461 | test_code_t |
462 | test_ssl3 (gnutls_session_t session) | 462 | test_ssl3 (mhd_gtls_session_t session) |
463 | { | 463 | { |
464 | int ret; | 464 | int ret; |
465 | ADD_ALL_CIPHERS (session); | 465 | ADD_ALL_CIPHERS (session); |
@@ -468,7 +468,7 @@ test_ssl3 (gnutls_session_t session) | |||
468 | ADD_PROTOCOL (session, MHD_GNUTLS_SSL3); | 468 | ADD_PROTOCOL (session, MHD_GNUTLS_SSL3); |
469 | ADD_ALL_MACS (session); | 469 | ADD_ALL_MACS (session); |
470 | ADD_ALL_KX (session); | 470 | ADD_ALL_KX (session); |
471 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 471 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
472 | 472 | ||
473 | ret = do_handshake (session); | 473 | ret = do_handshake (session); |
474 | if (ret == TEST_SUCCEED) | 474 | if (ret == TEST_SUCCEED) |
@@ -485,7 +485,7 @@ got_alarm (int k) | |||
485 | } | 485 | } |
486 | 486 | ||
487 | test_code_t | 487 | test_code_t |
488 | test_bye (gnutls_session_t session) | 488 | test_bye (mhd_gtls_session_t session) |
489 | { | 489 | { |
490 | int ret; | 490 | int ret; |
491 | char data[20]; | 491 | char data[20]; |
@@ -501,13 +501,13 @@ test_bye (gnutls_session_t session) | |||
501 | ADD_ALL_PROTOCOLS (session); | 501 | ADD_ALL_PROTOCOLS (session); |
502 | ADD_ALL_MACS (session); | 502 | ADD_ALL_MACS (session); |
503 | ADD_ALL_KX (session); | 503 | ADD_ALL_KX (session); |
504 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 504 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
505 | 505 | ||
506 | ret = do_handshake (session); | 506 | ret = do_handshake (session); |
507 | if (ret == TEST_FAILED) | 507 | if (ret == TEST_FAILED) |
508 | return ret; | 508 | return ret; |
509 | 509 | ||
510 | ret = gnutls_bye (session, GNUTLS_SHUT_WR); | 510 | ret = MHD_gnutls_bye (session, GNUTLS_SHUT_WR); |
511 | if (ret < 0) | 511 | if (ret < 0) |
512 | return TEST_FAILED; | 512 | return TEST_FAILED; |
513 | 513 | ||
@@ -521,7 +521,7 @@ test_bye (gnutls_session_t session) | |||
521 | 521 | ||
522 | do | 522 | do |
523 | { | 523 | { |
524 | ret = gnutls_record_recv (session, data, sizeof (data)); | 524 | ret = MHD_gnutls_record_recv (session, data, sizeof (data)); |
525 | } | 525 | } |
526 | while (ret > 0); | 526 | while (ret > 0); |
527 | 527 | ||
@@ -544,7 +544,7 @@ test_bye (gnutls_session_t session) | |||
544 | 544 | ||
545 | 545 | ||
546 | test_code_t | 546 | test_code_t |
547 | test_aes (gnutls_session_t session) | 547 | test_aes (mhd_gtls_session_t session) |
548 | { | 548 | { |
549 | int ret; | 549 | int ret; |
550 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_AES_128_CBC); | 550 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_AES_128_CBC); |
@@ -553,7 +553,7 @@ test_aes (gnutls_session_t session) | |||
553 | ADD_ALL_PROTOCOLS (session); | 553 | ADD_ALL_PROTOCOLS (session); |
554 | ADD_ALL_MACS (session); | 554 | ADD_ALL_MACS (session); |
555 | ADD_ALL_KX (session); | 555 | ADD_ALL_KX (session); |
556 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 556 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
557 | 557 | ||
558 | ret = do_handshake (session); | 558 | ret = do_handshake (session); |
559 | return ret; | 559 | return ret; |
@@ -561,7 +561,7 @@ test_aes (gnutls_session_t session) | |||
561 | 561 | ||
562 | #ifdef ENABLE_CAMELLIA | 562 | #ifdef ENABLE_CAMELLIA |
563 | test_code_t | 563 | test_code_t |
564 | test_camellia (gnutls_session_t session) | 564 | test_camellia (mhd_gtls_session_t session) |
565 | { | 565 | { |
566 | int ret; | 566 | int ret; |
567 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_CAMELLIA_128_CBC); | 567 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_CAMELLIA_128_CBC); |
@@ -570,7 +570,7 @@ test_camellia (gnutls_session_t session) | |||
570 | ADD_ALL_PROTOCOLS (session); | 570 | ADD_ALL_PROTOCOLS (session); |
571 | ADD_ALL_MACS (session); | 571 | ADD_ALL_MACS (session); |
572 | ADD_ALL_KX (session); | 572 | ADD_ALL_KX (session); |
573 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 573 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
574 | 574 | ||
575 | ret = do_handshake (session); | 575 | ret = do_handshake (session); |
576 | return ret; | 576 | return ret; |
@@ -578,7 +578,7 @@ test_camellia (gnutls_session_t session) | |||
578 | #endif | 578 | #endif |
579 | 579 | ||
580 | test_code_t | 580 | test_code_t |
581 | test_openpgp1 (gnutls_session_t session) | 581 | test_openpgp1 (mhd_gtls_session_t session) |
582 | { | 582 | { |
583 | int ret; | 583 | int ret; |
584 | ADD_ALL_CIPHERS (session); | 584 | ADD_ALL_CIPHERS (session); |
@@ -587,7 +587,7 @@ test_openpgp1 (gnutls_session_t session) | |||
587 | ADD_ALL_PROTOCOLS (session); | 587 | ADD_ALL_PROTOCOLS (session); |
588 | ADD_ALL_MACS (session); | 588 | ADD_ALL_MACS (session); |
589 | ADD_ALL_KX (session); | 589 | ADD_ALL_KX (session); |
590 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 590 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
591 | 591 | ||
592 | ret = do_handshake (session); | 592 | ret = do_handshake (session); |
593 | if (ret == TEST_FAILED) | 593 | if (ret == TEST_FAILED) |
@@ -600,7 +600,7 @@ test_openpgp1 (gnutls_session_t session) | |||
600 | } | 600 | } |
601 | 601 | ||
602 | test_code_t | 602 | test_code_t |
603 | test_unknown_ciphersuites (gnutls_session_t session) | 603 | test_unknown_ciphersuites (mhd_gtls_session_t session) |
604 | { | 604 | { |
605 | int ret; | 605 | int ret; |
606 | #ifdef ENABLE_CAMELLIA | 606 | #ifdef ENABLE_CAMELLIA |
@@ -616,14 +616,14 @@ test_unknown_ciphersuites (gnutls_session_t session) | |||
616 | ADD_ALL_PROTOCOLS (session); | 616 | ADD_ALL_PROTOCOLS (session); |
617 | ADD_ALL_MACS (session); | 617 | ADD_ALL_MACS (session); |
618 | ADD_ALL_KX (session); | 618 | ADD_ALL_KX (session); |
619 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 619 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
620 | 620 | ||
621 | ret = do_handshake (session); | 621 | ret = do_handshake (session); |
622 | return ret; | 622 | return ret; |
623 | } | 623 | } |
624 | 624 | ||
625 | test_code_t | 625 | test_code_t |
626 | test_md5 (gnutls_session_t session) | 626 | test_md5 (mhd_gtls_session_t session) |
627 | { | 627 | { |
628 | int ret; | 628 | int ret; |
629 | ADD_ALL_CIPHERS (session); | 629 | ADD_ALL_CIPHERS (session); |
@@ -632,7 +632,7 @@ test_md5 (gnutls_session_t session) | |||
632 | ADD_ALL_PROTOCOLS (session); | 632 | ADD_ALL_PROTOCOLS (session); |
633 | ADD_MAC (session, MHD_GNUTLS_MAC_MD5); | 633 | ADD_MAC (session, MHD_GNUTLS_MAC_MD5); |
634 | ADD_ALL_KX (session); | 634 | ADD_ALL_KX (session); |
635 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 635 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
636 | 636 | ||
637 | ret = do_handshake (session); | 637 | ret = do_handshake (session); |
638 | return ret; | 638 | return ret; |
@@ -640,7 +640,7 @@ test_md5 (gnutls_session_t session) | |||
640 | 640 | ||
641 | #ifdef HAVE_LIBZ | 641 | #ifdef HAVE_LIBZ |
642 | test_code_t | 642 | test_code_t |
643 | test_zlib (gnutls_session_t session) | 643 | test_zlib (mhd_gtls_session_t session) |
644 | { | 644 | { |
645 | int ret; | 645 | int ret; |
646 | ADD_ALL_CIPHERS (session); | 646 | ADD_ALL_CIPHERS (session); |
@@ -649,7 +649,7 @@ test_zlib (gnutls_session_t session) | |||
649 | ADD_ALL_PROTOCOLS (session); | 649 | ADD_ALL_PROTOCOLS (session); |
650 | ADD_ALL_MACS (session); | 650 | ADD_ALL_MACS (session); |
651 | ADD_ALL_KX (session); | 651 | ADD_ALL_KX (session); |
652 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 652 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
653 | 653 | ||
654 | ret = do_handshake (session); | 654 | ret = do_handshake (session); |
655 | return ret; | 655 | return ret; |
@@ -657,10 +657,10 @@ test_zlib (gnutls_session_t session) | |||
657 | #endif | 657 | #endif |
658 | 658 | ||
659 | test_code_t | 659 | test_code_t |
660 | test_lzo (gnutls_session_t session) | 660 | test_lzo (mhd_gtls_session_t session) |
661 | { | 661 | { |
662 | int ret; | 662 | int ret; |
663 | gnutls_handshake_set_private_extensions (session, 1); | 663 | MHD_gtls_handshake_set_private_extensions (session, 1); |
664 | 664 | ||
665 | ADD_ALL_CIPHERS (session); | 665 | ADD_ALL_CIPHERS (session); |
666 | ADD_COMP (session, MHD_GNUTLS_COMP_LZO); | 666 | ADD_COMP (session, MHD_GNUTLS_COMP_LZO); |
@@ -668,7 +668,7 @@ test_lzo (gnutls_session_t session) | |||
668 | ADD_ALL_PROTOCOLS (session); | 668 | ADD_ALL_PROTOCOLS (session); |
669 | ADD_ALL_MACS (session); | 669 | ADD_ALL_MACS (session); |
670 | ADD_ALL_KX (session); | 670 | ADD_ALL_KX (session); |
671 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 671 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
672 | 672 | ||
673 | ret = do_handshake (session); | 673 | ret = do_handshake (session); |
674 | 674 | ||
@@ -676,7 +676,7 @@ test_lzo (gnutls_session_t session) | |||
676 | } | 676 | } |
677 | 677 | ||
678 | test_code_t | 678 | test_code_t |
679 | test_sha (gnutls_session_t session) | 679 | test_sha (mhd_gtls_session_t session) |
680 | { | 680 | { |
681 | int ret; | 681 | int ret; |
682 | ADD_ALL_CIPHERS (session); | 682 | ADD_ALL_CIPHERS (session); |
@@ -685,14 +685,14 @@ test_sha (gnutls_session_t session) | |||
685 | ADD_ALL_PROTOCOLS (session); | 685 | ADD_ALL_PROTOCOLS (session); |
686 | ADD_MAC (session, MHD_GNUTLS_MAC_SHA1); | 686 | ADD_MAC (session, MHD_GNUTLS_MAC_SHA1); |
687 | ADD_ALL_KX (session); | 687 | ADD_ALL_KX (session); |
688 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 688 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
689 | 689 | ||
690 | ret = do_handshake (session); | 690 | ret = do_handshake (session); |
691 | return ret; | 691 | return ret; |
692 | } | 692 | } |
693 | 693 | ||
694 | test_code_t | 694 | test_code_t |
695 | test_3des (gnutls_session_t session) | 695 | test_3des (mhd_gtls_session_t session) |
696 | { | 696 | { |
697 | int ret; | 697 | int ret; |
698 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_3DES_CBC); | 698 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_3DES_CBC); |
@@ -701,14 +701,14 @@ test_3des (gnutls_session_t session) | |||
701 | ADD_ALL_PROTOCOLS (session); | 701 | ADD_ALL_PROTOCOLS (session); |
702 | ADD_ALL_MACS (session); | 702 | ADD_ALL_MACS (session); |
703 | ADD_ALL_KX (session); | 703 | ADD_ALL_KX (session); |
704 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 704 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
705 | 705 | ||
706 | ret = do_handshake (session); | 706 | ret = do_handshake (session); |
707 | return ret; | 707 | return ret; |
708 | } | 708 | } |
709 | 709 | ||
710 | test_code_t | 710 | test_code_t |
711 | test_arcfour (gnutls_session_t session) | 711 | test_arcfour (mhd_gtls_session_t session) |
712 | { | 712 | { |
713 | int ret; | 713 | int ret; |
714 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_128); | 714 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_128); |
@@ -717,14 +717,14 @@ test_arcfour (gnutls_session_t session) | |||
717 | ADD_ALL_PROTOCOLS (session); | 717 | ADD_ALL_PROTOCOLS (session); |
718 | ADD_ALL_MACS (session); | 718 | ADD_ALL_MACS (session); |
719 | ADD_ALL_KX (session); | 719 | ADD_ALL_KX (session); |
720 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 720 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
721 | 721 | ||
722 | ret = do_handshake (session); | 722 | ret = do_handshake (session); |
723 | return ret; | 723 | return ret; |
724 | } | 724 | } |
725 | 725 | ||
726 | test_code_t | 726 | test_code_t |
727 | test_arcfour_40 (gnutls_session_t session) | 727 | test_arcfour_40 (mhd_gtls_session_t session) |
728 | { | 728 | { |
729 | int ret; | 729 | int ret; |
730 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_40); | 730 | ADD_CIPHER (session, MHD_GNUTLS_CIPHER_ARCFOUR_40); |
@@ -733,14 +733,14 @@ test_arcfour_40 (gnutls_session_t session) | |||
733 | ADD_ALL_PROTOCOLS (session); | 733 | ADD_ALL_PROTOCOLS (session); |
734 | ADD_ALL_MACS (session); | 734 | ADD_ALL_MACS (session); |
735 | ADD_ALL_KX (session); | 735 | ADD_ALL_KX (session); |
736 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 736 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
737 | 737 | ||
738 | ret = do_handshake (session); | 738 | ret = do_handshake (session); |
739 | return ret; | 739 | return ret; |
740 | } | 740 | } |
741 | 741 | ||
742 | test_code_t | 742 | test_code_t |
743 | test_tls1 (gnutls_session_t session) | 743 | test_tls1 (mhd_gtls_session_t session) |
744 | { | 744 | { |
745 | int ret; | 745 | int ret; |
746 | ADD_ALL_CIPHERS (session); | 746 | ADD_ALL_CIPHERS (session); |
@@ -749,7 +749,7 @@ test_tls1 (gnutls_session_t session) | |||
749 | ADD_PROTOCOL (session, GNUTLS_TLS1); | 749 | ADD_PROTOCOL (session, GNUTLS_TLS1); |
750 | ADD_ALL_MACS (session); | 750 | ADD_ALL_MACS (session); |
751 | ADD_ALL_KX (session); | 751 | ADD_ALL_KX (session); |
752 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 752 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
753 | 753 | ||
754 | ret = do_handshake (session); | 754 | ret = do_handshake (session); |
755 | if (ret == TEST_SUCCEED) | 755 | if (ret == TEST_SUCCEED) |
@@ -760,7 +760,7 @@ test_tls1 (gnutls_session_t session) | |||
760 | } | 760 | } |
761 | 761 | ||
762 | test_code_t | 762 | test_code_t |
763 | test_tls1_1 (gnutls_session_t session) | 763 | test_tls1_1 (mhd_gtls_session_t session) |
764 | { | 764 | { |
765 | int ret; | 765 | int ret; |
766 | ADD_ALL_CIPHERS (session); | 766 | ADD_ALL_CIPHERS (session); |
@@ -769,7 +769,7 @@ test_tls1_1 (gnutls_session_t session) | |||
769 | ADD_PROTOCOL (session, MHD_GNUTLS_TLS1_1); | 769 | ADD_PROTOCOL (session, MHD_GNUTLS_TLS1_1); |
770 | ADD_ALL_MACS (session); | 770 | ADD_ALL_MACS (session); |
771 | ADD_ALL_KX (session); | 771 | ADD_ALL_KX (session); |
772 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 772 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
773 | 773 | ||
774 | ret = do_handshake (session); | 774 | ret = do_handshake (session); |
775 | if (ret == TEST_SUCCEED) | 775 | if (ret == TEST_SUCCEED) |
@@ -780,7 +780,7 @@ test_tls1_1 (gnutls_session_t session) | |||
780 | } | 780 | } |
781 | 781 | ||
782 | test_code_t | 782 | test_code_t |
783 | test_tls1_1_fallback (gnutls_session_t session) | 783 | test_tls1_1_fallback (mhd_gtls_session_t session) |
784 | { | 784 | { |
785 | int ret; | 785 | int ret; |
786 | if (tls1_1_ok) | 786 | if (tls1_1_ok) |
@@ -792,15 +792,15 @@ test_tls1_1_fallback (gnutls_session_t session) | |||
792 | ADD_PROTOCOL3 (session, MHD_GNUTLS_TLS1_1, GNUTLS_TLS1, MHD_GNUTLS_SSL3); | 792 | ADD_PROTOCOL3 (session, MHD_GNUTLS_TLS1_1, GNUTLS_TLS1, MHD_GNUTLS_SSL3); |
793 | ADD_ALL_MACS (session); | 793 | ADD_ALL_MACS (session); |
794 | ADD_ALL_KX (session); | 794 | ADD_ALL_KX (session); |
795 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 795 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
796 | 796 | ||
797 | ret = do_handshake (session); | 797 | ret = do_handshake (session); |
798 | if (ret != TEST_SUCCEED) | 798 | if (ret != TEST_SUCCEED) |
799 | return TEST_FAILED; | 799 | return TEST_FAILED; |
800 | 800 | ||
801 | if (gnutls_protocol_get_version (session) == GNUTLS_TLS1) | 801 | if (MHD_gnutls_protocol_get_version (session) == GNUTLS_TLS1) |
802 | return TEST_SUCCEED; | 802 | return TEST_SUCCEED; |
803 | else if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 803 | else if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
804 | return TEST_UNSURE; | 804 | return TEST_UNSURE; |
805 | 805 | ||
806 | return TEST_FAILED; | 806 | return TEST_FAILED; |
@@ -811,7 +811,7 @@ test_tls1_1_fallback (gnutls_session_t session) | |||
811 | * but the previous SSL 3.0 test succeeded then disable TLS 1.0. | 811 | * but the previous SSL 3.0 test succeeded then disable TLS 1.0. |
812 | */ | 812 | */ |
813 | test_code_t | 813 | test_code_t |
814 | test_tls_disable (gnutls_session_t session) | 814 | test_tls_disable (mhd_gtls_session_t session) |
815 | { | 815 | { |
816 | int ret; | 816 | int ret; |
817 | if (tls1_ok != 0) | 817 | if (tls1_ok != 0) |
@@ -823,7 +823,7 @@ test_tls_disable (gnutls_session_t session) | |||
823 | ADD_ALL_PROTOCOLS (session); | 823 | ADD_ALL_PROTOCOLS (session); |
824 | ADD_ALL_MACS (session); | 824 | ADD_ALL_MACS (session); |
825 | ADD_ALL_KX (session); | 825 | ADD_ALL_KX (session); |
826 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 826 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
827 | 827 | ||
828 | ret = do_handshake (session); | 828 | ret = do_handshake (session); |
829 | if (ret == TEST_FAILED) | 829 | if (ret == TEST_FAILED) |
@@ -840,7 +840,7 @@ test_tls_disable (gnutls_session_t session) | |||
840 | } | 840 | } |
841 | 841 | ||
842 | test_code_t | 842 | test_code_t |
843 | test_rsa_pms (gnutls_session_t session) | 843 | test_rsa_pms (mhd_gtls_session_t session) |
844 | { | 844 | { |
845 | int ret; | 845 | int ret; |
846 | 846 | ||
@@ -855,19 +855,19 @@ test_rsa_pms (gnutls_session_t session) | |||
855 | ADD_ALL_PROTOCOLS (session); | 855 | ADD_ALL_PROTOCOLS (session); |
856 | ADD_ALL_MACS (session); | 856 | ADD_ALL_MACS (session); |
857 | ADD_KX (session, MHD_GNUTLS_KX_RSA); | 857 | ADD_KX (session, MHD_GNUTLS_KX_RSA); |
858 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 858 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
859 | 859 | ||
860 | ret = do_handshake (session); | 860 | ret = do_handshake (session); |
861 | if (ret == TEST_FAILED) | 861 | if (ret == TEST_FAILED) |
862 | return TEST_FAILED; | 862 | return TEST_FAILED; |
863 | 863 | ||
864 | if (gnutls_protocol_get_version (session) == GNUTLS_TLS1) | 864 | if (MHD_gnutls_protocol_get_version (session) == GNUTLS_TLS1) |
865 | return TEST_SUCCEED; | 865 | return TEST_SUCCEED; |
866 | return TEST_UNSURE; | 866 | return TEST_UNSURE; |
867 | } | 867 | } |
868 | 868 | ||
869 | test_code_t | 869 | test_code_t |
870 | test_max_record_size (gnutls_session_t session) | 870 | test_max_record_size (mhd_gtls_session_t session) |
871 | { | 871 | { |
872 | int ret; | 872 | int ret; |
873 | ADD_ALL_CIPHERS (session); | 873 | ADD_ALL_CIPHERS (session); |
@@ -876,14 +876,14 @@ test_max_record_size (gnutls_session_t session) | |||
876 | ADD_ALL_PROTOCOLS (session); | 876 | ADD_ALL_PROTOCOLS (session); |
877 | ADD_ALL_MACS (session); | 877 | ADD_ALL_MACS (session); |
878 | ADD_ALL_KX (session); | 878 | ADD_ALL_KX (session); |
879 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 879 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
880 | gnutls_record_set_max_size (session, 512); | 880 | MHD_gnutls_record_set_max_size (session, 512); |
881 | 881 | ||
882 | ret = do_handshake (session); | 882 | ret = do_handshake (session); |
883 | if (ret == TEST_FAILED) | 883 | if (ret == TEST_FAILED) |
884 | return ret; | 884 | return ret; |
885 | 885 | ||
886 | ret = gnutls_record_get_max_size (session); | 886 | ret = MHD_gnutls_record_get_max_size (session); |
887 | if (ret == 512) | 887 | if (ret == 512) |
888 | return TEST_SUCCEED; | 888 | return TEST_SUCCEED; |
889 | 889 | ||
@@ -891,7 +891,7 @@ test_max_record_size (gnutls_session_t session) | |||
891 | } | 891 | } |
892 | 892 | ||
893 | test_code_t | 893 | test_code_t |
894 | test_hello_extension (gnutls_session_t session) | 894 | test_hello_extension (mhd_gtls_session_t session) |
895 | { | 895 | { |
896 | int ret; | 896 | int ret; |
897 | ADD_ALL_CIPHERS (session); | 897 | ADD_ALL_CIPHERS (session); |
@@ -900,19 +900,19 @@ test_hello_extension (gnutls_session_t session) | |||
900 | ADD_ALL_PROTOCOLS (session); | 900 | ADD_ALL_PROTOCOLS (session); |
901 | ADD_ALL_MACS (session); | 901 | ADD_ALL_MACS (session); |
902 | ADD_ALL_KX (session); | 902 | ADD_ALL_KX (session); |
903 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 903 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
904 | gnutls_record_set_max_size (session, 512); | 904 | MHD_gnutls_record_set_max_size (session, 512); |
905 | 905 | ||
906 | ret = do_handshake (session); | 906 | ret = do_handshake (session); |
907 | return ret; | 907 | return ret; |
908 | } | 908 | } |
909 | 909 | ||
910 | void _gnutls_record_set_default_version (gnutls_session_t session, | 910 | void _gnutls_record_set_default_version (mhd_gtls_session_t session, |
911 | unsigned char major, | 911 | unsigned char major, |
912 | unsigned char minor); | 912 | unsigned char minor); |
913 | 913 | ||
914 | test_code_t | 914 | test_code_t |
915 | test_version_rollback (gnutls_session_t session) | 915 | test_version_rollback (mhd_gtls_session_t session) |
916 | { | 916 | { |
917 | int ret; | 917 | int ret; |
918 | if (tls1_ok == 0) | 918 | if (tls1_ok == 0) |
@@ -931,7 +931,7 @@ test_version_rollback (gnutls_session_t session) | |||
931 | ADD_ALL_PROTOCOLS (session); | 931 | ADD_ALL_PROTOCOLS (session); |
932 | ADD_ALL_MACS (session); | 932 | ADD_ALL_MACS (session); |
933 | ADD_ALL_KX (session); | 933 | ADD_ALL_KX (session); |
934 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 934 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
935 | _gnutls_record_set_default_version (session, 3, 0); | 935 | _gnutls_record_set_default_version (session, 3, 0); |
936 | 936 | ||
937 | ret = do_handshake (session); | 937 | ret = do_handshake (session); |
@@ -939,7 +939,7 @@ test_version_rollback (gnutls_session_t session) | |||
939 | return ret; | 939 | return ret; |
940 | 940 | ||
941 | if (tls1_ok != 0 | 941 | if (tls1_ok != 0 |
942 | && gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 942 | && MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
943 | return TEST_FAILED; | 943 | return TEST_FAILED; |
944 | 944 | ||
945 | return TEST_SUCCEED; | 945 | return TEST_SUCCEED; |
@@ -950,7 +950,7 @@ test_version_rollback (gnutls_session_t session) | |||
950 | * message. | 950 | * message. |
951 | */ | 951 | */ |
952 | test_code_t | 952 | test_code_t |
953 | test_version_oob (gnutls_session_t session) | 953 | test_version_oob (mhd_gtls_session_t session) |
954 | { | 954 | { |
955 | int ret; | 955 | int ret; |
956 | /* here we enable both SSL 3.0 and TLS 1.0 | 956 | /* here we enable both SSL 3.0 and TLS 1.0 |
@@ -962,18 +962,18 @@ test_version_oob (gnutls_session_t session) | |||
962 | ADD_ALL_PROTOCOLS (session); | 962 | ADD_ALL_PROTOCOLS (session); |
963 | ADD_ALL_MACS (session); | 963 | ADD_ALL_MACS (session); |
964 | ADD_ALL_KX (session); | 964 | ADD_ALL_KX (session); |
965 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 965 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
966 | _gnutls_record_set_default_version (session, 5, 5); | 966 | _gnutls_record_set_default_version (session, 5, 5); |
967 | 967 | ||
968 | ret = do_handshake (session); | 968 | ret = do_handshake (session); |
969 | return ret; | 969 | return ret; |
970 | } | 970 | } |
971 | 971 | ||
972 | void _gnutls_rsa_pms_set_version (gnutls_session_t session, | 972 | void _gnutls_rsa_pms_set_version (mhd_gtls_session_t session, |
973 | unsigned char major, unsigned char minor); | 973 | unsigned char major, unsigned char minor); |
974 | 974 | ||
975 | test_code_t | 975 | test_code_t |
976 | test_rsa_pms_version_check (gnutls_session_t session) | 976 | test_rsa_pms_version_check (mhd_gtls_session_t session) |
977 | { | 977 | { |
978 | int ret; | 978 | int ret; |
979 | /* here we use an arbitary version in the RSA PMS | 979 | /* here we use an arbitary version in the RSA PMS |
@@ -987,7 +987,7 @@ test_rsa_pms_version_check (gnutls_session_t session) | |||
987 | ADD_ALL_PROTOCOLS (session); | 987 | ADD_ALL_PROTOCOLS (session); |
988 | ADD_ALL_MACS (session); | 988 | ADD_ALL_MACS (session); |
989 | ADD_ALL_KX (session); | 989 | ADD_ALL_KX (session); |
990 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 990 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
991 | _gnutls_rsa_pms_set_version (session, 5, 5); /* use SSL 5.5 version */ | 991 | _gnutls_rsa_pms_set_version (session, 5, 5); /* use SSL 5.5 version */ |
992 | 992 | ||
993 | ret = do_handshake (session); | 993 | ret = do_handshake (session); |
@@ -997,7 +997,7 @@ test_rsa_pms_version_check (gnutls_session_t session) | |||
997 | 997 | ||
998 | #ifdef ENABLE_ANON | 998 | #ifdef ENABLE_ANON |
999 | test_code_t | 999 | test_code_t |
1000 | test_anonymous (gnutls_session_t session) | 1000 | test_anonymous (mhd_gtls_session_t session) |
1001 | { | 1001 | { |
1002 | int ret; | 1002 | int ret; |
1003 | 1003 | ||
@@ -1007,19 +1007,19 @@ test_anonymous (gnutls_session_t session) | |||
1007 | ADD_ALL_PROTOCOLS (session); | 1007 | ADD_ALL_PROTOCOLS (session); |
1008 | ADD_ALL_MACS (session); | 1008 | ADD_ALL_MACS (session); |
1009 | ADD_KX (session, MHD_GNUTLS_KX_ANON_DH); | 1009 | ADD_KX (session, MHD_GNUTLS_KX_ANON_DH); |
1010 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_ANON, anon_cred); | 1010 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_ANON, anon_cred); |
1011 | 1011 | ||
1012 | ret = do_handshake (session); | 1012 | ret = do_handshake (session); |
1013 | 1013 | ||
1014 | if (ret == TEST_SUCCEED) | 1014 | if (ret == TEST_SUCCEED) |
1015 | gnutls_dh_get_pubkey (session, &pubkey); | 1015 | MHD_gnutls_dh_get_pubkey (session, &pubkey); |
1016 | 1016 | ||
1017 | return ret; | 1017 | return ret; |
1018 | } | 1018 | } |
1019 | #endif | 1019 | #endif |
1020 | 1020 | ||
1021 | test_code_t | 1021 | test_code_t |
1022 | test_session_resume2 (gnutls_session_t session) | 1022 | test_session_resume2 (mhd_gtls_session_t session) |
1023 | { | 1023 | { |
1024 | int ret; | 1024 | int ret; |
1025 | char tmp_session_id[32]; | 1025 | char tmp_session_id[32]; |
@@ -1035,8 +1035,8 @@ test_session_resume2 (gnutls_session_t session) | |||
1035 | ADD_ALL_MACS (session); | 1035 | ADD_ALL_MACS (session); |
1036 | ADD_ALL_KX (session); | 1036 | ADD_ALL_KX (session); |
1037 | 1037 | ||
1038 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 1038 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
1039 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_ANON, anon_cred); | 1039 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_ANON, anon_cred); |
1040 | 1040 | ||
1041 | gnutls_session_set_data (session, session_data, session_data_size); | 1041 | gnutls_session_set_data (session, session_data, session_data_size); |
1042 | 1042 | ||
@@ -1050,12 +1050,12 @@ test_session_resume2 (gnutls_session_t session) | |||
1050 | /* check if we actually resumed the previous session */ | 1050 | /* check if we actually resumed the previous session */ |
1051 | 1051 | ||
1052 | session_id_size = sizeof (session_id); | 1052 | session_id_size = sizeof (session_id); |
1053 | gnutls_session_get_id (session, session_id, &session_id_size); | 1053 | MHD_gtls_session_get_id (session, session_id, &session_id_size); |
1054 | 1054 | ||
1055 | if (session_id_size == 0) | 1055 | if (session_id_size == 0) |
1056 | return TEST_FAILED; | 1056 | return TEST_FAILED; |
1057 | 1057 | ||
1058 | if (gnutls_session_is_resumed (session)) | 1058 | if (MHD_gtls_session_is_resumed (session)) |
1059 | return TEST_SUCCEED; | 1059 | return TEST_SUCCEED; |
1060 | 1060 | ||
1061 | if (tmp_session_id_size == session_id_size && | 1061 | if (tmp_session_id_size == session_id_size && |
@@ -1068,7 +1068,7 @@ test_session_resume2 (gnutls_session_t session) | |||
1068 | extern char *hostname; | 1068 | extern char *hostname; |
1069 | 1069 | ||
1070 | test_code_t | 1070 | test_code_t |
1071 | test_certificate (gnutls_session_t session) | 1071 | test_certificate (mhd_gtls_session_t session) |
1072 | { | 1072 | { |
1073 | int ret; | 1073 | int ret; |
1074 | 1074 | ||
@@ -1082,7 +1082,7 @@ test_certificate (gnutls_session_t session) | |||
1082 | ADD_ALL_MACS (session); | 1082 | ADD_ALL_MACS (session); |
1083 | ADD_ALL_KX (session); | 1083 | ADD_ALL_KX (session); |
1084 | 1084 | ||
1085 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 1085 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
1086 | 1086 | ||
1087 | ret = do_handshake (session); | 1087 | ret = do_handshake (session); |
1088 | if (ret == TEST_FAILED) | 1088 | if (ret == TEST_FAILED) |
@@ -1097,7 +1097,7 @@ test_certificate (gnutls_session_t session) | |||
1097 | /* A callback function to be used at the certificate selection time. | 1097 | /* A callback function to be used at the certificate selection time. |
1098 | */ | 1098 | */ |
1099 | static int | 1099 | static int |
1100 | cert_callback (gnutls_session_t session, | 1100 | cert_callback (mhd_gtls_session_t session, |
1101 | const gnutls_datum_t * req_ca_rdn, int nreqs, | 1101 | const gnutls_datum_t * req_ca_rdn, int nreqs, |
1102 | const gnutls_pk_algorithm_t * sign_algos, | 1102 | const gnutls_pk_algorithm_t * sign_algos, |
1103 | int sign_algos_length, gnutls_retr_st * st) | 1103 | int sign_algos_length, gnutls_retr_st * st) |
@@ -1137,7 +1137,7 @@ cert_callback (gnutls_session_t session, | |||
1137 | * if the server sends a certificate request packet. | 1137 | * if the server sends a certificate request packet. |
1138 | */ | 1138 | */ |
1139 | test_code_t | 1139 | test_code_t |
1140 | test_server_cas (gnutls_session_t session) | 1140 | test_server_cas (mhd_gtls_session_t session) |
1141 | { | 1141 | { |
1142 | int ret; | 1142 | int ret; |
1143 | 1143 | ||
@@ -1151,11 +1151,11 @@ test_server_cas (gnutls_session_t session) | |||
1151 | ADD_ALL_MACS (session); | 1151 | ADD_ALL_MACS (session); |
1152 | ADD_ALL_KX (session); | 1152 | ADD_ALL_KX (session); |
1153 | 1153 | ||
1154 | gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 1154 | MHD_gnutls_credentials_set (session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
1155 | gnutls_certificate_client_set_retrieve_function (xcred, cert_callback); | 1155 | MHD_gtls_certificate_client_set_retrieve_function (xcred, cert_callback); |
1156 | 1156 | ||
1157 | ret = do_handshake (session); | 1157 | ret = do_handshake (session); |
1158 | gnutls_certificate_client_set_retrieve_function (xcred, NULL); | 1158 | MHD_gtls_certificate_client_set_retrieve_function (xcred, NULL); |
1159 | 1159 | ||
1160 | if (ret == TEST_FAILED) | 1160 | if (ret == TEST_FAILED) |
1161 | return ret; | 1161 | return ret; |
diff --git a/src/daemon/https/tests.h b/src/daemon/https/tests.h index 2f27f850..bc2d5aaf 100644 --- a/src/daemon/https/tests.h +++ b/src/daemon/https/tests.h | |||
@@ -3,40 +3,40 @@ typedef enum | |||
3 | TEST_SUCCEED, TEST_FAILED, TEST_UNSURE, TEST_IGNORE | 3 | TEST_SUCCEED, TEST_FAILED, TEST_UNSURE, TEST_IGNORE |
4 | } test_code_t; | 4 | } test_code_t; |
5 | 5 | ||
6 | test_code_t test_srp (gnutls_session_t state); | 6 | test_code_t test_srp (mhd_gtls_session_t state); |
7 | test_code_t test_server (gnutls_session_t state); | 7 | test_code_t test_server (mhd_gtls_session_t state); |
8 | test_code_t test_export (gnutls_session_t state); | 8 | test_code_t test_export (mhd_gtls_session_t state); |
9 | test_code_t test_export_info (gnutls_session_t state); | 9 | test_code_t test_export_info (mhd_gtls_session_t state); |
10 | test_code_t test_hello_extension (gnutls_session_t state); | 10 | test_code_t test_hello_extension (mhd_gtls_session_t state); |
11 | test_code_t test_dhe (gnutls_session_t state); | 11 | test_code_t test_dhe (mhd_gtls_session_t state); |
12 | test_code_t test_dhe_group (gnutls_session_t state); | 12 | test_code_t test_dhe_group (mhd_gtls_session_t state); |
13 | test_code_t test_ssl3 (gnutls_session_t state); | 13 | test_code_t test_ssl3 (mhd_gtls_session_t state); |
14 | test_code_t test_aes (gnutls_session_t state); | 14 | test_code_t test_aes (mhd_gtls_session_t state); |
15 | #ifdef ENABLE_CAMELLIA | 15 | #ifdef ENABLE_CAMELLIA |
16 | test_code_t test_camellia (gnutls_session_t state); | 16 | test_code_t test_camellia (mhd_gtls_session_t state); |
17 | #endif | 17 | #endif |
18 | test_code_t test_md5 (gnutls_session_t state); | 18 | test_code_t test_md5 (mhd_gtls_session_t state); |
19 | test_code_t test_sha (gnutls_session_t state); | 19 | test_code_t test_sha (mhd_gtls_session_t state); |
20 | test_code_t test_3des (gnutls_session_t state); | 20 | test_code_t test_3des (mhd_gtls_session_t state); |
21 | test_code_t test_arcfour (gnutls_session_t state); | 21 | test_code_t test_arcfour (mhd_gtls_session_t state); |
22 | test_code_t test_arcfour_40 (gnutls_session_t state); | 22 | test_code_t test_arcfour_40 (mhd_gtls_session_t state); |
23 | test_code_t test_tls1 (gnutls_session_t state); | 23 | test_code_t test_tls1 (mhd_gtls_session_t state); |
24 | test_code_t test_tls1_1 (gnutls_session_t state); | 24 | test_code_t test_tls1_1 (mhd_gtls_session_t state); |
25 | test_code_t test_tls1_1_fallback (gnutls_session_t state); | 25 | test_code_t test_tls1_1_fallback (mhd_gtls_session_t state); |
26 | test_code_t test_tls_disable (gnutls_session_t state); | 26 | test_code_t test_tls_disable (mhd_gtls_session_t state); |
27 | test_code_t test_rsa_pms (gnutls_session_t state); | 27 | test_code_t test_rsa_pms (mhd_gtls_session_t state); |
28 | test_code_t test_max_record_size (gnutls_session_t state); | 28 | test_code_t test_max_record_size (mhd_gtls_session_t state); |
29 | test_code_t test_version_rollback (gnutls_session_t state); | 29 | test_code_t test_version_rollback (mhd_gtls_session_t state); |
30 | test_code_t test_anonymous (gnutls_session_t state); | 30 | test_code_t test_anonymous (mhd_gtls_session_t state); |
31 | test_code_t test_unknown_ciphersuites (gnutls_session_t state); | 31 | test_code_t test_unknown_ciphersuites (mhd_gtls_session_t state); |
32 | test_code_t test_openpgp1 (gnutls_session_t state); | 32 | test_code_t test_openpgp1 (mhd_gtls_session_t state); |
33 | test_code_t test_bye (gnutls_session_t state); | 33 | test_code_t test_bye (mhd_gtls_session_t state); |
34 | test_code_t test_certificate (gnutls_session_t state); | 34 | test_code_t test_certificate (mhd_gtls_session_t state); |
35 | test_code_t test_server_cas (gnutls_session_t state); | 35 | test_code_t test_server_cas (mhd_gtls_session_t state); |
36 | test_code_t test_session_resume2 (gnutls_session_t state); | 36 | test_code_t test_session_resume2 (mhd_gtls_session_t state); |
37 | test_code_t test_rsa_pms_version_check (gnutls_session_t session); | 37 | test_code_t test_rsa_pms_version_check (mhd_gtls_session_t session); |
38 | test_code_t test_version_oob (gnutls_session_t session); | 38 | test_code_t test_version_oob (mhd_gtls_session_t session); |
39 | test_code_t test_zlib (gnutls_session_t session); | 39 | test_code_t test_zlib (mhd_gtls_session_t session); |
40 | test_code_t test_lzo (gnutls_session_t session); | 40 | test_code_t test_lzo (mhd_gtls_session_t session); |
41 | int _test_srp_username_callback (gnutls_session_t session, | 41 | int _test_srp_username_callback (mhd_gtls_session_t session, |
42 | char **username, char **password); | 42 | char **username, char **password); |
diff --git a/src/daemon/https/tls/auth_anon.c b/src/daemon/https/tls/auth_anon.c index d32ef344..ae6346c3 100644 --- a/src/daemon/https/tls/auth_anon.c +++ b/src/daemon/https/tls/auth_anon.c | |||
@@ -40,38 +40,38 @@ | |||
40 | #include <gnutls_state.h> | 40 | #include <gnutls_state.h> |
41 | #include <auth_dh_common.h> | 41 | #include <auth_dh_common.h> |
42 | 42 | ||
43 | static int gen_anon_server_kx (gnutls_session_t, opaque **); | 43 | static int gen_anon_server_kx (mhd_gtls_session_t, opaque **); |
44 | static int proc_anon_client_kx (gnutls_session_t, opaque *, size_t); | 44 | static int proc_anon_client_kx (mhd_gtls_session_t, opaque *, size_t); |
45 | static int proc_anon_server_kx (gnutls_session_t, opaque *, size_t); | 45 | static int mhd_gtls_proc_anon_server_kx (mhd_gtls_session_t, opaque *, size_t); |
46 | 46 | ||
47 | const mod_auth_st anon_auth_struct = { | 47 | const mhd_gtls_mod_auth_st anon_auth_struct = { |
48 | "ANON", | 48 | "ANON", |
49 | NULL, | 49 | NULL, |
50 | NULL, | 50 | NULL, |
51 | gen_anon_server_kx, | 51 | gen_anon_server_kx, |
52 | _gnutls_gen_dh_common_client_kx, /* this can be shared */ | 52 | mhd_gtls_gen_dh_common_client_kx, /* this can be shared */ |
53 | NULL, | 53 | NULL, |
54 | NULL, | 54 | NULL, |
55 | 55 | ||
56 | NULL, | 56 | NULL, |
57 | NULL, /* certificate */ | 57 | NULL, /* certificate */ |
58 | proc_anon_server_kx, | 58 | mhd_gtls_proc_anon_server_kx, |
59 | proc_anon_client_kx, | 59 | proc_anon_client_kx, |
60 | NULL, | 60 | NULL, |
61 | NULL | 61 | NULL |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static int | 64 | static int |
65 | gen_anon_server_kx (gnutls_session_t session, opaque ** data) | 65 | gen_anon_server_kx (mhd_gtls_session_t session, opaque ** data) |
66 | { | 66 | { |
67 | mpi_t g, p; | 67 | mpi_t g, p; |
68 | const mpi_t *mpis; | 68 | const mpi_t *mpis; |
69 | int ret; | 69 | int ret; |
70 | gnutls_dh_params_t dh_params; | 70 | mhd_gtls_dh_params_t dh_params; |
71 | gnutls_anon_server_credentials_t cred; | 71 | mhd_gtls_anon_server_credentials_t cred; |
72 | 72 | ||
73 | cred = (gnutls_anon_server_credentials_t) | 73 | cred = (mhd_gtls_anon_server_credentials_t) |
74 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_ANON, NULL); | 74 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_ANON, NULL); |
75 | if (cred == NULL) | 75 | if (cred == NULL) |
76 | { | 76 | { |
77 | gnutls_assert (); | 77 | gnutls_assert (); |
@@ -79,8 +79,8 @@ gen_anon_server_kx (gnutls_session_t session, opaque ** data) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | dh_params = | 81 | dh_params = |
82 | _gnutls_get_dh_params (cred->dh_params, cred->params_func, session); | 82 | mhd_gtls_get_dh_params (cred->dh_params, cred->params_func, session); |
83 | mpis = _gnutls_dh_params_to_mpi (dh_params); | 83 | mpis = mhd_gtls_dh_params_to_mpi (dh_params); |
84 | if (mpis == NULL) | 84 | if (mpis == NULL) |
85 | { | 85 | { |
86 | gnutls_assert (); | 86 | gnutls_assert (); |
@@ -91,16 +91,16 @@ gen_anon_server_kx (gnutls_session_t session, opaque ** data) | |||
91 | g = mpis[1]; | 91 | g = mpis[1]; |
92 | 92 | ||
93 | if ((ret = | 93 | if ((ret = |
94 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_ANON, | 94 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_ANON, |
95 | sizeof (anon_auth_info_st), 1)) < 0) | 95 | sizeof (anon_auth_info_st), 1)) < 0) |
96 | { | 96 | { |
97 | gnutls_assert (); | 97 | gnutls_assert (); |
98 | return ret; | 98 | return ret; |
99 | } | 99 | } |
100 | 100 | ||
101 | _gnutls_dh_set_group (session, g, p); | 101 | mhd_gtls_dh_set_group (session, g, p); |
102 | 102 | ||
103 | ret = _gnutls_dh_common_print_server_kx (session, g, p, data, 0); | 103 | ret = mhd_gtls_dh_common_print_server_kx (session, g, p, data, 0); |
104 | if (ret < 0) | 104 | if (ret < 0) |
105 | { | 105 | { |
106 | gnutls_assert (); | 106 | gnutls_assert (); |
@@ -111,20 +111,20 @@ gen_anon_server_kx (gnutls_session_t session, opaque ** data) | |||
111 | 111 | ||
112 | 112 | ||
113 | static int | 113 | static int |
114 | proc_anon_client_kx (gnutls_session_t session, opaque * data, | 114 | proc_anon_client_kx (mhd_gtls_session_t session, opaque * data, |
115 | size_t _data_size) | 115 | size_t _data_size) |
116 | { | 116 | { |
117 | gnutls_anon_server_credentials_t cred; | 117 | mhd_gtls_anon_server_credentials_t cred; |
118 | int bits; | 118 | int bits; |
119 | int ret; | 119 | int ret; |
120 | mpi_t p, g; | 120 | mpi_t p, g; |
121 | gnutls_dh_params_t dh_params; | 121 | mhd_gtls_dh_params_t dh_params; |
122 | const mpi_t *mpis; | 122 | const mpi_t *mpis; |
123 | 123 | ||
124 | bits = _gnutls_dh_get_allowed_prime_bits (session); | 124 | bits = mhd_gtls_dh_get_allowed_prime_bits (session); |
125 | 125 | ||
126 | cred = (gnutls_anon_server_credentials_t) | 126 | cred = (mhd_gtls_anon_server_credentials_t) |
127 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_ANON, NULL); | 127 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_ANON, NULL); |
128 | if (cred == NULL) | 128 | if (cred == NULL) |
129 | { | 129 | { |
130 | gnutls_assert (); | 130 | gnutls_assert (); |
@@ -132,8 +132,8 @@ proc_anon_client_kx (gnutls_session_t session, opaque * data, | |||
132 | } | 132 | } |
133 | 133 | ||
134 | dh_params = | 134 | dh_params = |
135 | _gnutls_get_dh_params (cred->dh_params, cred->params_func, session); | 135 | mhd_gtls_get_dh_params (cred->dh_params, cred->params_func, session); |
136 | mpis = _gnutls_dh_params_to_mpi (dh_params); | 136 | mpis = mhd_gtls_dh_params_to_mpi (dh_params); |
137 | if (mpis == NULL) | 137 | if (mpis == NULL) |
138 | { | 138 | { |
139 | gnutls_assert (); | 139 | gnutls_assert (); |
@@ -143,14 +143,14 @@ proc_anon_client_kx (gnutls_session_t session, opaque * data, | |||
143 | p = mpis[0]; | 143 | p = mpis[0]; |
144 | g = mpis[1]; | 144 | g = mpis[1]; |
145 | 145 | ||
146 | ret = _gnutls_proc_dh_common_client_kx (session, data, _data_size, g, p); | 146 | ret = mhd_gtls_proc_dh_common_client_kx (session, data, _data_size, g, p); |
147 | 147 | ||
148 | return ret; | 148 | return ret; |
149 | 149 | ||
150 | } | 150 | } |
151 | 151 | ||
152 | int | 152 | int |
153 | proc_anon_server_kx (gnutls_session_t session, opaque * data, | 153 | mhd_gtls_proc_anon_server_kx (mhd_gtls_session_t session, opaque * data, |
154 | size_t _data_size) | 154 | size_t _data_size) |
155 | { | 155 | { |
156 | 156 | ||
@@ -158,14 +158,14 @@ proc_anon_server_kx (gnutls_session_t session, opaque * data, | |||
158 | 158 | ||
159 | /* set auth_info */ | 159 | /* set auth_info */ |
160 | if ((ret = | 160 | if ((ret = |
161 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_ANON, | 161 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_ANON, |
162 | sizeof (anon_auth_info_st), 1)) < 0) | 162 | sizeof (anon_auth_info_st), 1)) < 0) |
163 | { | 163 | { |
164 | gnutls_assert (); | 164 | gnutls_assert (); |
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
167 | 167 | ||
168 | ret = _gnutls_proc_dh_common_server_kx (session, data, _data_size, 0); | 168 | ret = mhd_gtls_proc_dh_common_server_kx (session, data, _data_size, 0); |
169 | if (ret < 0) | 169 | if (ret < 0) |
170 | { | 170 | { |
171 | gnutls_assert (); | 171 | gnutls_assert (); |
diff --git a/src/daemon/https/tls/auth_anon.h b/src/daemon/https/tls/auth_anon.h index b1705f85..631dd595 100644 --- a/src/daemon/https/tls/auth_anon.h +++ b/src/daemon/https/tls/auth_anon.h | |||
@@ -26,23 +26,23 @@ | |||
26 | #include <gnutls_auth.h> | 26 | #include <gnutls_auth.h> |
27 | #include <auth_dh_common.h> | 27 | #include <auth_dh_common.h> |
28 | 28 | ||
29 | typedef struct gnutls_anon_server_credentials_st | 29 | typedef struct mhd_gtls_anon_server_credentials_st |
30 | { | 30 | { |
31 | gnutls_dh_params_t dh_params; | 31 | mhd_gtls_dh_params_t dh_params; |
32 | /* this callback is used to retrieve the DH or RSA | 32 | /* this callback is used to retrieve the DH or RSA |
33 | * parameters. | 33 | * parameters. |
34 | */ | 34 | */ |
35 | gnutls_params_function *params_func; | 35 | gnutls_params_function *params_func; |
36 | } anon_server_credentials_st; | 36 | } mhd_anon_server_credentials_st; |
37 | 37 | ||
38 | typedef struct gnutls_anon_client_credentials_st | 38 | typedef struct mhd_gtls_anon_client_credentials_st |
39 | { | 39 | { |
40 | int dummy; | 40 | int dummy; |
41 | } anon_client_credentials_st; | 41 | } mhd_anon_client_credentials_st; |
42 | 42 | ||
43 | typedef struct anon_auth_info_st | 43 | typedef struct mhd_gtls_anon_auth_info_st |
44 | { | 44 | { |
45 | dh_info_st dh; | 45 | dh_info_st dh; |
46 | } *anon_auth_info_t; | 46 | } * mhd_anon_auth_info_t; |
47 | 47 | ||
48 | typedef struct anon_auth_info_st anon_auth_info_st; | 48 | typedef struct mhd_gtls_anon_auth_info_st anon_auth_info_st; |
diff --git a/src/daemon/https/tls/auth_cert.c b/src/daemon/https/tls/auth_cert.c index c5c5d9f5..7fea2569 100644 --- a/src/daemon/https/tls/auth_cert.c +++ b/src/daemon/https/tls/auth_cert.c | |||
@@ -187,7 +187,7 @@ _gnutls_cert_get_issuer_dn (gnutls_cert * cert, gnutls_datum_t * odn) | |||
187 | * CAs and sign algorithms supported by the peer server. | 187 | * CAs and sign algorithms supported by the peer server. |
188 | */ | 188 | */ |
189 | static int | 189 | static int |
190 | _find_x509_cert (const gnutls_certificate_credentials_t cred, | 190 | _find_x509_cert (const mhd_gtls_cert_credentials_t cred, |
191 | opaque * _data, size_t _data_size, | 191 | opaque * _data, size_t _data_size, |
192 | const gnutls_pk_algorithm_t * pk_algos, | 192 | const gnutls_pk_algorithm_t * pk_algos, |
193 | int pk_algos_length, int *indx) | 193 | int pk_algos_length, int *indx) |
@@ -205,7 +205,7 @@ _find_x509_cert (const gnutls_certificate_credentials_t cred, | |||
205 | { | 205 | { |
206 | 206 | ||
207 | DECR_LENGTH_RET (data_size, 2, 0); | 207 | DECR_LENGTH_RET (data_size, 2, 0); |
208 | size = _gnutls_read_uint16 (data); | 208 | size = mhd_gtls_read_uint16 (data); |
209 | DECR_LENGTH_RET (data_size, size, 0); | 209 | DECR_LENGTH_RET (data_size, size, 0); |
210 | data += 2; | 210 | data += 2; |
211 | 211 | ||
@@ -258,7 +258,7 @@ _find_x509_cert (const gnutls_certificate_credentials_t cred, | |||
258 | /* Locates the most appropriate openpgp cert | 258 | /* Locates the most appropriate openpgp cert |
259 | */ | 259 | */ |
260 | static int | 260 | static int |
261 | _find_openpgp_cert (const gnutls_certificate_credentials_t cred, | 261 | _find_openpgp_cert (const mhd_gtls_cert_credentials_t cred, |
262 | gnutls_pk_algorithm_t * pk_algos, | 262 | gnutls_pk_algorithm_t * pk_algos, |
263 | int pk_algos_length, int *indx) | 263 | int pk_algos_length, int *indx) |
264 | { | 264 | { |
@@ -294,7 +294,7 @@ _find_openpgp_cert (const gnutls_certificate_credentials_t cred, | |||
294 | * certificate request packet. | 294 | * certificate request packet. |
295 | */ | 295 | */ |
296 | static int | 296 | static int |
297 | get_issuers_num (gnutls_session_t session, opaque * data, ssize_t data_size) | 297 | get_issuers_num (mhd_gtls_session_t session, opaque * data, ssize_t data_size) |
298 | { | 298 | { |
299 | int issuers_dn_len = 0, result; | 299 | int issuers_dn_len = 0, result; |
300 | unsigned size; | 300 | unsigned size; |
@@ -314,7 +314,7 @@ get_issuers_num (gnutls_session_t session, opaque * data, ssize_t data_size) | |||
314 | */ | 314 | */ |
315 | result = GNUTLS_E_UNEXPECTED_PACKET_LENGTH; | 315 | result = GNUTLS_E_UNEXPECTED_PACKET_LENGTH; |
316 | DECR_LENGTH_COM (data_size, 2, goto error); | 316 | DECR_LENGTH_COM (data_size, 2, goto error); |
317 | size = _gnutls_read_uint16 (data); | 317 | size = mhd_gtls_read_uint16 (data); |
318 | 318 | ||
319 | result = GNUTLS_E_UNEXPECTED_PACKET_LENGTH; | 319 | result = GNUTLS_E_UNEXPECTED_PACKET_LENGTH; |
320 | DECR_LENGTH_COM (data_size, size, goto error); | 320 | DECR_LENGTH_COM (data_size, size, goto error); |
@@ -343,7 +343,7 @@ error: | |||
343 | * packet. | 343 | * packet. |
344 | */ | 344 | */ |
345 | static int | 345 | static int |
346 | get_issuers (gnutls_session_t session, | 346 | get_issuers (mhd_gtls_session_t session, |
347 | gnutls_datum_t * issuers_dn, int issuers_len, | 347 | gnutls_datum_t * issuers_dn, int issuers_len, |
348 | opaque * data, size_t data_size) | 348 | opaque * data, size_t data_size) |
349 | { | 349 | { |
@@ -367,7 +367,7 @@ get_issuers (gnutls_session_t session, | |||
367 | */ | 367 | */ |
368 | data_size -= 2; | 368 | data_size -= 2; |
369 | 369 | ||
370 | size = _gnutls_read_uint16 (data); | 370 | size = mhd_gtls_read_uint16 (data); |
371 | 371 | ||
372 | data += 2; | 372 | data += 2; |
373 | 373 | ||
@@ -384,7 +384,7 @@ get_issuers (gnutls_session_t session, | |||
384 | /* Calls the client get callback. | 384 | /* Calls the client get callback. |
385 | */ | 385 | */ |
386 | static int | 386 | static int |
387 | call_get_cert_callback (gnutls_session_t session, | 387 | call_get_cert_callback (mhd_gtls_session_t session, |
388 | gnutls_datum_t * issuers_dn, | 388 | gnutls_datum_t * issuers_dn, |
389 | int issuers_dn_length, | 389 | int issuers_dn_length, |
390 | gnutls_pk_algorithm_t * pk_algos, int pk_algos_length) | 390 | gnutls_pk_algorithm_t * pk_algos, int pk_algos_length) |
@@ -395,10 +395,10 @@ call_get_cert_callback (gnutls_session_t session, | |||
395 | gnutls_retr_st st; | 395 | gnutls_retr_st st; |
396 | int ret; | 396 | int ret; |
397 | gnutls_certificate_type_t type = gnutls_certificate_type_get (session); | 397 | gnutls_certificate_type_t type = gnutls_certificate_type_get (session); |
398 | gnutls_certificate_credentials_t cred; | 398 | mhd_gtls_cert_credentials_t cred; |
399 | 399 | ||
400 | cred = (gnutls_certificate_credentials_t) | 400 | cred = (mhd_gtls_cert_credentials_t) |
401 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 401 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
402 | if (cred == NULL) | 402 | if (cred == NULL) |
403 | { | 403 | { |
404 | gnutls_assert (); | 404 | gnutls_assert (); |
@@ -457,7 +457,7 @@ call_get_cert_callback (gnutls_session_t session, | |||
457 | 457 | ||
458 | } | 458 | } |
459 | 459 | ||
460 | _gnutls_selected_certs_set (session, local_certs, | 460 | mhd_gtls_selected_certs_set (session, local_certs, |
461 | (local_certs != NULL) ? st.ncerts : 0, | 461 | (local_certs != NULL) ? st.ncerts : 0, |
462 | local_key, 1); | 462 | local_key, 1); |
463 | 463 | ||
@@ -504,20 +504,20 @@ cleanup: | |||
504 | * algorithm (only in automatic mode). | 504 | * algorithm (only in automatic mode). |
505 | */ | 505 | */ |
506 | static int | 506 | static int |
507 | _select_client_cert (gnutls_session_t session, | 507 | _select_client_cert (mhd_gtls_session_t session, |
508 | opaque * _data, size_t _data_size, | 508 | opaque * _data, size_t _data_size, |
509 | gnutls_pk_algorithm_t * pk_algos, int pk_algos_length) | 509 | gnutls_pk_algorithm_t * pk_algos, int pk_algos_length) |
510 | { | 510 | { |
511 | int result; | 511 | int result; |
512 | int indx = -1; | 512 | int indx = -1; |
513 | gnutls_certificate_credentials_t cred; | 513 | mhd_gtls_cert_credentials_t cred; |
514 | opaque *data = _data; | 514 | opaque *data = _data; |
515 | ssize_t data_size = _data_size; | 515 | ssize_t data_size = _data_size; |
516 | int issuers_dn_length; | 516 | int issuers_dn_length; |
517 | gnutls_datum_t *issuers_dn = NULL; | 517 | gnutls_datum_t *issuers_dn = NULL; |
518 | 518 | ||
519 | cred = (gnutls_certificate_credentials_t) | 519 | cred = (mhd_gtls_cert_credentials_t) |
520 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 520 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
521 | if (cred == NULL) | 521 | if (cred == NULL) |
522 | { | 522 | { |
523 | gnutls_assert (); | 523 | gnutls_assert (); |
@@ -590,14 +590,14 @@ _select_client_cert (gnutls_session_t session, | |||
590 | 590 | ||
591 | if (indx >= 0) | 591 | if (indx >= 0) |
592 | { | 592 | { |
593 | _gnutls_selected_certs_set (session, | 593 | mhd_gtls_selected_certs_set (session, |
594 | &cred->cert_list[indx][0], | 594 | &cred->cert_list[indx][0], |
595 | cred->cert_list_length[indx], | 595 | cred->cert_list_length[indx], |
596 | &cred->pkey[indx], 0); | 596 | &cred->pkey[indx], 0); |
597 | } | 597 | } |
598 | else | 598 | else |
599 | { | 599 | { |
600 | _gnutls_selected_certs_set (session, NULL, 0, NULL, 0); | 600 | mhd_gtls_selected_certs_set (session, NULL, 0, NULL, 0); |
601 | } | 601 | } |
602 | 602 | ||
603 | result = 0; | 603 | result = 0; |
@@ -613,7 +613,7 @@ cleanup: | |||
613 | */ | 613 | */ |
614 | 614 | ||
615 | int | 615 | int |
616 | _gnutls_gen_x509_crt (gnutls_session_t session, opaque ** data) | 616 | _gnutls_gen_x509_crt (mhd_gtls_session_t session, opaque ** data) |
617 | { | 617 | { |
618 | int ret, i; | 618 | int ret, i; |
619 | opaque *pdata; | 619 | opaque *pdata; |
@@ -624,7 +624,7 @@ _gnutls_gen_x509_crt (gnutls_session_t session, opaque ** data) | |||
624 | /* find the appropriate certificate | 624 | /* find the appropriate certificate |
625 | */ | 625 | */ |
626 | if ((ret = | 626 | if ((ret = |
627 | _gnutls_get_selected_cert (session, &apr_cert_list, | 627 | mhd_gtls_get_selected_cert (session, &apr_cert_list, |
628 | &apr_cert_list_length, &apr_pkey)) < 0) | 628 | &apr_cert_list_length, &apr_pkey)) < 0) |
629 | { | 629 | { |
630 | gnutls_assert (); | 630 | gnutls_assert (); |
@@ -656,11 +656,11 @@ _gnutls_gen_x509_crt (gnutls_session_t session, opaque ** data) | |||
656 | gnutls_assert (); | 656 | gnutls_assert (); |
657 | return GNUTLS_E_MEMORY_ERROR; | 657 | return GNUTLS_E_MEMORY_ERROR; |
658 | } | 658 | } |
659 | _gnutls_write_uint24 (ret - 3, pdata); | 659 | mhd_gtls_write_uint24 (ret - 3, pdata); |
660 | pdata += 3; | 660 | pdata += 3; |
661 | for (i = 0; i < apr_cert_list_length; i++) | 661 | for (i = 0; i < apr_cert_list_length; i++) |
662 | { | 662 | { |
663 | _gnutls_write_datum24 (pdata, apr_cert_list[i].raw); | 663 | mhd_gtls_write_datum24 (pdata, apr_cert_list[i].raw); |
664 | pdata += (3 + apr_cert_list[i].raw.size); | 664 | pdata += (3 + apr_cert_list[i].raw.size); |
665 | } | 665 | } |
666 | 666 | ||
@@ -671,7 +671,7 @@ enum PGPKeyDescriptorType | |||
671 | { PGP_KEY_FINGERPRINT, PGP_KEY }; | 671 | { PGP_KEY_FINGERPRINT, PGP_KEY }; |
672 | 672 | ||
673 | int | 673 | int |
674 | _gnutls_gen_openpgp_certificate (gnutls_session_t session, opaque ** data) | 674 | _gnutls_gen_openpgp_certificate (mhd_gtls_session_t session, opaque ** data) |
675 | { | 675 | { |
676 | int ret; | 676 | int ret; |
677 | opaque *pdata; | 677 | opaque *pdata; |
@@ -681,7 +681,7 @@ _gnutls_gen_openpgp_certificate (gnutls_session_t session, opaque ** data) | |||
681 | 681 | ||
682 | /* find the appropriate certificate */ | 682 | /* find the appropriate certificate */ |
683 | if ((ret = | 683 | if ((ret = |
684 | _gnutls_get_selected_cert (session, &apr_cert_list, | 684 | mhd_gtls_get_selected_cert (session, &apr_cert_list, |
685 | &apr_cert_list_length, &apr_pkey)) < 0) | 685 | &apr_cert_list_length, &apr_pkey)) < 0) |
686 | { | 686 | { |
687 | gnutls_assert (); | 687 | gnutls_assert (); |
@@ -702,7 +702,7 @@ _gnutls_gen_openpgp_certificate (gnutls_session_t session, opaque ** data) | |||
702 | return GNUTLS_E_MEMORY_ERROR; | 702 | return GNUTLS_E_MEMORY_ERROR; |
703 | } | 703 | } |
704 | 704 | ||
705 | _gnutls_write_uint24 (ret - 3, pdata); | 705 | mhd_gtls_write_uint24 (ret - 3, pdata); |
706 | pdata += 3; | 706 | pdata += 3; |
707 | 707 | ||
708 | *pdata = PGP_KEY; /* whole key */ | 708 | *pdata = PGP_KEY; /* whole key */ |
@@ -710,17 +710,17 @@ _gnutls_gen_openpgp_certificate (gnutls_session_t session, opaque ** data) | |||
710 | 710 | ||
711 | if (apr_cert_list_length > 0) | 711 | if (apr_cert_list_length > 0) |
712 | { | 712 | { |
713 | _gnutls_write_datum24 (pdata, apr_cert_list[0].raw); | 713 | mhd_gtls_write_datum24 (pdata, apr_cert_list[0].raw); |
714 | pdata += (3 + apr_cert_list[0].raw.size); | 714 | pdata += (3 + apr_cert_list[0].raw.size); |
715 | } | 715 | } |
716 | else /* empty - no certificate */ | 716 | else /* empty - no certificate */ |
717 | _gnutls_write_uint24 (0, pdata); | 717 | mhd_gtls_write_uint24 (0, pdata); |
718 | 718 | ||
719 | return ret; | 719 | return ret; |
720 | } | 720 | } |
721 | 721 | ||
722 | int | 722 | int |
723 | _gnutls_gen_openpgp_certificate_fpr (gnutls_session_t session, opaque ** data) | 723 | _gnutls_gen_openpgp_certificate_fpr (mhd_gtls_session_t session, opaque ** data) |
724 | { | 724 | { |
725 | int ret, packet_size; | 725 | int ret, packet_size; |
726 | size_t fpr_size; | 726 | size_t fpr_size; |
@@ -731,7 +731,7 @@ _gnutls_gen_openpgp_certificate_fpr (gnutls_session_t session, opaque ** data) | |||
731 | 731 | ||
732 | /* find the appropriate certificate */ | 732 | /* find the appropriate certificate */ |
733 | if ((ret = | 733 | if ((ret = |
734 | _gnutls_get_selected_cert (session, &apr_cert_list, | 734 | mhd_gtls_get_selected_cert (session, &apr_cert_list, |
735 | &apr_cert_list_length, &apr_pkey)) < 0) | 735 | &apr_cert_list_length, &apr_pkey)) < 0) |
736 | { | 736 | { |
737 | gnutls_assert (); | 737 | gnutls_assert (); |
@@ -756,7 +756,7 @@ _gnutls_gen_openpgp_certificate_fpr (gnutls_session_t session, opaque ** data) | |||
756 | return GNUTLS_E_MEMORY_ERROR; | 756 | return GNUTLS_E_MEMORY_ERROR; |
757 | } | 757 | } |
758 | 758 | ||
759 | _gnutls_write_uint24 (packet_size - 3, pdata); | 759 | mhd_gtls_write_uint24 (packet_size - 3, pdata); |
760 | pdata += 3; | 760 | pdata += 3; |
761 | 761 | ||
762 | *pdata = PGP_KEY_FINGERPRINT; /* key fingerprint */ | 762 | *pdata = PGP_KEY_FINGERPRINT; /* key fingerprint */ |
@@ -787,12 +787,12 @@ _gnutls_gen_openpgp_certificate_fpr (gnutls_session_t session, opaque ** data) | |||
787 | 787 | ||
788 | 788 | ||
789 | int | 789 | int |
790 | _gnutls_gen_cert_client_certificate (gnutls_session_t session, opaque ** data) | 790 | mhd_gtls_gen_cert_client_certificate (mhd_gtls_session_t session, opaque ** data) |
791 | { | 791 | { |
792 | switch (session->security_parameters.cert_type) | 792 | switch (session->security_parameters.cert_type) |
793 | { | 793 | { |
794 | case MHD_GNUTLS_CRT_OPENPGP: | 794 | case MHD_GNUTLS_CRT_OPENPGP: |
795 | if (_gnutls_openpgp_send_fingerprint (session) == 0) | 795 | if (mhd_gtls_openpgp_send_fingerprint (session) == 0) |
796 | return _gnutls_gen_openpgp_certificate (session, data); | 796 | return _gnutls_gen_openpgp_certificate (session, data); |
797 | else | 797 | else |
798 | return _gnutls_gen_openpgp_certificate_fpr (session, data); | 798 | return _gnutls_gen_openpgp_certificate_fpr (session, data); |
@@ -807,7 +807,7 @@ _gnutls_gen_cert_client_certificate (gnutls_session_t session, opaque ** data) | |||
807 | } | 807 | } |
808 | 808 | ||
809 | int | 809 | int |
810 | _gnutls_gen_cert_server_certificate (gnutls_session_t session, opaque ** data) | 810 | mhd_gtls_gen_cert_server_certificate (mhd_gtls_session_t session, opaque ** data) |
811 | { | 811 | { |
812 | switch (session->security_parameters.cert_type) | 812 | switch (session->security_parameters.cert_type) |
813 | { | 813 | { |
@@ -824,23 +824,23 @@ _gnutls_gen_cert_server_certificate (gnutls_session_t session, opaque ** data) | |||
824 | /* Process server certificate | 824 | /* Process server certificate |
825 | */ | 825 | */ |
826 | 826 | ||
827 | #define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) _gnutls_gcert_deinit(&peer_certificate_list[x]) | 827 | #define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) mhd_gtls_gcert_deinit(&peer_certificate_list[x]) |
828 | int | 828 | int |
829 | _gnutls_proc_x509_server_certificate (gnutls_session_t session, | 829 | _gnutls_proc_x509_server_certificate (mhd_gtls_session_t session, |
830 | opaque * data, size_t data_size) | 830 | opaque * data, size_t data_size) |
831 | { | 831 | { |
832 | int size, len, ret; | 832 | int size, len, ret; |
833 | opaque *p = data; | 833 | opaque *p = data; |
834 | cert_auth_info_t info; | 834 | cert_auth_info_t info; |
835 | gnutls_certificate_credentials_t cred; | 835 | mhd_gtls_cert_credentials_t cred; |
836 | ssize_t dsize = data_size; | 836 | ssize_t dsize = data_size; |
837 | int i, j, x; | 837 | int i, j, x; |
838 | gnutls_cert *peer_certificate_list; | 838 | gnutls_cert *peer_certificate_list; |
839 | int peer_certificate_list_size = 0; | 839 | int peer_certificate_list_size = 0; |
840 | gnutls_datum_t tmp; | 840 | gnutls_datum_t tmp; |
841 | 841 | ||
842 | cred = (gnutls_certificate_credentials_t) | 842 | cred = (mhd_gtls_cert_credentials_t) |
843 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 843 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
844 | if (cred == NULL) | 844 | if (cred == NULL) |
845 | { | 845 | { |
846 | gnutls_assert (); | 846 | gnutls_assert (); |
@@ -849,14 +849,14 @@ _gnutls_proc_x509_server_certificate (gnutls_session_t session, | |||
849 | 849 | ||
850 | 850 | ||
851 | if ((ret = | 851 | if ((ret = |
852 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, | 852 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, |
853 | sizeof (cert_auth_info_st), 1)) < 0) | 853 | sizeof (cert_auth_info_st), 1)) < 0) |
854 | { | 854 | { |
855 | gnutls_assert (); | 855 | gnutls_assert (); |
856 | return ret; | 856 | return ret; |
857 | } | 857 | } |
858 | 858 | ||
859 | info = _gnutls_get_auth_info (session); | 859 | info = mhd_gtls_get_auth_info (session); |
860 | 860 | ||
861 | if (data == NULL || data_size == 0) | 861 | if (data == NULL || data_size == 0) |
862 | { | 862 | { |
@@ -866,7 +866,7 @@ _gnutls_proc_x509_server_certificate (gnutls_session_t session, | |||
866 | } | 866 | } |
867 | 867 | ||
868 | DECR_LEN (dsize, 3); | 868 | DECR_LEN (dsize, 3); |
869 | size = _gnutls_read_uint24 (p); | 869 | size = mhd_gtls_read_uint24 (p); |
870 | p += 3; | 870 | p += 3; |
871 | 871 | ||
872 | /* some implementations send 0B 00 00 06 00 00 03 00 00 00 | 872 | /* some implementations send 0B 00 00 06 00 00 03 00 00 00 |
@@ -883,7 +883,7 @@ _gnutls_proc_x509_server_certificate (gnutls_session_t session, | |||
883 | while (i > 0) | 883 | while (i > 0) |
884 | { | 884 | { |
885 | DECR_LEN (dsize, 3); | 885 | DECR_LEN (dsize, 3); |
886 | len = _gnutls_read_uint24 (p); | 886 | len = mhd_gtls_read_uint24 (p); |
887 | p += 3; | 887 | p += 3; |
888 | DECR_LEN (dsize, len); | 888 | DECR_LEN (dsize, len); |
889 | peer_certificate_list_size++; | 889 | peer_certificate_list_size++; |
@@ -921,14 +921,14 @@ _gnutls_proc_x509_server_certificate (gnutls_session_t session, | |||
921 | 921 | ||
922 | for (j = 0; j < peer_certificate_list_size; j++) | 922 | for (j = 0; j < peer_certificate_list_size; j++) |
923 | { | 923 | { |
924 | len = _gnutls_read_uint24 (p); | 924 | len = mhd_gtls_read_uint24 (p); |
925 | p += 3; | 925 | p += 3; |
926 | 926 | ||
927 | tmp.size = len; | 927 | tmp.size = len; |
928 | tmp.data = p; | 928 | tmp.data = p; |
929 | 929 | ||
930 | if ((ret = | 930 | if ((ret = |
931 | _gnutls_x509_raw_cert_to_gcert (&peer_certificate_list | 931 | mhd_gtls_x509_raw_cert_to_gcert (&peer_certificate_list |
932 | [j], &tmp, | 932 | [j], &tmp, |
933 | CERT_ONLY_EXTENSIONS)) < 0) | 933 | CERT_ONLY_EXTENSIONS)) < 0) |
934 | { | 934 | { |
@@ -966,23 +966,23 @@ cleanup: | |||
966 | 966 | ||
967 | } | 967 | } |
968 | 968 | ||
969 | #define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) _gnutls_gcert_deinit(&peer_certificate_list[x]) | 969 | #define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) mhd_gtls_gcert_deinit(&peer_certificate_list[x]) |
970 | int | 970 | int |
971 | _gnutls_proc_openpgp_server_certificate (gnutls_session_t session, | 971 | _gnutls_proc_openpgp_server_certificate (mhd_gtls_session_t session, |
972 | opaque * data, size_t data_size) | 972 | opaque * data, size_t data_size) |
973 | { | 973 | { |
974 | int size, ret, len; | 974 | int size, ret, len; |
975 | opaque *p = data; | 975 | opaque *p = data; |
976 | cert_auth_info_t info; | 976 | cert_auth_info_t info; |
977 | gnutls_certificate_credentials_t cred; | 977 | mhd_gtls_cert_credentials_t cred; |
978 | ssize_t dsize = data_size; | 978 | ssize_t dsize = data_size; |
979 | int i, x; | 979 | int i, x; |
980 | gnutls_cert *peer_certificate_list = NULL; | 980 | gnutls_cert *peer_certificate_list = NULL; |
981 | int peer_certificate_list_size = 0; | 981 | int peer_certificate_list_size = 0; |
982 | gnutls_datum_t tmp, akey = { NULL, 0 }; | 982 | gnutls_datum_t tmp, akey = { NULL, 0 }; |
983 | 983 | ||
984 | cred = (gnutls_certificate_credentials_t) | 984 | cred = (mhd_gtls_cert_credentials_t) |
985 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 985 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
986 | if (cred == NULL) | 986 | if (cred == NULL) |
987 | { | 987 | { |
988 | gnutls_assert (); | 988 | gnutls_assert (); |
@@ -990,14 +990,14 @@ _gnutls_proc_openpgp_server_certificate (gnutls_session_t session, | |||
990 | } | 990 | } |
991 | 991 | ||
992 | if ((ret = | 992 | if ((ret = |
993 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, | 993 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, |
994 | sizeof (cert_auth_info_st), 1)) < 0) | 994 | sizeof (cert_auth_info_st), 1)) < 0) |
995 | { | 995 | { |
996 | gnutls_assert (); | 996 | gnutls_assert (); |
997 | return ret; | 997 | return ret; |
998 | } | 998 | } |
999 | 999 | ||
1000 | info = _gnutls_get_auth_info (session); | 1000 | info = mhd_gtls_get_auth_info (session); |
1001 | 1001 | ||
1002 | if (data == NULL || data_size == 0) | 1002 | if (data == NULL || data_size == 0) |
1003 | { | 1003 | { |
@@ -1006,7 +1006,7 @@ _gnutls_proc_openpgp_server_certificate (gnutls_session_t session, | |||
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | DECR_LEN (dsize, 3); | 1008 | DECR_LEN (dsize, 3); |
1009 | size = _gnutls_read_uint24 (p); | 1009 | size = mhd_gtls_read_uint24 (p); |
1010 | p += 3; | 1010 | p += 3; |
1011 | 1011 | ||
1012 | if (size == 0) | 1012 | if (size == 0) |
@@ -1060,7 +1060,7 @@ _gnutls_proc_openpgp_server_certificate (gnutls_session_t session, | |||
1060 | 1060 | ||
1061 | /* Read the actual certificate */ | 1061 | /* Read the actual certificate */ |
1062 | DECR_LEN (dsize, 3); | 1062 | DECR_LEN (dsize, 3); |
1063 | len = _gnutls_read_uint24 (p); | 1063 | len = mhd_gtls_read_uint24 (p); |
1064 | p += 3; | 1064 | p += 3; |
1065 | 1065 | ||
1066 | if (len == 0) | 1066 | if (len == 0) |
@@ -1147,7 +1147,7 @@ cleanup: | |||
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | int | 1149 | int |
1150 | _gnutls_proc_cert_server_certificate (gnutls_session_t session, | 1150 | mhd_gtls_proc_cert_server_certificate (mhd_gtls_session_t session, |
1151 | opaque * data, size_t data_size) | 1151 | opaque * data, size_t data_size) |
1152 | { | 1152 | { |
1153 | switch (session->security_parameters.cert_type) | 1153 | switch (session->security_parameters.cert_type) |
@@ -1185,21 +1185,21 @@ _gnutls_check_supported_sign_algo (CertificateSigType algo) | |||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | int | 1187 | int |
1188 | _gnutls_proc_cert_cert_req (gnutls_session_t session, opaque * data, | 1188 | mhd_gtls_proc_cert_cert_req (mhd_gtls_session_t session, opaque * data, |
1189 | size_t data_size) | 1189 | size_t data_size) |
1190 | { | 1190 | { |
1191 | int size, ret; | 1191 | int size, ret; |
1192 | opaque *p; | 1192 | opaque *p; |
1193 | gnutls_certificate_credentials_t cred; | 1193 | mhd_gtls_cert_credentials_t cred; |
1194 | cert_auth_info_t info; | 1194 | cert_auth_info_t info; |
1195 | ssize_t dsize; | 1195 | ssize_t dsize; |
1196 | int i, j; | 1196 | int i, j; |
1197 | gnutls_pk_algorithm_t pk_algos[MAX_SIGN_ALGOS]; | 1197 | gnutls_pk_algorithm_t pk_algos[MAX_SIGN_ALGOS]; |
1198 | int pk_algos_length; | 1198 | int pk_algos_length; |
1199 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 1199 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
1200 | 1200 | ||
1201 | cred = (gnutls_certificate_credentials_t) | 1201 | cred = (mhd_gtls_cert_credentials_t) |
1202 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 1202 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
1203 | if (cred == NULL) | 1203 | if (cred == NULL) |
1204 | { | 1204 | { |
1205 | gnutls_assert (); | 1205 | gnutls_assert (); |
@@ -1207,14 +1207,14 @@ _gnutls_proc_cert_cert_req (gnutls_session_t session, opaque * data, | |||
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | if ((ret = | 1209 | if ((ret = |
1210 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, | 1210 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, |
1211 | sizeof (cert_auth_info_st), 0)) < 0) | 1211 | sizeof (cert_auth_info_st), 0)) < 0) |
1212 | { | 1212 | { |
1213 | gnutls_assert (); | 1213 | gnutls_assert (); |
1214 | return ret; | 1214 | return ret; |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | info = _gnutls_get_auth_info (session); | 1217 | info = mhd_gtls_get_auth_info (session); |
1218 | 1218 | ||
1219 | p = data; | 1219 | p = data; |
1220 | dsize = data_size; | 1220 | dsize = data_size; |
@@ -1259,7 +1259,7 @@ _gnutls_proc_cert_cert_req (gnutls_session_t session, opaque * data, | |||
1259 | 1259 | ||
1260 | /* read the certificate authorities */ | 1260 | /* read the certificate authorities */ |
1261 | DECR_LEN (dsize, 2); | 1261 | DECR_LEN (dsize, 2); |
1262 | size = _gnutls_read_uint16 (p); | 1262 | size = mhd_gtls_read_uint16 (p); |
1263 | p += 2; | 1263 | p += 2; |
1264 | 1264 | ||
1265 | if (session->security_parameters.cert_type == MHD_GNUTLS_CRT_OPENPGP | 1265 | if (session->security_parameters.cert_type == MHD_GNUTLS_CRT_OPENPGP |
@@ -1290,7 +1290,7 @@ _gnutls_proc_cert_cert_req (gnutls_session_t session, opaque * data, | |||
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | int | 1292 | int |
1293 | _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, opaque ** data) | 1293 | mhd_gtls_gen_cert_client_cert_vrfy (mhd_gtls_session_t session, opaque ** data) |
1294 | { | 1294 | { |
1295 | int ret; | 1295 | int ret; |
1296 | gnutls_cert *apr_cert_list; | 1296 | gnutls_cert *apr_cert_list; |
@@ -1302,7 +1302,7 @@ _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, opaque ** data) | |||
1302 | 1302 | ||
1303 | /* find the appropriate certificate */ | 1303 | /* find the appropriate certificate */ |
1304 | if ((ret = | 1304 | if ((ret = |
1305 | _gnutls_get_selected_cert (session, &apr_cert_list, | 1305 | mhd_gtls_get_selected_cert (session, &apr_cert_list, |
1306 | &apr_cert_list_length, &apr_pkey)) < 0) | 1306 | &apr_cert_list_length, &apr_pkey)) < 0) |
1307 | { | 1307 | { |
1308 | gnutls_assert (); | 1308 | gnutls_assert (); |
@@ -1312,7 +1312,7 @@ _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, opaque ** data) | |||
1312 | if (apr_cert_list_length > 0) | 1312 | if (apr_cert_list_length > 0) |
1313 | { | 1313 | { |
1314 | if ((ret = | 1314 | if ((ret = |
1315 | _gnutls_tls_sign_hdata (session, | 1315 | mhd_gtls_tls_sign_hdata (session, |
1316 | &apr_cert_list[0], | 1316 | &apr_cert_list[0], |
1317 | apr_pkey, &signature)) < 0) | 1317 | apr_pkey, &signature)) < 0) |
1318 | { | 1318 | { |
@@ -1332,7 +1332,7 @@ _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, opaque ** data) | |||
1332 | return GNUTLS_E_MEMORY_ERROR; | 1332 | return GNUTLS_E_MEMORY_ERROR; |
1333 | } | 1333 | } |
1334 | size = signature.size; | 1334 | size = signature.size; |
1335 | _gnutls_write_uint16 (size, *data); | 1335 | mhd_gtls_write_uint16 (size, *data); |
1336 | 1336 | ||
1337 | memcpy (&(*data)[2], signature.data, size); | 1337 | memcpy (&(*data)[2], signature.data, size); |
1338 | 1338 | ||
@@ -1342,14 +1342,14 @@ _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, opaque ** data) | |||
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | int | 1344 | int |
1345 | _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t session, | 1345 | mhd_gtls_proc_cert_client_cert_vrfy (mhd_gtls_session_t session, |
1346 | opaque * data, size_t data_size) | 1346 | opaque * data, size_t data_size) |
1347 | { | 1347 | { |
1348 | int size, ret; | 1348 | int size, ret; |
1349 | ssize_t dsize = data_size; | 1349 | ssize_t dsize = data_size; |
1350 | opaque *pdata = data; | 1350 | opaque *pdata = data; |
1351 | gnutls_datum_t sig; | 1351 | gnutls_datum_t sig; |
1352 | cert_auth_info_t info = _gnutls_get_auth_info (session); | 1352 | cert_auth_info_t info = mhd_gtls_get_auth_info (session); |
1353 | gnutls_cert peer_cert; | 1353 | gnutls_cert peer_cert; |
1354 | 1354 | ||
1355 | if (info == NULL || info->ncerts == 0) | 1355 | if (info == NULL || info->ncerts == 0) |
@@ -1360,7 +1360,7 @@ _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t session, | |||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | DECR_LEN (dsize, 2); | 1362 | DECR_LEN (dsize, 2); |
1363 | size = _gnutls_read_uint16 (pdata); | 1363 | size = mhd_gtls_read_uint16 (pdata); |
1364 | pdata += 2; | 1364 | pdata += 2; |
1365 | 1365 | ||
1366 | DECR_LEN (dsize, size); | 1366 | DECR_LEN (dsize, size); |
@@ -1368,7 +1368,7 @@ _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t session, | |||
1368 | sig.data = pdata; | 1368 | sig.data = pdata; |
1369 | sig.size = size; | 1369 | sig.size = size; |
1370 | 1370 | ||
1371 | ret = _gnutls_raw_cert_to_gcert (&peer_cert, | 1371 | ret = mhd_gtls_raw_cert_to_gcert (&peer_cert, |
1372 | session->security_parameters.cert_type, | 1372 | session->security_parameters.cert_type, |
1373 | &info->raw_certificate_list[0], | 1373 | &info->raw_certificate_list[0], |
1374 | CERT_NO_COPY); | 1374 | CERT_NO_COPY); |
@@ -1379,33 +1379,33 @@ _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t session, | |||
1379 | return ret; | 1379 | return ret; |
1380 | } | 1380 | } |
1381 | 1381 | ||
1382 | if ((ret = _gnutls_verify_sig_hdata (session, &peer_cert, &sig)) < 0) | 1382 | if ((ret = mhd_gtls_verify_sig_hdata (session, &peer_cert, &sig)) < 0) |
1383 | { | 1383 | { |
1384 | gnutls_assert (); | 1384 | gnutls_assert (); |
1385 | _gnutls_gcert_deinit (&peer_cert); | 1385 | mhd_gtls_gcert_deinit (&peer_cert); |
1386 | return ret; | 1386 | return ret; |
1387 | } | 1387 | } |
1388 | _gnutls_gcert_deinit (&peer_cert); | 1388 | mhd_gtls_gcert_deinit (&peer_cert); |
1389 | 1389 | ||
1390 | return 0; | 1390 | return 0; |
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | #define CERTTYPE_SIZE 3 | 1393 | #define CERTTYPE_SIZE 3 |
1394 | int | 1394 | int |
1395 | _gnutls_gen_cert_server_cert_req (gnutls_session_t session, opaque ** data) | 1395 | mhd_gtls_gen_cert_server_cert_req (mhd_gtls_session_t session, opaque ** data) |
1396 | { | 1396 | { |
1397 | gnutls_certificate_credentials_t cred; | 1397 | mhd_gtls_cert_credentials_t cred; |
1398 | int size; | 1398 | int size; |
1399 | opaque *pdata; | 1399 | opaque *pdata; |
1400 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 1400 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
1401 | 1401 | ||
1402 | /* Now we need to generate the RDN sequence. This is | 1402 | /* Now we need to generate the RDN sequence. This is |
1403 | * already in the CERTIFICATE_CRED structure, to improve | 1403 | * already in the CERTIFICATE_CRED structure, to improve |
1404 | * performance. | 1404 | * performance. |
1405 | */ | 1405 | */ |
1406 | 1406 | ||
1407 | cred = (gnutls_certificate_credentials_t) | 1407 | cred = (mhd_gtls_cert_credentials_t) |
1408 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 1408 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
1409 | if (cred == NULL) | 1409 | if (cred == NULL) |
1410 | { | 1410 | { |
1411 | gnutls_assert (); | 1411 | gnutls_assert (); |
@@ -1449,12 +1449,12 @@ _gnutls_gen_cert_server_cert_req (gnutls_session_t session, opaque ** data) | |||
1449 | if (session->security_parameters.cert_type == MHD_GNUTLS_CRT_X509 && | 1449 | if (session->security_parameters.cert_type == MHD_GNUTLS_CRT_X509 && |
1450 | session->internals.ignore_rdn_sequence == 0) | 1450 | session->internals.ignore_rdn_sequence == 0) |
1451 | { | 1451 | { |
1452 | _gnutls_write_datum16 (pdata, cred->x509_rdn_sequence); | 1452 | mhd_gtls_write_datum16 (pdata, cred->x509_rdn_sequence); |
1453 | /* pdata += cred->x509_rdn_sequence.size + 2; */ | 1453 | /* pdata += cred->x509_rdn_sequence.size + 2; */ |
1454 | } | 1454 | } |
1455 | else | 1455 | else |
1456 | { | 1456 | { |
1457 | _gnutls_write_uint16 (0, pdata); | 1457 | mhd_gtls_write_uint16 (0, pdata); |
1458 | /* pdata+=2; */ | 1458 | /* pdata+=2; */ |
1459 | } | 1459 | } |
1460 | 1460 | ||
@@ -1470,7 +1470,7 @@ _gnutls_gen_cert_server_cert_req (gnutls_session_t session, opaque ** data) | |||
1470 | * | 1470 | * |
1471 | */ | 1471 | */ |
1472 | int | 1472 | int |
1473 | _gnutls_get_selected_cert (gnutls_session_t session, | 1473 | mhd_gtls_get_selected_cert (mhd_gtls_session_t session, |
1474 | gnutls_cert ** apr_cert_list, | 1474 | gnutls_cert ** apr_cert_list, |
1475 | int *apr_cert_list_length, | 1475 | int *apr_cert_list_length, |
1476 | gnutls_privkey ** apr_pkey) | 1476 | gnutls_privkey ** apr_pkey) |
@@ -1530,7 +1530,7 @@ alloc_and_load_x509_certs (gnutls_x509_crt_t * certs, unsigned ncerts) | |||
1530 | 1530 | ||
1531 | for (i = 0; i < ncerts; i++) | 1531 | for (i = 0; i < ncerts; i++) |
1532 | { | 1532 | { |
1533 | ret = _gnutls_x509_crt_to_gcert (&local_certs[i], certs[i], 0); | 1533 | ret = mhd_gtls_x509_crt_to_gcert (&local_certs[i], certs[i], 0); |
1534 | if (ret < 0) | 1534 | if (ret < 0) |
1535 | break; | 1535 | break; |
1536 | } | 1536 | } |
@@ -1540,7 +1540,7 @@ alloc_and_load_x509_certs (gnutls_x509_crt_t * certs, unsigned ncerts) | |||
1540 | gnutls_assert (); | 1540 | gnutls_assert (); |
1541 | for (j = 0; j < i; j++) | 1541 | for (j = 0; j < i; j++) |
1542 | { | 1542 | { |
1543 | _gnutls_gcert_deinit (&local_certs[j]); | 1543 | mhd_gtls_gcert_deinit (&local_certs[j]); |
1544 | } | 1544 | } |
1545 | gnutls_free (local_certs); | 1545 | gnutls_free (local_certs); |
1546 | return NULL; | 1546 | return NULL; |
@@ -1613,7 +1613,7 @@ alloc_and_load_pgp_certs (gnutls_openpgp_crt_t cert) | |||
1613 | if (ret < 0) | 1613 | if (ret < 0) |
1614 | { | 1614 | { |
1615 | gnutls_assert (); | 1615 | gnutls_assert (); |
1616 | _gnutls_gcert_deinit (local_certs); | 1616 | mhd_gtls_gcert_deinit (local_certs); |
1617 | gnutls_free (local_certs); | 1617 | gnutls_free (local_certs); |
1618 | return NULL; | 1618 | return NULL; |
1619 | } | 1619 | } |
@@ -1658,7 +1658,7 @@ alloc_and_load_pgp_key (const gnutls_openpgp_privkey_t key) | |||
1658 | 1658 | ||
1659 | 1659 | ||
1660 | void | 1660 | void |
1661 | _gnutls_selected_certs_deinit (gnutls_session_t session) | 1661 | mhd_gtls_selected_certs_deinit (mhd_gtls_session_t session) |
1662 | { | 1662 | { |
1663 | if (session->internals.selected_need_free != 0) | 1663 | if (session->internals.selected_need_free != 0) |
1664 | { | 1664 | { |
@@ -1666,13 +1666,13 @@ _gnutls_selected_certs_deinit (gnutls_session_t session) | |||
1666 | 1666 | ||
1667 | for (i = 0; i < session->internals.selected_cert_list_length; i++) | 1667 | for (i = 0; i < session->internals.selected_cert_list_length; i++) |
1668 | { | 1668 | { |
1669 | _gnutls_gcert_deinit (&session->internals.selected_cert_list[i]); | 1669 | mhd_gtls_gcert_deinit (&session->internals.selected_cert_list[i]); |
1670 | } | 1670 | } |
1671 | gnutls_free (session->internals.selected_cert_list); | 1671 | gnutls_free (session->internals.selected_cert_list); |
1672 | session->internals.selected_cert_list = NULL; | 1672 | session->internals.selected_cert_list = NULL; |
1673 | session->internals.selected_cert_list_length = 0; | 1673 | session->internals.selected_cert_list_length = 0; |
1674 | 1674 | ||
1675 | _gnutls_gkey_deinit (session->internals.selected_key); | 1675 | mhd_gtls_gkey_deinit (session->internals.selected_key); |
1676 | if (session->internals.selected_key) | 1676 | if (session->internals.selected_key) |
1677 | { | 1677 | { |
1678 | gnutls_free (session->internals.selected_key); | 1678 | gnutls_free (session->internals.selected_key); |
@@ -1684,11 +1684,11 @@ _gnutls_selected_certs_deinit (gnutls_session_t session) | |||
1684 | } | 1684 | } |
1685 | 1685 | ||
1686 | void | 1686 | void |
1687 | _gnutls_selected_certs_set (gnutls_session_t session, | 1687 | mhd_gtls_selected_certs_set (mhd_gtls_session_t session, |
1688 | gnutls_cert * certs, int ncerts, | 1688 | gnutls_cert * certs, int ncerts, |
1689 | gnutls_privkey * key, int need_free) | 1689 | gnutls_privkey * key, int need_free) |
1690 | { | 1690 | { |
1691 | _gnutls_selected_certs_deinit (session); | 1691 | mhd_gtls_selected_certs_deinit (session); |
1692 | 1692 | ||
1693 | session->internals.selected_cert_list = certs; | 1693 | session->internals.selected_cert_list = certs; |
1694 | session->internals.selected_cert_list_length = ncerts; | 1694 | session->internals.selected_cert_list_length = ncerts; |
@@ -1709,15 +1709,15 @@ _gnutls_selected_certs_set (gnutls_session_t session, | |||
1709 | * | 1709 | * |
1710 | */ | 1710 | */ |
1711 | int | 1711 | int |
1712 | _gnutls_server_select_cert (gnutls_session_t session, | 1712 | mhd_gtls_server_select_cert (mhd_gtls_session_t session, |
1713 | gnutls_pk_algorithm_t requested_algo) | 1713 | gnutls_pk_algorithm_t requested_algo) |
1714 | { | 1714 | { |
1715 | unsigned i; | 1715 | unsigned i; |
1716 | int idx, ret; | 1716 | int idx, ret; |
1717 | gnutls_certificate_credentials_t cred; | 1717 | mhd_gtls_cert_credentials_t cred; |
1718 | 1718 | ||
1719 | cred = (gnutls_certificate_credentials_t) | 1719 | cred = (mhd_gtls_cert_credentials_t) |
1720 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 1720 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
1721 | if (cred == NULL) | 1721 | if (cred == NULL) |
1722 | { | 1722 | { |
1723 | gnutls_assert (); | 1723 | gnutls_assert (); |
@@ -1759,7 +1759,7 @@ _gnutls_server_select_cert (gnutls_session_t session, | |||
1759 | */ | 1759 | */ |
1760 | if (idx >= 0 && ret == 0) | 1760 | if (idx >= 0 && ret == 0) |
1761 | { | 1761 | { |
1762 | _gnutls_selected_certs_set (session, | 1762 | mhd_gtls_selected_certs_set (session, |
1763 | &cred->cert_list[idx][0], | 1763 | &cred->cert_list[idx][0], |
1764 | cred->cert_list_length[idx], | 1764 | cred->cert_list_length[idx], |
1765 | &cred->pkey[idx], 0); | 1765 | &cred->pkey[idx], 0); |
@@ -1771,10 +1771,10 @@ _gnutls_server_select_cert (gnutls_session_t session, | |||
1771 | return ret; | 1771 | return ret; |
1772 | } | 1772 | } |
1773 | 1773 | ||
1774 | /* Frees the rsa_info_st structure. | 1774 | /* Frees the mhd_gtls_rsa_info_st structure. |
1775 | */ | 1775 | */ |
1776 | void | 1776 | void |
1777 | _gnutls_free_rsa_info (rsa_info_st * rsa) | 1777 | mhd_gtls_free_rsa_info (rsa_info_st * rsa) |
1778 | { | 1778 | { |
1779 | _gnutls_free_datum (&rsa->modulus); | 1779 | _gnutls_free_datum (&rsa->modulus); |
1780 | _gnutls_free_datum (&rsa->exponent); | 1780 | _gnutls_free_datum (&rsa->exponent); |
diff --git a/src/daemon/https/tls/auth_cert.h b/src/daemon/https/tls/auth_cert.h index e49a6089..979a698a 100644 --- a/src/daemon/https/tls/auth_cert.h +++ b/src/daemon/https/tls/auth_cert.h | |||
@@ -35,10 +35,10 @@ | |||
35 | * support a server that has multiple certificates | 35 | * support a server that has multiple certificates |
36 | */ | 36 | */ |
37 | 37 | ||
38 | typedef struct gnutls_certificate_credentials_st | 38 | typedef struct mhd_gtls_certificate_credentials_st |
39 | { | 39 | { |
40 | gnutls_dh_params_t dh_params; | 40 | mhd_gtls_dh_params_t dh_params; |
41 | gnutls_rsa_params_t rsa_params; | 41 | mhd_gtls_rsa_params_t rsa_params; |
42 | /* this callback is used to retrieve the DH or RSA | 42 | /* this callback is used to retrieve the DH or RSA |
43 | * parameters. | 43 | * parameters. |
44 | */ | 44 | */ |
@@ -100,13 +100,13 @@ typedef struct gnutls_certificate_credentials_st | |||
100 | gnutls_certificate_server_retrieve_function *server_get_cert_callback; | 100 | gnutls_certificate_server_retrieve_function *server_get_cert_callback; |
101 | } certificate_credentials_st; | 101 | } certificate_credentials_st; |
102 | 102 | ||
103 | typedef struct rsa_info_st | 103 | typedef struct mhd_gtls_rsa_info_st |
104 | { | 104 | { |
105 | gnutls_datum_t modulus; | 105 | gnutls_datum_t modulus; |
106 | gnutls_datum_t exponent; | 106 | gnutls_datum_t exponent; |
107 | } rsa_info_st; | 107 | } rsa_info_st; |
108 | 108 | ||
109 | typedef struct cert_auth_info_st | 109 | typedef struct mhd_gtls_cert_auth_info_st |
110 | { | 110 | { |
111 | int certificate_requested; /* if the peer requested certificate | 111 | int certificate_requested; /* if the peer requested certificate |
112 | * this is non zero; | 112 | * this is non zero; |
@@ -124,36 +124,36 @@ typedef struct cert_auth_info_st | |||
124 | unsigned int ncerts; /* holds the size of the list above */ | 124 | unsigned int ncerts; /* holds the size of the list above */ |
125 | } *cert_auth_info_t; | 125 | } *cert_auth_info_t; |
126 | 126 | ||
127 | typedef struct cert_auth_info_st cert_auth_info_st; | 127 | typedef struct mhd_gtls_cert_auth_info_st cert_auth_info_st; |
128 | 128 | ||
129 | void _gnutls_free_rsa_info (rsa_info_st * rsa); | 129 | void mhd_gtls_free_rsa_info (rsa_info_st * rsa); |
130 | 130 | ||
131 | /* AUTH X509 functions */ | 131 | /* AUTH X509 functions */ |
132 | int _gnutls_gen_cert_server_certificate (gnutls_session_t, opaque **); | 132 | int mhd_gtls_gen_cert_server_certificate (mhd_gtls_session_t, opaque **); |
133 | int _gnutls_gen_cert_client_certificate (gnutls_session_t, opaque **); | 133 | int mhd_gtls_gen_cert_client_certificate (mhd_gtls_session_t, opaque **); |
134 | int _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t, opaque **); | 134 | int mhd_gtls_gen_cert_client_cert_vrfy (mhd_gtls_session_t, opaque **); |
135 | int _gnutls_gen_cert_server_cert_req (gnutls_session_t, opaque **); | 135 | int mhd_gtls_gen_cert_server_cert_req (mhd_gtls_session_t, opaque **); |
136 | int _gnutls_proc_cert_cert_req (gnutls_session_t, opaque *, size_t); | 136 | int mhd_gtls_proc_cert_cert_req (mhd_gtls_session_t, opaque *, size_t); |
137 | int _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t, opaque *, size_t); | 137 | int mhd_gtls_proc_cert_client_cert_vrfy (mhd_gtls_session_t, opaque *, size_t); |
138 | int _gnutls_proc_cert_server_certificate (gnutls_session_t, opaque *, size_t); | 138 | int mhd_gtls_proc_cert_server_certificate (mhd_gtls_session_t, opaque *, size_t); |
139 | int _gnutls_get_selected_cert (gnutls_session_t session, | 139 | int mhd_gtls_get_selected_cert (mhd_gtls_session_t session, |
140 | gnutls_cert ** apr_cert_list, | 140 | gnutls_cert ** apr_cert_list, |
141 | int *apr_cert_list_length, | 141 | int *apr_cert_list_length, |
142 | gnutls_privkey ** apr_pkey); | 142 | gnutls_privkey ** apr_pkey); |
143 | 143 | ||
144 | int _gnutls_server_select_cert (struct gnutls_session_int *, | 144 | int mhd_gtls_server_select_cert (struct MHD_gtls_session_int *, |
145 | gnutls_pk_algorithm_t); | 145 | gnutls_pk_algorithm_t); |
146 | void _gnutls_selected_certs_deinit (gnutls_session_t session); | 146 | void mhd_gtls_selected_certs_deinit (mhd_gtls_session_t session); |
147 | void _gnutls_selected_certs_set (gnutls_session_t session, | 147 | void mhd_gtls_selected_certs_set (mhd_gtls_session_t session, |
148 | gnutls_cert * certs, int ncerts, | 148 | gnutls_cert * certs, int ncerts, |
149 | gnutls_privkey * key, int need_free); | 149 | gnutls_privkey * key, int need_free); |
150 | 150 | ||
151 | #define _gnutls_proc_cert_client_certificate _gnutls_proc_cert_server_certificate | 151 | #define _gnutls_proc_cert_client_certificate mhd_gtls_proc_cert_server_certificate |
152 | 152 | ||
153 | gnutls_rsa_params_t _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t | 153 | mhd_gtls_rsa_params_t mhd_gtls_certificate_get_rsa_params (mhd_gtls_rsa_params_t |
154 | rsa_params, | 154 | rsa_params, |
155 | gnutls_params_function | 155 | gnutls_params_function |
156 | * func, | 156 | * func, |
157 | gnutls_session_t); | 157 | mhd_gtls_session_t); |
158 | 158 | ||
159 | #endif | 159 | #endif |
diff --git a/src/daemon/https/tls/auth_dh_common.c b/src/daemon/https/tls/auth_dh_common.c index f6354cb6..13e7987b 100644 --- a/src/daemon/https/tls/auth_dh_common.c +++ b/src/daemon/https/tls/auth_dh_common.c | |||
@@ -42,7 +42,7 @@ | |||
42 | /* Frees the dh_info_st structure. | 42 | /* Frees the dh_info_st structure. |
43 | */ | 43 | */ |
44 | void | 44 | void |
45 | _gnutls_free_dh_info (dh_info_st * dh) | 45 | mhd_gtls_free_dh_info (dh_info_st * dh) |
46 | { | 46 | { |
47 | dh->secret_bits = 0; | 47 | dh->secret_bits = 0; |
48 | _gnutls_free_datum (&dh->prime); | 48 | _gnutls_free_datum (&dh->prime); |
@@ -51,7 +51,7 @@ _gnutls_free_dh_info (dh_info_st * dh) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | int | 53 | int |
54 | _gnutls_proc_dh_common_client_kx (gnutls_session_t session, | 54 | mhd_gtls_proc_dh_common_client_kx (mhd_gtls_session_t session, |
55 | opaque * data, size_t _data_size, | 55 | opaque * data, size_t _data_size, |
56 | mpi_t g, mpi_t p) | 56 | mpi_t g, mpi_t p) |
57 | { | 57 | { |
@@ -62,20 +62,20 @@ _gnutls_proc_dh_common_client_kx (gnutls_session_t session, | |||
62 | 62 | ||
63 | 63 | ||
64 | DECR_LEN (data_size, 2); | 64 | DECR_LEN (data_size, 2); |
65 | n_Y = _gnutls_read_uint16 (&data[0]); | 65 | n_Y = mhd_gtls_read_uint16 (&data[0]); |
66 | _n_Y = n_Y; | 66 | _n_Y = n_Y; |
67 | 67 | ||
68 | DECR_LEN (data_size, n_Y); | 68 | DECR_LEN (data_size, n_Y); |
69 | if (_gnutls_mpi_scan_nz (&session->key->client_Y, &data[2], &_n_Y)) | 69 | if (mhd_gtls_mpi_scan_nz (&session->key->client_Y, &data[2], &_n_Y)) |
70 | { | 70 | { |
71 | gnutls_assert (); | 71 | gnutls_assert (); |
72 | return GNUTLS_E_MPI_SCAN_FAILED; | 72 | return GNUTLS_E_MPI_SCAN_FAILED; |
73 | } | 73 | } |
74 | 74 | ||
75 | _gnutls_dh_set_peer_public (session, session->key->client_Y); | 75 | mhd_gtls_dh_set_peer_public (session, session->key->client_Y); |
76 | 76 | ||
77 | session->key->KEY = | 77 | session->key->KEY = |
78 | gnutls_calc_dh_key (session->key->client_Y, session->key->dh_secret, p); | 78 | mhd_gtls_calc_dh_key (session->key->client_Y, session->key->dh_secret, p); |
79 | 79 | ||
80 | if (session->key->KEY == NULL) | 80 | if (session->key->KEY == NULL) |
81 | { | 81 | { |
@@ -83,12 +83,12 @@ _gnutls_proc_dh_common_client_kx (gnutls_session_t session, | |||
83 | return GNUTLS_E_MEMORY_ERROR; | 83 | return GNUTLS_E_MEMORY_ERROR; |
84 | } | 84 | } |
85 | 85 | ||
86 | _gnutls_mpi_release (&session->key->client_Y); | 86 | mhd_gtls_mpi_release (&session->key->client_Y); |
87 | _gnutls_mpi_release (&session->key->dh_secret); | 87 | mhd_gtls_mpi_release (&session->key->dh_secret); |
88 | 88 | ||
89 | ret = _gnutls_mpi_dprint (&session->key->key, session->key->KEY); | 89 | ret = mhd_gtls_mpi_dprint (&session->key->key, session->key->KEY); |
90 | 90 | ||
91 | _gnutls_mpi_release (&session->key->KEY); | 91 | mhd_gtls_mpi_release (&session->key->KEY); |
92 | 92 | ||
93 | if (ret < 0) | 93 | if (ret < 0) |
94 | { | 94 | { |
@@ -99,7 +99,7 @@ _gnutls_proc_dh_common_client_kx (gnutls_session_t session, | |||
99 | } | 99 | } |
100 | 100 | ||
101 | int | 101 | int |
102 | _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) | 102 | mhd_gtls_gen_dh_common_client_kx (mhd_gtls_session_t session, opaque ** data) |
103 | { | 103 | { |
104 | mpi_t x = NULL, X = NULL; | 104 | mpi_t x = NULL, X = NULL; |
105 | size_t n_X; | 105 | size_t n_X; |
@@ -107,7 +107,7 @@ _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) | |||
107 | 107 | ||
108 | *data = NULL; | 108 | *data = NULL; |
109 | 109 | ||
110 | X = gnutls_calc_dh_secret (&x, session->key->client_g, | 110 | X = mhd_gtls_calc_dh_secret (&x, session->key->client_g, |
111 | session->key->client_p); | 111 | session->key->client_p); |
112 | if (X == NULL || x == NULL) | 112 | if (X == NULL || x == NULL) |
113 | { | 113 | { |
@@ -116,9 +116,9 @@ _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) | |||
116 | goto error; | 116 | goto error; |
117 | } | 117 | } |
118 | 118 | ||
119 | _gnutls_dh_set_secret_bits (session, _gnutls_mpi_get_nbits (x)); | 119 | mhd_gtls_dh_set_secret_bits (session, _gnutls_mpi_get_nbits (x)); |
120 | 120 | ||
121 | _gnutls_mpi_print (NULL, &n_X, X); | 121 | mhd_gtls_mpi_print (NULL, &n_X, X); |
122 | (*data) = gnutls_malloc (n_X + 2); | 122 | (*data) = gnutls_malloc (n_X + 2); |
123 | if (*data == NULL) | 123 | if (*data == NULL) |
124 | { | 124 | { |
@@ -126,16 +126,16 @@ _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) | |||
126 | goto error; | 126 | goto error; |
127 | } | 127 | } |
128 | 128 | ||
129 | _gnutls_mpi_print (&(*data)[2], &n_X, X); | 129 | mhd_gtls_mpi_print (&(*data)[2], &n_X, X); |
130 | _gnutls_mpi_release (&X); | 130 | mhd_gtls_mpi_release (&X); |
131 | 131 | ||
132 | _gnutls_write_uint16 (n_X, &(*data)[0]); | 132 | mhd_gtls_write_uint16 (n_X, &(*data)[0]); |
133 | 133 | ||
134 | /* calculate the key after calculating the message */ | 134 | /* calculate the key after calculating the message */ |
135 | session->key->KEY = | 135 | session->key->KEY = |
136 | gnutls_calc_dh_key (session->key->client_Y, x, session->key->client_p); | 136 | mhd_gtls_calc_dh_key (session->key->client_Y, x, session->key->client_p); |
137 | 137 | ||
138 | _gnutls_mpi_release (&x); | 138 | mhd_gtls_mpi_release (&x); |
139 | if (session->key->KEY == NULL) | 139 | if (session->key->KEY == NULL) |
140 | { | 140 | { |
141 | gnutls_assert (); | 141 | gnutls_assert (); |
@@ -144,13 +144,13 @@ _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* THESE SHOULD BE DISCARDED */ | 146 | /* THESE SHOULD BE DISCARDED */ |
147 | _gnutls_mpi_release (&session->key->client_Y); | 147 | mhd_gtls_mpi_release (&session->key->client_Y); |
148 | _gnutls_mpi_release (&session->key->client_p); | 148 | mhd_gtls_mpi_release (&session->key->client_p); |
149 | _gnutls_mpi_release (&session->key->client_g); | 149 | mhd_gtls_mpi_release (&session->key->client_g); |
150 | 150 | ||
151 | ret = _gnutls_mpi_dprint (&session->key->key, session->key->KEY); | 151 | ret = mhd_gtls_mpi_dprint (&session->key->key, session->key->KEY); |
152 | 152 | ||
153 | _gnutls_mpi_release (&session->key->KEY); | 153 | mhd_gtls_mpi_release (&session->key->KEY); |
154 | 154 | ||
155 | if (ret < 0) | 155 | if (ret < 0) |
156 | { | 156 | { |
@@ -161,15 +161,15 @@ _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) | |||
161 | return n_X + 2; | 161 | return n_X + 2; |
162 | 162 | ||
163 | error: | 163 | error: |
164 | _gnutls_mpi_release (&x); | 164 | mhd_gtls_mpi_release (&x); |
165 | _gnutls_mpi_release (&X); | 165 | mhd_gtls_mpi_release (&X); |
166 | gnutls_free (*data); | 166 | gnutls_free (*data); |
167 | *data = NULL; | 167 | *data = NULL; |
168 | return ret; | 168 | return ret; |
169 | } | 169 | } |
170 | 170 | ||
171 | int | 171 | int |
172 | _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | 172 | mhd_gtls_proc_dh_common_server_kx (mhd_gtls_session_t session, |
173 | opaque * data, size_t _data_size, int psk) | 173 | opaque * data, size_t _data_size, int psk) |
174 | { | 174 | { |
175 | uint16_t n_Y, n_g, n_p; | 175 | uint16_t n_Y, n_g, n_p; |
@@ -185,13 +185,13 @@ _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | |||
185 | if (psk != 0) | 185 | if (psk != 0) |
186 | { | 186 | { |
187 | DECR_LEN (data_size, 2); | 187 | DECR_LEN (data_size, 2); |
188 | psk_size = _gnutls_read_uint16 (&data[i]); | 188 | psk_size = mhd_gtls_read_uint16 (&data[i]); |
189 | DECR_LEN (data_size, psk_size); | 189 | DECR_LEN (data_size, psk_size); |
190 | i += 2 + psk_size; | 190 | i += 2 + psk_size; |
191 | } | 191 | } |
192 | 192 | ||
193 | DECR_LEN (data_size, 2); | 193 | DECR_LEN (data_size, 2); |
194 | n_p = _gnutls_read_uint16 (&data[i]); | 194 | n_p = mhd_gtls_read_uint16 (&data[i]); |
195 | i += 2; | 195 | i += 2; |
196 | 196 | ||
197 | DECR_LEN (data_size, n_p); | 197 | DECR_LEN (data_size, n_p); |
@@ -199,7 +199,7 @@ _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | |||
199 | i += n_p; | 199 | i += n_p; |
200 | 200 | ||
201 | DECR_LEN (data_size, 2); | 201 | DECR_LEN (data_size, 2); |
202 | n_g = _gnutls_read_uint16 (&data[i]); | 202 | n_g = mhd_gtls_read_uint16 (&data[i]); |
203 | i += 2; | 203 | i += 2; |
204 | 204 | ||
205 | DECR_LEN (data_size, n_g); | 205 | DECR_LEN (data_size, n_g); |
@@ -207,7 +207,7 @@ _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | |||
207 | i += n_g; | 207 | i += n_g; |
208 | 208 | ||
209 | DECR_LEN (data_size, 2); | 209 | DECR_LEN (data_size, 2); |
210 | n_Y = _gnutls_read_uint16 (&data[i]); | 210 | n_Y = mhd_gtls_read_uint16 (&data[i]); |
211 | i += 2; | 211 | i += 2; |
212 | 212 | ||
213 | DECR_LEN (data_size, n_Y); | 213 | DECR_LEN (data_size, n_Y); |
@@ -218,24 +218,24 @@ _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | |||
218 | _n_g = n_g; | 218 | _n_g = n_g; |
219 | _n_p = n_p; | 219 | _n_p = n_p; |
220 | 220 | ||
221 | if (_gnutls_mpi_scan_nz (&session->key->client_Y, data_Y, &_n_Y) != 0) | 221 | if (mhd_gtls_mpi_scan_nz (&session->key->client_Y, data_Y, &_n_Y) != 0) |
222 | { | 222 | { |
223 | gnutls_assert (); | 223 | gnutls_assert (); |
224 | return GNUTLS_E_MPI_SCAN_FAILED; | 224 | return GNUTLS_E_MPI_SCAN_FAILED; |
225 | } | 225 | } |
226 | 226 | ||
227 | if (_gnutls_mpi_scan_nz (&session->key->client_g, data_g, &_n_g) != 0) | 227 | if (mhd_gtls_mpi_scan_nz (&session->key->client_g, data_g, &_n_g) != 0) |
228 | { | 228 | { |
229 | gnutls_assert (); | 229 | gnutls_assert (); |
230 | return GNUTLS_E_MPI_SCAN_FAILED; | 230 | return GNUTLS_E_MPI_SCAN_FAILED; |
231 | } | 231 | } |
232 | if (_gnutls_mpi_scan_nz (&session->key->client_p, data_p, &_n_p) != 0) | 232 | if (mhd_gtls_mpi_scan_nz (&session->key->client_p, data_p, &_n_p) != 0) |
233 | { | 233 | { |
234 | gnutls_assert (); | 234 | gnutls_assert (); |
235 | return GNUTLS_E_MPI_SCAN_FAILED; | 235 | return GNUTLS_E_MPI_SCAN_FAILED; |
236 | } | 236 | } |
237 | 237 | ||
238 | bits = _gnutls_dh_get_allowed_prime_bits (session); | 238 | bits = mhd_gtls_dh_get_allowed_prime_bits (session); |
239 | if (bits < 0) | 239 | if (bits < 0) |
240 | { | 240 | { |
241 | gnutls_assert (); | 241 | gnutls_assert (); |
@@ -250,9 +250,9 @@ _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | |||
250 | return GNUTLS_E_DH_PRIME_UNACCEPTABLE; | 250 | return GNUTLS_E_DH_PRIME_UNACCEPTABLE; |
251 | } | 251 | } |
252 | 252 | ||
253 | _gnutls_dh_set_group (session, session->key->client_g, | 253 | mhd_gtls_dh_set_group (session, session->key->client_g, |
254 | session->key->client_p); | 254 | session->key->client_p); |
255 | _gnutls_dh_set_peer_public (session, session->key->client_Y); | 255 | mhd_gtls_dh_set_peer_public (session, session->key->client_Y); |
256 | 256 | ||
257 | ret = n_Y + n_p + n_g + 6; | 257 | ret = n_Y + n_p + n_g + 6; |
258 | if (psk != 0) | 258 | if (psk != 0) |
@@ -264,7 +264,7 @@ _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | |||
264 | /* If the psk flag is set, then an empty psk_identity_hint will | 264 | /* If the psk flag is set, then an empty psk_identity_hint will |
265 | * be inserted */ | 265 | * be inserted */ |
266 | int | 266 | int |
267 | _gnutls_dh_common_print_server_kx (gnutls_session_t session, | 267 | mhd_gtls_dh_common_print_server_kx (mhd_gtls_session_t session, |
268 | mpi_t g, mpi_t p, opaque ** data, int psk) | 268 | mpi_t g, mpi_t p, opaque ** data, int psk) |
269 | { | 269 | { |
270 | mpi_t x, X; | 270 | mpi_t x, X; |
@@ -272,7 +272,7 @@ _gnutls_dh_common_print_server_kx (gnutls_session_t session, | |||
272 | int ret, data_size, pos; | 272 | int ret, data_size, pos; |
273 | uint8_t *pdata; | 273 | uint8_t *pdata; |
274 | 274 | ||
275 | X = gnutls_calc_dh_secret (&x, g, p); | 275 | X = mhd_gtls_calc_dh_secret (&x, g, p); |
276 | if (X == NULL || x == NULL) | 276 | if (X == NULL || x == NULL) |
277 | { | 277 | { |
278 | gnutls_assert (); | 278 | gnutls_assert (); |
@@ -280,11 +280,11 @@ _gnutls_dh_common_print_server_kx (gnutls_session_t session, | |||
280 | } | 280 | } |
281 | 281 | ||
282 | session->key->dh_secret = x; | 282 | session->key->dh_secret = x; |
283 | _gnutls_dh_set_secret_bits (session, _gnutls_mpi_get_nbits (x)); | 283 | mhd_gtls_dh_set_secret_bits (session, _gnutls_mpi_get_nbits (x)); |
284 | 284 | ||
285 | _gnutls_mpi_print (NULL, &n_g, g); | 285 | mhd_gtls_mpi_print (NULL, &n_g, g); |
286 | _gnutls_mpi_print (NULL, &n_p, p); | 286 | mhd_gtls_mpi_print (NULL, &n_p, p); |
287 | _gnutls_mpi_print (NULL, &n_X, X); | 287 | mhd_gtls_mpi_print (NULL, &n_X, X); |
288 | 288 | ||
289 | data_size = n_g + n_p + n_X + 6; | 289 | data_size = n_g + n_p + n_X + 6; |
290 | if (psk != 0) | 290 | if (psk != 0) |
@@ -293,7 +293,7 @@ _gnutls_dh_common_print_server_kx (gnutls_session_t session, | |||
293 | (*data) = gnutls_malloc (data_size); | 293 | (*data) = gnutls_malloc (data_size); |
294 | if (*data == NULL) | 294 | if (*data == NULL) |
295 | { | 295 | { |
296 | _gnutls_mpi_release (&X); | 296 | mhd_gtls_mpi_release (&X); |
297 | return GNUTLS_E_MEMORY_ERROR; | 297 | return GNUTLS_E_MEMORY_ERROR; |
298 | } | 298 | } |
299 | 299 | ||
@@ -302,24 +302,24 @@ _gnutls_dh_common_print_server_kx (gnutls_session_t session, | |||
302 | 302 | ||
303 | if (psk != 0) | 303 | if (psk != 0) |
304 | { | 304 | { |
305 | _gnutls_write_uint16 (0, &pdata[pos]); | 305 | mhd_gtls_write_uint16 (0, &pdata[pos]); |
306 | pos += 2; | 306 | pos += 2; |
307 | } | 307 | } |
308 | 308 | ||
309 | _gnutls_mpi_print (&pdata[pos + 2], &n_p, p); | 309 | mhd_gtls_mpi_print (&pdata[pos + 2], &n_p, p); |
310 | _gnutls_write_uint16 (n_p, &pdata[pos]); | 310 | mhd_gtls_write_uint16 (n_p, &pdata[pos]); |
311 | 311 | ||
312 | pos += n_p + 2; | 312 | pos += n_p + 2; |
313 | 313 | ||
314 | _gnutls_mpi_print (&pdata[pos + 2], &n_g, g); | 314 | mhd_gtls_mpi_print (&pdata[pos + 2], &n_g, g); |
315 | _gnutls_write_uint16 (n_g, &pdata[pos]); | 315 | mhd_gtls_write_uint16 (n_g, &pdata[pos]); |
316 | 316 | ||
317 | pos += n_g + 2; | 317 | pos += n_g + 2; |
318 | 318 | ||
319 | _gnutls_mpi_print (&pdata[pos + 2], &n_X, X); | 319 | mhd_gtls_mpi_print (&pdata[pos + 2], &n_X, X); |
320 | _gnutls_mpi_release (&X); | 320 | mhd_gtls_mpi_release (&X); |
321 | 321 | ||
322 | _gnutls_write_uint16 (n_X, &pdata[pos]); | 322 | mhd_gtls_write_uint16 (n_X, &pdata[pos]); |
323 | 323 | ||
324 | ret = data_size; | 324 | ret = data_size; |
325 | 325 | ||
diff --git a/src/daemon/https/tls/auth_dh_common.h b/src/daemon/https/tls/auth_dh_common.h index be0ad066..9d2d994a 100644 --- a/src/daemon/https/tls/auth_dh_common.h +++ b/src/daemon/https/tls/auth_dh_common.h | |||
@@ -34,14 +34,14 @@ typedef struct | |||
34 | gnutls_datum_t public_key; | 34 | gnutls_datum_t public_key; |
35 | } dh_info_st; | 35 | } dh_info_st; |
36 | 36 | ||
37 | void _gnutls_free_dh_info (dh_info_st * dh); | 37 | void mhd_gtls_free_dh_info (dh_info_st * dh); |
38 | int _gnutls_gen_dh_common_client_kx (gnutls_session_t, opaque **); | 38 | int mhd_gtls_gen_dh_common_client_kx (mhd_gtls_session_t, opaque **); |
39 | int _gnutls_proc_dh_common_client_kx (gnutls_session_t session, | 39 | int mhd_gtls_proc_dh_common_client_kx (mhd_gtls_session_t session, |
40 | opaque * data, size_t _data_size, | 40 | opaque * data, size_t _data_size, |
41 | mpi_t p, mpi_t g); | 41 | mpi_t p, mpi_t g); |
42 | int _gnutls_dh_common_print_server_kx (gnutls_session_t, mpi_t g, mpi_t p, | 42 | int mhd_gtls_dh_common_print_server_kx (mhd_gtls_session_t, mpi_t g, mpi_t p, |
43 | opaque ** data, int psk); | 43 | opaque ** data, int psk); |
44 | int _gnutls_proc_dh_common_server_kx (gnutls_session_t session, | 44 | int mhd_gtls_proc_dh_common_server_kx (mhd_gtls_session_t session, |
45 | opaque * data, size_t _data_size, | 45 | opaque * data, size_t _data_size, |
46 | int psk); | 46 | int psk); |
47 | 47 | ||
diff --git a/src/daemon/https/tls/auth_dhe.c b/src/daemon/https/tls/auth_dhe.c index 36c3be3f..ada5efe2 100644 --- a/src/daemon/https/tls/auth_dhe.c +++ b/src/daemon/https/tls/auth_dhe.c | |||
@@ -39,47 +39,47 @@ | |||
39 | #include <gnutls_state.h> | 39 | #include <gnutls_state.h> |
40 | #include <auth_dh_common.h> | 40 | #include <auth_dh_common.h> |
41 | 41 | ||
42 | static int gen_dhe_server_kx (gnutls_session_t, opaque **); | 42 | static int gen_dhe_server_kx (mhd_gtls_session_t, opaque **); |
43 | static int proc_dhe_server_kx (gnutls_session_t, opaque *, size_t); | 43 | static int proc_dhe_server_kx (mhd_gtls_session_t, opaque *, size_t); |
44 | static int proc_dhe_client_kx (gnutls_session_t, opaque *, size_t); | 44 | static int proc_dhe_client_kx (mhd_gtls_session_t, opaque *, size_t); |
45 | 45 | ||
46 | const mod_auth_st dhe_rsa_auth_struct = { | 46 | const mhd_gtls_mod_auth_st dhe_rsa_auth_struct = { |
47 | "DHE_RSA", | 47 | "DHE_RSA", |
48 | _gnutls_gen_cert_server_certificate, | 48 | mhd_gtls_gen_cert_server_certificate, |
49 | _gnutls_gen_cert_client_certificate, | 49 | mhd_gtls_gen_cert_client_certificate, |
50 | gen_dhe_server_kx, | 50 | gen_dhe_server_kx, |
51 | _gnutls_gen_dh_common_client_kx, | 51 | mhd_gtls_gen_dh_common_client_kx, |
52 | _gnutls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ | 52 | mhd_gtls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ |
53 | _gnutls_gen_cert_server_cert_req, /* server cert request */ | 53 | mhd_gtls_gen_cert_server_cert_req, /* server cert request */ |
54 | 54 | ||
55 | _gnutls_proc_cert_server_certificate, | 55 | mhd_gtls_proc_cert_server_certificate, |
56 | _gnutls_proc_cert_client_certificate, | 56 | _gnutls_proc_cert_client_certificate, |
57 | proc_dhe_server_kx, | 57 | proc_dhe_server_kx, |
58 | proc_dhe_client_kx, | 58 | proc_dhe_client_kx, |
59 | _gnutls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ | 59 | mhd_gtls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ |
60 | _gnutls_proc_cert_cert_req /* proc server cert request */ | 60 | mhd_gtls_proc_cert_cert_req /* proc server cert request */ |
61 | }; | 61 | }; |
62 | 62 | ||
63 | const mod_auth_st dhe_dss_auth_struct = { | 63 | const mhd_gtls_mod_auth_st dhe_dss_auth_struct = { |
64 | "DHE_DSS", | 64 | "DHE_DSS", |
65 | _gnutls_gen_cert_server_certificate, | 65 | mhd_gtls_gen_cert_server_certificate, |
66 | _gnutls_gen_cert_client_certificate, | 66 | mhd_gtls_gen_cert_client_certificate, |
67 | gen_dhe_server_kx, | 67 | gen_dhe_server_kx, |
68 | _gnutls_gen_dh_common_client_kx, | 68 | mhd_gtls_gen_dh_common_client_kx, |
69 | _gnutls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ | 69 | mhd_gtls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ |
70 | _gnutls_gen_cert_server_cert_req, /* server cert request */ | 70 | mhd_gtls_gen_cert_server_cert_req, /* server cert request */ |
71 | 71 | ||
72 | _gnutls_proc_cert_server_certificate, | 72 | mhd_gtls_proc_cert_server_certificate, |
73 | _gnutls_proc_cert_client_certificate, | 73 | _gnutls_proc_cert_client_certificate, |
74 | proc_dhe_server_kx, | 74 | proc_dhe_server_kx, |
75 | proc_dhe_client_kx, | 75 | proc_dhe_client_kx, |
76 | _gnutls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ | 76 | mhd_gtls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ |
77 | _gnutls_proc_cert_cert_req /* proc server cert request */ | 77 | mhd_gtls_proc_cert_cert_req /* proc server cert request */ |
78 | }; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
81 | static int | 81 | static int |
82 | gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | 82 | gen_dhe_server_kx (mhd_gtls_session_t session, opaque ** data) |
83 | { | 83 | { |
84 | mpi_t g, p; | 84 | mpi_t g, p; |
85 | const mpi_t *mpis; | 85 | const mpi_t *mpis; |
@@ -89,22 +89,22 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
89 | gnutls_privkey *apr_pkey; | 89 | gnutls_privkey *apr_pkey; |
90 | int apr_cert_list_length; | 90 | int apr_cert_list_length; |
91 | gnutls_datum_t signature, ddata; | 91 | gnutls_datum_t signature, ddata; |
92 | gnutls_certificate_credentials_t cred; | 92 | mhd_gtls_cert_credentials_t cred; |
93 | gnutls_dh_params_t dh_params; | 93 | mhd_gtls_dh_params_t dh_params; |
94 | 94 | ||
95 | cred = (gnutls_certificate_credentials_t) | 95 | cred = (mhd_gtls_cert_credentials_t) |
96 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 96 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
97 | if (cred == NULL) | 97 | if (cred == NULL) |
98 | { | 98 | { |
99 | gnutls_assert (); | 99 | gnutls_assert (); |
100 | return GNUTLS_E_INSUFFICIENT_CREDENTIALS; | 100 | return GNUTLS_E_INSUFFICIENT_CREDENTIALS; |
101 | } | 101 | } |
102 | 102 | ||
103 | bits = _gnutls_dh_get_allowed_prime_bits (session); | 103 | bits = mhd_gtls_dh_get_allowed_prime_bits (session); |
104 | 104 | ||
105 | /* find the appropriate certificate */ | 105 | /* find the appropriate certificate */ |
106 | if ((ret = | 106 | if ((ret = |
107 | _gnutls_get_selected_cert (session, &apr_cert_list, | 107 | mhd_gtls_get_selected_cert (session, &apr_cert_list, |
108 | &apr_cert_list_length, &apr_pkey)) < 0) | 108 | &apr_cert_list_length, &apr_pkey)) < 0) |
109 | { | 109 | { |
110 | gnutls_assert (); | 110 | gnutls_assert (); |
@@ -112,8 +112,8 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | dh_params = | 114 | dh_params = |
115 | _gnutls_get_dh_params (cred->dh_params, cred->params_func, session); | 115 | mhd_gtls_get_dh_params (cred->dh_params, cred->params_func, session); |
116 | mpis = _gnutls_dh_params_to_mpi (dh_params); | 116 | mpis = mhd_gtls_dh_params_to_mpi (dh_params); |
117 | if (mpis == NULL) | 117 | if (mpis == NULL) |
118 | { | 118 | { |
119 | gnutls_assert (); | 119 | gnutls_assert (); |
@@ -123,16 +123,16 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
123 | p = mpis[0]; | 123 | p = mpis[0]; |
124 | g = mpis[1]; | 124 | g = mpis[1]; |
125 | 125 | ||
126 | if ((ret = _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, | 126 | if ((ret = mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, |
127 | sizeof (cert_auth_info_st), 0)) < 0) | 127 | sizeof (cert_auth_info_st), 0)) < 0) |
128 | { | 128 | { |
129 | gnutls_assert (); | 129 | gnutls_assert (); |
130 | return ret; | 130 | return ret; |
131 | } | 131 | } |
132 | 132 | ||
133 | _gnutls_dh_set_group (session, g, p); | 133 | mhd_gtls_dh_set_group (session, g, p); |
134 | 134 | ||
135 | ret = _gnutls_dh_common_print_server_kx (session, g, p, data, 0); | 135 | ret = mhd_gtls_dh_common_print_server_kx (session, g, p, data, 0); |
136 | if (ret < 0) | 136 | if (ret < 0) |
137 | { | 137 | { |
138 | gnutls_assert (); | 138 | gnutls_assert (); |
@@ -148,7 +148,7 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
148 | if (apr_cert_list_length > 0) | 148 | if (apr_cert_list_length > 0) |
149 | { | 149 | { |
150 | if ((ret = | 150 | if ((ret = |
151 | _gnutls_tls_sign_params (session, &apr_cert_list[0], | 151 | mhd_gtls_tls_sign_params (session, &apr_cert_list[0], |
152 | apr_pkey, &ddata, &signature)) < 0) | 152 | apr_pkey, &ddata, &signature)) < 0) |
153 | { | 153 | { |
154 | gnutls_assert (); | 154 | gnutls_assert (); |
@@ -162,7 +162,7 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
162 | return data_size; /* do not put a signature - ILLEGAL! */ | 162 | return data_size; /* do not put a signature - ILLEGAL! */ |
163 | } | 163 | } |
164 | 164 | ||
165 | *data = gnutls_realloc_fast (*data, data_size + signature.size + 2); | 165 | *data = mhd_gtls_realloc_fast (*data, data_size + signature.size + 2); |
166 | if (*data == NULL) | 166 | if (*data == NULL) |
167 | { | 167 | { |
168 | _gnutls_free_datum (&signature); | 168 | _gnutls_free_datum (&signature); |
@@ -170,7 +170,7 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
170 | return GNUTLS_E_MEMORY_ERROR; | 170 | return GNUTLS_E_MEMORY_ERROR; |
171 | } | 171 | } |
172 | 172 | ||
173 | _gnutls_write_datum16 (&(*data)[data_size], signature); | 173 | mhd_gtls_write_datum16 (&(*data)[data_size], signature); |
174 | data_size += signature.size + 2; | 174 | data_size += signature.size + 2; |
175 | 175 | ||
176 | _gnutls_free_datum (&signature); | 176 | _gnutls_free_datum (&signature); |
@@ -179,13 +179,13 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | static int | 181 | static int |
182 | proc_dhe_server_kx (gnutls_session_t session, opaque * data, | 182 | proc_dhe_server_kx (mhd_gtls_session_t session, opaque * data, |
183 | size_t _data_size) | 183 | size_t _data_size) |
184 | { | 184 | { |
185 | int sigsize; | 185 | int sigsize; |
186 | gnutls_datum_t vparams, signature; | 186 | gnutls_datum_t vparams, signature; |
187 | int ret; | 187 | int ret; |
188 | cert_auth_info_t info = _gnutls_get_auth_info (session); | 188 | cert_auth_info_t info = mhd_gtls_get_auth_info (session); |
189 | ssize_t data_size = _data_size; | 189 | ssize_t data_size = _data_size; |
190 | gnutls_cert peer_cert; | 190 | gnutls_cert peer_cert; |
191 | 191 | ||
@@ -196,7 +196,7 @@ proc_dhe_server_kx (gnutls_session_t session, opaque * data, | |||
196 | return GNUTLS_E_INTERNAL_ERROR; | 196 | return GNUTLS_E_INTERNAL_ERROR; |
197 | } | 197 | } |
198 | 198 | ||
199 | ret = _gnutls_proc_dh_common_server_kx (session, data, _data_size, 0); | 199 | ret = mhd_gtls_proc_dh_common_server_kx (session, data, _data_size, 0); |
200 | if (ret < 0) | 200 | if (ret < 0) |
201 | { | 201 | { |
202 | gnutls_assert (); | 202 | gnutls_assert (); |
@@ -209,14 +209,14 @@ proc_dhe_server_kx (gnutls_session_t session, opaque * data, | |||
209 | vparams.data = data; | 209 | vparams.data = data; |
210 | 210 | ||
211 | DECR_LEN (data_size, 2); | 211 | DECR_LEN (data_size, 2); |
212 | sigsize = _gnutls_read_uint16 (&data[vparams.size]); | 212 | sigsize = mhd_gtls_read_uint16 (&data[vparams.size]); |
213 | 213 | ||
214 | DECR_LEN (data_size, sigsize); | 214 | DECR_LEN (data_size, sigsize); |
215 | signature.data = &data[vparams.size + 2]; | 215 | signature.data = &data[vparams.size + 2]; |
216 | signature.size = sigsize; | 216 | signature.size = sigsize; |
217 | 217 | ||
218 | if ((ret = | 218 | if ((ret = |
219 | _gnutls_raw_cert_to_gcert (&peer_cert, | 219 | mhd_gtls_raw_cert_to_gcert (&peer_cert, |
220 | session->security_parameters.cert_type, | 220 | session->security_parameters.cert_type, |
221 | &info->raw_certificate_list[0], | 221 | &info->raw_certificate_list[0], |
222 | CERT_NO_COPY)) < 0) | 222 | CERT_NO_COPY)) < 0) |
@@ -225,9 +225,9 @@ proc_dhe_server_kx (gnutls_session_t session, opaque * data, | |||
225 | return ret; | 225 | return ret; |
226 | } | 226 | } |
227 | 227 | ||
228 | ret = _gnutls_verify_sig_params (session, &peer_cert, &vparams, &signature); | 228 | ret = mhd_gtls_verify_sig_params (session, &peer_cert, &vparams, &signature); |
229 | 229 | ||
230 | _gnutls_gcert_deinit (&peer_cert); | 230 | mhd_gtls_gcert_deinit (&peer_cert); |
231 | if (ret < 0) | 231 | if (ret < 0) |
232 | { | 232 | { |
233 | gnutls_assert (); | 233 | gnutls_assert (); |
@@ -240,17 +240,17 @@ proc_dhe_server_kx (gnutls_session_t session, opaque * data, | |||
240 | 240 | ||
241 | 241 | ||
242 | static int | 242 | static int |
243 | proc_dhe_client_kx (gnutls_session_t session, opaque * data, | 243 | proc_dhe_client_kx (mhd_gtls_session_t session, opaque * data, |
244 | size_t _data_size) | 244 | size_t _data_size) |
245 | { | 245 | { |
246 | gnutls_certificate_credentials_t cred; | 246 | mhd_gtls_cert_credentials_t cred; |
247 | int ret; | 247 | int ret; |
248 | mpi_t p, g; | 248 | mpi_t p, g; |
249 | const mpi_t *mpis; | 249 | const mpi_t *mpis; |
250 | gnutls_dh_params_t dh_params; | 250 | mhd_gtls_dh_params_t dh_params; |
251 | 251 | ||
252 | cred = (gnutls_certificate_credentials_t) | 252 | cred = (mhd_gtls_cert_credentials_t) |
253 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 253 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
254 | if (cred == NULL) | 254 | if (cred == NULL) |
255 | { | 255 | { |
256 | gnutls_assert (); | 256 | gnutls_assert (); |
@@ -258,8 +258,8 @@ proc_dhe_client_kx (gnutls_session_t session, opaque * data, | |||
258 | } | 258 | } |
259 | 259 | ||
260 | dh_params = | 260 | dh_params = |
261 | _gnutls_get_dh_params (cred->dh_params, cred->params_func, session); | 261 | mhd_gtls_get_dh_params (cred->dh_params, cred->params_func, session); |
262 | mpis = _gnutls_dh_params_to_mpi (dh_params); | 262 | mpis = mhd_gtls_dh_params_to_mpi (dh_params); |
263 | if (mpis == NULL) | 263 | if (mpis == NULL) |
264 | { | 264 | { |
265 | gnutls_assert (); | 265 | gnutls_assert (); |
@@ -269,7 +269,7 @@ proc_dhe_client_kx (gnutls_session_t session, opaque * data, | |||
269 | p = mpis[0]; | 269 | p = mpis[0]; |
270 | g = mpis[1]; | 270 | g = mpis[1]; |
271 | 271 | ||
272 | ret = _gnutls_proc_dh_common_client_kx (session, data, _data_size, g, p); | 272 | ret = mhd_gtls_proc_dh_common_client_kx (session, data, _data_size, g, p); |
273 | 273 | ||
274 | return ret; | 274 | return ret; |
275 | 275 | ||
diff --git a/src/daemon/https/tls/auth_rsa.c b/src/daemon/https/tls/auth_rsa.c index ae5640ae..40d1913f 100644 --- a/src/daemon/https/tls/auth_rsa.c +++ b/src/daemon/https/tls/auth_rsa.c | |||
@@ -42,30 +42,30 @@ | |||
42 | #include <gnutls_x509.h> | 42 | #include <gnutls_x509.h> |
43 | #include <gc.h> | 43 | #include <gc.h> |
44 | 44 | ||
45 | int _gnutls_gen_rsa_client_kx (gnutls_session_t, opaque **); | 45 | int _gnutls_gen_rsa_client_kx (mhd_gtls_session_t, opaque **); |
46 | int _gnutls_proc_rsa_client_kx (gnutls_session_t, opaque *, size_t); | 46 | int _gnutls_proc_rsa_client_kx (mhd_gtls_session_t, opaque *, size_t); |
47 | 47 | ||
48 | const mod_auth_st rsa_auth_struct = { | 48 | const mhd_gtls_mod_auth_st rsa_auth_struct = { |
49 | "RSA", | 49 | "RSA", |
50 | _gnutls_gen_cert_server_certificate, | 50 | mhd_gtls_gen_cert_server_certificate, |
51 | _gnutls_gen_cert_client_certificate, | 51 | mhd_gtls_gen_cert_client_certificate, |
52 | NULL, /* gen server kx */ | 52 | NULL, /* gen server kx */ |
53 | _gnutls_gen_rsa_client_kx, | 53 | _gnutls_gen_rsa_client_kx, |
54 | _gnutls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ | 54 | mhd_gtls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ |
55 | _gnutls_gen_cert_server_cert_req, /* server cert request */ | 55 | mhd_gtls_gen_cert_server_cert_req, /* server cert request */ |
56 | 56 | ||
57 | _gnutls_proc_cert_server_certificate, | 57 | mhd_gtls_proc_cert_server_certificate, |
58 | _gnutls_proc_cert_client_certificate, | 58 | _gnutls_proc_cert_client_certificate, |
59 | NULL, /* proc server kx */ | 59 | NULL, /* proc server kx */ |
60 | _gnutls_proc_rsa_client_kx, /* proc client kx */ | 60 | _gnutls_proc_rsa_client_kx, /* proc client kx */ |
61 | _gnutls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ | 61 | mhd_gtls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ |
62 | _gnutls_proc_cert_cert_req /* proc server cert request */ | 62 | mhd_gtls_proc_cert_cert_req /* proc server cert request */ |
63 | }; | 63 | }; |
64 | 64 | ||
65 | /* This function reads the RSA parameters from peer's certificate; | 65 | /* This function reads the RSA parameters from peer's certificate; |
66 | */ | 66 | */ |
67 | int | 67 | int |
68 | _gnutls_get_public_rsa_params (gnutls_session_t session, | 68 | _gnutls_get_public_rsa_params (mhd_gtls_session_t session, |
69 | mpi_t params[MAX_PUBLIC_PARAMS_SIZE], | 69 | mpi_t params[MAX_PUBLIC_PARAMS_SIZE], |
70 | int *params_len) | 70 | int *params_len) |
71 | { | 71 | { |
@@ -76,7 +76,7 @@ _gnutls_get_public_rsa_params (gnutls_session_t session, | |||
76 | 76 | ||
77 | /* normal non export case */ | 77 | /* normal non export case */ |
78 | 78 | ||
79 | info = _gnutls_get_auth_info (session); | 79 | info = mhd_gtls_get_auth_info (session); |
80 | 80 | ||
81 | if (info == NULL || info->ncerts == 0) | 81 | if (info == NULL || info->ncerts == 0) |
82 | { | 82 | { |
@@ -85,7 +85,7 @@ _gnutls_get_public_rsa_params (gnutls_session_t session, | |||
85 | } | 85 | } |
86 | 86 | ||
87 | ret = | 87 | ret = |
88 | _gnutls_raw_cert_to_gcert (&peer_cert, | 88 | mhd_gtls_raw_cert_to_gcert (&peer_cert, |
89 | session->security_parameters.cert_type, | 89 | session->security_parameters.cert_type, |
90 | &info->raw_certificate_list[0], | 90 | &info->raw_certificate_list[0], |
91 | CERT_ONLY_PUBKEY | CERT_NO_COPY); | 91 | CERT_ONLY_PUBKEY | CERT_NO_COPY); |
@@ -98,13 +98,13 @@ _gnutls_get_public_rsa_params (gnutls_session_t session, | |||
98 | 98 | ||
99 | 99 | ||
100 | /* EXPORT case: */ | 100 | /* EXPORT case: */ |
101 | if (_gnutls_cipher_suite_get_kx_algo | 101 | if (mhd_gtls_cipher_suite_get_kx_algo |
102 | (&session->security_parameters.current_cipher_suite) | 102 | (&session->security_parameters.current_cipher_suite) |
103 | == MHD_GNUTLS_KX_RSA_EXPORT | 103 | == MHD_GNUTLS_KX_RSA_EXPORT |
104 | && _gnutls_mpi_get_nbits (peer_cert.params[0]) > 512) | 104 | && _gnutls_mpi_get_nbits (peer_cert.params[0]) > 512) |
105 | { | 105 | { |
106 | 106 | ||
107 | _gnutls_gcert_deinit (&peer_cert); | 107 | mhd_gtls_gcert_deinit (&peer_cert); |
108 | 108 | ||
109 | if (session->key->rsa[0] == NULL || session->key->rsa[1] == NULL) | 109 | if (session->key->rsa[0] == NULL || session->key->rsa[1] == NULL) |
110 | { | 110 | { |
@@ -139,7 +139,7 @@ _gnutls_get_public_rsa_params (gnutls_session_t session, | |||
139 | { | 139 | { |
140 | params[i] = _gnutls_mpi_copy (peer_cert.params[i]); | 140 | params[i] = _gnutls_mpi_copy (peer_cert.params[i]); |
141 | } | 141 | } |
142 | _gnutls_gcert_deinit (&peer_cert); | 142 | mhd_gtls_gcert_deinit (&peer_cert); |
143 | 143 | ||
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
@@ -147,15 +147,15 @@ _gnutls_get_public_rsa_params (gnutls_session_t session, | |||
147 | /* This function reads the RSA parameters from the private key | 147 | /* This function reads the RSA parameters from the private key |
148 | */ | 148 | */ |
149 | int | 149 | int |
150 | _gnutls_get_private_rsa_params (gnutls_session_t session, | 150 | _gnutls_get_private_rsa_params (mhd_gtls_session_t session, |
151 | mpi_t ** params, int *params_size) | 151 | mpi_t ** params, int *params_size) |
152 | { | 152 | { |
153 | int bits; | 153 | int bits; |
154 | gnutls_certificate_credentials_t cred; | 154 | mhd_gtls_cert_credentials_t cred; |
155 | gnutls_rsa_params_t rsa_params; | 155 | mhd_gtls_rsa_params_t rsa_params; |
156 | 156 | ||
157 | cred = (gnutls_certificate_credentials_t) | 157 | cred = (mhd_gtls_cert_credentials_t) |
158 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 158 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
159 | if (cred == NULL) | 159 | if (cred == NULL) |
160 | { | 160 | { |
161 | gnutls_assert (); | 161 | gnutls_assert (); |
@@ -172,13 +172,13 @@ _gnutls_get_private_rsa_params (gnutls_session_t session, | |||
172 | _gnutls_mpi_get_nbits (session->internals.selected_cert_list[0]. | 172 | _gnutls_mpi_get_nbits (session->internals.selected_cert_list[0]. |
173 | params[0]); | 173 | params[0]); |
174 | 174 | ||
175 | if (_gnutls_cipher_suite_get_kx_algo | 175 | if (mhd_gtls_cipher_suite_get_kx_algo |
176 | (&session->security_parameters.current_cipher_suite) | 176 | (&session->security_parameters.current_cipher_suite) |
177 | == MHD_GNUTLS_KX_RSA_EXPORT && bits > 512) | 177 | == MHD_GNUTLS_KX_RSA_EXPORT && bits > 512) |
178 | { | 178 | { |
179 | 179 | ||
180 | rsa_params = | 180 | rsa_params = |
181 | _gnutls_certificate_get_rsa_params (cred->rsa_params, | 181 | mhd_gtls_certificate_get_rsa_params (cred->rsa_params, |
182 | cred->params_func, session); | 182 | cred->params_func, session); |
183 | /* EXPORT case: */ | 183 | /* EXPORT case: */ |
184 | if (rsa_params == NULL) | 184 | if (rsa_params == NULL) |
@@ -206,7 +206,7 @@ _gnutls_get_private_rsa_params (gnutls_session_t session, | |||
206 | } | 206 | } |
207 | 207 | ||
208 | int | 208 | int |
209 | _gnutls_proc_rsa_client_kx (gnutls_session_t session, opaque * data, | 209 | _gnutls_proc_rsa_client_kx (mhd_gtls_session_t session, opaque * data, |
210 | size_t _data_size) | 210 | size_t _data_size) |
211 | { | 211 | { |
212 | gnutls_datum_t plaintext; | 212 | gnutls_datum_t plaintext; |
@@ -217,7 +217,7 @@ _gnutls_proc_rsa_client_kx (gnutls_session_t session, opaque * data, | |||
217 | int randomize_key = 0; | 217 | int randomize_key = 0; |
218 | ssize_t data_size = _data_size; | 218 | ssize_t data_size = _data_size; |
219 | 219 | ||
220 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 220 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
221 | { | 221 | { |
222 | /* SSL 3.0 | 222 | /* SSL 3.0 |
223 | */ | 223 | */ |
@@ -230,7 +230,7 @@ _gnutls_proc_rsa_client_kx (gnutls_session_t session, opaque * data, | |||
230 | */ | 230 | */ |
231 | DECR_LEN (data_size, 2); | 231 | DECR_LEN (data_size, 2); |
232 | ciphertext.data = &data[2]; | 232 | ciphertext.data = &data[2]; |
233 | dsize = _gnutls_read_uint16 (data); | 233 | dsize = mhd_gtls_read_uint16 (data); |
234 | 234 | ||
235 | if (dsize != data_size) | 235 | if (dsize != data_size) |
236 | { | 236 | { |
@@ -247,7 +247,7 @@ _gnutls_proc_rsa_client_kx (gnutls_session_t session, opaque * data, | |||
247 | return ret; | 247 | return ret; |
248 | } | 248 | } |
249 | 249 | ||
250 | ret = _gnutls_pkcs1_rsa_decrypt (&plaintext, &ciphertext, params, params_len, 2); /* btype==2 */ | 250 | ret = mhd_gtls_pkcs1_rsa_decrypt (&plaintext, &ciphertext, params, params_len, 2); /* btype==2 */ |
251 | 251 | ||
252 | if (ret < 0 || plaintext.size != TLS_MASTER_SIZE) | 252 | if (ret < 0 || plaintext.size != TLS_MASTER_SIZE) |
253 | { | 253 | { |
@@ -318,7 +318,7 @@ _gnutls_proc_rsa_client_kx (gnutls_session_t session, opaque * data, | |||
318 | /* return RSA(random) using the peers public key | 318 | /* return RSA(random) using the peers public key |
319 | */ | 319 | */ |
320 | int | 320 | int |
321 | _gnutls_gen_rsa_client_kx (gnutls_session_t session, opaque ** data) | 321 | _gnutls_gen_rsa_client_kx (mhd_gtls_session_t session, opaque ** data) |
322 | { | 322 | { |
323 | cert_auth_info_t auth = session->key->auth_info; | 323 | cert_auth_info_t auth = session->key->auth_info; |
324 | gnutls_datum_t sdata; /* data to send */ | 324 | gnutls_datum_t sdata; /* data to send */ |
@@ -352,12 +352,12 @@ _gnutls_gen_rsa_client_kx (gnutls_session_t session, opaque ** data) | |||
352 | return GNUTLS_E_RANDOM_FAILED; | 352 | return GNUTLS_E_RANDOM_FAILED; |
353 | } | 353 | } |
354 | 354 | ||
355 | ver = _gnutls_get_adv_version (session); | 355 | ver = mhd_gtls_get_adv_version (session); |
356 | 356 | ||
357 | if (session->internals.rsa_pms_version[0] == 0) | 357 | if (session->internals.rsa_pms_version[0] == 0) |
358 | { | 358 | { |
359 | session->key->key.data[0] = _gnutls_version_get_major (ver); | 359 | session->key->key.data[0] = mhd_gtls_version_get_major (ver); |
360 | session->key->key.data[1] = _gnutls_version_get_minor (ver); | 360 | session->key->key.data[1] = mhd_gtls_version_get_minor (ver); |
361 | } | 361 | } |
362 | else | 362 | else |
363 | { /* use the version provided */ | 363 | { /* use the version provided */ |
@@ -375,7 +375,7 @@ _gnutls_gen_rsa_client_kx (gnutls_session_t session, opaque ** data) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | if ((ret = | 377 | if ((ret = |
378 | _gnutls_pkcs1_rsa_encrypt (&sdata, &session->key->key, | 378 | mhd_gtls_pkcs1_rsa_encrypt (&sdata, &session->key->key, |
379 | params, params_len, 2)) < 0) | 379 | params, params_len, 2)) < 0) |
380 | { | 380 | { |
381 | gnutls_assert (); | 381 | gnutls_assert (); |
@@ -383,9 +383,9 @@ _gnutls_gen_rsa_client_kx (gnutls_session_t session, opaque ** data) | |||
383 | } | 383 | } |
384 | 384 | ||
385 | for (i = 0; i < params_len; i++) | 385 | for (i = 0; i < params_len; i++) |
386 | _gnutls_mpi_release (¶ms[i]); | 386 | mhd_gtls_mpi_release (¶ms[i]); |
387 | 387 | ||
388 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 388 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
389 | { | 389 | { |
390 | /* SSL 3.0 */ | 390 | /* SSL 3.0 */ |
391 | *data = sdata.data; | 391 | *data = sdata.data; |
@@ -399,7 +399,7 @@ _gnutls_gen_rsa_client_kx (gnutls_session_t session, opaque ** data) | |||
399 | _gnutls_free_datum (&sdata); | 399 | _gnutls_free_datum (&sdata); |
400 | return GNUTLS_E_MEMORY_ERROR; | 400 | return GNUTLS_E_MEMORY_ERROR; |
401 | } | 401 | } |
402 | _gnutls_write_datum16 (*data, sdata); | 402 | mhd_gtls_write_datum16 (*data, sdata); |
403 | ret = sdata.size + 2; | 403 | ret = sdata.size + 2; |
404 | _gnutls_free_datum (&sdata); | 404 | _gnutls_free_datum (&sdata); |
405 | return ret; | 405 | return ret; |
diff --git a/src/daemon/https/tls/auth_rsa_export.c b/src/daemon/https/tls/auth_rsa_export.c index 7c598226..cb01570f 100644 --- a/src/daemon/https/tls/auth_rsa_export.c +++ b/src/daemon/https/tls/auth_rsa_export.c | |||
@@ -43,32 +43,32 @@ | |||
43 | #include <gnutls_rsa_export.h> | 43 | #include <gnutls_rsa_export.h> |
44 | #include <gnutls_state.h> | 44 | #include <gnutls_state.h> |
45 | 45 | ||
46 | int _gnutls_gen_rsa_client_kx (gnutls_session_t, opaque **); | 46 | int _gnutls_gen_rsa_client_kx (mhd_gtls_session_t, opaque **); |
47 | int _gnutls_proc_rsa_client_kx (gnutls_session_t, opaque *, size_t); | 47 | int _gnutls_proc_rsa_client_kx (mhd_gtls_session_t, opaque *, size_t); |
48 | static int gen_rsa_export_server_kx (gnutls_session_t, opaque **); | 48 | static int gen_rsa_export_server_kx (mhd_gtls_session_t, opaque **); |
49 | static int proc_rsa_export_server_kx (gnutls_session_t, opaque *, size_t); | 49 | static int proc_rsa_export_server_kx (mhd_gtls_session_t, opaque *, size_t); |
50 | 50 | ||
51 | const mod_auth_st rsa_export_auth_struct = { | 51 | const mhd_gtls_mod_auth_st rsa_export_auth_struct = { |
52 | "RSA EXPORT", | 52 | "RSA EXPORT", |
53 | _gnutls_gen_cert_server_certificate, | 53 | mhd_gtls_gen_cert_server_certificate, |
54 | _gnutls_gen_cert_client_certificate, | 54 | mhd_gtls_gen_cert_client_certificate, |
55 | gen_rsa_export_server_kx, | 55 | gen_rsa_export_server_kx, |
56 | _gnutls_gen_rsa_client_kx, | 56 | _gnutls_gen_rsa_client_kx, |
57 | _gnutls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ | 57 | mhd_gtls_gen_cert_client_cert_vrfy, /* gen client cert vrfy */ |
58 | _gnutls_gen_cert_server_cert_req, /* server cert request */ | 58 | mhd_gtls_gen_cert_server_cert_req, /* server cert request */ |
59 | 59 | ||
60 | _gnutls_proc_cert_server_certificate, | 60 | mhd_gtls_proc_cert_server_certificate, |
61 | _gnutls_proc_cert_client_certificate, | 61 | _gnutls_proc_cert_client_certificate, |
62 | proc_rsa_export_server_kx, | 62 | proc_rsa_export_server_kx, |
63 | _gnutls_proc_rsa_client_kx, /* proc client kx */ | 63 | _gnutls_proc_rsa_client_kx, /* proc client kx */ |
64 | _gnutls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ | 64 | mhd_gtls_proc_cert_client_cert_vrfy, /* proc client cert vrfy */ |
65 | _gnutls_proc_cert_cert_req /* proc server cert request */ | 65 | mhd_gtls_proc_cert_cert_req /* proc server cert request */ |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static int | 68 | static int |
69 | gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | 69 | gen_rsa_export_server_kx (mhd_gtls_session_t session, opaque ** data) |
70 | { | 70 | { |
71 | gnutls_rsa_params_t rsa_params; | 71 | mhd_gtls_rsa_params_t rsa_params; |
72 | const mpi_t *rsa_mpis; | 72 | const mpi_t *rsa_mpis; |
73 | size_t n_e, n_m; | 73 | size_t n_e, n_m; |
74 | uint8_t *data_e, *data_m; | 74 | uint8_t *data_e, *data_m; |
@@ -78,10 +78,10 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
78 | int apr_cert_list_length; | 78 | int apr_cert_list_length; |
79 | gnutls_datum_t signature, ddata; | 79 | gnutls_datum_t signature, ddata; |
80 | cert_auth_info_t info; | 80 | cert_auth_info_t info; |
81 | gnutls_certificate_credentials_t cred; | 81 | mhd_gtls_cert_credentials_t cred; |
82 | 82 | ||
83 | cred = (gnutls_certificate_credentials_t) | 83 | cred = (mhd_gtls_cert_credentials_t) |
84 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 84 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
85 | if (cred == NULL) | 85 | if (cred == NULL) |
86 | { | 86 | { |
87 | gnutls_assert (); | 87 | gnutls_assert (); |
@@ -90,7 +90,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
90 | 90 | ||
91 | /* find the appropriate certificate */ | 91 | /* find the appropriate certificate */ |
92 | if ((ret = | 92 | if ((ret = |
93 | _gnutls_get_selected_cert (session, &apr_cert_list, | 93 | mhd_gtls_get_selected_cert (session, &apr_cert_list, |
94 | &apr_cert_list_length, &apr_pkey)) < 0) | 94 | &apr_cert_list_length, &apr_pkey)) < 0) |
95 | { | 95 | { |
96 | gnutls_assert (); | 96 | gnutls_assert (); |
@@ -107,7 +107,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | rsa_params = | 109 | rsa_params = |
110 | _gnutls_certificate_get_rsa_params (cred->rsa_params, cred->params_func, | 110 | mhd_gtls_certificate_get_rsa_params (cred->rsa_params, cred->params_func, |
111 | session); | 111 | session); |
112 | rsa_mpis = _gnutls_rsa_params_to_mpi (rsa_params); | 112 | rsa_mpis = _gnutls_rsa_params_to_mpi (rsa_params); |
113 | if (rsa_mpis == NULL) | 113 | if (rsa_mpis == NULL) |
@@ -116,18 +116,18 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
116 | return GNUTLS_E_NO_TEMPORARY_RSA_PARAMS; | 116 | return GNUTLS_E_NO_TEMPORARY_RSA_PARAMS; |
117 | } | 117 | } |
118 | 118 | ||
119 | if ((ret = _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, | 119 | if ((ret = mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, |
120 | sizeof (cert_auth_info_st), 0)) < 0) | 120 | sizeof (cert_auth_info_st), 0)) < 0) |
121 | { | 121 | { |
122 | gnutls_assert (); | 122 | gnutls_assert (); |
123 | return ret; | 123 | return ret; |
124 | } | 124 | } |
125 | 125 | ||
126 | info = _gnutls_get_auth_info (session); | 126 | info = mhd_gtls_get_auth_info (session); |
127 | _gnutls_rsa_export_set_pubkey (session, rsa_mpis[1], rsa_mpis[0]); | 127 | mhd_gtls_rsa_export_set_pubkey (session, rsa_mpis[1], rsa_mpis[0]); |
128 | 128 | ||
129 | _gnutls_mpi_print (NULL, &n_m, rsa_mpis[0]); | 129 | mhd_gtls_mpi_print (NULL, &n_m, rsa_mpis[0]); |
130 | _gnutls_mpi_print (NULL, &n_e, rsa_mpis[1]); | 130 | mhd_gtls_mpi_print (NULL, &n_e, rsa_mpis[1]); |
131 | 131 | ||
132 | (*data) = gnutls_malloc (n_e + n_m + 4); | 132 | (*data) = gnutls_malloc (n_e + n_m + 4); |
133 | if (*data == NULL) | 133 | if (*data == NULL) |
@@ -136,14 +136,14 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | data_m = &(*data)[0]; | 138 | data_m = &(*data)[0]; |
139 | _gnutls_mpi_print (&data_m[2], &n_m, rsa_mpis[0]); | 139 | mhd_gtls_mpi_print (&data_m[2], &n_m, rsa_mpis[0]); |
140 | 140 | ||
141 | _gnutls_write_uint16 (n_m, data_m); | 141 | mhd_gtls_write_uint16 (n_m, data_m); |
142 | 142 | ||
143 | data_e = &data_m[2 + n_m]; | 143 | data_e = &data_m[2 + n_m]; |
144 | _gnutls_mpi_print (&data_e[2], &n_e, rsa_mpis[1]); | 144 | mhd_gtls_mpi_print (&data_e[2], &n_e, rsa_mpis[1]); |
145 | 145 | ||
146 | _gnutls_write_uint16 (n_e, data_e); | 146 | mhd_gtls_write_uint16 (n_e, data_e); |
147 | 147 | ||
148 | data_size = n_m + n_e + 4; | 148 | data_size = n_m + n_e + 4; |
149 | 149 | ||
@@ -156,7 +156,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
156 | if (apr_cert_list_length > 0) | 156 | if (apr_cert_list_length > 0) |
157 | { | 157 | { |
158 | if ((ret = | 158 | if ((ret = |
159 | _gnutls_tls_sign_params (session, &apr_cert_list[0], | 159 | mhd_gtls_tls_sign_params (session, &apr_cert_list[0], |
160 | apr_pkey, &ddata, &signature)) < 0) | 160 | apr_pkey, &ddata, &signature)) < 0) |
161 | { | 161 | { |
162 | gnutls_assert (); | 162 | gnutls_assert (); |
@@ -171,7 +171,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
171 | return data_size; /* do not put a signature - ILLEGAL! */ | 171 | return data_size; /* do not put a signature - ILLEGAL! */ |
172 | } | 172 | } |
173 | 173 | ||
174 | *data = gnutls_realloc_fast (*data, data_size + signature.size + 2); | 174 | *data = mhd_gtls_realloc_fast (*data, data_size + signature.size + 2); |
175 | if (*data == NULL) | 175 | if (*data == NULL) |
176 | { | 176 | { |
177 | _gnutls_free_datum (&signature); | 177 | _gnutls_free_datum (&signature); |
@@ -179,7 +179,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
179 | return GNUTLS_E_MEMORY_ERROR; | 179 | return GNUTLS_E_MEMORY_ERROR; |
180 | } | 180 | } |
181 | 181 | ||
182 | _gnutls_write_datum16 (&((*data)[data_size]), signature); | 182 | mhd_gtls_write_datum16 (&((*data)[data_size]), signature); |
183 | data_size += signature.size + 2; | 183 | data_size += signature.size + 2; |
184 | 184 | ||
185 | _gnutls_free_datum (&signature); | 185 | _gnutls_free_datum (&signature); |
@@ -190,11 +190,11 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) | |||
190 | /* if the peer's certificate is of 512 bits or less, returns non zero. | 190 | /* if the peer's certificate is of 512 bits or less, returns non zero. |
191 | */ | 191 | */ |
192 | int | 192 | int |
193 | _gnutls_peers_cert_less_512 (gnutls_session_t session) | 193 | _gnutls_peers_cert_less_512 (mhd_gtls_session_t session) |
194 | { | 194 | { |
195 | gnutls_cert peer_cert; | 195 | gnutls_cert peer_cert; |
196 | int ret; | 196 | int ret; |
197 | cert_auth_info_t info = _gnutls_get_auth_info (session); | 197 | cert_auth_info_t info = mhd_gtls_get_auth_info (session); |
198 | 198 | ||
199 | if (info == NULL || info->ncerts == 0) | 199 | if (info == NULL || info->ncerts == 0) |
200 | { | 200 | { |
@@ -204,7 +204,7 @@ _gnutls_peers_cert_less_512 (gnutls_session_t session) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | if ((ret = | 206 | if ((ret = |
207 | _gnutls_raw_cert_to_gcert (&peer_cert, | 207 | mhd_gtls_raw_cert_to_gcert (&peer_cert, |
208 | session->security_parameters.cert_type, | 208 | session->security_parameters.cert_type, |
209 | &info->raw_certificate_list[0], | 209 | &info->raw_certificate_list[0], |
210 | CERT_NO_COPY)) < 0) | 210 | CERT_NO_COPY)) < 0) |
@@ -216,23 +216,23 @@ _gnutls_peers_cert_less_512 (gnutls_session_t session) | |||
216 | if (peer_cert.subject_pk_algorithm != MHD_GNUTLS_PK_RSA) | 216 | if (peer_cert.subject_pk_algorithm != MHD_GNUTLS_PK_RSA) |
217 | { | 217 | { |
218 | gnutls_assert (); | 218 | gnutls_assert (); |
219 | _gnutls_gcert_deinit (&peer_cert); | 219 | mhd_gtls_gcert_deinit (&peer_cert); |
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
222 | 222 | ||
223 | if (_gnutls_mpi_get_nbits (peer_cert.params[0]) <= 512) | 223 | if (_gnutls_mpi_get_nbits (peer_cert.params[0]) <= 512) |
224 | { | 224 | { |
225 | _gnutls_gcert_deinit (&peer_cert); | 225 | mhd_gtls_gcert_deinit (&peer_cert); |
226 | return 1; | 226 | return 1; |
227 | } | 227 | } |
228 | 228 | ||
229 | _gnutls_gcert_deinit (&peer_cert); | 229 | mhd_gtls_gcert_deinit (&peer_cert); |
230 | 230 | ||
231 | return 0; | 231 | return 0; |
232 | } | 232 | } |
233 | 233 | ||
234 | static int | 234 | static int |
235 | proc_rsa_export_server_kx (gnutls_session_t session, | 235 | proc_rsa_export_server_kx (mhd_gtls_session_t session, |
236 | opaque * data, size_t _data_size) | 236 | opaque * data, size_t _data_size) |
237 | { | 237 | { |
238 | uint16_t n_m, n_e; | 238 | uint16_t n_m, n_e; |
@@ -246,7 +246,7 @@ proc_rsa_export_server_kx (gnutls_session_t session, | |||
246 | cert_auth_info_t info; | 246 | cert_auth_info_t info; |
247 | gnutls_cert peer_cert; | 247 | gnutls_cert peer_cert; |
248 | 248 | ||
249 | info = _gnutls_get_auth_info (session); | 249 | info = mhd_gtls_get_auth_info (session); |
250 | if (info == NULL || info->ncerts == 0) | 250 | if (info == NULL || info->ncerts == 0) |
251 | { | 251 | { |
252 | gnutls_assert (); | 252 | gnutls_assert (); |
@@ -258,7 +258,7 @@ proc_rsa_export_server_kx (gnutls_session_t session, | |||
258 | i = 0; | 258 | i = 0; |
259 | 259 | ||
260 | DECR_LEN (data_size, 2); | 260 | DECR_LEN (data_size, 2); |
261 | n_m = _gnutls_read_uint16 (&data[i]); | 261 | n_m = mhd_gtls_read_uint16 (&data[i]); |
262 | i += 2; | 262 | i += 2; |
263 | 263 | ||
264 | DECR_LEN (data_size, n_m); | 264 | DECR_LEN (data_size, n_m); |
@@ -266,7 +266,7 @@ proc_rsa_export_server_kx (gnutls_session_t session, | |||
266 | i += n_m; | 266 | i += n_m; |
267 | 267 | ||
268 | DECR_LEN (data_size, 2); | 268 | DECR_LEN (data_size, 2); |
269 | n_e = _gnutls_read_uint16 (&data[i]); | 269 | n_e = mhd_gtls_read_uint16 (&data[i]); |
270 | i += 2; | 270 | i += 2; |
271 | 271 | ||
272 | DECR_LEN (data_size, n_e); | 272 | DECR_LEN (data_size, n_e); |
@@ -276,19 +276,19 @@ proc_rsa_export_server_kx (gnutls_session_t session, | |||
276 | _n_e = n_e; | 276 | _n_e = n_e; |
277 | _n_m = n_m; | 277 | _n_m = n_m; |
278 | 278 | ||
279 | if (_gnutls_mpi_scan_nz (&session->key->rsa[0], data_m, &_n_m) != 0) | 279 | if (mhd_gtls_mpi_scan_nz (&session->key->rsa[0], data_m, &_n_m) != 0) |
280 | { | 280 | { |
281 | gnutls_assert (); | 281 | gnutls_assert (); |
282 | return GNUTLS_E_MPI_SCAN_FAILED; | 282 | return GNUTLS_E_MPI_SCAN_FAILED; |
283 | } | 283 | } |
284 | 284 | ||
285 | if (_gnutls_mpi_scan_nz (&session->key->rsa[1], data_e, &_n_e) != 0) | 285 | if (mhd_gtls_mpi_scan_nz (&session->key->rsa[1], data_e, &_n_e) != 0) |
286 | { | 286 | { |
287 | gnutls_assert (); | 287 | gnutls_assert (); |
288 | return GNUTLS_E_MPI_SCAN_FAILED; | 288 | return GNUTLS_E_MPI_SCAN_FAILED; |
289 | } | 289 | } |
290 | 290 | ||
291 | _gnutls_rsa_export_set_pubkey (session, session->key->rsa[1], | 291 | mhd_gtls_rsa_export_set_pubkey (session, session->key->rsa[1], |
292 | session->key->rsa[0]); | 292 | session->key->rsa[0]); |
293 | 293 | ||
294 | /* VERIFY SIGNATURE */ | 294 | /* VERIFY SIGNATURE */ |
@@ -297,14 +297,14 @@ proc_rsa_export_server_kx (gnutls_session_t session, | |||
297 | vparams.data = data; | 297 | vparams.data = data; |
298 | 298 | ||
299 | DECR_LEN (data_size, 2); | 299 | DECR_LEN (data_size, 2); |
300 | sigsize = _gnutls_read_uint16 (&data[vparams.size]); | 300 | sigsize = mhd_gtls_read_uint16 (&data[vparams.size]); |
301 | 301 | ||
302 | DECR_LEN (data_size, sigsize); | 302 | DECR_LEN (data_size, sigsize); |
303 | signature.data = &data[vparams.size + 2]; | 303 | signature.data = &data[vparams.size + 2]; |
304 | signature.size = sigsize; | 304 | signature.size = sigsize; |
305 | 305 | ||
306 | if ((ret = | 306 | if ((ret = |
307 | _gnutls_raw_cert_to_gcert (&peer_cert, | 307 | mhd_gtls_raw_cert_to_gcert (&peer_cert, |
308 | session->security_parameters.cert_type, | 308 | session->security_parameters.cert_type, |
309 | &info->raw_certificate_list[0], | 309 | &info->raw_certificate_list[0], |
310 | CERT_NO_COPY)) < 0) | 310 | CERT_NO_COPY)) < 0) |
@@ -313,9 +313,9 @@ proc_rsa_export_server_kx (gnutls_session_t session, | |||
313 | return ret; | 313 | return ret; |
314 | } | 314 | } |
315 | 315 | ||
316 | ret = _gnutls_verify_sig_params (session, &peer_cert, &vparams, &signature); | 316 | ret = mhd_gtls_verify_sig_params (session, &peer_cert, &vparams, &signature); |
317 | 317 | ||
318 | _gnutls_gcert_deinit (&peer_cert); | 318 | mhd_gtls_gcert_deinit (&peer_cert); |
319 | if (ret < 0) | 319 | if (ret < 0) |
320 | { | 320 | { |
321 | gnutls_assert (); | 321 | gnutls_assert (); |
diff --git a/src/daemon/https/tls/debug.c b/src/daemon/https/tls/debug.c index 2ea31577..14c7b494 100644 --- a/src/daemon/https/tls/debug.c +++ b/src/daemon/https/tls/debug.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | 33 | ||
34 | void | 34 | void |
35 | _gnutls_print_state (gnutls_session_t session) | 35 | _gnutls_print_state (mhd_gtls_session_t session) |
36 | { | 36 | { |
37 | 37 | ||
38 | _gnutls_debug_log ("GNUTLS State:\n"); | 38 | _gnutls_debug_log ("GNUTLS State:\n"); |
diff --git a/src/daemon/https/tls/debug.h b/src/daemon/https/tls/debug.h index 169bc21d..ccaf0f17 100644 --- a/src/daemon/https/tls/debug.h +++ b/src/daemon/https/tls/debug.h | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifdef DEBUG | 25 | #ifdef DEBUG |
26 | void _gnutls_print_state (gnutls_session_t session); | 26 | void _gnutls_print_state (mhd_gtls_session_t session); |
27 | #endif | 27 | #endif |
28 | const char *_gnutls_packet2str (content_type_t packet); | 28 | const char *_gnutls_packet2str (content_type_t packet); |
29 | const char *_gnutls_handshake2str (gnutls_handshake_description_t handshake); | 29 | const char *_gnutls_handshake2str (gnutls_handshake_description_t handshake); |
diff --git a/src/daemon/https/tls/ext_cert_type.c b/src/daemon/https/tls/ext_cert_type.c index a1bec6a1..fbbbab79 100644 --- a/src/daemon/https/tls/ext_cert_type.c +++ b/src/daemon/https/tls/ext_cert_type.c | |||
@@ -46,7 +46,7 @@ inline static int _gnutls_cert_type2num (int record_size); | |||
46 | */ | 46 | */ |
47 | 47 | ||
48 | int | 48 | int |
49 | _gnutls_cert_type_recv_params (gnutls_session_t session, | 49 | mhd_gtls_cert_type_recv_params (mhd_gtls_session_t session, |
50 | const opaque * data, size_t _data_size) | 50 | const opaque * data, size_t _data_size) |
51 | { | 51 | { |
52 | int new_type = -1, ret, i; | 52 | int new_type = -1, ret, i; |
@@ -72,7 +72,7 @@ _gnutls_cert_type_recv_params (gnutls_session_t session, | |||
72 | 72 | ||
73 | /* Check if we support this cert_type */ | 73 | /* Check if we support this cert_type */ |
74 | if ((ret = | 74 | if ((ret = |
75 | _gnutls_session_cert_type_supported (session, new_type)) < 0) | 75 | mhd_gtls_session_cert_type_supported (session, new_type)) < 0) |
76 | { | 76 | { |
77 | gnutls_assert (); | 77 | gnutls_assert (); |
78 | return ret; | 78 | return ret; |
@@ -100,7 +100,7 @@ _gnutls_cert_type_recv_params (gnutls_session_t session, | |||
100 | 100 | ||
101 | /* Check if we support this cert_type */ | 101 | /* Check if we support this cert_type */ |
102 | if ((ret = | 102 | if ((ret = |
103 | _gnutls_session_cert_type_supported (session, | 103 | mhd_gtls_session_cert_type_supported (session, |
104 | new_type)) < 0) | 104 | new_type)) < 0) |
105 | { | 105 | { |
106 | gnutls_assert (); | 106 | gnutls_assert (); |
@@ -118,7 +118,7 @@ _gnutls_cert_type_recv_params (gnutls_session_t session, | |||
118 | } | 118 | } |
119 | 119 | ||
120 | if ((ret = | 120 | if ((ret = |
121 | _gnutls_session_cert_type_supported (session, new_type)) < 0) | 121 | mhd_gtls_session_cert_type_supported (session, new_type)) < 0) |
122 | { | 122 | { |
123 | gnutls_assert (); | 123 | gnutls_assert (); |
124 | /* The peer has requested unsupported certificate | 124 | /* The peer has requested unsupported certificate |
@@ -141,7 +141,7 @@ _gnutls_cert_type_recv_params (gnutls_session_t session, | |||
141 | /* returns data_size or a negative number on failure | 141 | /* returns data_size or a negative number on failure |
142 | */ | 142 | */ |
143 | int | 143 | int |
144 | _gnutls_cert_type_send_params (gnutls_session_t session, opaque * data, | 144 | mhd_gtls_cert_type_send_params (mhd_gtls_session_t session, opaque * data, |
145 | size_t data_size) | 145 | size_t data_size) |
146 | { | 146 | { |
147 | unsigned len, i; | 147 | unsigned len, i; |
diff --git a/src/daemon/https/tls/ext_cert_type.h b/src/daemon/https/tls/ext_cert_type.h index ea7cf219..616e1e7f 100644 --- a/src/daemon/https/tls/ext_cert_type.h +++ b/src/daemon/https/tls/ext_cert_type.h | |||
@@ -25,7 +25,7 @@ | |||
25 | /* Maps record size to numbers according to the | 25 | /* Maps record size to numbers according to the |
26 | * extensions draft. | 26 | * extensions draft. |
27 | */ | 27 | */ |
28 | int _gnutls_cert_type_recv_params (gnutls_session_t session, | 28 | int mhd_gtls_cert_type_recv_params (mhd_gtls_session_t session, |
29 | const opaque * data, size_t data_size); | 29 | const opaque * data, size_t data_size); |
30 | int _gnutls_cert_type_send_params (gnutls_session_t session, opaque * data, | 30 | int mhd_gtls_cert_type_send_params (mhd_gtls_session_t session, opaque * data, |
31 | size_t); | 31 | size_t); |
diff --git a/src/daemon/https/tls/ext_inner_application.c b/src/daemon/https/tls/ext_inner_application.c index 763e8cbf..a2276589 100644 --- a/src/daemon/https/tls/ext_inner_application.c +++ b/src/daemon/https/tls/ext_inner_application.c | |||
@@ -32,10 +32,10 @@ | |||
32 | #define YES 1 | 32 | #define YES 1 |
33 | 33 | ||
34 | int | 34 | int |
35 | _gnutls_inner_application_recv_params (gnutls_session_t session, | 35 | mhd_gtls_inner_app_rcv_params (mhd_gtls_session_t session, |
36 | const opaque * data, size_t data_size) | 36 | const opaque * data, size_t data_size) |
37 | { | 37 | { |
38 | tls_ext_st *ext = &session->security_parameters.extensions; | 38 | mhd_gtls_ext_st *ext = &session->security_parameters.extensions; |
39 | 39 | ||
40 | if (data_size != 1) | 40 | if (data_size != 1) |
41 | { | 41 | { |
@@ -66,10 +66,10 @@ _gnutls_inner_application_recv_params (gnutls_session_t session, | |||
66 | /* returns data_size or a negative number on failure | 66 | /* returns data_size or a negative number on failure |
67 | */ | 67 | */ |
68 | int | 68 | int |
69 | _gnutls_inner_application_send_params (gnutls_session_t session, | 69 | mhd_gtls_inner_app_send_params (mhd_gtls_session_t session, |
70 | opaque * data, size_t data_size) | 70 | opaque * data, size_t data_size) |
71 | { | 71 | { |
72 | tls_ext_st *ext = &session->security_parameters.extensions; | 72 | mhd_gtls_ext_st *ext = &session->security_parameters.extensions; |
73 | 73 | ||
74 | /* Set ext->gnutls_ia_enable depending on whether we have a TLS/IA | 74 | /* Set ext->gnutls_ia_enable depending on whether we have a TLS/IA |
75 | credential in the session. */ | 75 | credential in the session. */ |
@@ -77,7 +77,7 @@ _gnutls_inner_application_send_params (gnutls_session_t session, | |||
77 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 77 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
78 | { | 78 | { |
79 | gnutls_ia_client_credentials_t cred = (gnutls_ia_client_credentials_t) | 79 | gnutls_ia_client_credentials_t cred = (gnutls_ia_client_credentials_t) |
80 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); | 80 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); |
81 | 81 | ||
82 | if (cred) | 82 | if (cred) |
83 | ext->gnutls_ia_enable = 1; | 83 | ext->gnutls_ia_enable = 1; |
@@ -85,7 +85,7 @@ _gnutls_inner_application_send_params (gnutls_session_t session, | |||
85 | else | 85 | else |
86 | { | 86 | { |
87 | gnutls_ia_server_credentials_t cred = (gnutls_ia_server_credentials_t) | 87 | gnutls_ia_server_credentials_t cred = (gnutls_ia_server_credentials_t) |
88 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); | 88 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_IA, NULL); |
89 | 89 | ||
90 | if (cred) | 90 | if (cred) |
91 | ext->gnutls_ia_enable = 1; | 91 | ext->gnutls_ia_enable = 1; |
diff --git a/src/daemon/https/tls/ext_inner_application.h b/src/daemon/https/tls/ext_inner_application.h index e75719e3..c863fcaa 100644 --- a/src/daemon/https/tls/ext_inner_application.h +++ b/src/daemon/https/tls/ext_inner_application.h | |||
@@ -22,8 +22,8 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_inner_application_recv_params (gnutls_session_t session, | 25 | int mhd_gtls_inner_app_rcv_params (mhd_gtls_session_t session, |
26 | const opaque * data, | 26 | const opaque * data, |
27 | size_t data_size); | 27 | size_t data_size); |
28 | int _gnutls_inner_application_send_params (gnutls_session_t session, | 28 | int mhd_gtls_inner_app_send_params (mhd_gtls_session_t session, |
29 | opaque * data, size_t); | 29 | opaque * data, size_t); |
diff --git a/src/daemon/https/tls/ext_max_record.c b/src/daemon/https/tls/ext_max_record.c index d0787483..3f4ac68a 100644 --- a/src/daemon/https/tls/ext_max_record.c +++ b/src/daemon/https/tls/ext_max_record.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | 42 | ||
43 | int | 43 | int |
44 | _gnutls_max_record_recv_params (gnutls_session_t session, | 44 | mhd_gtls_max_record_recv_params (mhd_gtls_session_t session, |
45 | const opaque * data, size_t _data_size) | 45 | const opaque * data, size_t _data_size) |
46 | { | 46 | { |
47 | ssize_t new_size; | 47 | ssize_t new_size; |
@@ -53,7 +53,7 @@ _gnutls_max_record_recv_params (gnutls_session_t session, | |||
53 | { | 53 | { |
54 | DECR_LEN (data_size, 1); | 54 | DECR_LEN (data_size, 1); |
55 | 55 | ||
56 | new_size = _gnutls_mre_num2record (data[0]); | 56 | new_size = mhd_gtls_mre_num2record (data[0]); |
57 | 57 | ||
58 | if (new_size < 0) | 58 | if (new_size < 0) |
59 | { | 59 | { |
@@ -77,7 +77,7 @@ _gnutls_max_record_recv_params (gnutls_session_t session, | |||
77 | return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; | 77 | return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; |
78 | } | 78 | } |
79 | 79 | ||
80 | new_size = _gnutls_mre_num2record (data[0]); | 80 | new_size = mhd_gtls_mre_num2record (data[0]); |
81 | 81 | ||
82 | if (new_size < 0 | 82 | if (new_size < 0 |
83 | || new_size != session->internals.proposed_record_size) | 83 | || new_size != session->internals.proposed_record_size) |
@@ -102,7 +102,7 @@ _gnutls_max_record_recv_params (gnutls_session_t session, | |||
102 | /* returns data_size or a negative number on failure | 102 | /* returns data_size or a negative number on failure |
103 | */ | 103 | */ |
104 | int | 104 | int |
105 | _gnutls_max_record_send_params (gnutls_session_t session, opaque * data, | 105 | mhd_gtls_max_record_send_params (mhd_gtls_session_t session, opaque * data, |
106 | size_t data_size) | 106 | size_t data_size) |
107 | { | 107 | { |
108 | uint16_t len; | 108 | uint16_t len; |
@@ -120,7 +120,7 @@ _gnutls_max_record_send_params (gnutls_session_t session, opaque * data, | |||
120 | } | 120 | } |
121 | 121 | ||
122 | data[0] = | 122 | data[0] = |
123 | (uint8_t) _gnutls_mre_record2num (session->internals. | 123 | (uint8_t) mhd_gtls_mre_record2num (session->internals. |
124 | proposed_record_size); | 124 | proposed_record_size); |
125 | return len; | 125 | return len; |
126 | } | 126 | } |
@@ -140,7 +140,7 @@ _gnutls_max_record_send_params (gnutls_session_t session, opaque * data, | |||
140 | } | 140 | } |
141 | 141 | ||
142 | data[0] = | 142 | data[0] = |
143 | (uint8_t) _gnutls_mre_record2num (session-> | 143 | (uint8_t) mhd_gtls_mre_record2num (session-> |
144 | security_parameters. | 144 | security_parameters. |
145 | max_record_recv_size); | 145 | max_record_recv_size); |
146 | return len; | 146 | return len; |
@@ -156,7 +156,7 @@ _gnutls_max_record_send_params (gnutls_session_t session, opaque * data, | |||
156 | * extensions draft. | 156 | * extensions draft. |
157 | */ | 157 | */ |
158 | int | 158 | int |
159 | _gnutls_mre_num2record (int num) | 159 | mhd_gtls_mre_num2record (int num) |
160 | { | 160 | { |
161 | switch (num) | 161 | switch (num) |
162 | { | 162 | { |
@@ -177,7 +177,7 @@ _gnutls_mre_num2record (int num) | |||
177 | * extensions draft. | 177 | * extensions draft. |
178 | */ | 178 | */ |
179 | int | 179 | int |
180 | _gnutls_mre_record2num (uint16_t record_size) | 180 | mhd_gtls_mre_record2num (uint16_t record_size) |
181 | { | 181 | { |
182 | switch (record_size) | 182 | switch (record_size) |
183 | { | 183 | { |
diff --git a/src/daemon/https/tls/ext_max_record.h b/src/daemon/https/tls/ext_max_record.h index 751bedc8..487fe40d 100644 --- a/src/daemon/https/tls/ext_max_record.h +++ b/src/daemon/https/tls/ext_max_record.h | |||
@@ -25,9 +25,9 @@ | |||
25 | /* Maps record size to numbers according to the | 25 | /* Maps record size to numbers according to the |
26 | * extensions draft. | 26 | * extensions draft. |
27 | */ | 27 | */ |
28 | int _gnutls_mre_num2record (int num); | 28 | int mhd_gtls_mre_num2record (int num); |
29 | int _gnutls_mre_record2num (uint16_t record_size); | 29 | int mhd_gtls_mre_record2num (uint16_t record_size); |
30 | int _gnutls_max_record_recv_params (gnutls_session_t session, | 30 | int mhd_gtls_max_record_recv_params (mhd_gtls_session_t session, |
31 | const opaque * data, size_t data_size); | 31 | const opaque * data, size_t data_size); |
32 | int _gnutls_max_record_send_params (gnutls_session_t session, opaque * data, | 32 | int mhd_gtls_max_record_send_params (mhd_gtls_session_t session, opaque * data, |
33 | size_t); | 33 | size_t); |
diff --git a/src/daemon/https/tls/ext_oprfi.c b/src/daemon/https/tls/ext_oprfi.c index 56a3bc3f..f8bd4953 100644 --- a/src/daemon/https/tls/ext_oprfi.c +++ b/src/daemon/https/tls/ext_oprfi.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <gnutls_num.h> | 33 | #include <gnutls_num.h> |
34 | 34 | ||
35 | int | 35 | int |
36 | oprfi_recv_server (gnutls_session_t session, | 36 | oprfi_recv_server (mhd_gtls_session_t session, |
37 | const opaque * data, size_t _data_size) | 37 | const opaque * data, size_t _data_size) |
38 | { | 38 | { |
39 | ssize_t data_size = _data_size; | 39 | ssize_t data_size = _data_size; |
@@ -46,7 +46,7 @@ oprfi_recv_server (gnutls_session_t session, | |||
46 | } | 46 | } |
47 | 47 | ||
48 | DECR_LEN (data_size, 2); | 48 | DECR_LEN (data_size, 2); |
49 | len = _gnutls_read_uint16 (data); | 49 | len = mhd_gtls_read_uint16 (data); |
50 | data += 2; | 50 | data += 2; |
51 | 51 | ||
52 | if (len != data_size) | 52 | if (len != data_size) |
@@ -69,7 +69,7 @@ oprfi_recv_server (gnutls_session_t session, | |||
69 | } | 69 | } |
70 | 70 | ||
71 | int | 71 | int |
72 | oprfi_recv_client (gnutls_session_t session, | 72 | oprfi_recv_client (mhd_gtls_session_t session, |
73 | const opaque * data, size_t _data_size) | 73 | const opaque * data, size_t _data_size) |
74 | { | 74 | { |
75 | ssize_t data_size = _data_size; | 75 | ssize_t data_size = _data_size; |
@@ -82,7 +82,7 @@ oprfi_recv_client (gnutls_session_t session, | |||
82 | } | 82 | } |
83 | 83 | ||
84 | DECR_LEN (data_size, 2); | 84 | DECR_LEN (data_size, 2); |
85 | len = _gnutls_read_uint16 (data); | 85 | len = mhd_gtls_read_uint16 (data); |
86 | data += 2; | 86 | data += 2; |
87 | 87 | ||
88 | if (len != data_size) | 88 | if (len != data_size) |
@@ -111,7 +111,7 @@ oprfi_recv_client (gnutls_session_t session, | |||
111 | } | 111 | } |
112 | 112 | ||
113 | int | 113 | int |
114 | _gnutls_oprfi_recv_params (gnutls_session_t session, | 114 | mhd_gtls_oprfi_recv_params (mhd_gtls_session_t session, |
115 | const opaque * data, size_t data_size) | 115 | const opaque * data, size_t data_size) |
116 | { | 116 | { |
117 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 117 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
@@ -121,7 +121,7 @@ _gnutls_oprfi_recv_params (gnutls_session_t session, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | int | 123 | int |
124 | oprfi_send_client (gnutls_session_t session, opaque * data, size_t _data_size) | 124 | oprfi_send_client (mhd_gtls_session_t session, opaque * data, size_t _data_size) |
125 | { | 125 | { |
126 | opaque *p = data; | 126 | opaque *p = data; |
127 | ssize_t data_size = _data_size; | 127 | ssize_t data_size = _data_size; |
@@ -131,7 +131,7 @@ oprfi_send_client (gnutls_session_t session, opaque * data, size_t _data_size) | |||
131 | return 0; | 131 | return 0; |
132 | 132 | ||
133 | DECR_LENGTH_RET (data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER); | 133 | DECR_LENGTH_RET (data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER); |
134 | _gnutls_write_uint16 (oprf_size, p); | 134 | mhd_gtls_write_uint16 (oprf_size, p); |
135 | p += 2; | 135 | p += 2; |
136 | 136 | ||
137 | DECR_LENGTH_RET (data_size, oprf_size, GNUTLS_E_SHORT_MEMORY_BUFFER); | 137 | DECR_LENGTH_RET (data_size, oprf_size, GNUTLS_E_SHORT_MEMORY_BUFFER); |
@@ -142,7 +142,7 @@ oprfi_send_client (gnutls_session_t session, opaque * data, size_t _data_size) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | int | 144 | int |
145 | oprfi_send_server (gnutls_session_t session, opaque * data, size_t _data_size) | 145 | oprfi_send_server (mhd_gtls_session_t session, opaque * data, size_t _data_size) |
146 | { | 146 | { |
147 | opaque *p = data; | 147 | opaque *p = data; |
148 | int ret; | 148 | int ret; |
@@ -177,7 +177,7 @@ oprfi_send_server (gnutls_session_t session, opaque * data, size_t _data_size) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | DECR_LENGTH_RET (data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER); | 179 | DECR_LENGTH_RET (data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER); |
180 | _gnutls_write_uint16 (session->security_parameters. | 180 | mhd_gtls_write_uint16 (session->security_parameters. |
181 | extensions.oprfi_server_len, p); | 181 | extensions.oprfi_server_len, p); |
182 | p += 2; | 182 | p += 2; |
183 | 183 | ||
@@ -191,7 +191,7 @@ oprfi_send_server (gnutls_session_t session, opaque * data, size_t _data_size) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | int | 193 | int |
194 | _gnutls_oprfi_send_params (gnutls_session_t session, | 194 | mhd_gtls_oprfi_send_params (mhd_gtls_session_t session, |
195 | opaque * data, size_t data_size) | 195 | opaque * data, size_t data_size) |
196 | { | 196 | { |
197 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 197 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
@@ -201,8 +201,8 @@ _gnutls_oprfi_send_params (gnutls_session_t session, | |||
201 | } | 201 | } |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * gnutls_oprfi_enable_client: | 204 | * MHD_gtls_oprfi_enable_client: |
205 | * @session: is a #gnutls_session_t structure. | 205 | * @session: is a #mhd_gtls_session_t structure. |
206 | * @len: length of Opaque PRF data to use in client. | 206 | * @len: length of Opaque PRF data to use in client. |
207 | * @data: Opaque PRF data to use in client. | 207 | * @data: Opaque PRF data to use in client. |
208 | * | 208 | * |
@@ -214,7 +214,7 @@ _gnutls_oprfi_send_params (gnutls_session_t session, | |||
214 | * may de-allocate it immediately after calling this function. | 214 | * may de-allocate it immediately after calling this function. |
215 | **/ | 215 | **/ |
216 | void | 216 | void |
217 | gnutls_oprfi_enable_client (gnutls_session_t session, | 217 | MHD_gtls_oprfi_enable_client (mhd_gtls_session_t session, |
218 | size_t len, unsigned char *data) | 218 | size_t len, unsigned char *data) |
219 | { | 219 | { |
220 | session->security_parameters.extensions.oprfi_client_len = len; | 220 | session->security_parameters.extensions.oprfi_client_len = len; |
@@ -222,8 +222,8 @@ gnutls_oprfi_enable_client (gnutls_session_t session, | |||
222 | } | 222 | } |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * gnutls_oprfi_enable_server: | 225 | * MHD_gtls_oprfi_enable_server: |
226 | * @session: is a #gnutls_session_t structure. | 226 | * @session: is a #mhd_gtls_session_t structure. |
227 | * @cb: function pointer to Opaque PRF extension server callback. | 227 | * @cb: function pointer to Opaque PRF extension server callback. |
228 | * @userdata: hook passed to callback function for passing application state. | 228 | * @userdata: hook passed to callback function for passing application state. |
229 | * | 229 | * |
@@ -232,7 +232,7 @@ gnutls_oprfi_enable_client (gnutls_session_t session, | |||
232 | * provided callback @cb will be invoked. The callback must have the | 232 | * provided callback @cb will be invoked. The callback must have the |
233 | * following prototype: | 233 | * following prototype: |
234 | * | 234 | * |
235 | * int callback (gnutls_session_t session, void *userdata, | 235 | * int callback (mhd_gtls_session_t session, void *userdata, |
236 | * size_t oprfi_len, const unsigned char *in_oprfi, | 236 | * size_t oprfi_len, const unsigned char *in_oprfi, |
237 | * unsigned char *out_oprfi); | 237 | * unsigned char *out_oprfi); |
238 | * | 238 | * |
@@ -242,7 +242,7 @@ gnutls_oprfi_enable_client (gnutls_session_t session, | |||
242 | * handshake will be aborted. | 242 | * handshake will be aborted. |
243 | **/ | 243 | **/ |
244 | void | 244 | void |
245 | gnutls_oprfi_enable_server (gnutls_session_t session, | 245 | MHD_gtls_oprfi_enable_server (mhd_gtls_session_t session, |
246 | gnutls_oprfi_callback_func cb, void *userdata) | 246 | gnutls_oprfi_callback_func cb, void *userdata) |
247 | { | 247 | { |
248 | session->security_parameters.extensions.oprfi_cb = cb; | 248 | session->security_parameters.extensions.oprfi_cb = cb; |
diff --git a/src/daemon/https/tls/ext_oprfi.h b/src/daemon/https/tls/ext_oprfi.h index 7f75be9c..27a9c96a 100644 --- a/src/daemon/https/tls/ext_oprfi.h +++ b/src/daemon/https/tls/ext_oprfi.h | |||
@@ -24,10 +24,10 @@ | |||
24 | 24 | ||
25 | #include <gnutls_int.h> | 25 | #include <gnutls_int.h> |
26 | 26 | ||
27 | int _gnutls_oprfi_recv_params (gnutls_session_t state, | 27 | int mhd_gtls_oprfi_recv_params (mhd_gtls_session_t state, |
28 | const opaque * data, | 28 | const opaque * data, |
29 | size_t data_size); | 29 | size_t data_size); |
30 | 30 | ||
31 | int _gnutls_oprfi_send_params (gnutls_session_t state, | 31 | int mhd_gtls_oprfi_send_params (mhd_gtls_session_t state, |
32 | opaque * data, | 32 | opaque * data, |
33 | size_t data_size); | 33 | size_t data_size); |
diff --git a/src/daemon/https/tls/ext_server_name.c b/src/daemon/https/tls/ext_server_name.c index bc6b4759..9dc1f3bb 100644 --- a/src/daemon/https/tls/ext_server_name.c +++ b/src/daemon/https/tls/ext_server_name.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | int | 41 | int |
42 | _gnutls_server_name_recv_params (gnutls_session_t session, | 42 | mhd_gtls_server_name_recv_params (mhd_gtls_session_t session, |
43 | const opaque * data, size_t _data_size) | 43 | const opaque * data, size_t _data_size) |
44 | { | 44 | { |
45 | int i; | 45 | int i; |
@@ -51,7 +51,7 @@ _gnutls_server_name_recv_params (gnutls_session_t session, | |||
51 | if (session->security_parameters.entity == GNUTLS_SERVER) | 51 | if (session->security_parameters.entity == GNUTLS_SERVER) |
52 | { | 52 | { |
53 | DECR_LENGTH_RET (data_size, 2, 0); | 53 | DECR_LENGTH_RET (data_size, 2, 0); |
54 | len = _gnutls_read_uint16 (data); | 54 | len = mhd_gtls_read_uint16 (data); |
55 | 55 | ||
56 | if (len != data_size) | 56 | if (len != data_size) |
57 | { | 57 | { |
@@ -71,7 +71,7 @@ _gnutls_server_name_recv_params (gnutls_session_t session, | |||
71 | p++; | 71 | p++; |
72 | 72 | ||
73 | DECR_LEN (data_size, 2); | 73 | DECR_LEN (data_size, 2); |
74 | len = _gnutls_read_uint16 (p); | 74 | len = mhd_gtls_read_uint16 (p); |
75 | p += 2; | 75 | p += 2; |
76 | 76 | ||
77 | DECR_LENGTH_RET (data_size, len, 0); | 77 | DECR_LENGTH_RET (data_size, len, 0); |
@@ -96,7 +96,7 @@ _gnutls_server_name_recv_params (gnutls_session_t session, | |||
96 | type = *p; | 96 | type = *p; |
97 | p++; | 97 | p++; |
98 | 98 | ||
99 | len = _gnutls_read_uint16 (p); | 99 | len = mhd_gtls_read_uint16 (p); |
100 | p += 2; | 100 | p += 2; |
101 | 101 | ||
102 | switch (type) | 102 | switch (type) |
@@ -124,7 +124,7 @@ _gnutls_server_name_recv_params (gnutls_session_t session, | |||
124 | /* returns data_size or a negative number on failure | 124 | /* returns data_size or a negative number on failure |
125 | */ | 125 | */ |
126 | int | 126 | int |
127 | _gnutls_server_name_send_params (gnutls_session_t session, | 127 | mhd_gtls_server_name_send_params (mhd_gtls_session_t session, |
128 | opaque * data, size_t _data_size) | 128 | opaque * data, size_t _data_size) |
129 | { | 129 | { |
130 | uint16_t len; | 130 | uint16_t len; |
@@ -163,7 +163,7 @@ _gnutls_server_name_send_params (gnutls_session_t session, | |||
163 | /* UINT16: write total size of all names | 163 | /* UINT16: write total size of all names |
164 | */ | 164 | */ |
165 | DECR_LENGTH_RET (data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER); | 165 | DECR_LENGTH_RET (data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER); |
166 | _gnutls_write_uint16 (total_size - 2, p); | 166 | mhd_gtls_write_uint16 (total_size - 2, p); |
167 | p += 2; | 167 | p += 2; |
168 | 168 | ||
169 | for (i = 0; | 169 | for (i = 0; |
@@ -191,7 +191,7 @@ _gnutls_server_name_send_params (gnutls_session_t session, | |||
191 | *p = 0; /* NAME_DNS type */ | 191 | *p = 0; /* NAME_DNS type */ |
192 | p++; | 192 | p++; |
193 | 193 | ||
194 | _gnutls_write_uint16 (len, p); | 194 | mhd_gtls_write_uint16 (len, p); |
195 | p += 2; | 195 | p += 2; |
196 | 196 | ||
197 | memcpy (p, | 197 | memcpy (p, |
@@ -210,8 +210,8 @@ _gnutls_server_name_send_params (gnutls_session_t session, | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /** | 212 | /** |
213 | * gnutls_server_name_get - Used to get the server name indicator send by a client | 213 | * MHD_gnutls_server_name_get - Used to get the server name indicator send by a client |
214 | * @session: is a #gnutls_session_t structure. | 214 | * @session: is a #mhd_gtls_session_t structure. |
215 | * @data: will hold the data | 215 | * @data: will hold the data |
216 | * @data_length: will hold the data length. Must hold the maximum size of data. | 216 | * @data_length: will hold the data length. Must hold the maximum size of data. |
217 | * @type: will hold the server name indicator type | 217 | * @type: will hold the server name indicator type |
@@ -233,7 +233,7 @@ _gnutls_server_name_send_params (gnutls_session_t session, | |||
233 | * | 233 | * |
234 | **/ | 234 | **/ |
235 | int | 235 | int |
236 | gnutls_server_name_get (gnutls_session_t session, void *data, | 236 | MHD_gnutls_server_name_get (mhd_gtls_session_t session, void *data, |
237 | size_t * data_length, | 237 | size_t * data_length, |
238 | unsigned int *type, unsigned int indx) | 238 | unsigned int *type, unsigned int indx) |
239 | { | 239 | { |
@@ -278,8 +278,8 @@ gnutls_server_name_get (gnutls_session_t session, void *data, | |||
278 | } | 278 | } |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * gnutls_server_name_set - Used to set a name indicator to be sent as an extension | 281 | * MHD_gnutls_server_name_set - Used to set a name indicator to be sent as an extension |
282 | * @session: is a #gnutls_session_t structure. | 282 | * @session: is a #mhd_gtls_session_t structure. |
283 | * @type: specifies the indicator type | 283 | * @type: specifies the indicator type |
284 | * @name: is a string that contains the server name. | 284 | * @name: is a string that contains the server name. |
285 | * @name_length: holds the length of name | 285 | * @name_length: holds the length of name |
@@ -295,7 +295,7 @@ gnutls_server_name_get (gnutls_session_t session, void *data, | |||
295 | * | 295 | * |
296 | **/ | 296 | **/ |
297 | int | 297 | int |
298 | gnutls_server_name_set (gnutls_session_t session, | 298 | MHD_gnutls_server_name_set (mhd_gtls_session_t session, |
299 | gnutls_server_name_type_t type, | 299 | gnutls_server_name_type_t type, |
300 | const void *name, size_t name_length) | 300 | const void *name, size_t name_length) |
301 | { | 301 | { |
diff --git a/src/daemon/https/tls/ext_server_name.h b/src/daemon/https/tls/ext_server_name.h index 91e727a1..7a471ad4 100644 --- a/src/daemon/https/tls/ext_server_name.h +++ b/src/daemon/https/tls/ext_server_name.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_server_name_recv_params (gnutls_session_t session, | 25 | int mhd_gtls_server_name_recv_params (mhd_gtls_session_t session, |
26 | const opaque * data, size_t data_size); | 26 | const opaque * data, size_t data_size); |
27 | int _gnutls_server_name_send_params (gnutls_session_t session, | 27 | int mhd_gtls_server_name_send_params (mhd_gtls_session_t session, |
28 | opaque * data, size_t); | 28 | opaque * data, size_t); |
diff --git a/src/daemon/https/tls/gnutls_alert.c b/src/daemon/https/tls/gnutls_alert.c index 29422dab..3a97365f 100644 --- a/src/daemon/https/tls/gnutls_alert.c +++ b/src/daemon/https/tls/gnutls_alert.c | |||
@@ -80,15 +80,15 @@ static const gnutls_alert_entry sup_alerts[] = { | |||
80 | 80 | ||
81 | 81 | ||
82 | /** | 82 | /** |
83 | * gnutls_alert_get_name - Returns a string describing the alert number given | 83 | * MHD_gnutls_alert_get_name - Returns a string describing the alert number given |
84 | * @alert: is an alert number #gnutls_session_t structure. | 84 | * @alert: is an alert number #mhd_gtls_session_t structure. |
85 | * | 85 | * |
86 | * This function will return a string that describes the given alert | 86 | * This function will return a string that describes the given alert |
87 | * number or NULL. See gnutls_alert_get(). | 87 | * number or NULL. See gnutls_alert_get(). |
88 | * | 88 | * |
89 | **/ | 89 | **/ |
90 | const char * | 90 | const char * |
91 | gnutls_alert_get_name (gnutls_alert_description_t alert) | 91 | MHD_gnutls_alert_get_name (gnutls_alert_description_t alert) |
92 | { | 92 | { |
93 | const char *ret = NULL; | 93 | const char *ret = NULL; |
94 | 94 | ||
@@ -98,8 +98,8 @@ gnutls_alert_get_name (gnutls_alert_description_t alert) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * gnutls_alert_send - This function sends an alert message to the peer | 101 | * MHD_gnutls_alert_send - This function sends an alert message to the peer |
102 | * @session: is a #gnutls_session_t structure. | 102 | * @session: is a #mhd_gtls_session_t structure. |
103 | * @level: is the level of the alert | 103 | * @level: is the level of the alert |
104 | * @desc: is the alert description | 104 | * @desc: is the alert description |
105 | * | 105 | * |
@@ -115,7 +115,7 @@ gnutls_alert_get_name (gnutls_alert_description_t alert) | |||
115 | * | 115 | * |
116 | **/ | 116 | **/ |
117 | int | 117 | int |
118 | gnutls_alert_send (gnutls_session_t session, gnutls_alert_level_t level, | 118 | MHD_gnutls_alert_send (mhd_gtls_session_t session, gnutls_alert_level_t level, |
119 | gnutls_alert_description_t desc) | 119 | gnutls_alert_description_t desc) |
120 | { | 120 | { |
121 | uint8_t data[2]; | 121 | uint8_t data[2]; |
@@ -125,20 +125,20 @@ gnutls_alert_send (gnutls_session_t session, gnutls_alert_level_t level, | |||
125 | data[0] = (uint8_t) level; | 125 | data[0] = (uint8_t) level; |
126 | data[1] = (uint8_t) desc; | 126 | data[1] = (uint8_t) desc; |
127 | 127 | ||
128 | name = gnutls_alert_get_name ((int) data[1]); | 128 | name = MHD_gnutls_alert_get_name ((int) data[1]); |
129 | if (name == NULL) | 129 | if (name == NULL) |
130 | name = "(unknown)"; | 130 | name = "(unknown)"; |
131 | _gnutls_record_log ("REC: Sending Alert[%d|%d] - %s\n", data[0], | 131 | _gnutls_record_log ("REC: Sending Alert[%d|%d] - %s\n", data[0], |
132 | data[1], name); | 132 | data[1], name); |
133 | 133 | ||
134 | if ((ret = _gnutls_send_int (session, GNUTLS_ALERT, -1, data, 2)) >= 0) | 134 | if ((ret = mhd_gtls_send_int (session, GNUTLS_ALERT, -1, data, 2)) >= 0) |
135 | return 0; | 135 | return 0; |
136 | else | 136 | else |
137 | return ret; | 137 | return ret; |
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * gnutls_error_to_alert - This function returns an alert code based on the given error code | 141 | * MHD_gtls_error_to_alert - This function returns an alert code based on the given error code |
142 | * @err: is a negative integer | 142 | * @err: is a negative integer |
143 | * @level: the alert level will be stored there | 143 | * @level: the alert level will be stored there |
144 | * | 144 | * |
@@ -153,7 +153,7 @@ gnutls_alert_send (gnutls_session_t session, gnutls_alert_level_t level, | |||
153 | * | 153 | * |
154 | **/ | 154 | **/ |
155 | int | 155 | int |
156 | gnutls_error_to_alert (int err, int *level) | 156 | MHD_gtls_error_to_alert (int err, int *level) |
157 | { | 157 | { |
158 | int ret, _level = -1; | 158 | int ret, _level = -1; |
159 | 159 | ||
@@ -254,12 +254,12 @@ gnutls_error_to_alert (int err, int *level) | |||
254 | 254 | ||
255 | 255 | ||
256 | /** | 256 | /** |
257 | * gnutls_alert_send_appropriate - This function sends an alert to the peer depending on the error code | 257 | * MHD_gnutls_alert_send_appropriate - This function sends an alert to the peer depending on the error code |
258 | * @session: is a #gnutls_session_t structure. | 258 | * @session: is a #mhd_gtls_session_t structure. |
259 | * @err: is an integer | 259 | * @err: is an integer |
260 | * | 260 | * |
261 | * Sends an alert to the peer depending on the error code returned by a gnutls | 261 | * Sends an alert to the peer depending on the error code returned by a gnutls |
262 | * function. This function will call gnutls_error_to_alert() to determine | 262 | * function. This function will call MHD_gtls_error_to_alert() to determine |
263 | * the appropriate alert to send. | 263 | * the appropriate alert to send. |
264 | * | 264 | * |
265 | * This function may also return GNUTLS_E_AGAIN, or GNUTLS_E_INTERRUPTED. | 265 | * This function may also return GNUTLS_E_AGAIN, or GNUTLS_E_INTERRUPTED. |
@@ -270,23 +270,23 @@ gnutls_error_to_alert (int err, int *level) | |||
270 | * Returns zero on success. | 270 | * Returns zero on success. |
271 | */ | 271 | */ |
272 | int | 272 | int |
273 | gnutls_alert_send_appropriate (gnutls_session_t session, int err) | 273 | MHD_gnutls_alert_send_appropriate (mhd_gtls_session_t session, int err) |
274 | { | 274 | { |
275 | int alert; | 275 | int alert; |
276 | int level; | 276 | int level; |
277 | 277 | ||
278 | alert = gnutls_error_to_alert (err, &level); | 278 | alert = MHD_gtls_error_to_alert (err, &level); |
279 | if (alert < 0) | 279 | if (alert < 0) |
280 | { | 280 | { |
281 | return alert; | 281 | return alert; |
282 | } | 282 | } |
283 | 283 | ||
284 | return gnutls_alert_send (session, level, alert); | 284 | return MHD_gnutls_alert_send (session, level, alert); |
285 | } | 285 | } |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * gnutls_alert_get - Returns the last alert number received. | 288 | * gnutls_alert_get - Returns the last alert number received. |
289 | * @session: is a #gnutls_session_t structure. | 289 | * @session: is a #mhd_gtls_session_t structure. |
290 | * | 290 | * |
291 | * This function will return the last alert number received. This | 291 | * This function will return the last alert number received. This |
292 | * function should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or | 292 | * function should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or |
@@ -298,7 +298,7 @@ gnutls_alert_send_appropriate (gnutls_session_t session, int err) | |||
298 | * | 298 | * |
299 | **/ | 299 | **/ |
300 | gnutls_alert_description_t | 300 | gnutls_alert_description_t |
301 | gnutls_alert_get (gnutls_session_t session) | 301 | gnutls_alert_get (mhd_gtls_session_t session) |
302 | { | 302 | { |
303 | return session->internals.last_alert; | 303 | return session->internals.last_alert; |
304 | } | 304 | } |
diff --git a/src/daemon/https/tls/gnutls_algorithms.c b/src/daemon/https/tls/gnutls_algorithms.c index 1809afda..adb65081 100644 --- a/src/daemon/https/tls/gnutls_algorithms.c +++ b/src/daemon/https/tls/gnutls_algorithms.c | |||
@@ -381,22 +381,22 @@ static const gnutls_compression_method_t supported_compressions[] = { | |||
381 | GNUTLS_COMPRESSION_LOOP( if(p->num == num) { a; break; } ) | 381 | GNUTLS_COMPRESSION_LOOP( if(p->num == num) { a; break; } ) |
382 | 382 | ||
383 | /* Key Exchange Section */ | 383 | /* Key Exchange Section */ |
384 | extern mod_auth_st rsa_auth_struct; | 384 | extern mhd_gtls_mod_auth_st rsa_auth_struct; |
385 | extern mod_auth_st rsa_export_auth_struct; | 385 | extern mhd_gtls_mod_auth_st rsa_export_auth_struct; |
386 | extern mod_auth_st dhe_rsa_auth_struct; | 386 | extern mhd_gtls_mod_auth_st dhe_rsa_auth_struct; |
387 | extern mod_auth_st dhe_dss_auth_struct; | 387 | extern mhd_gtls_mod_auth_st dhe_dss_auth_struct; |
388 | extern mod_auth_st anon_auth_struct; | 388 | extern mhd_gtls_mod_auth_st anon_auth_struct; |
389 | extern mod_auth_st srp_auth_struct; | 389 | extern mhd_gtls_mod_auth_st srp_auth_struct; |
390 | extern mod_auth_st psk_auth_struct; | 390 | extern mhd_gtls_mod_auth_st psk_auth_struct; |
391 | extern mod_auth_st dhe_psk_auth_struct; | 391 | extern mhd_gtls_mod_auth_st dhe_psk_auth_struct; |
392 | extern mod_auth_st srp_rsa_auth_struct; | 392 | extern mhd_gtls_mod_auth_st srp_rsa_auth_struct; |
393 | extern mod_auth_st srp_dss_auth_struct; | 393 | extern mhd_gtls_mod_auth_st srp_dss_auth_struct; |
394 | 394 | ||
395 | struct gnutls_kx_algo_entry | 395 | struct gnutls_kx_algo_entry |
396 | { | 396 | { |
397 | const char *name; | 397 | const char *name; |
398 | gnutls_kx_algorithm_t algorithm; | 398 | gnutls_kx_algorithm_t algorithm; |
399 | mod_auth_st *auth_struct; | 399 | mhd_gtls_mod_auth_st *auth_struct; |
400 | int needs_dh_params; | 400 | int needs_dh_params; |
401 | int needs_rsa_params; | 401 | int needs_rsa_params; |
402 | }; | 402 | }; |
@@ -763,7 +763,7 @@ static const gnutls_cipher_suite_entry cs_algorithms[] = { | |||
763 | /* Generic Functions */ | 763 | /* Generic Functions */ |
764 | 764 | ||
765 | int | 765 | int |
766 | _gnutls_mac_priority (gnutls_session_t session, | 766 | mhd_gtls_mac_priority (mhd_gtls_session_t session, |
767 | gnutls_mac_algorithm_t algorithm) | 767 | gnutls_mac_algorithm_t algorithm) |
768 | { /* actually returns the priority */ | 768 | { /* actually returns the priority */ |
769 | unsigned int i; | 769 | unsigned int i; |
@@ -776,14 +776,14 @@ _gnutls_mac_priority (gnutls_session_t session, | |||
776 | } | 776 | } |
777 | 777 | ||
778 | /** | 778 | /** |
779 | * gnutls_mac_get_name - Returns a string with the name of the specified mac algorithm | 779 | * MHD_gnutls_mac_get_name - Returns a string with the name of the specified mac algorithm |
780 | * @algorithm: is a MAC algorithm | 780 | * @algorithm: is a MAC algorithm |
781 | * | 781 | * |
782 | * Returns: a string that contains the name of the specified MAC | 782 | * Returns: a string that contains the name of the specified MAC |
783 | * algorithm, or %NULL. | 783 | * algorithm, or %NULL. |
784 | **/ | 784 | **/ |
785 | const char * | 785 | const char * |
786 | gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm) | 786 | MHD_gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm) |
787 | { | 787 | { |
788 | const char *ret = NULL; | 788 | const char *ret = NULL; |
789 | 789 | ||
@@ -794,7 +794,7 @@ gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm) | |||
794 | } | 794 | } |
795 | 795 | ||
796 | /** | 796 | /** |
797 | * gnutls_mac_get_id - Returns the gnutls id of the specified in string algorithm | 797 | * MHD_gtls_mac_get_id - Returns the gnutls id of the specified in string algorithm |
798 | * @algorithm: is a MAC algorithm name | 798 | * @algorithm: is a MAC algorithm name |
799 | * | 799 | * |
800 | * Returns: an %gnutls_mac_algorithm_tid of the specified in a string | 800 | * Returns: an %gnutls_mac_algorithm_tid of the specified in a string |
@@ -802,7 +802,7 @@ gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm) | |||
802 | * compared in a case insensitive way. | 802 | * compared in a case insensitive way. |
803 | **/ | 803 | **/ |
804 | gnutls_mac_algorithm_t | 804 | gnutls_mac_algorithm_t |
805 | gnutls_mac_get_id (const char *name) | 805 | MHD_gtls_mac_get_id (const char *name) |
806 | { | 806 | { |
807 | gnutls_mac_algorithm_t ret = MHD_GNUTLS_MAC_UNKNOWN; | 807 | gnutls_mac_algorithm_t ret = MHD_GNUTLS_MAC_UNKNOWN; |
808 | 808 | ||
@@ -813,7 +813,7 @@ gnutls_mac_get_id (const char *name) | |||
813 | } | 813 | } |
814 | 814 | ||
815 | /** | 815 | /** |
816 | * gnutls_mac_get_key_size - Returns the length of the MAC's key size | 816 | * MHD_gnutls_mac_get_key_size - Returns the length of the MAC's key size |
817 | * @algorithm: is an encryption algorithm | 817 | * @algorithm: is an encryption algorithm |
818 | * | 818 | * |
819 | * Returns: length (in bytes) of the given MAC key size, or 0 if the | 819 | * Returns: length (in bytes) of the given MAC key size, or 0 if the |
@@ -821,7 +821,7 @@ gnutls_mac_get_id (const char *name) | |||
821 | * | 821 | * |
822 | **/ | 822 | **/ |
823 | size_t | 823 | size_t |
824 | gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm) | 824 | MHD_gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm) |
825 | { | 825 | { |
826 | size_t ret = 0; | 826 | size_t ret = 0; |
827 | 827 | ||
@@ -832,7 +832,7 @@ gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm) | |||
832 | } | 832 | } |
833 | 833 | ||
834 | /** | 834 | /** |
835 | * gnutls_mac_list: | 835 | * MHD_gtls_mac_list: |
836 | * | 836 | * |
837 | * Get a list of hash algorithms for use as MACs. Note that not | 837 | * Get a list of hash algorithms for use as MACs. Note that not |
838 | * necessarily all MACs are supported in TLS cipher suites. For | 838 | * necessarily all MACs are supported in TLS cipher suites. For |
@@ -843,13 +843,13 @@ gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm) | |||
843 | * integers indicating the available MACs. | 843 | * integers indicating the available MACs. |
844 | **/ | 844 | **/ |
845 | const gnutls_mac_algorithm_t * | 845 | const gnutls_mac_algorithm_t * |
846 | gnutls_mac_list (void) | 846 | MHD_gtls_mac_list (void) |
847 | { | 847 | { |
848 | return supported_macs; | 848 | return supported_macs; |
849 | } | 849 | } |
850 | 850 | ||
851 | const char * | 851 | const char * |
852 | _gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t algorithm) | 852 | mhd_gtls_x509_mac_to_oid (gnutls_mac_algorithm_t algorithm) |
853 | { | 853 | { |
854 | const char *ret = NULL; | 854 | const char *ret = NULL; |
855 | 855 | ||
@@ -860,7 +860,7 @@ _gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t algorithm) | |||
860 | } | 860 | } |
861 | 861 | ||
862 | gnutls_mac_algorithm_t | 862 | gnutls_mac_algorithm_t |
863 | _gnutls_x509_oid2mac_algorithm (const char *oid) | 863 | mhd_gtls_x509_oid2mac_algorithm (const char *oid) |
864 | { | 864 | { |
865 | gnutls_mac_algorithm_t ret = 0; | 865 | gnutls_mac_algorithm_t ret = 0; |
866 | 866 | ||
@@ -876,7 +876,7 @@ _gnutls_x509_oid2mac_algorithm (const char *oid) | |||
876 | } | 876 | } |
877 | 877 | ||
878 | int | 878 | int |
879 | _gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm) | 879 | mhd_gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm) |
880 | { | 880 | { |
881 | ssize_t ret = -1; | 881 | ssize_t ret = -1; |
882 | GNUTLS_HASH_ALG_LOOP (ret = p->id); | 882 | GNUTLS_HASH_ALG_LOOP (ret = p->id); |
@@ -889,7 +889,7 @@ _gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm) | |||
889 | 889 | ||
890 | /* Compression Functions */ | 890 | /* Compression Functions */ |
891 | int | 891 | int |
892 | _gnutls_compression_priority (gnutls_session_t session, | 892 | mhd_gtls_compression_priority (mhd_gtls_session_t session, |
893 | gnutls_compression_method_t algorithm) | 893 | gnutls_compression_method_t algorithm) |
894 | { /* actually returns the priority */ | 894 | { /* actually returns the priority */ |
895 | unsigned int i; | 895 | unsigned int i; |
@@ -902,14 +902,14 @@ _gnutls_compression_priority (gnutls_session_t session, | |||
902 | } | 902 | } |
903 | 903 | ||
904 | /** | 904 | /** |
905 | * gnutls_compression_get_name - Returns a string with the name of the specified compression algorithm | 905 | * MHD_gnutls_compression_get_name - Returns a string with the name of the specified compression algorithm |
906 | * @algorithm: is a Compression algorithm | 906 | * @algorithm: is a Compression algorithm |
907 | * | 907 | * |
908 | * Returns: a pointer to a string that contains the name of the | 908 | * Returns: a pointer to a string that contains the name of the |
909 | * specified compression algorithm, or %NULL. | 909 | * specified compression algorithm, or %NULL. |
910 | **/ | 910 | **/ |
911 | const char * | 911 | const char * |
912 | gnutls_compression_get_name (gnutls_compression_method_t algorithm) | 912 | MHD_gnutls_compression_get_name (gnutls_compression_method_t algorithm) |
913 | { | 913 | { |
914 | const char *ret = NULL; | 914 | const char *ret = NULL; |
915 | 915 | ||
@@ -920,7 +920,7 @@ gnutls_compression_get_name (gnutls_compression_method_t algorithm) | |||
920 | } | 920 | } |
921 | 921 | ||
922 | /** | 922 | /** |
923 | * gnutls_compression_get_id - Returns the gnutls id of the specified in string algorithm | 923 | * MHD_gtls_compression_get_id - Returns the gnutls id of the specified in string algorithm |
924 | * @algorithm: is a compression method name | 924 | * @algorithm: is a compression method name |
925 | * | 925 | * |
926 | * The names are compared in a case insensitive way. | 926 | * The names are compared in a case insensitive way. |
@@ -930,7 +930,7 @@ gnutls_compression_get_name (gnutls_compression_method_t algorithm) | |||
930 | * | 930 | * |
931 | **/ | 931 | **/ |
932 | gnutls_compression_method_t | 932 | gnutls_compression_method_t |
933 | gnutls_compression_get_id (const char *name) | 933 | MHD_gtls_compression_get_id (const char *name) |
934 | { | 934 | { |
935 | gnutls_compression_method_t ret = MHD_GNUTLS_COMP_UNKNOWN; | 935 | gnutls_compression_method_t ret = MHD_GNUTLS_COMP_UNKNOWN; |
936 | 936 | ||
@@ -944,7 +944,7 @@ gnutls_compression_get_id (const char *name) | |||
944 | } | 944 | } |
945 | 945 | ||
946 | /** | 946 | /** |
947 | * gnutls_compression_list: | 947 | * MHD_gtls_compression_list: |
948 | * | 948 | * |
949 | * Get a list of compression methods. Note that to be able to use LZO | 949 | * Get a list of compression methods. Note that to be able to use LZO |
950 | * compression, you must link to libgnutls-extra and call | 950 | * compression, you must link to libgnutls-extra and call |
@@ -954,14 +954,14 @@ gnutls_compression_get_id (const char *name) | |||
954 | * integers indicating the available compression methods. | 954 | * integers indicating the available compression methods. |
955 | **/ | 955 | **/ |
956 | const gnutls_compression_method_t * | 956 | const gnutls_compression_method_t * |
957 | gnutls_compression_list (void) | 957 | MHD_gtls_compression_list (void) |
958 | { | 958 | { |
959 | return supported_compressions; | 959 | return supported_compressions; |
960 | } | 960 | } |
961 | 961 | ||
962 | /* return the tls number of the specified algorithm */ | 962 | /* return the tls number of the specified algorithm */ |
963 | int | 963 | int |
964 | _gnutls_compression_get_num (gnutls_compression_method_t algorithm) | 964 | mhd_gtls_compression_get_num (gnutls_compression_method_t algorithm) |
965 | { | 965 | { |
966 | int ret = -1; | 966 | int ret = -1; |
967 | 967 | ||
@@ -972,7 +972,7 @@ _gnutls_compression_get_num (gnutls_compression_method_t algorithm) | |||
972 | } | 972 | } |
973 | 973 | ||
974 | int | 974 | int |
975 | _gnutls_compression_get_wbits (gnutls_compression_method_t algorithm) | 975 | mhd_gtls_compression_get_wbits (gnutls_compression_method_t algorithm) |
976 | { | 976 | { |
977 | int ret = -1; | 977 | int ret = -1; |
978 | /* avoid prefix */ | 978 | /* avoid prefix */ |
@@ -981,7 +981,7 @@ _gnutls_compression_get_wbits (gnutls_compression_method_t algorithm) | |||
981 | } | 981 | } |
982 | 982 | ||
983 | int | 983 | int |
984 | _gnutls_compression_get_mem_level (gnutls_compression_method_t algorithm) | 984 | mhd_gtls_compression_get_mem_level (gnutls_compression_method_t algorithm) |
985 | { | 985 | { |
986 | int ret = -1; | 986 | int ret = -1; |
987 | /* avoid prefix */ | 987 | /* avoid prefix */ |
@@ -990,7 +990,7 @@ _gnutls_compression_get_mem_level (gnutls_compression_method_t algorithm) | |||
990 | } | 990 | } |
991 | 991 | ||
992 | int | 992 | int |
993 | _gnutls_compression_get_comp_level (gnutls_compression_method_t algorithm) | 993 | mhd_gtls_compression_get_comp_level (gnutls_compression_method_t algorithm) |
994 | { | 994 | { |
995 | int ret = -1; | 995 | int ret = -1; |
996 | /* avoid prefix */ | 996 | /* avoid prefix */ |
@@ -1002,7 +1002,7 @@ _gnutls_compression_get_comp_level (gnutls_compression_method_t algorithm) | |||
1002 | * method num | 1002 | * method num |
1003 | */ | 1003 | */ |
1004 | gnutls_compression_method_t | 1004 | gnutls_compression_method_t |
1005 | _gnutls_compression_get_id (int num) | 1005 | mhd_gtls_compression_get_id (int num) |
1006 | { | 1006 | { |
1007 | gnutls_compression_method_t ret = -1; | 1007 | gnutls_compression_method_t ret = -1; |
1008 | 1008 | ||
@@ -1013,7 +1013,7 @@ _gnutls_compression_get_id (int num) | |||
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | int | 1015 | int |
1016 | _gnutls_compression_is_ok (gnutls_compression_method_t algorithm) | 1016 | mhd_gtls_compression_is_ok (gnutls_compression_method_t algorithm) |
1017 | { | 1017 | { |
1018 | ssize_t ret = -1; | 1018 | ssize_t ret = -1; |
1019 | GNUTLS_COMPRESSION_ALG_LOOP (ret = p->id); | 1019 | GNUTLS_COMPRESSION_ALG_LOOP (ret = p->id); |
@@ -1026,7 +1026,7 @@ _gnutls_compression_is_ok (gnutls_compression_method_t algorithm) | |||
1026 | 1026 | ||
1027 | /* CIPHER functions */ | 1027 | /* CIPHER functions */ |
1028 | int | 1028 | int |
1029 | _gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm) | 1029 | mhd_gtls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm) |
1030 | { | 1030 | { |
1031 | size_t ret = 0; | 1031 | size_t ret = 0; |
1032 | GNUTLS_ALG_LOOP (ret = p->blocksize); | 1032 | GNUTLS_ALG_LOOP (ret = p->blocksize); |
@@ -1036,7 +1036,7 @@ _gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm) | |||
1036 | 1036 | ||
1037 | /* returns the priority */ | 1037 | /* returns the priority */ |
1038 | int | 1038 | int |
1039 | _gnutls_cipher_priority (gnutls_session_t session, | 1039 | mhd_gtls_cipher_priority (mhd_gtls_session_t session, |
1040 | gnutls_cipher_algorithm_t algorithm) | 1040 | gnutls_cipher_algorithm_t algorithm) |
1041 | { | 1041 | { |
1042 | unsigned int i; | 1042 | unsigned int i; |
@@ -1049,7 +1049,7 @@ _gnutls_cipher_priority (gnutls_session_t session, | |||
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | int | 1051 | int |
1052 | _gnutls_cipher_is_block (gnutls_cipher_algorithm_t algorithm) | 1052 | mhd_gtls_cipher_is_block (gnutls_cipher_algorithm_t algorithm) |
1053 | { | 1053 | { |
1054 | size_t ret = 0; | 1054 | size_t ret = 0; |
1055 | 1055 | ||
@@ -1059,14 +1059,14 @@ _gnutls_cipher_is_block (gnutls_cipher_algorithm_t algorithm) | |||
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | /** | 1061 | /** |
1062 | * gnutls_cipher_get_key_size - Returns the length of the cipher's key size | 1062 | * MHD_gnutls_cipher_get_key_size - Returns the length of the cipher's key size |
1063 | * @algorithm: is an encryption algorithm | 1063 | * @algorithm: is an encryption algorithm |
1064 | * | 1064 | * |
1065 | * Returns: length (in bytes) of the given cipher's key size, o 0 if | 1065 | * Returns: length (in bytes) of the given cipher's key size, o 0 if |
1066 | * the given cipher is invalid. | 1066 | * the given cipher is invalid. |
1067 | **/ | 1067 | **/ |
1068 | size_t | 1068 | size_t |
1069 | gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm) | 1069 | MHD_gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm) |
1070 | { /* In bytes */ | 1070 | { /* In bytes */ |
1071 | size_t ret = 0; | 1071 | size_t ret = 0; |
1072 | GNUTLS_ALG_LOOP (ret = p->keysize); | 1072 | GNUTLS_ALG_LOOP (ret = p->keysize); |
@@ -1075,7 +1075,7 @@ gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm) | |||
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | int | 1077 | int |
1078 | _gnutls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm) | 1078 | mhd_gtls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm) |
1079 | { /* In bytes */ | 1079 | { /* In bytes */ |
1080 | size_t ret = 0; | 1080 | size_t ret = 0; |
1081 | GNUTLS_ALG_LOOP (ret = p->iv); | 1081 | GNUTLS_ALG_LOOP (ret = p->iv); |
@@ -1084,7 +1084,7 @@ _gnutls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm) | |||
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | int | 1086 | int |
1087 | _gnutls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm) | 1087 | mhd_gtls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm) |
1088 | { /* In bytes */ | 1088 | { /* In bytes */ |
1089 | size_t ret = 0; | 1089 | size_t ret = 0; |
1090 | GNUTLS_ALG_LOOP (ret = p->export_flag); | 1090 | GNUTLS_ALG_LOOP (ret = p->export_flag); |
@@ -1093,14 +1093,14 @@ _gnutls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm) | |||
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | /** | 1095 | /** |
1096 | * gnutls_cipher_get_name - Returns a string with the name of the specified cipher algorithm | 1096 | * MHD_gnutls_cipher_get_name - Returns a string with the name of the specified cipher algorithm |
1097 | * @algorithm: is an encryption algorithm | 1097 | * @algorithm: is an encryption algorithm |
1098 | * | 1098 | * |
1099 | * Returns: a pointer to a string that contains the name of the | 1099 | * Returns: a pointer to a string that contains the name of the |
1100 | * specified cipher, or %NULL. | 1100 | * specified cipher, or %NULL. |
1101 | **/ | 1101 | **/ |
1102 | const char * | 1102 | const char * |
1103 | gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm) | 1103 | MHD_gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm) |
1104 | { | 1104 | { |
1105 | const char *ret = NULL; | 1105 | const char *ret = NULL; |
1106 | 1106 | ||
@@ -1111,7 +1111,7 @@ gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm) | |||
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | /** | 1113 | /** |
1114 | * gnutls_cipher_get_id - Returns the gnutls id of the specified in string algorithm | 1114 | * MHD_gtls_cipher_get_id - Returns the gnutls id of the specified in string algorithm |
1115 | * @algorithm: is a MAC algorithm name | 1115 | * @algorithm: is a MAC algorithm name |
1116 | * | 1116 | * |
1117 | * The names are compared in a case insensitive way. | 1117 | * The names are compared in a case insensitive way. |
@@ -1121,7 +1121,7 @@ gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm) | |||
1121 | * | 1121 | * |
1122 | **/ | 1122 | **/ |
1123 | gnutls_cipher_algorithm_t | 1123 | gnutls_cipher_algorithm_t |
1124 | gnutls_cipher_get_id (const char *name) | 1124 | MHD_gtls_cipher_get_id (const char *name) |
1125 | { | 1125 | { |
1126 | gnutls_cipher_algorithm_t ret = MHD_GNUTLS_CIPHER_UNKNOWN; | 1126 | gnutls_cipher_algorithm_t ret = MHD_GNUTLS_CIPHER_UNKNOWN; |
1127 | 1127 | ||
@@ -1132,7 +1132,7 @@ gnutls_cipher_get_id (const char *name) | |||
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | /** | 1134 | /** |
1135 | * gnutls_cipher_list: | 1135 | * MHD_gtls_cipher_list: |
1136 | * | 1136 | * |
1137 | * Get a list of supported cipher algorithms. Note that not | 1137 | * Get a list of supported cipher algorithms. Note that not |
1138 | * necessarily all ciphers are supported as TLS cipher suites. For | 1138 | * necessarily all ciphers are supported as TLS cipher suites. For |
@@ -1144,13 +1144,13 @@ gnutls_cipher_get_id (const char *name) | |||
1144 | * | 1144 | * |
1145 | **/ | 1145 | **/ |
1146 | const gnutls_cipher_algorithm_t * | 1146 | const gnutls_cipher_algorithm_t * |
1147 | gnutls_cipher_list (void) | 1147 | MHD_gtls_cipher_list (void) |
1148 | { | 1148 | { |
1149 | return supported_ciphers; | 1149 | return supported_ciphers; |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | int | 1152 | int |
1153 | _gnutls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm) | 1153 | mhd_gtls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm) |
1154 | { | 1154 | { |
1155 | ssize_t ret = -1; | 1155 | ssize_t ret = -1; |
1156 | GNUTLS_ALG_LOOP (ret = p->id); | 1156 | GNUTLS_ALG_LOOP (ret = p->id); |
@@ -1162,17 +1162,17 @@ _gnutls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm) | |||
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | /* Key EXCHANGE functions */ | 1164 | /* Key EXCHANGE functions */ |
1165 | mod_auth_st * | 1165 | mhd_gtls_mod_auth_st * |
1166 | _gnutls_kx_auth_struct (gnutls_kx_algorithm_t algorithm) | 1166 | mhd_gtls_kx_auth_struct (gnutls_kx_algorithm_t algorithm) |
1167 | { | 1167 | { |
1168 | mod_auth_st *ret = NULL; | 1168 | mhd_gtls_mod_auth_st *ret = NULL; |
1169 | GNUTLS_KX_ALG_LOOP (ret = p->auth_struct); | 1169 | GNUTLS_KX_ALG_LOOP (ret = p->auth_struct); |
1170 | return ret; | 1170 | return ret; |
1171 | 1171 | ||
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | int | 1174 | int |
1175 | _gnutls_kx_priority (gnutls_session_t session, | 1175 | mhd_gtls_kx_priority (mhd_gtls_session_t session, |
1176 | gnutls_kx_algorithm_t algorithm) | 1176 | gnutls_kx_algorithm_t algorithm) |
1177 | { | 1177 | { |
1178 | unsigned int i; | 1178 | unsigned int i; |
@@ -1185,14 +1185,14 @@ _gnutls_kx_priority (gnutls_session_t session, | |||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | /** | 1187 | /** |
1188 | * gnutls_kx_get_name - Returns a string with the name of the specified key exchange algorithm | 1188 | * MHD_gnutls_kx_get_name - Returns a string with the name of the specified key exchange algorithm |
1189 | * @algorithm: is a key exchange algorithm | 1189 | * @algorithm: is a key exchange algorithm |
1190 | * | 1190 | * |
1191 | * Returns: a pointer to a string that contains the name of the | 1191 | * Returns: a pointer to a string that contains the name of the |
1192 | * specified key exchange algorithm, or %NULL. | 1192 | * specified key exchange algorithm, or %NULL. |
1193 | **/ | 1193 | **/ |
1194 | const char * | 1194 | const char * |
1195 | gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm) | 1195 | MHD_gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm) |
1196 | { | 1196 | { |
1197 | const char *ret = NULL; | 1197 | const char *ret = NULL; |
1198 | 1198 | ||
@@ -1203,7 +1203,7 @@ gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm) | |||
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | /** | 1205 | /** |
1206 | * gnutls_kx_get_id - Returns the gnutls id of the specified in string algorithm | 1206 | * MHD_gtls_kx_get_id - Returns the gnutls id of the specified in string algorithm |
1207 | * @algorithm: is a KX name | 1207 | * @algorithm: is a KX name |
1208 | * | 1208 | * |
1209 | * The names are compared in a case insensitive way. | 1209 | * The names are compared in a case insensitive way. |
@@ -1212,7 +1212,7 @@ gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm) | |||
1212 | * %GNUTLS_KX_UNKNOWN on error. | 1212 | * %GNUTLS_KX_UNKNOWN on error. |
1213 | **/ | 1213 | **/ |
1214 | gnutls_kx_algorithm_t | 1214 | gnutls_kx_algorithm_t |
1215 | gnutls_kx_get_id (const char *name) | 1215 | MHD_gtls_kx_get_id (const char *name) |
1216 | { | 1216 | { |
1217 | gnutls_cipher_algorithm_t ret = MHD_GNUTLS_KX_UNKNOWN; | 1217 | gnutls_cipher_algorithm_t ret = MHD_GNUTLS_KX_UNKNOWN; |
1218 | 1218 | ||
@@ -1223,7 +1223,7 @@ gnutls_kx_get_id (const char *name) | |||
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | /** | 1225 | /** |
1226 | * gnutls_kx_list: | 1226 | * MHD_gtls_kx_list: |
1227 | * | 1227 | * |
1228 | * Get a list of supported key exchange algorithms. | 1228 | * Get a list of supported key exchange algorithms. |
1229 | * | 1229 | * |
@@ -1231,13 +1231,13 @@ gnutls_kx_get_id (const char *name) | |||
1231 | * indicating the available key exchange algorithms. | 1231 | * indicating the available key exchange algorithms. |
1232 | **/ | 1232 | **/ |
1233 | const gnutls_kx_algorithm_t * | 1233 | const gnutls_kx_algorithm_t * |
1234 | gnutls_kx_list (void) | 1234 | MHD_gtls_kx_list (void) |
1235 | { | 1235 | { |
1236 | return supported_kxs; | 1236 | return supported_kxs; |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | int | 1239 | int |
1240 | _gnutls_kx_is_ok (gnutls_kx_algorithm_t algorithm) | 1240 | mhd_gtls_kx_is_ok (gnutls_kx_algorithm_t algorithm) |
1241 | { | 1241 | { |
1242 | ssize_t ret = -1; | 1242 | ssize_t ret = -1; |
1243 | GNUTLS_KX_ALG_LOOP (ret = p->algorithm); | 1243 | GNUTLS_KX_ALG_LOOP (ret = p->algorithm); |
@@ -1249,7 +1249,7 @@ _gnutls_kx_is_ok (gnutls_kx_algorithm_t algorithm) | |||
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | int | 1251 | int |
1252 | _gnutls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm) | 1252 | mhd_gtls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm) |
1253 | { | 1253 | { |
1254 | ssize_t ret = 0; | 1254 | ssize_t ret = 0; |
1255 | GNUTLS_KX_ALG_LOOP (ret = p->needs_rsa_params); | 1255 | GNUTLS_KX_ALG_LOOP (ret = p->needs_rsa_params); |
@@ -1257,7 +1257,7 @@ _gnutls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm) | |||
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | int | 1259 | int |
1260 | _gnutls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm) | 1260 | mhd_gtls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm) |
1261 | { | 1261 | { |
1262 | ssize_t ret = 0; | 1262 | ssize_t ret = 0; |
1263 | GNUTLS_KX_ALG_LOOP (ret = p->needs_dh_params); | 1263 | GNUTLS_KX_ALG_LOOP (ret = p->needs_dh_params); |
@@ -1266,7 +1266,7 @@ _gnutls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm) | |||
1266 | 1266 | ||
1267 | /* Version */ | 1267 | /* Version */ |
1268 | int | 1268 | int |
1269 | _gnutls_version_priority (gnutls_session_t session, gnutls_protocol_t version) | 1269 | mhd_gtls_version_priority (mhd_gtls_session_t session, gnutls_protocol_t version) |
1270 | { /* actually returns the priority */ | 1270 | { /* actually returns the priority */ |
1271 | unsigned int i; | 1271 | unsigned int i; |
1272 | 1272 | ||
@@ -1285,7 +1285,7 @@ _gnutls_version_priority (gnutls_session_t session, gnutls_protocol_t version) | |||
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | gnutls_protocol_t | 1287 | gnutls_protocol_t |
1288 | _gnutls_version_lowest (gnutls_session_t session) | 1288 | mhd_gtls_version_lowest (mhd_gtls_session_t session) |
1289 | { /* returns the lowest version supported */ | 1289 | { /* returns the lowest version supported */ |
1290 | unsigned int i, min = 0xff; | 1290 | unsigned int i, min = 0xff; |
1291 | 1291 | ||
@@ -1307,7 +1307,7 @@ _gnutls_version_lowest (gnutls_session_t session) | |||
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | gnutls_protocol_t | 1309 | gnutls_protocol_t |
1310 | _gnutls_version_max (gnutls_session_t session) | 1310 | mhd_gtls_version_max (mhd_gtls_session_t session) |
1311 | { /* returns the maximum version supported */ | 1311 | { /* returns the maximum version supported */ |
1312 | unsigned int i, max = 0x00; | 1312 | unsigned int i, max = 0x00; |
1313 | 1313 | ||
@@ -1329,14 +1329,14 @@ _gnutls_version_max (gnutls_session_t session) | |||
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | /** | 1331 | /** |
1332 | * gnutls_protocol_get_name - Returns a string with the name of the specified SSL/TLS version | 1332 | * MHD_gnutls_protocol_get_name - Returns a string with the name of the specified SSL/TLS version |
1333 | * @version: is a (gnutls) version number | 1333 | * @version: is a (gnutls) version number |
1334 | * | 1334 | * |
1335 | * Returns: a string that contains the name of the specified TLS | 1335 | * Returns: a string that contains the name of the specified TLS |
1336 | * version (e.g., "TLS 1.0"), or %NULL. | 1336 | * version (e.g., "TLS 1.0"), or %NULL. |
1337 | **/ | 1337 | **/ |
1338 | const char * | 1338 | const char * |
1339 | gnutls_protocol_get_name (gnutls_protocol_t version) | 1339 | MHD_gnutls_protocol_get_name (gnutls_protocol_t version) |
1340 | { | 1340 | { |
1341 | const char *ret = NULL; | 1341 | const char *ret = NULL; |
1342 | 1342 | ||
@@ -1346,7 +1346,7 @@ gnutls_protocol_get_name (gnutls_protocol_t version) | |||
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | /** | 1348 | /** |
1349 | * gnutls_protocol_get_id - Returns the gnutls id of the specified in string protocol | 1349 | * MHD_gtls_protocol_get_id - Returns the gnutls id of the specified in string protocol |
1350 | * @algorithm: is a protocol name | 1350 | * @algorithm: is a protocol name |
1351 | * | 1351 | * |
1352 | * The names are compared in a case insensitive way. | 1352 | * The names are compared in a case insensitive way. |
@@ -1355,7 +1355,7 @@ gnutls_protocol_get_name (gnutls_protocol_t version) | |||
1355 | * %GNUTLS_VERSION_UNKNOWN on error. | 1355 | * %GNUTLS_VERSION_UNKNOWN on error. |
1356 | **/ | 1356 | **/ |
1357 | gnutls_protocol_t | 1357 | gnutls_protocol_t |
1358 | gnutls_protocol_get_id (const char *name) | 1358 | MHD_gtls_protocol_get_id (const char *name) |
1359 | { | 1359 | { |
1360 | gnutls_protocol_t ret = MHD_GNUTLS_VERSION_UNKNOWN; | 1360 | gnutls_protocol_t ret = MHD_GNUTLS_VERSION_UNKNOWN; |
1361 | 1361 | ||
@@ -1366,7 +1366,7 @@ gnutls_protocol_get_id (const char *name) | |||
1366 | } | 1366 | } |
1367 | 1367 | ||
1368 | /** | 1368 | /** |
1369 | * gnutls_protocol_list: | 1369 | * MHD_gtls_protocol_list: |
1370 | * | 1370 | * |
1371 | * Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc. | 1371 | * Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc. |
1372 | * | 1372 | * |
@@ -1375,13 +1375,13 @@ gnutls_protocol_get_id (const char *name) | |||
1375 | * | 1375 | * |
1376 | **/ | 1376 | **/ |
1377 | const gnutls_protocol_t * | 1377 | const gnutls_protocol_t * |
1378 | gnutls_protocol_list (void) | 1378 | MHD_gtls_protocol_list (void) |
1379 | { | 1379 | { |
1380 | return supported_protocols; | 1380 | return supported_protocols; |
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | int | 1383 | int |
1384 | _gnutls_version_get_minor (gnutls_protocol_t version) | 1384 | mhd_gtls_version_get_minor (gnutls_protocol_t version) |
1385 | { | 1385 | { |
1386 | int ret = -1; | 1386 | int ret = -1; |
1387 | 1387 | ||
@@ -1390,7 +1390,7 @@ _gnutls_version_get_minor (gnutls_protocol_t version) | |||
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | gnutls_protocol_t | 1392 | gnutls_protocol_t |
1393 | _gnutls_version_get (int major, int minor) | 1393 | mhd_gtls_version_get (int major, int minor) |
1394 | { | 1394 | { |
1395 | int ret = -1; | 1395 | int ret = -1; |
1396 | 1396 | ||
@@ -1401,7 +1401,7 @@ _gnutls_version_get (int major, int minor) | |||
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | int | 1403 | int |
1404 | _gnutls_version_get_major (gnutls_protocol_t version) | 1404 | mhd_gtls_version_get_major (gnutls_protocol_t version) |
1405 | { | 1405 | { |
1406 | int ret = -1; | 1406 | int ret = -1; |
1407 | 1407 | ||
@@ -1412,7 +1412,7 @@ _gnutls_version_get_major (gnutls_protocol_t version) | |||
1412 | /* Version Functions */ | 1412 | /* Version Functions */ |
1413 | 1413 | ||
1414 | int | 1414 | int |
1415 | _gnutls_version_is_supported (gnutls_session_t session, | 1415 | mhd_gtls_version_is_supported (mhd_gtls_session_t session, |
1416 | const gnutls_protocol_t version) | 1416 | const gnutls_protocol_t version) |
1417 | { | 1417 | { |
1418 | int ret = 0; | 1418 | int ret = 0; |
@@ -1421,7 +1421,7 @@ _gnutls_version_is_supported (gnutls_session_t session, | |||
1421 | if (ret == 0) | 1421 | if (ret == 0) |
1422 | return 0; | 1422 | return 0; |
1423 | 1423 | ||
1424 | if (_gnutls_version_priority (session, version) < 0) | 1424 | if (mhd_gtls_version_priority (session, version) < 0) |
1425 | return 0; /* disabled by the user */ | 1425 | return 0; /* disabled by the user */ |
1426 | else | 1426 | else |
1427 | return 1; | 1427 | return 1; |
@@ -1429,7 +1429,7 @@ _gnutls_version_is_supported (gnutls_session_t session, | |||
1429 | 1429 | ||
1430 | /* Type to KX mappings */ | 1430 | /* Type to KX mappings */ |
1431 | gnutls_kx_algorithm_t | 1431 | gnutls_kx_algorithm_t |
1432 | _gnutls_map_kx_get_kx (gnutls_credentials_type_t type, int server) | 1432 | mhd_gtls_map_kx_get_kx (gnutls_credentials_type_t type, int server) |
1433 | { | 1433 | { |
1434 | gnutls_kx_algorithm_t ret = -1; | 1434 | gnutls_kx_algorithm_t ret = -1; |
1435 | 1435 | ||
@@ -1445,7 +1445,7 @@ _gnutls_map_kx_get_kx (gnutls_credentials_type_t type, int server) | |||
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | gnutls_credentials_type_t | 1447 | gnutls_credentials_type_t |
1448 | _gnutls_map_kx_get_cred (gnutls_kx_algorithm_t algorithm, int server) | 1448 | mhd_gtls_map_kx_get_cred (gnutls_kx_algorithm_t algorithm, int server) |
1449 | { | 1449 | { |
1450 | gnutls_credentials_type_t ret = -1; | 1450 | gnutls_credentials_type_t ret = -1; |
1451 | if (server) | 1451 | if (server) |
@@ -1464,7 +1464,7 @@ _gnutls_map_kx_get_cred (gnutls_kx_algorithm_t algorithm, int server) | |||
1464 | 1464 | ||
1465 | /* Cipher Suite's functions */ | 1465 | /* Cipher Suite's functions */ |
1466 | gnutls_cipher_algorithm_t | 1466 | gnutls_cipher_algorithm_t |
1467 | _gnutls_cipher_suite_get_cipher_algo (const cipher_suite_st * suite) | 1467 | mhd_gtls_cipher_suite_get_cipher_algo (const cipher_suite_st * suite) |
1468 | { | 1468 | { |
1469 | int ret = 0; | 1469 | int ret = 0; |
1470 | GNUTLS_CIPHER_SUITE_ALG_LOOP (ret = p->block_algorithm); | 1470 | GNUTLS_CIPHER_SUITE_ALG_LOOP (ret = p->block_algorithm); |
@@ -1472,7 +1472,7 @@ _gnutls_cipher_suite_get_cipher_algo (const cipher_suite_st * suite) | |||
1472 | } | 1472 | } |
1473 | 1473 | ||
1474 | gnutls_protocol_t | 1474 | gnutls_protocol_t |
1475 | _gnutls_cipher_suite_get_version (const cipher_suite_st * suite) | 1475 | mhd_gtls_cipher_suite_get_version (const cipher_suite_st * suite) |
1476 | { | 1476 | { |
1477 | int ret = 0; | 1477 | int ret = 0; |
1478 | GNUTLS_CIPHER_SUITE_ALG_LOOP (ret = p->version); | 1478 | GNUTLS_CIPHER_SUITE_ALG_LOOP (ret = p->version); |
@@ -1480,7 +1480,7 @@ _gnutls_cipher_suite_get_version (const cipher_suite_st * suite) | |||
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | gnutls_kx_algorithm_t | 1482 | gnutls_kx_algorithm_t |
1483 | _gnutls_cipher_suite_get_kx_algo (const cipher_suite_st * suite) | 1483 | mhd_gtls_cipher_suite_get_kx_algo (const cipher_suite_st * suite) |
1484 | { | 1484 | { |
1485 | int ret = 0; | 1485 | int ret = 0; |
1486 | 1486 | ||
@@ -1490,7 +1490,7 @@ _gnutls_cipher_suite_get_kx_algo (const cipher_suite_st * suite) | |||
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | gnutls_mac_algorithm_t | 1492 | gnutls_mac_algorithm_t |
1493 | _gnutls_cipher_suite_get_mac_algo (const cipher_suite_st * suite) | 1493 | mhd_gtls_cipher_suite_get_mac_algo (const cipher_suite_st * suite) |
1494 | { /* In bytes */ | 1494 | { /* In bytes */ |
1495 | int ret = 0; | 1495 | int ret = 0; |
1496 | GNUTLS_CIPHER_SUITE_ALG_LOOP (ret = p->mac_algorithm); | 1496 | GNUTLS_CIPHER_SUITE_ALG_LOOP (ret = p->mac_algorithm); |
@@ -1499,7 +1499,7 @@ _gnutls_cipher_suite_get_mac_algo (const cipher_suite_st * suite) | |||
1499 | } | 1499 | } |
1500 | 1500 | ||
1501 | const char * | 1501 | const char * |
1502 | _gnutls_cipher_suite_get_name (cipher_suite_st * suite) | 1502 | mhd_gtls_cipher_suite_get_name (cipher_suite_st * suite) |
1503 | { | 1503 | { |
1504 | const char *ret = NULL; | 1504 | const char *ret = NULL; |
1505 | 1505 | ||
@@ -1509,78 +1509,6 @@ _gnutls_cipher_suite_get_name (cipher_suite_st * suite) | |||
1509 | return ret; | 1509 | return ret; |
1510 | } | 1510 | } |
1511 | 1511 | ||
1512 | /** | ||
1513 | * gnutls_cipher_suite_get_name - Returns a string with the name of the specified cipher suite | ||
1514 | * @kx_algorithm: is a Key exchange algorithm | ||
1515 | * @cipher_algorithm: is a cipher algorithm | ||
1516 | * @mac_algorithm: is a MAC algorithm | ||
1517 | * | ||
1518 | * Note that the full cipher suite name must be prepended by TLS or | ||
1519 | * SSL depending of the protocol in use. | ||
1520 | * | ||
1521 | * Returns: a string that contains the name of a TLS cipher suite, | ||
1522 | * specified by the given algorithms, or %NULL. | ||
1523 | **/ | ||
1524 | const char * | ||
1525 | gnutls_cipher_suite_get_name (gnutls_kx_algorithm_t kx_algorithm, | ||
1526 | gnutls_cipher_algorithm_t cipher_algorithm, | ||
1527 | gnutls_mac_algorithm_t mac_algorithm) | ||
1528 | { | ||
1529 | const char *ret = NULL; | ||
1530 | |||
1531 | /* avoid prefix */ | ||
1532 | GNUTLS_CIPHER_SUITE_LOOP (if (kx_algorithm == p->kx_algorithm && | ||
1533 | cipher_algorithm == p->block_algorithm && | ||
1534 | mac_algorithm == p->mac_algorithm) | ||
1535 | ret = p->name + sizeof ("GNUTLS_") - 1) | ||
1536 | ; | ||
1537 | |||
1538 | return ret; | ||
1539 | } | ||
1540 | |||
1541 | /** | ||
1542 | * gnutls_cipher_suite_info: | ||
1543 | * @idx: index of cipher suite to get information about, starts on 0. | ||
1544 | * @cs_id: output buffer with room for 2 bytes, indicating cipher suite value | ||
1545 | * @kx: output variable indicating key exchange algorithm, or %NULL. | ||
1546 | * @cipher: output variable indicating cipher, or %NULL. | ||
1547 | * @mac: output variable indicating MAC algorithm, or %NULL. | ||
1548 | * @version: output variable indicating TLS protocol version, or %NULL. | ||
1549 | * | ||
1550 | * Get information about supported cipher suites. Use the function | ||
1551 | * iteratively to get information about all supported cipher suites. | ||
1552 | * Call with idx=0 to get information about first cipher suite, then | ||
1553 | * idx=1 and so on until the function returns NULL. | ||
1554 | * | ||
1555 | * Returns: the name of @idx cipher suite, and set the information | ||
1556 | * about the cipher suite in the output variables. If @idx is out of | ||
1557 | * bounds, %NULL is returned. | ||
1558 | **/ | ||
1559 | const char * | ||
1560 | gnutls_cipher_suite_info (size_t idx, | ||
1561 | char *cs_id, | ||
1562 | gnutls_kx_algorithm_t * kx, | ||
1563 | gnutls_cipher_algorithm_t * cipher, | ||
1564 | gnutls_mac_algorithm_t * mac, | ||
1565 | gnutls_protocol_t * version) | ||
1566 | { | ||
1567 | if (idx >= CIPHER_SUITES_COUNT) | ||
1568 | return NULL; | ||
1569 | |||
1570 | if (cs_id) | ||
1571 | memcpy (cs_id, cs_algorithms[idx].id.suite, 2); | ||
1572 | if (kx) | ||
1573 | *kx = cs_algorithms[idx].kx_algorithm; | ||
1574 | if (cipher) | ||
1575 | *cipher = cs_algorithms[idx].block_algorithm; | ||
1576 | if (mac) | ||
1577 | *mac = cs_algorithms[idx].mac_algorithm; | ||
1578 | if (version) | ||
1579 | *version = cs_algorithms[idx].version; | ||
1580 | |||
1581 | return cs_algorithms[idx].name + sizeof ("GNU") - 1; | ||
1582 | } | ||
1583 | |||
1584 | static inline int | 1512 | static inline int |
1585 | _gnutls_cipher_suite_is_ok (cipher_suite_st * suite) | 1513 | _gnutls_cipher_suite_is_ok (cipher_suite_st * suite) |
1586 | { | 1514 | { |
@@ -1602,11 +1530,11 @@ _gnutls_cipher_suite_is_ok (cipher_suite_st * suite) | |||
1602 | 1530 | ||
1603 | #define MAX_ELEM_SIZE 4 | 1531 | #define MAX_ELEM_SIZE 4 |
1604 | static inline int | 1532 | static inline int |
1605 | _gnutls_partition (gnutls_session_t session, | 1533 | _gnutls_partition (mhd_gtls_session_t session, |
1606 | void *_base, | 1534 | void *_base, |
1607 | size_t nmemb, | 1535 | size_t nmemb, |
1608 | size_t size, | 1536 | size_t size, |
1609 | int (*compar) (gnutls_session_t, | 1537 | int (*compar) (mhd_gtls_session_t, |
1610 | const void *, const void *)) | 1538 | const void *, const void *)) |
1611 | { | 1539 | { |
1612 | uint8_t *base = _base; | 1540 | uint8_t *base = _base; |
@@ -1650,11 +1578,11 @@ _gnutls_partition (gnutls_session_t session, | |||
1650 | } | 1578 | } |
1651 | 1579 | ||
1652 | static void | 1580 | static void |
1653 | _gnutls_qsort (gnutls_session_t session, | 1581 | _gnutls_qsort (mhd_gtls_session_t session, |
1654 | void *_base, | 1582 | void *_base, |
1655 | size_t nmemb, | 1583 | size_t nmemb, |
1656 | size_t size, | 1584 | size_t size, |
1657 | int (*compar) (gnutls_session_t, const void *, const void *)) | 1585 | int (*compar) (mhd_gtls_session_t, const void *, const void *)) |
1658 | { | 1586 | { |
1659 | unsigned int pivot; | 1587 | unsigned int pivot; |
1660 | char *base = _base; | 1588 | char *base = _base; |
@@ -1683,28 +1611,28 @@ _gnutls_qsort (gnutls_session_t session, | |||
1683 | * For use with qsort | 1611 | * For use with qsort |
1684 | */ | 1612 | */ |
1685 | static int | 1613 | static int |
1686 | _gnutls_compare_algo (gnutls_session_t session, | 1614 | _gnutls_compare_algo (mhd_gtls_session_t session, |
1687 | const void *i_A1, const void *i_A2) | 1615 | const void *i_A1, const void *i_A2) |
1688 | { | 1616 | { |
1689 | gnutls_kx_algorithm_t kA1 = | 1617 | gnutls_kx_algorithm_t kA1 = |
1690 | _gnutls_cipher_suite_get_kx_algo ((const cipher_suite_st *) i_A1); | 1618 | mhd_gtls_cipher_suite_get_kx_algo ((const cipher_suite_st *) i_A1); |
1691 | gnutls_kx_algorithm_t kA2 = | 1619 | gnutls_kx_algorithm_t kA2 = |
1692 | _gnutls_cipher_suite_get_kx_algo ((const cipher_suite_st *) i_A2); | 1620 | mhd_gtls_cipher_suite_get_kx_algo ((const cipher_suite_st *) i_A2); |
1693 | gnutls_cipher_algorithm_t cA1 = | 1621 | gnutls_cipher_algorithm_t cA1 = |
1694 | _gnutls_cipher_suite_get_cipher_algo ((const cipher_suite_st *) i_A1); | 1622 | mhd_gtls_cipher_suite_get_cipher_algo ((const cipher_suite_st *) i_A1); |
1695 | gnutls_cipher_algorithm_t cA2 = | 1623 | gnutls_cipher_algorithm_t cA2 = |
1696 | _gnutls_cipher_suite_get_cipher_algo ((const cipher_suite_st *) i_A2); | 1624 | mhd_gtls_cipher_suite_get_cipher_algo ((const cipher_suite_st *) i_A2); |
1697 | gnutls_mac_algorithm_t mA1 = | 1625 | gnutls_mac_algorithm_t mA1 = |
1698 | _gnutls_cipher_suite_get_mac_algo ((const cipher_suite_st *) i_A1); | 1626 | mhd_gtls_cipher_suite_get_mac_algo ((const cipher_suite_st *) i_A1); |
1699 | gnutls_mac_algorithm_t mA2 = | 1627 | gnutls_mac_algorithm_t mA2 = |
1700 | _gnutls_cipher_suite_get_mac_algo ((const cipher_suite_st *) i_A2); | 1628 | mhd_gtls_cipher_suite_get_mac_algo ((const cipher_suite_st *) i_A2); |
1701 | 1629 | ||
1702 | int p1 = (_gnutls_kx_priority (session, kA1) + 1) * 64; | 1630 | int p1 = (mhd_gtls_kx_priority (session, kA1) + 1) * 64; |
1703 | int p2 = (_gnutls_kx_priority (session, kA2) + 1) * 64; | 1631 | int p2 = (mhd_gtls_kx_priority (session, kA2) + 1) * 64; |
1704 | p1 += (_gnutls_cipher_priority (session, cA1) + 1) * 8; | 1632 | p1 += (mhd_gtls_cipher_priority (session, cA1) + 1) * 8; |
1705 | p2 += (_gnutls_cipher_priority (session, cA2) + 1) * 8; | 1633 | p2 += (mhd_gtls_cipher_priority (session, cA2) + 1) * 8; |
1706 | p1 += _gnutls_mac_priority (session, mA1); | 1634 | p1 += mhd_gtls_mac_priority (session, mA1); |
1707 | p2 += _gnutls_mac_priority (session, mA2); | 1635 | p2 += mhd_gtls_mac_priority (session, mA2); |
1708 | 1636 | ||
1709 | if (p1 > p2) | 1637 | if (p1 > p2) |
1710 | { | 1638 | { |
@@ -1722,8 +1650,8 @@ _gnutls_compare_algo (gnutls_session_t session, | |||
1722 | 1650 | ||
1723 | #ifdef SORT_DEBUG | 1651 | #ifdef SORT_DEBUG |
1724 | static void | 1652 | static void |
1725 | _gnutls_bsort (gnutls_session_t session, void *_base, size_t nmemb, | 1653 | _gnutls_bsort (mhd_gtls_session_t session, void *_base, size_t nmemb, |
1726 | size_t size, int (*compar) (gnutls_session_t, const void *, | 1654 | size_t size, int (*compar) (mhd_gtls_session_t, const void *, |
1727 | const void *)) | 1655 | const void *)) |
1728 | { | 1656 | { |
1729 | unsigned int i, j; | 1657 | unsigned int i, j; |
@@ -1746,7 +1674,7 @@ _gnutls_bsort (gnutls_session_t session, void *_base, size_t nmemb, | |||
1746 | #endif | 1674 | #endif |
1747 | 1675 | ||
1748 | int | 1676 | int |
1749 | _gnutls_supported_ciphersuites_sorted (gnutls_session_t session, | 1677 | mhd_gtls_supported_ciphersuites_sorted (mhd_gtls_session_t session, |
1750 | cipher_suite_st ** ciphers) | 1678 | cipher_suite_st ** ciphers) |
1751 | { | 1679 | { |
1752 | 1680 | ||
@@ -1755,7 +1683,7 @@ _gnutls_supported_ciphersuites_sorted (gnutls_session_t session, | |||
1755 | #endif | 1683 | #endif |
1756 | int count; | 1684 | int count; |
1757 | 1685 | ||
1758 | count = _gnutls_supported_ciphersuites (session, ciphers); | 1686 | count = mhd_gtls_supported_ciphersuites (session, ciphers); |
1759 | if (count <= 0) | 1687 | if (count <= 0) |
1760 | { | 1688 | { |
1761 | gnutls_assert (); | 1689 | gnutls_assert (); |
@@ -1765,7 +1693,7 @@ _gnutls_supported_ciphersuites_sorted (gnutls_session_t session, | |||
1765 | _gnutls_debug_log ("Unsorted: \n"); | 1693 | _gnutls_debug_log ("Unsorted: \n"); |
1766 | for (i = 0; i < count; i++) | 1694 | for (i = 0; i < count; i++) |
1767 | _gnutls_debug_log ("\t%d: %s\n", i, | 1695 | _gnutls_debug_log ("\t%d: %s\n", i, |
1768 | _gnutls_cipher_suite_get_name ((*ciphers)[i])); | 1696 | mhd_gtls_cipher_suite_get_name ((*ciphers)[i])); |
1769 | #endif | 1697 | #endif |
1770 | 1698 | ||
1771 | _gnutls_qsort (session, *ciphers, count, sizeof (cipher_suite_st), | 1699 | _gnutls_qsort (session, *ciphers, count, sizeof (cipher_suite_st), |
@@ -1775,14 +1703,14 @@ _gnutls_supported_ciphersuites_sorted (gnutls_session_t session, | |||
1775 | _gnutls_debug_log ("Sorted: \n"); | 1703 | _gnutls_debug_log ("Sorted: \n"); |
1776 | for (i = 0; i < count; i++) | 1704 | for (i = 0; i < count; i++) |
1777 | _gnutls_debug_log ("\t%d: %s\n", i, | 1705 | _gnutls_debug_log ("\t%d: %s\n", i, |
1778 | _gnutls_cipher_suite_get_name ((*ciphers)[i])); | 1706 | mhd_gtls_cipher_suite_get_name ((*ciphers)[i])); |
1779 | #endif | 1707 | #endif |
1780 | 1708 | ||
1781 | return count; | 1709 | return count; |
1782 | } | 1710 | } |
1783 | 1711 | ||
1784 | int | 1712 | int |
1785 | _gnutls_supported_ciphersuites (gnutls_session_t session, | 1713 | mhd_gtls_supported_ciphersuites (mhd_gtls_session_t session, |
1786 | cipher_suite_st ** _ciphers) | 1714 | cipher_suite_st ** _ciphers) |
1787 | { | 1715 | { |
1788 | 1716 | ||
@@ -1808,7 +1736,7 @@ _gnutls_supported_ciphersuites (gnutls_session_t session, | |||
1808 | return GNUTLS_E_MEMORY_ERROR; | 1736 | return GNUTLS_E_MEMORY_ERROR; |
1809 | } | 1737 | } |
1810 | 1738 | ||
1811 | version = gnutls_protocol_get_version (session); | 1739 | version = MHD_gnutls_protocol_get_version (session); |
1812 | 1740 | ||
1813 | for (i = 0; i < count; i++) | 1741 | for (i = 0; i < count; i++) |
1814 | { | 1742 | { |
@@ -1827,19 +1755,19 @@ _gnutls_supported_ciphersuites (gnutls_session_t session, | |||
1827 | /* remove cipher suites which do not support the | 1755 | /* remove cipher suites which do not support the |
1828 | * protocol version used. | 1756 | * protocol version used. |
1829 | */ | 1757 | */ |
1830 | if (_gnutls_cipher_suite_get_version (&tmp_ciphers[i]) > version) | 1758 | if (mhd_gtls_cipher_suite_get_version (&tmp_ciphers[i]) > version) |
1831 | continue; | 1759 | continue; |
1832 | 1760 | ||
1833 | if (_gnutls_kx_priority (session, | 1761 | if (mhd_gtls_kx_priority (session, |
1834 | _gnutls_cipher_suite_get_kx_algo (&tmp_ciphers | 1762 | mhd_gtls_cipher_suite_get_kx_algo (&tmp_ciphers |
1835 | [i])) < 0) | 1763 | [i])) < 0) |
1836 | continue; | 1764 | continue; |
1837 | if (_gnutls_mac_priority (session, | 1765 | if (mhd_gtls_mac_priority (session, |
1838 | _gnutls_cipher_suite_get_mac_algo | 1766 | mhd_gtls_cipher_suite_get_mac_algo |
1839 | (&tmp_ciphers[i])) < 0) | 1767 | (&tmp_ciphers[i])) < 0) |
1840 | continue; | 1768 | continue; |
1841 | if (_gnutls_cipher_priority (session, | 1769 | if (mhd_gtls_cipher_priority (session, |
1842 | _gnutls_cipher_suite_get_cipher_algo | 1770 | mhd_gtls_cipher_suite_get_cipher_algo |
1843 | (&tmp_ciphers[i])) < 0) | 1771 | (&tmp_ciphers[i])) < 0) |
1844 | continue; | 1772 | continue; |
1845 | 1773 | ||
@@ -1853,7 +1781,7 @@ _gnutls_supported_ciphersuites (gnutls_session_t session, | |||
1853 | if (ret_count > 0 && ret_count != count) | 1781 | if (ret_count > 0 && ret_count != count) |
1854 | { | 1782 | { |
1855 | ciphers = | 1783 | ciphers = |
1856 | gnutls_realloc_fast (ciphers, ret_count * sizeof (cipher_suite_st)); | 1784 | mhd_gtls_realloc_fast (ciphers, ret_count * sizeof (cipher_suite_st)); |
1857 | } | 1785 | } |
1858 | else | 1786 | else |
1859 | { | 1787 | { |
@@ -1888,7 +1816,7 @@ _gnutls_supported_ciphersuites (gnutls_session_t session, | |||
1888 | */ | 1816 | */ |
1889 | #define SUPPORTED_COMPRESSION_METHODS session->internals.priorities.compression.num_algorithms | 1817 | #define SUPPORTED_COMPRESSION_METHODS session->internals.priorities.compression.num_algorithms |
1890 | int | 1818 | int |
1891 | _gnutls_supported_compression_methods (gnutls_session_t session, | 1819 | mhd_gtls_supported_compression_methods (mhd_gtls_session_t session, |
1892 | uint8_t ** comp) | 1820 | uint8_t ** comp) |
1893 | { | 1821 | { |
1894 | unsigned int i, j; | 1822 | unsigned int i, j; |
@@ -1899,7 +1827,7 @@ _gnutls_supported_compression_methods (gnutls_session_t session, | |||
1899 | 1827 | ||
1900 | for (i = j = 0; i < SUPPORTED_COMPRESSION_METHODS; i++) | 1828 | for (i = j = 0; i < SUPPORTED_COMPRESSION_METHODS; i++) |
1901 | { | 1829 | { |
1902 | int tmp = _gnutls_compression_get_num (session->internals.priorities. | 1830 | int tmp = mhd_gtls_compression_get_num (session->internals.priorities. |
1903 | compression.priority[i]); | 1831 | compression.priority[i]); |
1904 | 1832 | ||
1905 | /* remove private compression algorithms, if requested. | 1833 | /* remove private compression algorithms, if requested. |
@@ -1926,14 +1854,14 @@ _gnutls_supported_compression_methods (gnutls_session_t session, | |||
1926 | } | 1854 | } |
1927 | 1855 | ||
1928 | /** | 1856 | /** |
1929 | * gnutls_certificate_type_get_name - Returns a string with the name of the specified certificate type | 1857 | * MHD_gnutls_certificate_type_get_name - Returns a string with the name of the specified certificate type |
1930 | * @type: is a certificate type | 1858 | * @type: is a certificate type |
1931 | * | 1859 | * |
1932 | * Returns: a string (or %NULL) that contains the name of the | 1860 | * Returns: a string (or %NULL) that contains the name of the |
1933 | * specified certificate type. | 1861 | * specified certificate type. |
1934 | **/ | 1862 | **/ |
1935 | const char * | 1863 | const char * |
1936 | gnutls_certificate_type_get_name (gnutls_certificate_type_t type) | 1864 | MHD_gnutls_certificate_type_get_name (gnutls_certificate_type_t type) |
1937 | { | 1865 | { |
1938 | const char *ret = NULL; | 1866 | const char *ret = NULL; |
1939 | 1867 | ||
@@ -1946,7 +1874,7 @@ gnutls_certificate_type_get_name (gnutls_certificate_type_t type) | |||
1946 | } | 1874 | } |
1947 | 1875 | ||
1948 | /** | 1876 | /** |
1949 | * gnutls_certificate_type_get_id - Returns the gnutls id of the specified in string type | 1877 | * MHD_gtls_certificate_type_get_id - Returns the gnutls id of the specified in string type |
1950 | * @name: is a certificate type name | 1878 | * @name: is a certificate type name |
1951 | * | 1879 | * |
1952 | * The names are compared in a case insensitive way. | 1880 | * The names are compared in a case insensitive way. |
@@ -1955,7 +1883,7 @@ gnutls_certificate_type_get_name (gnutls_certificate_type_t type) | |||
1955 | * %GNUTLS_CRT_UNKNOWN on error. | 1883 | * %GNUTLS_CRT_UNKNOWN on error. |
1956 | **/ | 1884 | **/ |
1957 | gnutls_certificate_type_t | 1885 | gnutls_certificate_type_t |
1958 | gnutls_certificate_type_get_id (const char *name) | 1886 | MHD_gtls_certificate_type_get_id (const char *name) |
1959 | { | 1887 | { |
1960 | gnutls_certificate_type_t ret = MHD_GNUTLS_CRT_UNKNOWN; | 1888 | gnutls_certificate_type_t ret = MHD_GNUTLS_CRT_UNKNOWN; |
1961 | 1889 | ||
@@ -1974,7 +1902,7 @@ static const gnutls_certificate_type_t supported_certificate_types[] = | |||
1974 | }; | 1902 | }; |
1975 | 1903 | ||
1976 | /** | 1904 | /** |
1977 | * gnutls_certificate_type_list: | 1905 | * MHD_gtls_certificate_type_list: |
1978 | * | 1906 | * |
1979 | * Get a list of certificate types. Note that to be able to use | 1907 | * Get a list of certificate types. Note that to be able to use |
1980 | * OpenPGP certificates, you must link to libgnutls-extra and call | 1908 | * OpenPGP certificates, you must link to libgnutls-extra and call |
@@ -1985,7 +1913,7 @@ static const gnutls_certificate_type_t supported_certificate_types[] = | |||
1985 | * | 1913 | * |
1986 | **/ | 1914 | **/ |
1987 | const gnutls_certificate_type_t * | 1915 | const gnutls_certificate_type_t * |
1988 | gnutls_certificate_type_list (void) | 1916 | MHD_gtls_certificate_type_list (void) |
1989 | { | 1917 | { |
1990 | return supported_certificate_types; | 1918 | return supported_certificate_types; |
1991 | } | 1919 | } |
@@ -1994,7 +1922,7 @@ gnutls_certificate_type_list (void) | |||
1994 | * the given gnutls_kx_algorithm_t. | 1922 | * the given gnutls_kx_algorithm_t. |
1995 | */ | 1923 | */ |
1996 | gnutls_pk_algorithm_t | 1924 | gnutls_pk_algorithm_t |
1997 | _gnutls_map_pk_get_pk (gnutls_kx_algorithm_t kx_algorithm) | 1925 | mhd_gtls_map_pk_get_pk (gnutls_kx_algorithm_t kx_algorithm) |
1998 | { | 1926 | { |
1999 | gnutls_pk_algorithm_t ret = -1; | 1927 | gnutls_pk_algorithm_t ret = -1; |
2000 | 1928 | ||
@@ -2007,7 +1935,7 @@ _gnutls_map_pk_get_pk (gnutls_kx_algorithm_t kx_algorithm) | |||
2007 | * ex. GNUTLS_KX_RSA requires a certificate able to encrypt... so returns CIPHER_ENCRYPT. | 1935 | * ex. GNUTLS_KX_RSA requires a certificate able to encrypt... so returns CIPHER_ENCRYPT. |
2008 | */ | 1936 | */ |
2009 | enum encipher_type | 1937 | enum encipher_type |
2010 | _gnutls_kx_encipher_type (gnutls_kx_algorithm_t kx_algorithm) | 1938 | mhd_gtls_kx_encipher_type (gnutls_kx_algorithm_t kx_algorithm) |
2011 | { | 1939 | { |
2012 | int ret = CIPHER_IGN; | 1940 | int ret = CIPHER_IGN; |
2013 | GNUTLS_PK_MAP_ALG_LOOP (ret = p->encipher_type) return ret; | 1941 | GNUTLS_PK_MAP_ALG_LOOP (ret = p->encipher_type) return ret; |
@@ -2068,26 +1996,8 @@ static const gnutls_sign_entry sign_algorithms[] = { | |||
2068 | #define GNUTLS_SIGN_ALG_LOOP(a) \ | 1996 | #define GNUTLS_SIGN_ALG_LOOP(a) \ |
2069 | GNUTLS_SIGN_LOOP( if(p->id && p->id == sign) { a; break; } ) | 1997 | GNUTLS_SIGN_LOOP( if(p->id && p->id == sign) { a; break; } ) |
2070 | 1998 | ||
2071 | /** | ||
2072 | * gnutls_sign_algorithm_get_name - Returns a string with the name of the specified sign algorithm | ||
2073 | * @algorithm: is a sign algorithm | ||
2074 | * | ||
2075 | * Returns: a string that contains the name of the specified sign | ||
2076 | * algorithm, or %NULL. | ||
2077 | **/ | ||
2078 | const char * | ||
2079 | gnutls_sign_algorithm_get_name (gnutls_sign_algorithm_t sign) | ||
2080 | { | ||
2081 | const char *ret = NULL; | ||
2082 | |||
2083 | /* avoid prefix */ | ||
2084 | GNUTLS_SIGN_ALG_LOOP (ret = p->name); | ||
2085 | |||
2086 | return ret; | ||
2087 | } | ||
2088 | |||
2089 | gnutls_sign_algorithm_t | 1999 | gnutls_sign_algorithm_t |
2090 | _gnutls_x509_oid2sign_algorithm (const char *oid) | 2000 | mhd_gtls_x509_oid2sign_algorithm (const char *oid) |
2091 | { | 2001 | { |
2092 | gnutls_sign_algorithm_t ret = 0; | 2002 | gnutls_sign_algorithm_t ret = 0; |
2093 | 2003 | ||
@@ -2105,7 +2015,7 @@ _gnutls_x509_oid2sign_algorithm (const char *oid) | |||
2105 | } | 2015 | } |
2106 | 2016 | ||
2107 | gnutls_sign_algorithm_t | 2017 | gnutls_sign_algorithm_t |
2108 | _gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_mac_algorithm_t mac) | 2018 | mhd_gtls_x509_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_mac_algorithm_t mac) |
2109 | { | 2019 | { |
2110 | gnutls_sign_algorithm_t ret = 0; | 2020 | gnutls_sign_algorithm_t ret = 0; |
2111 | 2021 | ||
@@ -2120,13 +2030,13 @@ _gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_mac_algorithm_t mac) | |||
2120 | } | 2030 | } |
2121 | 2031 | ||
2122 | const char * | 2032 | const char * |
2123 | _gnutls_x509_sign_to_oid (gnutls_pk_algorithm_t pk, | 2033 | mhd_gtls_x509_sign_to_oid (gnutls_pk_algorithm_t pk, |
2124 | gnutls_mac_algorithm_t mac) | 2034 | gnutls_mac_algorithm_t mac) |
2125 | { | 2035 | { |
2126 | gnutls_sign_algorithm_t sign; | 2036 | gnutls_sign_algorithm_t sign; |
2127 | const char *ret = NULL; | 2037 | const char *ret = NULL; |
2128 | 2038 | ||
2129 | sign = _gnutls_x509_pk_to_sign (pk, mac); | 2039 | sign = mhd_gtls_x509_pk_to_sign (pk, mac); |
2130 | if (sign == GNUTLS_SIGN_UNKNOWN) | 2040 | if (sign == GNUTLS_SIGN_UNKNOWN) |
2131 | return NULL; | 2041 | return NULL; |
2132 | 2042 | ||
@@ -2159,31 +2069,8 @@ static const gnutls_pk_entry pk_algorithms[] = { | |||
2159 | 0} | 2069 | 0} |
2160 | }; | 2070 | }; |
2161 | 2071 | ||
2162 | /** | ||
2163 | * gnutls_pk_algorithm_get_name - Returns a string with the name of the specified public key algorithm | ||
2164 | * @algorithm: is a pk algorithm | ||
2165 | * | ||
2166 | * Returns: a string that contains the name of the specified public | ||
2167 | * key algorithm, or %NULL. | ||
2168 | **/ | ||
2169 | const char * | ||
2170 | gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm) | ||
2171 | { | ||
2172 | const char *ret = NULL; | ||
2173 | const gnutls_pk_entry *p; | ||
2174 | |||
2175 | for (p = pk_algorithms; p->name != NULL; p++) | ||
2176 | if (p->id && p->id == algorithm) | ||
2177 | { | ||
2178 | ret = p->name; | ||
2179 | break; | ||
2180 | } | ||
2181 | |||
2182 | return ret; | ||
2183 | } | ||
2184 | |||
2185 | gnutls_pk_algorithm_t | 2072 | gnutls_pk_algorithm_t |
2186 | _gnutls_x509_oid2pk_algorithm (const char *oid) | 2073 | mhd_gtls_x509_oid2pk_algorithm (const char *oid) |
2187 | { | 2074 | { |
2188 | gnutls_pk_algorithm_t ret = MHD_GNUTLS_PK_UNKNOWN; | 2075 | gnutls_pk_algorithm_t ret = MHD_GNUTLS_PK_UNKNOWN; |
2189 | const gnutls_pk_entry *p; | 2076 | const gnutls_pk_entry *p; |
@@ -2199,7 +2086,7 @@ _gnutls_x509_oid2pk_algorithm (const char *oid) | |||
2199 | } | 2086 | } |
2200 | 2087 | ||
2201 | const char * | 2088 | const char * |
2202 | _gnutls_x509_pk_to_oid (gnutls_pk_algorithm_t algorithm) | 2089 | mhd_gtls_x509_pk_to_oid (gnutls_pk_algorithm_t algorithm) |
2203 | { | 2090 | { |
2204 | const char *ret = NULL; | 2091 | const char *ret = NULL; |
2205 | const gnutls_pk_entry *p; | 2092 | const gnutls_pk_entry *p; |
diff --git a/src/daemon/https/tls/gnutls_algorithms.h b/src/daemon/https/tls/gnutls_algorithms.h index fd23ef0a..84198c1a 100644 --- a/src/daemon/https/tls/gnutls_algorithms.h +++ b/src/daemon/https/tls/gnutls_algorithms.h | |||
@@ -23,87 +23,87 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef ALGORITHMS_H | 25 | #ifndef ALGORITHMS_H |
26 | # define ALGORITHMS_H | 26 | #define ALGORITHMS_H |
27 | 27 | ||
28 | #include "gnutls_auth.h" | 28 | #include "gnutls_auth.h" |
29 | 29 | ||
30 | /* Functions for version handling. */ | 30 | /* Functions for version handling. */ |
31 | gnutls_protocol_t _gnutls_version_lowest (gnutls_session_t session); | 31 | gnutls_protocol_t mhd_gtls_version_lowest (mhd_gtls_session_t session); |
32 | gnutls_protocol_t _gnutls_version_max (gnutls_session_t session); | 32 | gnutls_protocol_t mhd_gtls_version_max (mhd_gtls_session_t session); |
33 | int _gnutls_version_priority (gnutls_session_t session, | 33 | int mhd_gtls_version_priority (mhd_gtls_session_t session, |
34 | gnutls_protocol_t version); | 34 | gnutls_protocol_t version); |
35 | int _gnutls_version_is_supported (gnutls_session_t session, | 35 | int mhd_gtls_version_is_supported (mhd_gtls_session_t session, |
36 | const gnutls_protocol_t version); | 36 | const gnutls_protocol_t version); |
37 | int _gnutls_version_get_major (gnutls_protocol_t ver); | 37 | int mhd_gtls_version_get_major (gnutls_protocol_t ver); |
38 | int _gnutls_version_get_minor (gnutls_protocol_t ver); | 38 | int mhd_gtls_version_get_minor (gnutls_protocol_t ver); |
39 | gnutls_protocol_t _gnutls_version_get (int major, int minor); | 39 | gnutls_protocol_t mhd_gtls_version_get (int major, int minor); |
40 | 40 | ||
41 | /* Functions for MACs. */ | 41 | /* Functions for MACs. */ |
42 | int _gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm); | 42 | int mhd_gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm); |
43 | gnutls_mac_algorithm_t _gnutls_x509_oid2mac_algorithm (const char *oid); | 43 | gnutls_mac_algorithm_t mhd_gtls_x509_oid2mac_algorithm (const char *oid); |
44 | const char *_gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t mac); | 44 | const char * mhd_gtls_x509_mac_to_oid (gnutls_mac_algorithm_t mac); |
45 | 45 | ||
46 | /* Functions for cipher suites. */ | 46 | /* Functions for cipher suites. */ |
47 | int _gnutls_supported_ciphersuites (gnutls_session_t session, | 47 | int mhd_gtls_supported_ciphersuites (mhd_gtls_session_t session, |
48 | cipher_suite_st ** ciphers); | 48 | cipher_suite_st ** ciphers); |
49 | int _gnutls_supported_ciphersuites_sorted (gnutls_session_t session, | 49 | int mhd_gtls_supported_ciphersuites_sorted (mhd_gtls_session_t session, |
50 | cipher_suite_st ** ciphers); | 50 | cipher_suite_st ** ciphers); |
51 | int _gnutls_supported_compression_methods (gnutls_session_t session, | 51 | int mhd_gtls_supported_compression_methods (mhd_gtls_session_t session, |
52 | uint8_t ** comp); | 52 | uint8_t ** comp); |
53 | const char *_gnutls_cipher_suite_get_name (cipher_suite_st * algorithm); | 53 | const char * mhd_gtls_cipher_suite_get_name (cipher_suite_st * algorithm); |
54 | gnutls_cipher_algorithm_t _gnutls_cipher_suite_get_cipher_algo (const | 54 | gnutls_cipher_algorithm_t mhd_gtls_cipher_suite_get_cipher_algo (const |
55 | cipher_suite_st | 55 | cipher_suite_st |
56 | * algorithm); | 56 | * algorithm); |
57 | gnutls_kx_algorithm_t _gnutls_cipher_suite_get_kx_algo (const cipher_suite_st | 57 | gnutls_kx_algorithm_t mhd_gtls_cipher_suite_get_kx_algo (const cipher_suite_st |
58 | * algorithm); | 58 | * algorithm); |
59 | gnutls_mac_algorithm_t _gnutls_cipher_suite_get_mac_algo (const | 59 | gnutls_mac_algorithm_t mhd_gtls_cipher_suite_get_mac_algo (const |
60 | cipher_suite_st * | 60 | cipher_suite_st * |
61 | algorithm); | 61 | algorithm); |
62 | gnutls_protocol_t _gnutls_cipher_suite_get_version (const cipher_suite_st * | 62 | gnutls_protocol_t mhd_gtls_cipher_suite_get_version (const cipher_suite_st * |
63 | algorithm); | 63 | algorithm); |
64 | cipher_suite_st _gnutls_cipher_suite_get_suite_name (cipher_suite_st * | 64 | cipher_suite_st mhd_gtls_cipher_suite_get_suite_name (cipher_suite_st * |
65 | algorithm); | 65 | algorithm); |
66 | 66 | ||
67 | /* Functions for ciphers. */ | 67 | /* Functions for ciphers. */ |
68 | int _gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm); | 68 | int mhd_gtls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm); |
69 | int _gnutls_cipher_is_block (gnutls_cipher_algorithm_t algorithm); | 69 | int mhd_gtls_cipher_is_block (gnutls_cipher_algorithm_t algorithm); |
70 | int _gnutls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm); | 70 | int mhd_gtls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm); |
71 | int _gnutls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm); | 71 | int mhd_gtls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm); |
72 | int _gnutls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm); | 72 | int mhd_gtls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm); |
73 | 73 | ||
74 | /* Functions for key exchange. */ | 74 | /* Functions for key exchange. */ |
75 | int _gnutls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm); | 75 | int mhd_gtls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm); |
76 | int _gnutls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm); | 76 | int mhd_gtls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm); |
77 | mod_auth_st *_gnutls_kx_auth_struct (gnutls_kx_algorithm_t algorithm); | 77 | mhd_gtls_mod_auth_st * mhd_gtls_kx_auth_struct (gnutls_kx_algorithm_t algorithm); |
78 | int _gnutls_kx_is_ok (gnutls_kx_algorithm_t algorithm); | 78 | int mhd_gtls_kx_is_ok (gnutls_kx_algorithm_t algorithm); |
79 | 79 | ||
80 | /* Functions for compression. */ | 80 | /* Functions for compression. */ |
81 | int _gnutls_compression_is_ok (gnutls_compression_method_t algorithm); | 81 | int mhd_gtls_compression_is_ok (gnutls_compression_method_t algorithm); |
82 | int _gnutls_compression_get_num (gnutls_compression_method_t algorithm); | 82 | int mhd_gtls_compression_get_num (gnutls_compression_method_t algorithm); |
83 | gnutls_compression_method_t _gnutls_compression_get_id (int num); | 83 | gnutls_compression_method_t mhd_gtls_compression_get_id (int num); |
84 | int _gnutls_compression_get_mem_level (gnutls_compression_method_t algorithm); | 84 | int mhd_gtls_compression_get_mem_level (gnutls_compression_method_t algorithm); |
85 | int _gnutls_compression_get_comp_level (gnutls_compression_method_t | 85 | int mhd_gtls_compression_get_comp_level (gnutls_compression_method_t |
86 | algorithm); | 86 | algorithm); |
87 | int _gnutls_compression_get_wbits (gnutls_compression_method_t algorithm); | 87 | int mhd_gtls_compression_get_wbits (gnutls_compression_method_t algorithm); |
88 | 88 | ||
89 | /* Type to KX mappings. */ | 89 | /* Type to KX mappings. */ |
90 | gnutls_kx_algorithm_t _gnutls_map_kx_get_kx (gnutls_credentials_type_t type, | 90 | gnutls_kx_algorithm_t mhd_gtls_map_kx_get_kx (gnutls_credentials_type_t type, |
91 | int server); | 91 | int server); |
92 | gnutls_credentials_type_t _gnutls_map_kx_get_cred (gnutls_kx_algorithm_t | 92 | gnutls_credentials_type_t mhd_gtls_map_kx_get_cred (gnutls_kx_algorithm_t |
93 | algorithm, int server); | 93 | algorithm, int server); |
94 | 94 | ||
95 | /* KX to PK mapping. */ | 95 | /* KX to PK mapping. */ |
96 | gnutls_pk_algorithm_t _gnutls_map_pk_get_pk (gnutls_kx_algorithm_t | 96 | gnutls_pk_algorithm_t mhd_gtls_map_pk_get_pk (gnutls_kx_algorithm_t |
97 | kx_algorithm); | 97 | kx_algorithm); |
98 | gnutls_pk_algorithm_t _gnutls_x509_oid2pk_algorithm (const char *oid); | 98 | gnutls_pk_algorithm_t mhd_gtls_x509_oid2pk_algorithm (const char *oid); |
99 | const char *_gnutls_x509_pk_to_oid (gnutls_pk_algorithm_t pk); | 99 | const char * mhd_gtls_x509_pk_to_oid (gnutls_pk_algorithm_t pk); |
100 | 100 | ||
101 | enum encipher_type | 101 | enum encipher_type |
102 | { CIPHER_ENCRYPT = 0, CIPHER_SIGN = 1, CIPHER_IGN }; | 102 | { CIPHER_ENCRYPT = 0, CIPHER_SIGN = 1, CIPHER_IGN }; |
103 | 103 | ||
104 | enum encipher_type _gnutls_kx_encipher_type (gnutls_kx_algorithm_t algorithm); | 104 | enum encipher_type mhd_gtls_kx_encipher_type (gnutls_kx_algorithm_t algorithm); |
105 | 105 | ||
106 | struct gnutls_compression_entry | 106 | struct mhd_gtls_compression_entry |
107 | { | 107 | { |
108 | const char *name; | 108 | const char *name; |
109 | gnutls_compression_method_t id; | 109 | gnutls_compression_method_t id; |
@@ -114,28 +114,28 @@ struct gnutls_compression_entry | |||
114 | int mem_level; | 114 | int mem_level; |
115 | int comp_level; | 115 | int comp_level; |
116 | }; | 116 | }; |
117 | typedef struct gnutls_compression_entry gnutls_compression_entry; | 117 | typedef struct mhd_gtls_compression_entry gnutls_compression_entry; |
118 | 118 | ||
119 | /* Functions for sign algorithms. */ | 119 | /* Functions for sign algorithms. */ |
120 | gnutls_sign_algorithm_t _gnutls_x509_oid2sign_algorithm (const char *oid); | 120 | gnutls_sign_algorithm_t mhd_gtls_x509_oid2sign_algorithm (const char *oid); |
121 | gnutls_sign_algorithm_t _gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk, | 121 | gnutls_sign_algorithm_t mhd_gtls_x509_pk_to_sign (gnutls_pk_algorithm_t pk, |
122 | gnutls_mac_algorithm_t mac); | 122 | gnutls_mac_algorithm_t mac); |
123 | const char *_gnutls_x509_sign_to_oid (gnutls_pk_algorithm_t, | 123 | const char * mhd_gtls_x509_sign_to_oid (gnutls_pk_algorithm_t, |
124 | gnutls_mac_algorithm_t mac); | 124 | gnutls_mac_algorithm_t mac); |
125 | 125 | ||
126 | int _gnutls_mac_priority (gnutls_session_t session, | 126 | int mhd_gtls_mac_priority (mhd_gtls_session_t session, |
127 | gnutls_mac_algorithm_t algorithm); | 127 | gnutls_mac_algorithm_t algorithm); |
128 | int _gnutls_cipher_priority (gnutls_session_t session, | 128 | int mhd_gtls_cipher_priority (mhd_gtls_session_t session, |
129 | gnutls_cipher_algorithm_t algorithm); | 129 | gnutls_cipher_algorithm_t algorithm); |
130 | int _gnutls_kx_priority (gnutls_session_t session, | 130 | int mhd_gtls_kx_priority (mhd_gtls_session_t session, |
131 | gnutls_kx_algorithm_t algorithm); | 131 | gnutls_kx_algorithm_t algorithm); |
132 | int _gnutls_compression_priority (gnutls_session_t session, | 132 | int mhd_gtls_compression_priority (mhd_gtls_session_t session, |
133 | gnutls_compression_method_t algorithm); | 133 | gnutls_compression_method_t algorithm); |
134 | 134 | ||
135 | gnutls_mac_algorithm_t gnutls_mac_get_id (const char* name); | 135 | gnutls_mac_algorithm_t MHD_gtls_mac_get_id (const char* name); |
136 | gnutls_cipher_algorithm_t gnutls_cipher_get_id (const char* name); | 136 | gnutls_cipher_algorithm_t MHD_gtls_cipher_get_id (const char* name); |
137 | gnutls_kx_algorithm_t gnutls_kx_get_id (const char* name); | 137 | gnutls_kx_algorithm_t MHD_gtls_kx_get_id (const char* name); |
138 | gnutls_protocol_t gnutls_protocol_get_id (const char* name); | 138 | gnutls_protocol_t MHD_gtls_protocol_get_id (const char* name); |
139 | gnutls_certificate_type_t gnutls_certificate_type_get_id (const char* name); | 139 | gnutls_certificate_type_t MHD_gtls_certificate_type_get_id (const char* name); |
140 | 140 | ||
141 | #endif | 141 | #endif |
diff --git a/src/daemon/https/tls/gnutls_anon_cred.c b/src/daemon/https/tls/gnutls_anon_cred.c index fd0917f8..9fd344db 100644 --- a/src/daemon/https/tls/gnutls_anon_cred.c +++ b/src/daemon/https/tls/gnutls_anon_cred.c | |||
@@ -36,22 +36,22 @@ | |||
36 | static const int anon_dummy; | 36 | static const int anon_dummy; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * gnutls_anon_free_server_credentials - Used to free an allocated gnutls_anon_server_credentials_t structure | 39 | * MHD_gnutls_anon_free_server_credentials - Used to free an allocated mhd_gtls_anon_server_credentials_t structure |
40 | * @sc: is an #gnutls_anon_server_credentials_t structure. | 40 | * @sc: is an #mhd_gtls_anon_server_credentials_t structure. |
41 | * | 41 | * |
42 | * This structure is complex enough to manipulate directly thus this | 42 | * This structure is complex enough to manipulate directly thus this |
43 | * helper function is provided in order to free (deallocate) it. | 43 | * helper function is provided in order to free (deallocate) it. |
44 | **/ | 44 | **/ |
45 | void | 45 | void |
46 | gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc) | 46 | MHD_gnutls_anon_free_server_credentials (mhd_gtls_anon_server_credentials_t sc) |
47 | { | 47 | { |
48 | 48 | ||
49 | gnutls_free (sc); | 49 | gnutls_free (sc); |
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * gnutls_anon_allocate_server_credentials - Used to allocate an gnutls_anon_server_credentials_t structure | 53 | * MHD_gnutls_anon_allocate_server_credentials - Used to allocate an mhd_gtls_anon_server_credentials_t structure |
54 | * @sc: is a pointer to an #gnutls_anon_server_credentials_t structure. | 54 | * @sc: is a pointer to an #mhd_gtls_anon_server_credentials_t structure. |
55 | * | 55 | * |
56 | * This structure is complex enough to manipulate directly thus this | 56 | * This structure is complex enough to manipulate directly thus this |
57 | * helper function is provided in order to allocate it. | 57 | * helper function is provided in order to allocate it. |
@@ -59,10 +59,10 @@ gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc) | |||
59 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 59 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
60 | **/ | 60 | **/ |
61 | int | 61 | int |
62 | gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials_t * | 62 | MHD_gnutls_anon_allocate_server_credentials (mhd_gtls_anon_server_credentials_t * |
63 | sc) | 63 | sc) |
64 | { | 64 | { |
65 | *sc = gnutls_calloc (1, sizeof (anon_server_credentials_st)); | 65 | *sc = gnutls_calloc (1, sizeof (mhd_anon_server_credentials_st)); |
66 | if (*sc == NULL) | 66 | if (*sc == NULL) |
67 | return GNUTLS_E_MEMORY_ERROR; | 67 | return GNUTLS_E_MEMORY_ERROR; |
68 | 68 | ||
@@ -71,20 +71,20 @@ gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials_t * | |||
71 | 71 | ||
72 | 72 | ||
73 | /** | 73 | /** |
74 | * gnutls_anon_free_client_credentials - Used to free an allocated gnutls_anon_client_credentials_t structure | 74 | * MHD_gnutls_anon_free_client_credentials - Used to free an allocated mhd_gtls_anon_client_credentials_t structure |
75 | * @sc: is an #gnutls_anon_client_credentials_t structure. | 75 | * @sc: is an #mhd_gtls_anon_client_credentials_t structure. |
76 | * | 76 | * |
77 | * This structure is complex enough to manipulate directly thus this | 77 | * This structure is complex enough to manipulate directly thus this |
78 | * helper function is provided in order to free (deallocate) it. | 78 | * helper function is provided in order to free (deallocate) it. |
79 | **/ | 79 | **/ |
80 | void | 80 | void |
81 | gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t sc) | 81 | MHD_gnutls_anon_free_client_credentials (mhd_gtls_anon_client_credentials_t sc) |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * gnutls_anon_allocate_client_credentials - Used to allocate a credentials structure | 86 | * MHD_gnutls_anon_allocate_client_credentials - Used to allocate a credentials structure |
87 | * @sc: is a pointer to an #gnutls_anon_client_credentials_t structure. | 87 | * @sc: is a pointer to an #mhd_gtls_anon_client_credentials_t structure. |
88 | * | 88 | * |
89 | * This structure is complex enough to manipulate directly thus | 89 | * This structure is complex enough to manipulate directly thus |
90 | * this helper function is provided in order to allocate it. | 90 | * this helper function is provided in order to allocate it. |
@@ -92,7 +92,7 @@ gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t sc) | |||
92 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 92 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
93 | **/ | 93 | **/ |
94 | int | 94 | int |
95 | gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t * | 95 | MHD_gnutls_anon_allocate_client_credentials (mhd_gtls_anon_client_credentials_t * |
96 | sc) | 96 | sc) |
97 | { | 97 | { |
98 | /* anon_dummy is only there for *sc not to be null. | 98 | /* anon_dummy is only there for *sc not to be null. |
@@ -104,8 +104,8 @@ gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t * | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * gnutls_anon_set_server_dh_params - This function will set the DH parameters for a server to use | 107 | * MHD_gnutls_anon_set_server_dh_params - This function will set the DH parameters for a server to use |
108 | * @res: is a gnutls_anon_server_credentials_t structure | 108 | * @res: is a mhd_gtls_anon_server_credentials_t structure |
109 | * @dh_params: is a structure that holds diffie hellman parameters. | 109 | * @dh_params: is a structure that holds diffie hellman parameters. |
110 | * | 110 | * |
111 | * This function will set the diffie hellman parameters for an | 111 | * This function will set the diffie hellman parameters for an |
@@ -113,15 +113,15 @@ gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t * | |||
113 | * Anonymous Diffie Hellman cipher suites. | 113 | * Anonymous Diffie Hellman cipher suites. |
114 | **/ | 114 | **/ |
115 | void | 115 | void |
116 | gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res, | 116 | MHD_gnutls_anon_set_server_dh_params (mhd_gtls_anon_server_credentials_t res, |
117 | gnutls_dh_params_t dh_params) | 117 | mhd_gtls_dh_params_t dh_params) |
118 | { | 118 | { |
119 | res->dh_params = dh_params; | 119 | res->dh_params = dh_params; |
120 | } | 120 | } |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * gnutls_anon_set_server_params_function - This function will set the DH parameters callback | 123 | * MHD_gnutls_anon_set_server_params_function - This function will set the DH parameters callback |
124 | * @res: is a gnutls_certificate_credentials_t structure | 124 | * @res: is a mhd_gtls_cert_credentials_t structure |
125 | * @func: is the function to be called | 125 | * @func: is the function to be called |
126 | * | 126 | * |
127 | * This function will set a callback in order for the server to get | 127 | * This function will set a callback in order for the server to get |
@@ -129,7 +129,7 @@ gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res, | |||
129 | * callback should return zero on success. | 129 | * callback should return zero on success. |
130 | **/ | 130 | **/ |
131 | void | 131 | void |
132 | gnutls_anon_set_server_params_function (gnutls_anon_server_credentials_t res, | 132 | MHD_gnutls_anon_set_server_params_function (mhd_gtls_anon_server_credentials_t res, |
133 | gnutls_params_function * func) | 133 | gnutls_params_function * func) |
134 | { | 134 | { |
135 | res->params_func = func; | 135 | res->params_func = func; |
diff --git a/src/daemon/https/tls/gnutls_auth.c b/src/daemon/https/tls/gnutls_auth.c index bf4d6881..cb2f42e0 100644 --- a/src/daemon/https/tls/gnutls_auth.c +++ b/src/daemon/https/tls/gnutls_auth.c | |||
@@ -37,14 +37,14 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * gnutls_credentials_clear - Clears all the credentials previously set | 40 | * MHD_gnutls_credentials_clear - Clears all the credentials previously set |
41 | * @session: is a #gnutls_session_t structure. | 41 | * @session: is a #mhd_gtls_session_t structure. |
42 | * | 42 | * |
43 | * Clears all the credentials previously set in this session. | 43 | * Clears all the credentials previously set in this session. |
44 | * | 44 | * |
45 | **/ | 45 | **/ |
46 | void | 46 | void |
47 | gnutls_credentials_clear (gnutls_session_t session) | 47 | MHD_gnutls_credentials_clear (mhd_gtls_session_t session) |
48 | { | 48 | { |
49 | if (session->key && session->key->cred) | 49 | if (session->key && session->key->cred) |
50 | { /* beginning of the list */ | 50 | { /* beginning of the list */ |
@@ -65,8 +65,8 @@ gnutls_credentials_clear (gnutls_session_t session) | |||
65 | * { algorithm, credentials, pointer to next } | 65 | * { algorithm, credentials, pointer to next } |
66 | */ | 66 | */ |
67 | /** | 67 | /** |
68 | * gnutls_credentials_set - Sets the needed credentials for the specified authentication algorithm. | 68 | * MHD_gnutls_credentials_set - Sets the needed credentials for the specified authentication algorithm. |
69 | * @session: is a #gnutls_session_t structure. | 69 | * @session: is a #mhd_gtls_session_t structure. |
70 | * @type: is the type of the credentials | 70 | * @type: is the type of the credentials |
71 | * @cred: is a pointer to a structure. | 71 | * @cred: is a pointer to a structure. |
72 | * | 72 | * |
@@ -77,20 +77,20 @@ gnutls_credentials_clear (gnutls_session_t session) | |||
77 | * [ In order to minimize memory usage, and share credentials between | 77 | * [ In order to minimize memory usage, and share credentials between |
78 | * several threads gnutls keeps a pointer to cred, and not the whole cred | 78 | * several threads gnutls keeps a pointer to cred, and not the whole cred |
79 | * structure. Thus you will have to keep the structure allocated until | 79 | * structure. Thus you will have to keep the structure allocated until |
80 | * you call gnutls_deinit(). ] | 80 | * you call MHD_gnutls_deinit(). ] |
81 | * | 81 | * |
82 | * For GNUTLS_CRD_ANON cred should be gnutls_anon_client_credentials_t in case of a client. | 82 | * For GNUTLS_CRD_ANON cred should be mhd_gtls_anon_client_credentials_t in case of a client. |
83 | * In case of a server it should be gnutls_anon_server_credentials_t. | 83 | * In case of a server it should be mhd_gtls_anon_server_credentials_t. |
84 | * | 84 | * |
85 | * For GNUTLS_CRD_SRP cred should be gnutls_srp_client_credentials_t | 85 | * For GNUTLS_CRD_SRP cred should be gnutls_srp_client_credentials_t |
86 | * in case of a client, and gnutls_srp_server_credentials_t, in case | 86 | * in case of a client, and gnutls_srp_server_credentials_t, in case |
87 | * of a server. | 87 | * of a server. |
88 | * | 88 | * |
89 | * For GNUTLS_CRD_CERTIFICATE cred should be gnutls_certificate_credentials_t. | 89 | * For GNUTLS_CRD_CERTIFICATE cred should be mhd_gtls_cert_credentials_t. |
90 | * | 90 | * |
91 | **/ | 91 | **/ |
92 | int | 92 | int |
93 | gnutls_credentials_set (gnutls_session_t session, | 93 | MHD_gnutls_credentials_set (mhd_gtls_session_t session, |
94 | gnutls_credentials_type_t type, void *cred) | 94 | gnutls_credentials_type_t type, void *cred) |
95 | { | 95 | { |
96 | auth_cred_st *ccred = NULL, *pcred = NULL; | 96 | auth_cred_st *ccred = NULL, *pcred = NULL; |
@@ -150,8 +150,8 @@ gnutls_credentials_set (gnutls_session_t session, | |||
150 | } | 150 | } |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * gnutls_auth_get_type - Returns the type of credentials for the current authentication schema. | 153 | * MHD_gtls_auth_get_type - Returns the type of credentials for the current authentication schema. |
154 | * @session: is a #gnutls_session_t structure. | 154 | * @session: is a #mhd_gtls_session_t structure. |
155 | * | 155 | * |
156 | * Returns type of credentials for the current authentication schema. | 156 | * Returns type of credentials for the current authentication schema. |
157 | * The returned information is to be used to distinguish the function used | 157 | * The returned information is to be used to distinguish the function used |
@@ -161,7 +161,7 @@ gnutls_credentials_set (gnutls_session_t session, | |||
161 | * the same function are to be used to access the authentication data. | 161 | * the same function are to be used to access the authentication data. |
162 | **/ | 162 | **/ |
163 | gnutls_credentials_type_t | 163 | gnutls_credentials_type_t |
164 | gnutls_auth_get_type (gnutls_session_t session) | 164 | MHD_gtls_auth_get_type (mhd_gtls_session_t session) |
165 | { | 165 | { |
166 | /* This is not the credentials we must set, but the authentication data | 166 | /* This is not the credentials we must set, but the authentication data |
167 | * we get by the peer, so it should be reversed. | 167 | * we get by the peer, so it should be reversed. |
@@ -169,14 +169,14 @@ gnutls_auth_get_type (gnutls_session_t session) | |||
169 | int server = session->security_parameters.entity == GNUTLS_SERVER ? 0 : 1; | 169 | int server = session->security_parameters.entity == GNUTLS_SERVER ? 0 : 1; |
170 | 170 | ||
171 | return | 171 | return |
172 | _gnutls_map_kx_get_cred (_gnutls_cipher_suite_get_kx_algo | 172 | mhd_gtls_map_kx_get_cred (mhd_gtls_cipher_suite_get_kx_algo |
173 | (&session->security_parameters. | 173 | (&session->security_parameters. |
174 | current_cipher_suite), server); | 174 | current_cipher_suite), server); |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * gnutls_auth_server_get_type - Returns the type of credentials for the server authentication schema. | 178 | * MHD_gtls_auth_server_get_type - Returns the type of credentials for the server authentication schema. |
179 | * @session: is a #gnutls_session_t structure. | 179 | * @session: is a #mhd_gtls_session_t structure. |
180 | * | 180 | * |
181 | * Returns the type of credentials that were used for server authentication. | 181 | * Returns the type of credentials that were used for server authentication. |
182 | * The returned information is to be used to distinguish the function used | 182 | * The returned information is to be used to distinguish the function used |
@@ -184,17 +184,17 @@ gnutls_auth_get_type (gnutls_session_t session) | |||
184 | * | 184 | * |
185 | **/ | 185 | **/ |
186 | gnutls_credentials_type_t | 186 | gnutls_credentials_type_t |
187 | gnutls_auth_server_get_type (gnutls_session_t session) | 187 | MHD_gtls_auth_server_get_type (mhd_gtls_session_t session) |
188 | { | 188 | { |
189 | return | 189 | return |
190 | _gnutls_map_kx_get_cred (_gnutls_cipher_suite_get_kx_algo | 190 | mhd_gtls_map_kx_get_cred (mhd_gtls_cipher_suite_get_kx_algo |
191 | (&session->security_parameters. | 191 | (&session->security_parameters. |
192 | current_cipher_suite), 1); | 192 | current_cipher_suite), 1); |
193 | } | 193 | } |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * gnutls_auth_client_get_type - Returns the type of credentials for the client authentication schema. | 196 | * MHD_gtls_auth_client_get_type - Returns the type of credentials for the client authentication schema. |
197 | * @session: is a #gnutls_session_t structure. | 197 | * @session: is a #mhd_gtls_session_t structure. |
198 | * | 198 | * |
199 | * Returns the type of credentials that were used for client authentication. | 199 | * Returns the type of credentials that were used for client authentication. |
200 | * The returned information is to be used to distinguish the function used | 200 | * The returned information is to be used to distinguish the function used |
@@ -202,10 +202,10 @@ gnutls_auth_server_get_type (gnutls_session_t session) | |||
202 | * | 202 | * |
203 | **/ | 203 | **/ |
204 | gnutls_credentials_type_t | 204 | gnutls_credentials_type_t |
205 | gnutls_auth_client_get_type (gnutls_session_t session) | 205 | MHD_gtls_auth_client_get_type (mhd_gtls_session_t session) |
206 | { | 206 | { |
207 | return | 207 | return |
208 | _gnutls_map_kx_get_cred (_gnutls_cipher_suite_get_kx_algo | 208 | mhd_gtls_map_kx_get_cred (mhd_gtls_cipher_suite_get_kx_algo |
209 | (&session->security_parameters. | 209 | (&session->security_parameters. |
210 | current_cipher_suite), 0); | 210 | current_cipher_suite), 0); |
211 | } | 211 | } |
@@ -216,17 +216,17 @@ gnutls_auth_client_get_type (gnutls_session_t session) | |||
216 | * free that!!! | 216 | * free that!!! |
217 | */ | 217 | */ |
218 | const void * | 218 | const void * |
219 | _gnutls_get_kx_cred (gnutls_session_t session, | 219 | mhd_gtls_get_kx_cred (mhd_gtls_session_t session, |
220 | gnutls_kx_algorithm_t algo, int *err) | 220 | gnutls_kx_algorithm_t algo, int *err) |
221 | { | 221 | { |
222 | int server = session->security_parameters.entity == GNUTLS_SERVER ? 1 : 0; | 222 | int server = session->security_parameters.entity == GNUTLS_SERVER ? 1 : 0; |
223 | 223 | ||
224 | return _gnutls_get_cred (session->key, | 224 | return mhd_gtls_get_cred (session->key, |
225 | _gnutls_map_kx_get_cred (algo, server), err); | 225 | mhd_gtls_map_kx_get_cred (algo, server), err); |
226 | } | 226 | } |
227 | 227 | ||
228 | const void * | 228 | const void * |
229 | _gnutls_get_cred (gnutls_key_st key, gnutls_credentials_type_t type, int *err) | 229 | mhd_gtls_get_cred (mhd_gtls_key_st key, gnutls_credentials_type_t type, int *err) |
230 | { | 230 | { |
231 | const void *retval = NULL; | 231 | const void *retval = NULL; |
232 | int _err = -1; | 232 | int _err = -1; |
@@ -257,10 +257,10 @@ out: | |||
257 | } | 257 | } |
258 | 258 | ||
259 | /*- | 259 | /*- |
260 | * _gnutls_get_auth_info - Returns a pointer to authentication information. | 260 | * mhd_gtls_get_auth_info - Returns a pointer to authentication information. |
261 | * @session: is a #gnutls_session_t structure. | 261 | * @session: is a #mhd_gtls_session_t structure. |
262 | * | 262 | * |
263 | * This function must be called after a succesful gnutls_handshake(). | 263 | * This function must be called after a succesful MHD_gnutls_handshake(). |
264 | * Returns a pointer to authentication information. That information | 264 | * Returns a pointer to authentication information. That information |
265 | * is data obtained by the handshake protocol, the key exchange algorithm, | 265 | * is data obtained by the handshake protocol, the key exchange algorithm, |
266 | * and the TLS extensions messages. | 266 | * and the TLS extensions messages. |
@@ -270,21 +270,21 @@ out: | |||
270 | * In case of GNUTLS_CRD_SRP returns a type of &srp_(server/client)_auth_info_t; | 270 | * In case of GNUTLS_CRD_SRP returns a type of &srp_(server/client)_auth_info_t; |
271 | -*/ | 271 | -*/ |
272 | void * | 272 | void * |
273 | _gnutls_get_auth_info (gnutls_session_t session) | 273 | mhd_gtls_get_auth_info (mhd_gtls_session_t session) |
274 | { | 274 | { |
275 | return session->key->auth_info; | 275 | return session->key->auth_info; |
276 | } | 276 | } |
277 | 277 | ||
278 | /*- | 278 | /*- |
279 | * _gnutls_free_auth_info - Frees the auth info structure | 279 | * mhd_gtls_free_auth_info - Frees the auth info structure |
280 | * @session: is a #gnutls_session_t structure. | 280 | * @session: is a #mhd_gtls_session_t structure. |
281 | * | 281 | * |
282 | * This function frees the auth info structure and sets it to | 282 | * This function frees the auth info structure and sets it to |
283 | * null. It must be called since some structures contain malloced | 283 | * null. It must be called since some structures contain malloced |
284 | * elements. | 284 | * elements. |
285 | -*/ | 285 | -*/ |
286 | void | 286 | void |
287 | _gnutls_free_auth_info (gnutls_session_t session) | 287 | mhd_gtls_free_auth_info (mhd_gtls_session_t session) |
288 | { | 288 | { |
289 | dh_info_st *dh_info; | 289 | dh_info_st *dh_info; |
290 | rsa_info_st *rsa_info; | 290 | rsa_info_st *rsa_info; |
@@ -301,19 +301,19 @@ _gnutls_free_auth_info (gnutls_session_t session) | |||
301 | break; | 301 | break; |
302 | case MHD_GNUTLS_CRD_ANON: | 302 | case MHD_GNUTLS_CRD_ANON: |
303 | { | 303 | { |
304 | anon_auth_info_t info = _gnutls_get_auth_info (session); | 304 | mhd_anon_auth_info_t info = mhd_gtls_get_auth_info (session); |
305 | 305 | ||
306 | if (info == NULL) | 306 | if (info == NULL) |
307 | break; | 307 | break; |
308 | 308 | ||
309 | dh_info = &info->dh; | 309 | dh_info = &info->dh; |
310 | _gnutls_free_dh_info (dh_info); | 310 | mhd_gtls_free_dh_info (dh_info); |
311 | } | 311 | } |
312 | break; | 312 | break; |
313 | case MHD_GNUTLS_CRD_CERTIFICATE: | 313 | case MHD_GNUTLS_CRD_CERTIFICATE: |
314 | { | 314 | { |
315 | unsigned int i; | 315 | unsigned int i; |
316 | cert_auth_info_t info = _gnutls_get_auth_info (session); | 316 | cert_auth_info_t info = mhd_gtls_get_auth_info (session); |
317 | 317 | ||
318 | if (info == NULL) | 318 | if (info == NULL) |
319 | break; | 319 | break; |
@@ -329,8 +329,8 @@ _gnutls_free_auth_info (gnutls_session_t session) | |||
329 | info->raw_certificate_list = NULL; | 329 | info->raw_certificate_list = NULL; |
330 | info->ncerts = 0; | 330 | info->ncerts = 0; |
331 | 331 | ||
332 | _gnutls_free_dh_info (dh_info); | 332 | mhd_gtls_free_dh_info (dh_info); |
333 | _gnutls_free_rsa_info (rsa_info); | 333 | mhd_gtls_free_rsa_info (rsa_info); |
334 | } | 334 | } |
335 | 335 | ||
336 | 336 | ||
@@ -353,7 +353,7 @@ _gnutls_free_auth_info (gnutls_session_t session) | |||
353 | * info structure to a different type. | 353 | * info structure to a different type. |
354 | */ | 354 | */ |
355 | int | 355 | int |
356 | _gnutls_auth_info_set (gnutls_session_t session, | 356 | mhd_gtls_auth_info_set (mhd_gtls_session_t session, |
357 | gnutls_credentials_type_t type, int size, | 357 | gnutls_credentials_type_t type, int size, |
358 | int allow_change) | 358 | int allow_change) |
359 | { | 359 | { |
@@ -378,7 +378,7 @@ _gnutls_auth_info_set (gnutls_session_t session, | |||
378 | * ciphersuite which is negotiated has different authentication | 378 | * ciphersuite which is negotiated has different authentication |
379 | * schema. | 379 | * schema. |
380 | */ | 380 | */ |
381 | if (gnutls_auth_get_type (session) != session->key->auth_info_type) | 381 | if (MHD_gtls_auth_get_type (session) != session->key->auth_info_type) |
382 | { | 382 | { |
383 | gnutls_assert (); | 383 | gnutls_assert (); |
384 | return GNUTLS_E_INVALID_REQUEST; | 384 | return GNUTLS_E_INVALID_REQUEST; |
@@ -392,10 +392,10 @@ _gnutls_auth_info_set (gnutls_session_t session, | |||
392 | * certificate (in order to prevent revealing the certificate's contents, | 392 | * certificate (in order to prevent revealing the certificate's contents, |
393 | * to passive eavesdropers. | 393 | * to passive eavesdropers. |
394 | */ | 394 | */ |
395 | if (gnutls_auth_get_type (session) != session->key->auth_info_type) | 395 | if (MHD_gtls_auth_get_type (session) != session->key->auth_info_type) |
396 | { | 396 | { |
397 | 397 | ||
398 | _gnutls_free_auth_info (session); | 398 | mhd_gtls_free_auth_info (session); |
399 | 399 | ||
400 | session->key->auth_info = calloc (1, size); | 400 | session->key->auth_info = calloc (1, size); |
401 | if (session->key->auth_info == NULL) | 401 | if (session->key->auth_info == NULL) |
diff --git a/src/daemon/https/tls/gnutls_auth.h b/src/daemon/https/tls/gnutls_auth.h index 07d81352..89d07d88 100644 --- a/src/daemon/https/tls/gnutls_auth.h +++ b/src/daemon/https/tls/gnutls_auth.h | |||
@@ -23,28 +23,28 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef GNUTLS_AUTH_H | 25 | #ifndef GNUTLS_AUTH_H |
26 | # define GNUTLS_AUTH_H | 26 | #define GNUTLS_AUTH_H |
27 | 27 | ||
28 | typedef struct mod_auth_st_int | 28 | typedef struct mhd_gtls_mod_auth_st_int |
29 | { | 29 | { |
30 | const char *name; /* null terminated */ | 30 | const char *name; /* null terminated */ |
31 | int (*gnutls_generate_server_certificate) (gnutls_session_t, opaque **); | 31 | int (* mhd_gtls_gen_server_certificate) (mhd_gtls_session_t, opaque **); |
32 | int (*gnutls_generate_client_certificate) (gnutls_session_t, opaque **); | 32 | int (* mhd_gtls_gen_client_certificate) (mhd_gtls_session_t, opaque **); |
33 | int (*gnutls_generate_server_kx) (gnutls_session_t, opaque **); | 33 | int (* mhd_gtls_gen_server_kx) (mhd_gtls_session_t, opaque **); |
34 | int (*gnutls_generate_client_kx) (gnutls_session_t, opaque **); /* used in SRP */ | 34 | int (* mhd_gtls_gen_client_kx) (mhd_gtls_session_t, opaque **); /* used in SRP */ |
35 | int (*gnutls_generate_client_cert_vrfy) (gnutls_session_t, opaque **); | 35 | int (* mhd_gtls_gen_client_cert_vrfy) (mhd_gtls_session_t, opaque **); |
36 | int (*gnutls_generate_server_certificate_request) (gnutls_session_t, | 36 | int (* mhd_gtls_gen_server_certificate_request) (mhd_gtls_session_t, |
37 | opaque **); | 37 | opaque **); |
38 | 38 | ||
39 | int (*gnutls_process_server_certificate) (gnutls_session_t, opaque *, | 39 | int (* mhd_gtls_process_server_certificate) (mhd_gtls_session_t, opaque *, |
40 | size_t); | 40 | size_t); |
41 | int (*gnutls_process_client_certificate) (gnutls_session_t, opaque *, | 41 | int (* mhd_gtls_process_client_certificate) (mhd_gtls_session_t, opaque *, |
42 | size_t); | 42 | size_t); |
43 | int (*gnutls_process_server_kx) (gnutls_session_t, opaque *, size_t); | 43 | int (* mhd_gtls_process_server_kx) (mhd_gtls_session_t, opaque *, size_t); |
44 | int (*gnutls_process_client_kx) (gnutls_session_t, opaque *, size_t); | 44 | int (* mhd_gtls_process_client_kx) (mhd_gtls_session_t, opaque *, size_t); |
45 | int (*gnutls_process_client_cert_vrfy) (gnutls_session_t, opaque *, size_t); | 45 | int (* mhd_gtls_process_client_cert_vrfy) (mhd_gtls_session_t, opaque *, size_t); |
46 | int (*gnutls_process_server_certificate_request) (gnutls_session_t, | 46 | int (* mhd_gtls_process_server_certificate_request) (mhd_gtls_session_t, |
47 | opaque *, size_t); | 47 | opaque *, size_t); |
48 | } mod_auth_st; | 48 | } mhd_gtls_mod_auth_st; |
49 | 49 | ||
50 | #endif | 50 | #endif |
diff --git a/src/daemon/https/tls/gnutls_auth_int.h b/src/daemon/https/tls/gnutls_auth_int.h index 85fe53a1..9188cc79 100644 --- a/src/daemon/https/tls/gnutls_auth_int.h +++ b/src/daemon/https/tls/gnutls_auth_int.h | |||
@@ -22,11 +22,11 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | const void *_gnutls_get_cred (gnutls_key_st key, | 25 | const void * mhd_gtls_get_cred (mhd_gtls_key_st key, |
26 | gnutls_credentials_type_t kx, int *err); | 26 | gnutls_credentials_type_t kx, int *err); |
27 | const void *_gnutls_get_kx_cred (gnutls_session_t session, | 27 | const void * mhd_gtls_get_kx_cred (mhd_gtls_session_t session, |
28 | gnutls_kx_algorithm_t algo, int *err); | 28 | gnutls_kx_algorithm_t algo, int *err); |
29 | void *_gnutls_get_auth_info (gnutls_session_t session); | 29 | void * mhd_gtls_get_auth_info (mhd_gtls_session_t session); |
30 | int _gnutls_auth_info_set (gnutls_session_t session, | 30 | int mhd_gtls_auth_info_set (mhd_gtls_session_t session, |
31 | gnutls_credentials_type_t type, int size, | 31 | gnutls_credentials_type_t type, int size, |
32 | int allow_change); | 32 | int allow_change); |
diff --git a/src/daemon/https/tls/gnutls_buffer.h b/src/daemon/https/tls/gnutls_buffer.h deleted file mode 100644 index 5c552a7a..00000000 --- a/src/daemon/https/tls/gnutls_buffer.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation | ||
3 | * | ||
4 | * Author: Nikos Mavrogiannopoulos | ||
5 | * | ||
6 | * This file is part of GNUTLS. | ||
7 | * | ||
8 | * The GNUTLS library 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 | ||
19 | * License along with this library; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
21 | * USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include <gnutls_str.h> | ||
26 | |||
27 | typedef gnutls_string gnutls_buffer; | ||
28 | |||
29 | #define _gnutls_buffer_init(buf) _gnutls_string_init(buf, gnutls_malloc, gnutls_realloc, gnutls_free); | ||
30 | #define _gnutls_buffer_clear _gnutls_string_clear | ||
31 | #define _gnutls_buffer_append _gnutls_string_append_data | ||
diff --git a/src/daemon/https/tls/gnutls_buffers.c b/src/daemon/https/tls/gnutls_buffers.c index bbc1bcc4..92979c26 100644 --- a/src/daemon/https/tls/gnutls_buffers.c +++ b/src/daemon/https/tls/gnutls_buffers.c | |||
@@ -23,19 +23,19 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* This is the only file that uses the berkeley sockets API. | 25 | /* This is the only file that uses the berkeley sockets API. |
26 | * | 26 | * |
27 | * Also holds all the buffering code used in gnutls. | 27 | * Also holds all the buffering code used in gnutls. |
28 | * The buffering code works as: | 28 | * The buffering code works as: |
29 | * | 29 | * |
30 | * RECORD LAYER: | 30 | * RECORD LAYER: |
31 | * 1. uses a buffer to hold data (application/handshake), | 31 | * 1. uses a buffer to hold data (application/handshake), |
32 | * we got but they were not requested, yet. | 32 | * we got but they were not requested, yet. |
33 | * (see gnutls_record_buffer_put(), gnutls_record_buffer_get_size() etc.) | 33 | * (see gnutls_record_buffer_put(), gnutls_record_buffer_get_size() etc.) |
34 | * | 34 | * |
35 | * 2. uses a buffer to hold data that were incomplete (ie the read/write | 35 | * 2. uses a buffer to hold data that were incomplete (ie the read/write |
36 | * was interrupted) | 36 | * was interrupted) |
37 | * (see _gnutls_io_read_buffered(), _gnutls_io_write_buffered() etc.) | 37 | * (see mhd_gtls_io_read_buffered(), mhd_gtls_io_write_buffered() etc.) |
38 | * | 38 | * |
39 | * HANDSHAKE LAYER: | 39 | * HANDSHAKE LAYER: |
40 | * 1. Uses a buffer to hold data that was not sent or received | 40 | * 1. Uses a buffer to hold data that was not sent or received |
41 | * complete. (E.g. sent 10 bytes of a handshake packet that is 20 bytes | 41 | * complete. (E.g. sent 10 bytes of a handshake packet that is 20 bytes |
@@ -43,7 +43,7 @@ | |||
43 | * (see _gnutls_handshake_send_int(), _gnutls_handshake_recv_int()) | 43 | * (see _gnutls_handshake_send_int(), _gnutls_handshake_recv_int()) |
44 | * | 44 | * |
45 | * 2. Uses buffer to hold the last received handshake message. | 45 | * 2. Uses buffer to hold the last received handshake message. |
46 | * (see _gnutls_handshake_buffer_put() etc.) | 46 | * (see mhd_gtls_handshake_buffer_put() etc.) |
47 | * | 47 | * |
48 | */ | 48 | */ |
49 | 49 | ||
@@ -68,8 +68,8 @@ | |||
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * gnutls_transport_set_errno: | 71 | * MHD_gnutls_transport_set_errno: |
72 | * @session: is a #gnutls_session_t structure. | 72 | * @session: is a #mhd_gtls_session_t structure. |
73 | * @err: error value to store in session-specific errno variable. | 73 | * @err: error value to store in session-specific errno variable. |
74 | * | 74 | * |
75 | * Store @err in the session-specific errno variable. Useful values | 75 | * Store @err in the session-specific errno variable. Useful values |
@@ -77,7 +77,7 @@ | |||
77 | * treated as real errors in the push/pull function. | 77 | * treated as real errors in the push/pull function. |
78 | * | 78 | * |
79 | * This function is useful in replacement push/pull functions set by | 79 | * This function is useful in replacement push/pull functions set by |
80 | * gnutls_transport_set_push_function and | 80 | * MHD_gnutls_transport_set_push_function and |
81 | * gnutls_transport_set_pullpush_function under Windows, where the | 81 | * gnutls_transport_set_pullpush_function under Windows, where the |
82 | * replacement push/pull may not have access to the same @errno | 82 | * replacement push/pull may not have access to the same @errno |
83 | * variable that is used by GnuTLS (e.g., the application is linked to | 83 | * variable that is used by GnuTLS (e.g., the application is linked to |
@@ -85,16 +85,16 @@ | |||
85 | * | 85 | * |
86 | * If you don't have the @session variable easily accessible from the | 86 | * If you don't have the @session variable easily accessible from the |
87 | * push/pull function, and don't worry about thread conflicts, you can | 87 | * push/pull function, and don't worry about thread conflicts, you can |
88 | * also use gnutls_transport_set_global_errno(). | 88 | * also use MHD_gnutls_transport_set_global_errno(). |
89 | **/ | 89 | **/ |
90 | void | 90 | void |
91 | gnutls_transport_set_errno (gnutls_session_t session, int err) | 91 | MHD_gnutls_transport_set_errno (mhd_gtls_session_t session, int err) |
92 | { | 92 | { |
93 | session->internals.errnum = err; | 93 | session->internals.errnum = err; |
94 | } | 94 | } |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * gnutls_transport_set_global_errno: | 97 | * MHD_gnutls_transport_set_global_errno: |
98 | * @err: error value to store in global errno variable. | 98 | * @err: error value to store in global errno variable. |
99 | * | 99 | * |
100 | * Store @err in the global errno variable. Useful values for @err is | 100 | * Store @err in the global errno variable. Useful values for @err is |
@@ -102,7 +102,7 @@ gnutls_transport_set_errno (gnutls_session_t session, int err) | |||
102 | * errors in the push/pull function. | 102 | * errors in the push/pull function. |
103 | * | 103 | * |
104 | * This function is useful in replacement push/pull functions set by | 104 | * This function is useful in replacement push/pull functions set by |
105 | * gnutls_transport_set_push_function and | 105 | * MHD_gnutls_transport_set_push_function and |
106 | * gnutls_transport_set_pullpush_function under Windows, where the | 106 | * gnutls_transport_set_pullpush_function under Windows, where the |
107 | * replacement push/pull may not have access to the same @errno | 107 | * replacement push/pull may not have access to the same @errno |
108 | * variable that is used by GnuTLS (e.g., the application is linked to | 108 | * variable that is used by GnuTLS (e.g., the application is linked to |
@@ -111,10 +111,10 @@ gnutls_transport_set_errno (gnutls_session_t session, int err) | |||
111 | * Whether this function is thread safe or not depends on whether the | 111 | * Whether this function is thread safe or not depends on whether the |
112 | * global variable errno is thread safe, some system libraries make it | 112 | * global variable errno is thread safe, some system libraries make it |
113 | * a thread-local variable. When feasible, using the guaranteed | 113 | * a thread-local variable. When feasible, using the guaranteed |
114 | * thread-safe gnutls_transport_set_errno() may be better. | 114 | * thread-safe MHD_gnutls_transport_set_errno() may be better. |
115 | **/ | 115 | **/ |
116 | void | 116 | void |
117 | gnutls_transport_set_global_errno (int err) | 117 | MHD_gnutls_transport_set_global_errno (int err) |
118 | { | 118 | { |
119 | errno = err; | 119 | errno = err; |
120 | } | 120 | } |
@@ -123,11 +123,11 @@ gnutls_transport_set_global_errno (int err) | |||
123 | * HANDSHAKE DATA. | 123 | * HANDSHAKE DATA. |
124 | */ | 124 | */ |
125 | int | 125 | int |
126 | _gnutls_record_buffer_put (content_type_t type, | 126 | mhd_gnutls_record_buffer_put (content_type_t type, |
127 | gnutls_session_t session, | 127 | mhd_gtls_session_t session, opaque * data, |
128 | opaque * data, size_t length) | 128 | size_t length) |
129 | { | 129 | { |
130 | gnutls_buffer *buf; | 130 | mhd_gtls_buffer *buf; |
131 | 131 | ||
132 | if (length == 0) | 132 | if (length == 0) |
133 | return 0; | 133 | return 0; |
@@ -157,7 +157,7 @@ _gnutls_record_buffer_put (content_type_t type, | |||
157 | return GNUTLS_E_INVALID_REQUEST; | 157 | return GNUTLS_E_INVALID_REQUEST; |
158 | } | 158 | } |
159 | 159 | ||
160 | if (_gnutls_buffer_append (buf, data, length) < 0) | 160 | if (mhd_gtls_buffer_append (buf, data, length) < 0) |
161 | { | 161 | { |
162 | gnutls_assert (); | 162 | gnutls_assert (); |
163 | return GNUTLS_E_MEMORY_ERROR; | 163 | return GNUTLS_E_MEMORY_ERROR; |
@@ -167,7 +167,8 @@ _gnutls_record_buffer_put (content_type_t type, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | int | 169 | int |
170 | _gnutls_record_buffer_get_size (content_type_t type, gnutls_session_t session) | 170 | mhd_gnutls_record_buffer_get_size (content_type_t type, |
171 | mhd_gtls_session_t session) | ||
171 | { | 172 | { |
172 | switch (type) | 173 | switch (type) |
173 | { | 174 | { |
@@ -186,8 +187,8 @@ _gnutls_record_buffer_get_size (content_type_t type, gnutls_session_t session) | |||
186 | } | 187 | } |
187 | 188 | ||
188 | /** | 189 | /** |
189 | * gnutls_record_check_pending - checks if there are any data to receive in gnutls buffers. | 190 | * MHD_gtls_record_check_pending - checks if there are any data to receive in gnutls buffers. |
190 | * @session: is a #gnutls_session_t structure. | 191 | * @session: is a #mhd_gtls_session_t structure. |
191 | * | 192 | * |
192 | * This function checks if there are any data to receive | 193 | * This function checks if there are any data to receive |
193 | * in the gnutls buffers. Returns the size of that data or 0. | 194 | * in the gnutls buffers. Returns the size of that data or 0. |
@@ -197,15 +198,14 @@ _gnutls_record_buffer_get_size (content_type_t type, gnutls_session_t session) | |||
197 | * to work). | 198 | * to work). |
198 | **/ | 199 | **/ |
199 | size_t | 200 | size_t |
200 | gnutls_record_check_pending (gnutls_session_t session) | 201 | MHD_gtls_record_check_pending (mhd_gtls_session_t session) |
201 | { | 202 | { |
202 | return _gnutls_record_buffer_get_size (GNUTLS_APPLICATION_DATA, session); | 203 | return mhd_gnutls_record_buffer_get_size (GNUTLS_APPLICATION_DATA, session); |
203 | } | 204 | } |
204 | 205 | ||
205 | int | 206 | int |
206 | _gnutls_record_buffer_get (content_type_t type, | 207 | mhd_gtls_record_buffer_get (content_type_t type, mhd_gtls_session_t session, |
207 | gnutls_session_t session, | 208 | opaque * data, size_t length) |
208 | opaque * data, size_t length) | ||
209 | { | 209 | { |
210 | if (length == 0 || data == NULL) | 210 | if (length == 0 || data == NULL) |
211 | { | 211 | { |
@@ -289,8 +289,8 @@ _gnutls_record_buffer_get (content_type_t type, | |||
289 | * Flags are only used if the default recv() function is being used. | 289 | * Flags are only used if the default recv() function is being used. |
290 | */ | 290 | */ |
291 | static ssize_t | 291 | static ssize_t |
292 | _gnutls_read (gnutls_session_t session, | 292 | _gnutls_read (mhd_gtls_session_t session, void *iptr, |
293 | void *iptr, size_t sizeOfPtr, int flags) | 293 | size_t sizeOfPtr, int flags) |
294 | { | 294 | { |
295 | size_t left; | 295 | size_t left; |
296 | ssize_t i = 0; | 296 | ssize_t i = 0; |
@@ -303,13 +303,12 @@ _gnutls_read (gnutls_session_t session, | |||
303 | left = sizeOfPtr; | 303 | left = sizeOfPtr; |
304 | while (left > 0) | 304 | while (left > 0) |
305 | { | 305 | { |
306 | |||
307 | session->internals.errnum = 0; | 306 | session->internals.errnum = 0; |
308 | |||
309 | if (session->internals._gnutls_pull_func == NULL) | 307 | if (session->internals._gnutls_pull_func == NULL) |
310 | { | 308 | { |
311 | i = recv (GNUTLS_POINTER_TO_INT (fd), &ptr[sizeOfPtr - left], left, | 309 | i = |
312 | flags); | 310 | recv (GNUTLS_POINTER_TO_INT (fd), &ptr[sizeOfPtr - left], left, |
311 | flags); | ||
313 | #if HAVE_WINSOCK | 312 | #if HAVE_WINSOCK |
314 | if (i < 0) | 313 | if (i < 0) |
315 | { | 314 | { |
@@ -333,8 +332,9 @@ _gnutls_read (gnutls_session_t session, | |||
333 | #endif | 332 | #endif |
334 | } | 333 | } |
335 | else | 334 | else |
336 | i = session->internals._gnutls_pull_func (fd, &ptr[sizeOfPtr - | 335 | i = session->internals._gnutls_pull_func (fd, |
337 | left], left); | 336 | &ptr[sizeOfPtr - left], |
337 | left); | ||
338 | 338 | ||
339 | if (i < 0) | 339 | if (i < 0) |
340 | { | 340 | { |
@@ -394,14 +394,14 @@ finish: | |||
394 | line[0] = 0; | 394 | line[0] = 0; |
395 | 395 | ||
396 | sprintf (tmp, "%.4x - ", x); | 396 | sprintf (tmp, "%.4x - ", x); |
397 | _gnutls_str_cat (line, sizeof (line), tmp); | 397 | mhd_gtls_str_cat (line, sizeof (line), tmp); |
398 | 398 | ||
399 | for (j = 0; j < 16; j++) | 399 | for (j = 0; j < 16; j++) |
400 | { | 400 | { |
401 | if (sum < (sizeOfPtr - left)) | 401 | if (sum < (sizeOfPtr - left)) |
402 | { | 402 | { |
403 | sprintf (tmp, "%.2x ", ((unsigned char *) ptr)[sum++]); | 403 | sprintf (tmp, "%.2x ", ((unsigned char *) ptr)[sum++]); |
404 | _gnutls_str_cat (line, sizeof (line), tmp); | 404 | mhd_gtls_str_cat (line, sizeof (line), tmp); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | _gnutls_read_log ("%s\n", line); | 407 | _gnutls_read_log ("%s\n", line); |
@@ -417,7 +417,7 @@ finish: | |||
417 | * Clears the peeked data (read with MSG_PEEK). | 417 | * Clears the peeked data (read with MSG_PEEK). |
418 | */ | 418 | */ |
419 | int | 419 | int |
420 | _gnutls_io_clear_peeked_data (gnutls_session_t session) | 420 | mhd_gtls_io_clear_peeked_data (mhd_gtls_session_t session) |
421 | { | 421 | { |
422 | char *peekdata; | 422 | char *peekdata; |
423 | int ret, sum; | 423 | int ret, sum; |
@@ -457,7 +457,7 @@ _gnutls_io_clear_peeked_data (gnutls_session_t session) | |||
457 | } | 457 | } |
458 | 458 | ||
459 | void | 459 | void |
460 | _gnutls_io_clear_read_buffer (gnutls_session_t session) | 460 | mhd_gtls_io_clear_read_buffer (mhd_gtls_session_t session) |
461 | { | 461 | { |
462 | session->internals.record_recv_buffer.length = 0; | 462 | session->internals.record_recv_buffer.length = 0; |
463 | } | 463 | } |
@@ -465,16 +465,15 @@ _gnutls_io_clear_read_buffer (gnutls_session_t session) | |||
465 | /* This function is like recv(with MSG_PEEK). But it does not return -1 on error. | 465 | /* This function is like recv(with MSG_PEEK). But it does not return -1 on error. |
466 | * It does return gnutls_errno instead. | 466 | * It does return gnutls_errno instead. |
467 | * This function reads data from the socket and keeps them in a buffer, of up to | 467 | * This function reads data from the socket and keeps them in a buffer, of up to |
468 | * MAX_RECV_SIZE. | 468 | * MAX_RECV_SIZE. |
469 | * | 469 | * |
470 | * This is not a general purpose function. It returns EXACTLY the data requested, | 470 | * This is not a general purpose function. It returns EXACTLY the data requested, |
471 | * which are stored in a local (in the session) buffer. A pointer (iptr) to this buffer is returned. | 471 | * which are stored in a local (in the session) buffer. A pointer (iptr) to this buffer is returned. |
472 | * | 472 | * |
473 | */ | 473 | */ |
474 | ssize_t | 474 | ssize_t |
475 | _gnutls_io_read_buffered (gnutls_session_t session, | 475 | mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr, |
476 | opaque ** iptr, | 476 | size_t sizeOfPtr, content_type_t recv_type) |
477 | size_t sizeOfPtr, content_type_t recv_type) | ||
478 | { | 477 | { |
479 | ssize_t ret = 0, ret2 = 0; | 478 | ssize_t ret = 0, ret2 = 0; |
480 | size_t min; | 479 | size_t min; |
@@ -501,7 +500,7 @@ _gnutls_io_read_buffered (gnutls_session_t session, | |||
501 | else | 500 | else |
502 | { | 501 | { |
503 | /* leave peeked data to the kernel space only if application data | 502 | /* leave peeked data to the kernel space only if application data |
504 | * is received and we don't have any peeked | 503 | * is received and we don't have any peeked |
505 | * data in gnutls session. | 504 | * data in gnutls session. |
506 | */ | 505 | */ |
507 | if (recv_type != GNUTLS_APPLICATION_DATA | 506 | if (recv_type != GNUTLS_APPLICATION_DATA |
@@ -534,8 +533,8 @@ _gnutls_io_read_buffered (gnutls_session_t session, | |||
534 | /* Check if the previously read data plus the new data to | 533 | /* Check if the previously read data plus the new data to |
535 | * receive are longer than the maximum receive buffer size. | 534 | * receive are longer than the maximum receive buffer size. |
536 | */ | 535 | */ |
537 | if ((session->internals.record_recv_buffer.length + recvdata) > | 536 | if ((session->internals.record_recv_buffer.length + recvdata) |
538 | MAX_RECV_SIZE) | 537 | > MAX_RECV_SIZE) |
539 | { | 538 | { |
540 | gnutls_assert (); /* internal error */ | 539 | gnutls_assert (); /* internal error */ |
541 | return GNUTLS_E_INVALID_REQUEST; | 540 | return GNUTLS_E_INVALID_REQUEST; |
@@ -544,8 +543,8 @@ _gnutls_io_read_buffered (gnutls_session_t session, | |||
544 | /* Allocate the data required to store the new packet. | 543 | /* Allocate the data required to store the new packet. |
545 | */ | 544 | */ |
546 | alloc_size = recvdata + session->internals.record_recv_buffer.length; | 545 | alloc_size = recvdata + session->internals.record_recv_buffer.length; |
547 | session->internals.record_recv_buffer.data | 546 | session->internals.record_recv_buffer.data = |
548 | = gnutls_realloc_fast (session->internals.record_recv_buffer.data, | 547 | mhd_gtls_realloc_fast (session->internals.record_recv_buffer.data, |
549 | alloc_size); | 548 | alloc_size); |
550 | if (session->internals.record_recv_buffer.data == NULL) | 549 | if (session->internals.record_recv_buffer.data == NULL) |
551 | { | 550 | { |
@@ -565,7 +564,7 @@ _gnutls_io_read_buffered (gnutls_session_t session, | |||
565 | /* return immediately if we got an interrupt or eagain | 564 | /* return immediately if we got an interrupt or eagain |
566 | * error. | 565 | * error. |
567 | */ | 566 | */ |
568 | if (ret < 0 && gnutls_error_is_fatal (ret) == 0) | 567 | if (ret < 0 && MHD_gtls_error_is_fatal (ret) == 0) |
569 | { | 568 | { |
570 | return ret; | 569 | return ret; |
571 | } | 570 | } |
@@ -592,7 +591,7 @@ _gnutls_io_read_buffered (gnutls_session_t session, | |||
592 | { | 591 | { |
593 | ret2 = _gnutls_read (session, &buf[buf_pos], recvlowat, MSG_PEEK); | 592 | ret2 = _gnutls_read (session, &buf[buf_pos], recvlowat, MSG_PEEK); |
594 | 593 | ||
595 | if (ret2 < 0 && gnutls_error_is_fatal (ret2) == 0) | 594 | if (ret2 < 0 && MHD_gtls_error_is_fatal (ret2) == 0) |
596 | { | 595 | { |
597 | return ret2; | 596 | return ret2; |
598 | } | 597 | } |
@@ -652,7 +651,7 @@ _gnutls_io_read_buffered (gnutls_session_t session, | |||
652 | #define MEMSUB(x,y) ((ssize_t)((ptrdiff_t)x-(ptrdiff_t)y)) | 651 | #define MEMSUB(x,y) ((ssize_t)((ptrdiff_t)x-(ptrdiff_t)y)) |
653 | 652 | ||
654 | inline static int | 653 | inline static int |
655 | _gnutls_buffer_insert (gnutls_buffer * buffer, | 654 | _gnutls_buffer_insert (mhd_gtls_buffer * buffer, |
656 | const opaque * _data, size_t data_size) | 655 | const opaque * _data, size_t data_size) |
657 | { | 656 | { |
658 | 657 | ||
@@ -681,7 +680,7 @@ _gnutls_buffer_insert (gnutls_buffer * buffer, | |||
681 | 680 | ||
682 | } | 681 | } |
683 | 682 | ||
684 | if (_gnutls_buffer_append (buffer, _data, data_size) < 0) | 683 | if (mhd_gtls_buffer_append (buffer, _data, data_size) < 0) |
685 | { | 684 | { |
686 | gnutls_assert (); | 685 | gnutls_assert (); |
687 | return GNUTLS_E_MEMORY_ERROR; | 686 | return GNUTLS_E_MEMORY_ERROR; |
@@ -691,7 +690,7 @@ _gnutls_buffer_insert (gnutls_buffer * buffer, | |||
691 | } | 690 | } |
692 | 691 | ||
693 | inline static int | 692 | inline static int |
694 | _gnutls_buffer_get (gnutls_buffer * buffer, | 693 | _gnutls_buffer_get (mhd_gtls_buffer * buffer, |
695 | const opaque ** ptr, size_t * ptr_size) | 694 | const opaque ** ptr, size_t * ptr_size) |
696 | { | 695 | { |
697 | *ptr_size = buffer->length; | 696 | *ptr_size = buffer->length; |
@@ -708,12 +707,12 @@ _gnutls_buffer_get (gnutls_buffer * buffer, | |||
708 | * | 707 | * |
709 | * We need to push exactly the data in n, since we cannot send less | 708 | * We need to push exactly the data in n, since we cannot send less |
710 | * data. In TLS the peer must receive the whole packet in order | 709 | * data. In TLS the peer must receive the whole packet in order |
711 | * to decrypt and verify the integrity. | 710 | * to decrypt and verify the integrity. |
712 | * | 711 | * |
713 | */ | 712 | */ |
714 | ssize_t | 713 | ssize_t |
715 | _gnutls_io_write_buffered (gnutls_session_t session, | 714 | mhd_gtls_io_write_buffered (mhd_gtls_session_t session, |
716 | const void *iptr, size_t n) | 715 | const void *iptr, size_t n) |
717 | { | 716 | { |
718 | size_t left; | 717 | size_t left; |
719 | unsigned j, x, sum = 0; | 718 | unsigned j, x, sum = 0; |
@@ -743,9 +742,8 @@ _gnutls_io_write_buffered (gnutls_session_t session, | |||
743 | if (iptr == NULL) | 742 | if (iptr == NULL) |
744 | { | 743 | { |
745 | /* checking is handled above */ | 744 | /* checking is handled above */ |
746 | ret | 745 | ret = _gnutls_buffer_get (&session->internals.record_send_buffer, &ptr, |
747 | = | 746 | &n); |
748 | _gnutls_buffer_get (&session->internals.record_send_buffer, &ptr, &n); | ||
749 | if (ret < 0) | 747 | if (ret < 0) |
750 | { | 748 | { |
751 | gnutls_assert (); | 749 | gnutls_assert (); |
@@ -843,14 +841,14 @@ _gnutls_io_write_buffered (gnutls_session_t session, | |||
843 | break; | 841 | break; |
844 | 842 | ||
845 | sprintf (tmp, "%.4x - ", x); | 843 | sprintf (tmp, "%.4x - ", x); |
846 | _gnutls_str_cat (line, sizeof (line), tmp); | 844 | mhd_gtls_str_cat (line, sizeof (line), tmp); |
847 | 845 | ||
848 | for (j = 0; j < 16; j++) | 846 | for (j = 0; j < 16; j++) |
849 | { | 847 | { |
850 | if (sum < n - left) | 848 | if (sum < n - left) |
851 | { | 849 | { |
852 | sprintf (tmp, "%.2x ", ((unsigned char *) ptr)[sum++]); | 850 | sprintf (tmp, "%.2x ", ((unsigned char *) ptr)[sum++]); |
853 | _gnutls_str_cat (line, sizeof (line), tmp); | 851 | mhd_gtls_str_cat (line, sizeof (line), tmp); |
854 | } | 852 | } |
855 | else | 853 | else |
856 | break; | 854 | break; |
@@ -874,14 +872,14 @@ _gnutls_io_write_buffered (gnutls_session_t session, | |||
874 | * interrupted. | 872 | * interrupted. |
875 | */ | 873 | */ |
876 | ssize_t | 874 | ssize_t |
877 | _gnutls_io_write_flush (gnutls_session_t session) | 875 | mhd_gtls_io_write_flush (mhd_gtls_session_t session) |
878 | { | 876 | { |
879 | ssize_t ret; | 877 | ssize_t ret; |
880 | 878 | ||
881 | if (session->internals.record_send_buffer.length == 0) | 879 | if (session->internals.record_send_buffer.length == 0) |
882 | return 0; /* done */ | 880 | return 0; /* done */ |
883 | 881 | ||
884 | ret = _gnutls_io_write_buffered (session, NULL, 0); | 882 | ret = mhd_gtls_io_write_buffered (session, NULL, 0); |
885 | _gnutls_write_log ("WRITE FLUSH: %d [buffer: %d]\n", ret, | 883 | _gnutls_write_log ("WRITE FLUSH: %d [buffer: %d]\n", ret, |
886 | session->internals.record_send_buffer.length); | 884 | session->internals.record_send_buffer.length); |
887 | 885 | ||
@@ -893,10 +891,10 @@ _gnutls_io_write_flush (gnutls_session_t session) | |||
893 | * interrupted. | 891 | * interrupted. |
894 | */ | 892 | */ |
895 | ssize_t | 893 | ssize_t |
896 | _gnutls_handshake_io_write_flush (gnutls_session_t session) | 894 | mhd_gtls_handshake_io_write_flush (mhd_gtls_session_t session) |
897 | { | 895 | { |
898 | ssize_t ret; | 896 | ssize_t ret; |
899 | ret = _gnutls_handshake_io_send_int (session, 0, 0, NULL, 0); | 897 | ret = mhd_gtls_handshake_io_send_int (session, 0, 0, NULL, 0); |
900 | if (ret < 0) | 898 | if (ret < 0) |
901 | { | 899 | { |
902 | gnutls_assert (); | 900 | gnutls_assert (); |
@@ -914,14 +912,14 @@ _gnutls_handshake_io_write_flush (gnutls_session_t session) | |||
914 | return ret; | 912 | return ret; |
915 | } | 913 | } |
916 | 914 | ||
917 | /* This is a send function for the gnutls handshake | 915 | /* This is a send function for the gnutls handshake |
918 | * protocol. Just makes sure that all data have been sent. | 916 | * protocol. Just makes sure that all data have been sent. |
919 | */ | 917 | */ |
920 | ssize_t | 918 | ssize_t |
921 | _gnutls_handshake_io_send_int (gnutls_session_t session, | 919 | mhd_gtls_handshake_io_send_int (mhd_gtls_session_t session, |
922 | content_type_t type, | 920 | content_type_t type, |
923 | gnutls_handshake_description_t htype, | 921 | gnutls_handshake_description_t htype, |
924 | const void *iptr, size_t n) | 922 | const void *iptr, size_t n) |
925 | { | 923 | { |
926 | size_t left; | 924 | size_t left; |
927 | ssize_t ret = 0; | 925 | ssize_t ret = 0; |
@@ -936,9 +934,8 @@ _gnutls_handshake_io_send_int (gnutls_session_t session, | |||
936 | /* resuming previously interrupted write | 934 | /* resuming previously interrupted write |
937 | */ | 935 | */ |
938 | gnutls_assert (); | 936 | gnutls_assert (); |
939 | ret = | 937 | ret = _gnutls_buffer_get (&session->internals.handshake_send_buffer, |
940 | _gnutls_buffer_get (&session->internals.handshake_send_buffer, &ptr, | 938 | &ptr, &n); |
941 | &n); | ||
942 | if (ret < 0) | 939 | if (ret < 0) |
943 | { | 940 | { |
944 | gnutls_assert (); | 941 | gnutls_assert (); |
@@ -996,7 +993,7 @@ _gnutls_handshake_io_send_int (gnutls_session_t session, | |||
996 | left = n; | 993 | left = n; |
997 | while (left > 0) | 994 | while (left > 0) |
998 | { | 995 | { |
999 | ret = _gnutls_send_int (session, type, htype, &ptr[n - left], left); | 996 | ret = mhd_gtls_send_int (session, type, htype, &ptr[n - left], left); |
1000 | 997 | ||
1001 | if (ret <= 0) | 998 | if (ret <= 0) |
1002 | { | 999 | { |
@@ -1006,14 +1003,15 @@ _gnutls_handshake_io_send_int (gnutls_session_t session, | |||
1006 | ret = GNUTLS_E_INTERNAL_ERROR; | 1003 | ret = GNUTLS_E_INTERNAL_ERROR; |
1007 | } | 1004 | } |
1008 | 1005 | ||
1009 | if (left > 0 | 1006 | if (left > 0 && (ret == GNUTLS_E_INTERRUPTED || ret |
1010 | && (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN)) | 1007 | == GNUTLS_E_AGAIN)) |
1011 | { | 1008 | { |
1012 | gnutls_assert (); | 1009 | gnutls_assert (); |
1013 | 1010 | ||
1014 | retval = _gnutls_buffer_insert (&session->internals. | 1011 | retval = |
1015 | handshake_send_buffer, | 1012 | _gnutls_buffer_insert (&session->internals. |
1016 | &ptr[n - left], left); | 1013 | handshake_send_buffer, &ptr[n - left], |
1014 | left); | ||
1017 | if (retval < 0) | 1015 | if (retval < 0) |
1018 | { | 1016 | { |
1019 | gnutls_assert (); | 1017 | gnutls_assert (); |
@@ -1047,14 +1045,14 @@ _gnutls_handshake_io_send_int (gnutls_session_t session, | |||
1047 | 1045 | ||
1048 | } | 1046 | } |
1049 | 1047 | ||
1050 | /* This is a receive function for the gnutls handshake | 1048 | /* This is a receive function for the gnutls handshake |
1051 | * protocol. Makes sure that we have received all data. | 1049 | * protocol. Makes sure that we have received all data. |
1052 | */ | 1050 | */ |
1053 | ssize_t | 1051 | ssize_t |
1054 | _gnutls_handshake_io_recv_int (gnutls_session_t session, | 1052 | mhd_gtls_handshake_io_recv_int (mhd_gtls_session_t session, |
1055 | content_type_t type, | 1053 | content_type_t type, |
1056 | gnutls_handshake_description_t htype, | 1054 | gnutls_handshake_description_t htype, |
1057 | void *iptr, size_t sizeOfPtr) | 1055 | void *iptr, size_t sizeOfPtr) |
1058 | { | 1056 | { |
1059 | size_t left; | 1057 | size_t left; |
1060 | ssize_t i; | 1058 | ssize_t i; |
@@ -1084,8 +1082,7 @@ _gnutls_handshake_io_recv_int (gnutls_session_t session, | |||
1084 | session->internals.handshake_recv_buffer.length -= sizeOfPtr; | 1082 | session->internals.handshake_recv_buffer.length -= sizeOfPtr; |
1085 | 1083 | ||
1086 | memmove (session->internals.handshake_recv_buffer.data, | 1084 | memmove (session->internals.handshake_recv_buffer.data, |
1087 | &session->internals.handshake_recv_buffer. | 1085 | &session->internals.handshake_recv_buffer.data[sizeOfPtr], |
1088 | data[sizeOfPtr], | ||
1089 | session->internals.handshake_recv_buffer.length); | 1086 | session->internals.handshake_recv_buffer.length); |
1090 | 1087 | ||
1091 | return sizeOfPtr; | 1088 | return sizeOfPtr; |
@@ -1105,7 +1102,7 @@ _gnutls_handshake_io_recv_int (gnutls_session_t session, | |||
1105 | while (left > 0) | 1102 | while (left > 0) |
1106 | { | 1103 | { |
1107 | dsize = sizeOfPtr - left; | 1104 | dsize = sizeOfPtr - left; |
1108 | i = _gnutls_recv_int (session, type, htype, &ptr[dsize], left); | 1105 | i = mhd_gtls_recv_int (session, type, htype, &ptr[dsize], left); |
1109 | if (i < 0) | 1106 | if (i < 0) |
1110 | { | 1107 | { |
1111 | 1108 | ||
@@ -1114,7 +1111,8 @@ _gnutls_handshake_io_recv_int (gnutls_session_t session, | |||
1114 | gnutls_assert (); | 1111 | gnutls_assert (); |
1115 | 1112 | ||
1116 | session->internals.handshake_recv_buffer.data | 1113 | session->internals.handshake_recv_buffer.data |
1117 | = gnutls_realloc_fast (session->internals. | 1114 | = |
1115 | mhd_gtls_realloc_fast (session->internals. | ||
1118 | handshake_recv_buffer.data, dsize); | 1116 | handshake_recv_buffer.data, dsize); |
1119 | if (session->internals.handshake_recv_buffer.data == NULL) | 1117 | if (session->internals.handshake_recv_buffer.data == NULL) |
1120 | { | 1118 | { |
@@ -1157,15 +1155,16 @@ _gnutls_handshake_io_recv_int (gnutls_session_t session, | |||
1157 | * and finished messages. | 1155 | * and finished messages. |
1158 | */ | 1156 | */ |
1159 | int | 1157 | int |
1160 | _gnutls_handshake_buffer_put (gnutls_session_t session, | 1158 | mhd_gtls_handshake_buffer_put (mhd_gtls_session_t session, opaque * data, |
1161 | opaque * data, size_t length) | 1159 | size_t length) |
1162 | { | 1160 | { |
1163 | 1161 | ||
1164 | if (length == 0) | 1162 | if (length == 0) |
1165 | return 0; | 1163 | return 0; |
1166 | 1164 | ||
1167 | if ((session->internals.max_handshake_data_buffer_size > 0) && ((length | 1165 | if ((session->internals.max_handshake_data_buffer_size > 0) && ((length |
1168 | + session-> | 1166 | + |
1167 | session-> | ||
1169 | internals. | 1168 | internals. |
1170 | handshake_hash_buffer. | 1169 | handshake_hash_buffer. |
1171 | length) > | 1170 | length) > |
@@ -1179,8 +1178,8 @@ _gnutls_handshake_buffer_put (gnutls_session_t session, | |||
1179 | 1178 | ||
1180 | _gnutls_buffers_log ("BUF[HSK]: Inserted %d bytes of Data\n", length); | 1179 | _gnutls_buffers_log ("BUF[HSK]: Inserted %d bytes of Data\n", length); |
1181 | 1180 | ||
1182 | if (_gnutls_buffer_append (&session->internals.handshake_hash_buffer, data, | 1181 | if (mhd_gtls_buffer_append (&session->internals.handshake_hash_buffer, data, |
1183 | length) < 0) | 1182 | length) < 0) |
1184 | { | 1183 | { |
1185 | gnutls_assert (); | 1184 | gnutls_assert (); |
1186 | return GNUTLS_E_MEMORY_ERROR; | 1185 | return GNUTLS_E_MEMORY_ERROR; |
@@ -1190,7 +1189,7 @@ _gnutls_handshake_buffer_put (gnutls_session_t session, | |||
1190 | } | 1189 | } |
1191 | 1190 | ||
1192 | int | 1191 | int |
1193 | _gnutls_handshake_buffer_get_size (gnutls_session_t session) | 1192 | mhd_gtls_handshake_buffer_get_size (mhd_gtls_session_t session) |
1194 | { | 1193 | { |
1195 | 1194 | ||
1196 | return session->internals.handshake_hash_buffer.length; | 1195 | return session->internals.handshake_hash_buffer.length; |
@@ -1200,8 +1199,8 @@ _gnutls_handshake_buffer_get_size (gnutls_session_t session) | |||
1200 | * and returns data from it (peek mode!) | 1199 | * and returns data from it (peek mode!) |
1201 | */ | 1200 | */ |
1202 | int | 1201 | int |
1203 | _gnutls_handshake_buffer_peek (gnutls_session_t session, | 1202 | mhd_gtls_handshake_buffer_peek (mhd_gtls_session_t session, opaque * data, |
1204 | opaque * data, size_t length) | 1203 | size_t length) |
1205 | { | 1204 | { |
1206 | if (length > session->internals.handshake_hash_buffer.length) | 1205 | if (length > session->internals.handshake_hash_buffer.length) |
1207 | { | 1206 | { |
@@ -1218,8 +1217,8 @@ _gnutls_handshake_buffer_peek (gnutls_session_t session, | |||
1218 | * and returns data from it (peek mode!) | 1217 | * and returns data from it (peek mode!) |
1219 | */ | 1218 | */ |
1220 | int | 1219 | int |
1221 | _gnutls_handshake_buffer_get_ptr (gnutls_session_t session, | 1220 | mhd_gtls_handshake_buffer_get_ptr (mhd_gtls_session_t session, |
1222 | opaque ** data_ptr, size_t * length) | 1221 | opaque ** data_ptr, size_t * length) |
1223 | { | 1222 | { |
1224 | if (length != NULL) | 1223 | if (length != NULL) |
1225 | *length = session->internals.handshake_hash_buffer.length; | 1224 | *length = session->internals.handshake_hash_buffer.length; |
@@ -1235,7 +1234,7 @@ _gnutls_handshake_buffer_get_ptr (gnutls_session_t session, | |||
1235 | /* Does not free the buffer | 1234 | /* Does not free the buffer |
1236 | */ | 1235 | */ |
1237 | int | 1236 | int |
1238 | _gnutls_handshake_buffer_empty (gnutls_session_t session) | 1237 | mhd_gtls_handshake_buffer_empty (mhd_gtls_session_t session) |
1239 | { | 1238 | { |
1240 | 1239 | ||
1241 | _gnutls_buffers_log ("BUF[HSK]: Emptied buffer\n"); | 1240 | _gnutls_buffers_log ("BUF[HSK]: Emptied buffer\n"); |
@@ -1246,12 +1245,9 @@ _gnutls_handshake_buffer_empty (gnutls_session_t session) | |||
1246 | } | 1245 | } |
1247 | 1246 | ||
1248 | int | 1247 | int |
1249 | _gnutls_handshake_buffer_clear (gnutls_session_t session) | 1248 | mhd_gtls_handshake_buffer_clear (mhd_gtls_session_t session) |
1250 | { | 1249 | { |
1251 | |||
1252 | _gnutls_buffers_log ("BUF[HSK]: Cleared Data from buffer\n"); | 1250 | _gnutls_buffers_log ("BUF[HSK]: Cleared Data from buffer\n"); |
1253 | 1251 | mhd_gtls_buffer_clear (&session->internals.handshake_hash_buffer); | |
1254 | _gnutls_buffer_clear (&session->internals.handshake_hash_buffer); | ||
1255 | |||
1256 | return 0; | 1252 | return 0; |
1257 | } | 1253 | } |
diff --git a/src/daemon/https/tls/gnutls_buffers.h b/src/daemon/https/tls/gnutls_buffers.h index aaafde0d..c3a09097 100644 --- a/src/daemon/https/tls/gnutls_buffers.h +++ b/src/daemon/https/tls/gnutls_buffers.h | |||
@@ -22,46 +22,46 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_record_buffer_put (content_type_t type, | 25 | int mhd_gnutls_record_buffer_put (content_type_t type, |
26 | gnutls_session_t session, opaque * data, | 26 | mhd_gtls_session_t session, opaque * data, |
27 | size_t length); | 27 | size_t length); |
28 | int _gnutls_record_buffer_get_size (content_type_t type, | 28 | int mhd_gnutls_record_buffer_get_size (content_type_t type, |
29 | gnutls_session_t session); | 29 | mhd_gtls_session_t session); |
30 | int _gnutls_record_buffer_get (content_type_t type, | 30 | int mhd_gtls_record_buffer_get (content_type_t type, |
31 | gnutls_session_t session, opaque * data, | 31 | mhd_gtls_session_t session, opaque * data, |
32 | size_t length); | 32 | size_t length); |
33 | ssize_t _gnutls_io_read_buffered (gnutls_session_t, opaque ** iptr, | 33 | ssize_t mhd_gtls_io_read_buffered (mhd_gtls_session_t, opaque ** iptr, |
34 | size_t n, content_type_t); | 34 | size_t n, content_type_t); |
35 | void _gnutls_io_clear_read_buffer (gnutls_session_t); | 35 | void mhd_gtls_io_clear_read_buffer (mhd_gtls_session_t); |
36 | int _gnutls_io_clear_peeked_data (gnutls_session_t session); | 36 | int mhd_gtls_io_clear_peeked_data (mhd_gtls_session_t session); |
37 | 37 | ||
38 | ssize_t _gnutls_io_write_buffered (gnutls_session_t, const void *iptr, | 38 | ssize_t mhd_gtls_io_write_buffered (mhd_gtls_session_t, const void *iptr, |
39 | size_t n); | 39 | size_t n); |
40 | ssize_t _gnutls_io_write_buffered2 (gnutls_session_t, const void *iptr, | 40 | ssize_t mhd_gtls_io_write_buffered2 (mhd_gtls_session_t, const void *iptr, |
41 | size_t n, const void *iptr2, size_t n2); | 41 | size_t n, const void *iptr2, size_t n2); |
42 | 42 | ||
43 | int _gnutls_handshake_buffer_get_size (gnutls_session_t session); | 43 | int mhd_gtls_handshake_buffer_get_size (mhd_gtls_session_t session); |
44 | int _gnutls_handshake_buffer_peek (gnutls_session_t session, opaque * data, | 44 | int mhd_gtls_handshake_buffer_peek (mhd_gtls_session_t session, opaque * data, |
45 | size_t length); | 45 | size_t length); |
46 | int _gnutls_handshake_buffer_put (gnutls_session_t session, opaque * data, | 46 | int mhd_gtls_handshake_buffer_put (mhd_gtls_session_t session, opaque * data, |
47 | size_t length); | 47 | size_t length); |
48 | int _gnutls_handshake_buffer_clear (gnutls_session_t session); | 48 | int mhd_gtls_handshake_buffer_clear (mhd_gtls_session_t session); |
49 | int _gnutls_handshake_buffer_empty (gnutls_session_t session); | 49 | int mhd_gtls_handshake_buffer_empty (mhd_gtls_session_t session); |
50 | int _gnutls_handshake_buffer_get_ptr (gnutls_session_t session, | 50 | int mhd_gtls_handshake_buffer_get_ptr (mhd_gtls_session_t session, |
51 | opaque ** data_ptr, size_t * length); | 51 | opaque ** data_ptr, size_t * length); |
52 | 52 | ||
53 | #define _gnutls_handshake_io_buffer_clear( session) \ | 53 | #define _gnutls_handshake_io_buffer_clear( session) \ |
54 | _gnutls_buffer_clear( &session->internals.handshake_send_buffer); \ | 54 | mhd_gtls_buffer_clear( &session->internals.handshake_send_buffer); \ |
55 | _gnutls_buffer_clear( &session->internals.handshake_recv_buffer); \ | 55 | mhd_gtls_buffer_clear( &session->internals.handshake_recv_buffer); \ |
56 | session->internals.handshake_send_buffer_prev_size = 0 | 56 | session->internals.handshake_send_buffer_prev_size = 0 |
57 | 57 | ||
58 | ssize_t _gnutls_handshake_io_recv_int (gnutls_session_t, content_type_t, | 58 | ssize_t mhd_gtls_handshake_io_recv_int (mhd_gtls_session_t, content_type_t, |
59 | gnutls_handshake_description_t, void *, | 59 | gnutls_handshake_description_t, void *, |
60 | size_t); | 60 | size_t); |
61 | ssize_t _gnutls_handshake_io_send_int (gnutls_session_t, content_type_t, | 61 | ssize_t mhd_gtls_handshake_io_send_int (mhd_gtls_session_t, content_type_t, |
62 | gnutls_handshake_description_t, | 62 | gnutls_handshake_description_t, |
63 | const void *, size_t); | 63 | const void *, size_t); |
64 | ssize_t _gnutls_io_write_flush (gnutls_session_t session); | 64 | ssize_t mhd_gtls_io_write_flush (mhd_gtls_session_t session); |
65 | ssize_t _gnutls_handshake_io_write_flush (gnutls_session_t session); | 65 | ssize_t mhd_gtls_handshake_io_write_flush (mhd_gtls_session_t session); |
66 | 66 | ||
67 | size_t gnutls_record_check_pending (gnutls_session_t session); | 67 | size_t MHD_gtls_record_check_pending (mhd_gtls_session_t session); |
diff --git a/src/daemon/https/tls/gnutls_cert.c b/src/daemon/https/tls/gnutls_cert.c index 63c0b497..ee169a75 100644 --- a/src/daemon/https/tls/gnutls_cert.c +++ b/src/daemon/https/tls/gnutls_cert.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "mpi.h" | 46 | #include "mpi.h" |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * gnutls_certificate_free_keys - Used to free all the keys from a gnutls_certificate_credentials_t structure | 49 | * MHD_gnutls_certificate_free_keys - Used to free all the keys from a mhd_gtls_cert_credentials_t structure |
50 | * @sc: is an #gnutls_certificate_credentials_t structure. | 50 | * @sc: is an #mhd_gtls_cert_credentials_t structure. |
51 | * | 51 | * |
52 | * This function will delete all the keys and the certificates associated | 52 | * This function will delete all the keys and the certificates associated |
53 | * with the given credentials. This function must not be called when a | 53 | * with the given credentials. This function must not be called when a |
@@ -55,7 +55,7 @@ | |||
55 | * | 55 | * |
56 | **/ | 56 | **/ |
57 | void | 57 | void |
58 | gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc) | 58 | MHD_gnutls_certificate_free_keys (mhd_gtls_cert_credentials_t sc) |
59 | { | 59 | { |
60 | unsigned i, j; | 60 | unsigned i, j; |
61 | 61 | ||
@@ -63,7 +63,7 @@ gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc) | |||
63 | { | 63 | { |
64 | for (j = 0; j < sc->cert_list_length[i]; j++) | 64 | for (j = 0; j < sc->cert_list_length[i]; j++) |
65 | { | 65 | { |
66 | _gnutls_gcert_deinit (&sc->cert_list[i][j]); | 66 | mhd_gtls_gcert_deinit (&sc->cert_list[i][j]); |
67 | } | 67 | } |
68 | gnutls_free (sc->cert_list[i]); | 68 | gnutls_free (sc->cert_list[i]); |
69 | } | 69 | } |
@@ -76,7 +76,7 @@ gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc) | |||
76 | 76 | ||
77 | for (i = 0; i < sc->ncerts; i++) | 77 | for (i = 0; i < sc->ncerts; i++) |
78 | { | 78 | { |
79 | _gnutls_gkey_deinit (&sc->pkey[i]); | 79 | mhd_gtls_gkey_deinit (&sc->pkey[i]); |
80 | } | 80 | } |
81 | 81 | ||
82 | gnutls_free (sc->pkey); | 82 | gnutls_free (sc->pkey); |
@@ -87,17 +87,17 @@ gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * gnutls_certificate_free_cas - Used to free all the CAs from a gnutls_certificate_credentials_t structure | 90 | * MHD_gnutls_certificate_free_cas - Used to free all the CAs from a mhd_gtls_cert_credentials_t structure |
91 | * @sc: is an #gnutls_certificate_credentials_t structure. | 91 | * @sc: is an #mhd_gtls_cert_credentials_t structure. |
92 | * | 92 | * |
93 | * This function will delete all the CAs associated | 93 | * This function will delete all the CAs associated |
94 | * with the given credentials. Servers that do not use | 94 | * with the given credentials. Servers that do not use |
95 | * gnutls_certificate_verify_peers2() may call this to | 95 | * MHD_gtls_certificate_verify_peers2() may call this to |
96 | * save some memory. | 96 | * save some memory. |
97 | * | 97 | * |
98 | **/ | 98 | **/ |
99 | void | 99 | void |
100 | gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc) | 100 | MHD_gnutls_certificate_free_cas (mhd_gtls_cert_credentials_t sc) |
101 | { | 101 | { |
102 | unsigned j; | 102 | unsigned j; |
103 | 103 | ||
@@ -114,8 +114,8 @@ gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc) | |||
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * gnutls_certificate_free_ca_names - Used to free all the CA names from a gnutls_certificate_credentials_t structure | 117 | * MHD_gnutls_certificate_free_ca_names - Used to free all the CA names from a mhd_gtls_cert_credentials_t structure |
118 | * @sc: is an #gnutls_certificate_credentials_t structure. | 118 | * @sc: is an #mhd_gtls_cert_credentials_t structure. |
119 | * | 119 | * |
120 | * This function will delete all the CA name in the | 120 | * This function will delete all the CA name in the |
121 | * given credentials. Clients may call this to save some memory | 121 | * given credentials. Clients may call this to save some memory |
@@ -126,13 +126,13 @@ gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc) | |||
126 | * | 126 | * |
127 | **/ | 127 | **/ |
128 | void | 128 | void |
129 | gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc) | 129 | MHD_gnutls_certificate_free_ca_names (mhd_gtls_cert_credentials_t sc) |
130 | { | 130 | { |
131 | _gnutls_free_datum (&sc->x509_rdn_sequence); | 131 | _gnutls_free_datum (&sc->x509_rdn_sequence); |
132 | } | 132 | } |
133 | 133 | ||
134 | /*- | 134 | /*- |
135 | * _gnutls_certificate_get_rsa_params - Returns the RSA parameters pointer | 135 | * mhd_gtls_certificate_get_rsa_params - Returns the RSA parameters pointer |
136 | * @rsa_params: holds the RSA parameters or NULL. | 136 | * @rsa_params: holds the RSA parameters or NULL. |
137 | * @func: function to retrieve the parameters or NULL. | 137 | * @func: function to retrieve the parameters or NULL. |
138 | * @session: The session. | 138 | * @session: The session. |
@@ -140,10 +140,10 @@ gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc) | |||
140 | * This function will return the rsa parameters pointer. | 140 | * This function will return the rsa parameters pointer. |
141 | * | 141 | * |
142 | -*/ | 142 | -*/ |
143 | gnutls_rsa_params_t | 143 | mhd_gtls_rsa_params_t |
144 | _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t rsa_params, | 144 | mhd_gtls_certificate_get_rsa_params (mhd_gtls_rsa_params_t rsa_params, |
145 | gnutls_params_function * func, | 145 | gnutls_params_function * func, |
146 | gnutls_session_t session) | 146 | mhd_gtls_session_t session) |
147 | { | 147 | { |
148 | gnutls_params_st params; | 148 | gnutls_params_st params; |
149 | int ret; | 149 | int ret; |
@@ -172,8 +172,8 @@ _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t rsa_params, | |||
172 | 172 | ||
173 | 173 | ||
174 | /** | 174 | /** |
175 | * gnutls_certificate_free_credentials - Used to free an allocated gnutls_certificate_credentials_t structure | 175 | * MHD_gnutls_certificate_free_credentials - Used to free an allocated mhd_gtls_cert_credentials_t structure |
176 | * @sc: is an #gnutls_certificate_credentials_t structure. | 176 | * @sc: is an #mhd_gtls_cert_credentials_t structure. |
177 | * | 177 | * |
178 | * This structure is complex enough to manipulate directly thus | 178 | * This structure is complex enough to manipulate directly thus |
179 | * this helper function is provided in order to free (deallocate) it. | 179 | * this helper function is provided in order to free (deallocate) it. |
@@ -183,13 +183,13 @@ _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t rsa_params, | |||
183 | * this function). | 183 | * this function). |
184 | **/ | 184 | **/ |
185 | void | 185 | void |
186 | gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc) | 186 | MHD_gnutls_certificate_free_credentials (mhd_gtls_cert_credentials_t sc) |
187 | { | 187 | { |
188 | gnutls_certificate_free_keys (sc); | 188 | MHD_gnutls_certificate_free_keys (sc); |
189 | gnutls_certificate_free_cas (sc); | 189 | MHD_gnutls_certificate_free_cas (sc); |
190 | gnutls_certificate_free_ca_names (sc); | 190 | MHD_gnutls_certificate_free_ca_names (sc); |
191 | #ifdef ENABLE_PKI | 191 | #ifdef ENABLE_PKI |
192 | gnutls_certificate_free_crls (sc); | 192 | MHD_gnutls_certificate_free_crls (sc); |
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | #ifndef KEYRING_HACK | 195 | #ifndef KEYRING_HACK |
@@ -204,8 +204,8 @@ gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc) | |||
204 | 204 | ||
205 | 205 | ||
206 | /** | 206 | /** |
207 | * gnutls_certificate_allocate_credentials - Used to allocate a gnutls_certificate_credentials_t structure | 207 | * MHD_gnutls_certificate_allocate_credentials - Used to allocate a mhd_gtls_cert_credentials_t structure |
208 | * @res: is a pointer to an #gnutls_certificate_credentials_t structure. | 208 | * @res: is a pointer to an #mhd_gtls_cert_credentials_t structure. |
209 | * | 209 | * |
210 | * This structure is complex enough to manipulate directly thus this | 210 | * This structure is complex enough to manipulate directly thus this |
211 | * helper function is provided in order to allocate it. | 211 | * helper function is provided in order to allocate it. |
@@ -213,7 +213,7 @@ gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc) | |||
213 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 213 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
214 | **/ | 214 | **/ |
215 | int | 215 | int |
216 | gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t * | 216 | MHD_gnutls_certificate_allocate_credentials (mhd_gtls_cert_credentials_t * |
217 | res) | 217 | res) |
218 | { | 218 | { |
219 | *res = gnutls_calloc (1, sizeof (certificate_credentials_st)); | 219 | *res = gnutls_calloc (1, sizeof (certificate_credentials_st)); |
@@ -235,7 +235,7 @@ gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t * | |||
235 | * extensions in order to disable unneded algorithms. | 235 | * extensions in order to disable unneded algorithms. |
236 | */ | 236 | */ |
237 | int | 237 | int |
238 | _gnutls_selected_cert_supported_kx (gnutls_session_t session, | 238 | mhd_gtls_selected_cert_supported_kx (mhd_gtls_session_t session, |
239 | gnutls_kx_algorithm_t ** alg, | 239 | gnutls_kx_algorithm_t ** alg, |
240 | int *alg_size) | 240 | int *alg_size) |
241 | { | 241 | { |
@@ -257,7 +257,7 @@ _gnutls_selected_cert_supported_kx (gnutls_session_t session, | |||
257 | 257 | ||
258 | for (kx = 0; kx < MAX_ALGOS; kx++) | 258 | for (kx = 0; kx < MAX_ALGOS; kx++) |
259 | { | 259 | { |
260 | pk = _gnutls_map_pk_get_pk (kx); | 260 | pk = mhd_gtls_map_pk_get_pk (kx); |
261 | if (pk == cert->subject_pk_algorithm) | 261 | if (pk == cert->subject_pk_algorithm) |
262 | { | 262 | { |
263 | /* then check key usage */ | 263 | /* then check key usage */ |
@@ -288,8 +288,8 @@ _gnutls_selected_cert_supported_kx (gnutls_session_t session, | |||
288 | 288 | ||
289 | 289 | ||
290 | /** | 290 | /** |
291 | * gnutls_certificate_server_set_request - Used to set whether to request a client certificate | 291 | * MHD_gtls_certificate_server_set_request - Used to set whether to request a client certificate |
292 | * @session: is an #gnutls_session_t structure. | 292 | * @session: is an #mhd_gtls_session_t structure. |
293 | * @req: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE | 293 | * @req: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE |
294 | * | 294 | * |
295 | * This function specifies if we (in case of a server) are going | 295 | * This function specifies if we (in case of a server) are going |
@@ -300,21 +300,21 @@ _gnutls_selected_cert_supported_kx (gnutls_session_t session, | |||
300 | * send a certificate. | 300 | * send a certificate. |
301 | **/ | 301 | **/ |
302 | void | 302 | void |
303 | gnutls_certificate_server_set_request (gnutls_session_t session, | 303 | MHD_gtls_certificate_server_set_request (mhd_gtls_session_t session, |
304 | gnutls_certificate_request_t req) | 304 | gnutls_certificate_request_t req) |
305 | { | 305 | { |
306 | session->internals.send_cert_req = req; | 306 | session->internals.send_cert_req = req; |
307 | } | 307 | } |
308 | 308 | ||
309 | /** | 309 | /** |
310 | * gnutls_certificate_client_set_retrieve_function - Used to set a callback to retrieve the certificate | 310 | * MHD_gtls_certificate_client_set_retrieve_function - Used to set a callback to retrieve the certificate |
311 | * @cred: is a #gnutls_certificate_credentials_t structure. | 311 | * @cred: is a #mhd_gtls_cert_credentials_t structure. |
312 | * @func: is the callback function | 312 | * @func: is the callback function |
313 | * | 313 | * |
314 | * This function sets a callback to be called in order to retrieve the certificate | 314 | * This function sets a callback to be called in order to retrieve the certificate |
315 | * to be used in the handshake. | 315 | * to be used in the handshake. |
316 | * The callback's function prototype is: | 316 | * The callback's function prototype is: |
317 | * int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, | 317 | * int (*callback)(mhd_gtls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, |
318 | * const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st* st); | 318 | * const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st* st); |
319 | * | 319 | * |
320 | * @req_ca_cert is only used in X.509 certificates. | 320 | * @req_ca_cert is only used in X.509 certificates. |
@@ -336,22 +336,22 @@ gnutls_certificate_server_set_request (gnutls_session_t session, | |||
336 | * should be set to zero. The value (-1) indicates error and the handshake | 336 | * should be set to zero. The value (-1) indicates error and the handshake |
337 | * will be terminated. | 337 | * will be terminated. |
338 | **/ | 338 | **/ |
339 | void gnutls_certificate_client_set_retrieve_function | 339 | void MHD_gtls_certificate_client_set_retrieve_function |
340 | (gnutls_certificate_credentials_t cred, | 340 | (mhd_gtls_cert_credentials_t cred, |
341 | gnutls_certificate_client_retrieve_function * func) | 341 | gnutls_certificate_client_retrieve_function * func) |
342 | { | 342 | { |
343 | cred->client_get_cert_callback = func; | 343 | cred->client_get_cert_callback = func; |
344 | } | 344 | } |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * gnutls_certificate_server_set_retrieve_function - Used to set a callback to retrieve the certificate | 347 | * MHD_gtls_certificate_server_set_retrieve_function - Used to set a callback to retrieve the certificate |
348 | * @cred: is a #gnutls_certificate_credentials_t structure. | 348 | * @cred: is a #mhd_gtls_cert_credentials_t structure. |
349 | * @func: is the callback function | 349 | * @func: is the callback function |
350 | * | 350 | * |
351 | * This function sets a callback to be called in order to retrieve the certificate | 351 | * This function sets a callback to be called in order to retrieve the certificate |
352 | * to be used in the handshake. | 352 | * to be used in the handshake. |
353 | * The callback's function prototype is: | 353 | * The callback's function prototype is: |
354 | * int (*callback)(gnutls_session_t, gnutls_retr_st* st); | 354 | * int (*callback)(mhd_gtls_session_t, gnutls_retr_st* st); |
355 | * | 355 | * |
356 | * @st should contain the certificates and private keys. | 356 | * @st should contain the certificates and private keys. |
357 | * | 357 | * |
@@ -362,8 +362,8 @@ void gnutls_certificate_client_set_retrieve_function | |||
362 | * return 0 on success. The value (-1) indicates error and the handshake | 362 | * return 0 on success. The value (-1) indicates error and the handshake |
363 | * will be terminated. | 363 | * will be terminated. |
364 | **/ | 364 | **/ |
365 | void gnutls_certificate_server_set_retrieve_function | 365 | void MHD_gtls_certificate_server_set_retrieve_function |
366 | (gnutls_certificate_credentials_t cred, | 366 | (mhd_gtls_cert_credentials_t cred, |
367 | gnutls_certificate_server_retrieve_function * func) | 367 | gnutls_certificate_server_retrieve_function * func) |
368 | { | 368 | { |
369 | cred->server_get_cert_callback = func; | 369 | cred->server_get_cert_callback = func; |
@@ -446,21 +446,21 @@ _gnutls_x509_get_raw_crt_expiration_time (const gnutls_datum_t * cert) | |||
446 | * | 446 | * |
447 | -*/ | 447 | -*/ |
448 | int | 448 | int |
449 | _gnutls_openpgp_crt_verify_peers (gnutls_session_t session, | 449 | _gnutls_openpgp_crt_verify_peers (mhd_gtls_session_t session, |
450 | unsigned int *status) | 450 | unsigned int *status) |
451 | { | 451 | { |
452 | cert_auth_info_t info; | 452 | cert_auth_info_t info; |
453 | gnutls_certificate_credentials_t cred; | 453 | mhd_gtls_cert_credentials_t cred; |
454 | int peer_certificate_list_size, ret; | 454 | int peer_certificate_list_size, ret; |
455 | 455 | ||
456 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); | 456 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); |
457 | 457 | ||
458 | info = _gnutls_get_auth_info (session); | 458 | info = mhd_gtls_get_auth_info (session); |
459 | if (info == NULL) | 459 | if (info == NULL) |
460 | return GNUTLS_E_INVALID_REQUEST; | 460 | return GNUTLS_E_INVALID_REQUEST; |
461 | 461 | ||
462 | cred = (gnutls_certificate_credentials_t) | 462 | cred = (mhd_gtls_cert_credentials_t) |
463 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 463 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
464 | if (cred == NULL) | 464 | if (cred == NULL) |
465 | { | 465 | { |
466 | gnutls_assert (); | 466 | gnutls_assert (); |
@@ -506,7 +506,7 @@ _gnutls_openpgp_crt_verify_peers (gnutls_session_t session, | |||
506 | 506 | ||
507 | 507 | ||
508 | /** | 508 | /** |
509 | * gnutls_certificate_verify_peers2 - This function returns the peer's certificate verification status | 509 | * MHD_gtls_certificate_verify_peers2 - This function returns the peer's certificate verification status |
510 | * @session: is a gnutls session | 510 | * @session: is a gnutls session |
511 | * @status: is the output of the verification | 511 | * @status: is the output of the verification |
512 | * | 512 | * |
@@ -516,7 +516,7 @@ _gnutls_openpgp_crt_verify_peers (gnutls_session_t session, | |||
516 | * elements bitwise or'd. To avoid denial of service attacks some | 516 | * elements bitwise or'd. To avoid denial of service attacks some |
517 | * default upper limits regarding the certificate key size and chain | 517 | * default upper limits regarding the certificate key size and chain |
518 | * size are set. To override them use | 518 | * size are set. To override them use |
519 | * gnutls_certificate_set_verify_limits(). | 519 | * MHD_gnutls_certificate_set_verify_limits(). |
520 | * | 520 | * |
521 | * Note that you must also check the peer's name in order to check if | 521 | * Note that you must also check the peer's name in order to check if |
522 | * the verified certificate belongs to the actual peer. | 522 | * the verified certificate belongs to the actual peer. |
@@ -526,20 +526,20 @@ _gnutls_openpgp_crt_verify_peers (gnutls_session_t session, | |||
526 | * | 526 | * |
527 | * Note that some commonly used X.509 Certificate Authorities are | 527 | * Note that some commonly used X.509 Certificate Authorities are |
528 | * still using Version 1 certificates. If you want to accept them, | 528 | * still using Version 1 certificates. If you want to accept them, |
529 | * you need to call gnutls_certificate_set_verify_flags() with, e.g., | 529 | * you need to call MHD_gnutls_certificate_set_verify_flags() with, e.g., |
530 | * %GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT parameter. | 530 | * %GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT parameter. |
531 | * | 531 | * |
532 | * Returns: a negative error code on error and zero on success. | 532 | * Returns: a negative error code on error and zero on success. |
533 | **/ | 533 | **/ |
534 | int | 534 | int |
535 | gnutls_certificate_verify_peers2 (gnutls_session_t session, | 535 | MHD_gtls_certificate_verify_peers2 (mhd_gtls_session_t session, |
536 | unsigned int *status) | 536 | unsigned int *status) |
537 | { | 537 | { |
538 | cert_auth_info_t info; | 538 | cert_auth_info_t info; |
539 | 539 | ||
540 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); | 540 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); |
541 | 541 | ||
542 | info = _gnutls_get_auth_info (session); | 542 | info = mhd_gtls_get_auth_info (session); |
543 | if (info == NULL) | 543 | if (info == NULL) |
544 | { | 544 | { |
545 | return GNUTLS_E_NO_CERTIFICATE_FOUND; | 545 | return GNUTLS_E_NO_CERTIFICATE_FOUND; |
@@ -560,7 +560,7 @@ gnutls_certificate_verify_peers2 (gnutls_session_t session, | |||
560 | } | 560 | } |
561 | 561 | ||
562 | /** | 562 | /** |
563 | * gnutls_certificate_verify_peers - This function returns the peer's certificate verification status | 563 | * MHD_gtls_certificate_verify_peers - This function returns the peer's certificate verification status |
564 | * @session: is a gnutls session | 564 | * @session: is a gnutls session |
565 | * | 565 | * |
566 | * This function will try to verify the peer's certificate and return | 566 | * This function will try to verify the peer's certificate and return |
@@ -574,15 +574,15 @@ gnutls_certificate_verify_peers2 (gnutls_session_t session, | |||
574 | * | 574 | * |
575 | * This is the same as gnutls_x509_crt_list_verify(). | 575 | * This is the same as gnutls_x509_crt_list_verify(). |
576 | * | 576 | * |
577 | * Deprecated: Use gnutls_certificate_verify_peers2() instead. | 577 | * Deprecated: Use MHD_gtls_certificate_verify_peers2() instead. |
578 | **/ | 578 | **/ |
579 | int | 579 | int |
580 | gnutls_certificate_verify_peers (gnutls_session_t session) | 580 | MHD_gtls_certificate_verify_peers (mhd_gtls_session_t session) |
581 | { | 581 | { |
582 | unsigned int status; | 582 | unsigned int status; |
583 | int ret; | 583 | int ret; |
584 | 584 | ||
585 | ret = gnutls_certificate_verify_peers2 (session, &status); | 585 | ret = MHD_gtls_certificate_verify_peers2 (session, &status); |
586 | 586 | ||
587 | if (ret < 0) | 587 | if (ret < 0) |
588 | { | 588 | { |
@@ -594,7 +594,7 @@ gnutls_certificate_verify_peers (gnutls_session_t session) | |||
594 | } | 594 | } |
595 | 595 | ||
596 | /** | 596 | /** |
597 | * gnutls_certificate_expiration_time_peers - This function returns the peer's certificate expiration time | 597 | * MHD_gtls_certificate_expiration_time_peers - This function returns the peer's certificate expiration time |
598 | * @session: is a gnutls session | 598 | * @session: is a gnutls session |
599 | * | 599 | * |
600 | * This function will return the peer's certificate expiration time. | 600 | * This function will return the peer's certificate expiration time. |
@@ -602,13 +602,13 @@ gnutls_certificate_verify_peers (gnutls_session_t session) | |||
602 | * Returns: (time_t)-1 on error. | 602 | * Returns: (time_t)-1 on error. |
603 | **/ | 603 | **/ |
604 | time_t | 604 | time_t |
605 | gnutls_certificate_expiration_time_peers (gnutls_session_t session) | 605 | MHD_gtls_certificate_expiration_time_peers (mhd_gtls_session_t session) |
606 | { | 606 | { |
607 | cert_auth_info_t info; | 607 | cert_auth_info_t info; |
608 | 608 | ||
609 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); | 609 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); |
610 | 610 | ||
611 | info = _gnutls_get_auth_info (session); | 611 | info = mhd_gtls_get_auth_info (session); |
612 | if (info == NULL) | 612 | if (info == NULL) |
613 | { | 613 | { |
614 | return (time_t) - 1; | 614 | return (time_t) - 1; |
@@ -638,7 +638,7 @@ gnutls_certificate_expiration_time_peers (gnutls_session_t session) | |||
638 | } | 638 | } |
639 | 639 | ||
640 | /** | 640 | /** |
641 | * gnutls_certificate_activation_time_peers - This function returns the peer's certificate activation time | 641 | * MHD_gtls_certificate_activation_time_peers - This function returns the peer's certificate activation time |
642 | * @session: is a gnutls session | 642 | * @session: is a gnutls session |
643 | * | 643 | * |
644 | * This function will return the peer's certificate activation time. | 644 | * This function will return the peer's certificate activation time. |
@@ -647,13 +647,13 @@ gnutls_certificate_expiration_time_peers (gnutls_session_t session) | |||
647 | * Returns: (time_t)-1 on error. | 647 | * Returns: (time_t)-1 on error. |
648 | **/ | 648 | **/ |
649 | time_t | 649 | time_t |
650 | gnutls_certificate_activation_time_peers (gnutls_session_t session) | 650 | MHD_gtls_certificate_activation_time_peers (mhd_gtls_session_t session) |
651 | { | 651 | { |
652 | cert_auth_info_t info; | 652 | cert_auth_info_t info; |
653 | 653 | ||
654 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); | 654 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); |
655 | 655 | ||
656 | info = _gnutls_get_auth_info (session); | 656 | info = mhd_gtls_get_auth_info (session); |
657 | if (info == NULL) | 657 | if (info == NULL) |
658 | { | 658 | { |
659 | return (time_t) - 1; | 659 | return (time_t) - 1; |
@@ -683,7 +683,7 @@ gnutls_certificate_activation_time_peers (gnutls_session_t session) | |||
683 | } | 683 | } |
684 | 684 | ||
685 | int | 685 | int |
686 | _gnutls_raw_cert_to_gcert (gnutls_cert * gcert, | 686 | mhd_gtls_raw_cert_to_gcert (gnutls_cert * gcert, |
687 | gnutls_certificate_type_t type, | 687 | gnutls_certificate_type_t type, |
688 | const gnutls_datum_t * raw_cert, | 688 | const gnutls_datum_t * raw_cert, |
689 | int flags /* OR of ConvFlags */ ) | 689 | int flags /* OR of ConvFlags */ ) |
@@ -691,7 +691,7 @@ _gnutls_raw_cert_to_gcert (gnutls_cert * gcert, | |||
691 | switch (type) | 691 | switch (type) |
692 | { | 692 | { |
693 | case MHD_GNUTLS_CRT_X509: | 693 | case MHD_GNUTLS_CRT_X509: |
694 | return _gnutls_x509_raw_cert_to_gcert (gcert, raw_cert, flags); | 694 | return mhd_gtls_x509_raw_cert_to_gcert (gcert, raw_cert, flags); |
695 | case MHD_GNUTLS_CRT_OPENPGP: | 695 | case MHD_GNUTLS_CRT_OPENPGP: |
696 | if (_E_gnutls_openpgp_raw_key_to_gcert == NULL) | 696 | if (_E_gnutls_openpgp_raw_key_to_gcert == NULL) |
697 | { | 697 | { |
@@ -706,7 +706,7 @@ _gnutls_raw_cert_to_gcert (gnutls_cert * gcert, | |||
706 | } | 706 | } |
707 | 707 | ||
708 | int | 708 | int |
709 | _gnutls_raw_privkey_to_gkey (gnutls_privkey * key, | 709 | mhd_gtls_raw_privkey_to_gkey (gnutls_privkey * key, |
710 | gnutls_certificate_type_t type, | 710 | gnutls_certificate_type_t type, |
711 | const gnutls_datum_t * raw_key, | 711 | const gnutls_datum_t * raw_key, |
712 | int key_enc /* DER or PEM */ ) | 712 | int key_enc /* DER or PEM */ ) |
@@ -741,7 +741,7 @@ _gnutls_raw_privkey_to_gkey (gnutls_privkey * key, | |||
741 | * The critical extensions will be catched by the verification functions. | 741 | * The critical extensions will be catched by the verification functions. |
742 | */ | 742 | */ |
743 | int | 743 | int |
744 | _gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert, | 744 | mhd_gtls_x509_raw_cert_to_gcert (gnutls_cert * gcert, |
745 | const gnutls_datum_t * derCert, | 745 | const gnutls_datum_t * derCert, |
746 | int flags /* OR of ConvFlags */ ) | 746 | int flags /* OR of ConvFlags */ ) |
747 | { | 747 | { |
@@ -763,7 +763,7 @@ _gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert, | |||
763 | return ret; | 763 | return ret; |
764 | } | 764 | } |
765 | 765 | ||
766 | ret = _gnutls_x509_crt_to_gcert (gcert, cert, flags); | 766 | ret = mhd_gtls_x509_crt_to_gcert (gcert, cert, flags); |
767 | gnutls_x509_crt_deinit (cert); | 767 | gnutls_x509_crt_deinit (cert); |
768 | 768 | ||
769 | return ret; | 769 | return ret; |
@@ -772,7 +772,7 @@ _gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert, | |||
772 | /* Like above but it accepts a parsed certificate instead. | 772 | /* Like above but it accepts a parsed certificate instead. |
773 | */ | 773 | */ |
774 | int | 774 | int |
775 | _gnutls_x509_crt_to_gcert (gnutls_cert * gcert, | 775 | mhd_gtls_x509_crt_to_gcert (gnutls_cert * gcert, |
776 | gnutls_x509_crt_t cert, unsigned int flags) | 776 | gnutls_x509_crt_t cert, unsigned int flags) |
777 | { | 777 | { |
778 | int ret = 0; | 778 | int ret = 0; |
@@ -857,7 +857,7 @@ _gnutls_x509_crt_to_gcert (gnutls_cert * gcert, | |||
857 | } | 857 | } |
858 | 858 | ||
859 | void | 859 | void |
860 | _gnutls_gcert_deinit (gnutls_cert * cert) | 860 | mhd_gtls_gcert_deinit (gnutls_cert * cert) |
861 | { | 861 | { |
862 | int i; | 862 | int i; |
863 | 863 | ||
@@ -866,21 +866,21 @@ _gnutls_gcert_deinit (gnutls_cert * cert) | |||
866 | 866 | ||
867 | for (i = 0; i < cert->params_size; i++) | 867 | for (i = 0; i < cert->params_size; i++) |
868 | { | 868 | { |
869 | _gnutls_mpi_release (&cert->params[i]); | 869 | mhd_gtls_mpi_release (&cert->params[i]); |
870 | } | 870 | } |
871 | 871 | ||
872 | _gnutls_free_datum (&cert->raw); | 872 | _gnutls_free_datum (&cert->raw); |
873 | } | 873 | } |
874 | 874 | ||
875 | /** | 875 | /** |
876 | * gnutls_sign_callback_set: | 876 | * MHD_gtls_sign_callback_set: |
877 | * @session: is a gnutls session | 877 | * @session: is a gnutls session |
878 | * @sign_func: function pointer to application's sign callback. | 878 | * @sign_func: function pointer to application's sign callback. |
879 | * @userdata: void pointer that will be passed to sign callback. | 879 | * @userdata: void pointer that will be passed to sign callback. |
880 | * | 880 | * |
881 | * Set the callback function. The function must have this prototype: | 881 | * Set the callback function. The function must have this prototype: |
882 | * | 882 | * |
883 | * typedef int (*gnutls_sign_func) (gnutls_session_t session, | 883 | * typedef int (*gnutls_sign_func) (mhd_gtls_session_t session, |
884 | * void *userdata, | 884 | * void *userdata, |
885 | * gnutls_certificate_type_t cert_type, | 885 | * gnutls_certificate_type_t cert_type, |
886 | * const gnutls_datum_t * cert, | 886 | * const gnutls_datum_t * cert, |
@@ -889,10 +889,10 @@ _gnutls_gcert_deinit (gnutls_cert * cert) | |||
889 | * | 889 | * |
890 | * The @userdata parameter is passed to the @sign_func verbatim, and | 890 | * The @userdata parameter is passed to the @sign_func verbatim, and |
891 | * can be used to store application-specific data needed in the | 891 | * can be used to store application-specific data needed in the |
892 | * callback function. See also gnutls_sign_callback_get(). | 892 | * callback function. See also MHD_gtls_sign_callback_get(). |
893 | **/ | 893 | **/ |
894 | void | 894 | void |
895 | gnutls_sign_callback_set (gnutls_session_t session, | 895 | MHD_gtls_sign_callback_set (mhd_gtls_session_t session, |
896 | gnutls_sign_func sign_func, void *userdata) | 896 | gnutls_sign_func sign_func, void *userdata) |
897 | { | 897 | { |
898 | session->internals.sign_func = sign_func; | 898 | session->internals.sign_func = sign_func; |
@@ -900,17 +900,17 @@ gnutls_sign_callback_set (gnutls_session_t session, | |||
900 | } | 900 | } |
901 | 901 | ||
902 | /** | 902 | /** |
903 | * gnutls_sign_callback_get: | 903 | * MHD_gtls_sign_callback_get: |
904 | * @session: is a gnutls session | 904 | * @session: is a gnutls session |
905 | * @userdata: if non-%NULL, will be set to abstract callback pointer. | 905 | * @userdata: if non-%NULL, will be set to abstract callback pointer. |
906 | * | 906 | * |
907 | * Retrieve the callback function, and its userdata pointer. | 907 | * Retrieve the callback function, and its userdata pointer. |
908 | * | 908 | * |
909 | * Returns: The function pointer set by gnutls_sign_callback_set(), or | 909 | * Returns: The function pointer set by MHD_gtls_sign_callback_set(), or |
910 | * if not set, %NULL. | 910 | * if not set, %NULL. |
911 | **/ | 911 | **/ |
912 | gnutls_sign_func | 912 | gnutls_sign_func |
913 | gnutls_sign_callback_get (gnutls_session_t session, void **userdata) | 913 | MHD_gtls_sign_callback_get (mhd_gtls_session_t session, void **userdata) |
914 | { | 914 | { |
915 | if (userdata) | 915 | if (userdata) |
916 | *userdata = session->internals.sign_func_userdata; | 916 | *userdata = session->internals.sign_func_userdata; |
diff --git a/src/daemon/https/tls/gnutls_cert.h b/src/daemon/https/tls/gnutls_cert.h index 09df10eb..30b23b27 100644 --- a/src/daemon/https/tls/gnutls_cert.h +++ b/src/daemon/https/tls/gnutls_cert.h | |||
@@ -98,7 +98,7 @@ typedef struct gnutls_privkey_int | |||
98 | gnutls_pk_algorithm_t pk_algorithm; | 98 | gnutls_pk_algorithm_t pk_algorithm; |
99 | } gnutls_privkey; | 99 | } gnutls_privkey; |
100 | 100 | ||
101 | struct gnutls_session_int; /* because gnutls_session_t is not defined when this file is included */ | 101 | struct MHD_gtls_session_int; /* because mhd_gtls_session_t is not defined when this file is included */ |
102 | 102 | ||
103 | typedef enum ConvFlags | 103 | typedef enum ConvFlags |
104 | { | 104 | { |
@@ -107,24 +107,24 @@ typedef enum ConvFlags | |||
107 | CERT_ONLY_EXTENSIONS = 16 | 107 | CERT_ONLY_EXTENSIONS = 16 |
108 | } ConvFlags; | 108 | } ConvFlags; |
109 | 109 | ||
110 | int _gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert, | 110 | int mhd_gtls_x509_raw_cert_to_gcert (gnutls_cert * gcert, |
111 | const gnutls_datum_t * derCert, | 111 | const gnutls_datum_t * derCert, |
112 | int flags); | 112 | int flags); |
113 | int _gnutls_x509_crt_to_gcert (gnutls_cert * gcert, gnutls_x509_crt_t cert, | 113 | int mhd_gtls_x509_crt_to_gcert (gnutls_cert * gcert, gnutls_x509_crt_t cert, |
114 | unsigned int flags); | 114 | unsigned int flags); |
115 | 115 | ||
116 | void _gnutls_gkey_deinit (gnutls_privkey * key); | 116 | void mhd_gtls_gkey_deinit (gnutls_privkey * key); |
117 | void _gnutls_gcert_deinit (gnutls_cert * cert); | 117 | void mhd_gtls_gcert_deinit (gnutls_cert * cert); |
118 | 118 | ||
119 | int _gnutls_selected_cert_supported_kx (struct gnutls_session_int *session, | 119 | int mhd_gtls_selected_cert_supported_kx (struct MHD_gtls_session_int *session, |
120 | gnutls_kx_algorithm_t ** alg, | 120 | gnutls_kx_algorithm_t ** alg, |
121 | int *alg_size); | 121 | int *alg_size); |
122 | 122 | ||
123 | int _gnutls_raw_cert_to_gcert (gnutls_cert * gcert, | 123 | int mhd_gtls_raw_cert_to_gcert (gnutls_cert * gcert, |
124 | gnutls_certificate_type_t type, | 124 | gnutls_certificate_type_t type, |
125 | const gnutls_datum_t * raw_cert, | 125 | const gnutls_datum_t * raw_cert, |
126 | int flags /* OR of ConvFlags */ ); | 126 | int flags /* OR of ConvFlags */ ); |
127 | int _gnutls_raw_privkey_to_gkey (gnutls_privkey * key, | 127 | int mhd_gtls_raw_privkey_to_gkey (gnutls_privkey * key, |
128 | gnutls_certificate_type_t type, | 128 | gnutls_certificate_type_t type, |
129 | const gnutls_datum_t * raw_key, | 129 | const gnutls_datum_t * raw_key, |
130 | int key_enc /* DER or PEM */ ); | 130 | int key_enc /* DER or PEM */ ); |
diff --git a/src/daemon/https/tls/gnutls_cipher.c b/src/daemon/https/tls/gnutls_cipher.c index c9526ec6..4dd99f92 100644 --- a/src/daemon/https/tls/gnutls_cipher.c +++ b/src/daemon/https/tls/gnutls_cipher.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <gc.h> | 42 | #include <gc.h> |
43 | 43 | ||
44 | inline static int | 44 | inline static int |
45 | is_write_comp_null (gnutls_session_t session) | 45 | is_write_comp_null (mhd_gtls_session_t session) |
46 | { | 46 | { |
47 | if (session->security_parameters.write_compression_algorithm == | 47 | if (session->security_parameters.write_compression_algorithm == |
48 | MHD_GNUTLS_COMP_NULL) | 48 | MHD_GNUTLS_COMP_NULL) |
@@ -52,7 +52,7 @@ is_write_comp_null (gnutls_session_t session) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | inline static int | 54 | inline static int |
55 | is_read_comp_null (gnutls_session_t session) | 55 | is_read_comp_null (mhd_gtls_session_t session) |
56 | { | 56 | { |
57 | if (session->security_parameters.read_compression_algorithm == | 57 | if (session->security_parameters.read_compression_algorithm == |
58 | MHD_GNUTLS_COMP_NULL) | 58 | MHD_GNUTLS_COMP_NULL) |
@@ -68,7 +68,7 @@ is_read_comp_null (gnutls_session_t session) | |||
68 | * If random pad != 0 then the random pad data will be appended. | 68 | * If random pad != 0 then the random pad data will be appended. |
69 | */ | 69 | */ |
70 | int | 70 | int |
71 | _gnutls_encrypt (gnutls_session_t session, const opaque * headers, | 71 | mhd_gtls_encrypt (mhd_gtls_session_t session, const opaque * headers, |
72 | size_t headers_size, const opaque * data, | 72 | size_t headers_size, const opaque * data, |
73 | size_t data_size, opaque * ciphertext, | 73 | size_t data_size, opaque * ciphertext, |
74 | size_t ciphertext_size, content_type_t type, int random_pad) | 74 | size_t ciphertext_size, content_type_t type, int random_pad) |
@@ -99,7 +99,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * headers, | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | ret = _gnutls_compressed2ciphertext (session, &ciphertext[headers_size], | 102 | ret = mhd_gtls_compressed2ciphertext (session, &ciphertext[headers_size], |
103 | ciphertext_size - headers_size, | 103 | ciphertext_size - headers_size, |
104 | comp, type, random_pad); | 104 | comp, type, random_pad); |
105 | 105 | ||
@@ -115,7 +115,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * headers, | |||
115 | 115 | ||
116 | /* copy the headers */ | 116 | /* copy the headers */ |
117 | memcpy (ciphertext, headers, headers_size); | 117 | memcpy (ciphertext, headers, headers_size); |
118 | _gnutls_write_uint16 (ret, &ciphertext[3]); | 118 | mhd_gtls_write_uint16 (ret, &ciphertext[3]); |
119 | 119 | ||
120 | return ret + headers_size; | 120 | return ret + headers_size; |
121 | } | 121 | } |
@@ -124,7 +124,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * headers, | |||
124 | * Returns the decrypted data length. | 124 | * Returns the decrypted data length. |
125 | */ | 125 | */ |
126 | int | 126 | int |
127 | _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, | 127 | mhd_gtls_decrypt (mhd_gtls_session_t session, opaque * ciphertext, |
128 | size_t ciphertext_size, uint8_t * data, | 128 | size_t ciphertext_size, uint8_t * data, |
129 | size_t max_data_size, content_type_t type) | 129 | size_t max_data_size, content_type_t type) |
130 | { | 130 | { |
@@ -139,7 +139,7 @@ _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, | |||
139 | gcipher.data = ciphertext; | 139 | gcipher.data = ciphertext; |
140 | 140 | ||
141 | ret = | 141 | ret = |
142 | _gnutls_ciphertext2compressed (session, data, max_data_size, | 142 | mhd_gtls_ciphertext2compressed (session, data, max_data_size, |
143 | gcipher, type); | 143 | gcipher, type); |
144 | if (ret < 0) | 144 | if (ret < 0) |
145 | { | 145 | { |
@@ -204,11 +204,11 @@ mac_init (gnutls_mac_algorithm_t mac, opaque * secret, int secret_size, | |||
204 | 204 | ||
205 | if (ver == MHD_GNUTLS_SSL3) | 205 | if (ver == MHD_GNUTLS_SSL3) |
206 | { /* SSL 3.0 */ | 206 | { /* SSL 3.0 */ |
207 | td = _gnutls_mac_init_ssl3 (mac, secret, secret_size); | 207 | td = mhd_gnutls_mac_init_ssl3 (mac, secret, secret_size); |
208 | } | 208 | } |
209 | else | 209 | else |
210 | { /* TLS 1.x */ | 210 | { /* TLS 1.x */ |
211 | td = _gnutls_hmac_init (mac, secret, secret_size); | 211 | td = mhd_gtls_hmac_init (mac, secret, secret_size); |
212 | } | 212 | } |
213 | 213 | ||
214 | return td; | 214 | return td; |
@@ -219,16 +219,16 @@ mac_deinit (mac_hd_t td, opaque * res, int ver) | |||
219 | { | 219 | { |
220 | if (ver == MHD_GNUTLS_SSL3) | 220 | if (ver == MHD_GNUTLS_SSL3) |
221 | { /* SSL 3.0 */ | 221 | { /* SSL 3.0 */ |
222 | _gnutls_mac_deinit_ssl3 (td, res); | 222 | mhd_gnutls_mac_deinit_ssl3 (td, res); |
223 | } | 223 | } |
224 | else | 224 | else |
225 | { | 225 | { |
226 | _gnutls_hmac_deinit (td, res); | 226 | mhd_gnutls_hmac_deinit (td, res); |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | inline static int | 230 | inline static int |
231 | calc_enc_length (gnutls_session_t session, int data_size, | 231 | calc_enc_length (mhd_gtls_session_t session, int data_size, |
232 | int hash_size, uint8_t * pad, int random_pad, | 232 | int hash_size, uint8_t * pad, int random_pad, |
233 | cipher_type_t block_algo, uint16_t blocksize) | 233 | cipher_type_t block_algo, uint16_t blocksize) |
234 | { | 234 | { |
@@ -289,7 +289,7 @@ calc_enc_length (gnutls_session_t session, int data_size, | |||
289 | * return the actual encrypted data length. | 289 | * return the actual encrypted data length. |
290 | */ | 290 | */ |
291 | int | 291 | int |
292 | _gnutls_compressed2ciphertext (gnutls_session_t session, | 292 | mhd_gtls_compressed2ciphertext (mhd_gtls_session_t session, |
293 | opaque * cipher_data, int cipher_size, | 293 | opaque * cipher_data, int cipher_size, |
294 | gnutls_datum_t compressed, | 294 | gnutls_datum_t compressed, |
295 | content_type_t _type, int random_pad) | 295 | content_type_t _type, int random_pad) |
@@ -302,21 +302,21 @@ _gnutls_compressed2ciphertext (gnutls_session_t session, | |||
302 | uint8_t type = _type; | 302 | uint8_t type = _type; |
303 | uint8_t major, minor; | 303 | uint8_t major, minor; |
304 | int hash_size = | 304 | int hash_size = |
305 | _gnutls_hash_get_algo_len (session->security_parameters. | 305 | mhd_gnutls_hash_get_algo_len (session->security_parameters. |
306 | write_mac_algorithm); | 306 | write_mac_algorithm); |
307 | gnutls_protocol_t ver; | 307 | gnutls_protocol_t ver; |
308 | int blocksize = | 308 | int blocksize = |
309 | _gnutls_cipher_get_block_size (session->security_parameters. | 309 | mhd_gtls_cipher_get_block_size (session->security_parameters. |
310 | write_bulk_cipher_algorithm); | 310 | write_bulk_cipher_algorithm); |
311 | cipher_type_t block_algo = | 311 | cipher_type_t block_algo = |
312 | _gnutls_cipher_is_block (session->security_parameters. | 312 | mhd_gtls_cipher_is_block (session->security_parameters. |
313 | write_bulk_cipher_algorithm); | 313 | write_bulk_cipher_algorithm); |
314 | opaque *data_ptr; | 314 | opaque *data_ptr; |
315 | 315 | ||
316 | 316 | ||
317 | ver = gnutls_protocol_get_version (session); | 317 | ver = MHD_gnutls_protocol_get_version (session); |
318 | minor = _gnutls_version_get_minor (ver); | 318 | minor = mhd_gtls_version_get_minor (ver); |
319 | major = _gnutls_version_get_major (ver); | 319 | major = mhd_gtls_version_get_major (ver); |
320 | 320 | ||
321 | 321 | ||
322 | /* Initialize MAC */ | 322 | /* Initialize MAC */ |
@@ -332,22 +332,22 @@ _gnutls_compressed2ciphertext (gnutls_session_t session, | |||
332 | return GNUTLS_E_INTERNAL_ERROR; | 332 | return GNUTLS_E_INTERNAL_ERROR; |
333 | } | 333 | } |
334 | 334 | ||
335 | c_length = _gnutls_conv_uint16 (compressed.size); | 335 | c_length = mhd_gtls_conv_uint16 (compressed.size); |
336 | 336 | ||
337 | if (td != GNUTLS_MAC_FAILED) | 337 | if (td != GNUTLS_MAC_FAILED) |
338 | { /* actually when the algorithm in not the NULL one */ | 338 | { /* actually when the algorithm in not the NULL one */ |
339 | _gnutls_hmac (td, | 339 | mhd_gnutls_hash (td, |
340 | UINT64DATA (session->connection_state. | 340 | UINT64DATA (session->connection_state. |
341 | write_sequence_number), 8); | 341 | write_sequence_number), 8); |
342 | 342 | ||
343 | _gnutls_hmac (td, &type, 1); | 343 | mhd_gnutls_hash (td, &type, 1); |
344 | if (ver >= MHD_GNUTLS_TLS1_0) | 344 | if (ver >= MHD_GNUTLS_TLS1_0) |
345 | { /* TLS 1.0 or higher */ | 345 | { /* TLS 1.0 or higher */ |
346 | _gnutls_hmac (td, &major, 1); | 346 | mhd_gnutls_hash (td, &major, 1); |
347 | _gnutls_hmac (td, &minor, 1); | 347 | mhd_gnutls_hash (td, &minor, 1); |
348 | } | 348 | } |
349 | _gnutls_hmac (td, &c_length, 2); | 349 | mhd_gnutls_hash (td, &c_length, 2); |
350 | _gnutls_hmac (td, compressed.data, compressed.size); | 350 | mhd_gnutls_hash (td, compressed.data, compressed.size); |
351 | mac_deinit (td, MAC, ver); | 351 | mac_deinit (td, MAC, ver); |
352 | } | 352 | } |
353 | 353 | ||
@@ -401,7 +401,7 @@ _gnutls_compressed2ciphertext (gnutls_session_t session, | |||
401 | 401 | ||
402 | /* Actual encryption (inplace). | 402 | /* Actual encryption (inplace). |
403 | */ | 403 | */ |
404 | ret = _gnutls_cipher_encrypt (session->connection_state. | 404 | ret = mhd_gtls_cipher_encrypt (session->connection_state. |
405 | write_cipher_state, cipher_data, length); | 405 | write_cipher_state, cipher_data, length); |
406 | if (ret < 0) | 406 | if (ret < 0) |
407 | { | 407 | { |
@@ -416,7 +416,7 @@ _gnutls_compressed2ciphertext (gnutls_session_t session, | |||
416 | * Returns the actual compressed packet size. | 416 | * Returns the actual compressed packet size. |
417 | */ | 417 | */ |
418 | int | 418 | int |
419 | _gnutls_ciphertext2compressed (gnutls_session_t session, | 419 | mhd_gtls_ciphertext2compressed (mhd_gtls_session_t session, |
420 | opaque * compress_data, | 420 | opaque * compress_data, |
421 | int compress_size, | 421 | int compress_size, |
422 | gnutls_datum_t ciphertext, uint8_t type) | 422 | gnutls_datum_t ciphertext, uint8_t type) |
@@ -431,14 +431,14 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, | |||
431 | uint8_t major, minor; | 431 | uint8_t major, minor; |
432 | gnutls_protocol_t ver; | 432 | gnutls_protocol_t ver; |
433 | int hash_size = | 433 | int hash_size = |
434 | _gnutls_hash_get_algo_len (session->security_parameters. | 434 | mhd_gnutls_hash_get_algo_len (session->security_parameters. |
435 | read_mac_algorithm); | 435 | read_mac_algorithm); |
436 | 436 | ||
437 | ver = gnutls_protocol_get_version (session); | 437 | ver = MHD_gnutls_protocol_get_version (session); |
438 | minor = _gnutls_version_get_minor (ver); | 438 | minor = mhd_gtls_version_get_minor (ver); |
439 | major = _gnutls_version_get_major (ver); | 439 | major = mhd_gtls_version_get_major (ver); |
440 | 440 | ||
441 | blocksize = _gnutls_cipher_get_block_size (session->security_parameters. | 441 | blocksize = mhd_gtls_cipher_get_block_size (session->security_parameters. |
442 | read_bulk_cipher_algorithm); | 442 | read_bulk_cipher_algorithm); |
443 | 443 | ||
444 | /* initialize MAC | 444 | /* initialize MAC |
@@ -458,11 +458,11 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, | |||
458 | 458 | ||
459 | /* actual decryption (inplace) | 459 | /* actual decryption (inplace) |
460 | */ | 460 | */ |
461 | switch (_gnutls_cipher_is_block | 461 | switch (mhd_gtls_cipher_is_block |
462 | (session->security_parameters.read_bulk_cipher_algorithm)) | 462 | (session->security_parameters.read_bulk_cipher_algorithm)) |
463 | { | 463 | { |
464 | case CIPHER_STREAM: | 464 | case CIPHER_STREAM: |
465 | if ((ret = _gnutls_cipher_decrypt (session->connection_state. | 465 | if ((ret = mhd_gtls_cipher_decrypt (session->connection_state. |
466 | read_cipher_state, | 466 | read_cipher_state, |
467 | ciphertext.data, | 467 | ciphertext.data, |
468 | ciphertext.size)) < 0) | 468 | ciphertext.size)) < 0) |
@@ -481,7 +481,7 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, | |||
481 | return GNUTLS_E_DECRYPTION_FAILED; | 481 | return GNUTLS_E_DECRYPTION_FAILED; |
482 | } | 482 | } |
483 | 483 | ||
484 | if ((ret = _gnutls_cipher_decrypt (session->connection_state. | 484 | if ((ret = mhd_gtls_cipher_decrypt (session->connection_state. |
485 | read_cipher_state, | 485 | read_cipher_state, |
486 | ciphertext.data, | 486 | ciphertext.data, |
487 | ciphertext.size)) < 0) | 487 | ciphertext.size)) < 0) |
@@ -534,27 +534,27 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, | |||
534 | 534 | ||
535 | if (length < 0) | 535 | if (length < 0) |
536 | length = 0; | 536 | length = 0; |
537 | c_length = _gnutls_conv_uint16 ((uint16_t) length); | 537 | c_length = mhd_gtls_conv_uint16 ((uint16_t) length); |
538 | 538 | ||
539 | /* Pass the type, version, length and compressed through | 539 | /* Pass the type, version, length and compressed through |
540 | * MAC. | 540 | * MAC. |
541 | */ | 541 | */ |
542 | if (td != GNUTLS_MAC_FAILED) | 542 | if (td != GNUTLS_MAC_FAILED) |
543 | { | 543 | { |
544 | _gnutls_hmac (td, | 544 | mhd_gnutls_hash (td, |
545 | UINT64DATA (session->connection_state. | 545 | UINT64DATA (session->connection_state. |
546 | read_sequence_number), 8); | 546 | read_sequence_number), 8); |
547 | 547 | ||
548 | _gnutls_hmac (td, &type, 1); | 548 | mhd_gnutls_hash (td, &type, 1); |
549 | if (ver >= MHD_GNUTLS_TLS1_0) | 549 | if (ver >= MHD_GNUTLS_TLS1_0) |
550 | { /* TLS 1.x */ | 550 | { /* TLS 1.x */ |
551 | _gnutls_hmac (td, &major, 1); | 551 | mhd_gnutls_hash (td, &major, 1); |
552 | _gnutls_hmac (td, &minor, 1); | 552 | mhd_gnutls_hash (td, &minor, 1); |
553 | } | 553 | } |
554 | _gnutls_hmac (td, &c_length, 2); | 554 | mhd_gnutls_hash (td, &c_length, 2); |
555 | 555 | ||
556 | if (length > 0) | 556 | if (length > 0) |
557 | _gnutls_hmac (td, ciphertext.data, length); | 557 | mhd_gnutls_hash (td, ciphertext.data, length); |
558 | 558 | ||
559 | mac_deinit (td, MAC, ver); | 559 | mac_deinit (td, MAC, ver); |
560 | } | 560 | } |
diff --git a/src/daemon/https/tls/gnutls_cipher.h b/src/daemon/https/tls/gnutls_cipher.h index 0279e859..2bdf5a18 100644 --- a/src/daemon/https/tls/gnutls_cipher.h +++ b/src/daemon/https/tls/gnutls_cipher.h | |||
@@ -22,20 +22,20 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_encrypt (gnutls_session_t session, const opaque * headers, | 25 | int mhd_gtls_encrypt (mhd_gtls_session_t session, const opaque * headers, |
26 | size_t headers_size, const opaque * data, | 26 | size_t headers_size, const opaque * data, |
27 | size_t data_size, opaque * ciphertext, | 27 | size_t data_size, opaque * ciphertext, |
28 | size_t ciphertext_size, content_type_t type, | 28 | size_t ciphertext_size, content_type_t type, |
29 | int random_pad); | 29 | int random_pad); |
30 | 30 | ||
31 | int _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, | 31 | int mhd_gtls_decrypt (mhd_gtls_session_t session, opaque * ciphertext, |
32 | size_t ciphertext_size, uint8_t * data, size_t data_size, | 32 | size_t ciphertext_size, uint8_t * data, size_t data_size, |
33 | content_type_t type); | 33 | content_type_t type); |
34 | int _gnutls_compressed2ciphertext (gnutls_session_t session, | 34 | int mhd_gtls_compressed2ciphertext (mhd_gtls_session_t session, |
35 | opaque * cipher_data, int cipher_size, | 35 | opaque * cipher_data, int cipher_size, |
36 | gnutls_datum_t compressed, | 36 | gnutls_datum_t compressed, |
37 | content_type_t _type, int random_pad); | 37 | content_type_t _type, int random_pad); |
38 | int _gnutls_ciphertext2compressed (gnutls_session_t session, | 38 | int mhd_gtls_ciphertext2compressed (mhd_gtls_session_t session, |
39 | opaque * compress_data, | 39 | opaque * compress_data, |
40 | int compress_size, | 40 | int compress_size, |
41 | gnutls_datum_t ciphertext, uint8_t type); | 41 | gnutls_datum_t ciphertext, uint8_t type); |
diff --git a/src/daemon/https/tls/gnutls_cipher_int.c b/src/daemon/https/tls/gnutls_cipher_int.c index bfe734d5..489e14c7 100644 --- a/src/daemon/https/tls/gnutls_cipher_int.c +++ b/src/daemon/https/tls/gnutls_cipher_int.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <gnutls_datum.h> | 28 | #include <gnutls_datum.h> |
29 | 29 | ||
30 | cipher_hd_t | 30 | cipher_hd_t |
31 | _gnutls_cipher_init (gnutls_cipher_algorithm_t cipher, | 31 | mhd_gtls_cipher_init (gnutls_cipher_algorithm_t cipher, |
32 | const gnutls_datum_t * key, const gnutls_datum_t * iv) | 32 | const gnutls_datum_t * key, const gnutls_datum_t * iv) |
33 | { | 33 | { |
34 | cipher_hd_t ret = NULL; | 34 | cipher_hd_t ret = NULL; |
@@ -95,7 +95,7 @@ _gnutls_cipher_init (gnutls_cipher_algorithm_t cipher, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | int | 97 | int |
98 | _gnutls_cipher_encrypt (cipher_hd_t handle, void *text, int textlen) | 98 | mhd_gtls_cipher_encrypt (cipher_hd_t handle, void *text, int textlen) |
99 | { | 99 | { |
100 | if (handle != GNUTLS_CIPHER_FAILED) | 100 | if (handle != GNUTLS_CIPHER_FAILED) |
101 | { | 101 | { |
@@ -109,7 +109,7 @@ _gnutls_cipher_encrypt (cipher_hd_t handle, void *text, int textlen) | |||
109 | } | 109 | } |
110 | 110 | ||
111 | int | 111 | int |
112 | _gnutls_cipher_decrypt (cipher_hd_t handle, void *ciphertext, | 112 | mhd_gtls_cipher_decrypt (cipher_hd_t handle, void *ciphertext, |
113 | int ciphertextlen) | 113 | int ciphertextlen) |
114 | { | 114 | { |
115 | if (handle != GNUTLS_CIPHER_FAILED) | 115 | if (handle != GNUTLS_CIPHER_FAILED) |
@@ -124,7 +124,7 @@ _gnutls_cipher_decrypt (cipher_hd_t handle, void *ciphertext, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | void | 126 | void |
127 | _gnutls_cipher_deinit (cipher_hd_t handle) | 127 | mhd_gnutls_cipher_deinit (cipher_hd_t handle) |
128 | { | 128 | { |
129 | if (handle != GNUTLS_CIPHER_FAILED) | 129 | if (handle != GNUTLS_CIPHER_FAILED) |
130 | { | 130 | { |
diff --git a/src/daemon/https/tls/gnutls_cipher_int.h b/src/daemon/https/tls/gnutls_cipher_int.h index 78ed487f..03681fc6 100644 --- a/src/daemon/https/tls/gnutls_cipher_int.h +++ b/src/daemon/https/tls/gnutls_cipher_int.h | |||
@@ -29,18 +29,18 @@ | |||
29 | #define GNUTLS_CIPHER_FAILED NULL | 29 | #define GNUTLS_CIPHER_FAILED NULL |
30 | 30 | ||
31 | // TODO gc_cipher_handle -> void * x3 | 31 | // TODO gc_cipher_handle -> void * x3 |
32 | void * _gnutls_cipher_init(gnutls_cipher_algorithm_t cipher, | 32 | void * mhd_gtls_cipher_init(gnutls_cipher_algorithm_t cipher, |
33 | const gnutls_datum_t * key, | 33 | const gnutls_datum_t * key, |
34 | const gnutls_datum_t * iv); | 34 | const gnutls_datum_t * iv); |
35 | 35 | ||
36 | int _gnutls_cipher_encrypt(void * handle, | 36 | int mhd_gtls_cipher_encrypt(void * handle, |
37 | void *text, | 37 | void *text, |
38 | int textlen); | 38 | int textlen); |
39 | 39 | ||
40 | int _gnutls_cipher_decrypt(void * handle, | 40 | int mhd_gtls_cipher_decrypt(void * handle, |
41 | void *ciphertext, | 41 | void *ciphertext, |
42 | int ciphertextlen); | 42 | int ciphertextlen); |
43 | 43 | ||
44 | void _gnutls_cipher_deinit(void * handle); | 44 | void mhd_gnutls_cipher_deinit(void * handle); |
45 | 45 | ||
46 | #endif /* GNUTLS_CIPHER_INT */ | 46 | #endif /* GNUTLS_CIPHER_INT */ |
diff --git a/src/daemon/https/tls/gnutls_compress.c b/src/daemon/https/tls/gnutls_compress.c index e6561ad6..7ee4c2fe 100644 --- a/src/daemon/https/tls/gnutls_compress.c +++ b/src/daemon/https/tls/gnutls_compress.c | |||
@@ -34,7 +34,7 @@ | |||
34 | /* These functions allocate the return value internally | 34 | /* These functions allocate the return value internally |
35 | */ | 35 | */ |
36 | int | 36 | int |
37 | _gnutls_m_plaintext2compressed (gnutls_session_t session, | 37 | _gnutls_m_plaintext2compressed (mhd_gtls_session_t session, |
38 | gnutls_datum_t * compressed, | 38 | gnutls_datum_t * compressed, |
39 | const gnutls_datum_t * plaintext) | 39 | const gnutls_datum_t * plaintext) |
40 | { | 40 | { |
@@ -42,7 +42,7 @@ _gnutls_m_plaintext2compressed (gnutls_session_t session, | |||
42 | opaque *data; | 42 | opaque *data; |
43 | 43 | ||
44 | size = | 44 | size = |
45 | _gnutls_compress (session->connection_state.write_compression_state, | 45 | mhd_gtls_compress (session->connection_state.write_compression_state, |
46 | plaintext->data, plaintext->size, &data, | 46 | plaintext->data, plaintext->size, &data, |
47 | MAX_RECORD_SEND_SIZE + EXTRA_COMP_SIZE); | 47 | MAX_RECORD_SEND_SIZE + EXTRA_COMP_SIZE); |
48 | if (size < 0) | 48 | if (size < 0) |
@@ -57,7 +57,7 @@ _gnutls_m_plaintext2compressed (gnutls_session_t session, | |||
57 | } | 57 | } |
58 | 58 | ||
59 | int | 59 | int |
60 | _gnutls_m_compressed2plaintext (gnutls_session_t session, | 60 | _gnutls_m_compressed2plaintext (mhd_gtls_session_t session, |
61 | gnutls_datum_t * plain, | 61 | gnutls_datum_t * plain, |
62 | const gnutls_datum_t * compressed) | 62 | const gnutls_datum_t * compressed) |
63 | { | 63 | { |
@@ -65,7 +65,7 @@ _gnutls_m_compressed2plaintext (gnutls_session_t session, | |||
65 | opaque *data; | 65 | opaque *data; |
66 | 66 | ||
67 | size = | 67 | size = |
68 | _gnutls_decompress (session->connection_state. | 68 | mhd_gtls_decompress (session->connection_state. |
69 | read_compression_state, compressed->data, | 69 | read_compression_state, compressed->data, |
70 | compressed->size, &data, MAX_RECORD_RECV_SIZE); | 70 | compressed->size, &data, MAX_RECORD_RECV_SIZE); |
71 | if (size < 0) | 71 | if (size < 0) |
diff --git a/src/daemon/https/tls/gnutls_compress.h b/src/daemon/https/tls/gnutls_compress.h index 44666321..2fa07aaa 100644 --- a/src/daemon/https/tls/gnutls_compress.h +++ b/src/daemon/https/tls/gnutls_compress.h | |||
@@ -22,9 +22,9 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_m_plaintext2compressed (gnutls_session_t session, | 25 | int _gnutls_m_plaintext2compressed (mhd_gtls_session_t session, |
26 | gnutls_datum_t * compressed, | 26 | gnutls_datum_t * compressed, |
27 | const gnutls_datum_t *plaintext); | 27 | const gnutls_datum_t *plaintext); |
28 | int _gnutls_m_compressed2plaintext (gnutls_session_t session, | 28 | int _gnutls_m_compressed2plaintext (mhd_gtls_session_t session, |
29 | gnutls_datum_t * plain, | 29 | gnutls_datum_t * plain, |
30 | const gnutls_datum_t* compressed); | 30 | const gnutls_datum_t* compressed); |
diff --git a/src/daemon/https/tls/gnutls_compress_int.c b/src/daemon/https/tls/gnutls_compress_int.c index 77c733b0..f300e297 100644 --- a/src/daemon/https/tls/gnutls_compress_int.c +++ b/src/daemon/https/tls/gnutls_compress_int.c | |||
@@ -31,7 +31,7 @@ | |||
31 | * decompress. | 31 | * decompress. |
32 | */ | 32 | */ |
33 | comp_hd_t | 33 | comp_hd_t |
34 | _gnutls_comp_init (gnutls_compression_method_t method, int d) | 34 | mhd_gtls_comp_init (gnutls_compression_method_t method, int d) |
35 | { | 35 | { |
36 | comp_hd_t ret; | 36 | comp_hd_t ret; |
37 | 37 | ||
@@ -54,9 +54,9 @@ _gnutls_comp_init (gnutls_compression_method_t method, int d) | |||
54 | int comp_level; | 54 | int comp_level; |
55 | z_stream *zhandle; | 55 | z_stream *zhandle; |
56 | 56 | ||
57 | window_bits = _gnutls_compression_get_wbits (method); | 57 | window_bits = mhd_gtls_compression_get_wbits (method); |
58 | mem_level = _gnutls_compression_get_mem_level (method); | 58 | mem_level = mhd_gtls_compression_get_mem_level (method); |
59 | comp_level = _gnutls_compression_get_comp_level (method); | 59 | comp_level = mhd_gtls_compression_get_comp_level (method); |
60 | 60 | ||
61 | ret->handle = gnutls_malloc (sizeof (z_stream)); | 61 | ret->handle = gnutls_malloc (sizeof (z_stream)); |
62 | if (ret->handle == NULL) | 62 | if (ret->handle == NULL) |
@@ -102,7 +102,7 @@ cleanup_ret: | |||
102 | * decompress. | 102 | * decompress. |
103 | */ | 103 | */ |
104 | void | 104 | void |
105 | _gnutls_comp_deinit (comp_hd_t handle, int d) | 105 | mhd_gtls_comp_deinit (comp_hd_t handle, int d) |
106 | { | 106 | { |
107 | if (handle != NULL) | 107 | if (handle != NULL) |
108 | { | 108 | { |
@@ -129,7 +129,7 @@ _gnutls_comp_deinit (comp_hd_t handle, int d) | |||
129 | */ | 129 | */ |
130 | 130 | ||
131 | int | 131 | int |
132 | _gnutls_compress (comp_hd_t handle, const opaque * plain, | 132 | mhd_gtls_compress (comp_hd_t handle, const opaque * plain, |
133 | size_t plain_size, opaque ** compressed, | 133 | size_t plain_size, opaque ** compressed, |
134 | size_t max_comp_size) | 134 | size_t max_comp_size) |
135 | { | 135 | { |
@@ -204,7 +204,7 @@ _gnutls_compress (comp_hd_t handle, const opaque * plain, | |||
204 | 204 | ||
205 | 205 | ||
206 | int | 206 | int |
207 | _gnutls_decompress (comp_hd_t handle, opaque * compressed, | 207 | mhd_gtls_decompress (comp_hd_t handle, opaque * compressed, |
208 | size_t compressed_size, opaque ** plain, | 208 | size_t compressed_size, opaque ** plain, |
209 | size_t max_record_size) | 209 | size_t max_record_size) |
210 | { | 210 | { |
@@ -247,7 +247,7 @@ _gnutls_decompress (comp_hd_t handle, opaque * compressed, | |||
247 | do | 247 | do |
248 | { | 248 | { |
249 | out_size += 512; | 249 | out_size += 512; |
250 | *plain = gnutls_realloc_fast (*plain, out_size); | 250 | *plain = mhd_gtls_realloc_fast (*plain, out_size); |
251 | if (*plain == NULL) | 251 | if (*plain == NULL) |
252 | { | 252 | { |
253 | gnutls_assert (); | 253 | gnutls_assert (); |
diff --git a/src/daemon/https/tls/gnutls_compress_int.h b/src/daemon/https/tls/gnutls_compress_int.h index 4479fb4d..f494b0f7 100644 --- a/src/daemon/https/tls/gnutls_compress_int.h +++ b/src/daemon/https/tls/gnutls_compress_int.h | |||
@@ -37,13 +37,13 @@ typedef struct comp_hd_t_STRUCT | |||
37 | gnutls_compression_method_t algo; | 37 | gnutls_compression_method_t algo; |
38 | } *comp_hd_t; | 38 | } *comp_hd_t; |
39 | 39 | ||
40 | comp_hd_t _gnutls_comp_init (gnutls_compression_method_t, int d); | 40 | comp_hd_t mhd_gtls_comp_init (gnutls_compression_method_t, int d); |
41 | void _gnutls_comp_deinit (comp_hd_t handle, int d); | 41 | void mhd_gtls_comp_deinit (comp_hd_t handle, int d); |
42 | 42 | ||
43 | int _gnutls_decompress (comp_hd_t handle, opaque * compressed, | 43 | int mhd_gtls_decompress (comp_hd_t handle, opaque * compressed, |
44 | size_t compressed_size, opaque ** plain, | 44 | size_t compressed_size, opaque ** plain, |
45 | size_t max_record_size); | 45 | size_t max_record_size); |
46 | int _gnutls_compress (comp_hd_t, const opaque * plain, size_t plain_size, | 46 | int mhd_gtls_compress (comp_hd_t, const opaque * plain, size_t plain_size, |
47 | opaque ** compressed, size_t max_comp_size); | 47 | opaque ** compressed, size_t max_comp_size); |
48 | 48 | ||
49 | #endif | 49 | #endif |
diff --git a/src/daemon/https/tls/gnutls_constate.c b/src/daemon/https/tls/gnutls_constate.c index eff2184f..4e683de7 100644 --- a/src/daemon/https/tls/gnutls_constate.c +++ b/src/daemon/https/tls/gnutls_constate.c | |||
@@ -55,7 +55,7 @@ static const int servwrite_length = sizeof (servwrite) - 1; | |||
55 | * (session->cipher_specs) | 55 | * (session->cipher_specs) |
56 | */ | 56 | */ |
57 | int | 57 | int |
58 | _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | 58 | _gnutls_set_keys (mhd_gtls_session_t session, int hash_size, int IV_size, |
59 | int key_size, int export_flag) | 59 | int key_size, int export_flag) |
60 | { | 60 | { |
61 | 61 | ||
@@ -99,7 +99,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
99 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) | 99 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) |
100 | { /* SSL 3 */ | 100 | { /* SSL 3 */ |
101 | ret = | 101 | ret = |
102 | _gnutls_ssl3_generate_random (session-> | 102 | mhd_gnutls_ssl3_generate_random (session-> |
103 | security_parameters. | 103 | security_parameters. |
104 | master_secret, | 104 | master_secret, |
105 | TLS_MASTER_SIZE, rnd, | 105 | TLS_MASTER_SIZE, rnd, |
@@ -109,7 +109,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
109 | else | 109 | else |
110 | { /* TLS 1.0 */ | 110 | { /* TLS 1.0 */ |
111 | ret = | 111 | ret = |
112 | _gnutls_PRF (session, session->security_parameters.master_secret, | 112 | mhd_gtls_PRF (session, session->security_parameters.master_secret, |
113 | TLS_MASTER_SIZE, keyexp, keyexp_length, | 113 | TLS_MASTER_SIZE, keyexp, keyexp_length, |
114 | rnd, 2 * TLS_RANDOM_SIZE, block_size, key_block); | 114 | rnd, 2 * TLS_RANDOM_SIZE, block_size, key_block); |
115 | } | 115 | } |
@@ -122,7 +122,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
122 | } | 122 | } |
123 | 123 | ||
124 | _gnutls_hard_log ("INT: KEY BLOCK[%d]: %s\n", block_size, | 124 | _gnutls_hard_log ("INT: KEY BLOCK[%d]: %s\n", block_size, |
125 | _gnutls_bin2hex (key_block, block_size, buf, | 125 | mhd_gtls_bin2hex (key_block, block_size, buf, |
126 | sizeof (buf))); | 126 | sizeof (buf))); |
127 | 127 | ||
128 | pos = 0; | 128 | pos = 0; |
@@ -192,7 +192,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
192 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) | 192 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) |
193 | { /* SSL 3 */ | 193 | { /* SSL 3 */ |
194 | ret = | 194 | ret = |
195 | _gnutls_ssl3_hash_md5 (&key_block[pos], | 195 | mhd_gnutls_ssl3_hash_md5 (&key_block[pos], |
196 | key_size, rrnd, | 196 | key_size, rrnd, |
197 | 2 * TLS_RANDOM_SIZE, | 197 | 2 * TLS_RANDOM_SIZE, |
198 | EXPORT_FINAL_KEY_SIZE, | 198 | EXPORT_FINAL_KEY_SIZE, |
@@ -202,7 +202,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
202 | else | 202 | else |
203 | { /* TLS 1.0 */ | 203 | { /* TLS 1.0 */ |
204 | ret = | 204 | ret = |
205 | _gnutls_PRF (session, &key_block[pos], key_size, | 205 | mhd_gtls_PRF (session, &key_block[pos], key_size, |
206 | cliwrite, cliwrite_length, | 206 | cliwrite, cliwrite_length, |
207 | rrnd, | 207 | rrnd, |
208 | 2 * TLS_RANDOM_SIZE, | 208 | 2 * TLS_RANDOM_SIZE, |
@@ -224,7 +224,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
224 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) | 224 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) |
225 | { /* SSL 3 */ | 225 | { /* SSL 3 */ |
226 | ret = | 226 | ret = |
227 | _gnutls_ssl3_hash_md5 (&key_block[pos], key_size, | 227 | mhd_gnutls_ssl3_hash_md5 (&key_block[pos], key_size, |
228 | rnd, 2 * TLS_RANDOM_SIZE, | 228 | rnd, 2 * TLS_RANDOM_SIZE, |
229 | EXPORT_FINAL_KEY_SIZE, | 229 | EXPORT_FINAL_KEY_SIZE, |
230 | server_write_key); | 230 | server_write_key); |
@@ -232,7 +232,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
232 | else | 232 | else |
233 | { /* TLS 1.0 */ | 233 | { /* TLS 1.0 */ |
234 | ret = | 234 | ret = |
235 | _gnutls_PRF (session, &key_block[pos], key_size, | 235 | mhd_gtls_PRF (session, &key_block[pos], key_size, |
236 | servwrite, servwrite_length, | 236 | servwrite, servwrite_length, |
237 | rrnd, 2 * TLS_RANDOM_SIZE, | 237 | rrnd, 2 * TLS_RANDOM_SIZE, |
238 | EXPORT_FINAL_KEY_SIZE, server_write_key); | 238 | EXPORT_FINAL_KEY_SIZE, server_write_key); |
@@ -262,7 +262,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
262 | } | 262 | } |
263 | _gnutls_hard_log ("INT: CLIENT WRITE KEY [%d]: %s\n", | 263 | _gnutls_hard_log ("INT: CLIENT WRITE KEY [%d]: %s\n", |
264 | client_write_key_size, | 264 | client_write_key_size, |
265 | _gnutls_bin2hex (client_write_key, | 265 | mhd_gtls_bin2hex (client_write_key, |
266 | client_write_key_size, buf, | 266 | client_write_key_size, buf, |
267 | sizeof (buf))); | 267 | sizeof (buf))); |
268 | 268 | ||
@@ -278,7 +278,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
278 | 278 | ||
279 | _gnutls_hard_log ("INT: SERVER WRITE KEY [%d]: %s\n", | 279 | _gnutls_hard_log ("INT: SERVER WRITE KEY [%d]: %s\n", |
280 | server_write_key_size, | 280 | server_write_key_size, |
281 | _gnutls_bin2hex (server_write_key, | 281 | mhd_gtls_bin2hex (server_write_key, |
282 | server_write_key_size, buf, | 282 | server_write_key_size, buf, |
283 | sizeof (buf))); | 283 | sizeof (buf))); |
284 | 284 | ||
@@ -325,7 +325,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
325 | 325 | ||
326 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) | 326 | if (session->security_parameters.version == MHD_GNUTLS_SSL3) |
327 | { /* SSL 3 */ | 327 | { /* SSL 3 */ |
328 | ret = _gnutls_ssl3_hash_md5 ("", 0, | 328 | ret = mhd_gnutls_ssl3_hash_md5 ("", 0, |
329 | rrnd, TLS_RANDOM_SIZE * 2, | 329 | rrnd, TLS_RANDOM_SIZE * 2, |
330 | IV_size, iv_block); | 330 | IV_size, iv_block); |
331 | 331 | ||
@@ -337,14 +337,14 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
337 | return ret; | 337 | return ret; |
338 | } | 338 | } |
339 | 339 | ||
340 | ret = _gnutls_ssl3_hash_md5 ("", 0, rnd, | 340 | ret = mhd_gnutls_ssl3_hash_md5 ("", 0, rnd, |
341 | TLS_RANDOM_SIZE * 2, | 341 | TLS_RANDOM_SIZE * 2, |
342 | IV_size, &iv_block[IV_size]); | 342 | IV_size, &iv_block[IV_size]); |
343 | 343 | ||
344 | } | 344 | } |
345 | else | 345 | else |
346 | { /* TLS 1.0 */ | 346 | { /* TLS 1.0 */ |
347 | ret = _gnutls_PRF (session, "", 0, | 347 | ret = mhd_gtls_PRF (session, "", 0, |
348 | ivblock, ivblock_length, rrnd, | 348 | ivblock, ivblock_length, rrnd, |
349 | 2 * TLS_RANDOM_SIZE, IV_size * 2, iv_block); | 349 | 2 * TLS_RANDOM_SIZE, IV_size * 2, iv_block); |
350 | } | 350 | } |
@@ -385,7 +385,7 @@ _gnutls_set_keys (gnutls_session_t session, int hash_size, int IV_size, | |||
385 | } | 385 | } |
386 | 386 | ||
387 | int | 387 | int |
388 | _gnutls_set_read_keys (gnutls_session_t session) | 388 | _gnutls_set_read_keys (mhd_gtls_session_t session) |
389 | { | 389 | { |
390 | int hash_size; | 390 | int hash_size; |
391 | int IV_size; | 391 | int IV_size; |
@@ -396,17 +396,17 @@ _gnutls_set_read_keys (gnutls_session_t session) | |||
396 | mac_algo = session->security_parameters.read_mac_algorithm; | 396 | mac_algo = session->security_parameters.read_mac_algorithm; |
397 | algo = session->security_parameters.read_bulk_cipher_algorithm; | 397 | algo = session->security_parameters.read_bulk_cipher_algorithm; |
398 | 398 | ||
399 | hash_size = _gnutls_hash_get_algo_len (mac_algo); | 399 | hash_size = mhd_gnutls_hash_get_algo_len (mac_algo); |
400 | IV_size = _gnutls_cipher_get_iv_size (algo); | 400 | IV_size = mhd_gtls_cipher_get_iv_size (algo); |
401 | key_size = gnutls_cipher_get_key_size (algo); | 401 | key_size = MHD_gnutls_cipher_get_key_size (algo); |
402 | export_flag = _gnutls_cipher_get_export_flag (algo); | 402 | export_flag = mhd_gtls_cipher_get_export_flag (algo); |
403 | 403 | ||
404 | return _gnutls_set_keys (session, hash_size, IV_size, key_size, | 404 | return _gnutls_set_keys (session, hash_size, IV_size, key_size, |
405 | export_flag); | 405 | export_flag); |
406 | } | 406 | } |
407 | 407 | ||
408 | int | 408 | int |
409 | _gnutls_set_write_keys (gnutls_session_t session) | 409 | _gnutls_set_write_keys (mhd_gtls_session_t session) |
410 | { | 410 | { |
411 | int hash_size; | 411 | int hash_size; |
412 | int IV_size; | 412 | int IV_size; |
@@ -417,10 +417,10 @@ _gnutls_set_write_keys (gnutls_session_t session) | |||
417 | mac_algo = session->security_parameters.write_mac_algorithm; | 417 | mac_algo = session->security_parameters.write_mac_algorithm; |
418 | algo = session->security_parameters.write_bulk_cipher_algorithm; | 418 | algo = session->security_parameters.write_bulk_cipher_algorithm; |
419 | 419 | ||
420 | hash_size = _gnutls_hash_get_algo_len (mac_algo); | 420 | hash_size = mhd_gnutls_hash_get_algo_len (mac_algo); |
421 | IV_size = _gnutls_cipher_get_iv_size (algo); | 421 | IV_size = mhd_gtls_cipher_get_iv_size (algo); |
422 | key_size = gnutls_cipher_get_key_size (algo); | 422 | key_size = MHD_gnutls_cipher_get_key_size (algo); |
423 | export_flag = _gnutls_cipher_get_export_flag (algo); | 423 | export_flag = mhd_gtls_cipher_get_export_flag (algo); |
424 | 424 | ||
425 | return _gnutls_set_keys (session, hash_size, IV_size, key_size, | 425 | return _gnutls_set_keys (session, hash_size, IV_size, key_size, |
426 | export_flag); | 426 | export_flag); |
@@ -439,12 +439,12 @@ _gnutls_set_write_keys (gnutls_session_t session) | |||
439 | dst->max_record_recv_size = src->max_record_recv_size; \ | 439 | dst->max_record_recv_size = src->max_record_recv_size; \ |
440 | dst->max_record_send_size = src->max_record_send_size; \ | 440 | dst->max_record_send_size = src->max_record_send_size; \ |
441 | dst->version = src->version; \ | 441 | dst->version = src->version; \ |
442 | memcpy( &dst->extensions, &src->extensions, sizeof(tls_ext_st)); \ | 442 | memcpy( &dst->extensions, &src->extensions, sizeof(mhd_gtls_ext_st)); \ |
443 | memcpy( &dst->inner_secret, &src->inner_secret, TLS_MASTER_SIZE); | 443 | memcpy( &dst->inner_secret, &src->inner_secret, TLS_MASTER_SIZE); |
444 | 444 | ||
445 | static void | 445 | static void |
446 | _gnutls_cpy_read_security_parameters (security_parameters_st * | 446 | _gnutls_cpy_read_security_parameters (mhd_gtls_security_param_st * |
447 | dst, security_parameters_st * src) | 447 | dst, mhd_gtls_security_param_st * src) |
448 | { | 448 | { |
449 | CPY_COMMON; | 449 | CPY_COMMON; |
450 | 450 | ||
@@ -454,8 +454,8 @@ _gnutls_cpy_read_security_parameters (security_parameters_st * | |||
454 | } | 454 | } |
455 | 455 | ||
456 | static void | 456 | static void |
457 | _gnutls_cpy_write_security_parameters (security_parameters_st * | 457 | _gnutls_cpy_write_security_parameters (mhd_gtls_security_param_st * |
458 | dst, security_parameters_st * src) | 458 | dst, mhd_gtls_security_param_st * src) |
459 | { | 459 | { |
460 | CPY_COMMON; | 460 | CPY_COMMON; |
461 | 461 | ||
@@ -471,13 +471,13 @@ _gnutls_cpy_write_security_parameters (security_parameters_st * | |||
471 | * This is to be called after sending the Change Cipher Spec packet. | 471 | * This is to be called after sending the Change Cipher Spec packet. |
472 | */ | 472 | */ |
473 | int | 473 | int |
474 | _gnutls_connection_state_init (gnutls_session_t session) | 474 | mhd_gtls_connection_state_init (mhd_gtls_session_t session) |
475 | { | 475 | { |
476 | int ret; | 476 | int ret; |
477 | 477 | ||
478 | /* Setup the master secret | 478 | /* Setup the master secret |
479 | */ | 479 | */ |
480 | if ((ret = _gnutls_generate_master (session, 0), 0) < 0) | 480 | if ((ret = mhd_gtls_generate_master (session, 0), 0) < 0) |
481 | { | 481 | { |
482 | gnutls_assert (); | 482 | gnutls_assert (); |
483 | return ret; | 483 | return ret; |
@@ -492,7 +492,7 @@ _gnutls_connection_state_init (gnutls_session_t session) | |||
492 | * (read encrypted data) | 492 | * (read encrypted data) |
493 | */ | 493 | */ |
494 | int | 494 | int |
495 | _gnutls_read_connection_state_init (gnutls_session_t session) | 495 | mhd_gtls_read_connection_state_init (mhd_gtls_session_t session) |
496 | { | 496 | { |
497 | int mac_size; | 497 | int mac_size; |
498 | int rc; | 498 | int rc; |
@@ -504,27 +504,27 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
504 | */ | 504 | */ |
505 | if (session->internals.resumed == RESUME_FALSE) | 505 | if (session->internals.resumed == RESUME_FALSE) |
506 | { | 506 | { |
507 | rc = _gnutls_set_read_cipher (session, | 507 | rc = mhd_gtls_set_read_cipher (session, |
508 | _gnutls_cipher_suite_get_cipher_algo | 508 | mhd_gtls_cipher_suite_get_cipher_algo |
509 | (&session->security_parameters. | 509 | (&session->security_parameters. |
510 | current_cipher_suite)); | 510 | current_cipher_suite)); |
511 | if (rc < 0) | 511 | if (rc < 0) |
512 | return rc; | 512 | return rc; |
513 | rc = _gnutls_set_read_mac (session, | 513 | rc = mhd_gtls_set_read_mac (session, |
514 | _gnutls_cipher_suite_get_mac_algo | 514 | mhd_gtls_cipher_suite_get_mac_algo |
515 | (&session->security_parameters. | 515 | (&session->security_parameters. |
516 | current_cipher_suite)); | 516 | current_cipher_suite)); |
517 | if (rc < 0) | 517 | if (rc < 0) |
518 | return rc; | 518 | return rc; |
519 | 519 | ||
520 | rc = _gnutls_set_kx (session, | 520 | rc = mhd_gtls_set_kx (session, |
521 | _gnutls_cipher_suite_get_kx_algo | 521 | mhd_gtls_cipher_suite_get_kx_algo |
522 | (&session->security_parameters. | 522 | (&session->security_parameters. |
523 | current_cipher_suite)); | 523 | current_cipher_suite)); |
524 | if (rc < 0) | 524 | if (rc < 0) |
525 | return rc; | 525 | return rc; |
526 | 526 | ||
527 | rc = _gnutls_set_read_compression (session, | 527 | rc = mhd_gtls_set_read_compression (session, |
528 | session->internals. | 528 | session->internals. |
529 | compression_method); | 529 | compression_method); |
530 | if (rc < 0) | 530 | if (rc < 0) |
@@ -545,18 +545,18 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
545 | return rc; | 545 | return rc; |
546 | 546 | ||
547 | _gnutls_handshake_log ("HSK[%x]: Cipher Suite: %s\n", | 547 | _gnutls_handshake_log ("HSK[%x]: Cipher Suite: %s\n", |
548 | session, _gnutls_cipher_suite_get_name (&session-> | 548 | session, mhd_gtls_cipher_suite_get_name (&session-> |
549 | security_parameters. | 549 | security_parameters. |
550 | current_cipher_suite)); | 550 | current_cipher_suite)); |
551 | 551 | ||
552 | if (_gnutls_compression_is_ok | 552 | if (mhd_gtls_compression_is_ok |
553 | (session->security_parameters.read_compression_algorithm) != 0) | 553 | (session->security_parameters.read_compression_algorithm) != 0) |
554 | { | 554 | { |
555 | gnutls_assert (); | 555 | gnutls_assert (); |
556 | return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM; | 556 | return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM; |
557 | } | 557 | } |
558 | 558 | ||
559 | if (_gnutls_mac_is_ok | 559 | if (mhd_gnutls_mac_is_ok |
560 | (session->security_parameters.read_mac_algorithm) != 0) | 560 | (session->security_parameters.read_mac_algorithm) != 0) |
561 | { | 561 | { |
562 | gnutls_assert (); | 562 | gnutls_assert (); |
@@ -569,14 +569,14 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
569 | _gnutls_free_datum (&session->connection_state.read_mac_secret); | 569 | _gnutls_free_datum (&session->connection_state.read_mac_secret); |
570 | 570 | ||
571 | if (session->connection_state.read_cipher_state != NULL) | 571 | if (session->connection_state.read_cipher_state != NULL) |
572 | _gnutls_cipher_deinit (session->connection_state.read_cipher_state); | 572 | mhd_gnutls_cipher_deinit (session->connection_state.read_cipher_state); |
573 | 573 | ||
574 | if (session->connection_state.read_compression_state != NULL) | 574 | if (session->connection_state.read_compression_state != NULL) |
575 | _gnutls_comp_deinit (session->connection_state.read_compression_state, 1); | 575 | mhd_gtls_comp_deinit (session->connection_state.read_compression_state, 1); |
576 | 576 | ||
577 | 577 | ||
578 | mac_size = | 578 | mac_size = |
579 | _gnutls_hash_get_algo_len (session->security_parameters. | 579 | mhd_gnutls_hash_get_algo_len (session->security_parameters. |
580 | read_mac_algorithm); | 580 | read_mac_algorithm); |
581 | 581 | ||
582 | _gnutls_handshake_log | 582 | _gnutls_handshake_log |
@@ -588,7 +588,7 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
588 | /* initialize cipher session | 588 | /* initialize cipher session |
589 | */ | 589 | */ |
590 | session->connection_state.read_cipher_state = | 590 | session->connection_state.read_cipher_state = |
591 | _gnutls_cipher_init (session->security_parameters. | 591 | mhd_gtls_cipher_init (session->security_parameters. |
592 | read_bulk_cipher_algorithm, | 592 | read_bulk_cipher_algorithm, |
593 | &session->cipher_specs. | 593 | &session->cipher_specs. |
594 | client_write_key, | 594 | client_write_key, |
@@ -624,7 +624,7 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
624 | 624 | ||
625 | case GNUTLS_CLIENT: | 625 | case GNUTLS_CLIENT: |
626 | session->connection_state.read_cipher_state = | 626 | session->connection_state.read_cipher_state = |
627 | _gnutls_cipher_init (session->security_parameters. | 627 | mhd_gtls_cipher_init (session->security_parameters. |
628 | read_bulk_cipher_algorithm, | 628 | read_bulk_cipher_algorithm, |
629 | &session->cipher_specs. | 629 | &session->cipher_specs. |
630 | server_write_key, | 630 | server_write_key, |
@@ -664,7 +664,7 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
664 | } | 664 | } |
665 | 665 | ||
666 | session->connection_state.read_compression_state = | 666 | session->connection_state.read_compression_state = |
667 | _gnutls_comp_init (session->security_parameters. | 667 | mhd_gtls_comp_init (session->security_parameters. |
668 | read_compression_algorithm, 1); | 668 | read_compression_algorithm, 1); |
669 | 669 | ||
670 | if (session->connection_state.read_compression_state == GNUTLS_COMP_FAILED) | 670 | if (session->connection_state.read_compression_state == GNUTLS_COMP_FAILED) |
@@ -682,7 +682,7 @@ _gnutls_read_connection_state_init (gnutls_session_t session) | |||
682 | * (write encrypted data) | 682 | * (write encrypted data) |
683 | */ | 683 | */ |
684 | int | 684 | int |
685 | _gnutls_write_connection_state_init (gnutls_session_t session) | 685 | mhd_gtls_write_connection_state_init (mhd_gtls_session_t session) |
686 | { | 686 | { |
687 | int mac_size; | 687 | int mac_size; |
688 | int rc; | 688 | int rc; |
@@ -694,27 +694,27 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
694 | */ | 694 | */ |
695 | if (session->internals.resumed == RESUME_FALSE) | 695 | if (session->internals.resumed == RESUME_FALSE) |
696 | { | 696 | { |
697 | rc = _gnutls_set_write_cipher (session, | 697 | rc = mhd_gtls_set_write_cipher (session, |
698 | _gnutls_cipher_suite_get_cipher_algo | 698 | mhd_gtls_cipher_suite_get_cipher_algo |
699 | (&session->security_parameters. | 699 | (&session->security_parameters. |
700 | current_cipher_suite)); | 700 | current_cipher_suite)); |
701 | if (rc < 0) | 701 | if (rc < 0) |
702 | return rc; | 702 | return rc; |
703 | rc = _gnutls_set_write_mac (session, | 703 | rc = mhd_gtls_set_write_mac (session, |
704 | _gnutls_cipher_suite_get_mac_algo | 704 | mhd_gtls_cipher_suite_get_mac_algo |
705 | (&session->security_parameters. | 705 | (&session->security_parameters. |
706 | current_cipher_suite)); | 706 | current_cipher_suite)); |
707 | if (rc < 0) | 707 | if (rc < 0) |
708 | return rc; | 708 | return rc; |
709 | 709 | ||
710 | rc = _gnutls_set_kx (session, | 710 | rc = mhd_gtls_set_kx (session, |
711 | _gnutls_cipher_suite_get_kx_algo | 711 | mhd_gtls_cipher_suite_get_kx_algo |
712 | (&session->security_parameters. | 712 | (&session->security_parameters. |
713 | current_cipher_suite)); | 713 | current_cipher_suite)); |
714 | if (rc < 0) | 714 | if (rc < 0) |
715 | return rc; | 715 | return rc; |
716 | 716 | ||
717 | rc = _gnutls_set_write_compression (session, | 717 | rc = mhd_gtls_set_write_compression (session, |
718 | session->internals. | 718 | session->internals. |
719 | compression_method); | 719 | compression_method); |
720 | if (rc < 0) | 720 | if (rc < 0) |
@@ -734,18 +734,18 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
734 | return rc; | 734 | return rc; |
735 | 735 | ||
736 | _gnutls_handshake_log ("HSK[%x]: Cipher Suite: %s\n", session, | 736 | _gnutls_handshake_log ("HSK[%x]: Cipher Suite: %s\n", session, |
737 | _gnutls_cipher_suite_get_name (&session-> | 737 | mhd_gtls_cipher_suite_get_name (&session-> |
738 | security_parameters. | 738 | security_parameters. |
739 | current_cipher_suite)); | 739 | current_cipher_suite)); |
740 | 740 | ||
741 | if (_gnutls_compression_is_ok | 741 | if (mhd_gtls_compression_is_ok |
742 | (session->security_parameters.write_compression_algorithm) != 0) | 742 | (session->security_parameters.write_compression_algorithm) != 0) |
743 | { | 743 | { |
744 | gnutls_assert (); | 744 | gnutls_assert (); |
745 | return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM; | 745 | return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM; |
746 | } | 746 | } |
747 | 747 | ||
748 | if (_gnutls_mac_is_ok | 748 | if (mhd_gnutls_mac_is_ok |
749 | (session->security_parameters.write_mac_algorithm) != 0) | 749 | (session->security_parameters.write_mac_algorithm) != 0) |
750 | { | 750 | { |
751 | gnutls_assert (); | 751 | gnutls_assert (); |
@@ -760,14 +760,14 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
760 | _gnutls_free_datum (&session->connection_state.write_mac_secret); | 760 | _gnutls_free_datum (&session->connection_state.write_mac_secret); |
761 | 761 | ||
762 | if (session->connection_state.write_cipher_state != NULL) | 762 | if (session->connection_state.write_cipher_state != NULL) |
763 | _gnutls_cipher_deinit (session->connection_state.write_cipher_state); | 763 | mhd_gnutls_cipher_deinit (session->connection_state.write_cipher_state); |
764 | 764 | ||
765 | if (session->connection_state.write_compression_state != NULL) | 765 | if (session->connection_state.write_compression_state != NULL) |
766 | _gnutls_comp_deinit (session->connection_state. | 766 | mhd_gtls_comp_deinit (session->connection_state. |
767 | write_compression_state, 0); | 767 | write_compression_state, 0); |
768 | 768 | ||
769 | mac_size = | 769 | mac_size = |
770 | _gnutls_hash_get_algo_len (session->security_parameters. | 770 | mhd_gnutls_hash_get_algo_len (session->security_parameters. |
771 | write_mac_algorithm); | 771 | write_mac_algorithm); |
772 | 772 | ||
773 | _gnutls_handshake_log | 773 | _gnutls_handshake_log |
@@ -779,7 +779,7 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
779 | /* initialize cipher session | 779 | /* initialize cipher session |
780 | */ | 780 | */ |
781 | session->connection_state.write_cipher_state = | 781 | session->connection_state.write_cipher_state = |
782 | _gnutls_cipher_init (session->security_parameters. | 782 | mhd_gtls_cipher_init (session->security_parameters. |
783 | write_bulk_cipher_algorithm, | 783 | write_bulk_cipher_algorithm, |
784 | &session->cipher_specs. | 784 | &session->cipher_specs. |
785 | server_write_key, | 785 | server_write_key, |
@@ -818,7 +818,7 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
818 | 818 | ||
819 | case GNUTLS_CLIENT: | 819 | case GNUTLS_CLIENT: |
820 | session->connection_state.write_cipher_state = | 820 | session->connection_state.write_cipher_state = |
821 | _gnutls_cipher_init (session->security_parameters. | 821 | mhd_gtls_cipher_init (session->security_parameters. |
822 | write_bulk_cipher_algorithm, | 822 | write_bulk_cipher_algorithm, |
823 | &session->cipher_specs. | 823 | &session->cipher_specs. |
824 | client_write_key, | 824 | client_write_key, |
@@ -858,7 +858,7 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
858 | 858 | ||
859 | 859 | ||
860 | session->connection_state.write_compression_state = | 860 | session->connection_state.write_compression_state = |
861 | _gnutls_comp_init (session->security_parameters. | 861 | mhd_gtls_comp_init (session->security_parameters. |
862 | write_compression_algorithm, 0); | 862 | write_compression_algorithm, 0); |
863 | 863 | ||
864 | if (session->connection_state.write_compression_state == GNUTLS_COMP_FAILED) | 864 | if (session->connection_state.write_compression_state == GNUTLS_COMP_FAILED) |
@@ -873,13 +873,13 @@ _gnutls_write_connection_state_init (gnutls_session_t session) | |||
873 | /* Sets the specified cipher into the pending session | 873 | /* Sets the specified cipher into the pending session |
874 | */ | 874 | */ |
875 | int | 875 | int |
876 | _gnutls_set_read_cipher (gnutls_session_t session, | 876 | mhd_gtls_set_read_cipher (mhd_gtls_session_t session, |
877 | gnutls_cipher_algorithm_t algo) | 877 | gnutls_cipher_algorithm_t algo) |
878 | { | 878 | { |
879 | 879 | ||
880 | if (_gnutls_cipher_is_ok (algo) == 0) | 880 | if (mhd_gtls_cipher_is_ok (algo) == 0) |
881 | { | 881 | { |
882 | if (_gnutls_cipher_priority (session, algo) < 0) | 882 | if (mhd_gtls_cipher_priority (session, algo) < 0) |
883 | { | 883 | { |
884 | gnutls_assert (); | 884 | gnutls_assert (); |
885 | return GNUTLS_E_UNWANTED_ALGORITHM; | 885 | return GNUTLS_E_UNWANTED_ALGORITHM; |
@@ -899,13 +899,13 @@ _gnutls_set_read_cipher (gnutls_session_t session, | |||
899 | } | 899 | } |
900 | 900 | ||
901 | int | 901 | int |
902 | _gnutls_set_write_cipher (gnutls_session_t session, | 902 | mhd_gtls_set_write_cipher (mhd_gtls_session_t session, |
903 | gnutls_cipher_algorithm_t algo) | 903 | gnutls_cipher_algorithm_t algo) |
904 | { | 904 | { |
905 | 905 | ||
906 | if (_gnutls_cipher_is_ok (algo) == 0) | 906 | if (mhd_gtls_cipher_is_ok (algo) == 0) |
907 | { | 907 | { |
908 | if (_gnutls_cipher_priority (session, algo) < 0) | 908 | if (mhd_gtls_cipher_priority (session, algo) < 0) |
909 | { | 909 | { |
910 | gnutls_assert (); | 910 | gnutls_assert (); |
911 | return GNUTLS_E_UNWANTED_ALGORITHM; | 911 | return GNUTLS_E_UNWANTED_ALGORITHM; |
@@ -928,11 +928,11 @@ _gnutls_set_write_cipher (gnutls_session_t session, | |||
928 | /* Sets the specified algorithm into pending compression session | 928 | /* Sets the specified algorithm into pending compression session |
929 | */ | 929 | */ |
930 | int | 930 | int |
931 | _gnutls_set_read_compression (gnutls_session_t session, | 931 | mhd_gtls_set_read_compression (mhd_gtls_session_t session, |
932 | gnutls_compression_method_t algo) | 932 | gnutls_compression_method_t algo) |
933 | { | 933 | { |
934 | 934 | ||
935 | if (_gnutls_compression_is_ok (algo) == 0) | 935 | if (mhd_gtls_compression_is_ok (algo) == 0) |
936 | { | 936 | { |
937 | session->security_parameters.read_compression_algorithm = algo; | 937 | session->security_parameters.read_compression_algorithm = algo; |
938 | } | 938 | } |
@@ -946,11 +946,11 @@ _gnutls_set_read_compression (gnutls_session_t session, | |||
946 | } | 946 | } |
947 | 947 | ||
948 | int | 948 | int |
949 | _gnutls_set_write_compression (gnutls_session_t session, | 949 | mhd_gtls_set_write_compression (mhd_gtls_session_t session, |
950 | gnutls_compression_method_t algo) | 950 | gnutls_compression_method_t algo) |
951 | { | 951 | { |
952 | 952 | ||
953 | if (_gnutls_compression_is_ok (algo) == 0) | 953 | if (mhd_gtls_compression_is_ok (algo) == 0) |
954 | { | 954 | { |
955 | session->security_parameters.write_compression_algorithm = algo; | 955 | session->security_parameters.write_compression_algorithm = algo; |
956 | } | 956 | } |
@@ -966,10 +966,10 @@ _gnutls_set_write_compression (gnutls_session_t session, | |||
966 | /* Sets the specified kx algorithm into pending session | 966 | /* Sets the specified kx algorithm into pending session |
967 | */ | 967 | */ |
968 | int | 968 | int |
969 | _gnutls_set_kx (gnutls_session_t session, gnutls_kx_algorithm_t algo) | 969 | mhd_gtls_set_kx (mhd_gtls_session_t session, gnutls_kx_algorithm_t algo) |
970 | { | 970 | { |
971 | 971 | ||
972 | if (_gnutls_kx_is_ok (algo) == 0) | 972 | if (mhd_gtls_kx_is_ok (algo) == 0) |
973 | { | 973 | { |
974 | session->security_parameters.kx_algorithm = algo; | 974 | session->security_parameters.kx_algorithm = algo; |
975 | } | 975 | } |
@@ -978,7 +978,7 @@ _gnutls_set_kx (gnutls_session_t session, gnutls_kx_algorithm_t algo) | |||
978 | gnutls_assert (); | 978 | gnutls_assert (); |
979 | return GNUTLS_E_INTERNAL_ERROR; | 979 | return GNUTLS_E_INTERNAL_ERROR; |
980 | } | 980 | } |
981 | if (_gnutls_kx_priority (session, algo) < 0) | 981 | if (mhd_gtls_kx_priority (session, algo) < 0) |
982 | { | 982 | { |
983 | gnutls_assert (); | 983 | gnutls_assert (); |
984 | /* we shouldn't get here */ | 984 | /* we shouldn't get here */ |
@@ -991,10 +991,10 @@ _gnutls_set_kx (gnutls_session_t session, gnutls_kx_algorithm_t algo) | |||
991 | 991 | ||
992 | /* Sets the specified mac algorithm into pending session */ | 992 | /* Sets the specified mac algorithm into pending session */ |
993 | int | 993 | int |
994 | _gnutls_set_read_mac (gnutls_session_t session, gnutls_mac_algorithm_t algo) | 994 | mhd_gtls_set_read_mac (mhd_gtls_session_t session, gnutls_mac_algorithm_t algo) |
995 | { | 995 | { |
996 | 996 | ||
997 | if (_gnutls_mac_is_ok (algo) == 0) | 997 | if (mhd_gnutls_mac_is_ok (algo) == 0) |
998 | { | 998 | { |
999 | session->security_parameters.read_mac_algorithm = algo; | 999 | session->security_parameters.read_mac_algorithm = algo; |
1000 | } | 1000 | } |
@@ -1003,7 +1003,7 @@ _gnutls_set_read_mac (gnutls_session_t session, gnutls_mac_algorithm_t algo) | |||
1003 | gnutls_assert (); | 1003 | gnutls_assert (); |
1004 | return GNUTLS_E_INTERNAL_ERROR; | 1004 | return GNUTLS_E_INTERNAL_ERROR; |
1005 | } | 1005 | } |
1006 | if (_gnutls_mac_priority (session, algo) < 0) | 1006 | if (mhd_gtls_mac_priority (session, algo) < 0) |
1007 | { | 1007 | { |
1008 | gnutls_assert (); | 1008 | gnutls_assert (); |
1009 | return GNUTLS_E_UNWANTED_ALGORITHM; | 1009 | return GNUTLS_E_UNWANTED_ALGORITHM; |
@@ -1015,10 +1015,10 @@ _gnutls_set_read_mac (gnutls_session_t session, gnutls_mac_algorithm_t algo) | |||
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | int | 1017 | int |
1018 | _gnutls_set_write_mac (gnutls_session_t session, gnutls_mac_algorithm_t algo) | 1018 | mhd_gtls_set_write_mac (mhd_gtls_session_t session, gnutls_mac_algorithm_t algo) |
1019 | { | 1019 | { |
1020 | 1020 | ||
1021 | if (_gnutls_mac_is_ok (algo) == 0) | 1021 | if (mhd_gnutls_mac_is_ok (algo) == 0) |
1022 | { | 1022 | { |
1023 | session->security_parameters.write_mac_algorithm = algo; | 1023 | session->security_parameters.write_mac_algorithm = algo; |
1024 | } | 1024 | } |
@@ -1027,7 +1027,7 @@ _gnutls_set_write_mac (gnutls_session_t session, gnutls_mac_algorithm_t algo) | |||
1027 | gnutls_assert (); | 1027 | gnutls_assert (); |
1028 | return GNUTLS_E_INTERNAL_ERROR; | 1028 | return GNUTLS_E_INTERNAL_ERROR; |
1029 | } | 1029 | } |
1030 | if (_gnutls_mac_priority (session, algo) < 0) | 1030 | if (mhd_gtls_mac_priority (session, algo) < 0) |
1031 | { | 1031 | { |
1032 | gnutls_assert (); | 1032 | gnutls_assert (); |
1033 | return GNUTLS_E_UNWANTED_ALGORITHM; | 1033 | return GNUTLS_E_UNWANTED_ALGORITHM; |
diff --git a/src/daemon/https/tls/gnutls_constate.h b/src/daemon/https/tls/gnutls_constate.h index f58c8b14..b9948587 100644 --- a/src/daemon/https/tls/gnutls_constate.h +++ b/src/daemon/https/tls/gnutls_constate.h | |||
@@ -22,19 +22,19 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_connection_state_init (gnutls_session_t session); | 25 | int mhd_gtls_connection_state_init (mhd_gtls_session_t session); |
26 | int _gnutls_read_connection_state_init (gnutls_session_t session); | 26 | int mhd_gtls_read_connection_state_init (mhd_gtls_session_t session); |
27 | int _gnutls_write_connection_state_init (gnutls_session_t session); | 27 | int mhd_gtls_write_connection_state_init (mhd_gtls_session_t session); |
28 | int _gnutls_set_write_cipher (gnutls_session_t session, | 28 | int mhd_gtls_set_write_cipher (mhd_gtls_session_t session, |
29 | gnutls_cipher_algorithm_t algo); | 29 | gnutls_cipher_algorithm_t algo); |
30 | int _gnutls_set_write_mac (gnutls_session_t session, | 30 | int mhd_gtls_set_write_mac (mhd_gtls_session_t session, |
31 | gnutls_mac_algorithm_t algo); | 31 | gnutls_mac_algorithm_t algo); |
32 | int _gnutls_set_read_cipher (gnutls_session_t session, | 32 | int mhd_gtls_set_read_cipher (mhd_gtls_session_t session, |
33 | gnutls_cipher_algorithm_t algo); | 33 | gnutls_cipher_algorithm_t algo); |
34 | int _gnutls_set_read_mac (gnutls_session_t session, | 34 | int mhd_gtls_set_read_mac (mhd_gtls_session_t session, |
35 | gnutls_mac_algorithm_t algo); | 35 | gnutls_mac_algorithm_t algo); |
36 | int _gnutls_set_read_compression (gnutls_session_t session, | 36 | int mhd_gtls_set_read_compression (mhd_gtls_session_t session, |
37 | gnutls_compression_method_t algo); | 37 | gnutls_compression_method_t algo); |
38 | int _gnutls_set_write_compression (gnutls_session_t session, | 38 | int mhd_gtls_set_write_compression (mhd_gtls_session_t session, |
39 | gnutls_compression_method_t algo); | 39 | gnutls_compression_method_t algo); |
40 | int _gnutls_set_kx (gnutls_session_t session, gnutls_kx_algorithm_t algo); | 40 | int mhd_gtls_set_kx (mhd_gtls_session_t session, gnutls_kx_algorithm_t algo); |
diff --git a/src/daemon/https/tls/gnutls_datum.c b/src/daemon/https/tls/gnutls_datum.c index 4b2eb1f4..ea18d801 100644 --- a/src/daemon/https/tls/gnutls_datum.c +++ b/src/daemon/https/tls/gnutls_datum.c | |||
@@ -34,31 +34,31 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | void | 36 | void |
37 | _gnutls_write_datum16 (opaque * dest, gnutls_datum_t dat) | 37 | mhd_gtls_write_datum16 (opaque * dest, gnutls_datum_t dat) |
38 | { | 38 | { |
39 | _gnutls_write_uint16 (dat.size, dest); | 39 | mhd_gtls_write_uint16 (dat.size, dest); |
40 | if (dat.data != NULL) | 40 | if (dat.data != NULL) |
41 | memcpy (&dest[2], dat.data, dat.size); | 41 | memcpy (&dest[2], dat.data, dat.size); |
42 | } | 42 | } |
43 | 43 | ||
44 | void | 44 | void |
45 | _gnutls_write_datum24 (opaque * dest, gnutls_datum_t dat) | 45 | mhd_gtls_write_datum24 (opaque * dest, gnutls_datum_t dat) |
46 | { | 46 | { |
47 | _gnutls_write_uint24 (dat.size, dest); | 47 | mhd_gtls_write_uint24 (dat.size, dest); |
48 | if (dat.data != NULL) | 48 | if (dat.data != NULL) |
49 | memcpy (&dest[3], dat.data, dat.size); | 49 | memcpy (&dest[3], dat.data, dat.size); |
50 | } | 50 | } |
51 | 51 | ||
52 | void | 52 | void |
53 | _gnutls_write_datum32 (opaque * dest, gnutls_datum_t dat) | 53 | mhd_gtls_write_datum32 (opaque * dest, gnutls_datum_t dat) |
54 | { | 54 | { |
55 | _gnutls_write_uint32 (dat.size, dest); | 55 | mhd_gtls_write_uint32 (dat.size, dest); |
56 | if (dat.data != NULL) | 56 | if (dat.data != NULL) |
57 | memcpy (&dest[4], dat.data, dat.size); | 57 | memcpy (&dest[4], dat.data, dat.size); |
58 | } | 58 | } |
59 | 59 | ||
60 | void | 60 | void |
61 | _gnutls_write_datum8 (opaque * dest, gnutls_datum_t dat) | 61 | mhd_gtls_write_datum8 (opaque * dest, gnutls_datum_t dat) |
62 | { | 62 | { |
63 | dest[0] = (uint8_t) dat.size; | 63 | dest[0] = (uint8_t) dat.size; |
64 | if (dat.data != NULL) | 64 | if (dat.data != NULL) |
@@ -67,7 +67,7 @@ _gnutls_write_datum8 (opaque * dest, gnutls_datum_t dat) | |||
67 | 67 | ||
68 | 68 | ||
69 | int | 69 | int |
70 | _gnutls_set_datum_m (gnutls_datum_t * dat, const void *data, | 70 | mhd_gtls_set_datum_m (gnutls_datum_t * dat, const void *data, |
71 | size_t data_size, gnutls_alloc_function galloc_func) | 71 | size_t data_size, gnutls_alloc_function galloc_func) |
72 | { | 72 | { |
73 | if (data_size == 0 || data == NULL) | 73 | if (data_size == 0 || data == NULL) |
@@ -88,7 +88,7 @@ _gnutls_set_datum_m (gnutls_datum_t * dat, const void *data, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | int | 90 | int |
91 | _gnutls_datum_append_m (gnutls_datum_t * dst, const void *data, | 91 | mhd_gtls_datum_append_m (gnutls_datum_t * dst, const void *data, |
92 | size_t data_size, | 92 | size_t data_size, |
93 | gnutls_realloc_function grealloc_func) | 93 | gnutls_realloc_function grealloc_func) |
94 | { | 94 | { |
@@ -104,7 +104,7 @@ _gnutls_datum_append_m (gnutls_datum_t * dst, const void *data, | |||
104 | } | 104 | } |
105 | 105 | ||
106 | void | 106 | void |
107 | _gnutls_free_datum_m (gnutls_datum_t * dat, gnutls_free_function gfree_func) | 107 | mhd_gtls_free_datum_m (gnutls_datum_t * dat, gnutls_free_function gfree_func) |
108 | { | 108 | { |
109 | if (dat->data != NULL) | 109 | if (dat->data != NULL) |
110 | gfree_func (dat->data); | 110 | gfree_func (dat->data); |
diff --git a/src/daemon/https/tls/gnutls_datum.h b/src/daemon/https/tls/gnutls_datum.h index 0f609531..cce91595 100644 --- a/src/daemon/https/tls/gnutls_datum.h +++ b/src/daemon/https/tls/gnutls_datum.h | |||
@@ -22,19 +22,19 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | void _gnutls_write_datum16 (opaque * dest, gnutls_datum_t dat); | 25 | void mhd_gtls_write_datum16 (opaque * dest, gnutls_datum_t dat); |
26 | void _gnutls_write_datum24 (opaque * dest, gnutls_datum_t dat); | 26 | void mhd_gtls_write_datum24 (opaque * dest, gnutls_datum_t dat); |
27 | void _gnutls_write_datum32 (opaque * dest, gnutls_datum_t dat); | 27 | void mhd_gtls_write_datum32 (opaque * dest, gnutls_datum_t dat); |
28 | void _gnutls_write_datum8 (opaque * dest, gnutls_datum_t dat); | 28 | void mhd_gtls_write_datum8 (opaque * dest, gnutls_datum_t dat); |
29 | 29 | ||
30 | int _gnutls_set_datum_m (gnutls_datum_t * dat, const void *data, | 30 | int mhd_gtls_set_datum_m (gnutls_datum_t * dat, const void *data, |
31 | size_t data_size, gnutls_alloc_function); | 31 | size_t data_size, gnutls_alloc_function); |
32 | #define _gnutls_set_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_malloc) | 32 | #define _gnutls_set_datum( x, y, z) mhd_gtls_set_datum_m(x,y,z, gnutls_malloc) |
33 | #define _gnutls_sset_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_secure_malloc) | 33 | #define _gnutls_sset_datum( x, y, z) mhd_gtls_set_datum_m(x,y,z, gnutls_secure_malloc) |
34 | 34 | ||
35 | int _gnutls_datum_append_m (gnutls_datum_t * dat, const void *data, | 35 | int mhd_gtls_datum_append_m (gnutls_datum_t * dat, const void *data, |
36 | size_t data_size, gnutls_realloc_function); | 36 | size_t data_size, gnutls_realloc_function); |
37 | #define _gnutls_datum_append(x,y,z) _gnutls_datum_append_m(x,y,z, gnutls_realloc) | 37 | #define _gnutls_datum_append(x,y,z) mhd_gtls_datum_append_m(x,y,z, gnutls_realloc) |
38 | 38 | ||
39 | void _gnutls_free_datum_m (gnutls_datum_t * dat, gnutls_free_function); | 39 | void mhd_gtls_free_datum_m (gnutls_datum_t * dat, gnutls_free_function); |
40 | #define _gnutls_free_datum(x) _gnutls_free_datum_m(x, gnutls_free) | 40 | #define _gnutls_free_datum(x) mhd_gtls_free_datum_m(x, gnutls_free) |
diff --git a/src/daemon/https/tls/gnutls_dh.c b/src/daemon/https/tls/gnutls_dh.c index 19322c73..388f6e0c 100644 --- a/src/daemon/https/tls/gnutls_dh.c +++ b/src/daemon/https/tls/gnutls_dh.c | |||
@@ -35,11 +35,11 @@ | |||
35 | his_key = X ^ y mod p; | 35 | his_key = X ^ y mod p; |
36 | 36 | ||
37 | // generate our secret and the public value (X) for it | 37 | // generate our secret and the public value (X) for it |
38 | X = gnutls_calc_dh_secret(&x, g, p); | 38 | X = mhd_gtls_calc_dh_secret(&x, g, p); |
39 | // now we can calculate the shared secret | 39 | // now we can calculate the shared secret |
40 | key = gnutls_calc_dh_key(Y, x, g, p); | 40 | key = mhd_gtls_calc_dh_key(Y, x, g, p); |
41 | _gnutls_mpi_release(x); | 41 | mhd_gtls_mpi_release(x); |
42 | _gnutls_mpi_release(g); | 42 | mhd_gtls_mpi_release(g); |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #define MAX_BITS 18000 | 45 | #define MAX_BITS 18000 |
@@ -47,7 +47,7 @@ | |||
47 | /* returns the public value (X), and the secret (ret_x). | 47 | /* returns the public value (X), and the secret (ret_x). |
48 | */ | 48 | */ |
49 | mpi_t | 49 | mpi_t |
50 | gnutls_calc_dh_secret (mpi_t * ret_x, mpi_t g, mpi_t prime) | 50 | mhd_gtls_calc_dh_secret (mpi_t * ret_x, mpi_t g, mpi_t prime) |
51 | { | 51 | { |
52 | mpi_t e, x; | 52 | mpi_t e, x; |
53 | int x_size = _gnutls_mpi_get_nbits (prime) - 1; | 53 | int x_size = _gnutls_mpi_get_nbits (prime) - 1; |
@@ -89,7 +89,7 @@ gnutls_calc_dh_secret (mpi_t * ret_x, mpi_t g, mpi_t prime) | |||
89 | if (ret_x) | 89 | if (ret_x) |
90 | *ret_x = NULL; | 90 | *ret_x = NULL; |
91 | 91 | ||
92 | _gnutls_mpi_release (&x); | 92 | mhd_gtls_mpi_release (&x); |
93 | return NULL; | 93 | return NULL; |
94 | } | 94 | } |
95 | 95 | ||
@@ -98,13 +98,13 @@ gnutls_calc_dh_secret (mpi_t * ret_x, mpi_t g, mpi_t prime) | |||
98 | if (ret_x) | 98 | if (ret_x) |
99 | *ret_x = x; | 99 | *ret_x = x; |
100 | else | 100 | else |
101 | _gnutls_mpi_release (&x); | 101 | mhd_gtls_mpi_release (&x); |
102 | return e; | 102 | return e; |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | mpi_t | 106 | mpi_t |
107 | gnutls_calc_dh_key (mpi_t f, mpi_t x, mpi_t prime) | 107 | mhd_gtls_calc_dh_key (mpi_t f, mpi_t x, mpi_t prime) |
108 | { | 108 | { |
109 | mpi_t k; | 109 | mpi_t k; |
110 | int bits; | 110 | int bits; |
@@ -124,7 +124,7 @@ gnutls_calc_dh_key (mpi_t f, mpi_t x, mpi_t prime) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | /*- | 126 | /*- |
127 | * _gnutls_get_dh_params - Returns the DH parameters pointer | 127 | * mhd_gtls_get_dh_params - Returns the DH parameters pointer |
128 | * @dh_params: is an DH parameters structure, or NULL. | 128 | * @dh_params: is an DH parameters structure, or NULL. |
129 | * @func: is a callback function to receive the parameters or NULL. | 129 | * @func: is a callback function to receive the parameters or NULL. |
130 | * @session: a gnutls session. | 130 | * @session: a gnutls session. |
@@ -132,10 +132,10 @@ gnutls_calc_dh_key (mpi_t f, mpi_t x, mpi_t prime) | |||
132 | * This function will return the dh parameters pointer. | 132 | * This function will return the dh parameters pointer. |
133 | * | 133 | * |
134 | -*/ | 134 | -*/ |
135 | gnutls_dh_params_t | 135 | mhd_gtls_dh_params_t |
136 | _gnutls_get_dh_params (gnutls_dh_params_t dh_params, | 136 | mhd_gtls_get_dh_params (mhd_gtls_dh_params_t dh_params, |
137 | gnutls_params_function * func, | 137 | gnutls_params_function * func, |
138 | gnutls_session_t session) | 138 | mhd_gtls_session_t session) |
139 | { | 139 | { |
140 | gnutls_params_st params; | 140 | gnutls_params_st params; |
141 | int ret; | 141 | int ret; |
diff --git a/src/daemon/https/tls/gnutls_dh.h b/src/daemon/https/tls/gnutls_dh.h index dc8a129d..06ac6135 100644 --- a/src/daemon/https/tls/gnutls_dh.h +++ b/src/daemon/https/tls/gnutls_dh.h | |||
@@ -25,14 +25,14 @@ | |||
25 | #ifndef GNUTLS_DH_H | 25 | #ifndef GNUTLS_DH_H |
26 | # define GNUTLS_DH_H | 26 | # define GNUTLS_DH_H |
27 | 27 | ||
28 | const mpi_t *_gnutls_dh_params_to_mpi (gnutls_dh_params_t); | 28 | const mpi_t * mhd_gtls_dh_params_to_mpi (mhd_gtls_dh_params_t); |
29 | mpi_t gnutls_calc_dh_secret (mpi_t * ret_x, mpi_t g, mpi_t prime); | 29 | mpi_t mhd_gtls_calc_dh_secret (mpi_t * ret_x, mpi_t g, mpi_t prime); |
30 | mpi_t gnutls_calc_dh_key (mpi_t f, mpi_t x, mpi_t prime); | 30 | mpi_t mhd_gtls_calc_dh_key (mpi_t f, mpi_t x, mpi_t prime); |
31 | int _gnutls_dh_generate_prime (mpi_t * ret_g, mpi_t * ret_n, unsigned bits); | 31 | int mhd_gtls_dh_generate_prime (mpi_t * ret_g, mpi_t * ret_n, unsigned bits); |
32 | 32 | ||
33 | gnutls_dh_params_t | 33 | mhd_gtls_dh_params_t |
34 | _gnutls_get_dh_params (gnutls_dh_params_t dh_params, | 34 | mhd_gtls_get_dh_params (mhd_gtls_dh_params_t dh_params, |
35 | gnutls_params_function * func, | 35 | gnutls_params_function * func, |
36 | gnutls_session_t session); | 36 | mhd_gtls_session_t session); |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/src/daemon/https/tls/gnutls_dh_primes.c b/src/daemon/https/tls/gnutls_dh_primes.c index 0aea5b5f..0d404bd8 100644 --- a/src/daemon/https/tls/gnutls_dh_primes.c +++ b/src/daemon/https/tls/gnutls_dh_primes.c | |||
@@ -36,7 +36,7 @@ | |||
36 | /* returns the prime and the generator of DH params. | 36 | /* returns the prime and the generator of DH params. |
37 | */ | 37 | */ |
38 | const mpi_t * | 38 | const mpi_t * |
39 | _gnutls_dh_params_to_mpi (gnutls_dh_params_t dh_primes) | 39 | mhd_gtls_dh_params_to_mpi (mhd_gtls_dh_params_t dh_primes) |
40 | { | 40 | { |
41 | if (dh_primes == NULL || dh_primes->params[1] == NULL | 41 | if (dh_primes == NULL || dh_primes->params[1] == NULL |
42 | || dh_primes->params[0] == NULL) | 42 | || dh_primes->params[0] == NULL) |
@@ -48,7 +48,7 @@ _gnutls_dh_params_to_mpi (gnutls_dh_params_t dh_primes) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | int | 50 | int |
51 | _gnutls_dh_generate_prime (mpi_t * ret_g, mpi_t * ret_n, unsigned int bits) | 51 | mhd_gtls_dh_generate_prime (mpi_t * ret_g, mpi_t * ret_n, unsigned int bits) |
52 | { | 52 | { |
53 | mpi_t g = NULL, prime = NULL; | 53 | mpi_t g = NULL, prime = NULL; |
54 | gcry_error_t err; | 54 | gcry_error_t err; |
@@ -75,7 +75,7 @@ _gnutls_dh_generate_prime (mpi_t * ret_g, mpi_t * ret_n, unsigned int bits) | |||
75 | 75 | ||
76 | if (times) | 76 | if (times) |
77 | { | 77 | { |
78 | _gnutls_mpi_release (&prime); | 78 | mhd_gtls_mpi_release (&prime); |
79 | gcry_prime_release_factors (factors); | 79 | gcry_prime_release_factors (factors); |
80 | } | 80 | } |
81 | 81 | ||
@@ -119,17 +119,17 @@ _gnutls_dh_generate_prime (mpi_t * ret_g, mpi_t * ret_n, unsigned int bits) | |||
119 | if (ret_g) | 119 | if (ret_g) |
120 | *ret_g = g; | 120 | *ret_g = g; |
121 | else | 121 | else |
122 | _gnutls_mpi_release (&g); | 122 | mhd_gtls_mpi_release (&g); |
123 | if (ret_n) | 123 | if (ret_n) |
124 | *ret_n = prime; | 124 | *ret_n = prime; |
125 | else | 125 | else |
126 | _gnutls_mpi_release (&prime); | 126 | mhd_gtls_mpi_release (&prime); |
127 | 127 | ||
128 | return 0; | 128 | return 0; |
129 | 129 | ||
130 | cleanup:gcry_prime_release_factors (factors); | 130 | cleanup:gcry_prime_release_factors (factors); |
131 | _gnutls_mpi_release (&g); | 131 | mhd_gtls_mpi_release (&g); |
132 | _gnutls_mpi_release (&prime); | 132 | mhd_gtls_mpi_release (&prime); |
133 | 133 | ||
134 | return result; | 134 | return result; |
135 | 135 | ||
@@ -139,60 +139,17 @@ cleanup:gcry_prime_release_factors (factors); | |||
139 | * generated one. | 139 | * generated one. |
140 | */ | 140 | */ |
141 | /** | 141 | /** |
142 | * gnutls_dh_params_import_raw - This function will import DH parameters | 142 | * MHD_gnutls_dh_params_init - This function will initialize the DH parameters |
143 | * @dh_params: Is a structure that will hold the prime numbers | ||
144 | * @prime: holds the new prime | ||
145 | * @generator: holds the new generator | ||
146 | * | ||
147 | * This function will replace the pair of prime and generator for use in | ||
148 | * the Diffie-Hellman key exchange. The new parameters should be stored in the | ||
149 | * appropriate gnutls_datum. | ||
150 | * | ||
151 | **/ | ||
152 | int | ||
153 | gnutls_dh_params_import_raw (gnutls_dh_params_t dh_params, | ||
154 | const gnutls_datum_t * prime, | ||
155 | const gnutls_datum_t * generator) | ||
156 | { | ||
157 | mpi_t tmp_prime, tmp_g; | ||
158 | size_t siz; | ||
159 | |||
160 | siz = prime->size; | ||
161 | if (_gnutls_mpi_scan_nz (&tmp_prime, prime->data, &siz)) | ||
162 | { | ||
163 | gnutls_assert (); | ||
164 | return GNUTLS_E_MPI_SCAN_FAILED; | ||
165 | } | ||
166 | |||
167 | siz = generator->size; | ||
168 | if (_gnutls_mpi_scan_nz (&tmp_g, generator->data, &siz)) | ||
169 | { | ||
170 | _gnutls_mpi_release (&tmp_prime); | ||
171 | gnutls_assert (); | ||
172 | return GNUTLS_E_MPI_SCAN_FAILED; | ||
173 | } | ||
174 | |||
175 | /* store the generated values | ||
176 | */ | ||
177 | dh_params->params[0] = tmp_prime; | ||
178 | dh_params->params[1] = tmp_g; | ||
179 | |||
180 | return 0; | ||
181 | |||
182 | } | ||
183 | |||
184 | /** | ||
185 | * gnutls_dh_params_init - This function will initialize the DH parameters | ||
186 | * @dh_params: Is a structure that will hold the prime numbers | 143 | * @dh_params: Is a structure that will hold the prime numbers |
187 | * | 144 | * |
188 | * This function will initialize the DH parameters structure. | 145 | * This function will initialize the DH parameters structure. |
189 | * | 146 | * |
190 | **/ | 147 | **/ |
191 | int | 148 | int |
192 | gnutls_dh_params_init (gnutls_dh_params_t * dh_params) | 149 | MHD_gnutls_dh_params_init (mhd_gtls_dh_params_t * dh_params) |
193 | { | 150 | { |
194 | 151 | ||
195 | (*dh_params) = gnutls_calloc (1, sizeof (dh_params_st)); | 152 | (*dh_params) = gnutls_calloc (1, sizeof (mhd_gtls_dh_params_st)); |
196 | if (*dh_params == NULL) | 153 | if (*dh_params == NULL) |
197 | { | 154 | { |
198 | gnutls_assert (); | 155 | gnutls_assert (); |
@@ -204,59 +161,35 @@ gnutls_dh_params_init (gnutls_dh_params_t * dh_params) | |||
204 | } | 161 | } |
205 | 162 | ||
206 | /** | 163 | /** |
207 | * gnutls_dh_params_deinit - This function will deinitialize the DH parameters | 164 | * MHD_gnutls_dh_params_deinit - This function will deinitialize the DH parameters |
208 | * @dh_params: Is a structure that holds the prime numbers | 165 | * @dh_params: Is a structure that holds the prime numbers |
209 | * | 166 | * |
210 | * This function will deinitialize the DH parameters structure. | 167 | * This function will deinitialize the DH parameters structure. |
211 | * | 168 | * |
212 | **/ | 169 | **/ |
213 | void | 170 | void |
214 | gnutls_dh_params_deinit (gnutls_dh_params_t dh_params) | 171 | MHD_gnutls_dh_params_deinit (mhd_gtls_dh_params_t dh_params) |
215 | { | 172 | { |
216 | if (dh_params == NULL) | 173 | if (dh_params == NULL) |
217 | return; | 174 | return; |
218 | 175 | ||
219 | _gnutls_mpi_release (&dh_params->params[0]); | 176 | mhd_gtls_mpi_release (&dh_params->params[0]); |
220 | _gnutls_mpi_release (&dh_params->params[1]); | 177 | mhd_gtls_mpi_release (&dh_params->params[1]); |
221 | 178 | ||
222 | gnutls_free (dh_params); | 179 | gnutls_free (dh_params); |
223 | 180 | ||
224 | } | 181 | } |
225 | 182 | ||
226 | /** | 183 | /** |
227 | * gnutls_dh_params_cpy - This function will copy a DH parameters structure | 184 | * MHD_gnutls_dh_params_generate2 - This function will generate new DH parameters |
228 | * @dst: Is the destination structure, which should be initialized. | ||
229 | * @src: Is the source structure | ||
230 | * | ||
231 | * This function will copy the DH parameters structure from source | ||
232 | * to destination. | ||
233 | * | ||
234 | **/ | ||
235 | int | ||
236 | gnutls_dh_params_cpy (gnutls_dh_params_t dst, gnutls_dh_params_t src) | ||
237 | { | ||
238 | if (src == NULL) | ||
239 | return GNUTLS_E_INVALID_REQUEST; | ||
240 | |||
241 | dst->params[0] = _gnutls_mpi_copy (src->params[0]); | ||
242 | dst->params[1] = _gnutls_mpi_copy (src->params[1]); | ||
243 | |||
244 | if (dst->params[0] == NULL || dst->params[1] == NULL) | ||
245 | return GNUTLS_E_MEMORY_ERROR; | ||
246 | |||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * gnutls_dh_params_generate2 - This function will generate new DH parameters | ||
252 | * @params: Is the structure that the DH parameters will be stored | 185 | * @params: Is the structure that the DH parameters will be stored |
253 | * @bits: is the prime's number of bits | 186 | * @bits: is the prime's number of bits |
254 | * | 187 | * |
255 | * This function will generate a new pair of prime and generator for use in | 188 | * This function will generate a new pair of prime and generator for use in |
256 | * the Diffie-Hellman key exchange. The new parameters will be allocated using | 189 | * the Diffie-Hellman key exchange. The new parameters will be allocated using |
257 | * gnutls_malloc() and will be stored in the appropriate datum. | 190 | * gnutls_malloc() and will be stored in the appropriate datum. |
258 | * This function is normally slow. | 191 | * This function is normally slow. |
259 | * | 192 | * |
260 | * Note that the bits value should be one of 768, 1024, 2048, 3072 or 4096. | 193 | * Note that the bits value should be one of 768, 1024, 2048, 3072 or 4096. |
261 | * Also note that the DH parameters are only useful to servers. | 194 | * Also note that the DH parameters are only useful to servers. |
262 | * Since clients use the parameters sent by the server, it's of | 195 | * Since clients use the parameters sent by the server, it's of |
@@ -264,12 +197,12 @@ gnutls_dh_params_cpy (gnutls_dh_params_t dst, gnutls_dh_params_t src) | |||
264 | * | 197 | * |
265 | **/ | 198 | **/ |
266 | int | 199 | int |
267 | gnutls_dh_params_generate2 (gnutls_dh_params_t params, unsigned int bits) | 200 | MHD_gnutls_dh_params_generate2 (mhd_gtls_dh_params_t params, unsigned int bits) |
268 | { | 201 | { |
269 | int ret; | 202 | int ret; |
270 | 203 | ||
271 | ret = | 204 | ret = |
272 | _gnutls_dh_generate_prime (¶ms->params[1], ¶ms->params[0], bits); | 205 | mhd_gtls_dh_generate_prime (¶ms->params[1], ¶ms->params[0], bits); |
273 | if (ret < 0) | 206 | if (ret < 0) |
274 | { | 207 | { |
275 | gnutls_assert (); | 208 | gnutls_assert (); |
@@ -278,349 +211,3 @@ gnutls_dh_params_generate2 (gnutls_dh_params_t params, unsigned int bits) | |||
278 | 211 | ||
279 | return 0; | 212 | return 0; |
280 | } | 213 | } |
281 | |||
282 | /** | ||
283 | * gnutls_dh_params_import_pkcs3 - This function will import DH params from a pkcs3 structure | ||
284 | * @params: A structure where the parameters will be copied to | ||
285 | * @pkcs3_params: should contain a PKCS3 DHParams structure PEM or DER encoded | ||
286 | * @format: the format of params. PEM or DER. | ||
287 | * | ||
288 | * This function will extract the DHParams found in a PKCS3 formatted | ||
289 | * structure. This is the format generated by "openssl dhparam" tool. | ||
290 | * | ||
291 | * If the structure is PEM encoded, it should have a header | ||
292 | * of "BEGIN DH PARAMETERS". | ||
293 | * | ||
294 | * In case of failure a negative value will be returned, and | ||
295 | * 0 on success. | ||
296 | * | ||
297 | **/ | ||
298 | int | ||
299 | gnutls_dh_params_import_pkcs3 (gnutls_dh_params_t params, | ||
300 | const gnutls_datum_t * pkcs3_params, | ||
301 | gnutls_x509_crt_fmt_t format) | ||
302 | { | ||
303 | ASN1_TYPE c2; | ||
304 | int result, need_free = 0; | ||
305 | gnutls_datum_t _params; | ||
306 | |||
307 | if (format == GNUTLS_X509_FMT_PEM) | ||
308 | { | ||
309 | opaque *out; | ||
310 | |||
311 | result = _gnutls_fbase64_decode ("DH PARAMETERS", pkcs3_params->data, | ||
312 | pkcs3_params->size, &out); | ||
313 | |||
314 | if (result <= 0) | ||
315 | { | ||
316 | if (result == 0) | ||
317 | result = GNUTLS_E_INTERNAL_ERROR; | ||
318 | gnutls_assert (); | ||
319 | return result; | ||
320 | } | ||
321 | |||
322 | _params.data = out; | ||
323 | _params.size = result; | ||
324 | |||
325 | need_free = 1; | ||
326 | |||
327 | } | ||
328 | else | ||
329 | { | ||
330 | _params.data = pkcs3_params->data; | ||
331 | _params.size = pkcs3_params->size; | ||
332 | } | ||
333 | |||
334 | if ((result = | ||
335 | asn1_create_element (_gnutls_get_gnutls_asn (), "GNUTLS.DHParameter", | ||
336 | &c2)) != ASN1_SUCCESS) | ||
337 | { | ||
338 | gnutls_assert (); | ||
339 | if (need_free != 0) | ||
340 | { | ||
341 | gnutls_free (_params.data); | ||
342 | _params.data = NULL; | ||
343 | } | ||
344 | return _gnutls_asn2err (result); | ||
345 | } | ||
346 | |||
347 | result = asn1_der_decoding (&c2, _params.data, _params.size, NULL); | ||
348 | |||
349 | if (need_free != 0) | ||
350 | { | ||
351 | gnutls_free (_params.data); | ||
352 | _params.data = NULL; | ||
353 | } | ||
354 | |||
355 | if (result != ASN1_SUCCESS) | ||
356 | { | ||
357 | /* couldn't decode DER */ | ||
358 | |||
359 | _gnutls_x509_log ("DHParams: Decoding error %d\n", result); | ||
360 | gnutls_assert (); | ||
361 | asn1_delete_structure (&c2); | ||
362 | return _gnutls_asn2err (result); | ||
363 | } | ||
364 | |||
365 | /* Read PRIME | ||
366 | */ | ||
367 | result = _gnutls_x509_read_int (c2, "prime", ¶ms->params[0]); | ||
368 | if (result < 0) | ||
369 | { | ||
370 | asn1_delete_structure (&c2); | ||
371 | gnutls_assert (); | ||
372 | return result; | ||
373 | } | ||
374 | |||
375 | /* read the generator | ||
376 | */ | ||
377 | result = _gnutls_x509_read_int (c2, "base", ¶ms->params[1]); | ||
378 | if (result < 0) | ||
379 | { | ||
380 | asn1_delete_structure (&c2); | ||
381 | _gnutls_mpi_release (¶ms->params[0]); | ||
382 | gnutls_assert (); | ||
383 | return result; | ||
384 | } | ||
385 | |||
386 | asn1_delete_structure (&c2); | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * gnutls_dh_params_export_pkcs3 - This function will export DH params to a pkcs3 structure | ||
393 | * @params: Holds the DH parameters | ||
394 | * @format: the format of output params. One of PEM or DER. | ||
395 | * @params_data: will contain a PKCS3 DHParams structure PEM or DER encoded | ||
396 | * @params_data_size: holds the size of params_data (and will be replaced by the actual size of parameters) | ||
397 | * | ||
398 | * This function will export the given dh parameters to a PKCS3 | ||
399 | * DHParams structure. This is the format generated by "openssl dhparam" tool. | ||
400 | * If the buffer provided is not long enough to hold the output, then | ||
401 | * GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. | ||
402 | * | ||
403 | * If the structure is PEM encoded, it will have a header | ||
404 | * of "BEGIN DH PARAMETERS". | ||
405 | * | ||
406 | * In case of failure a negative value will be returned, and | ||
407 | * 0 on success. | ||
408 | * | ||
409 | **/ | ||
410 | int | ||
411 | gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params, | ||
412 | gnutls_x509_crt_fmt_t format, | ||
413 | unsigned char *params_data, | ||
414 | size_t * params_data_size) | ||
415 | { | ||
416 | ASN1_TYPE c2; | ||
417 | int result, _params_data_size; | ||
418 | size_t g_size, p_size; | ||
419 | opaque *p_data, *g_data; | ||
420 | opaque *all_data; | ||
421 | |||
422 | _gnutls_mpi_print_lz (NULL, &g_size, params->params[1]); | ||
423 | _gnutls_mpi_print_lz (NULL, &p_size, params->params[0]); | ||
424 | |||
425 | all_data = gnutls_malloc (g_size + p_size); | ||
426 | if (all_data == NULL) | ||
427 | { | ||
428 | gnutls_assert (); | ||
429 | return GNUTLS_E_MEMORY_ERROR; | ||
430 | } | ||
431 | |||
432 | p_data = &all_data[0]; | ||
433 | g_data = &all_data[p_size]; | ||
434 | |||
435 | _gnutls_mpi_print_lz (p_data, &p_size, params->params[0]); | ||
436 | _gnutls_mpi_print_lz (g_data, &g_size, params->params[1]); | ||
437 | |||
438 | /* Ok. Now we have the data. Create the asn1 structures | ||
439 | */ | ||
440 | |||
441 | if ((result = | ||
442 | asn1_create_element (_gnutls_get_gnutls_asn (), "GNUTLS.DHParameter", | ||
443 | &c2)) != ASN1_SUCCESS) | ||
444 | { | ||
445 | gnutls_assert (); | ||
446 | gnutls_free (all_data); | ||
447 | return _gnutls_asn2err (result); | ||
448 | } | ||
449 | |||
450 | /* Write PRIME | ||
451 | */ | ||
452 | if ((result = | ||
453 | asn1_write_value (c2, "prime", p_data, p_size)) != ASN1_SUCCESS) | ||
454 | { | ||
455 | gnutls_assert (); | ||
456 | gnutls_free (all_data); | ||
457 | asn1_delete_structure (&c2); | ||
458 | return _gnutls_asn2err (result); | ||
459 | } | ||
460 | |||
461 | /* Write the GENERATOR | ||
462 | */ | ||
463 | if ((result = | ||
464 | asn1_write_value (c2, "base", g_data, g_size)) != ASN1_SUCCESS) | ||
465 | { | ||
466 | gnutls_assert (); | ||
467 | gnutls_free (all_data); | ||
468 | asn1_delete_structure (&c2); | ||
469 | return _gnutls_asn2err (result); | ||
470 | } | ||
471 | |||
472 | gnutls_free (all_data); | ||
473 | |||
474 | if ((result = asn1_write_value (c2, "privateValueLength", | ||
475 | NULL, 0)) != ASN1_SUCCESS) | ||
476 | { | ||
477 | gnutls_assert (); | ||
478 | asn1_delete_structure (&c2); | ||
479 | return _gnutls_asn2err (result); | ||
480 | } | ||
481 | |||
482 | if (format == GNUTLS_X509_FMT_DER) | ||
483 | { | ||
484 | if (params_data == NULL) | ||
485 | *params_data_size = 0; | ||
486 | |||
487 | _params_data_size = *params_data_size; | ||
488 | result = | ||
489 | asn1_der_coding (c2, "", params_data, &_params_data_size, NULL); | ||
490 | *params_data_size = _params_data_size; | ||
491 | asn1_delete_structure (&c2); | ||
492 | |||
493 | if (result != ASN1_SUCCESS) | ||
494 | { | ||
495 | gnutls_assert (); | ||
496 | if (result == ASN1_MEM_ERROR) | ||
497 | return GNUTLS_E_SHORT_MEMORY_BUFFER; | ||
498 | |||
499 | return _gnutls_asn2err (result); | ||
500 | } | ||
501 | |||
502 | } | ||
503 | else | ||
504 | { /* PEM */ | ||
505 | opaque *tmp; | ||
506 | opaque *out; | ||
507 | int len; | ||
508 | |||
509 | len = 0; | ||
510 | asn1_der_coding (c2, "", NULL, &len, NULL); | ||
511 | |||
512 | tmp = gnutls_malloc (len); | ||
513 | if (tmp == NULL) | ||
514 | { | ||
515 | gnutls_assert (); | ||
516 | asn1_delete_structure (&c2); | ||
517 | return GNUTLS_E_MEMORY_ERROR; | ||
518 | } | ||
519 | |||
520 | if ((result = | ||
521 | asn1_der_coding (c2, "", tmp, &len, NULL)) != ASN1_SUCCESS) | ||
522 | { | ||
523 | gnutls_assert (); | ||
524 | gnutls_free (tmp); | ||
525 | asn1_delete_structure (&c2); | ||
526 | return _gnutls_asn2err (result); | ||
527 | } | ||
528 | |||
529 | asn1_delete_structure (&c2); | ||
530 | |||
531 | result = _gnutls_fbase64_encode ("DH PARAMETERS", tmp, len, &out); | ||
532 | |||
533 | gnutls_free (tmp); | ||
534 | |||
535 | if (result < 0) | ||
536 | { | ||
537 | gnutls_assert (); | ||
538 | return result; | ||
539 | } | ||
540 | |||
541 | if (result == 0) | ||
542 | { /* oooops */ | ||
543 | gnutls_assert (); | ||
544 | gnutls_free (out); | ||
545 | return GNUTLS_E_INTERNAL_ERROR; | ||
546 | } | ||
547 | |||
548 | if ((unsigned) result + 1 > *params_data_size) | ||
549 | { | ||
550 | gnutls_assert (); | ||
551 | gnutls_free (out); | ||
552 | *params_data_size = result + 1; | ||
553 | return GNUTLS_E_SHORT_MEMORY_BUFFER; | ||
554 | } | ||
555 | |||
556 | *params_data_size = result; | ||
557 | |||
558 | if (params_data) | ||
559 | { | ||
560 | memcpy (params_data, out, result); | ||
561 | params_data[result] = 0; | ||
562 | } | ||
563 | gnutls_free (out); | ||
564 | |||
565 | } | ||
566 | |||
567 | return 0; | ||
568 | } | ||
569 | |||
570 | /** | ||
571 | * gnutls_dh_params_export_raw - This function will export the raw DH parameters | ||
572 | * @params: Holds the DH parameters | ||
573 | * @prime: will hold the new prime | ||
574 | * @generator: will hold the new generator | ||
575 | * @bits: if non null will hold is the prime's number of bits | ||
576 | * | ||
577 | * This function will export the pair of prime and generator for use in | ||
578 | * the Diffie-Hellman key exchange. The new parameters will be allocated using | ||
579 | * gnutls_malloc() and will be stored in the appropriate datum. | ||
580 | * | ||
581 | **/ | ||
582 | int | ||
583 | gnutls_dh_params_export_raw (gnutls_dh_params_t params, | ||
584 | gnutls_datum_t * prime, | ||
585 | gnutls_datum_t * generator, unsigned int *bits) | ||
586 | { | ||
587 | |||
588 | size_t size; | ||
589 | |||
590 | if (params->params[1] == NULL || params->params[0] == NULL) | ||
591 | { | ||
592 | gnutls_assert (); | ||
593 | return GNUTLS_E_INVALID_REQUEST; | ||
594 | } | ||
595 | |||
596 | size = 0; | ||
597 | _gnutls_mpi_print (NULL, &size, params->params[1]); | ||
598 | |||
599 | generator->data = gnutls_malloc (size); | ||
600 | if (generator->data == NULL) | ||
601 | { | ||
602 | return GNUTLS_E_MEMORY_ERROR; | ||
603 | } | ||
604 | |||
605 | generator->size = size; | ||
606 | _gnutls_mpi_print (generator->data, &size, params->params[1]); | ||
607 | |||
608 | size = 0; | ||
609 | _gnutls_mpi_print (NULL, &size, params->params[0]); | ||
610 | |||
611 | prime->data = gnutls_malloc (size); | ||
612 | if (prime->data == NULL) | ||
613 | { | ||
614 | gnutls_free (generator->data); | ||
615 | generator->data = NULL; | ||
616 | return GNUTLS_E_MEMORY_ERROR; | ||
617 | } | ||
618 | prime->size = size; | ||
619 | _gnutls_mpi_print (prime->data, &size, params->params[0]); | ||
620 | |||
621 | if (bits) | ||
622 | *bits = _gnutls_mpi_get_nbits (params->params[0]); | ||
623 | |||
624 | return 0; | ||
625 | |||
626 | } | ||
diff --git a/src/daemon/https/tls/gnutls_errors.c b/src/daemon/https/tls/gnutls_errors.c index 9916dc96..9ebf67df 100644 --- a/src/daemon/https/tls/gnutls_errors.c +++ b/src/daemon/https/tls/gnutls_errors.c | |||
@@ -263,7 +263,7 @@ static const gnutls_error_entry error_algorithms[] = { | |||
263 | 263 | ||
264 | 264 | ||
265 | /** | 265 | /** |
266 | * gnutls_error_is_fatal - Returns non-zero in case of a fatal error | 266 | * MHD_gtls_error_is_fatal - Returns non-zero in case of a fatal error |
267 | * @error: is an error returned by a gnutls function. Error should be a negative value. | 267 | * @error: is an error returned by a gnutls function. Error should be a negative value. |
268 | * | 268 | * |
269 | * If a function returns a negative value you may feed that value | 269 | * If a function returns a negative value you may feed that value |
@@ -279,7 +279,7 @@ static const gnutls_error_entry error_algorithms[] = { | |||
279 | * | 279 | * |
280 | **/ | 280 | **/ |
281 | int | 281 | int |
282 | gnutls_error_is_fatal (int error) | 282 | MHD_gtls_error_is_fatal (int error) |
283 | { | 283 | { |
284 | int ret = 1; | 284 | int ret = 1; |
285 | 285 | ||
@@ -294,14 +294,14 @@ gnutls_error_is_fatal (int error) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | /** | 296 | /** |
297 | * gnutls_perror - prints a string to stderr with a description of an error | 297 | * MHD_gtls_perror - prints a string to stderr with a description of an error |
298 | * @error: is an error returned by a gnutls function. Error is always a negative value. | 298 | * @error: is an error returned by a gnutls function. Error is always a negative value. |
299 | * | 299 | * |
300 | * This function is like perror(). The only difference is that it accepts an | 300 | * This function is like perror(). The only difference is that it accepts an |
301 | * error number returned by a gnutls function. | 301 | * error number returned by a gnutls function. |
302 | **/ | 302 | **/ |
303 | void | 303 | void |
304 | gnutls_perror (int error) | 304 | MHD_gtls_perror (int error) |
305 | { | 305 | { |
306 | const char *ret = NULL; | 306 | const char *ret = NULL; |
307 | 307 | ||
@@ -314,7 +314,7 @@ gnutls_perror (int error) | |||
314 | 314 | ||
315 | 315 | ||
316 | /** | 316 | /** |
317 | * gnutls_strerror - Returns a string with a description of an error | 317 | * MHD_gtls_strerror - Returns a string with a description of an error |
318 | * @error: is an error returned by a gnutls function. Error is always a negative value. | 318 | * @error: is an error returned by a gnutls function. Error is always a negative value. |
319 | * | 319 | * |
320 | * This function is similar to strerror(). Differences: it accepts an error | 320 | * This function is similar to strerror(). Differences: it accepts an error |
@@ -322,7 +322,7 @@ gnutls_perror (int error) | |||
322 | * a descriptive string is sent instead of NULL. | 322 | * a descriptive string is sent instead of NULL. |
323 | **/ | 323 | **/ |
324 | const char * | 324 | const char * |
325 | gnutls_strerror (int error) | 325 | MHD_gtls_strerror (int error) |
326 | { | 326 | { |
327 | const char *ret = NULL; | 327 | const char *ret = NULL; |
328 | 328 | ||
diff --git a/src/daemon/https/tls/gnutls_extensions.c b/src/daemon/https/tls/gnutls_extensions.c index 603446d7..5e09c911 100644 --- a/src/daemon/https/tls/gnutls_extensions.c +++ b/src/daemon/https/tls/gnutls_extensions.c | |||
@@ -43,26 +43,26 @@ | |||
43 | 43 | ||
44 | 44 | ||
45 | #define MAX_EXT_SIZE 10 | 45 | #define MAX_EXT_SIZE 10 |
46 | const int _gnutls_extensions_size = MAX_EXT_SIZE; | 46 | const int mhd_gtls_extensions_size = MAX_EXT_SIZE; |
47 | 47 | ||
48 | gnutls_extension_entry _gnutls_extensions[MAX_EXT_SIZE] = { | 48 | mhd_gtls_extension_entry mhd_gtls_extensions[MAX_EXT_SIZE] = { |
49 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_MAX_RECORD_SIZE, | 49 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_MAX_RECORD_SIZE, |
50 | EXTENSION_TLS, | 50 | EXTENSION_TLS, |
51 | _gnutls_max_record_recv_params, | 51 | mhd_gtls_max_record_recv_params, |
52 | _gnutls_max_record_send_params), | 52 | mhd_gtls_max_record_send_params), |
53 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_CERT_TYPE, | 53 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_CERT_TYPE, |
54 | EXTENSION_TLS, | 54 | EXTENSION_TLS, |
55 | _gnutls_cert_type_recv_params, | 55 | mhd_gtls_cert_type_recv_params, |
56 | _gnutls_cert_type_send_params), | 56 | mhd_gtls_cert_type_send_params), |
57 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_SERVER_NAME, | 57 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_SERVER_NAME, |
58 | EXTENSION_APPLICATION, | 58 | EXTENSION_APPLICATION, |
59 | _gnutls_server_name_recv_params, | 59 | mhd_gtls_server_name_recv_params, |
60 | _gnutls_server_name_send_params), | 60 | mhd_gtls_server_name_send_params), |
61 | #ifdef ENABLE_OPRFI | 61 | #ifdef ENABLE_OPRFI |
62 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_OPAQUE_PRF_INPUT, | 62 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_OPAQUE_PRF_INPUT, |
63 | EXTENSION_TLS, | 63 | EXTENSION_TLS, |
64 | _gnutls_oprfi_recv_params, | 64 | mhd_gtls_oprfi_recv_params, |
65 | _gnutls_oprfi_send_params), | 65 | mhd_gtls_oprfi_send_params), |
66 | #endif | 66 | #endif |
67 | #ifdef ENABLE_SRP | 67 | #ifdef ENABLE_SRP |
68 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_SRP, | 68 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_SRP, |
@@ -72,14 +72,14 @@ gnutls_extension_entry _gnutls_extensions[MAX_EXT_SIZE] = { | |||
72 | #endif | 72 | #endif |
73 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_INNER_APPLICATION, | 73 | GNUTLS_EXTENSION_ENTRY (GNUTLS_EXTENSION_INNER_APPLICATION, |
74 | EXTENSION_TLS, | 74 | EXTENSION_TLS, |
75 | _gnutls_inner_application_recv_params, | 75 | mhd_gtls_inner_app_rcv_params, |
76 | _gnutls_inner_application_send_params), | 76 | mhd_gtls_inner_app_send_params), |
77 | {0, 0, 0, 0} | 77 | {0, 0, 0, 0} |
78 | }; | 78 | }; |
79 | 79 | ||
80 | #define GNUTLS_EXTENSION_LOOP2(b) \ | 80 | #define GNUTLS_EXTENSION_LOOP2(b) \ |
81 | gnutls_extension_entry *p; \ | 81 | mhd_gtls_extension_entry *p; \ |
82 | for(p = _gnutls_extensions; p->name != NULL; p++) { b ; } | 82 | for(p = mhd_gtls_extensions; p->name != NULL; p++) { b ; } |
83 | 83 | ||
84 | #define GNUTLS_EXTENSION_LOOP(a) \ | 84 | #define GNUTLS_EXTENSION_LOOP(a) \ |
85 | GNUTLS_EXTENSION_LOOP2( if(p->type == type) { a; break; } ) | 85 | GNUTLS_EXTENSION_LOOP2( if(p->type == type) { a; break; } ) |
@@ -87,10 +87,10 @@ gnutls_extension_entry _gnutls_extensions[MAX_EXT_SIZE] = { | |||
87 | 87 | ||
88 | /* EXTENSION functions */ | 88 | /* EXTENSION functions */ |
89 | 89 | ||
90 | ext_recv_func | 90 | mhd_gtls_ext_recv_func |
91 | _gnutls_ext_func_recv (uint16_t type, tls_ext_parse_type_t parse_type) | 91 | mhd_gtls_ext_func_recv (uint16_t type, mhd_gtls_ext_parse_type_t parse_type) |
92 | { | 92 | { |
93 | ext_recv_func ret = NULL; | 93 | mhd_gtls_ext_recv_func ret = NULL; |
94 | GNUTLS_EXTENSION_LOOP (if | 94 | GNUTLS_EXTENSION_LOOP (if |
95 | (parse_type == EXTENSION_ANY | 95 | (parse_type == EXTENSION_ANY |
96 | || p->parse_type == parse_type) ret = | 96 | || p->parse_type == parse_type) ret = |
@@ -99,17 +99,17 @@ _gnutls_ext_func_recv (uint16_t type, tls_ext_parse_type_t parse_type) | |||
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | ext_send_func | 102 | mhd_gtls_ext_send_func |
103 | _gnutls_ext_func_send (uint16_t type) | 103 | mhd_gtls_ext_func_send (uint16_t type) |
104 | { | 104 | { |
105 | ext_send_func ret = NULL; | 105 | mhd_gtls_ext_send_func ret = NULL; |
106 | GNUTLS_EXTENSION_LOOP (ret = p->gnutls_ext_func_send); | 106 | GNUTLS_EXTENSION_LOOP (ret = p->gnutls_ext_func_send); |
107 | return ret; | 107 | return ret; |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | const char * | 111 | const char * |
112 | _gnutls_extension_get_name (uint16_t type) | 112 | mhd_gtls_extension_get_name (uint16_t type) |
113 | { | 113 | { |
114 | const char *ret = NULL; | 114 | const char *ret = NULL; |
115 | 115 | ||
@@ -123,7 +123,7 @@ _gnutls_extension_get_name (uint16_t type) | |||
123 | * requested ones. Otherwise it's a fatal error. | 123 | * requested ones. Otherwise it's a fatal error. |
124 | */ | 124 | */ |
125 | static int | 125 | static int |
126 | _gnutls_extension_list_check (gnutls_session_t session, uint16_t type) | 126 | _gnutls_extension_list_check (mhd_gtls_session_t session, uint16_t type) |
127 | { | 127 | { |
128 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 128 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
129 | { | 129 | { |
@@ -140,15 +140,15 @@ _gnutls_extension_list_check (gnutls_session_t session, uint16_t type) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | int | 142 | int |
143 | _gnutls_parse_extensions (gnutls_session_t session, | 143 | mhd_gtls_parse_extensions (mhd_gtls_session_t session, |
144 | tls_ext_parse_type_t parse_type, | 144 | mhd_gtls_ext_parse_type_t parse_type, |
145 | const opaque * data, int data_size) | 145 | const opaque * data, int data_size) |
146 | { | 146 | { |
147 | int next, ret; | 147 | int next, ret; |
148 | int pos = 0; | 148 | int pos = 0; |
149 | uint16_t type; | 149 | uint16_t type; |
150 | const opaque *sdata; | 150 | const opaque *sdata; |
151 | ext_recv_func ext_recv; | 151 | mhd_gtls_ext_recv_func ext_recv; |
152 | uint16_t size; | 152 | uint16_t size; |
153 | 153 | ||
154 | #ifdef DEBUG | 154 | #ifdef DEBUG |
@@ -159,14 +159,14 @@ _gnutls_parse_extensions (gnutls_session_t session, | |||
159 | { | 159 | { |
160 | _gnutls_debug_log ("EXT[%d]: expecting extension '%s'\n", | 160 | _gnutls_debug_log ("EXT[%d]: expecting extension '%s'\n", |
161 | session, | 161 | session, |
162 | _gnutls_extension_get_name (session-> | 162 | mhd_gtls_extension_get_name (session-> |
163 | internals. | 163 | internals. |
164 | extensions_sent[i])); | 164 | extensions_sent[i])); |
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | DECR_LENGTH_RET (data_size, 2, 0); | 168 | DECR_LENGTH_RET (data_size, 2, 0); |
169 | next = _gnutls_read_uint16 (data); | 169 | next = mhd_gtls_read_uint16 (data); |
170 | pos += 2; | 170 | pos += 2; |
171 | 171 | ||
172 | DECR_LENGTH_RET (data_size, next, 0); | 172 | DECR_LENGTH_RET (data_size, next, 0); |
@@ -174,11 +174,11 @@ _gnutls_parse_extensions (gnutls_session_t session, | |||
174 | do | 174 | do |
175 | { | 175 | { |
176 | DECR_LENGTH_RET (next, 2, 0); | 176 | DECR_LENGTH_RET (next, 2, 0); |
177 | type = _gnutls_read_uint16 (&data[pos]); | 177 | type = mhd_gtls_read_uint16 (&data[pos]); |
178 | pos += 2; | 178 | pos += 2; |
179 | 179 | ||
180 | _gnutls_debug_log ("EXT[%x]: Received extension '%s/%d'\n", session, | 180 | _gnutls_debug_log ("EXT[%x]: Received extension '%s/%d'\n", session, |
181 | _gnutls_extension_get_name (type), type); | 181 | mhd_gtls_extension_get_name (type), type); |
182 | 182 | ||
183 | if ((ret = _gnutls_extension_list_check (session, type)) < 0) | 183 | if ((ret = _gnutls_extension_list_check (session, type)) < 0) |
184 | { | 184 | { |
@@ -187,14 +187,14 @@ _gnutls_parse_extensions (gnutls_session_t session, | |||
187 | } | 187 | } |
188 | 188 | ||
189 | DECR_LENGTH_RET (next, 2, 0); | 189 | DECR_LENGTH_RET (next, 2, 0); |
190 | size = _gnutls_read_uint16 (&data[pos]); | 190 | size = mhd_gtls_read_uint16 (&data[pos]); |
191 | pos += 2; | 191 | pos += 2; |
192 | 192 | ||
193 | DECR_LENGTH_RET (next, size, 0); | 193 | DECR_LENGTH_RET (next, size, 0); |
194 | sdata = &data[pos]; | 194 | sdata = &data[pos]; |
195 | pos += size; | 195 | pos += size; |
196 | 196 | ||
197 | ext_recv = _gnutls_ext_func_recv (type, parse_type); | 197 | ext_recv = mhd_gtls_ext_func_recv (type, parse_type); |
198 | if (ext_recv == NULL) | 198 | if (ext_recv == NULL) |
199 | continue; | 199 | continue; |
200 | if ((ret = ext_recv (session, sdata, size)) < 0) | 200 | if ((ret = ext_recv (session, sdata, size)) < 0) |
@@ -215,7 +215,7 @@ _gnutls_parse_extensions (gnutls_session_t session, | |||
215 | * extensions are the ones we requested. | 215 | * extensions are the ones we requested. |
216 | */ | 216 | */ |
217 | static void | 217 | static void |
218 | _gnutls_extension_list_add (gnutls_session_t session, uint16_t type) | 218 | _gnutls_extension_list_add (mhd_gtls_session_t session, uint16_t type) |
219 | { | 219 | { |
220 | 220 | ||
221 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 221 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
@@ -234,15 +234,15 @@ _gnutls_extension_list_add (gnutls_session_t session, uint16_t type) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | int | 236 | int |
237 | _gnutls_gen_extensions (gnutls_session_t session, opaque * data, | 237 | mhd_gtls_gen_extensions (mhd_gtls_session_t session, opaque * data, |
238 | size_t data_size) | 238 | size_t data_size) |
239 | { | 239 | { |
240 | int size; | 240 | int size; |
241 | uint16_t pos = 0; | 241 | uint16_t pos = 0; |
242 | opaque *sdata; | 242 | opaque *sdata; |
243 | int sdata_size; | 243 | int sdata_size; |
244 | ext_send_func ext_send; | 244 | mhd_gtls_ext_send_func ext_send; |
245 | gnutls_extension_entry *p; | 245 | mhd_gtls_extension_entry *p; |
246 | 246 | ||
247 | if (data_size < 2) | 247 | if (data_size < 2) |
248 | { | 248 | { |
@@ -261,9 +261,9 @@ _gnutls_gen_extensions (gnutls_session_t session, opaque * data, | |||
261 | } | 261 | } |
262 | 262 | ||
263 | pos += 2; | 263 | pos += 2; |
264 | for (p = _gnutls_extensions; p->name != NULL; p++) | 264 | for (p = mhd_gtls_extensions; p->name != NULL; p++) |
265 | { | 265 | { |
266 | ext_send = _gnutls_ext_func_send (p->type); | 266 | ext_send = mhd_gtls_ext_func_send (p->type); |
267 | if (ext_send == NULL) | 267 | if (ext_send == NULL) |
268 | continue; | 268 | continue; |
269 | size = ext_send (session, sdata, sdata_size); | 269 | size = ext_send (session, sdata, sdata_size); |
@@ -277,11 +277,11 @@ _gnutls_gen_extensions (gnutls_session_t session, opaque * data, | |||
277 | } | 277 | } |
278 | 278 | ||
279 | /* write extension type */ | 279 | /* write extension type */ |
280 | _gnutls_write_uint16 (p->type, &data[pos]); | 280 | mhd_gtls_write_uint16 (p->type, &data[pos]); |
281 | pos += 2; | 281 | pos += 2; |
282 | 282 | ||
283 | /* write size */ | 283 | /* write size */ |
284 | _gnutls_write_uint16 (size, &data[pos]); | 284 | mhd_gtls_write_uint16 (size, &data[pos]); |
285 | pos += 2; | 285 | pos += 2; |
286 | 286 | ||
287 | memcpy (&data[pos], sdata, size); | 287 | memcpy (&data[pos], sdata, size); |
@@ -292,7 +292,7 @@ _gnutls_gen_extensions (gnutls_session_t session, opaque * data, | |||
292 | _gnutls_extension_list_add (session, p->type); | 292 | _gnutls_extension_list_add (session, p->type); |
293 | 293 | ||
294 | _gnutls_debug_log ("EXT[%x]: Sending extension %s\n", session, | 294 | _gnutls_debug_log ("EXT[%x]: Sending extension %s\n", session, |
295 | _gnutls_extension_get_name (p->type)); | 295 | mhd_gtls_extension_get_name (p->type)); |
296 | } | 296 | } |
297 | else if (size < 0) | 297 | else if (size < 0) |
298 | { | 298 | { |
@@ -305,7 +305,7 @@ _gnutls_gen_extensions (gnutls_session_t session, opaque * data, | |||
305 | size = pos; | 305 | size = pos; |
306 | pos -= 2; /* remove the size of the size header! */ | 306 | pos -= 2; /* remove the size of the size header! */ |
307 | 307 | ||
308 | _gnutls_write_uint16 (pos, data); | 308 | mhd_gtls_write_uint16 (pos, data); |
309 | 309 | ||
310 | if (size == 2) | 310 | if (size == 2) |
311 | { /* empty */ | 311 | { /* empty */ |
diff --git a/src/daemon/https/tls/gnutls_extensions.h b/src/daemon/https/tls/gnutls_extensions.h index c305846c..d5e209f8 100644 --- a/src/daemon/https/tls/gnutls_extensions.h +++ b/src/daemon/https/tls/gnutls_extensions.h | |||
@@ -24,22 +24,22 @@ | |||
24 | 24 | ||
25 | #include <gnutls_int.h> | 25 | #include <gnutls_int.h> |
26 | 26 | ||
27 | const char *_gnutls_extension_get_name (uint16_t type); | 27 | const char * mhd_gtls_extension_get_name (uint16_t type); |
28 | int _gnutls_parse_extensions (gnutls_session_t, tls_ext_parse_type_t, const opaque *, int); | 28 | int mhd_gtls_parse_extensions (mhd_gtls_session_t, mhd_gtls_ext_parse_type_t, const opaque *, int); |
29 | int _gnutls_gen_extensions (gnutls_session_t session, opaque * data, | 29 | int mhd_gtls_gen_extensions (mhd_gtls_session_t session, opaque * data, |
30 | size_t data_size); | 30 | size_t data_size); |
31 | 31 | ||
32 | typedef int (*ext_recv_func) (gnutls_session_t, const opaque *, size_t); /* recv data */ | 32 | typedef int (* mhd_gtls_ext_recv_func) (mhd_gtls_session_t, const opaque *, size_t); /* recv data */ |
33 | typedef int (*ext_send_func) (gnutls_session_t, opaque *, size_t); /* send data */ | 33 | typedef int (* mhd_gtls_ext_send_func) (mhd_gtls_session_t, opaque *, size_t); /* send data */ |
34 | 34 | ||
35 | ext_send_func _gnutls_ext_func_send (uint16_t type); | 35 | mhd_gtls_ext_send_func mhd_gtls_ext_func_send (uint16_t type); |
36 | ext_recv_func _gnutls_ext_func_recv (uint16_t type, tls_ext_parse_type_t); | 36 | mhd_gtls_ext_recv_func mhd_gtls_ext_func_recv (uint16_t type, mhd_gtls_ext_parse_type_t); |
37 | 37 | ||
38 | typedef struct | 38 | typedef struct |
39 | { | 39 | { |
40 | const char *name; | 40 | const char *name; |
41 | uint16_t type; | 41 | uint16_t type; |
42 | tls_ext_parse_type_t parse_type; | 42 | mhd_gtls_ext_parse_type_t parse_type; |
43 | ext_recv_func gnutls_ext_func_recv; | 43 | mhd_gtls_ext_recv_func gnutls_ext_func_recv; |
44 | ext_send_func gnutls_ext_func_send; | 44 | mhd_gtls_ext_send_func gnutls_ext_func_send; |
45 | } gnutls_extension_entry; | 45 | } mhd_gtls_extension_entry; |
diff --git a/src/daemon/https/tls/gnutls_extra_hooks.h b/src/daemon/https/tls/gnutls_extra_hooks.h index ac55d06a..b4e83bad 100644 --- a/src/daemon/https/tls/gnutls_extra_hooks.h +++ b/src/daemon/https/tls/gnutls_extra_hooks.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <auth_cert.h> | 29 | #include <auth_cert.h> |
30 | 30 | ||
31 | typedef int (*_gnutls_openpgp_verify_key_func) | 31 | typedef int (*_gnutls_openpgp_verify_key_func) |
32 | (const gnutls_certificate_credentials_t, | 32 | (const mhd_gtls_cert_credentials_t, |
33 | const gnutls_datum_t *, int, | 33 | const gnutls_datum_t *, int, |
34 | unsigned int *); | 34 | unsigned int *); |
35 | 35 | ||
@@ -40,8 +40,8 @@ typedef time_t (*_gnutls_openpgp_crt_expiration_time_func) | |||
40 | (const gnutls_datum_t *); | 40 | (const gnutls_datum_t *); |
41 | 41 | ||
42 | typedef int (*_gnutls_openpgp_crt_request_func) | 42 | typedef int (*_gnutls_openpgp_crt_request_func) |
43 | (gnutls_session_t, gnutls_datum_t *, | 43 | (mhd_gtls_session_t, gnutls_datum_t *, |
44 | const gnutls_certificate_credentials_t, | 44 | const mhd_gtls_cert_credentials_t, |
45 | opaque *, int); | 45 | opaque *, int); |
46 | 46 | ||
47 | typedef int (*_gnutls_openpgp_fingerprint_func) | 47 | typedef int (*_gnutls_openpgp_fingerprint_func) |
diff --git a/src/daemon/https/tls/gnutls_global.c b/src/daemon/https/tls/gnutls_global.c index 5df0619b..916e8117 100644 --- a/src/daemon/https/tls/gnutls_global.c +++ b/src/daemon/https/tls/gnutls_global.c | |||
@@ -59,7 +59,7 @@ ASN1_TYPE _gnutls_pkix1_asn; | |||
59 | ASN1_TYPE _gnutls_gnutls_asn; | 59 | ASN1_TYPE _gnutls_gnutls_asn; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * gnutls_global_set_log_function - This function sets the logging function | 62 | * MHD_gtls_global_set_log_function - This function sets the logging function |
63 | * @log_func: it's a log function | 63 | * @log_func: it's a log function |
64 | * | 64 | * |
65 | * This is the function where you set the logging function gnutls | 65 | * This is the function where you set the logging function gnutls |
@@ -71,13 +71,13 @@ ASN1_TYPE _gnutls_gnutls_asn; | |||
71 | * void (*gnutls_log_func)( int level, const char*); | 71 | * void (*gnutls_log_func)( int level, const char*); |
72 | **/ | 72 | **/ |
73 | void | 73 | void |
74 | gnutls_global_set_log_function (gnutls_log_func log_func) | 74 | MHD_gtls_global_set_log_function (gnutls_log_func log_func) |
75 | { | 75 | { |
76 | _gnutls_log_func = log_func; | 76 | _gnutls_log_func = log_func; |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * gnutls_global_set_log_level - This function sets the logging level | 80 | * MHD_gtls_global_set_log_level - This function sets the logging level |
81 | * @level: it's an integer from 0 to 9. | 81 | * @level: it's an integer from 0 to 9. |
82 | * | 82 | * |
83 | * This is the function that allows you to set the log level. | 83 | * This is the function that allows you to set the log level. |
@@ -89,7 +89,7 @@ gnutls_global_set_log_function (gnutls_log_func log_func) | |||
89 | * | 89 | * |
90 | **/ | 90 | **/ |
91 | void | 91 | void |
92 | gnutls_global_set_log_level (int level) | 92 | MHD_gtls_global_set_log_level (int level) |
93 | { | 93 | { |
94 | _gnutls_log_level = level; | 94 | _gnutls_log_level = level; |
95 | } | 95 | } |
@@ -105,7 +105,7 @@ extern void *(*gnutls_calloc) (size_t, size_t); | |||
105 | int _gnutls_is_secure_mem_null (const void *); | 105 | int _gnutls_is_secure_mem_null (const void *); |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * gnutls_global_set_mem_functions - This function sets the memory allocation functions | 108 | * MHD_gtls_global_set_mem_functions - This function sets the memory allocation functions |
109 | * @alloc_func: it's the default memory allocation function. Like malloc(). | 109 | * @alloc_func: it's the default memory allocation function. Like malloc(). |
110 | * @secure_alloc_func: This is the memory allocation function that will be used for sensitive data. | 110 | * @secure_alloc_func: This is the memory allocation function that will be used for sensitive data. |
111 | * @is_secure_func: a function that returns 0 if the memory given is not secure. May be NULL. | 111 | * @is_secure_func: a function that returns 0 if the memory given is not secure. May be NULL. |
@@ -118,17 +118,16 @@ int _gnutls_is_secure_mem_null (const void *); | |||
118 | * This function is provided to set the memory allocation functions to | 118 | * This function is provided to set the memory allocation functions to |
119 | * something other than the defaults (ie the gcrypt allocation functions). | 119 | * something other than the defaults (ie the gcrypt allocation functions). |
120 | * | 120 | * |
121 | * This function must be called before gnutls_global_init() is called. | 121 | * This function must be called before MHD_gnutls_global_init() is called. |
122 | * | 122 | * |
123 | **/ | 123 | **/ |
124 | void | 124 | void MHD_gtls_global_set_mem_functions(gnutls_alloc_function alloc_func, |
125 | gnutls_global_set_mem_functions (gnutls_alloc_function alloc_func, | 125 | gnutls_alloc_function |
126 | gnutls_alloc_function | 126 | secure_alloc_func, |
127 | secure_alloc_func, | 127 | gnutls_is_secure_function |
128 | gnutls_is_secure_function | 128 | is_secure_func, |
129 | is_secure_func, | 129 | gnutls_realloc_function realloc_func, |
130 | gnutls_realloc_function realloc_func, | 130 | gnutls_free_function free_func) |
131 | gnutls_free_function free_func) | ||
132 | { | 131 | { |
133 | gnutls_secure_malloc = secure_alloc_func; | 132 | gnutls_secure_malloc = secure_alloc_func; |
134 | gnutls_malloc = alloc_func; | 133 | gnutls_malloc = alloc_func; |
@@ -148,10 +147,10 @@ gnutls_global_set_mem_functions (gnutls_alloc_function alloc_func, | |||
148 | gnutls_calloc = calloc; | 147 | gnutls_calloc = calloc; |
149 | } | 148 | } |
150 | else | 149 | else |
151 | { /* use the included ones */ | 150 | { /* use the included ones */ |
152 | gnutls_calloc = _gnutls_calloc; | 151 | gnutls_calloc = mhd_gtls_calloc; |
153 | } | 152 | } |
154 | gnutls_strdup = _gnutls_strdup; | 153 | gnutls_strdup = mhd_gtls_strdup; |
155 | 154 | ||
156 | } | 155 | } |
157 | 156 | ||
@@ -167,12 +166,12 @@ _gnutls_gcry_log_handler (void *dummy, int level, | |||
167 | static int _gnutls_init = 0; | 166 | static int _gnutls_init = 0; |
168 | 167 | ||
169 | /** | 168 | /** |
170 | * gnutls_global_init - This function initializes the global data to defaults. | 169 | * MHD_gnutls_global_init - This function initializes the global data to defaults. |
171 | * | 170 | * |
172 | * This function initializes the global data to defaults. | 171 | * This function initializes the global data to defaults. |
173 | * Every gnutls application has a global data which holds common parameters | 172 | * Every gnutls application has a global data which holds common parameters |
174 | * shared by gnutls session structures. | 173 | * shared by gnutls session structures. |
175 | * You must call gnutls_global_deinit() when gnutls usage is no longer needed | 174 | * You must call MHD_gnutls_global_deinit() when gnutls usage is no longer needed |
176 | * Returns zero on success. | 175 | * Returns zero on success. |
177 | * | 176 | * |
178 | * Note that this function will also initialize libgcrypt, if it has not | 177 | * Note that this function will also initialize libgcrypt, if it has not |
@@ -181,8 +180,8 @@ static int _gnutls_init = 0; | |||
181 | * want to disable libgcrypt's internal lockings etc. | 180 | * want to disable libgcrypt's internal lockings etc. |
182 | * | 181 | * |
183 | * This function increment a global counter, so that | 182 | * This function increment a global counter, so that |
184 | * gnutls_global_deinit() only releases resources when it has been | 183 | * MHD_gnutls_global_deinit() only releases resources when it has been |
185 | * called as many times as gnutls_global_init(). This is useful when | 184 | * called as many times as MHD_gnutls_global_init(). This is useful when |
186 | * GnuTLS is used by more than one library in an application. This | 185 | * GnuTLS is used by more than one library in an application. This |
187 | * function can be called many times, but will only do something the | 186 | * function can be called many times, but will only do something the |
188 | * first time. | 187 | * first time. |
@@ -197,7 +196,7 @@ static int _gnutls_init = 0; | |||
197 | * | 196 | * |
198 | **/ | 197 | **/ |
199 | int | 198 | int |
200 | gnutls_global_init (void) | 199 | MHD_gnutls_global_init (void) |
201 | { | 200 | { |
202 | int result = 0; | 201 | int result = 0; |
203 | int res; | 202 | int res; |
@@ -279,7 +278,7 @@ gnutls_global_init (void) | |||
279 | } | 278 | } |
280 | 279 | ||
281 | #ifdef DEBUG | 280 | #ifdef DEBUG |
282 | gnutls_global_set_log_function (MHD_tls_log_func); | 281 | MHD_gtls_global_set_log_function (MHD_tls_log_func); |
283 | #endif | 282 | #endif |
284 | 283 | ||
285 | /* initialize parser | 284 | /* initialize parser |
@@ -308,17 +307,17 @@ gnutls_global_init (void) | |||
308 | } | 307 | } |
309 | 308 | ||
310 | /** | 309 | /** |
311 | * gnutls_global_deinit - This function deinitializes the global data | 310 | * MHD_gnutls_global_deinit - This function deinitializes the global data |
312 | * | 311 | * |
313 | * This function deinitializes the global data, that were initialized | 312 | * This function deinitializes the global data, that were initialized |
314 | * using gnutls_global_init(). | 313 | * using MHD_gnutls_global_init(). |
315 | * | 314 | * |
316 | * Note! This function is not thread safe. See the discussion for | 315 | * Note! This function is not thread safe. See the discussion for |
317 | * gnutls_global_init() for more information. | 316 | * MHD_gnutls_global_init() for more information. |
318 | * | 317 | * |
319 | **/ | 318 | **/ |
320 | void | 319 | void |
321 | gnutls_global_deinit (void) | 320 | MHD_gnutls_global_deinit (void) |
322 | { | 321 | { |
323 | if (_gnutls_init == 1) | 322 | if (_gnutls_init == 1) |
324 | { | 323 | { |
@@ -337,7 +336,7 @@ gnutls_global_deinit (void) | |||
337 | */ | 336 | */ |
338 | 337 | ||
339 | /** | 338 | /** |
340 | * gnutls_transport_set_pull_function - This function sets a read like function | 339 | * MHD_gnutls_transport_set_pull_function - This function sets a read like function |
341 | * @pull_func: a callback function similar to read() | 340 | * @pull_func: a callback function similar to read() |
342 | * @session: gnutls session | 341 | * @session: gnutls session |
343 | * | 342 | * |
@@ -347,17 +346,17 @@ gnutls_global_deinit (void) | |||
347 | * probably be ok. | 346 | * probably be ok. |
348 | * | 347 | * |
349 | * PULL_FUNC is of the form, | 348 | * PULL_FUNC is of the form, |
350 | * ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t); | 349 | * ssize_t (*mhd_gtls_pull_func)(gnutls_transport_ptr_t, void*, size_t); |
351 | **/ | 350 | **/ |
352 | void | 351 | void |
353 | gnutls_transport_set_pull_function (gnutls_session_t session, | 352 | MHD_gnutls_transport_set_pull_function (mhd_gtls_session_t session, |
354 | gnutls_pull_func pull_func) | 353 | mhd_gtls_pull_func pull_func) |
355 | { | 354 | { |
356 | session->internals._gnutls_pull_func = pull_func; | 355 | session->internals._gnutls_pull_func = pull_func; |
357 | } | 356 | } |
358 | 357 | ||
359 | /** | 358 | /** |
360 | * gnutls_transport_set_push_function - This function sets the function to send data | 359 | * MHD_gnutls_transport_set_push_function - This function sets the function to send data |
361 | * @push_func: a callback function similar to write() | 360 | * @push_func: a callback function similar to write() |
362 | * @session: gnutls session | 361 | * @session: gnutls session |
363 | * | 362 | * |
@@ -368,11 +367,11 @@ gnutls_transport_set_pull_function (gnutls_session_t session, | |||
368 | * specify this function for gnutls to be able to send data. | 367 | * specify this function for gnutls to be able to send data. |
369 | * | 368 | * |
370 | * PUSH_FUNC is of the form, | 369 | * PUSH_FUNC is of the form, |
371 | * ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t); | 370 | * ssize_t (*mhd_gtls_push_func)(gnutls_transport_ptr_t, const void*, size_t); |
372 | **/ | 371 | **/ |
373 | void | 372 | void |
374 | gnutls_transport_set_push_function (gnutls_session_t session, | 373 | MHD_gnutls_transport_set_push_function (mhd_gtls_session_t session, |
375 | gnutls_push_func push_func) | 374 | mhd_gtls_push_func push_func) |
376 | { | 375 | { |
377 | session->internals._gnutls_push_func = push_func; | 376 | session->internals._gnutls_push_func = push_func; |
378 | } | 377 | } |
diff --git a/src/daemon/https/tls/gnutls_global.h b/src/daemon/https/tls/gnutls_global.h index 4a9488fd..7ec40882 100644 --- a/src/daemon/https/tls/gnutls_global.h +++ b/src/daemon/https/tls/gnutls_global.h | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <libtasn1.h> | 28 | #include <libtasn1.h> |
29 | 29 | ||
30 | /* this mutex is used to synchronize threads attemting call gnutls_global_init / gnutls_global_deinit */ | 30 | /* this mutex is used to synchronize threads attemting call MHD_gnutls_global_init / MHD_gnutls_global_deinit */ |
31 | pthread_mutex_t gnutls_init_mutex; | 31 | pthread_mutex_t gnutls_init_mutex; |
32 | 32 | ||
33 | int gnutls_is_secure_memory (const void *mem); | 33 | int gnutls_is_secure_memory (const void *mem); |
diff --git a/src/daemon/https/tls/gnutls_handshake.c b/src/daemon/https/tls/gnutls_handshake.c index 5f56822e..882b43e2 100644 --- a/src/daemon/https/tls/gnutls_handshake.c +++ b/src/daemon/https/tls/gnutls_handshake.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "gnutls_record.h" | 46 | #include "gnutls_record.h" |
47 | #include "gnutls_state.h" | 47 | #include "gnutls_state.h" |
48 | #include "gnutls_rsa_export.h" /* for gnutls_get_rsa_params() */ | 48 | #include "gnutls_rsa_export.h" /* for gnutls_get_rsa_params() */ |
49 | #include "auth_anon.h" /* for gnutls_anon_server_credentials_t */ | 49 | #include "auth_anon.h" /* for mhd_gtls_anon_server_credentials_t */ |
50 | #include "gc.h" | 50 | #include "gc.h" |
51 | 51 | ||
52 | #ifdef HANDSHAKE_DEBUG | 52 | #ifdef HANDSHAKE_DEBUG |
@@ -58,20 +58,20 @@ | |||
58 | #define TRUE 1 | 58 | #define TRUE 1 |
59 | #define FALSE 0 | 59 | #define FALSE 0 |
60 | 60 | ||
61 | int _gnutls_server_select_comp_method (gnutls_session_t session, | 61 | int _gnutls_server_select_comp_method (mhd_gtls_session_t session, |
62 | opaque * data, int datalen); | 62 | opaque * data, int datalen); |
63 | 63 | ||
64 | 64 | ||
65 | /* Clears the handshake hash buffers and handles. | 65 | /* Clears the handshake hash buffers and handles. |
66 | */ | 66 | */ |
67 | inline static void | 67 | inline static void |
68 | _gnutls_handshake_hash_buffers_clear (gnutls_session_t session) | 68 | _gnutls_handshake_hash_buffers_clear (mhd_gtls_session_t session) |
69 | { | 69 | { |
70 | _gnutls_hash_deinit (session->internals.handshake_mac_handle_md5, NULL); | 70 | mhd_gnutls_hash_deinit (session->internals.handshake_mac_handle_md5, NULL); |
71 | _gnutls_hash_deinit (session->internals.handshake_mac_handle_sha, NULL); | 71 | mhd_gnutls_hash_deinit (session->internals.handshake_mac_handle_sha, NULL); |
72 | session->internals.handshake_mac_handle_md5 = NULL; | 72 | session->internals.handshake_mac_handle_md5 = NULL; |
73 | session->internals.handshake_mac_handle_sha = NULL; | 73 | session->internals.handshake_mac_handle_sha = NULL; |
74 | _gnutls_handshake_buffer_clear (session); | 74 | mhd_gtls_handshake_buffer_clear (session); |
75 | } | 75 | } |
76 | 76 | ||
77 | /* this will copy the required values for resuming to | 77 | /* this will copy the required values for resuming to |
@@ -79,7 +79,7 @@ _gnutls_handshake_hash_buffers_clear (gnutls_session_t session) | |||
79 | * this will keep as less data to security_parameters. | 79 | * this will keep as less data to security_parameters. |
80 | */ | 80 | */ |
81 | static void | 81 | static void |
82 | resume_copy_required_values (gnutls_session_t session) | 82 | resume_copy_required_values (mhd_gtls_session_t session) |
83 | { | 83 | { |
84 | /* get the new random values */ | 84 | /* get the new random values */ |
85 | memcpy (session->internals.resumed_security_parameters. | 85 | memcpy (session->internals.resumed_security_parameters. |
@@ -107,7 +107,7 @@ resume_copy_required_values (gnutls_session_t session) | |||
107 | session->security_parameters.entity = | 107 | session->security_parameters.entity = |
108 | session->internals.resumed_security_parameters.entity; | 108 | session->internals.resumed_security_parameters.entity; |
109 | 109 | ||
110 | _gnutls_set_current_version (session, | 110 | mhd_gtls_set_current_version (session, |
111 | session->internals. | 111 | session->internals. |
112 | resumed_security_parameters.version); | 112 | resumed_security_parameters.version); |
113 | 113 | ||
@@ -122,13 +122,13 @@ resume_copy_required_values (gnutls_session_t session) | |||
122 | } | 122 | } |
123 | 123 | ||
124 | void | 124 | void |
125 | _gnutls_set_server_random (gnutls_session_t session, uint8_t * rnd) | 125 | mhd_gtls_set_server_random (mhd_gtls_session_t session, uint8_t * rnd) |
126 | { | 126 | { |
127 | memcpy (session->security_parameters.server_random, rnd, TLS_RANDOM_SIZE); | 127 | memcpy (session->security_parameters.server_random, rnd, TLS_RANDOM_SIZE); |
128 | } | 128 | } |
129 | 129 | ||
130 | void | 130 | void |
131 | _gnutls_set_client_random (gnutls_session_t session, uint8_t * rnd) | 131 | mhd_gtls_set_client_random (mhd_gtls_session_t session, uint8_t * rnd) |
132 | { | 132 | { |
133 | memcpy (session->security_parameters.client_random, rnd, TLS_RANDOM_SIZE); | 133 | memcpy (session->security_parameters.client_random, rnd, TLS_RANDOM_SIZE); |
134 | } | 134 | } |
@@ -138,25 +138,25 @@ _gnutls_set_client_random (gnutls_session_t session, uint8_t * rnd) | |||
138 | #define SSL3_SERVER_MSG "SRVR" | 138 | #define SSL3_SERVER_MSG "SRVR" |
139 | #define SSL_MSG_LEN 4 | 139 | #define SSL_MSG_LEN 4 |
140 | static int | 140 | static int |
141 | _gnutls_ssl3_finished (gnutls_session_t session, int type, opaque * ret) | 141 | _gnutls_ssl3_finished (mhd_gtls_session_t session, int type, opaque * ret) |
142 | { | 142 | { |
143 | const int siz = SSL_MSG_LEN; | 143 | const int siz = SSL_MSG_LEN; |
144 | mac_hd_t td_md5; | 144 | mac_hd_t td_md5; |
145 | mac_hd_t td_sha; | 145 | mac_hd_t td_sha; |
146 | const char *mesg; | 146 | const char *mesg; |
147 | 147 | ||
148 | td_md5 = _gnutls_hash_copy (session->internals.handshake_mac_handle_md5); | 148 | td_md5 = mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_md5); |
149 | if (td_md5 == NULL) | 149 | if (td_md5 == NULL) |
150 | { | 150 | { |
151 | gnutls_assert (); | 151 | gnutls_assert (); |
152 | return GNUTLS_E_HASH_FAILED; | 152 | return GNUTLS_E_HASH_FAILED; |
153 | } | 153 | } |
154 | 154 | ||
155 | td_sha = _gnutls_hash_copy (session->internals.handshake_mac_handle_sha); | 155 | td_sha = mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_sha); |
156 | if (td_sha == NULL) | 156 | if (td_sha == NULL) |
157 | { | 157 | { |
158 | gnutls_assert (); | 158 | gnutls_assert (); |
159 | _gnutls_hash_deinit (td_md5, NULL); | 159 | mhd_gnutls_hash_deinit (td_md5, NULL); |
160 | return GNUTLS_E_HASH_FAILED; | 160 | return GNUTLS_E_HASH_FAILED; |
161 | } | 161 | } |
162 | 162 | ||
@@ -169,13 +169,13 @@ _gnutls_ssl3_finished (gnutls_session_t session, int type, opaque * ret) | |||
169 | mesg = SSL3_CLIENT_MSG; | 169 | mesg = SSL3_CLIENT_MSG; |
170 | } | 170 | } |
171 | 171 | ||
172 | _gnutls_hash (td_md5, mesg, siz); | 172 | mhd_gnutls_hash (td_md5, mesg, siz); |
173 | _gnutls_hash (td_sha, mesg, siz); | 173 | mhd_gnutls_hash (td_sha, mesg, siz); |
174 | 174 | ||
175 | _gnutls_mac_deinit_ssl3_handshake (td_md5, ret, | 175 | mhd_gnutls_mac_deinit_ssl3_handshake (td_md5, ret, |
176 | session->security_parameters. | 176 | session->security_parameters. |
177 | master_secret, TLS_MASTER_SIZE); | 177 | master_secret, TLS_MASTER_SIZE); |
178 | _gnutls_mac_deinit_ssl3_handshake (td_sha, &ret[16], | 178 | mhd_gnutls_mac_deinit_ssl3_handshake (td_sha, &ret[16], |
179 | session->security_parameters. | 179 | session->security_parameters. |
180 | master_secret, TLS_MASTER_SIZE); | 180 | master_secret, TLS_MASTER_SIZE); |
181 | 181 | ||
@@ -187,7 +187,7 @@ _gnutls_ssl3_finished (gnutls_session_t session, int type, opaque * ret) | |||
187 | #define CLIENT_MSG "client finished" | 187 | #define CLIENT_MSG "client finished" |
188 | #define TLS_MSG_LEN 15 | 188 | #define TLS_MSG_LEN 15 |
189 | int | 189 | int |
190 | _gnutls_finished (gnutls_session_t session, int type, void *ret) | 190 | _gnutls_finished (mhd_gtls_session_t session, int type, void *ret) |
191 | { | 191 | { |
192 | const int siz = TLS_MSG_LEN; | 192 | const int siz = TLS_MSG_LEN; |
193 | opaque concat[36]; | 193 | opaque concat[36]; |
@@ -195,12 +195,12 @@ _gnutls_finished (gnutls_session_t session, int type, void *ret) | |||
195 | const char *mesg; | 195 | const char *mesg; |
196 | mac_hd_t td_md5 = NULL; | 196 | mac_hd_t td_md5 = NULL; |
197 | mac_hd_t td_sha; | 197 | mac_hd_t td_sha; |
198 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 198 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
199 | 199 | ||
200 | if (ver < MHD_GNUTLS_TLS1_2) | 200 | if (ver < MHD_GNUTLS_TLS1_2) |
201 | { | 201 | { |
202 | td_md5 = | 202 | td_md5 = |
203 | _gnutls_hash_copy (session->internals.handshake_mac_handle_md5); | 203 | mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_md5); |
204 | if (td_md5 == NULL) | 204 | if (td_md5 == NULL) |
205 | { | 205 | { |
206 | gnutls_assert (); | 206 | gnutls_assert (); |
@@ -208,23 +208,23 @@ _gnutls_finished (gnutls_session_t session, int type, void *ret) | |||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | td_sha = _gnutls_hash_copy (session->internals.handshake_mac_handle_sha); | 211 | td_sha = mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_sha); |
212 | if (td_sha == NULL) | 212 | if (td_sha == NULL) |
213 | { | 213 | { |
214 | gnutls_assert (); | 214 | gnutls_assert (); |
215 | _gnutls_hash_deinit (td_md5, NULL); | 215 | mhd_gnutls_hash_deinit (td_md5, NULL); |
216 | return GNUTLS_E_HASH_FAILED; | 216 | return GNUTLS_E_HASH_FAILED; |
217 | } | 217 | } |
218 | 218 | ||
219 | if (ver < MHD_GNUTLS_TLS1_2) | 219 | if (ver < MHD_GNUTLS_TLS1_2) |
220 | { | 220 | { |
221 | _gnutls_hash_deinit (td_md5, concat); | 221 | mhd_gnutls_hash_deinit (td_md5, concat); |
222 | _gnutls_hash_deinit (td_sha, &concat[16]); | 222 | mhd_gnutls_hash_deinit (td_sha, &concat[16]); |
223 | len = 20 + 16; | 223 | len = 20 + 16; |
224 | } | 224 | } |
225 | else | 225 | else |
226 | { | 226 | { |
227 | _gnutls_hash_deinit (td_sha, concat); | 227 | mhd_gnutls_hash_deinit (td_sha, concat); |
228 | len = 20; | 228 | len = 20; |
229 | } | 229 | } |
230 | 230 | ||
@@ -237,7 +237,7 @@ _gnutls_finished (gnutls_session_t session, int type, void *ret) | |||
237 | mesg = CLIENT_MSG; | 237 | mesg = CLIENT_MSG; |
238 | } | 238 | } |
239 | 239 | ||
240 | return _gnutls_PRF (session, session->security_parameters.master_secret, | 240 | return mhd_gtls_PRF (session, session->security_parameters.master_secret, |
241 | TLS_MASTER_SIZE, mesg, siz, concat, len, 12, ret); | 241 | TLS_MASTER_SIZE, mesg, siz, concat, len, 12, ret); |
242 | } | 242 | } |
243 | 243 | ||
@@ -245,7 +245,7 @@ _gnutls_finished (gnutls_session_t session, int type, void *ret) | |||
245 | * and put it to dst. | 245 | * and put it to dst. |
246 | */ | 246 | */ |
247 | int | 247 | int |
248 | _gnutls_tls_create_random (opaque * dst) | 248 | mhd_gtls_tls_create_random (opaque * dst) |
249 | { | 249 | { |
250 | uint32_t tim; | 250 | uint32_t tim; |
251 | 251 | ||
@@ -256,7 +256,7 @@ _gnutls_tls_create_random (opaque * dst) | |||
256 | 256 | ||
257 | tim = time (NULL); | 257 | tim = time (NULL); |
258 | /* generate server random value */ | 258 | /* generate server random value */ |
259 | _gnutls_write_uint32 (tim, dst); | 259 | mhd_gtls_write_uint32 (tim, dst); |
260 | 260 | ||
261 | if (gc_nonce (&dst[4], TLS_RANDOM_SIZE - 4) != GC_OK) | 261 | if (gc_nonce (&dst[4], TLS_RANDOM_SIZE - 4) != GC_OK) |
262 | { | 262 | { |
@@ -270,18 +270,18 @@ _gnutls_tls_create_random (opaque * dst) | |||
270 | /* returns the 0 on success or a negative value. | 270 | /* returns the 0 on success or a negative value. |
271 | */ | 271 | */ |
272 | int | 272 | int |
273 | _gnutls_negotiate_version (gnutls_session_t session, | 273 | mhd_gtls_negotiate_version (mhd_gtls_session_t session, |
274 | gnutls_protocol_t adv_version) | 274 | gnutls_protocol_t adv_version) |
275 | { | 275 | { |
276 | int ret; | 276 | int ret; |
277 | 277 | ||
278 | /* if we do not support that version */ | 278 | /* if we do not support that version */ |
279 | if (_gnutls_version_is_supported (session, adv_version) == 0) | 279 | if (mhd_gtls_version_is_supported (session, adv_version) == 0) |
280 | { | 280 | { |
281 | /* If he requested something we do not support | 281 | /* If he requested something we do not support |
282 | * then we send him the highest we support. | 282 | * then we send him the highest we support. |
283 | */ | 283 | */ |
284 | ret = _gnutls_version_max (session); | 284 | ret = mhd_gtls_version_max (session); |
285 | if (ret == MHD_GNUTLS_VERSION_UNKNOWN) | 285 | if (ret == MHD_GNUTLS_VERSION_UNKNOWN) |
286 | { | 286 | { |
287 | /* this check is not really needed. | 287 | /* this check is not really needed. |
@@ -295,13 +295,13 @@ _gnutls_negotiate_version (gnutls_session_t session, | |||
295 | ret = adv_version; | 295 | ret = adv_version; |
296 | } | 296 | } |
297 | 297 | ||
298 | _gnutls_set_current_version (session, ret); | 298 | mhd_gtls_set_current_version (session, ret); |
299 | 299 | ||
300 | return ret; | 300 | return ret; |
301 | } | 301 | } |
302 | 302 | ||
303 | int | 303 | int |
304 | _gnutls_user_hello_func (gnutls_session session, | 304 | mhd_gtls_user_hello_func (gnutls_session session, |
305 | gnutls_protocol_t adv_version) | 305 | gnutls_protocol_t adv_version) |
306 | { | 306 | { |
307 | int ret; | 307 | int ret; |
@@ -317,7 +317,7 @@ _gnutls_user_hello_func (gnutls_session session, | |||
317 | /* Here we need to renegotiate the version since the callee might | 317 | /* Here we need to renegotiate the version since the callee might |
318 | * have disabled some TLS versions. | 318 | * have disabled some TLS versions. |
319 | */ | 319 | */ |
320 | ret = _gnutls_negotiate_version (session, adv_version); | 320 | ret = mhd_gtls_negotiate_version (session, adv_version); |
321 | if (ret < 0) | 321 | if (ret < 0) |
322 | { | 322 | { |
323 | gnutls_assert (); | 323 | gnutls_assert (); |
@@ -333,7 +333,7 @@ _gnutls_user_hello_func (gnutls_session session, | |||
333 | * since SSL version 2.0 is not supported). | 333 | * since SSL version 2.0 is not supported). |
334 | */ | 334 | */ |
335 | int | 335 | int |
336 | _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | 336 | _gnutls_read_client_hello (mhd_gtls_session_t session, opaque * data, |
337 | int datalen) | 337 | int datalen) |
338 | { | 338 | { |
339 | uint8_t session_id_len; | 339 | uint8_t session_id_len; |
@@ -349,11 +349,11 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
349 | _gnutls_handshake_log ("HSK[%x]: Client's version: %d.%d\n", session, | 349 | _gnutls_handshake_log ("HSK[%x]: Client's version: %d.%d\n", session, |
350 | data[pos], data[pos + 1]); | 350 | data[pos], data[pos + 1]); |
351 | 351 | ||
352 | adv_version = _gnutls_version_get (data[pos], data[pos + 1]); | 352 | adv_version = mhd_gtls_version_get (data[pos], data[pos + 1]); |
353 | set_adv_version (session, data[pos], data[pos + 1]); | 353 | set_adv_version (session, data[pos], data[pos + 1]); |
354 | pos += 2; | 354 | pos += 2; |
355 | 355 | ||
356 | neg_version = _gnutls_negotiate_version (session, adv_version); | 356 | neg_version = mhd_gtls_negotiate_version (session, adv_version); |
357 | if (neg_version < 0) | 357 | if (neg_version < 0) |
358 | { | 358 | { |
359 | gnutls_assert (); | 359 | gnutls_assert (); |
@@ -363,11 +363,11 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
363 | /* Read client random value. | 363 | /* Read client random value. |
364 | */ | 364 | */ |
365 | DECR_LEN (len, TLS_RANDOM_SIZE); | 365 | DECR_LEN (len, TLS_RANDOM_SIZE); |
366 | _gnutls_set_client_random (session, &data[pos]); | 366 | mhd_gtls_set_client_random (session, &data[pos]); |
367 | pos += TLS_RANDOM_SIZE; | 367 | pos += TLS_RANDOM_SIZE; |
368 | 368 | ||
369 | _gnutls_tls_create_random (rnd); | 369 | mhd_gtls_tls_create_random (rnd); |
370 | _gnutls_set_server_random (session, rnd); | 370 | mhd_gtls_set_server_random (session, rnd); |
371 | 371 | ||
372 | session->security_parameters.timestamp = time (NULL); | 372 | session->security_parameters.timestamp = time (NULL); |
373 | 373 | ||
@@ -389,11 +389,11 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
389 | { /* resumed! */ | 389 | { /* resumed! */ |
390 | resume_copy_required_values (session); | 390 | resume_copy_required_values (session); |
391 | session->internals.resumed = RESUME_TRUE; | 391 | session->internals.resumed = RESUME_TRUE; |
392 | return _gnutls_user_hello_func (session, adv_version); | 392 | return mhd_gtls_user_hello_func (session, adv_version); |
393 | } | 393 | } |
394 | else | 394 | else |
395 | { | 395 | { |
396 | _gnutls_generate_session_id (session->security_parameters. | 396 | mhd_gtls_generate_session_id (session->security_parameters. |
397 | session_id, | 397 | session_id, |
398 | &session->security_parameters. | 398 | &session->security_parameters. |
399 | session_id_size); | 399 | session_id_size); |
@@ -404,7 +404,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
404 | /* Remember ciphersuites for later | 404 | /* Remember ciphersuites for later |
405 | */ | 405 | */ |
406 | DECR_LEN (len, 2); | 406 | DECR_LEN (len, 2); |
407 | suite_size = _gnutls_read_uint16 (&data[pos]); | 407 | suite_size = mhd_gtls_read_uint16 (&data[pos]); |
408 | pos += 2; | 408 | pos += 2; |
409 | 409 | ||
410 | DECR_LEN (len, suite_size); | 410 | DECR_LEN (len, suite_size); |
@@ -424,7 +424,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
424 | */ | 424 | */ |
425 | if (neg_version >= MHD_GNUTLS_TLS1_0) | 425 | if (neg_version >= MHD_GNUTLS_TLS1_0) |
426 | { | 426 | { |
427 | ret = _gnutls_parse_extensions (session, EXTENSION_APPLICATION, &data[pos], len); /* len is the rest of the parsed length */ | 427 | ret = mhd_gtls_parse_extensions (session, EXTENSION_APPLICATION, &data[pos], len); /* len is the rest of the parsed length */ |
428 | if (ret < 0) | 428 | if (ret < 0) |
429 | { | 429 | { |
430 | gnutls_assert (); | 430 | gnutls_assert (); |
@@ -432,7 +432,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | ret = _gnutls_user_hello_func (session, adv_version); | 435 | ret = mhd_gtls_user_hello_func (session, adv_version); |
436 | if (ret < 0) | 436 | if (ret < 0) |
437 | { | 437 | { |
438 | gnutls_assert (); | 438 | gnutls_assert (); |
@@ -441,7 +441,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
441 | 441 | ||
442 | if (neg_version >= MHD_GNUTLS_TLS1_0) | 442 | if (neg_version >= MHD_GNUTLS_TLS1_0) |
443 | { | 443 | { |
444 | ret = _gnutls_parse_extensions (session, EXTENSION_TLS, &data[pos], len); /* len is the rest of the parsed length */ | 444 | ret = mhd_gtls_parse_extensions (session, EXTENSION_TLS, &data[pos], len); /* len is the rest of the parsed length */ |
445 | if (ret < 0) | 445 | if (ret < 0) |
446 | { | 446 | { |
447 | gnutls_assert (); | 447 | gnutls_assert (); |
@@ -451,7 +451,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
451 | 451 | ||
452 | /* select an appropriate cipher suite | 452 | /* select an appropriate cipher suite |
453 | */ | 453 | */ |
454 | ret = _gnutls_server_select_suite (session, suite_ptr, suite_size); | 454 | ret = mhd_gtls_server_select_suite (session, suite_ptr, suite_size); |
455 | if (ret < 0) | 455 | if (ret < 0) |
456 | { | 456 | { |
457 | gnutls_assert (); | 457 | gnutls_assert (); |
@@ -472,7 +472,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, | |||
472 | /* here we hash all pending data. | 472 | /* here we hash all pending data. |
473 | */ | 473 | */ |
474 | inline static int | 474 | inline static int |
475 | _gnutls_handshake_hash_pending (gnutls_session_t session) | 475 | _gnutls_handshake_hash_pending (mhd_gtls_session_t session) |
476 | { | 476 | { |
477 | size_t siz; | 477 | size_t siz; |
478 | int ret; | 478 | int ret; |
@@ -487,7 +487,7 @@ _gnutls_handshake_hash_pending (gnutls_session_t session) | |||
487 | 487 | ||
488 | /* We check if there are pending data to hash. | 488 | /* We check if there are pending data to hash. |
489 | */ | 489 | */ |
490 | if ((ret = _gnutls_handshake_buffer_get_ptr (session, &data, &siz)) < 0) | 490 | if ((ret = mhd_gtls_handshake_buffer_get_ptr (session, &data, &siz)) < 0) |
491 | { | 491 | { |
492 | gnutls_assert (); | 492 | gnutls_assert (); |
493 | return ret; | 493 | return ret; |
@@ -495,11 +495,11 @@ _gnutls_handshake_hash_pending (gnutls_session_t session) | |||
495 | 495 | ||
496 | if (siz > 0) | 496 | if (siz > 0) |
497 | { | 497 | { |
498 | _gnutls_hash (session->internals.handshake_mac_handle_sha, data, siz); | 498 | mhd_gnutls_hash (session->internals.handshake_mac_handle_sha, data, siz); |
499 | _gnutls_hash (session->internals.handshake_mac_handle_md5, data, siz); | 499 | mhd_gnutls_hash (session->internals.handshake_mac_handle_md5, data, siz); |
500 | } | 500 | } |
501 | 501 | ||
502 | _gnutls_handshake_buffer_empty (session); | 502 | mhd_gtls_handshake_buffer_empty (session); |
503 | 503 | ||
504 | return 0; | 504 | return 0; |
505 | } | 505 | } |
@@ -510,7 +510,7 @@ _gnutls_handshake_hash_pending (gnutls_session_t session) | |||
510 | * we send. | 510 | * we send. |
511 | */ | 511 | */ |
512 | int | 512 | int |
513 | _gnutls_send_finished (gnutls_session_t session, int again) | 513 | _gnutls_send_finished (mhd_gtls_session_t session, int again) |
514 | { | 514 | { |
515 | uint8_t data[36]; | 515 | uint8_t data[36]; |
516 | int ret; | 516 | int ret; |
@@ -529,7 +529,7 @@ _gnutls_send_finished (gnutls_session_t session, int again) | |||
529 | return ret; | 529 | return ret; |
530 | } | 530 | } |
531 | 531 | ||
532 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 532 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
533 | { | 533 | { |
534 | ret = | 534 | ret = |
535 | _gnutls_ssl3_finished (session, | 535 | _gnutls_ssl3_finished (session, |
@@ -553,7 +553,7 @@ _gnutls_send_finished (gnutls_session_t session, int again) | |||
553 | } | 553 | } |
554 | 554 | ||
555 | ret = | 555 | ret = |
556 | _gnutls_send_handshake (session, data, data_size, | 556 | mhd_gtls_send_handshake (session, data, data_size, |
557 | GNUTLS_HANDSHAKE_FINISHED); | 557 | GNUTLS_HANDSHAKE_FINISHED); |
558 | 558 | ||
559 | return ret; | 559 | return ret; |
@@ -563,7 +563,7 @@ _gnutls_send_finished (gnutls_session_t session, int again) | |||
563 | * went fine we have negotiated a secure connection | 563 | * went fine we have negotiated a secure connection |
564 | */ | 564 | */ |
565 | int | 565 | int |
566 | _gnutls_recv_finished (gnutls_session_t session) | 566 | _gnutls_recv_finished (mhd_gtls_session_t session) |
567 | { | 567 | { |
568 | uint8_t data[36], *vrfy; | 568 | uint8_t data[36], *vrfy; |
569 | int data_size; | 569 | int data_size; |
@@ -571,7 +571,7 @@ _gnutls_recv_finished (gnutls_session_t session) | |||
571 | int vrfysize; | 571 | int vrfysize; |
572 | 572 | ||
573 | ret = | 573 | ret = |
574 | _gnutls_recv_handshake (session, &vrfy, &vrfysize, | 574 | mhd_gtls_recv_handshake (session, &vrfy, &vrfysize, |
575 | GNUTLS_HANDSHAKE_FINISHED, MANDATORY_PACKET); | 575 | GNUTLS_HANDSHAKE_FINISHED, MANDATORY_PACKET); |
576 | if (ret < 0) | 576 | if (ret < 0) |
577 | { | 577 | { |
@@ -581,7 +581,7 @@ _gnutls_recv_finished (gnutls_session_t session) | |||
581 | } | 581 | } |
582 | 582 | ||
583 | 583 | ||
584 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 584 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
585 | { | 585 | { |
586 | data_size = 36; | 586 | data_size = 36; |
587 | } | 587 | } |
@@ -597,7 +597,7 @@ _gnutls_recv_finished (gnutls_session_t session) | |||
597 | return GNUTLS_E_ERROR_IN_FINISHED_PACKET; | 597 | return GNUTLS_E_ERROR_IN_FINISHED_PACKET; |
598 | } | 598 | } |
599 | 599 | ||
600 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 600 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
601 | { | 601 | { |
602 | ret = | 602 | ret = |
603 | _gnutls_ssl3_finished (session, | 603 | _gnutls_ssl3_finished (session, |
@@ -650,11 +650,11 @@ _gnutls_server_find_pk_algos_in_ciphersuites (const opaque * | |||
650 | for (j = 0; j < datalen; j += 2) | 650 | for (j = 0; j < datalen; j += 2) |
651 | { | 651 | { |
652 | memcpy (&cs.suite, &data[j], 2); | 652 | memcpy (&cs.suite, &data[j], 2); |
653 | kx = _gnutls_cipher_suite_get_kx_algo (&cs); | 653 | kx = mhd_gtls_cipher_suite_get_kx_algo (&cs); |
654 | 654 | ||
655 | if (_gnutls_map_kx_get_cred (kx, 1) == MHD_GNUTLS_CRD_CERTIFICATE) | 655 | if (mhd_gtls_map_kx_get_cred (kx, 1) == MHD_GNUTLS_CRD_CERTIFICATE) |
656 | { | 656 | { |
657 | algo = _gnutls_map_pk_get_pk (kx); | 657 | algo = mhd_gtls_map_pk_get_pk (kx); |
658 | 658 | ||
659 | if (algo != prev_algo && prev_algo != 0) | 659 | if (algo != prev_algo && prev_algo != 0) |
660 | return GNUTLS_PK_ANY; | 660 | return GNUTLS_PK_ANY; |
@@ -670,7 +670,7 @@ _gnutls_server_find_pk_algos_in_ciphersuites (const opaque * | |||
670 | * it adds the suite to the session and performs some checks. | 670 | * it adds the suite to the session and performs some checks. |
671 | */ | 671 | */ |
672 | int | 672 | int |
673 | _gnutls_server_select_suite (gnutls_session_t session, opaque * data, | 673 | mhd_gtls_server_select_suite (mhd_gtls_session_t session, opaque * data, |
674 | int datalen) | 674 | int datalen) |
675 | { | 675 | { |
676 | int x, i, j; | 676 | int x, i, j; |
@@ -682,7 +682,7 @@ _gnutls_server_select_suite (gnutls_session_t session, opaque * data, | |||
682 | 682 | ||
683 | pk_algo = _gnutls_server_find_pk_algos_in_ciphersuites (data, datalen); | 683 | pk_algo = _gnutls_server_find_pk_algos_in_ciphersuites (data, datalen); |
684 | 684 | ||
685 | x = _gnutls_supported_ciphersuites (session, &ciphers); | 685 | x = mhd_gtls_supported_ciphersuites (session, &ciphers); |
686 | if (x < 0) | 686 | if (x < 0) |
687 | { /* the case x==0 is handled within the function. */ | 687 | { /* the case x==0 is handled within the function. */ |
688 | gnutls_assert (); | 688 | gnutls_assert (); |
@@ -693,7 +693,7 @@ _gnutls_server_select_suite (gnutls_session_t session, opaque * data, | |||
693 | * the certificate requested, or to the | 693 | * the certificate requested, or to the |
694 | * authentication requested (e.g. SRP). | 694 | * authentication requested (e.g. SRP). |
695 | */ | 695 | */ |
696 | x = _gnutls_remove_unwanted_ciphersuites (session, &ciphers, x, pk_algo); | 696 | x = mhd_gtls_remove_unwanted_ciphersuites (session, &ciphers, x, pk_algo); |
697 | if (x <= 0) | 697 | if (x <= 0) |
698 | { | 698 | { |
699 | gnutls_assert (); | 699 | gnutls_assert (); |
@@ -719,12 +719,12 @@ _gnutls_server_select_suite (gnutls_session_t session, opaque * data, | |||
719 | for (j = 0; j < datalen; j += 2) | 719 | for (j = 0; j < datalen; j += 2) |
720 | { | 720 | { |
721 | memcpy (&cs.suite, &data[j], 2); | 721 | memcpy (&cs.suite, &data[j], 2); |
722 | _gnutls_handshake_log ("\t%s\n", _gnutls_cipher_suite_get_name (&cs)); | 722 | _gnutls_handshake_log ("\t%s\n", mhd_gtls_cipher_suite_get_name (&cs)); |
723 | } | 723 | } |
724 | _gnutls_handshake_log ("HSK[%x]: Supported cipher suites: \n", session); | 724 | _gnutls_handshake_log ("HSK[%x]: Supported cipher suites: \n", session); |
725 | for (j = 0; j < x; j++) | 725 | for (j = 0; j < x; j++) |
726 | _gnutls_handshake_log ("\t%s\n", | 726 | _gnutls_handshake_log ("\t%s\n", |
727 | _gnutls_cipher_suite_get_name (&ciphers[j])); | 727 | mhd_gtls_cipher_suite_get_name (&ciphers[j])); |
728 | #endif | 728 | #endif |
729 | memset (session->security_parameters.current_cipher_suite.suite, '\0', 2); | 729 | memset (session->security_parameters.current_cipher_suite.suite, '\0', 2); |
730 | 730 | ||
@@ -740,7 +740,7 @@ _gnutls_server_select_suite (gnutls_session_t session, opaque * data, | |||
740 | 740 | ||
741 | _gnutls_handshake_log | 741 | _gnutls_handshake_log |
742 | ("HSK[%x]: Selected cipher suite: %s\n", session, | 742 | ("HSK[%x]: Selected cipher suite: %s\n", session, |
743 | _gnutls_cipher_suite_get_name (&cs)); | 743 | mhd_gtls_cipher_suite_get_name (&cs)); |
744 | memcpy (session->security_parameters.current_cipher_suite. | 744 | memcpy (session->security_parameters.current_cipher_suite. |
745 | suite, ciphers[i].suite, 2); | 745 | suite, ciphers[i].suite, 2); |
746 | retval = 0; | 746 | retval = 0; |
@@ -760,9 +760,9 @@ finish: | |||
760 | 760 | ||
761 | /* check if the credentials (username, public key etc.) are ok | 761 | /* check if the credentials (username, public key etc.) are ok |
762 | */ | 762 | */ |
763 | if (_gnutls_get_kx_cred | 763 | if (mhd_gtls_get_kx_cred |
764 | (session, | 764 | (session, |
765 | _gnutls_cipher_suite_get_kx_algo (&session->security_parameters. | 765 | mhd_gtls_cipher_suite_get_kx_algo (&session->security_parameters. |
766 | current_cipher_suite), | 766 | current_cipher_suite), |
767 | &err) == NULL && err != 0) | 767 | &err) == NULL && err != 0) |
768 | { | 768 | { |
@@ -771,12 +771,12 @@ finish: | |||
771 | } | 771 | } |
772 | 772 | ||
773 | 773 | ||
774 | /* set the mod_auth_st to the appropriate struct | 774 | /* set the mhd_gtls_mod_auth_st to the appropriate struct |
775 | * according to the KX algorithm. This is needed since all the | 775 | * according to the KX algorithm. This is needed since all the |
776 | * handshake functions are read from there; | 776 | * handshake functions are read from there; |
777 | */ | 777 | */ |
778 | session->internals.auth_struct = | 778 | session->internals.auth_struct = |
779 | _gnutls_kx_auth_struct (_gnutls_cipher_suite_get_kx_algo | 779 | mhd_gtls_kx_auth_struct (mhd_gtls_cipher_suite_get_kx_algo |
780 | (&session->security_parameters. | 780 | (&session->security_parameters. |
781 | current_cipher_suite)); | 781 | current_cipher_suite)); |
782 | if (session->internals.auth_struct == NULL) | 782 | if (session->internals.auth_struct == NULL) |
@@ -797,13 +797,13 @@ finish: | |||
797 | /* This selects the best supported compression method from the ones provided | 797 | /* This selects the best supported compression method from the ones provided |
798 | */ | 798 | */ |
799 | int | 799 | int |
800 | _gnutls_server_select_comp_method (gnutls_session_t session, | 800 | _gnutls_server_select_comp_method (mhd_gtls_session_t session, |
801 | opaque * data, int datalen) | 801 | opaque * data, int datalen) |
802 | { | 802 | { |
803 | int x, i, j; | 803 | int x, i, j; |
804 | uint8_t *comps; | 804 | uint8_t *comps; |
805 | 805 | ||
806 | x = _gnutls_supported_compression_methods (session, &comps); | 806 | x = mhd_gtls_supported_compression_methods (session, &comps); |
807 | if (x < 0) | 807 | if (x < 0) |
808 | { | 808 | { |
809 | gnutls_assert (); | 809 | gnutls_assert (); |
@@ -820,14 +820,14 @@ _gnutls_server_select_comp_method (gnutls_session_t session, | |||
820 | if (comps[i] == data[j]) | 820 | if (comps[i] == data[j]) |
821 | { | 821 | { |
822 | gnutls_compression_method_t method = | 822 | gnutls_compression_method_t method = |
823 | _gnutls_compression_get_id (comps[i]); | 823 | mhd_gtls_compression_get_id (comps[i]); |
824 | 824 | ||
825 | session->internals.compression_method = method; | 825 | session->internals.compression_method = method; |
826 | gnutls_free (comps); | 826 | gnutls_free (comps); |
827 | 827 | ||
828 | _gnutls_handshake_log | 828 | _gnutls_handshake_log |
829 | ("HSK[%x]: Selected Compression Method: %s\n", session, | 829 | ("HSK[%x]: Selected Compression Method: %s\n", session, |
830 | gnutls_compression_get_name (session->internals. | 830 | MHD_gnutls_compression_get_name (session->internals. |
831 | compression_method)); | 831 | compression_method)); |
832 | 832 | ||
833 | 833 | ||
@@ -851,7 +851,7 @@ _gnutls_server_select_comp_method (gnutls_session_t session, | |||
851 | * (until it returns ok), with NULL parameters. | 851 | * (until it returns ok), with NULL parameters. |
852 | */ | 852 | */ |
853 | int | 853 | int |
854 | _gnutls_send_empty_handshake (gnutls_session_t session, | 854 | _gnutls_send_empty_handshake (mhd_gtls_session_t session, |
855 | gnutls_handshake_description_t type, int again) | 855 | gnutls_handshake_description_t type, int again) |
856 | { | 856 | { |
857 | opaque data = 0; | 857 | opaque data = 0; |
@@ -862,13 +862,13 @@ _gnutls_send_empty_handshake (gnutls_session_t session, | |||
862 | else | 862 | else |
863 | ptr = NULL; | 863 | ptr = NULL; |
864 | 864 | ||
865 | return _gnutls_send_handshake (session, ptr, 0, type); | 865 | return mhd_gtls_send_handshake (session, ptr, 0, type); |
866 | } | 866 | } |
867 | 867 | ||
868 | 868 | ||
869 | /* This function will hash the handshake message we sent. */ | 869 | /* This function will hash the handshake message we sent. */ |
870 | static int | 870 | static int |
871 | _gnutls_handshake_hash_add_sent (gnutls_session_t session, | 871 | _gnutls_handshake_hash_add_sent (mhd_gtls_session_t session, |
872 | gnutls_handshake_description_t type, | 872 | gnutls_handshake_description_t type, |
873 | opaque * dataptr, uint32_t datalen) | 873 | opaque * dataptr, uint32_t datalen) |
874 | { | 874 | { |
@@ -882,9 +882,9 @@ _gnutls_handshake_hash_add_sent (gnutls_session_t session, | |||
882 | 882 | ||
883 | if (type != GNUTLS_HANDSHAKE_HELLO_REQUEST) | 883 | if (type != GNUTLS_HANDSHAKE_HELLO_REQUEST) |
884 | { | 884 | { |
885 | _gnutls_hash (session->internals.handshake_mac_handle_sha, dataptr, | 885 | mhd_gnutls_hash (session->internals.handshake_mac_handle_sha, dataptr, |
886 | datalen); | 886 | datalen); |
887 | _gnutls_hash (session->internals.handshake_mac_handle_md5, dataptr, | 887 | mhd_gnutls_hash (session->internals.handshake_mac_handle_md5, dataptr, |
888 | datalen); | 888 | datalen); |
889 | } | 889 | } |
890 | 890 | ||
@@ -893,12 +893,12 @@ _gnutls_handshake_hash_add_sent (gnutls_session_t session, | |||
893 | 893 | ||
894 | 894 | ||
895 | /* This function sends a handshake message of type 'type' containing the | 895 | /* This function sends a handshake message of type 'type' containing the |
896 | * data specified here. If the previous _gnutls_send_handshake() returned | 896 | * data specified here. If the previous mhd_gtls_send_handshake() returned |
897 | * GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED, then it must be called again | 897 | * GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED, then it must be called again |
898 | * (until it returns ok), with NULL parameters. | 898 | * (until it returns ok), with NULL parameters. |
899 | */ | 899 | */ |
900 | int | 900 | int |
901 | _gnutls_send_handshake (gnutls_session_t session, void *i_data, | 901 | mhd_gtls_send_handshake (mhd_gtls_session_t session, void *i_data, |
902 | uint32_t i_datasize, | 902 | uint32_t i_datasize, |
903 | gnutls_handshake_description_t type) | 903 | gnutls_handshake_description_t type) |
904 | { | 904 | { |
@@ -912,7 +912,7 @@ _gnutls_send_handshake (gnutls_session_t session, void *i_data, | |||
912 | /* we are resuming a previously interrupted | 912 | /* we are resuming a previously interrupted |
913 | * send. | 913 | * send. |
914 | */ | 914 | */ |
915 | ret = _gnutls_handshake_io_write_flush (session); | 915 | ret = mhd_gtls_handshake_io_write_flush (session); |
916 | return ret; | 916 | return ret; |
917 | 917 | ||
918 | } | 918 | } |
@@ -933,7 +933,7 @@ _gnutls_send_handshake (gnutls_session_t session, void *i_data, | |||
933 | } | 933 | } |
934 | 934 | ||
935 | data[pos++] = (uint8_t) type; | 935 | data[pos++] = (uint8_t) type; |
936 | _gnutls_write_uint24 (i_datasize, &data[pos]); | 936 | mhd_gtls_write_uint24 (i_datasize, &data[pos]); |
937 | pos += 3; | 937 | pos += 3; |
938 | 938 | ||
939 | if (i_datasize > 0) | 939 | if (i_datasize > 0) |
@@ -953,7 +953,7 @@ _gnutls_send_handshake (gnutls_session_t session, void *i_data, | |||
953 | session->internals.last_handshake_out = type; | 953 | session->internals.last_handshake_out = type; |
954 | 954 | ||
955 | ret = | 955 | ret = |
956 | _gnutls_handshake_io_send_int (session, GNUTLS_HANDSHAKE, type, | 956 | mhd_gtls_handshake_io_send_int (session, GNUTLS_HANDSHAKE, type, |
957 | data, datasize); | 957 | data, datasize); |
958 | 958 | ||
959 | _gnutls_handshake_log ("HSK[%x]: %s was sent [%ld bytes]\n", | 959 | _gnutls_handshake_log ("HSK[%x]: %s was sent [%ld bytes]\n", |
@@ -972,7 +972,7 @@ _gnutls_send_handshake (gnutls_session_t session, void *i_data, | |||
972 | */ | 972 | */ |
973 | #define SSL2_HEADERS 1 | 973 | #define SSL2_HEADERS 1 |
974 | static int | 974 | static int |
975 | _gnutls_recv_handshake_header (gnutls_session_t session, | 975 | _gnutls_recv_handshake_header (mhd_gtls_session_t session, |
976 | gnutls_handshake_description_t type, | 976 | gnutls_handshake_description_t type, |
977 | gnutls_handshake_description_t * recv_type) | 977 | gnutls_handshake_description_t * recv_type) |
978 | { | 978 | { |
@@ -1006,7 +1006,7 @@ _gnutls_recv_handshake_header (gnutls_session_t session, | |||
1006 | if (session->internals.handshake_header_buffer.header_size < SSL2_HEADERS) | 1006 | if (session->internals.handshake_header_buffer.header_size < SSL2_HEADERS) |
1007 | { | 1007 | { |
1008 | ret = | 1008 | ret = |
1009 | _gnutls_handshake_io_recv_int (session, GNUTLS_HANDSHAKE, | 1009 | mhd_gtls_handshake_io_recv_int (session, GNUTLS_HANDSHAKE, |
1010 | type, dataptr, SSL2_HEADERS); | 1010 | type, dataptr, SSL2_HEADERS); |
1011 | 1011 | ||
1012 | if (ret < 0) | 1012 | if (ret < 0) |
@@ -1029,7 +1029,7 @@ _gnutls_recv_handshake_header (gnutls_session_t session, | |||
1029 | || type != GNUTLS_HANDSHAKE_CLIENT_HELLO) | 1029 | || type != GNUTLS_HANDSHAKE_CLIENT_HELLO) |
1030 | { | 1030 | { |
1031 | ret = | 1031 | ret = |
1032 | _gnutls_handshake_io_recv_int (session, GNUTLS_HANDSHAKE, | 1032 | mhd_gtls_handshake_io_recv_int (session, GNUTLS_HANDSHAKE, |
1033 | type, | 1033 | type, |
1034 | &dataptr[session-> | 1034 | &dataptr[session-> |
1035 | internals. | 1035 | internals. |
@@ -1055,7 +1055,7 @@ _gnutls_recv_handshake_header (gnutls_session_t session, | |||
1055 | /* we do not use DECR_LEN because we know | 1055 | /* we do not use DECR_LEN because we know |
1056 | * that the packet has enough data. | 1056 | * that the packet has enough data. |
1057 | */ | 1057 | */ |
1058 | length32 = _gnutls_read_uint24 (&dataptr[1]); | 1058 | length32 = mhd_gtls_read_uint24 (&dataptr[1]); |
1059 | handshake_header_size = HANDSHAKE_HEADER_SIZE; | 1059 | handshake_header_size = HANDSHAKE_HEADER_SIZE; |
1060 | 1060 | ||
1061 | _gnutls_handshake_log ("HSK[%x]: %s was received [%ld bytes]\n", | 1061 | _gnutls_handshake_log ("HSK[%x]: %s was received [%ld bytes]\n", |
@@ -1105,7 +1105,7 @@ _gnutls_recv_handshake_header (gnutls_session_t session, | |||
1105 | * handshake data. | 1105 | * handshake data. |
1106 | */ | 1106 | */ |
1107 | static int | 1107 | static int |
1108 | _gnutls_handshake_hash_add_recvd (gnutls_session_t session, | 1108 | _gnutls_handshake_hash_add_recvd (mhd_gtls_session_t session, |
1109 | gnutls_handshake_description_t recv_type, | 1109 | gnutls_handshake_description_t recv_type, |
1110 | opaque * header, uint16_t header_size, | 1110 | opaque * header, uint16_t header_size, |
1111 | opaque * dataptr, uint32_t datalen) | 1111 | opaque * dataptr, uint32_t datalen) |
@@ -1127,7 +1127,7 @@ _gnutls_handshake_hash_add_recvd (gnutls_session_t session, | |||
1127 | { | 1127 | { |
1128 | 1128 | ||
1129 | if ((ret = | 1129 | if ((ret = |
1130 | _gnutls_handshake_buffer_put (session, header, header_size)) < 0) | 1130 | mhd_gtls_handshake_buffer_put (session, header, header_size)) < 0) |
1131 | { | 1131 | { |
1132 | gnutls_assert (); | 1132 | gnutls_assert (); |
1133 | return ret; | 1133 | return ret; |
@@ -1136,7 +1136,7 @@ _gnutls_handshake_hash_add_recvd (gnutls_session_t session, | |||
1136 | if (datalen > 0) | 1136 | if (datalen > 0) |
1137 | { | 1137 | { |
1138 | if ((ret = | 1138 | if ((ret = |
1139 | _gnutls_handshake_buffer_put (session, dataptr, datalen)) < 0) | 1139 | mhd_gtls_handshake_buffer_put (session, dataptr, datalen)) < 0) |
1140 | { | 1140 | { |
1141 | gnutls_assert (); | 1141 | gnutls_assert (); |
1142 | return ret; | 1142 | return ret; |
@@ -1151,10 +1151,10 @@ _gnutls_handshake_hash_add_recvd (gnutls_session_t session, | |||
1151 | /* This function will receive handshake messages of the given types, | 1151 | /* This function will receive handshake messages of the given types, |
1152 | * and will pass the message to the right place in order to be processed. | 1152 | * and will pass the message to the right place in order to be processed. |
1153 | * E.g. for the SERVER_HELLO message (if it is expected), it will be | 1153 | * E.g. for the SERVER_HELLO message (if it is expected), it will be |
1154 | * passed to _gnutls_recv_hello(). | 1154 | * passed to mhd_gtls_recv_hello(). |
1155 | */ | 1155 | */ |
1156 | int | 1156 | int |
1157 | _gnutls_recv_handshake (gnutls_session_t session, uint8_t ** data, | 1157 | mhd_gtls_recv_handshake (mhd_gtls_session_t session, uint8_t ** data, |
1158 | int *datalen, gnutls_handshake_description_t type, | 1158 | int *datalen, gnutls_handshake_description_t type, |
1159 | Optional optional) | 1159 | Optional optional) |
1160 | { | 1160 | { |
@@ -1204,7 +1204,7 @@ _gnutls_recv_handshake (gnutls_session_t session, uint8_t ** data, | |||
1204 | if (length32 > 0) | 1204 | if (length32 > 0) |
1205 | { | 1205 | { |
1206 | ret = | 1206 | ret = |
1207 | _gnutls_handshake_io_recv_int (session, GNUTLS_HANDSHAKE, | 1207 | mhd_gtls_handshake_io_recv_int (session, GNUTLS_HANDSHAKE, |
1208 | type, dataptr, length32); | 1208 | type, dataptr, length32); |
1209 | if (ret <= 0) | 1209 | if (ret <= 0) |
1210 | { | 1210 | { |
@@ -1241,7 +1241,7 @@ _gnutls_recv_handshake (gnutls_session_t session, uint8_t ** data, | |||
1241 | { | 1241 | { |
1242 | case GNUTLS_HANDSHAKE_CLIENT_HELLO: | 1242 | case GNUTLS_HANDSHAKE_CLIENT_HELLO: |
1243 | case GNUTLS_HANDSHAKE_SERVER_HELLO: | 1243 | case GNUTLS_HANDSHAKE_SERVER_HELLO: |
1244 | ret = _gnutls_recv_hello (session, dataptr, length32); | 1244 | ret = mhd_gtls_recv_hello (session, dataptr, length32); |
1245 | /* dataptr is freed because the caller does not | 1245 | /* dataptr is freed because the caller does not |
1246 | * need it */ | 1246 | * need it */ |
1247 | gnutls_free (dataptr); | 1247 | gnutls_free (dataptr); |
@@ -1278,7 +1278,7 @@ _gnutls_recv_handshake (gnutls_session_t session, uint8_t ** data, | |||
1278 | * to the session; | 1278 | * to the session; |
1279 | */ | 1279 | */ |
1280 | static int | 1280 | static int |
1281 | _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2]) | 1281 | _gnutls_client_set_ciphersuite (mhd_gtls_session_t session, opaque suite[2]) |
1282 | { | 1282 | { |
1283 | uint8_t z; | 1283 | uint8_t z; |
1284 | cipher_suite_st *cipher_suites; | 1284 | cipher_suite_st *cipher_suites; |
@@ -1286,7 +1286,7 @@ _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2]) | |||
1286 | int i, err; | 1286 | int i, err; |
1287 | 1287 | ||
1288 | z = 1; | 1288 | z = 1; |
1289 | cipher_suite_num = _gnutls_supported_ciphersuites (session, &cipher_suites); | 1289 | cipher_suite_num = mhd_gtls_supported_ciphersuites (session, &cipher_suites); |
1290 | if (cipher_suite_num < 0) | 1290 | if (cipher_suite_num < 0) |
1291 | { | 1291 | { |
1292 | gnutls_assert (); | 1292 | gnutls_assert (); |
@@ -1313,7 +1313,7 @@ _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2]) | |||
1313 | memcpy (session->security_parameters.current_cipher_suite.suite, suite, 2); | 1313 | memcpy (session->security_parameters.current_cipher_suite.suite, suite, 2); |
1314 | 1314 | ||
1315 | _gnutls_handshake_log ("HSK[%x]: Selected cipher suite: %s\n", session, | 1315 | _gnutls_handshake_log ("HSK[%x]: Selected cipher suite: %s\n", session, |
1316 | _gnutls_cipher_suite_get_name (&session-> | 1316 | mhd_gtls_cipher_suite_get_name (&session-> |
1317 | security_parameters. | 1317 | security_parameters. |
1318 | current_cipher_suite)); | 1318 | current_cipher_suite)); |
1319 | 1319 | ||
@@ -1321,8 +1321,8 @@ _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2]) | |||
1321 | /* check if the credentials (username, public key etc.) are ok. | 1321 | /* check if the credentials (username, public key etc.) are ok. |
1322 | * Actually checks if they exist. | 1322 | * Actually checks if they exist. |
1323 | */ | 1323 | */ |
1324 | if (_gnutls_get_kx_cred | 1324 | if (mhd_gtls_get_kx_cred |
1325 | (session, _gnutls_cipher_suite_get_kx_algo (&session-> | 1325 | (session, mhd_gtls_cipher_suite_get_kx_algo (&session-> |
1326 | security_parameters. | 1326 | security_parameters. |
1327 | current_cipher_suite), | 1327 | current_cipher_suite), |
1328 | &err) == NULL && err != 0) | 1328 | &err) == NULL && err != 0) |
@@ -1332,12 +1332,12 @@ _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2]) | |||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | 1334 | ||
1335 | /* set the mod_auth_st to the appropriate struct | 1335 | /* set the mhd_gtls_mod_auth_st to the appropriate struct |
1336 | * according to the KX algorithm. This is needed since all the | 1336 | * according to the KX algorithm. This is needed since all the |
1337 | * handshake functions are read from there; | 1337 | * handshake functions are read from there; |
1338 | */ | 1338 | */ |
1339 | session->internals.auth_struct = | 1339 | session->internals.auth_struct = |
1340 | _gnutls_kx_auth_struct (_gnutls_cipher_suite_get_kx_algo | 1340 | mhd_gtls_kx_auth_struct (mhd_gtls_cipher_suite_get_kx_algo |
1341 | (&session->security_parameters. | 1341 | (&session->security_parameters. |
1342 | current_cipher_suite)); | 1342 | current_cipher_suite)); |
1343 | 1343 | ||
@@ -1358,13 +1358,13 @@ _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2]) | |||
1358 | /* This function sets the given comp method to the session. | 1358 | /* This function sets the given comp method to the session. |
1359 | */ | 1359 | */ |
1360 | static int | 1360 | static int |
1361 | _gnutls_client_set_comp_method (gnutls_session_t session, opaque comp_method) | 1361 | _gnutls_client_set_comp_method (mhd_gtls_session_t session, opaque comp_method) |
1362 | { | 1362 | { |
1363 | int comp_methods_num; | 1363 | int comp_methods_num; |
1364 | uint8_t *compression_methods; | 1364 | uint8_t *compression_methods; |
1365 | int i; | 1365 | int i; |
1366 | 1366 | ||
1367 | comp_methods_num = _gnutls_supported_compression_methods (session, | 1367 | comp_methods_num = mhd_gtls_supported_compression_methods (session, |
1368 | &compression_methods); | 1368 | &compression_methods); |
1369 | if (comp_methods_num < 0) | 1369 | if (comp_methods_num < 0) |
1370 | { | 1370 | { |
@@ -1390,7 +1390,7 @@ _gnutls_client_set_comp_method (gnutls_session_t session, opaque comp_method) | |||
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | session->internals.compression_method = | 1392 | session->internals.compression_method = |
1393 | _gnutls_compression_get_id (comp_method); | 1393 | mhd_gtls_compression_get_id (comp_method); |
1394 | 1394 | ||
1395 | 1395 | ||
1396 | return 0; | 1396 | return 0; |
@@ -1401,7 +1401,7 @@ _gnutls_client_set_comp_method (gnutls_session_t session, opaque comp_method) | |||
1401 | * hello. | 1401 | * hello. |
1402 | */ | 1402 | */ |
1403 | static int | 1403 | static int |
1404 | _gnutls_client_check_if_resuming (gnutls_session_t session, | 1404 | _gnutls_client_check_if_resuming (mhd_gtls_session_t session, |
1405 | opaque * session_id, int session_id_len) | 1405 | opaque * session_id, int session_id_len) |
1406 | { | 1406 | { |
1407 | opaque buf[2 * TLS_MAX_SESSION_ID_SIZE + 1]; | 1407 | opaque buf[2 * TLS_MAX_SESSION_ID_SIZE + 1]; |
@@ -1409,7 +1409,7 @@ _gnutls_client_check_if_resuming (gnutls_session_t session, | |||
1409 | _gnutls_handshake_log ("HSK[%x]: SessionID length: %d\n", session, | 1409 | _gnutls_handshake_log ("HSK[%x]: SessionID length: %d\n", session, |
1410 | session_id_len); | 1410 | session_id_len); |
1411 | _gnutls_handshake_log ("HSK[%x]: SessionID: %s\n", session, | 1411 | _gnutls_handshake_log ("HSK[%x]: SessionID: %s\n", session, |
1412 | _gnutls_bin2hex (session_id, session_id_len, buf, | 1412 | mhd_gtls_bin2hex (session_id, session_id_len, buf, |
1413 | sizeof (buf))); | 1413 | sizeof (buf))); |
1414 | 1414 | ||
1415 | if (session_id_len > 0 && | 1415 | if (session_id_len > 0 && |
@@ -1448,7 +1448,7 @@ _gnutls_client_check_if_resuming (gnutls_session_t session, | |||
1448 | * session. | 1448 | * session. |
1449 | */ | 1449 | */ |
1450 | static int | 1450 | static int |
1451 | _gnutls_read_server_hello (gnutls_session_t session, | 1451 | _gnutls_read_server_hello (mhd_gtls_session_t session, |
1452 | opaque * data, int datalen) | 1452 | opaque * data, int datalen) |
1453 | { | 1453 | { |
1454 | uint8_t session_id_len = 0; | 1454 | uint8_t session_id_len = 0; |
@@ -1467,21 +1467,21 @@ _gnutls_read_server_hello (gnutls_session_t session, | |||
1467 | session, data[pos], data[pos + 1]); | 1467 | session, data[pos], data[pos + 1]); |
1468 | 1468 | ||
1469 | DECR_LEN (len, 2); | 1469 | DECR_LEN (len, 2); |
1470 | version = _gnutls_version_get (data[pos], data[pos + 1]); | 1470 | version = mhd_gtls_version_get (data[pos], data[pos + 1]); |
1471 | if (_gnutls_version_is_supported (session, version) == 0) | 1471 | if (mhd_gtls_version_is_supported (session, version) == 0) |
1472 | { | 1472 | { |
1473 | gnutls_assert (); | 1473 | gnutls_assert (); |
1474 | return GNUTLS_E_UNSUPPORTED_VERSION_PACKET; | 1474 | return GNUTLS_E_UNSUPPORTED_VERSION_PACKET; |
1475 | } | 1475 | } |
1476 | else | 1476 | else |
1477 | { | 1477 | { |
1478 | _gnutls_set_current_version (session, version); | 1478 | mhd_gtls_set_current_version (session, version); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | pos += 2; | 1481 | pos += 2; |
1482 | 1482 | ||
1483 | DECR_LEN (len, TLS_RANDOM_SIZE); | 1483 | DECR_LEN (len, TLS_RANDOM_SIZE); |
1484 | _gnutls_set_server_random (session, &data[pos]); | 1484 | mhd_gtls_set_server_random (session, &data[pos]); |
1485 | pos += TLS_RANDOM_SIZE; | 1485 | pos += TLS_RANDOM_SIZE; |
1486 | 1486 | ||
1487 | 1487 | ||
@@ -1536,7 +1536,7 @@ _gnutls_read_server_hello (gnutls_session_t session, | |||
1536 | */ | 1536 | */ |
1537 | if (version >= MHD_GNUTLS_TLS1_0) | 1537 | if (version >= MHD_GNUTLS_TLS1_0) |
1538 | { | 1538 | { |
1539 | ret = _gnutls_parse_extensions (session, EXTENSION_ANY, &data[pos], len); /* len is the rest of the parsed length */ | 1539 | ret = mhd_gtls_parse_extensions (session, EXTENSION_ANY, &data[pos], len); /* len is the rest of the parsed length */ |
1540 | if (ret < 0) | 1540 | if (ret < 0) |
1541 | { | 1541 | { |
1542 | gnutls_assert (); | 1542 | gnutls_assert (); |
@@ -1551,7 +1551,7 @@ _gnutls_read_server_hello (gnutls_session_t session, | |||
1551 | * Needed in client hello messages. Returns the new data length. | 1551 | * Needed in client hello messages. Returns the new data length. |
1552 | */ | 1552 | */ |
1553 | static int | 1553 | static int |
1554 | _gnutls_copy_ciphersuites (gnutls_session_t session, | 1554 | _gnutls_copy_ciphersuites (mhd_gtls_session_t session, |
1555 | opaque * ret_data, size_t ret_data_size) | 1555 | opaque * ret_data, size_t ret_data_size) |
1556 | { | 1556 | { |
1557 | int ret, i; | 1557 | int ret, i; |
@@ -1559,7 +1559,7 @@ _gnutls_copy_ciphersuites (gnutls_session_t session, | |||
1559 | uint16_t cipher_num; | 1559 | uint16_t cipher_num; |
1560 | int datalen, pos; | 1560 | int datalen, pos; |
1561 | 1561 | ||
1562 | ret = _gnutls_supported_ciphersuites_sorted (session, &cipher_suites); | 1562 | ret = mhd_gtls_supported_ciphersuites_sorted (session, &cipher_suites); |
1563 | if (ret < 0) | 1563 | if (ret < 0) |
1564 | { | 1564 | { |
1565 | gnutls_assert (); | 1565 | gnutls_assert (); |
@@ -1571,7 +1571,7 @@ _gnutls_copy_ciphersuites (gnutls_session_t session, | |||
1571 | * authentication requested (eg SRP). | 1571 | * authentication requested (eg SRP). |
1572 | */ | 1572 | */ |
1573 | ret = | 1573 | ret = |
1574 | _gnutls_remove_unwanted_ciphersuites (session, &cipher_suites, ret, -1); | 1574 | mhd_gtls_remove_unwanted_ciphersuites (session, &cipher_suites, ret, -1); |
1575 | if (ret < 0) | 1575 | if (ret < 0) |
1576 | { | 1576 | { |
1577 | gnutls_assert (); | 1577 | gnutls_assert (); |
@@ -1602,7 +1602,7 @@ _gnutls_copy_ciphersuites (gnutls_session_t session, | |||
1602 | return GNUTLS_E_INTERNAL_ERROR; | 1602 | return GNUTLS_E_INTERNAL_ERROR; |
1603 | } | 1603 | } |
1604 | 1604 | ||
1605 | _gnutls_write_uint16 (cipher_num, ret_data); | 1605 | mhd_gtls_write_uint16 (cipher_num, ret_data); |
1606 | pos += 2; | 1606 | pos += 2; |
1607 | 1607 | ||
1608 | for (i = 0; i < (cipher_num / 2); i++) | 1608 | for (i = 0; i < (cipher_num / 2); i++) |
@@ -1620,14 +1620,14 @@ _gnutls_copy_ciphersuites (gnutls_session_t session, | |||
1620 | * Needed in hello messages. Returns the new data length. | 1620 | * Needed in hello messages. Returns the new data length. |
1621 | */ | 1621 | */ |
1622 | static int | 1622 | static int |
1623 | _gnutls_copy_comp_methods (gnutls_session_t session, | 1623 | _gnutls_copy_comp_methods (mhd_gtls_session_t session, |
1624 | opaque * ret_data, size_t ret_data_size) | 1624 | opaque * ret_data, size_t ret_data_size) |
1625 | { | 1625 | { |
1626 | int ret, i; | 1626 | int ret, i; |
1627 | uint8_t *compression_methods, comp_num; | 1627 | uint8_t *compression_methods, comp_num; |
1628 | int datalen, pos; | 1628 | int datalen, pos; |
1629 | 1629 | ||
1630 | ret = _gnutls_supported_compression_methods (session, &compression_methods); | 1630 | ret = mhd_gtls_supported_compression_methods (session, &compression_methods); |
1631 | if (ret < 0) | 1631 | if (ret < 0) |
1632 | { | 1632 | { |
1633 | gnutls_assert (); | 1633 | gnutls_assert (); |
@@ -1665,7 +1665,7 @@ _gnutls_copy_comp_methods (gnutls_session_t session, | |||
1665 | /* This function sends the client hello handshake message. | 1665 | /* This function sends the client hello handshake message. |
1666 | */ | 1666 | */ |
1667 | static int | 1667 | static int |
1668 | _gnutls_send_client_hello (gnutls_session_t session, int again) | 1668 | _gnutls_send_client_hello (mhd_gtls_session_t session, int again) |
1669 | { | 1669 | { |
1670 | opaque *data = NULL; | 1670 | opaque *data = NULL; |
1671 | int extdatalen; | 1671 | int extdatalen; |
@@ -1703,7 +1703,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1703 | * version number to the previously established. | 1703 | * version number to the previously established. |
1704 | */ | 1704 | */ |
1705 | if (SessionID == NULL) | 1705 | if (SessionID == NULL) |
1706 | hver = _gnutls_version_max (session); | 1706 | hver = mhd_gtls_version_max (session); |
1707 | else | 1707 | else |
1708 | { /* we are resuming a session */ | 1708 | { /* we are resuming a session */ |
1709 | hver = session->internals.resumed_security_parameters.version; | 1709 | hver = session->internals.resumed_security_parameters.version; |
@@ -1716,13 +1716,13 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1716 | return GNUTLS_E_INTERNAL_ERROR; | 1716 | return GNUTLS_E_INTERNAL_ERROR; |
1717 | } | 1717 | } |
1718 | 1718 | ||
1719 | data[pos++] = _gnutls_version_get_major (hver); | 1719 | data[pos++] = mhd_gtls_version_get_major (hver); |
1720 | data[pos++] = _gnutls_version_get_minor (hver); | 1720 | data[pos++] = mhd_gtls_version_get_minor (hver); |
1721 | 1721 | ||
1722 | /* Set the version we advertized as maximum | 1722 | /* Set the version we advertized as maximum |
1723 | * (RSA uses it). | 1723 | * (RSA uses it). |
1724 | */ | 1724 | */ |
1725 | _gnutls_set_adv_version (session, hver); | 1725 | mhd_gtls_set_adv_version (session, hver); |
1726 | 1726 | ||
1727 | /* Some old implementations do not interoperate if we send a | 1727 | /* Some old implementations do not interoperate if we send a |
1728 | * different version in the record layer. | 1728 | * different version in the record layer. |
@@ -1732,7 +1732,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1732 | * handshake packet and ignore the one in the packet's record | 1732 | * handshake packet and ignore the one in the packet's record |
1733 | * header. | 1733 | * header. |
1734 | */ | 1734 | */ |
1735 | _gnutls_set_current_version (session, hver); | 1735 | mhd_gtls_set_current_version (session, hver); |
1736 | 1736 | ||
1737 | /* In order to know when this session was initiated. | 1737 | /* In order to know when this session was initiated. |
1738 | */ | 1738 | */ |
@@ -1740,8 +1740,8 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1740 | 1740 | ||
1741 | /* Generate random data | 1741 | /* Generate random data |
1742 | */ | 1742 | */ |
1743 | _gnutls_tls_create_random (rnd); | 1743 | mhd_gtls_tls_create_random (rnd); |
1744 | _gnutls_set_client_random (session, rnd); | 1744 | mhd_gtls_set_client_random (session, rnd); |
1745 | 1745 | ||
1746 | memcpy (&data[pos], rnd, TLS_RANDOM_SIZE); | 1746 | memcpy (&data[pos], rnd, TLS_RANDOM_SIZE); |
1747 | pos += TLS_RANDOM_SIZE; | 1747 | pos += TLS_RANDOM_SIZE; |
@@ -1763,7 +1763,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1763 | if (extdatalen > 0) | 1763 | if (extdatalen > 0) |
1764 | { | 1764 | { |
1765 | datalen += extdatalen; | 1765 | datalen += extdatalen; |
1766 | data = gnutls_realloc_fast (data, datalen); | 1766 | data = mhd_gtls_realloc_fast (data, datalen); |
1767 | if (data == NULL) | 1767 | if (data == NULL) |
1768 | { | 1768 | { |
1769 | gnutls_assert (); | 1769 | gnutls_assert (); |
@@ -1791,7 +1791,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1791 | if (extdatalen > 0) | 1791 | if (extdatalen > 0) |
1792 | { | 1792 | { |
1793 | datalen += extdatalen; | 1793 | datalen += extdatalen; |
1794 | data = gnutls_realloc_fast (data, datalen); | 1794 | data = mhd_gtls_realloc_fast (data, datalen); |
1795 | if (data == NULL) | 1795 | if (data == NULL) |
1796 | { | 1796 | { |
1797 | gnutls_assert (); | 1797 | gnutls_assert (); |
@@ -1816,12 +1816,12 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1816 | if (hver >= MHD_GNUTLS_TLS1_0) | 1816 | if (hver >= MHD_GNUTLS_TLS1_0) |
1817 | { | 1817 | { |
1818 | extdatalen = | 1818 | extdatalen = |
1819 | _gnutls_gen_extensions (session, extdata, sizeof (extdata)); | 1819 | mhd_gtls_gen_extensions (session, extdata, sizeof (extdata)); |
1820 | 1820 | ||
1821 | if (extdatalen > 0) | 1821 | if (extdatalen > 0) |
1822 | { | 1822 | { |
1823 | datalen += extdatalen; | 1823 | datalen += extdatalen; |
1824 | data = gnutls_realloc_fast (data, datalen); | 1824 | data = mhd_gtls_realloc_fast (data, datalen); |
1825 | if (data == NULL) | 1825 | if (data == NULL) |
1826 | { | 1826 | { |
1827 | gnutls_assert (); | 1827 | gnutls_assert (); |
@@ -1840,7 +1840,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | ret = | 1842 | ret = |
1843 | _gnutls_send_handshake (session, data, datalen, | 1843 | mhd_gtls_send_handshake (session, data, datalen, |
1844 | GNUTLS_HANDSHAKE_CLIENT_HELLO); | 1844 | GNUTLS_HANDSHAKE_CLIENT_HELLO); |
1845 | gnutls_free (data); | 1845 | gnutls_free (data); |
1846 | 1846 | ||
@@ -1848,7 +1848,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) | |||
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | static int | 1850 | static int |
1851 | _gnutls_send_server_hello (gnutls_session_t session, int again) | 1851 | _gnutls_send_server_hello (mhd_gtls_session_t session, int again) |
1852 | { | 1852 | { |
1853 | opaque *data = NULL; | 1853 | opaque *data = NULL; |
1854 | opaque extdata[MAX_EXT_DATA_LENGTH]; | 1854 | opaque extdata[MAX_EXT_DATA_LENGTH]; |
@@ -1867,7 +1867,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1867 | 1867 | ||
1868 | #ifdef ENABLE_SRP | 1868 | #ifdef ENABLE_SRP |
1869 | if (IS_SRP_KX | 1869 | if (IS_SRP_KX |
1870 | (_gnutls_cipher_suite_get_kx_algo | 1870 | (mhd_gtls_cipher_suite_get_kx_algo |
1871 | (&session->security_parameters.current_cipher_suite))) | 1871 | (&session->security_parameters.current_cipher_suite))) |
1872 | { | 1872 | { |
1873 | /* While resuming we cannot check the username extension since it is | 1873 | /* While resuming we cannot check the username extension since it is |
@@ -1882,7 +1882,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1882 | * alert and abort. | 1882 | * alert and abort. |
1883 | */ | 1883 | */ |
1884 | gnutls_assert (); | 1884 | gnutls_assert (); |
1885 | ret = gnutls_alert_send (session, GNUTLS_AL_FATAL, | 1885 | ret = MHD_gnutls_alert_send (session, GNUTLS_AL_FATAL, |
1886 | GNUTLS_A_UNKNOWN_PSK_IDENTITY); | 1886 | GNUTLS_A_UNKNOWN_PSK_IDENTITY); |
1887 | if (ret < 0) | 1887 | if (ret < 0) |
1888 | { | 1888 | { |
@@ -1899,7 +1899,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1899 | { | 1899 | { |
1900 | datalen = 2 + session_id_len + 1 + TLS_RANDOM_SIZE + 3; | 1900 | datalen = 2 + session_id_len + 1 + TLS_RANDOM_SIZE + 3; |
1901 | extdatalen = | 1901 | extdatalen = |
1902 | _gnutls_gen_extensions (session, extdata, sizeof (extdata)); | 1902 | mhd_gtls_gen_extensions (session, extdata, sizeof (extdata)); |
1903 | 1903 | ||
1904 | if (extdatalen < 0) | 1904 | if (extdatalen < 0) |
1905 | { | 1905 | { |
@@ -1915,9 +1915,9 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | data[pos++] = | 1917 | data[pos++] = |
1918 | _gnutls_version_get_major (session->security_parameters.version); | 1918 | mhd_gtls_version_get_major (session->security_parameters.version); |
1919 | data[pos++] = | 1919 | data[pos++] = |
1920 | _gnutls_version_get_minor (session->security_parameters.version); | 1920 | mhd_gtls_version_get_minor (session->security_parameters.version); |
1921 | 1921 | ||
1922 | memcpy (&data[pos], | 1922 | memcpy (&data[pos], |
1923 | session->security_parameters.server_random, TLS_RANDOM_SIZE); | 1923 | session->security_parameters.server_random, TLS_RANDOM_SIZE); |
@@ -1931,7 +1931,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1931 | pos += session_id_len; | 1931 | pos += session_id_len; |
1932 | 1932 | ||
1933 | _gnutls_handshake_log ("HSK[%x]: SessionID: %s\n", session, | 1933 | _gnutls_handshake_log ("HSK[%x]: SessionID: %s\n", session, |
1934 | _gnutls_bin2hex (SessionID, session_id_len, | 1934 | mhd_gtls_bin2hex (SessionID, session_id_len, |
1935 | buf, sizeof (buf))); | 1935 | buf, sizeof (buf))); |
1936 | 1936 | ||
1937 | memcpy (&data[pos], | 1937 | memcpy (&data[pos], |
@@ -1939,7 +1939,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1939 | pos += 2; | 1939 | pos += 2; |
1940 | 1940 | ||
1941 | comp = | 1941 | comp = |
1942 | (uint8_t) _gnutls_compression_get_num (session-> | 1942 | (uint8_t) mhd_gtls_compression_get_num (session-> |
1943 | internals.compression_method); | 1943 | internals.compression_method); |
1944 | data[pos++] = comp; | 1944 | data[pos++] = comp; |
1945 | 1945 | ||
@@ -1953,7 +1953,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | ret = | 1955 | ret = |
1956 | _gnutls_send_handshake (session, data, datalen, | 1956 | mhd_gtls_send_handshake (session, data, datalen, |
1957 | GNUTLS_HANDSHAKE_SERVER_HELLO); | 1957 | GNUTLS_HANDSHAKE_SERVER_HELLO); |
1958 | gnutls_afree (data); | 1958 | gnutls_afree (data); |
1959 | 1959 | ||
@@ -1961,7 +1961,7 @@ _gnutls_send_server_hello (gnutls_session_t session, int again) | |||
1961 | } | 1961 | } |
1962 | 1962 | ||
1963 | int | 1963 | int |
1964 | _gnutls_send_hello (gnutls_session_t session, int again) | 1964 | mhd_gtls_send_hello (mhd_gtls_session_t session, int again) |
1965 | { | 1965 | { |
1966 | int ret; | 1966 | int ret; |
1967 | 1967 | ||
@@ -1983,7 +1983,7 @@ _gnutls_send_hello (gnutls_session_t session, int again) | |||
1983 | * and internals.compression_method. | 1983 | * and internals.compression_method. |
1984 | */ | 1984 | */ |
1985 | int | 1985 | int |
1986 | _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) | 1986 | mhd_gtls_recv_hello (mhd_gtls_session_t session, opaque * data, int datalen) |
1987 | { | 1987 | { |
1988 | int ret; | 1988 | int ret; |
1989 | 1989 | ||
@@ -2010,7 +2010,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) | |||
2010 | return ret; | 2010 | return ret; |
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | /* The packets in gnutls_handshake (it's more broad than original TLS handshake) | 2013 | /* The packets in MHD_gnutls_handshake (it's more broad than original TLS handshake) |
2014 | * | 2014 | * |
2015 | * Client Server | 2015 | * Client Server |
2016 | * | 2016 | * |
@@ -2034,8 +2034,8 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) | |||
2034 | */ | 2034 | */ |
2035 | 2035 | ||
2036 | /** | 2036 | /** |
2037 | * gnutls_rehandshake - This function will renegotiate security parameters | 2037 | * MHD_gnutls_rehandshake - This function will renegotiate security parameters |
2038 | * @session: is a #gnutls_session_t structure. | 2038 | * @session: is a #mhd_gtls_session_t structure. |
2039 | * | 2039 | * |
2040 | * This function will renegotiate security parameters with the | 2040 | * This function will renegotiate security parameters with the |
2041 | * client. This should only be called in case of a server. | 2041 | * client. This should only be called in case of a server. |
@@ -2044,7 +2044,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) | |||
2044 | * parameters (perform a handshake). | 2044 | * parameters (perform a handshake). |
2045 | * | 2045 | * |
2046 | * If this function succeeds (returns 0), you must call the | 2046 | * If this function succeeds (returns 0), you must call the |
2047 | * gnutls_handshake() function in order to negotiate the new | 2047 | * MHD_gnutls_handshake() function in order to negotiate the new |
2048 | * parameters. | 2048 | * parameters. |
2049 | * | 2049 | * |
2050 | * If the client does not wish to renegotiate parameters he will | 2050 | * If the client does not wish to renegotiate parameters he will |
@@ -2057,7 +2057,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) | |||
2057 | * | 2057 | * |
2058 | **/ | 2058 | **/ |
2059 | int | 2059 | int |
2060 | gnutls_rehandshake (gnutls_session_t session) | 2060 | MHD_gnutls_rehandshake (mhd_gtls_session_t session) |
2061 | { | 2061 | { |
2062 | int ret; | 2062 | int ret; |
2063 | 2063 | ||
@@ -2081,7 +2081,7 @@ gnutls_rehandshake (gnutls_session_t session) | |||
2081 | } | 2081 | } |
2082 | 2082 | ||
2083 | inline static int | 2083 | inline static int |
2084 | _gnutls_abort_handshake (gnutls_session_t session, int ret) | 2084 | _gnutls_abort_handshake (mhd_gtls_session_t session, int ret) |
2085 | { | 2085 | { |
2086 | if (((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) && | 2086 | if (((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) && |
2087 | (gnutls_alert_get (session) == GNUTLS_A_NO_RENEGOTIATION)) | 2087 | (gnutls_alert_get (session) == GNUTLS_A_NO_RENEGOTIATION)) |
@@ -2097,13 +2097,13 @@ _gnutls_abort_handshake (gnutls_session_t session, int ret) | |||
2097 | * required for finished messages. | 2097 | * required for finished messages. |
2098 | */ | 2098 | */ |
2099 | inline static int | 2099 | inline static int |
2100 | _gnutls_handshake_hash_init (gnutls_session_t session) | 2100 | _gnutls_handshake_hash_init (mhd_gtls_session_t session) |
2101 | { | 2101 | { |
2102 | 2102 | ||
2103 | if (session->internals.handshake_mac_handle_md5 == NULL) | 2103 | if (session->internals.handshake_mac_handle_md5 == NULL) |
2104 | { | 2104 | { |
2105 | session->internals.handshake_mac_handle_md5 = | 2105 | session->internals.handshake_mac_handle_md5 = |
2106 | _gnutls_hash_init (MHD_GNUTLS_MAC_MD5); | 2106 | mhd_gtls_hash_init (MHD_GNUTLS_MAC_MD5); |
2107 | 2107 | ||
2108 | if (session->internals.handshake_mac_handle_md5 == GNUTLS_HASH_FAILED) | 2108 | if (session->internals.handshake_mac_handle_md5 == GNUTLS_HASH_FAILED) |
2109 | { | 2109 | { |
@@ -2115,7 +2115,7 @@ _gnutls_handshake_hash_init (gnutls_session_t session) | |||
2115 | if (session->internals.handshake_mac_handle_sha == NULL) | 2115 | if (session->internals.handshake_mac_handle_sha == NULL) |
2116 | { | 2116 | { |
2117 | session->internals.handshake_mac_handle_sha = | 2117 | session->internals.handshake_mac_handle_sha = |
2118 | _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 2118 | mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
2119 | if (session->internals.handshake_mac_handle_sha == GNUTLS_HASH_FAILED) | 2119 | if (session->internals.handshake_mac_handle_sha == GNUTLS_HASH_FAILED) |
2120 | { | 2120 | { |
2121 | gnutls_assert (); | 2121 | gnutls_assert (); |
@@ -2127,19 +2127,19 @@ _gnutls_handshake_hash_init (gnutls_session_t session) | |||
2127 | } | 2127 | } |
2128 | 2128 | ||
2129 | int | 2129 | int |
2130 | _gnutls_send_supplemental (gnutls_session_t session, int again) | 2130 | _gnutls_send_supplemental (mhd_gtls_session_t session, int again) |
2131 | { | 2131 | { |
2132 | int ret = 0; | 2132 | int ret = 0; |
2133 | 2133 | ||
2134 | _gnutls_debug_log ("EXT[%x]: Sending supplemental data\n", session); | 2134 | _gnutls_debug_log ("EXT[%x]: Sending supplemental data\n", session); |
2135 | 2135 | ||
2136 | if (again) | 2136 | if (again) |
2137 | ret = _gnutls_send_handshake (session, NULL, 0, | 2137 | ret = mhd_gtls_send_handshake (session, NULL, 0, |
2138 | GNUTLS_HANDSHAKE_SUPPLEMENTAL); | 2138 | GNUTLS_HANDSHAKE_SUPPLEMENTAL); |
2139 | else | 2139 | else |
2140 | { | 2140 | { |
2141 | gnutls_buffer buf; | 2141 | mhd_gtls_buffer buf; |
2142 | _gnutls_buffer_init (&buf); | 2142 | mhd_gtls_buffer_init (&buf); |
2143 | 2143 | ||
2144 | ret = _gnutls_gen_supplemental (session, &buf); | 2144 | ret = _gnutls_gen_supplemental (session, &buf); |
2145 | if (ret < 0) | 2145 | if (ret < 0) |
@@ -2148,16 +2148,16 @@ _gnutls_send_supplemental (gnutls_session_t session, int again) | |||
2148 | return ret; | 2148 | return ret; |
2149 | } | 2149 | } |
2150 | 2150 | ||
2151 | ret = _gnutls_send_handshake (session, buf.data, buf.length, | 2151 | ret = mhd_gtls_send_handshake (session, buf.data, buf.length, |
2152 | GNUTLS_HANDSHAKE_SUPPLEMENTAL); | 2152 | GNUTLS_HANDSHAKE_SUPPLEMENTAL); |
2153 | _gnutls_buffer_clear (&buf); | 2153 | mhd_gtls_buffer_clear (&buf); |
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | return ret; | 2156 | return ret; |
2157 | } | 2157 | } |
2158 | 2158 | ||
2159 | int | 2159 | int |
2160 | _gnutls_recv_supplemental (gnutls_session_t session) | 2160 | _gnutls_recv_supplemental (mhd_gtls_session_t session) |
2161 | { | 2161 | { |
2162 | uint8_t *data = NULL; | 2162 | uint8_t *data = NULL; |
2163 | int datalen = 0; | 2163 | int datalen = 0; |
@@ -2165,7 +2165,7 @@ _gnutls_recv_supplemental (gnutls_session_t session) | |||
2165 | 2165 | ||
2166 | _gnutls_debug_log ("EXT[%x]: Expecting supplemental data\n", session); | 2166 | _gnutls_debug_log ("EXT[%x]: Expecting supplemental data\n", session); |
2167 | 2167 | ||
2168 | ret = _gnutls_recv_handshake (session, &data, &datalen, | 2168 | ret = mhd_gtls_recv_handshake (session, &data, &datalen, |
2169 | GNUTLS_HANDSHAKE_SUPPLEMENTAL, | 2169 | GNUTLS_HANDSHAKE_SUPPLEMENTAL, |
2170 | OPTIONAL_PACKET); | 2170 | OPTIONAL_PACKET); |
2171 | if (ret < 0) | 2171 | if (ret < 0) |
@@ -2187,8 +2187,8 @@ _gnutls_recv_supplemental (gnutls_session_t session) | |||
2187 | } | 2187 | } |
2188 | 2188 | ||
2189 | /** | 2189 | /** |
2190 | * gnutls_handshake - This is the main function in the handshake protocol. | 2190 | * MHD_gnutls_handshake - This is the main function in the handshake protocol. |
2191 | * @session: is a #gnutls_session_t structure. | 2191 | * @session: is a #mhd_gtls_session_t structure. |
2192 | * | 2192 | * |
2193 | * This function does the handshake of the TLS/SSL protocol, and | 2193 | * This function does the handshake of the TLS/SSL protocol, and |
2194 | * initializes the TLS connection. | 2194 | * initializes the TLS connection. |
@@ -2201,8 +2201,8 @@ _gnutls_recv_supplemental (gnutls_session_t session) | |||
2201 | * The non-fatal errors such as %GNUTLS_E_AGAIN and | 2201 | * The non-fatal errors such as %GNUTLS_E_AGAIN and |
2202 | * %GNUTLS_E_INTERRUPTED interrupt the handshake procedure, which | 2202 | * %GNUTLS_E_INTERRUPTED interrupt the handshake procedure, which |
2203 | * should be later be resumed. Call this function again, until it | 2203 | * should be later be resumed. Call this function again, until it |
2204 | * returns 0; cf. gnutls_record_get_direction() and | 2204 | * returns 0; cf. MHD_gnutls_record_get_direction() and |
2205 | * gnutls_error_is_fatal(). | 2205 | * MHD_gtls_error_is_fatal(). |
2206 | * | 2206 | * |
2207 | * If this function is called by a server after a rehandshake request | 2207 | * If this function is called by a server after a rehandshake request |
2208 | * then %GNUTLS_E_GOT_APPLICATION_DATA or | 2208 | * then %GNUTLS_E_GOT_APPLICATION_DATA or |
@@ -2214,7 +2214,7 @@ _gnutls_recv_supplemental (gnutls_session_t session) | |||
2214 | * | 2214 | * |
2215 | **/ | 2215 | **/ |
2216 | int | 2216 | int |
2217 | gnutls_handshake (gnutls_session_t session) | 2217 | MHD_gnutls_handshake (mhd_gtls_session_t session) |
2218 | { | 2218 | { |
2219 | int ret; | 2219 | int ret; |
2220 | 2220 | ||
@@ -2226,11 +2226,11 @@ gnutls_handshake (gnutls_session_t session) | |||
2226 | 2226 | ||
2227 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 2227 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
2228 | { | 2228 | { |
2229 | ret = _gnutls_handshake_client (session); | 2229 | ret = mhd_gtls_handshake_client (session); |
2230 | } | 2230 | } |
2231 | else | 2231 | else |
2232 | { | 2232 | { |
2233 | ret = _gnutls_handshake_server (session); | 2233 | ret = mhd_gtls_handshake_server (session); |
2234 | } | 2234 | } |
2235 | if (ret < 0) | 2235 | if (ret < 0) |
2236 | { | 2236 | { |
@@ -2243,7 +2243,7 @@ gnutls_handshake (gnutls_session_t session) | |||
2243 | return ret; | 2243 | return ret; |
2244 | } | 2244 | } |
2245 | 2245 | ||
2246 | ret = _gnutls_handshake_common (session); | 2246 | ret = mhd_gtls_handshake_common (session); |
2247 | 2247 | ||
2248 | if (ret < 0) | 2248 | if (ret < 0) |
2249 | { | 2249 | { |
@@ -2256,14 +2256,14 @@ gnutls_handshake (gnutls_session_t session) | |||
2256 | STATE = STATE0; | 2256 | STATE = STATE0; |
2257 | 2257 | ||
2258 | _gnutls_handshake_io_buffer_clear (session); | 2258 | _gnutls_handshake_io_buffer_clear (session); |
2259 | _gnutls_handshake_internal_state_clear (session); | 2259 | mhd_gtls_handshake_internal_state_clear (session); |
2260 | 2260 | ||
2261 | return 0; | 2261 | return 0; |
2262 | } | 2262 | } |
2263 | 2263 | ||
2264 | #define IMED_RET( str, ret) do { \ | 2264 | #define IMED_RET( str, ret) do { \ |
2265 | if (ret < 0) { \ | 2265 | if (ret < 0) { \ |
2266 | if (gnutls_error_is_fatal(ret)==0) return ret; \ | 2266 | if (MHD_gtls_error_is_fatal(ret)==0) return ret; \ |
2267 | gnutls_assert(); \ | 2267 | gnutls_assert(); \ |
2268 | ERR( str, ret); \ | 2268 | ERR( str, ret); \ |
2269 | _gnutls_handshake_hash_buffers_clear(session); \ | 2269 | _gnutls_handshake_hash_buffers_clear(session); \ |
@@ -2273,11 +2273,11 @@ gnutls_handshake (gnutls_session_t session) | |||
2273 | 2273 | ||
2274 | 2274 | ||
2275 | /* | 2275 | /* |
2276 | * _gnutls_handshake_client | 2276 | * mhd_gtls_handshake_client |
2277 | * This function performs the client side of the handshake of the TLS/SSL protocol. | 2277 | * This function performs the client side of the handshake of the TLS/SSL protocol. |
2278 | */ | 2278 | */ |
2279 | int | 2279 | int |
2280 | _gnutls_handshake_client (gnutls_session_t session) | 2280 | mhd_gtls_handshake_client (mhd_gtls_session_t session) |
2281 | { | 2281 | { |
2282 | int ret = 0; | 2282 | int ret = 0; |
2283 | 2283 | ||
@@ -2286,7 +2286,7 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2286 | 2286 | ||
2287 | if (session->internals.resumed_security_parameters.session_id_size > 0) | 2287 | if (session->internals.resumed_security_parameters.session_id_size > 0) |
2288 | _gnutls_handshake_log ("HSK[%x]: Ask to resume: %s\n", session, | 2288 | _gnutls_handshake_log ("HSK[%x]: Ask to resume: %s\n", session, |
2289 | _gnutls_bin2hex (session->internals. | 2289 | mhd_gtls_bin2hex (session->internals. |
2290 | resumed_security_parameters. | 2290 | resumed_security_parameters. |
2291 | session_id, | 2291 | session_id, |
2292 | session->internals. | 2292 | session->internals. |
@@ -2299,14 +2299,14 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2299 | { | 2299 | { |
2300 | case STATE0: | 2300 | case STATE0: |
2301 | case STATE1: | 2301 | case STATE1: |
2302 | ret = _gnutls_send_hello (session, AGAIN (STATE1)); | 2302 | ret = mhd_gtls_send_hello (session, AGAIN (STATE1)); |
2303 | STATE = STATE1; | 2303 | STATE = STATE1; |
2304 | IMED_RET ("send hello", ret); | 2304 | IMED_RET ("send hello", ret); |
2305 | 2305 | ||
2306 | case STATE2: | 2306 | case STATE2: |
2307 | /* receive the server hello */ | 2307 | /* receive the server hello */ |
2308 | ret = | 2308 | ret = |
2309 | _gnutls_recv_handshake (session, NULL, NULL, | 2309 | mhd_gtls_recv_handshake (session, NULL, NULL, |
2310 | GNUTLS_HANDSHAKE_SERVER_HELLO, | 2310 | GNUTLS_HANDSHAKE_SERVER_HELLO, |
2311 | MANDATORY_PACKET); | 2311 | MANDATORY_PACKET); |
2312 | STATE = STATE2; | 2312 | STATE = STATE2; |
@@ -2323,14 +2323,14 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2323 | case STATE3: | 2323 | case STATE3: |
2324 | /* RECV CERTIFICATE */ | 2324 | /* RECV CERTIFICATE */ |
2325 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2325 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2326 | ret = _gnutls_recv_server_certificate (session); | 2326 | ret = mhd_gtls_recv_server_certificate (session); |
2327 | STATE = STATE3; | 2327 | STATE = STATE3; |
2328 | IMED_RET ("recv server certificate", ret); | 2328 | IMED_RET ("recv server certificate", ret); |
2329 | 2329 | ||
2330 | case STATE4: | 2330 | case STATE4: |
2331 | /* receive the server key exchange */ | 2331 | /* receive the server key exchange */ |
2332 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2332 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2333 | ret = _gnutls_recv_server_kx_message (session); | 2333 | ret = mhd_gtls_recv_server_kx_message (session); |
2334 | STATE = STATE4; | 2334 | STATE = STATE4; |
2335 | IMED_RET ("recv server kx message", ret); | 2335 | IMED_RET ("recv server kx message", ret); |
2336 | 2336 | ||
@@ -2339,7 +2339,7 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2339 | */ | 2339 | */ |
2340 | 2340 | ||
2341 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2341 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2342 | ret = _gnutls_recv_server_certificate_request (session); | 2342 | ret = mhd_gtls_recv_server_certificate_request (session); |
2343 | STATE = STATE5; | 2343 | STATE = STATE5; |
2344 | IMED_RET ("recv server certificate request message", ret); | 2344 | IMED_RET ("recv server certificate request message", ret); |
2345 | 2345 | ||
@@ -2347,7 +2347,7 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2347 | /* receive the server hello done */ | 2347 | /* receive the server hello done */ |
2348 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2348 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2349 | ret = | 2349 | ret = |
2350 | _gnutls_recv_handshake (session, NULL, NULL, | 2350 | mhd_gtls_recv_handshake (session, NULL, NULL, |
2351 | GNUTLS_HANDSHAKE_SERVER_HELLO_DONE, | 2351 | GNUTLS_HANDSHAKE_SERVER_HELLO_DONE, |
2352 | MANDATORY_PACKET); | 2352 | MANDATORY_PACKET); |
2353 | STATE = STATE6; | 2353 | STATE = STATE6; |
@@ -2365,13 +2365,13 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2365 | /* send our certificate - if any and if requested | 2365 | /* send our certificate - if any and if requested |
2366 | */ | 2366 | */ |
2367 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2367 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2368 | ret = _gnutls_send_client_certificate (session, AGAIN (STATE7)); | 2368 | ret = mhd_gtls_send_client_certificate (session, AGAIN (STATE7)); |
2369 | STATE = STATE7; | 2369 | STATE = STATE7; |
2370 | IMED_RET ("send client certificate", ret); | 2370 | IMED_RET ("send client certificate", ret); |
2371 | 2371 | ||
2372 | case STATE8: | 2372 | case STATE8: |
2373 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2373 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2374 | ret = _gnutls_send_client_kx_message (session, AGAIN (STATE8)); | 2374 | ret = mhd_gtls_send_client_kx_message (session, AGAIN (STATE8)); |
2375 | STATE = STATE8; | 2375 | STATE = STATE8; |
2376 | IMED_RET ("send client kx", ret); | 2376 | IMED_RET ("send client kx", ret); |
2377 | 2377 | ||
@@ -2379,7 +2379,7 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2379 | /* send client certificate verify */ | 2379 | /* send client certificate verify */ |
2380 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2380 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2381 | ret = | 2381 | ret = |
2382 | _gnutls_send_client_certificate_verify (session, AGAIN (STATE9)); | 2382 | mhd_gtls_send_client_certificate_verify (session, AGAIN (STATE9)); |
2383 | STATE = STATE9; | 2383 | STATE = STATE9; |
2384 | IMED_RET ("send client certificate verify", ret); | 2384 | IMED_RET ("send client certificate verify", ret); |
2385 | 2385 | ||
@@ -2395,7 +2395,7 @@ _gnutls_handshake_client (gnutls_session_t session) | |||
2395 | /* This function sends the final handshake packets and initializes connection | 2395 | /* This function sends the final handshake packets and initializes connection |
2396 | */ | 2396 | */ |
2397 | static int | 2397 | static int |
2398 | _gnutls_send_handshake_final (gnutls_session_t session, int init) | 2398 | _gnutls_send_handshake_final (mhd_gtls_session_t session, int init) |
2399 | { | 2399 | { |
2400 | int ret = 0; | 2400 | int ret = 0; |
2401 | 2401 | ||
@@ -2405,7 +2405,7 @@ _gnutls_send_handshake_final (gnutls_session_t session, int init) | |||
2405 | { | 2405 | { |
2406 | case STATE0: | 2406 | case STATE0: |
2407 | case STATE20: | 2407 | case STATE20: |
2408 | ret = _gnutls_send_change_cipher_spec (session, AGAIN (STATE20)); | 2408 | ret = mhd_gtls_send_change_cipher_spec (session, AGAIN (STATE20)); |
2409 | STATE = STATE20; | 2409 | STATE = STATE20; |
2410 | if (ret < 0) | 2410 | if (ret < 0) |
2411 | { | 2411 | { |
@@ -2418,7 +2418,7 @@ _gnutls_send_handshake_final (gnutls_session_t session, int init) | |||
2418 | */ | 2418 | */ |
2419 | if (init == TRUE) | 2419 | if (init == TRUE) |
2420 | { | 2420 | { |
2421 | ret = _gnutls_connection_state_init (session); | 2421 | ret = mhd_gtls_connection_state_init (session); |
2422 | if (ret < 0) | 2422 | if (ret < 0) |
2423 | { | 2423 | { |
2424 | gnutls_assert (); | 2424 | gnutls_assert (); |
@@ -2426,7 +2426,7 @@ _gnutls_send_handshake_final (gnutls_session_t session, int init) | |||
2426 | } | 2426 | } |
2427 | } | 2427 | } |
2428 | 2428 | ||
2429 | ret = _gnutls_write_connection_state_init (session); | 2429 | ret = mhd_gtls_write_connection_state_init (session); |
2430 | if (ret < 0) | 2430 | if (ret < 0) |
2431 | { | 2431 | { |
2432 | gnutls_assert (); | 2432 | gnutls_assert (); |
@@ -2457,7 +2457,7 @@ _gnutls_send_handshake_final (gnutls_session_t session, int init) | |||
2457 | * read session. | 2457 | * read session. |
2458 | */ | 2458 | */ |
2459 | static int | 2459 | static int |
2460 | _gnutls_recv_handshake_final (gnutls_session_t session, int init) | 2460 | _gnutls_recv_handshake_final (mhd_gtls_session_t session, int init) |
2461 | { | 2461 | { |
2462 | int ret = 0; | 2462 | int ret = 0; |
2463 | uint8_t ch; | 2463 | uint8_t ch; |
@@ -2466,7 +2466,7 @@ _gnutls_recv_handshake_final (gnutls_session_t session, int init) | |||
2466 | { | 2466 | { |
2467 | case STATE0: | 2467 | case STATE0: |
2468 | case STATE30: | 2468 | case STATE30: |
2469 | ret = _gnutls_recv_int (session, GNUTLS_CHANGE_CIPHER_SPEC, -1, &ch, 1); | 2469 | ret = mhd_gtls_recv_int (session, GNUTLS_CHANGE_CIPHER_SPEC, -1, &ch, 1); |
2470 | STATE = STATE30; | 2470 | STATE = STATE30; |
2471 | if (ret <= 0) | 2471 | if (ret <= 0) |
2472 | { | 2472 | { |
@@ -2478,7 +2478,7 @@ _gnutls_recv_handshake_final (gnutls_session_t session, int init) | |||
2478 | /* Initialize the connection session (start encryption) - in case of server */ | 2478 | /* Initialize the connection session (start encryption) - in case of server */ |
2479 | if (init == TRUE) | 2479 | if (init == TRUE) |
2480 | { | 2480 | { |
2481 | ret = _gnutls_connection_state_init (session); | 2481 | ret = mhd_gtls_connection_state_init (session); |
2482 | if (ret < 0) | 2482 | if (ret < 0) |
2483 | { | 2483 | { |
2484 | gnutls_assert (); | 2484 | gnutls_assert (); |
@@ -2486,7 +2486,7 @@ _gnutls_recv_handshake_final (gnutls_session_t session, int init) | |||
2486 | } | 2486 | } |
2487 | } | 2487 | } |
2488 | 2488 | ||
2489 | ret = _gnutls_read_connection_state_init (session); | 2489 | ret = mhd_gtls_read_connection_state_init (session); |
2490 | if (ret < 0) | 2490 | if (ret < 0) |
2491 | { | 2491 | { |
2492 | gnutls_assert (); | 2492 | gnutls_assert (); |
@@ -2512,12 +2512,12 @@ _gnutls_recv_handshake_final (gnutls_session_t session, int init) | |||
2512 | } | 2512 | } |
2513 | 2513 | ||
2514 | /* | 2514 | /* |
2515 | * _gnutls_handshake_server | 2515 | * mhd_gtls_handshake_server |
2516 | * This function does the server stuff of the handshake protocol. | 2516 | * This function does the server stuff of the handshake protocol. |
2517 | */ | 2517 | */ |
2518 | 2518 | ||
2519 | int | 2519 | int |
2520 | _gnutls_handshake_server (gnutls_session_t session) | 2520 | mhd_gtls_handshake_server (mhd_gtls_session_t session) |
2521 | { | 2521 | { |
2522 | int ret = 0; | 2522 | int ret = 0; |
2523 | 2523 | ||
@@ -2526,14 +2526,14 @@ _gnutls_handshake_server (gnutls_session_t session) | |||
2526 | case STATE0: | 2526 | case STATE0: |
2527 | case STATE1: | 2527 | case STATE1: |
2528 | ret = | 2528 | ret = |
2529 | _gnutls_recv_handshake (session, NULL, NULL, | 2529 | mhd_gtls_recv_handshake (session, NULL, NULL, |
2530 | GNUTLS_HANDSHAKE_CLIENT_HELLO, | 2530 | GNUTLS_HANDSHAKE_CLIENT_HELLO, |
2531 | MANDATORY_PACKET); | 2531 | MANDATORY_PACKET); |
2532 | STATE = STATE1; | 2532 | STATE = STATE1; |
2533 | IMED_RET ("recv hello", ret); | 2533 | IMED_RET ("recv hello", ret); |
2534 | 2534 | ||
2535 | case STATE2: | 2535 | case STATE2: |
2536 | ret = _gnutls_send_hello (session, AGAIN (STATE2)); | 2536 | ret = mhd_gtls_send_hello (session, AGAIN (STATE2)); |
2537 | STATE = STATE2; | 2537 | STATE = STATE2; |
2538 | IMED_RET ("send hello", ret); | 2538 | IMED_RET ("send hello", ret); |
2539 | 2539 | ||
@@ -2550,14 +2550,14 @@ _gnutls_handshake_server (gnutls_session_t session) | |||
2550 | /* NOTE: these should not be send if we are resuming */ | 2550 | /* NOTE: these should not be send if we are resuming */ |
2551 | 2551 | ||
2552 | if (session->internals.resumed == RESUME_FALSE) | 2552 | if (session->internals.resumed == RESUME_FALSE) |
2553 | ret = _gnutls_send_server_certificate (session, AGAIN (STATE3)); | 2553 | ret = mhd_gtls_send_server_certificate (session, AGAIN (STATE3)); |
2554 | STATE = STATE3; | 2554 | STATE = STATE3; |
2555 | IMED_RET ("send server certificate", ret); | 2555 | IMED_RET ("send server certificate", ret); |
2556 | 2556 | ||
2557 | case STATE4: | 2557 | case STATE4: |
2558 | /* send server key exchange (A) */ | 2558 | /* send server key exchange (A) */ |
2559 | if (session->internals.resumed == RESUME_FALSE) | 2559 | if (session->internals.resumed == RESUME_FALSE) |
2560 | ret = _gnutls_send_server_kx_message (session, AGAIN (STATE4)); | 2560 | ret = mhd_gtls_send_server_kx_message (session, AGAIN (STATE4)); |
2561 | STATE = STATE4; | 2561 | STATE = STATE4; |
2562 | IMED_RET ("send server kx", ret); | 2562 | IMED_RET ("send server kx", ret); |
2563 | 2563 | ||
@@ -2565,7 +2565,7 @@ _gnutls_handshake_server (gnutls_session_t session) | |||
2565 | /* Send certificate request - if requested to */ | 2565 | /* Send certificate request - if requested to */ |
2566 | if (session->internals.resumed == RESUME_FALSE) | 2566 | if (session->internals.resumed == RESUME_FALSE) |
2567 | ret = | 2567 | ret = |
2568 | _gnutls_send_server_certificate_request (session, AGAIN (STATE5)); | 2568 | mhd_gtls_send_server_certificate_request (session, AGAIN (STATE5)); |
2569 | STATE = STATE5; | 2569 | STATE = STATE5; |
2570 | IMED_RET ("send server cert request", ret); | 2570 | IMED_RET ("send server cert request", ret); |
2571 | 2571 | ||
@@ -2591,21 +2591,21 @@ _gnutls_handshake_server (gnutls_session_t session) | |||
2591 | case STATE7: | 2591 | case STATE7: |
2592 | /* receive the client certificate message */ | 2592 | /* receive the client certificate message */ |
2593 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2593 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2594 | ret = _gnutls_recv_client_certificate (session); | 2594 | ret = mhd_gtls_recv_client_certificate (session); |
2595 | STATE = STATE7; | 2595 | STATE = STATE7; |
2596 | IMED_RET ("recv client certificate", ret); | 2596 | IMED_RET ("recv client certificate", ret); |
2597 | 2597 | ||
2598 | case STATE8: | 2598 | case STATE8: |
2599 | /* receive the client key exchange message */ | 2599 | /* receive the client key exchange message */ |
2600 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2600 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2601 | ret = _gnutls_recv_client_kx_message (session); | 2601 | ret = mhd_gtls_recv_client_kx_message (session); |
2602 | STATE = STATE8; | 2602 | STATE = STATE8; |
2603 | IMED_RET ("recv client kx", ret); | 2603 | IMED_RET ("recv client kx", ret); |
2604 | 2604 | ||
2605 | case STATE9: | 2605 | case STATE9: |
2606 | /* receive the client certificate verify message */ | 2606 | /* receive the client certificate verify message */ |
2607 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ | 2607 | if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */ |
2608 | ret = _gnutls_recv_client_certificate_verify_message (session); | 2608 | ret = mhd_gtls_recv_client_certificate_verify_message (session); |
2609 | STATE = STATE9; | 2609 | STATE = STATE9; |
2610 | IMED_RET ("recv client certificate verify", ret); | 2610 | IMED_RET ("recv client certificate verify", ret); |
2611 | 2611 | ||
@@ -2618,7 +2618,7 @@ _gnutls_handshake_server (gnutls_session_t session) | |||
2618 | } | 2618 | } |
2619 | 2619 | ||
2620 | int | 2620 | int |
2621 | _gnutls_handshake_common (gnutls_session_t session) | 2621 | mhd_gtls_handshake_common (mhd_gtls_session_t session) |
2622 | { | 2622 | { |
2623 | int ret = 0; | 2623 | int ret = 0; |
2624 | 2624 | ||
@@ -2653,7 +2653,7 @@ _gnutls_handshake_common (gnutls_session_t session) | |||
2653 | } | 2653 | } |
2654 | 2654 | ||
2655 | int | 2655 | int |
2656 | _gnutls_generate_session_id (opaque * session_id, uint8_t * len) | 2656 | mhd_gtls_generate_session_id (opaque * session_id, uint8_t * len) |
2657 | { | 2657 | { |
2658 | *len = TLS_MAX_SESSION_ID_SIZE; | 2658 | *len = TLS_MAX_SESSION_ID_SIZE; |
2659 | 2659 | ||
@@ -2667,7 +2667,7 @@ _gnutls_generate_session_id (opaque * session_id, uint8_t * len) | |||
2667 | } | 2667 | } |
2668 | 2668 | ||
2669 | int | 2669 | int |
2670 | _gnutls_recv_hello_request (gnutls_session_t session, void *data, | 2670 | mhd_gtls_recv_hello_request (mhd_gtls_session_t session, void *data, |
2671 | uint32_t data_size) | 2671 | uint32_t data_size) |
2672 | { | 2672 | { |
2673 | uint8_t type; | 2673 | uint8_t type; |
@@ -2696,33 +2696,33 @@ _gnutls_recv_hello_request (gnutls_session_t session, void *data, | |||
2696 | * (DH or RSA) set up. Otherwise returns 0. | 2696 | * (DH or RSA) set up. Otherwise returns 0. |
2697 | */ | 2697 | */ |
2698 | inline static int | 2698 | inline static int |
2699 | check_server_params (gnutls_session_t session, | 2699 | check_server_params (mhd_gtls_session_t session, |
2700 | gnutls_kx_algorithm_t kx, | 2700 | gnutls_kx_algorithm_t kx, |
2701 | gnutls_kx_algorithm_t * alg, int alg_size) | 2701 | gnutls_kx_algorithm_t * alg, int alg_size) |
2702 | { | 2702 | { |
2703 | int cred_type; | 2703 | int cred_type; |
2704 | gnutls_dh_params_t dh_params = NULL; | 2704 | mhd_gtls_dh_params_t dh_params = NULL; |
2705 | gnutls_rsa_params_t rsa_params = NULL; | 2705 | mhd_gtls_rsa_params_t rsa_params = NULL; |
2706 | int j; | 2706 | int j; |
2707 | 2707 | ||
2708 | cred_type = _gnutls_map_kx_get_cred (kx, 1); | 2708 | cred_type = mhd_gtls_map_kx_get_cred (kx, 1); |
2709 | 2709 | ||
2710 | /* Read the Diffie Hellman parameters, if any. | 2710 | /* Read the Diffie Hellman parameters, if any. |
2711 | */ | 2711 | */ |
2712 | if (cred_type == MHD_GNUTLS_CRD_CERTIFICATE) | 2712 | if (cred_type == MHD_GNUTLS_CRD_CERTIFICATE) |
2713 | { | 2713 | { |
2714 | int delete; | 2714 | int delete; |
2715 | gnutls_certificate_credentials_t x509_cred = | 2715 | mhd_gtls_cert_credentials_t x509_cred = |
2716 | (gnutls_certificate_credentials_t) _gnutls_get_cred (session->key, | 2716 | (mhd_gtls_cert_credentials_t) mhd_gtls_get_cred (session->key, |
2717 | cred_type, NULL); | 2717 | cred_type, NULL); |
2718 | 2718 | ||
2719 | if (x509_cred != NULL) | 2719 | if (x509_cred != NULL) |
2720 | { | 2720 | { |
2721 | dh_params = | 2721 | dh_params = |
2722 | _gnutls_get_dh_params (x509_cred->dh_params, | 2722 | mhd_gtls_get_dh_params (x509_cred->dh_params, |
2723 | x509_cred->params_func, session); | 2723 | x509_cred->params_func, session); |
2724 | rsa_params = | 2724 | rsa_params = |
2725 | _gnutls_certificate_get_rsa_params (x509_cred->rsa_params, | 2725 | mhd_gtls_certificate_get_rsa_params (x509_cred->rsa_params, |
2726 | x509_cred->params_func, | 2726 | x509_cred->params_func, |
2727 | session); | 2727 | session); |
2728 | } | 2728 | } |
@@ -2747,14 +2747,14 @@ check_server_params (gnutls_session_t session, | |||
2747 | } | 2747 | } |
2748 | else if (cred_type == MHD_GNUTLS_CRD_ANON) | 2748 | else if (cred_type == MHD_GNUTLS_CRD_ANON) |
2749 | { | 2749 | { |
2750 | gnutls_anon_server_credentials_t anon_cred = | 2750 | mhd_gtls_anon_server_credentials_t anon_cred = |
2751 | (gnutls_anon_server_credentials_t) _gnutls_get_cred (session->key, | 2751 | (mhd_gtls_anon_server_credentials_t) mhd_gtls_get_cred (session->key, |
2752 | cred_type, NULL); | 2752 | cred_type, NULL); |
2753 | 2753 | ||
2754 | if (anon_cred != NULL) | 2754 | if (anon_cred != NULL) |
2755 | { | 2755 | { |
2756 | dh_params = | 2756 | dh_params = |
2757 | _gnutls_get_dh_params (anon_cred->dh_params, | 2757 | mhd_gtls_get_dh_params (anon_cred->dh_params, |
2758 | anon_cred->params_func, session); | 2758 | anon_cred->params_func, session); |
2759 | } | 2759 | } |
2760 | #endif | 2760 | #endif |
@@ -2763,13 +2763,13 @@ check_server_params (gnutls_session_t session, | |||
2763 | else if (cred_type == MHD_GNUTLS_CRD_PSK) | 2763 | else if (cred_type == MHD_GNUTLS_CRD_PSK) |
2764 | { | 2764 | { |
2765 | gnutls_psk_server_credentials_t psk_cred = | 2765 | gnutls_psk_server_credentials_t psk_cred = |
2766 | (gnutls_psk_server_credentials_t) _gnutls_get_cred (session->key, | 2766 | (gnutls_psk_server_credentials_t) mhd_gtls_get_cred (session->key, |
2767 | cred_type, NULL); | 2767 | cred_type, NULL); |
2768 | 2768 | ||
2769 | if (psk_cred != NULL) | 2769 | if (psk_cred != NULL) |
2770 | { | 2770 | { |
2771 | dh_params = | 2771 | dh_params = |
2772 | _gnutls_get_dh_params (psk_cred->dh_params, psk_cred->params_func, | 2772 | mhd_gtls_get_dh_params (psk_cred->dh_params, psk_cred->params_func, |
2773 | session); | 2773 | session); |
2774 | } | 2774 | } |
2775 | #endif | 2775 | #endif |
@@ -2781,7 +2781,7 @@ check_server_params (gnutls_session_t session, | |||
2781 | /* If the key exchange method needs RSA or DH params, | 2781 | /* If the key exchange method needs RSA or DH params, |
2782 | * but they are not set then remove it. | 2782 | * but they are not set then remove it. |
2783 | */ | 2783 | */ |
2784 | if (_gnutls_kx_needs_rsa_params (kx) != 0) | 2784 | if (mhd_gtls_kx_needs_rsa_params (kx) != 0) |
2785 | { | 2785 | { |
2786 | /* needs rsa params. */ | 2786 | /* needs rsa params. */ |
2787 | if (_gnutls_rsa_params_to_mpi (rsa_params) == NULL) | 2787 | if (_gnutls_rsa_params_to_mpi (rsa_params) == NULL) |
@@ -2791,10 +2791,10 @@ check_server_params (gnutls_session_t session, | |||
2791 | } | 2791 | } |
2792 | } | 2792 | } |
2793 | 2793 | ||
2794 | if (_gnutls_kx_needs_dh_params (kx) != 0) | 2794 | if (mhd_gtls_kx_needs_dh_params (kx) != 0) |
2795 | { | 2795 | { |
2796 | /* needs DH params. */ | 2796 | /* needs DH params. */ |
2797 | if (_gnutls_dh_params_to_mpi (dh_params) == NULL) | 2797 | if (mhd_gtls_dh_params_to_mpi (dh_params) == NULL) |
2798 | { | 2798 | { |
2799 | gnutls_assert (); | 2799 | gnutls_assert (); |
2800 | return 1; | 2800 | return 1; |
@@ -2812,7 +2812,7 @@ check_server_params (gnutls_session_t session, | |||
2812 | * by checking certificates etc. | 2812 | * by checking certificates etc. |
2813 | */ | 2813 | */ |
2814 | int | 2814 | int |
2815 | _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | 2815 | mhd_gtls_remove_unwanted_ciphersuites (mhd_gtls_session_t session, |
2816 | cipher_suite_st ** cipherSuites, | 2816 | cipher_suite_st ** cipherSuites, |
2817 | int numCipherSuites, | 2817 | int numCipherSuites, |
2818 | gnutls_pk_algorithm_t requested_pk_algo) | 2818 | gnutls_pk_algorithm_t requested_pk_algo) |
@@ -2821,7 +2821,7 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2821 | int ret = 0; | 2821 | int ret = 0; |
2822 | cipher_suite_st *newSuite, cs; | 2822 | cipher_suite_st *newSuite, cs; |
2823 | int newSuiteSize = 0, i; | 2823 | int newSuiteSize = 0, i; |
2824 | gnutls_certificate_credentials_t cert_cred; | 2824 | mhd_gtls_cert_credentials_t cert_cred; |
2825 | gnutls_kx_algorithm_t kx; | 2825 | gnutls_kx_algorithm_t kx; |
2826 | int server = session->security_parameters.entity == GNUTLS_SERVER ? 1 : 0; | 2826 | int server = session->security_parameters.entity == GNUTLS_SERVER ? 1 : 0; |
2827 | gnutls_kx_algorithm_t *alg = NULL; | 2827 | gnutls_kx_algorithm_t *alg = NULL; |
@@ -2834,7 +2834,7 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2834 | */ | 2834 | */ |
2835 | 2835 | ||
2836 | cert_cred = | 2836 | cert_cred = |
2837 | (gnutls_certificate_credentials_t) _gnutls_get_cred (session->key, | 2837 | (mhd_gtls_cert_credentials_t) mhd_gtls_get_cred (session->key, |
2838 | MHD_GNUTLS_CRD_CERTIFICATE, | 2838 | MHD_GNUTLS_CRD_CERTIFICATE, |
2839 | NULL); | 2839 | NULL); |
2840 | 2840 | ||
@@ -2844,12 +2844,12 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2844 | if (session->security_parameters.entity == GNUTLS_SERVER | 2844 | if (session->security_parameters.entity == GNUTLS_SERVER |
2845 | && cert_cred != NULL) | 2845 | && cert_cred != NULL) |
2846 | { | 2846 | { |
2847 | ret = _gnutls_server_select_cert (session, requested_pk_algo); | 2847 | ret = mhd_gtls_server_select_cert (session, requested_pk_algo); |
2848 | if (ret < 0) | 2848 | if (ret < 0) |
2849 | { | 2849 | { |
2850 | gnutls_assert (); | 2850 | gnutls_assert (); |
2851 | _gnutls_x509_log ("Could not find an appropriate certificate: %s\n", | 2851 | _gnutls_x509_log ("Could not find an appropriate certificate: %s\n", |
2852 | gnutls_strerror (ret)); | 2852 | MHD_gtls_strerror (ret)); |
2853 | cert_cred = NULL; | 2853 | cert_cred = NULL; |
2854 | } | 2854 | } |
2855 | } | 2855 | } |
@@ -2858,7 +2858,7 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2858 | * supported by the X509 certificate parameters. | 2858 | * supported by the X509 certificate parameters. |
2859 | */ | 2859 | */ |
2860 | if ((ret = | 2860 | if ((ret = |
2861 | _gnutls_selected_cert_supported_kx (session, &alg, &alg_size)) < 0) | 2861 | mhd_gtls_selected_cert_supported_kx (session, &alg, &alg_size)) < 0) |
2862 | { | 2862 | { |
2863 | gnutls_assert (); | 2863 | gnutls_assert (); |
2864 | return ret; | 2864 | return ret; |
@@ -2881,11 +2881,11 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2881 | /* finds the key exchange algorithm in | 2881 | /* finds the key exchange algorithm in |
2882 | * the ciphersuite | 2882 | * the ciphersuite |
2883 | */ | 2883 | */ |
2884 | kx = _gnutls_cipher_suite_get_kx_algo (&(*cipherSuites)[i]); | 2884 | kx = mhd_gtls_cipher_suite_get_kx_algo (&(*cipherSuites)[i]); |
2885 | 2885 | ||
2886 | /* if it is defined but had no credentials | 2886 | /* if it is defined but had no credentials |
2887 | */ | 2887 | */ |
2888 | if (_gnutls_get_kx_cred (session, kx, NULL) == NULL) | 2888 | if (mhd_gtls_get_kx_cred (session, kx, NULL) == NULL) |
2889 | { | 2889 | { |
2890 | delete = 1; | 2890 | delete = 1; |
2891 | } | 2891 | } |
@@ -2903,7 +2903,7 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2903 | SRP credential too. */ | 2903 | SRP credential too. */ |
2904 | if (kx == MHD_GNUTLS_KX_SRP_RSA || kx == MHD_GNUTLS_KX_SRP_DSS) | 2904 | if (kx == MHD_GNUTLS_KX_SRP_RSA || kx == MHD_GNUTLS_KX_SRP_DSS) |
2905 | { | 2905 | { |
2906 | if (!_gnutls_get_cred (session->key, MHD_GNUTLS_CRD_SRP, NULL)) | 2906 | if (!mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_SRP, NULL)) |
2907 | delete = 1; | 2907 | delete = 1; |
2908 | } | 2908 | } |
2909 | 2909 | ||
@@ -2914,7 +2914,7 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2914 | 2914 | ||
2915 | _gnutls_handshake_log ("HSK[%x]: Keeping ciphersuite: %s\n", | 2915 | _gnutls_handshake_log ("HSK[%x]: Keeping ciphersuite: %s\n", |
2916 | session, | 2916 | session, |
2917 | _gnutls_cipher_suite_get_name (&cs)); | 2917 | mhd_gtls_cipher_suite_get_name (&cs)); |
2918 | 2918 | ||
2919 | memcpy (newSuite[newSuiteSize].suite, (*cipherSuites)[i].suite, 2); | 2919 | memcpy (newSuite[newSuiteSize].suite, (*cipherSuites)[i].suite, 2); |
2920 | newSuiteSize++; | 2920 | newSuiteSize++; |
@@ -2923,7 +2923,7 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2923 | { | 2923 | { |
2924 | _gnutls_handshake_log ("HSK[%x]: Removing ciphersuite: %s\n", | 2924 | _gnutls_handshake_log ("HSK[%x]: Removing ciphersuite: %s\n", |
2925 | session, | 2925 | session, |
2926 | _gnutls_cipher_suite_get_name (&cs)); | 2926 | mhd_gtls_cipher_suite_get_name (&cs)); |
2927 | 2927 | ||
2928 | } | 2928 | } |
2929 | } | 2929 | } |
@@ -2939,8 +2939,8 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2939 | } | 2939 | } |
2940 | 2940 | ||
2941 | /** | 2941 | /** |
2942 | * gnutls_handshake_set_max_packet_length - This function will set the maximum length of a handshake message | 2942 | * MHD_gnutls_handshake_set_max_packet_length - This function will set the maximum length of a handshake message |
2943 | * @session: is a #gnutls_session_t structure. | 2943 | * @session: is a #mhd_gtls_session_t structure. |
2944 | * @max: is the maximum number. | 2944 | * @max: is the maximum number. |
2945 | * | 2945 | * |
2946 | * This function will set the maximum size of a handshake message. | 2946 | * This function will set the maximum size of a handshake message. |
@@ -2950,28 +2950,28 @@ _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | |||
2950 | * | 2950 | * |
2951 | **/ | 2951 | **/ |
2952 | void | 2952 | void |
2953 | gnutls_handshake_set_max_packet_length (gnutls_session_t session, size_t max) | 2953 | MHD_gnutls_handshake_set_max_packet_length (mhd_gtls_session_t session, size_t max) |
2954 | { | 2954 | { |
2955 | session->internals.max_handshake_data_buffer_size = max; | 2955 | session->internals.max_handshake_data_buffer_size = max; |
2956 | } | 2956 | } |
2957 | 2957 | ||
2958 | void | 2958 | void |
2959 | _gnutls_set_adv_version (gnutls_session_t session, gnutls_protocol_t ver) | 2959 | mhd_gtls_set_adv_version (mhd_gtls_session_t session, gnutls_protocol_t ver) |
2960 | { | 2960 | { |
2961 | set_adv_version (session, _gnutls_version_get_major (ver), | 2961 | set_adv_version (session, mhd_gtls_version_get_major (ver), |
2962 | _gnutls_version_get_minor (ver)); | 2962 | mhd_gtls_version_get_minor (ver)); |
2963 | } | 2963 | } |
2964 | 2964 | ||
2965 | gnutls_protocol_t | 2965 | gnutls_protocol_t |
2966 | _gnutls_get_adv_version (gnutls_session_t session) | 2966 | mhd_gtls_get_adv_version (mhd_gtls_session_t session) |
2967 | { | 2967 | { |
2968 | return _gnutls_version_get (_gnutls_get_adv_version_major (session), | 2968 | return mhd_gtls_version_get (_gnutls_get_adv_version_major (session), |
2969 | _gnutls_get_adv_version_minor (session)); | 2969 | _gnutls_get_adv_version_minor (session)); |
2970 | } | 2970 | } |
2971 | 2971 | ||
2972 | /** | 2972 | /** |
2973 | * gnutls_handshake_get_last_in - Returns the last handshake message received. | 2973 | * MHD_gtls_handshake_get_last_in - Returns the last handshake message received. |
2974 | * @session: is a #gnutls_session_t structure. | 2974 | * @session: is a #mhd_gtls_session_t structure. |
2975 | * | 2975 | * |
2976 | * This function is only useful to check where the last performed | 2976 | * This function is only useful to check where the last performed |
2977 | * handshake failed. If the previous handshake succeed or was not | 2977 | * handshake failed. If the previous handshake succeed or was not |
@@ -2984,14 +2984,14 @@ _gnutls_get_adv_version (gnutls_session_t session) | |||
2984 | * %gnutls_handshake_description_t. | 2984 | * %gnutls_handshake_description_t. |
2985 | **/ | 2985 | **/ |
2986 | gnutls_handshake_description_t | 2986 | gnutls_handshake_description_t |
2987 | gnutls_handshake_get_last_in (gnutls_session_t session) | 2987 | MHD_gtls_handshake_get_last_in (mhd_gtls_session_t session) |
2988 | { | 2988 | { |
2989 | return session->internals.last_handshake_in; | 2989 | return session->internals.last_handshake_in; |
2990 | } | 2990 | } |
2991 | 2991 | ||
2992 | /** | 2992 | /** |
2993 | * gnutls_handshake_get_last_out - Returns the last handshake message sent. | 2993 | * MHD_gtls_handshake_get_last_out - Returns the last handshake message sent. |
2994 | * @session: is a #gnutls_session_t structure. | 2994 | * @session: is a #mhd_gtls_session_t structure. |
2995 | * | 2995 | * |
2996 | * This function is only useful to check where the last performed | 2996 | * This function is only useful to check where the last performed |
2997 | * handshake failed. If the previous handshake succeed or was not | 2997 | * handshake failed. If the previous handshake succeed or was not |
@@ -3004,7 +3004,7 @@ gnutls_handshake_get_last_in (gnutls_session_t session) | |||
3004 | * %gnutls_handshake_description_t. | 3004 | * %gnutls_handshake_description_t. |
3005 | **/ | 3005 | **/ |
3006 | gnutls_handshake_description_t | 3006 | gnutls_handshake_description_t |
3007 | gnutls_handshake_get_last_out (gnutls_session_t session) | 3007 | MHD_gtls_handshake_get_last_out (mhd_gtls_session_t session) |
3008 | { | 3008 | { |
3009 | return session->internals.last_handshake_out; | 3009 | return session->internals.last_handshake_out; |
3010 | } | 3010 | } |
diff --git a/src/daemon/https/tls/gnutls_handshake.h b/src/daemon/https/tls/gnutls_handshake.h index 5cff279a..9917fdc7 100644 --- a/src/daemon/https/tls/gnutls_handshake.h +++ b/src/daemon/https/tls/gnutls_handshake.h | |||
@@ -25,33 +25,33 @@ | |||
25 | typedef enum Optional | 25 | typedef enum Optional |
26 | { OPTIONAL_PACKET, MANDATORY_PACKET } Optional; | 26 | { OPTIONAL_PACKET, MANDATORY_PACKET } Optional; |
27 | 27 | ||
28 | int _gnutls_send_handshake (gnutls_session_t session, void *i_data, | 28 | int mhd_gtls_send_handshake (mhd_gtls_session_t session, void *i_data, |
29 | uint32_t i_datasize, | 29 | uint32_t i_datasize, |
30 | gnutls_handshake_description_t type); | 30 | gnutls_handshake_description_t type); |
31 | int _gnutls_recv_hello_request (gnutls_session_t session, void *data, | 31 | int mhd_gtls_recv_hello_request (mhd_gtls_session_t session, void *data, |
32 | uint32_t data_size); | 32 | uint32_t data_size); |
33 | int _gnutls_send_hello (gnutls_session_t session, int again); | 33 | int mhd_gtls_send_hello (mhd_gtls_session_t session, int again); |
34 | int _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen); | 34 | int mhd_gtls_recv_hello (mhd_gtls_session_t session, opaque * data, int datalen); |
35 | int _gnutls_recv_handshake (gnutls_session_t session, uint8_t **, int *, | 35 | int mhd_gtls_recv_handshake (mhd_gtls_session_t session, uint8_t **, int *, |
36 | gnutls_handshake_description_t, | 36 | gnutls_handshake_description_t, |
37 | Optional optional); | 37 | Optional optional); |
38 | int _gnutls_generate_session_id (opaque * session_id, uint8_t * len); | 38 | int mhd_gtls_generate_session_id (opaque * session_id, uint8_t * len); |
39 | int _gnutls_handshake_common (gnutls_session_t session); | 39 | int mhd_gtls_handshake_common (mhd_gtls_session_t session); |
40 | int _gnutls_handshake_client (gnutls_session_t session); | 40 | int mhd_gtls_handshake_client (mhd_gtls_session_t session); |
41 | int _gnutls_handshake_server (gnutls_session_t session); | 41 | int mhd_gtls_handshake_server (mhd_gtls_session_t session); |
42 | void _gnutls_set_server_random (gnutls_session_t session, uint8_t * rnd); | 42 | void mhd_gtls_set_server_random (mhd_gtls_session_t session, uint8_t * rnd); |
43 | void _gnutls_set_client_random (gnutls_session_t session, uint8_t * rnd); | 43 | void mhd_gtls_set_client_random (mhd_gtls_session_t session, uint8_t * rnd); |
44 | int _gnutls_tls_create_random (opaque * dst); | 44 | int mhd_gtls_tls_create_random (opaque * dst); |
45 | int _gnutls_remove_unwanted_ciphersuites (gnutls_session_t session, | 45 | int mhd_gtls_remove_unwanted_ciphersuites (mhd_gtls_session_t session, |
46 | cipher_suite_st ** cipherSuites, | 46 | cipher_suite_st ** cipherSuites, |
47 | int numCipherSuites, | 47 | int numCipherSuites, |
48 | gnutls_pk_algorithm_t); | 48 | gnutls_pk_algorithm_t); |
49 | int _gnutls_find_pk_algos_in_ciphersuites (opaque * data, int datalen); | 49 | int mhd_gtls_find_pk_algos_in_ciphersuites (opaque * data, int datalen); |
50 | int _gnutls_server_select_suite (gnutls_session_t session, opaque * data, | 50 | int mhd_gtls_server_select_suite (mhd_gtls_session_t session, opaque * data, |
51 | int datalen); | 51 | int datalen); |
52 | 52 | ||
53 | int _gnutls_negotiate_version( gnutls_session_t session, gnutls_protocol_t adv_version); | 53 | int mhd_gtls_negotiate_version( mhd_gtls_session_t session, gnutls_protocol_t adv_version); |
54 | int _gnutls_user_hello_func( gnutls_session, gnutls_protocol_t adv_version); | 54 | int mhd_gtls_user_hello_func( gnutls_session, gnutls_protocol_t adv_version); |
55 | 55 | ||
56 | #define STATE session->internals.handshake_state | 56 | #define STATE session->internals.handshake_state |
57 | /* This returns true if we have got there | 57 | /* This returns true if we have got there |
diff --git a/src/daemon/https/tls/gnutls_hash_int.c b/src/daemon/https/tls/gnutls_hash_int.c index 8746613b..4afb0ea2 100644 --- a/src/daemon/https/tls/gnutls_hash_int.c +++ b/src/daemon/https/tls/gnutls_hash_int.c | |||
@@ -55,7 +55,7 @@ _gnutls_mac2gc (gnutls_mac_algorithm_t mac) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | GNUTLS_HASH_HANDLE | 57 | GNUTLS_HASH_HANDLE |
58 | _gnutls_hash_init (gnutls_mac_algorithm_t algorithm) | 58 | mhd_gtls_hash_init (gnutls_mac_algorithm_t algorithm) |
59 | { | 59 | { |
60 | mac_hd_t ret; | 60 | mac_hd_t ret; |
61 | int result; | 61 | int result; |
@@ -81,7 +81,7 @@ _gnutls_hash_init (gnutls_mac_algorithm_t algorithm) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | int | 83 | int |
84 | _gnutls_hash_get_algo_len (gnutls_mac_algorithm_t algorithm) | 84 | mhd_gnutls_hash_get_algo_len (gnutls_mac_algorithm_t algorithm) |
85 | { | 85 | { |
86 | int ret; | 86 | int ret; |
87 | 87 | ||
@@ -92,7 +92,7 @@ _gnutls_hash_get_algo_len (gnutls_mac_algorithm_t algorithm) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | int | 94 | int |
95 | _gnutls_hash (GNUTLS_HASH_HANDLE handle, const void *text, size_t textlen) | 95 | mhd_gnutls_hash (GNUTLS_HASH_HANDLE handle, const void *text, size_t textlen) |
96 | { | 96 | { |
97 | if (textlen > 0) | 97 | if (textlen > 0) |
98 | gc_hash_write (handle->handle, textlen, text); | 98 | gc_hash_write (handle->handle, textlen, text); |
@@ -100,7 +100,7 @@ _gnutls_hash (GNUTLS_HASH_HANDLE handle, const void *text, size_t textlen) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | GNUTLS_HASH_HANDLE | 102 | GNUTLS_HASH_HANDLE |
103 | _gnutls_hash_copy (GNUTLS_HASH_HANDLE handle) | 103 | mhd_gnutls_hash_copy (GNUTLS_HASH_HANDLE handle) |
104 | { | 104 | { |
105 | GNUTLS_HASH_HANDLE ret; | 105 | GNUTLS_HASH_HANDLE ret; |
106 | int result; | 106 | int result; |
@@ -126,12 +126,12 @@ _gnutls_hash_copy (GNUTLS_HASH_HANDLE handle) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | void | 128 | void |
129 | _gnutls_hash_deinit (GNUTLS_HASH_HANDLE handle, void *digest) | 129 | mhd_gnutls_hash_deinit (GNUTLS_HASH_HANDLE handle, void *digest) |
130 | { | 130 | { |
131 | const opaque *mac; | 131 | const opaque *mac; |
132 | int maclen; | 132 | int maclen; |
133 | 133 | ||
134 | maclen = _gnutls_hash_get_algo_len (handle->algorithm); | 134 | maclen = mhd_gnutls_hash_get_algo_len (handle->algorithm); |
135 | 135 | ||
136 | mac = gc_hash_read (handle->handle); | 136 | mac = gc_hash_read (handle->handle); |
137 | if (digest != NULL) | 137 | if (digest != NULL) |
@@ -144,7 +144,7 @@ _gnutls_hash_deinit (GNUTLS_HASH_HANDLE handle, void *digest) | |||
144 | 144 | ||
145 | 145 | ||
146 | mac_hd_t | 146 | mac_hd_t |
147 | _gnutls_hmac_init (gnutls_mac_algorithm_t algorithm, | 147 | mhd_gtls_hmac_init (gnutls_mac_algorithm_t algorithm, |
148 | const void *key, int keylen) | 148 | const void *key, int keylen) |
149 | { | 149 | { |
150 | mac_hd_t ret; | 150 | mac_hd_t ret; |
@@ -171,12 +171,12 @@ _gnutls_hmac_init (gnutls_mac_algorithm_t algorithm, | |||
171 | } | 171 | } |
172 | 172 | ||
173 | void | 173 | void |
174 | _gnutls_hmac_deinit (mac_hd_t handle, void *digest) | 174 | mhd_gnutls_hmac_deinit (mac_hd_t handle, void *digest) |
175 | { | 175 | { |
176 | const opaque *mac; | 176 | const opaque *mac; |
177 | int maclen; | 177 | int maclen; |
178 | 178 | ||
179 | maclen = _gnutls_hash_get_algo_len (handle->algorithm); | 179 | maclen = mhd_gnutls_hash_get_algo_len (handle->algorithm); |
180 | 180 | ||
181 | mac = gc_hash_read (handle->handle); | 181 | mac = gc_hash_read (handle->handle); |
182 | 182 | ||
@@ -203,7 +203,7 @@ get_padsize (gnutls_mac_algorithm_t algorithm) | |||
203 | } | 203 | } |
204 | 204 | ||
205 | mac_hd_t | 205 | mac_hd_t |
206 | _gnutls_mac_init_ssl3 (gnutls_mac_algorithm_t algorithm, void *key, | 206 | mhd_gnutls_mac_init_ssl3 (gnutls_mac_algorithm_t algorithm, void *key, |
207 | int keylen) | 207 | int keylen) |
208 | { | 208 | { |
209 | mac_hd_t ret; | 209 | mac_hd_t ret; |
@@ -219,22 +219,22 @@ _gnutls_mac_init_ssl3 (gnutls_mac_algorithm_t algorithm, void *key, | |||
219 | 219 | ||
220 | memset (ipad, 0x36, padsize); | 220 | memset (ipad, 0x36, padsize); |
221 | 221 | ||
222 | ret = _gnutls_hash_init (algorithm); | 222 | ret = mhd_gtls_hash_init (algorithm); |
223 | if (ret != GNUTLS_HASH_FAILED) | 223 | if (ret != GNUTLS_HASH_FAILED) |
224 | { | 224 | { |
225 | ret->key = key; | 225 | ret->key = key; |
226 | ret->keysize = keylen; | 226 | ret->keysize = keylen; |
227 | 227 | ||
228 | if (keylen > 0) | 228 | if (keylen > 0) |
229 | _gnutls_hash (ret, key, keylen); | 229 | mhd_gnutls_hash (ret, key, keylen); |
230 | _gnutls_hash (ret, ipad, padsize); | 230 | mhd_gnutls_hash (ret, ipad, padsize); |
231 | } | 231 | } |
232 | 232 | ||
233 | return ret; | 233 | return ret; |
234 | } | 234 | } |
235 | 235 | ||
236 | void | 236 | void |
237 | _gnutls_mac_deinit_ssl3 (mac_hd_t handle, void *digest) | 237 | mhd_gnutls_mac_deinit_ssl3 (mac_hd_t handle, void *digest) |
238 | { | 238 | { |
239 | opaque ret[MAX_HASH_SIZE]; | 239 | opaque ret[MAX_HASH_SIZE]; |
240 | mac_hd_t td; | 240 | mac_hd_t td; |
@@ -251,23 +251,23 @@ _gnutls_mac_deinit_ssl3 (mac_hd_t handle, void *digest) | |||
251 | 251 | ||
252 | memset (opad, 0x5C, padsize); | 252 | memset (opad, 0x5C, padsize); |
253 | 253 | ||
254 | td = _gnutls_hash_init (handle->algorithm); | 254 | td = mhd_gtls_hash_init (handle->algorithm); |
255 | if (td != GNUTLS_MAC_FAILED) | 255 | if (td != GNUTLS_MAC_FAILED) |
256 | { | 256 | { |
257 | if (handle->keysize > 0) | 257 | if (handle->keysize > 0) |
258 | _gnutls_hash (td, handle->key, handle->keysize); | 258 | mhd_gnutls_hash (td, handle->key, handle->keysize); |
259 | 259 | ||
260 | _gnutls_hash (td, opad, padsize); | 260 | mhd_gnutls_hash (td, opad, padsize); |
261 | block = _gnutls_hmac_get_algo_len (handle->algorithm); | 261 | block = mhd_gnutls_hash_get_algo_len (handle->algorithm); |
262 | _gnutls_hash_deinit (handle, ret); /* get the previous hash */ | 262 | mhd_gnutls_hash_deinit (handle, ret); /* get the previous hash */ |
263 | _gnutls_hash (td, ret, block); | 263 | mhd_gnutls_hash (td, ret, block); |
264 | 264 | ||
265 | _gnutls_hash_deinit (td, digest); | 265 | mhd_gnutls_hash_deinit (td, digest); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | void | 269 | void |
270 | _gnutls_mac_deinit_ssl3_handshake (mac_hd_t handle, | 270 | mhd_gnutls_mac_deinit_ssl3_handshake (mac_hd_t handle, |
271 | void *digest, opaque * key, | 271 | void *digest, opaque * key, |
272 | uint32_t key_size) | 272 | uint32_t key_size) |
273 | { | 273 | { |
@@ -288,23 +288,23 @@ _gnutls_mac_deinit_ssl3_handshake (mac_hd_t handle, | |||
288 | memset (opad, 0x5C, padsize); | 288 | memset (opad, 0x5C, padsize); |
289 | memset (ipad, 0x36, padsize); | 289 | memset (ipad, 0x36, padsize); |
290 | 290 | ||
291 | td = _gnutls_hash_init (handle->algorithm); | 291 | td = mhd_gtls_hash_init (handle->algorithm); |
292 | if (td != GNUTLS_HASH_FAILED) | 292 | if (td != GNUTLS_HASH_FAILED) |
293 | { | 293 | { |
294 | if (key_size > 0) | 294 | if (key_size > 0) |
295 | _gnutls_hash (td, key, key_size); | 295 | mhd_gnutls_hash (td, key, key_size); |
296 | 296 | ||
297 | _gnutls_hash (td, opad, padsize); | 297 | mhd_gnutls_hash (td, opad, padsize); |
298 | block = _gnutls_hmac_get_algo_len (handle->algorithm); | 298 | block = mhd_gnutls_hash_get_algo_len (handle->algorithm); |
299 | 299 | ||
300 | if (key_size > 0) | 300 | if (key_size > 0) |
301 | _gnutls_hash (handle, key, key_size); | 301 | mhd_gnutls_hash (handle, key, key_size); |
302 | _gnutls_hash (handle, ipad, padsize); | 302 | mhd_gnutls_hash (handle, ipad, padsize); |
303 | _gnutls_hash_deinit (handle, ret); /* get the previous hash */ | 303 | mhd_gnutls_hash_deinit (handle, ret); /* get the previous hash */ |
304 | 304 | ||
305 | _gnutls_hash (td, ret, block); | 305 | mhd_gnutls_hash (td, ret, block); |
306 | 306 | ||
307 | _gnutls_hash_deinit (td, digest); | 307 | mhd_gnutls_hash_deinit (td, digest); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
@@ -322,18 +322,18 @@ ssl3_sha (int i, opaque * secret, int secret_len, | |||
322 | text1[j] = 65 + i; /* A==65 */ | 322 | text1[j] = 65 + i; /* A==65 */ |
323 | } | 323 | } |
324 | 324 | ||
325 | td = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 325 | td = mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
326 | if (td == NULL) | 326 | if (td == NULL) |
327 | { | 327 | { |
328 | gnutls_assert (); | 328 | gnutls_assert (); |
329 | return GNUTLS_E_HASH_FAILED; | 329 | return GNUTLS_E_HASH_FAILED; |
330 | } | 330 | } |
331 | 331 | ||
332 | _gnutls_hash (td, text1, i + 1); | 332 | mhd_gnutls_hash (td, text1, i + 1); |
333 | _gnutls_hash (td, secret, secret_len); | 333 | mhd_gnutls_hash (td, secret, secret_len); |
334 | _gnutls_hash (td, rnd, rnd_len); | 334 | mhd_gnutls_hash (td, rnd, rnd_len); |
335 | 335 | ||
336 | _gnutls_hash_deinit (td, digest); | 336 | mhd_gnutls_hash_deinit (td, digest); |
337 | return 0; | 337 | return 0; |
338 | } | 338 | } |
339 | 339 | ||
@@ -345,49 +345,49 @@ ssl3_md5 (int i, opaque * secret, int secret_len, | |||
345 | mac_hd_t td; | 345 | mac_hd_t td; |
346 | int ret; | 346 | int ret; |
347 | 347 | ||
348 | td = _gnutls_hash_init (MHD_GNUTLS_MAC_MD5); | 348 | td = mhd_gtls_hash_init (MHD_GNUTLS_MAC_MD5); |
349 | if (td == NULL) | 349 | if (td == NULL) |
350 | { | 350 | { |
351 | gnutls_assert (); | 351 | gnutls_assert (); |
352 | return GNUTLS_E_HASH_FAILED; | 352 | return GNUTLS_E_HASH_FAILED; |
353 | } | 353 | } |
354 | 354 | ||
355 | _gnutls_hash (td, secret, secret_len); | 355 | mhd_gnutls_hash (td, secret, secret_len); |
356 | 356 | ||
357 | ret = ssl3_sha (i, secret, secret_len, rnd, rnd_len, tmp); | 357 | ret = ssl3_sha (i, secret, secret_len, rnd, rnd_len, tmp); |
358 | if (ret < 0) | 358 | if (ret < 0) |
359 | { | 359 | { |
360 | gnutls_assert (); | 360 | gnutls_assert (); |
361 | _gnutls_hash_deinit (td, digest); | 361 | mhd_gnutls_hash_deinit (td, digest); |
362 | return ret; | 362 | return ret; |
363 | } | 363 | } |
364 | 364 | ||
365 | _gnutls_hash (td, tmp, _gnutls_hash_get_algo_len (MHD_GNUTLS_MAC_SHA1)); | 365 | mhd_gnutls_hash (td, tmp, mhd_gnutls_hash_get_algo_len (MHD_GNUTLS_MAC_SHA1)); |
366 | 366 | ||
367 | _gnutls_hash_deinit (td, digest); | 367 | mhd_gnutls_hash_deinit (td, digest); |
368 | return 0; | 368 | return 0; |
369 | } | 369 | } |
370 | 370 | ||
371 | int | 371 | int |
372 | _gnutls_ssl3_hash_md5 (void *first, int first_len, | 372 | mhd_gnutls_ssl3_hash_md5 (void *first, int first_len, |
373 | void *second, int second_len, int ret_len, | 373 | void *second, int second_len, int ret_len, |
374 | opaque * ret) | 374 | opaque * ret) |
375 | { | 375 | { |
376 | opaque digest[MAX_HASH_SIZE]; | 376 | opaque digest[MAX_HASH_SIZE]; |
377 | mac_hd_t td; | 377 | mac_hd_t td; |
378 | int block = _gnutls_hash_get_algo_len (MHD_GNUTLS_MAC_MD5); | 378 | int block = mhd_gnutls_hash_get_algo_len (MHD_GNUTLS_MAC_MD5); |
379 | 379 | ||
380 | td = _gnutls_hash_init (MHD_GNUTLS_MAC_MD5); | 380 | td = mhd_gtls_hash_init (MHD_GNUTLS_MAC_MD5); |
381 | if (td == NULL) | 381 | if (td == NULL) |
382 | { | 382 | { |
383 | gnutls_assert (); | 383 | gnutls_assert (); |
384 | return GNUTLS_E_HASH_FAILED; | 384 | return GNUTLS_E_HASH_FAILED; |
385 | } | 385 | } |
386 | 386 | ||
387 | _gnutls_hash (td, first, first_len); | 387 | mhd_gnutls_hash (td, first, first_len); |
388 | _gnutls_hash (td, second, second_len); | 388 | mhd_gnutls_hash (td, second, second_len); |
389 | 389 | ||
390 | _gnutls_hash_deinit (td, digest); | 390 | mhd_gnutls_hash_deinit (td, digest); |
391 | 391 | ||
392 | if (ret_len > block) | 392 | if (ret_len > block) |
393 | { | 393 | { |
@@ -402,13 +402,13 @@ _gnutls_ssl3_hash_md5 (void *first, int first_len, | |||
402 | } | 402 | } |
403 | 403 | ||
404 | int | 404 | int |
405 | _gnutls_ssl3_generate_random (void *secret, int secret_len, | 405 | mhd_gnutls_ssl3_generate_random (void *secret, int secret_len, |
406 | void *rnd, int rnd_len, | 406 | void *rnd, int rnd_len, |
407 | int ret_bytes, opaque * ret) | 407 | int ret_bytes, opaque * ret) |
408 | { | 408 | { |
409 | int i = 0, copy, output_bytes; | 409 | int i = 0, copy, output_bytes; |
410 | opaque digest[MAX_HASH_SIZE]; | 410 | opaque digest[MAX_HASH_SIZE]; |
411 | int block = _gnutls_hash_get_algo_len (MHD_GNUTLS_MAC_MD5); | 411 | int block = mhd_gnutls_hash_get_algo_len (MHD_GNUTLS_MAC_MD5); |
412 | int result, times; | 412 | int result, times; |
413 | 413 | ||
414 | output_bytes = 0; | 414 | output_bytes = 0; |
diff --git a/src/daemon/https/tls/gnutls_hash_int.h b/src/daemon/https/tls/gnutls_hash_int.h index 3e1b75e6..0b49dfd5 100644 --- a/src/daemon/https/tls/gnutls_hash_int.h +++ b/src/daemon/https/tls/gnutls_hash_int.h | |||
@@ -42,31 +42,30 @@ typedef mac_hd_t GNUTLS_HASH_HANDLE; | |||
42 | #define GNUTLS_HASH_FAILED NULL | 42 | #define GNUTLS_HASH_FAILED NULL |
43 | #define GNUTLS_MAC_FAILED NULL | 43 | #define GNUTLS_MAC_FAILED NULL |
44 | 44 | ||
45 | mac_hd_t _gnutls_hmac_init (gnutls_mac_algorithm_t algorithm, | 45 | mac_hd_t mhd_gtls_hmac_init (gnutls_mac_algorithm_t algorithm, |
46 | const void *key, int keylen); | 46 | const void *key, int keylen); |
47 | #define _gnutls_hmac_get_algo_len _gnutls_hash_get_algo_len | ||
48 | #define _gnutls_hmac _gnutls_hash | ||
49 | void _gnutls_hmac_deinit (mac_hd_t handle, void *digest); | ||
50 | 47 | ||
51 | mac_hd_t _gnutls_mac_init_ssl3 (gnutls_mac_algorithm_t algorithm, void *key, | 48 | void mhd_gnutls_hmac_deinit (mac_hd_t handle, void *digest); |
49 | |||
50 | mac_hd_t mhd_gnutls_mac_init_ssl3 (gnutls_mac_algorithm_t algorithm, void *key, | ||
52 | int keylen); | 51 | int keylen); |
53 | void _gnutls_mac_deinit_ssl3 (mac_hd_t handle, void *digest); | 52 | void mhd_gnutls_mac_deinit_ssl3 (mac_hd_t handle, void *digest); |
54 | 53 | ||
55 | GNUTLS_HASH_HANDLE _gnutls_hash_init (gnutls_mac_algorithm_t algorithm); | 54 | GNUTLS_HASH_HANDLE mhd_gtls_hash_init (gnutls_mac_algorithm_t algorithm); |
56 | int _gnutls_hash_get_algo_len (gnutls_mac_algorithm_t algorithm); | 55 | int mhd_gnutls_hash_get_algo_len (gnutls_mac_algorithm_t algorithm); |
57 | int _gnutls_hash (GNUTLS_HASH_HANDLE handle, const void *text, | 56 | int mhd_gnutls_hash (GNUTLS_HASH_HANDLE handle, const void *text, |
58 | size_t textlen); | 57 | size_t textlen); |
59 | void _gnutls_hash_deinit (GNUTLS_HASH_HANDLE handle, void *digest); | 58 | void mhd_gnutls_hash_deinit (GNUTLS_HASH_HANDLE handle, void *digest); |
60 | 59 | ||
61 | int _gnutls_ssl3_generate_random (void *secret, int secret_len, | 60 | int mhd_gnutls_ssl3_generate_random (void *secret, int secret_len, |
62 | void *rnd, int random_len, int bytes, | 61 | void *rnd, int random_len, int bytes, |
63 | opaque * ret); | 62 | opaque * ret); |
64 | int _gnutls_ssl3_hash_md5 (void *first, int first_len, void *second, | 63 | int mhd_gnutls_ssl3_hash_md5 (void *first, int first_len, void *second, |
65 | int second_len, int ret_len, opaque * ret); | 64 | int second_len, int ret_len, opaque * ret); |
66 | 65 | ||
67 | void _gnutls_mac_deinit_ssl3_handshake (mac_hd_t handle, void *digest, | 66 | void mhd_gnutls_mac_deinit_ssl3_handshake (mac_hd_t handle, void *digest, |
68 | opaque * key, uint32_t key_size); | 67 | opaque * key, uint32_t key_size); |
69 | 68 | ||
70 | GNUTLS_HASH_HANDLE _gnutls_hash_copy (GNUTLS_HASH_HANDLE handle); | 69 | GNUTLS_HASH_HANDLE mhd_gnutls_hash_copy (GNUTLS_HASH_HANDLE handle); |
71 | 70 | ||
72 | #endif /* GNUTLS_HASH_INT_H */ | 71 | #endif /* GNUTLS_HASH_INT_H */ |
diff --git a/src/daemon/https/tls/gnutls_int.h b/src/daemon/https/tls/gnutls_int.h index 7791b554..a59c95dd 100644 --- a/src/daemon/https/tls/gnutls_int.h +++ b/src/daemon/https/tls/gnutls_int.h | |||
@@ -128,7 +128,13 @@ typedef enum handshake_state_t | |||
128 | STATE70, STATE71 | 128 | STATE70, STATE71 |
129 | } handshake_state_t; | 129 | } handshake_state_t; |
130 | 130 | ||
131 | #include <gnutls_buffer.h> | 131 | #include <gnutls_str.h> |
132 | |||
133 | typedef mhd_gtls_string mhd_gtls_buffer; | ||
134 | |||
135 | #define mhd_gtls_buffer_init(buf) mhd_gtls_string_init(buf, gnutls_malloc, gnutls_realloc, gnutls_free); | ||
136 | #define mhd_gtls_buffer_clear mhd_gtls_string_clear | ||
137 | #define mhd_gtls_buffer_append mhd_gtls_string_append_data | ||
132 | 138 | ||
133 | /* This is the maximum number of algorithms (ciphers or macs etc). | 139 | /* This is the maximum number of algorithms (ciphers or macs etc). |
134 | * keep it synced with GNUTLS_MAX_ALGORITHM_NUM in gnutls.h | 140 | * keep it synced with GNUTLS_MAX_ALGORITHM_NUM in gnutls.h |
@@ -175,17 +181,17 @@ typedef void (*LOG_FUNC)(int, | |||
175 | const char *); | 181 | const char *); |
176 | 182 | ||
177 | /* Store & Retrieve functions defines: */ | 183 | /* Store & Retrieve functions defines: */ |
178 | typedef struct auth_cred_st | 184 | typedef struct mhd_gtls_auth_cred_st |
179 | { | 185 | { |
180 | gnutls_credentials_type_t algorithm; | 186 | gnutls_credentials_type_t algorithm; |
181 | 187 | ||
182 | /* the type of credentials depends on algorithm | 188 | /* the type of credentials depends on algorithm |
183 | */ | 189 | */ |
184 | void *credentials; | 190 | void *credentials; |
185 | struct auth_cred_st *next; | 191 | struct mhd_gtls_auth_cred_st *next; |
186 | } auth_cred_st; | 192 | } auth_cred_st; |
187 | 193 | ||
188 | struct gnutls_key_st | 194 | struct mhd_gtls_key |
189 | { | 195 | { |
190 | /* For DH KX */ | 196 | /* For DH KX */ |
191 | gnutls_datum_t key; | 197 | gnutls_datum_t key; |
@@ -229,7 +235,7 @@ struct gnutls_key_st | |||
229 | * for a client certificate verify | 235 | * for a client certificate verify |
230 | */ | 236 | */ |
231 | }; | 237 | }; |
232 | typedef struct gnutls_key_st *gnutls_key_st; | 238 | typedef struct mhd_gtls_key * mhd_gtls_key_st; |
233 | 239 | ||
234 | /* STATE (cont) */ | 240 | /* STATE (cont) */ |
235 | #include <gnutls_hash_int.h> | 241 | #include <gnutls_hash_int.h> |
@@ -276,7 +282,7 @@ typedef struct | |||
276 | uint16_t oprfi_client_len; | 282 | uint16_t oprfi_client_len; |
277 | opaque *oprfi_server; | 283 | opaque *oprfi_server; |
278 | uint16_t oprfi_server_len; | 284 | uint16_t oprfi_server_len; |
279 | } tls_ext_st; | 285 | } mhd_gtls_ext_st; |
280 | 286 | ||
281 | /* This flag indicates for an extension whether | 287 | /* This flag indicates for an extension whether |
282 | * it is useful to application level or TLS level only. | 288 | * it is useful to application level or TLS level only. |
@@ -288,7 +294,7 @@ typedef enum tls_ext_parse_type_t | |||
288 | EXTENSION_ANY, | 294 | EXTENSION_ANY, |
289 | EXTENSION_APPLICATION, | 295 | EXTENSION_APPLICATION, |
290 | EXTENSION_TLS | 296 | EXTENSION_TLS |
291 | } tls_ext_parse_type_t; | 297 | } mhd_gtls_ext_parse_type_t; |
292 | 298 | ||
293 | /* auth_info_t structures now MAY contain malloced | 299 | /* auth_info_t structures now MAY contain malloced |
294 | * elements. | 300 | * elements. |
@@ -335,7 +341,7 @@ typedef struct | |||
335 | opaque session_id[TLS_MAX_SESSION_ID_SIZE]; | 341 | opaque session_id[TLS_MAX_SESSION_ID_SIZE]; |
336 | uint8_t session_id_size; | 342 | uint8_t session_id_size; |
337 | time_t timestamp; | 343 | time_t timestamp; |
338 | tls_ext_st extensions; | 344 | mhd_gtls_ext_st extensions; |
339 | 345 | ||
340 | /* The send size is the one requested by the programmer. | 346 | /* The send size is the one requested by the programmer. |
341 | * The recv size is the one negotiated with the peer. | 347 | * The recv size is the one negotiated with the peer. |
@@ -347,7 +353,7 @@ typedef struct | |||
347 | gnutls_protocol_t version; /* moved here */ | 353 | gnutls_protocol_t version; /* moved here */ |
348 | /* For TLS/IA. XXX: Move to IA credential? */ | 354 | /* For TLS/IA. XXX: Move to IA credential? */ |
349 | opaque inner_secret[TLS_MASTER_SIZE]; | 355 | opaque inner_secret[TLS_MASTER_SIZE]; |
350 | } security_parameters_st; | 356 | } mhd_gtls_security_param_st; |
351 | 357 | ||
352 | /* This structure holds the generated keys | 358 | /* This structure holds the generated keys |
353 | */ | 359 | */ |
@@ -363,7 +369,7 @@ typedef struct | |||
363 | * been generated. Non zero | 369 | * been generated. Non zero |
364 | * otherwise. | 370 | * otherwise. |
365 | */ | 371 | */ |
366 | } cipher_specs_st; | 372 | } mhd_gtls_cipher_specs_st; |
367 | 373 | ||
368 | typedef struct | 374 | typedef struct |
369 | { | 375 | { |
@@ -375,25 +381,25 @@ typedef struct | |||
375 | gnutls_datum_t write_mac_secret; | 381 | gnutls_datum_t write_mac_secret; |
376 | uint64 read_sequence_number; | 382 | uint64 read_sequence_number; |
377 | uint64 write_sequence_number; | 383 | uint64 write_sequence_number; |
378 | } conn_stat_st; | 384 | } mhd_gtls_conn_stat_st; |
379 | 385 | ||
380 | typedef struct | 386 | typedef struct |
381 | { | 387 | { |
382 | unsigned int priority[MAX_ALGOS]; | 388 | unsigned int priority[MAX_ALGOS]; |
383 | unsigned int num_algorithms; | 389 | unsigned int num_algorithms; |
384 | } priority_st; | 390 | } mhd_gtls_priority_st; |
385 | 391 | ||
386 | /* For the external api */ | 392 | /* For the external api */ |
387 | struct gnutls_priority_st | 393 | struct MHD_gtls_priority_st |
388 | { | 394 | { |
389 | priority_st cipher; | 395 | mhd_gtls_priority_st cipher; |
390 | priority_st mac; | 396 | mhd_gtls_priority_st mac; |
391 | priority_st kx; | 397 | mhd_gtls_priority_st kx; |
392 | priority_st compression; | 398 | mhd_gtls_priority_st compression; |
393 | priority_st protocol; | 399 | mhd_gtls_priority_st protocol; |
394 | 400 | ||
395 | /* certificate type : x509, OpenPGP, etc. */ | 401 | /* certificate type : x509, OpenPGP, etc. */ |
396 | priority_st cert_type; | 402 | mhd_gtls_priority_st cert_type; |
397 | 403 | ||
398 | /* to disable record padding */ | 404 | /* to disable record padding */ |
399 | int no_padding; | 405 | int no_padding; |
@@ -401,20 +407,20 @@ struct gnutls_priority_st | |||
401 | 407 | ||
402 | /* DH and RSA parameters types. | 408 | /* DH and RSA parameters types. |
403 | */ | 409 | */ |
404 | typedef struct gnutls_dh_params_int | 410 | typedef struct MHD_gtls_dh_params_int |
405 | { | 411 | { |
406 | /* [0] is the prime, [1] is the generator. | 412 | /* [0] is the prime, [1] is the generator. |
407 | */ | 413 | */ |
408 | mpi_t params[2]; | 414 | mpi_t params[2]; |
409 | } dh_params_st; | 415 | } mhd_gtls_dh_params_st; |
410 | 416 | ||
411 | typedef struct | 417 | typedef struct |
412 | { | 418 | { |
413 | gnutls_dh_params_t dh_params; | 419 | mhd_gtls_dh_params_t dh_params; |
414 | int free_dh_params; | 420 | int free_dh_params; |
415 | gnutls_rsa_params_t rsa_params; | 421 | mhd_gtls_rsa_params_t rsa_params; |
416 | int free_rsa_params; | 422 | int free_rsa_params; |
417 | } internal_params_st; | 423 | } mhd_gtls_internal_params_st; |
418 | 424 | ||
419 | typedef struct | 425 | typedef struct |
420 | { | 426 | { |
@@ -424,18 +430,18 @@ typedef struct | |||
424 | /* this holds the length of the handshake packet */ | 430 | /* this holds the length of the handshake packet */ |
425 | size_t packet_length; | 431 | size_t packet_length; |
426 | gnutls_handshake_description_t recv_type; | 432 | gnutls_handshake_description_t recv_type; |
427 | } handshake_header_buffer_st; | 433 | } mhd_gtls_handshake_header_buffer_st; |
428 | 434 | ||
429 | typedef struct | 435 | typedef struct |
430 | { | 436 | { |
431 | gnutls_buffer application_data_buffer; /* holds data to be delivered to application layer */ | 437 | mhd_gtls_buffer application_data_buffer; /* holds data to be delivered to application layer */ |
432 | gnutls_buffer handshake_hash_buffer; /* used to keep the last received handshake | 438 | mhd_gtls_buffer handshake_hash_buffer; /* used to keep the last received handshake |
433 | * message */ | 439 | * message */ |
434 | mac_hd_t handshake_mac_handle_sha; /* hash of the handshake messages */ | 440 | mac_hd_t handshake_mac_handle_sha; /* hash of the handshake messages */ |
435 | mac_hd_t handshake_mac_handle_md5; /* hash of the handshake messages */ | 441 | mac_hd_t handshake_mac_handle_md5; /* hash of the handshake messages */ |
436 | 442 | ||
437 | gnutls_buffer handshake_data_buffer; /* this is a buffer that holds the current handshake message */ | 443 | mhd_gtls_buffer handshake_data_buffer; /* this is a buffer that holds the current handshake message */ |
438 | gnutls_buffer ia_data_buffer; /* holds inner application data (TLS/IA) */ | 444 | mhd_gtls_buffer ia_data_buffer; /* holds inner application data (TLS/IA) */ |
439 | resumable_session_t resumable; /* TRUE or FALSE - if we can resume that session */ | 445 | resumable_session_t resumable; /* TRUE or FALSE - if we can resume that session */ |
440 | handshake_state_t handshake_state; /* holds | 446 | handshake_state_t handshake_state; /* holds |
441 | * a number which indicates where | 447 | * a number which indicates where |
@@ -463,11 +469,11 @@ typedef struct | |||
463 | gnutls_compression_method_t compression_method; | 469 | gnutls_compression_method_t compression_method; |
464 | 470 | ||
465 | /* priorities */ | 471 | /* priorities */ |
466 | struct gnutls_priority_st priorities; | 472 | struct MHD_gtls_priority_st priorities; |
467 | 473 | ||
468 | /* resumed session */ | 474 | /* resumed session */ |
469 | resumable_session_t resumed; /* RESUME_TRUE or FALSE - if we are resuming a session */ | 475 | resumable_session_t resumed; /* RESUME_TRUE or FALSE - if we are resuming a session */ |
470 | security_parameters_st resumed_security_parameters; | 476 | mhd_gtls_security_param_st resumed_security_parameters; |
471 | 477 | ||
472 | /* sockets internals */ | 478 | /* sockets internals */ |
473 | int lowat; | 479 | int lowat; |
@@ -475,19 +481,19 @@ typedef struct | |||
475 | /* These buffers are used in the handshake | 481 | /* These buffers are used in the handshake |
476 | * protocol only. freed using _gnutls_handshake_io_buffer_clear(); | 482 | * protocol only. freed using _gnutls_handshake_io_buffer_clear(); |
477 | */ | 483 | */ |
478 | gnutls_buffer handshake_send_buffer; | 484 | mhd_gtls_buffer handshake_send_buffer; |
479 | size_t handshake_send_buffer_prev_size; | 485 | size_t handshake_send_buffer_prev_size; |
480 | content_type_t handshake_send_buffer_type; | 486 | content_type_t handshake_send_buffer_type; |
481 | gnutls_handshake_description_t handshake_send_buffer_htype; | 487 | gnutls_handshake_description_t handshake_send_buffer_htype; |
482 | content_type_t handshake_recv_buffer_type; | 488 | content_type_t handshake_recv_buffer_type; |
483 | gnutls_handshake_description_t handshake_recv_buffer_htype; | 489 | gnutls_handshake_description_t handshake_recv_buffer_htype; |
484 | gnutls_buffer handshake_recv_buffer; | 490 | mhd_gtls_buffer handshake_recv_buffer; |
485 | 491 | ||
486 | /* this buffer holds a record packet -mostly used for | 492 | /* this buffer holds a record packet -mostly used for |
487 | * non blocking IO. | 493 | * non blocking IO. |
488 | */ | 494 | */ |
489 | gnutls_buffer record_recv_buffer; | 495 | mhd_gtls_buffer record_recv_buffer; |
490 | gnutls_buffer record_send_buffer; /* holds cached data | 496 | mhd_gtls_buffer record_send_buffer; /* holds cached data |
491 | * for the gnutls_io_write_buffered() | 497 | * for the gnutls_io_write_buffered() |
492 | * function. | 498 | * function. |
493 | */ | 499 | */ |
@@ -504,7 +510,7 @@ typedef struct | |||
504 | int have_peeked_data; | 510 | int have_peeked_data; |
505 | 511 | ||
506 | int expire_time; /* after expire_time seconds this session will expire */ | 512 | int expire_time; /* after expire_time seconds this session will expire */ |
507 | struct mod_auth_st_int *auth_struct; /* used in handshake packets and KX algorithms */ | 513 | struct mhd_gtls_mod_auth_st_int *auth_struct; /* used in handshake packets and KX algorithms */ |
508 | 514 | ||
509 | /* TODO rm */ | 515 | /* TODO rm */ |
510 | int v2_hello; /* 0 if the client hello is v3+. | 516 | int v2_hello; /* 0 if the client hello is v3+. |
@@ -512,7 +518,7 @@ typedef struct | |||
512 | */ | 518 | */ |
513 | /* keeps the headers of the handshake packet | 519 | /* keeps the headers of the handshake packet |
514 | */ | 520 | */ |
515 | handshake_header_buffer_st handshake_header_buffer; | 521 | mhd_gtls_handshake_header_buffer_st handshake_header_buffer; |
516 | 522 | ||
517 | /* this is the highest version available | 523 | /* this is the highest version available |
518 | * to the peer. (advertized version). | 524 | * to the peer. (advertized version). |
@@ -529,7 +535,7 @@ typedef struct | |||
529 | int send_cert_req; | 535 | int send_cert_req; |
530 | 536 | ||
531 | /* bits to use for DHE and DHA | 537 | /* bits to use for DHE and DHA |
532 | * use _gnutls_dh_get_prime_bits() and gnutls_dh_set_prime_bits() | 538 | * use _gnutls_dh_get_prime_bits() and MHD_gnutls_dh_set_prime_bits() |
533 | * to access it. | 539 | * to access it. |
534 | */ | 540 | */ |
535 | uint16_t dh_prime_bits; | 541 | uint16_t dh_prime_bits; |
@@ -538,22 +544,14 @@ typedef struct | |||
538 | 544 | ||
539 | /* PUSH & PULL functions. | 545 | /* PUSH & PULL functions. |
540 | */ | 546 | */ |
541 | gnutls_pull_func _gnutls_pull_func; | 547 | mhd_gtls_pull_func _gnutls_pull_func; |
542 | gnutls_push_func _gnutls_push_func; | 548 | mhd_gtls_push_func _gnutls_push_func; |
543 | /* Holds the first argument of PUSH and PULL | 549 | /* Holds the first argument of PUSH and PULL |
544 | * functions; | 550 | * functions; |
545 | */ | 551 | */ |
546 | gnutls_transport_ptr_t transport_recv_ptr; | 552 | gnutls_transport_ptr_t transport_recv_ptr; |
547 | gnutls_transport_ptr_t transport_send_ptr; | 553 | gnutls_transport_ptr_t transport_send_ptr; |
548 | 554 | ||
549 | /* STORE & RETRIEVE functions. Only used if other | ||
550 | * backend than gdbm is used. | ||
551 | */ | ||
552 | gnutls_db_store_func db_store_func; | ||
553 | gnutls_db_retr_func db_retrieve_func; | ||
554 | gnutls_db_remove_func db_remove_func; | ||
555 | void *db_ptr; | ||
556 | |||
557 | /* post client hello callback (server side only) | 555 | /* post client hello callback (server side only) |
558 | */ | 556 | */ |
559 | gnutls_handshake_post_client_hello_func user_hello_func; | 557 | gnutls_handshake_post_client_hello_func user_hello_func; |
@@ -564,7 +562,7 @@ typedef struct | |||
564 | uint16_t proposed_record_size; | 562 | uint16_t proposed_record_size; |
565 | 563 | ||
566 | /* holds the selected certificate and key. | 564 | /* holds the selected certificate and key. |
567 | * use _gnutls_selected_certs_deinit() and _gnutls_selected_certs_set() | 565 | * use mhd_gtls_selected_certs_deinit() and mhd_gtls_selected_certs_set() |
568 | * to change them. | 566 | * to change them. |
569 | */ | 567 | */ |
570 | gnutls_cert *selected_cert_list; | 568 | gnutls_cert *selected_cert_list; |
@@ -604,7 +602,7 @@ typedef struct | |||
604 | /* This callback will be used (if set) to receive an | 602 | /* This callback will be used (if set) to receive an |
605 | * openpgp key. (if the peer sends a fingerprint) | 603 | * openpgp key. (if the peer sends a fingerprint) |
606 | */ | 604 | */ |
607 | gnutls_openpgp_recv_key_func openpgp_recv_key_func; | 605 | mhd_gtls_openpgp_recv_key_func openpgp_recv_key_func; |
608 | 606 | ||
609 | /* If non zero the server will not advertize the CA's he | 607 | /* If non zero the server will not advertize the CA's he |
610 | * trusts (do not send an RDN sequence). | 608 | * trusts (do not send an RDN sequence). |
@@ -624,7 +622,7 @@ typedef struct | |||
624 | * credentials structure, or from a callback. That is to | 622 | * credentials structure, or from a callback. That is to |
625 | * minimize external calls. | 623 | * minimize external calls. |
626 | */ | 624 | */ |
627 | internal_params_st params; | 625 | mhd_gtls_internal_params_st params; |
628 | 626 | ||
629 | /* This buffer is used by the record recv functions, | 627 | /* This buffer is used by the record recv functions, |
630 | * as a temporary store buffer. | 628 | * as a temporary store buffer. |
@@ -633,7 +631,7 @@ typedef struct | |||
633 | 631 | ||
634 | /* To avoid using global variables, and especially on Windows where | 632 | /* To avoid using global variables, and especially on Windows where |
635 | * the application may use a different errno variable than GnuTLS, | 633 | * the application may use a different errno variable than GnuTLS, |
636 | * it is possible to use gnutls_transport_set_errno to set a | 634 | * it is possible to use MHD_gnutls_transport_set_errno to set a |
637 | * session-specific errno variable in the user-replaceable push/pull | 635 | * session-specific errno variable in the user-replaceable push/pull |
638 | * functions. This value is used by the send/recv functions. (The | 636 | * functions. This value is used by the send/recv functions. (The |
639 | * strange name of this variable is because 'errno' is typically | 637 | * strange name of this variable is because 'errno' is typically |
@@ -643,28 +641,28 @@ typedef struct | |||
643 | 641 | ||
644 | /* Function used to perform public-key signing operation during | 642 | /* Function used to perform public-key signing operation during |
645 | handshake. Used by gnutls_sig.c:_gnutls_tls_sign(), see also | 643 | handshake. Used by gnutls_sig.c:_gnutls_tls_sign(), see also |
646 | gnutls_sign_callback_set(). */ | 644 | MHD_gtls_sign_callback_set(). */ |
647 | gnutls_sign_func sign_func; | 645 | gnutls_sign_func sign_func; |
648 | void *sign_func_userdata; | 646 | void *sign_func_userdata; |
649 | 647 | ||
650 | /* If you add anything here, check _gnutls_handshake_internal_state_clear(). | 648 | /* If you add anything here, check mhd_gtls_handshake_internal_state_clear(). |
651 | */ | 649 | */ |
652 | } internals_st; | 650 | } mhd_gtls_internals_st; |
653 | 651 | ||
654 | struct gnutls_session_int | 652 | struct MHD_gtls_session_int |
655 | { | 653 | { |
656 | security_parameters_st security_parameters; | 654 | mhd_gtls_security_param_st security_parameters; |
657 | cipher_specs_st cipher_specs; | 655 | mhd_gtls_cipher_specs_st cipher_specs; |
658 | conn_stat_st connection_state; | 656 | mhd_gtls_conn_stat_st connection_state; |
659 | internals_st internals; | 657 | mhd_gtls_internals_st internals; |
660 | gnutls_key_st key; | 658 | mhd_gtls_key_st key; |
661 | }; | 659 | }; |
662 | 660 | ||
663 | /* functions */ | 661 | /* functions */ |
664 | void _gnutls_set_current_version(gnutls_session_t session, | 662 | void mhd_gtls_set_current_version(mhd_gtls_session_t session, |
665 | gnutls_protocol_t version); | 663 | gnutls_protocol_t version); |
666 | 664 | ||
667 | void _gnutls_free_auth_info(gnutls_session_t session); | 665 | void mhd_gtls_free_auth_info(mhd_gtls_session_t session); |
668 | 666 | ||
669 | /* These two macros return the advertized TLS version of | 667 | /* These two macros return the advertized TLS version of |
670 | * the peer. | 668 | * the peer. |
@@ -679,8 +677,8 @@ void _gnutls_free_auth_info(gnutls_session_t session); | |||
679 | session->internals.adv_version_major = major; \ | 677 | session->internals.adv_version_major = major; \ |
680 | session->internals.adv_version_minor = minor | 678 | session->internals.adv_version_minor = minor |
681 | 679 | ||
682 | void _gnutls_set_adv_version(gnutls_session_t, | 680 | void mhd_gtls_set_adv_version(mhd_gtls_session_t, |
683 | gnutls_protocol_t); | 681 | gnutls_protocol_t); |
684 | gnutls_protocol_t _gnutls_get_adv_version(gnutls_session_t); | 682 | gnutls_protocol_t mhd_gtls_get_adv_version(mhd_gtls_session_t); |
685 | 683 | ||
686 | #endif /* GNUTLS_INT_H */ | 684 | #endif /* GNUTLS_INT_H */ |
diff --git a/src/daemon/https/tls/gnutls_kx.c b/src/daemon/https/tls/gnutls_kx.c index 2153a791..ad42e5a1 100644 --- a/src/daemon/https/tls/gnutls_kx.c +++ b/src/daemon/https/tls/gnutls_kx.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* This file contains functions which are wrappers for the key exchange | 25 | /* This file contains functions which are wrappers for the key exchange |
26 | * part of TLS. They are called by the handshake functions (gnutls_handshake) | 26 | * part of TLS. They are called by the handshake functions (MHD_gnutls_handshake) |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "gnutls_int.h" | 29 | #include "gnutls_int.h" |
@@ -42,10 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #define MASTER_SECRET "master secret" | 44 | #define MASTER_SECRET "master secret" |
45 | static int generate_normal_master (gnutls_session_t session, int); | 45 | static int generate_normal_master (mhd_gtls_session_t session, int); |
46 | 46 | ||
47 | int | 47 | int |
48 | _gnutls_generate_master (gnutls_session_t session, int keep_premaster) | 48 | mhd_gtls_generate_master (mhd_gtls_session_t session, int keep_premaster) |
49 | { | 49 | { |
50 | if (session->internals.resumed == RESUME_FALSE) | 50 | if (session->internals.resumed == RESUME_FALSE) |
51 | return generate_normal_master (session, keep_premaster); | 51 | return generate_normal_master (session, keep_premaster); |
@@ -56,22 +56,22 @@ _gnutls_generate_master (gnutls_session_t session, int keep_premaster) | |||
56 | */ | 56 | */ |
57 | #define PREMASTER session->key->key | 57 | #define PREMASTER session->key->key |
58 | static int | 58 | static int |
59 | generate_normal_master (gnutls_session_t session, int keep_premaster) | 59 | generate_normal_master (mhd_gtls_session_t session, int keep_premaster) |
60 | { | 60 | { |
61 | int ret = 0; | 61 | int ret = 0; |
62 | char buf[512]; | 62 | char buf[512]; |
63 | 63 | ||
64 | _gnutls_hard_log ("INT: PREMASTER SECRET[%d]: %s\n", PREMASTER.size, | 64 | _gnutls_hard_log ("INT: PREMASTER SECRET[%d]: %s\n", PREMASTER.size, |
65 | _gnutls_bin2hex (PREMASTER.data, PREMASTER.size, buf, | 65 | mhd_gtls_bin2hex (PREMASTER.data, PREMASTER.size, buf, |
66 | sizeof (buf))); | 66 | sizeof (buf))); |
67 | _gnutls_hard_log ("INT: CLIENT RANDOM[%d]: %s\n", 32, | 67 | _gnutls_hard_log ("INT: CLIENT RANDOM[%d]: %s\n", 32, |
68 | _gnutls_bin2hex (session->security_parameters. | 68 | mhd_gtls_bin2hex (session->security_parameters. |
69 | client_random, 32, buf, sizeof (buf))); | 69 | client_random, 32, buf, sizeof (buf))); |
70 | _gnutls_hard_log ("INT: SERVER RANDOM[%d]: %s\n", 32, | 70 | _gnutls_hard_log ("INT: SERVER RANDOM[%d]: %s\n", 32, |
71 | _gnutls_bin2hex (session->security_parameters. | 71 | mhd_gtls_bin2hex (session->security_parameters. |
72 | server_random, 32, buf, sizeof (buf))); | 72 | server_random, 32, buf, sizeof (buf))); |
73 | 73 | ||
74 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) | 74 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3) |
75 | { | 75 | { |
76 | opaque rnd[2 * TLS_RANDOM_SIZE + 1]; | 76 | opaque rnd[2 * TLS_RANDOM_SIZE + 1]; |
77 | 77 | ||
@@ -81,7 +81,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
81 | session->security_parameters.server_random, TLS_RANDOM_SIZE); | 81 | session->security_parameters.server_random, TLS_RANDOM_SIZE); |
82 | 82 | ||
83 | ret = | 83 | ret = |
84 | _gnutls_ssl3_generate_random (PREMASTER.data, PREMASTER.size, | 84 | mhd_gnutls_ssl3_generate_random (PREMASTER.data, PREMASTER.size, |
85 | rnd, 2 * TLS_RANDOM_SIZE, | 85 | rnd, 2 * TLS_RANDOM_SIZE, |
86 | TLS_MASTER_SIZE, | 86 | TLS_MASTER_SIZE, |
87 | session->security_parameters. | 87 | session->security_parameters. |
@@ -107,7 +107,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
107 | _gnutls_hard_log ("INT: CLIENT OPRFI[%d]: %s\n", | 107 | _gnutls_hard_log ("INT: CLIENT OPRFI[%d]: %s\n", |
108 | session->security_parameters. | 108 | session->security_parameters. |
109 | extensions.oprfi_server_len, | 109 | extensions.oprfi_server_len, |
110 | _gnutls_bin2hex (session->security_parameters. | 110 | mhd_gtls_bin2hex (session->security_parameters. |
111 | extensions.oprfi_client, | 111 | extensions.oprfi_client, |
112 | session->security_parameters. | 112 | session->security_parameters. |
113 | extensions.oprfi_client_len, | 113 | extensions.oprfi_client_len, |
@@ -115,7 +115,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
115 | _gnutls_hard_log ("INT: SERVER OPRFI[%d]: %s\n", | 115 | _gnutls_hard_log ("INT: SERVER OPRFI[%d]: %s\n", |
116 | session->security_parameters. | 116 | session->security_parameters. |
117 | extensions.oprfi_server_len, | 117 | extensions.oprfi_server_len, |
118 | _gnutls_bin2hex (session->security_parameters. | 118 | mhd_gtls_bin2hex (session->security_parameters. |
119 | extensions.oprfi_server, | 119 | extensions.oprfi_server, |
120 | session->security_parameters. | 120 | session->security_parameters. |
121 | extensions.oprfi_server_len, | 121 | extensions.oprfi_server_len, |
@@ -135,7 +135,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
135 | session->security_parameters.extensions.oprfi_server, | 135 | session->security_parameters.extensions.oprfi_server, |
136 | session->security_parameters.extensions.oprfi_server_len); | 136 | session->security_parameters.extensions.oprfi_server_len); |
137 | 137 | ||
138 | ret = _gnutls_PRF (session, PREMASTER.data, PREMASTER.size, | 138 | ret = mhd_gtls_PRF (session, PREMASTER.data, PREMASTER.size, |
139 | MASTER_SECRET, strlen (MASTER_SECRET), | 139 | MASTER_SECRET, strlen (MASTER_SECRET), |
140 | rnd, rndlen, TLS_MASTER_SIZE, | 140 | rnd, rndlen, TLS_MASTER_SIZE, |
141 | session->security_parameters.master_secret); | 141 | session->security_parameters.master_secret); |
@@ -152,7 +152,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
152 | session->security_parameters.server_random, TLS_RANDOM_SIZE); | 152 | session->security_parameters.server_random, TLS_RANDOM_SIZE); |
153 | 153 | ||
154 | ret = | 154 | ret = |
155 | _gnutls_PRF (session, PREMASTER.data, PREMASTER.size, | 155 | mhd_gtls_PRF (session, PREMASTER.data, PREMASTER.size, |
156 | MASTER_SECRET, strlen (MASTER_SECRET), | 156 | MASTER_SECRET, strlen (MASTER_SECRET), |
157 | rnd, 2 * TLS_RANDOM_SIZE, TLS_MASTER_SIZE, | 157 | rnd, 2 * TLS_RANDOM_SIZE, TLS_MASTER_SIZE, |
158 | session->security_parameters.master_secret); | 158 | session->security_parameters.master_secret); |
@@ -169,7 +169,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
169 | return ret; | 169 | return ret; |
170 | 170 | ||
171 | _gnutls_hard_log ("INT: MASTER SECRET: %s\n", | 171 | _gnutls_hard_log ("INT: MASTER SECRET: %s\n", |
172 | _gnutls_bin2hex (session->security_parameters. | 172 | mhd_gtls_bin2hex (session->security_parameters. |
173 | master_secret, TLS_MASTER_SIZE, buf, | 173 | master_secret, TLS_MASTER_SIZE, buf, |
174 | sizeof (buf))); | 174 | sizeof (buf))); |
175 | 175 | ||
@@ -182,13 +182,13 @@ generate_normal_master (gnutls_session_t session, int keep_premaster) | |||
182 | * by the selected ciphersuite. | 182 | * by the selected ciphersuite. |
183 | */ | 183 | */ |
184 | int | 184 | int |
185 | _gnutls_send_server_kx_message (gnutls_session_t session, int again) | 185 | mhd_gtls_send_server_kx_message (mhd_gtls_session_t session, int again) |
186 | { | 186 | { |
187 | uint8_t *data = NULL; | 187 | uint8_t *data = NULL; |
188 | int data_size = 0; | 188 | int data_size = 0; |
189 | int ret = 0; | 189 | int ret = 0; |
190 | 190 | ||
191 | if (session->internals.auth_struct->gnutls_generate_server_kx == NULL) | 191 | if (session->internals.auth_struct->mhd_gtls_gen_server_kx == NULL) |
192 | return 0; | 192 | return 0; |
193 | 193 | ||
194 | data = NULL; | 194 | data = NULL; |
@@ -198,7 +198,7 @@ _gnutls_send_server_kx_message (gnutls_session_t session, int again) | |||
198 | { | 198 | { |
199 | data_size = | 199 | data_size = |
200 | session->internals.auth_struct-> | 200 | session->internals.auth_struct-> |
201 | gnutls_generate_server_kx (session, &data); | 201 | mhd_gtls_gen_server_kx (session, &data); |
202 | 202 | ||
203 | if (data_size == GNUTLS_E_INT_RET_0) | 203 | if (data_size == GNUTLS_E_INT_RET_0) |
204 | { | 204 | { |
@@ -214,7 +214,7 @@ _gnutls_send_server_kx_message (gnutls_session_t session, int again) | |||
214 | } | 214 | } |
215 | 215 | ||
216 | ret = | 216 | ret = |
217 | _gnutls_send_handshake (session, data, data_size, | 217 | mhd_gtls_send_handshake (session, data, data_size, |
218 | GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE); | 218 | GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE); |
219 | gnutls_free (data); | 219 | gnutls_free (data); |
220 | 220 | ||
@@ -230,14 +230,14 @@ _gnutls_send_server_kx_message (gnutls_session_t session, int again) | |||
230 | * client. | 230 | * client. |
231 | */ | 231 | */ |
232 | int | 232 | int |
233 | _gnutls_send_server_certificate_request (gnutls_session_t session, int again) | 233 | mhd_gtls_send_server_certificate_request (mhd_gtls_session_t session, int again) |
234 | { | 234 | { |
235 | uint8_t *data = NULL; | 235 | uint8_t *data = NULL; |
236 | int data_size = 0; | 236 | int data_size = 0; |
237 | int ret = 0; | 237 | int ret = 0; |
238 | 238 | ||
239 | if (session->internals.auth_struct-> | 239 | if (session->internals.auth_struct-> |
240 | gnutls_generate_server_certificate_request == NULL) | 240 | mhd_gtls_gen_server_certificate_request == NULL) |
241 | return 0; | 241 | return 0; |
242 | 242 | ||
243 | if (session->internals.send_cert_req <= 0) | 243 | if (session->internals.send_cert_req <= 0) |
@@ -250,7 +250,7 @@ _gnutls_send_server_certificate_request (gnutls_session_t session, int again) | |||
250 | { | 250 | { |
251 | data_size = | 251 | data_size = |
252 | session->internals.auth_struct-> | 252 | session->internals.auth_struct-> |
253 | gnutls_generate_server_certificate_request (session, &data); | 253 | mhd_gtls_gen_server_certificate_request (session, &data); |
254 | 254 | ||
255 | if (data_size < 0) | 255 | if (data_size < 0) |
256 | { | 256 | { |
@@ -259,7 +259,7 @@ _gnutls_send_server_certificate_request (gnutls_session_t session, int again) | |||
259 | } | 259 | } |
260 | } | 260 | } |
261 | ret = | 261 | ret = |
262 | _gnutls_send_handshake (session, data, data_size, | 262 | mhd_gtls_send_handshake (session, data, data_size, |
263 | GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST); | 263 | GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST); |
264 | gnutls_free (data); | 264 | gnutls_free (data); |
265 | 265 | ||
@@ -276,13 +276,13 @@ _gnutls_send_server_certificate_request (gnutls_session_t session, int again) | |||
276 | * exchange message | 276 | * exchange message |
277 | */ | 277 | */ |
278 | int | 278 | int |
279 | _gnutls_send_client_kx_message (gnutls_session_t session, int again) | 279 | mhd_gtls_send_client_kx_message (mhd_gtls_session_t session, int again) |
280 | { | 280 | { |
281 | uint8_t *data; | 281 | uint8_t *data; |
282 | int data_size; | 282 | int data_size; |
283 | int ret = 0; | 283 | int ret = 0; |
284 | 284 | ||
285 | if (session->internals.auth_struct->gnutls_generate_client_kx == NULL) | 285 | if (session->internals.auth_struct->mhd_gtls_gen_client_kx == NULL) |
286 | return 0; | 286 | return 0; |
287 | 287 | ||
288 | 288 | ||
@@ -293,7 +293,7 @@ _gnutls_send_client_kx_message (gnutls_session_t session, int again) | |||
293 | { | 293 | { |
294 | data_size = | 294 | data_size = |
295 | session->internals.auth_struct-> | 295 | session->internals.auth_struct-> |
296 | gnutls_generate_client_kx (session, &data); | 296 | mhd_gtls_gen_client_kx (session, &data); |
297 | if (data_size < 0) | 297 | if (data_size < 0) |
298 | { | 298 | { |
299 | gnutls_assert (); | 299 | gnutls_assert (); |
@@ -301,7 +301,7 @@ _gnutls_send_client_kx_message (gnutls_session_t session, int again) | |||
301 | } | 301 | } |
302 | } | 302 | } |
303 | ret = | 303 | ret = |
304 | _gnutls_send_handshake (session, data, data_size, | 304 | mhd_gtls_send_handshake (session, data, data_size, |
305 | GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE); | 305 | GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE); |
306 | gnutls_free (data); | 306 | gnutls_free (data); |
307 | 307 | ||
@@ -319,7 +319,7 @@ _gnutls_send_client_kx_message (gnutls_session_t session, int again) | |||
319 | * verify message | 319 | * verify message |
320 | */ | 320 | */ |
321 | int | 321 | int |
322 | _gnutls_send_client_certificate_verify (gnutls_session_t session, int again) | 322 | mhd_gtls_send_client_certificate_verify (mhd_gtls_session_t session, int again) |
323 | { | 323 | { |
324 | uint8_t *data; | 324 | uint8_t *data; |
325 | int ret = 0; | 325 | int ret = 0; |
@@ -335,7 +335,7 @@ _gnutls_send_client_certificate_verify (gnutls_session_t session, int again) | |||
335 | if (session->key->certificate_requested == 0) | 335 | if (session->key->certificate_requested == 0) |
336 | return 0; | 336 | return 0; |
337 | 337 | ||
338 | if (session->internals.auth_struct->gnutls_generate_client_cert_vrfy == | 338 | if (session->internals.auth_struct->mhd_gtls_gen_client_cert_vrfy == |
339 | NULL) | 339 | NULL) |
340 | { | 340 | { |
341 | gnutls_assert (); | 341 | gnutls_assert (); |
@@ -350,7 +350,7 @@ _gnutls_send_client_certificate_verify (gnutls_session_t session, int again) | |||
350 | { | 350 | { |
351 | data_size = | 351 | data_size = |
352 | session->internals.auth_struct-> | 352 | session->internals.auth_struct-> |
353 | gnutls_generate_client_cert_vrfy (session, &data); | 353 | mhd_gtls_gen_client_cert_vrfy (session, &data); |
354 | if (data_size < 0) | 354 | if (data_size < 0) |
355 | { | 355 | { |
356 | gnutls_assert (); | 356 | gnutls_assert (); |
@@ -361,7 +361,7 @@ _gnutls_send_client_certificate_verify (gnutls_session_t session, int again) | |||
361 | 361 | ||
362 | } | 362 | } |
363 | ret = | 363 | ret = |
364 | _gnutls_send_handshake (session, data, | 364 | mhd_gtls_send_handshake (session, data, |
365 | data_size, GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY); | 365 | data_size, GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY); |
366 | gnutls_free (data); | 366 | gnutls_free (data); |
367 | 367 | ||
@@ -370,18 +370,18 @@ _gnutls_send_client_certificate_verify (gnutls_session_t session, int again) | |||
370 | 370 | ||
371 | 371 | ||
372 | int | 372 | int |
373 | _gnutls_recv_server_kx_message (gnutls_session_t session) | 373 | mhd_gtls_recv_server_kx_message (mhd_gtls_session_t session) |
374 | { | 374 | { |
375 | uint8_t *data = NULL; | 375 | uint8_t *data = NULL; |
376 | int datasize; | 376 | int datasize; |
377 | int ret = 0; | 377 | int ret = 0; |
378 | 378 | ||
379 | if (session->internals.auth_struct->gnutls_process_server_kx != NULL) | 379 | if (session->internals.auth_struct->mhd_gtls_process_server_kx != NULL) |
380 | { | 380 | { |
381 | 381 | ||
382 | /* EXCEPTION FOR RSA_EXPORT cipher suite | 382 | /* EXCEPTION FOR RSA_EXPORT cipher suite |
383 | */ | 383 | */ |
384 | if (_gnutls_session_is_export (session) != 0 && | 384 | if (mhd_gtls_session_is_export (session) != 0 && |
385 | _gnutls_peers_cert_less_512 (session) != 0) | 385 | _gnutls_peers_cert_less_512 (session) != 0) |
386 | { | 386 | { |
387 | gnutls_assert (); | 387 | gnutls_assert (); |
@@ -389,7 +389,7 @@ _gnutls_recv_server_kx_message (gnutls_session_t session) | |||
389 | } | 389 | } |
390 | 390 | ||
391 | ret = | 391 | ret = |
392 | _gnutls_recv_handshake (session, &data, | 392 | mhd_gtls_recv_handshake (session, &data, |
393 | &datasize, | 393 | &datasize, |
394 | GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE, | 394 | GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE, |
395 | MANDATORY_PACKET); | 395 | MANDATORY_PACKET); |
@@ -401,7 +401,7 @@ _gnutls_recv_server_kx_message (gnutls_session_t session) | |||
401 | 401 | ||
402 | ret = | 402 | ret = |
403 | session->internals.auth_struct-> | 403 | session->internals.auth_struct-> |
404 | gnutls_process_server_kx (session, data, datasize); | 404 | mhd_gtls_process_server_kx (session, data, datasize); |
405 | gnutls_free (data); | 405 | gnutls_free (data); |
406 | 406 | ||
407 | if (ret < 0) | 407 | if (ret < 0) |
@@ -415,18 +415,18 @@ _gnutls_recv_server_kx_message (gnutls_session_t session) | |||
415 | } | 415 | } |
416 | 416 | ||
417 | int | 417 | int |
418 | _gnutls_recv_server_certificate_request (gnutls_session_t session) | 418 | mhd_gtls_recv_server_certificate_request (mhd_gtls_session_t session) |
419 | { | 419 | { |
420 | uint8_t *data; | 420 | uint8_t *data; |
421 | int datasize; | 421 | int datasize; |
422 | int ret = 0; | 422 | int ret = 0; |
423 | 423 | ||
424 | if (session->internals.auth_struct-> | 424 | if (session->internals.auth_struct-> |
425 | gnutls_process_server_certificate_request != NULL) | 425 | mhd_gtls_process_server_certificate_request != NULL) |
426 | { | 426 | { |
427 | 427 | ||
428 | ret = | 428 | ret = |
429 | _gnutls_recv_handshake (session, &data, | 429 | mhd_gtls_recv_handshake (session, &data, |
430 | &datasize, | 430 | &datasize, |
431 | GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST, | 431 | GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST, |
432 | OPTIONAL_PACKET); | 432 | OPTIONAL_PACKET); |
@@ -438,7 +438,7 @@ _gnutls_recv_server_certificate_request (gnutls_session_t session) | |||
438 | 438 | ||
439 | ret = | 439 | ret = |
440 | session->internals.auth_struct-> | 440 | session->internals.auth_struct-> |
441 | gnutls_process_server_certificate_request (session, data, datasize); | 441 | mhd_gtls_process_server_certificate_request (session, data, datasize); |
442 | gnutls_free (data); | 442 | gnutls_free (data); |
443 | if (ret < 0) | 443 | if (ret < 0) |
444 | return ret; | 444 | return ret; |
@@ -448,7 +448,7 @@ _gnutls_recv_server_certificate_request (gnutls_session_t session) | |||
448 | } | 448 | } |
449 | 449 | ||
450 | int | 450 | int |
451 | _gnutls_recv_client_kx_message (gnutls_session_t session) | 451 | mhd_gtls_recv_client_kx_message (mhd_gtls_session_t session) |
452 | { | 452 | { |
453 | uint8_t *data; | 453 | uint8_t *data; |
454 | int datasize; | 454 | int datasize; |
@@ -456,11 +456,11 @@ _gnutls_recv_client_kx_message (gnutls_session_t session) | |||
456 | 456 | ||
457 | 457 | ||
458 | /* Do key exchange only if the algorithm permits it */ | 458 | /* Do key exchange only if the algorithm permits it */ |
459 | if (session->internals.auth_struct->gnutls_process_client_kx != NULL) | 459 | if (session->internals.auth_struct->mhd_gtls_process_client_kx != NULL) |
460 | { | 460 | { |
461 | 461 | ||
462 | ret = | 462 | ret = |
463 | _gnutls_recv_handshake (session, &data, | 463 | mhd_gtls_recv_handshake (session, &data, |
464 | &datasize, | 464 | &datasize, |
465 | GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE, | 465 | GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE, |
466 | MANDATORY_PACKET); | 466 | MANDATORY_PACKET); |
@@ -469,7 +469,7 @@ _gnutls_recv_client_kx_message (gnutls_session_t session) | |||
469 | 469 | ||
470 | ret = | 470 | ret = |
471 | session->internals.auth_struct-> | 471 | session->internals.auth_struct-> |
472 | gnutls_process_client_kx (session, data, datasize); | 472 | mhd_gtls_process_client_kx (session, data, datasize); |
473 | gnutls_free (data); | 473 | gnutls_free (data); |
474 | if (ret < 0) | 474 | if (ret < 0) |
475 | return ret; | 475 | return ret; |
@@ -483,7 +483,7 @@ _gnutls_recv_client_kx_message (gnutls_session_t session) | |||
483 | /* This is called when we want send our certificate | 483 | /* This is called when we want send our certificate |
484 | */ | 484 | */ |
485 | int | 485 | int |
486 | _gnutls_send_client_certificate (gnutls_session_t session, int again) | 486 | mhd_gtls_send_client_certificate (mhd_gtls_session_t session, int again) |
487 | { | 487 | { |
488 | uint8_t *data = NULL; | 488 | uint8_t *data = NULL; |
489 | int data_size = 0; | 489 | int data_size = 0; |
@@ -494,7 +494,7 @@ _gnutls_send_client_certificate (gnutls_session_t session, int again) | |||
494 | return 0; | 494 | return 0; |
495 | 495 | ||
496 | if (session->internals.auth_struct-> | 496 | if (session->internals.auth_struct-> |
497 | gnutls_generate_client_certificate == NULL) | 497 | mhd_gtls_gen_client_certificate == NULL) |
498 | return 0; | 498 | return 0; |
499 | 499 | ||
500 | data = NULL; | 500 | data = NULL; |
@@ -502,14 +502,14 @@ _gnutls_send_client_certificate (gnutls_session_t session, int again) | |||
502 | 502 | ||
503 | if (again == 0) | 503 | if (again == 0) |
504 | { | 504 | { |
505 | if (gnutls_protocol_get_version (session) != MHD_GNUTLS_SSL3 || | 505 | if (MHD_gnutls_protocol_get_version (session) != MHD_GNUTLS_SSL3 || |
506 | session->internals.selected_cert_list_length > 0) | 506 | session->internals.selected_cert_list_length > 0) |
507 | { | 507 | { |
508 | /* TLS 1.0 or SSL 3.0 with a valid certificate | 508 | /* TLS 1.0 or SSL 3.0 with a valid certificate |
509 | */ | 509 | */ |
510 | data_size = | 510 | data_size = |
511 | session->internals.auth_struct-> | 511 | session->internals.auth_struct-> |
512 | gnutls_generate_client_certificate (session, &data); | 512 | mhd_gtls_gen_client_certificate (session, &data); |
513 | 513 | ||
514 | if (data_size < 0) | 514 | if (data_size < 0) |
515 | { | 515 | { |
@@ -523,11 +523,11 @@ _gnutls_send_client_certificate (gnutls_session_t session, int again) | |||
523 | * no certificate alert instead of an | 523 | * no certificate alert instead of an |
524 | * empty certificate. | 524 | * empty certificate. |
525 | */ | 525 | */ |
526 | if (gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3 && | 526 | if (MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3 && |
527 | session->internals.selected_cert_list_length == 0) | 527 | session->internals.selected_cert_list_length == 0) |
528 | { | 528 | { |
529 | ret = | 529 | ret = |
530 | gnutls_alert_send (session, GNUTLS_AL_WARNING, | 530 | MHD_gnutls_alert_send (session, GNUTLS_AL_WARNING, |
531 | GNUTLS_A_SSL3_NO_CERTIFICATE); | 531 | GNUTLS_A_SSL3_NO_CERTIFICATE); |
532 | 532 | ||
533 | } | 533 | } |
@@ -535,7 +535,7 @@ _gnutls_send_client_certificate (gnutls_session_t session, int again) | |||
535 | { /* TLS 1.0 or SSL 3.0 with a valid certificate | 535 | { /* TLS 1.0 or SSL 3.0 with a valid certificate |
536 | */ | 536 | */ |
537 | ret = | 537 | ret = |
538 | _gnutls_send_handshake (session, data, data_size, | 538 | mhd_gtls_send_handshake (session, data, data_size, |
539 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT); | 539 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT); |
540 | gnutls_free (data); | 540 | gnutls_free (data); |
541 | } | 541 | } |
@@ -553,7 +553,7 @@ _gnutls_send_client_certificate (gnutls_session_t session, int again) | |||
553 | /* This is called when we want send our certificate | 553 | /* This is called when we want send our certificate |
554 | */ | 554 | */ |
555 | int | 555 | int |
556 | _gnutls_send_server_certificate (gnutls_session_t session, int again) | 556 | mhd_gtls_send_server_certificate (mhd_gtls_session_t session, int again) |
557 | { | 557 | { |
558 | uint8_t *data = NULL; | 558 | uint8_t *data = NULL; |
559 | int data_size = 0; | 559 | int data_size = 0; |
@@ -561,7 +561,7 @@ _gnutls_send_server_certificate (gnutls_session_t session, int again) | |||
561 | 561 | ||
562 | 562 | ||
563 | if (session->internals.auth_struct-> | 563 | if (session->internals.auth_struct-> |
564 | gnutls_generate_server_certificate == NULL) | 564 | mhd_gtls_gen_server_certificate == NULL) |
565 | return 0; | 565 | return 0; |
566 | 566 | ||
567 | data = NULL; | 567 | data = NULL; |
@@ -571,7 +571,7 @@ _gnutls_send_server_certificate (gnutls_session_t session, int again) | |||
571 | { | 571 | { |
572 | data_size = | 572 | data_size = |
573 | session->internals.auth_struct-> | 573 | session->internals.auth_struct-> |
574 | gnutls_generate_server_certificate (session, &data); | 574 | mhd_gtls_gen_server_certificate (session, &data); |
575 | 575 | ||
576 | if (data_size < 0) | 576 | if (data_size < 0) |
577 | { | 577 | { |
@@ -580,7 +580,7 @@ _gnutls_send_server_certificate (gnutls_session_t session, int again) | |||
580 | } | 580 | } |
581 | } | 581 | } |
582 | ret = | 582 | ret = |
583 | _gnutls_send_handshake (session, data, data_size, | 583 | mhd_gtls_send_handshake (session, data, data_size, |
584 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT); | 584 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT); |
585 | gnutls_free (data); | 585 | gnutls_free (data); |
586 | 586 | ||
@@ -595,7 +595,7 @@ _gnutls_send_server_certificate (gnutls_session_t session, int again) | |||
595 | 595 | ||
596 | 596 | ||
597 | int | 597 | int |
598 | _gnutls_recv_client_certificate (gnutls_session_t session) | 598 | mhd_gtls_recv_client_certificate (mhd_gtls_session_t session) |
599 | { | 599 | { |
600 | int datasize; | 600 | int datasize; |
601 | opaque *data; | 601 | opaque *data; |
@@ -603,7 +603,7 @@ _gnutls_recv_client_certificate (gnutls_session_t session) | |||
603 | int optional; | 603 | int optional; |
604 | 604 | ||
605 | if (session->internals.auth_struct-> | 605 | if (session->internals.auth_struct-> |
606 | gnutls_process_client_certificate != NULL) | 606 | mhd_gtls_process_client_certificate != NULL) |
607 | { | 607 | { |
608 | 608 | ||
609 | /* if we have not requested a certificate then just return | 609 | /* if we have not requested a certificate then just return |
@@ -619,7 +619,7 @@ _gnutls_recv_client_certificate (gnutls_session_t session) | |||
619 | optional = OPTIONAL_PACKET; | 619 | optional = OPTIONAL_PACKET; |
620 | 620 | ||
621 | ret = | 621 | ret = |
622 | _gnutls_recv_handshake (session, &data, | 622 | mhd_gtls_recv_handshake (session, &data, |
623 | &datasize, | 623 | &datasize, |
624 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT, optional); | 624 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT, optional); |
625 | 625 | ||
@@ -631,7 +631,7 @@ _gnutls_recv_client_certificate (gnutls_session_t session) | |||
631 | */ | 631 | */ |
632 | if (optional == OPTIONAL_PACKET && | 632 | if (optional == OPTIONAL_PACKET && |
633 | ret == GNUTLS_E_WARNING_ALERT_RECEIVED && | 633 | ret == GNUTLS_E_WARNING_ALERT_RECEIVED && |
634 | gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3 && | 634 | MHD_gnutls_protocol_get_version (session) == MHD_GNUTLS_SSL3 && |
635 | gnutls_alert_get (session) == GNUTLS_A_SSL3_NO_CERTIFICATE) | 635 | gnutls_alert_get (session) == GNUTLS_A_SSL3_NO_CERTIFICATE) |
636 | { | 636 | { |
637 | 637 | ||
@@ -666,7 +666,7 @@ _gnutls_recv_client_certificate (gnutls_session_t session) | |||
666 | } | 666 | } |
667 | ret = | 667 | ret = |
668 | session->internals.auth_struct-> | 668 | session->internals.auth_struct-> |
669 | gnutls_process_client_certificate (session, data, datasize); | 669 | mhd_gtls_process_client_certificate (session, data, datasize); |
670 | 670 | ||
671 | gnutls_free (data); | 671 | gnutls_free (data); |
672 | if (ret < 0 && ret != GNUTLS_E_NO_CERTIFICATE_FOUND) | 672 | if (ret < 0 && ret != GNUTLS_E_NO_CERTIFICATE_FOUND) |
@@ -688,18 +688,18 @@ _gnutls_recv_client_certificate (gnutls_session_t session) | |||
688 | } | 688 | } |
689 | 689 | ||
690 | int | 690 | int |
691 | _gnutls_recv_server_certificate (gnutls_session_t session) | 691 | mhd_gtls_recv_server_certificate (mhd_gtls_session_t session) |
692 | { | 692 | { |
693 | int datasize; | 693 | int datasize; |
694 | opaque *data; | 694 | opaque *data; |
695 | int ret = 0; | 695 | int ret = 0; |
696 | 696 | ||
697 | if (session->internals.auth_struct-> | 697 | if (session->internals.auth_struct-> |
698 | gnutls_process_server_certificate != NULL) | 698 | mhd_gtls_process_server_certificate != NULL) |
699 | { | 699 | { |
700 | 700 | ||
701 | ret = | 701 | ret = |
702 | _gnutls_recv_handshake (session, &data, | 702 | mhd_gtls_recv_handshake (session, &data, |
703 | &datasize, | 703 | &datasize, |
704 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT, | 704 | GNUTLS_HANDSHAKE_CERTIFICATE_PKT, |
705 | MANDATORY_PACKET); | 705 | MANDATORY_PACKET); |
@@ -711,7 +711,7 @@ _gnutls_recv_server_certificate (gnutls_session_t session) | |||
711 | 711 | ||
712 | ret = | 712 | ret = |
713 | session->internals.auth_struct-> | 713 | session->internals.auth_struct-> |
714 | gnutls_process_server_certificate (session, data, datasize); | 714 | mhd_gtls_process_server_certificate (session, data, datasize); |
715 | gnutls_free (data); | 715 | gnutls_free (data); |
716 | if (ret < 0) | 716 | if (ret < 0) |
717 | { | 717 | { |
@@ -728,14 +728,14 @@ _gnutls_recv_server_certificate (gnutls_session_t session) | |||
728 | * arrive if the peer did not send us a certificate. | 728 | * arrive if the peer did not send us a certificate. |
729 | */ | 729 | */ |
730 | int | 730 | int |
731 | _gnutls_recv_client_certificate_verify_message (gnutls_session_t session) | 731 | mhd_gtls_recv_client_certificate_verify_message (mhd_gtls_session_t session) |
732 | { | 732 | { |
733 | uint8_t *data; | 733 | uint8_t *data; |
734 | int datasize; | 734 | int datasize; |
735 | int ret = 0; | 735 | int ret = 0; |
736 | 736 | ||
737 | 737 | ||
738 | if (session->internals.auth_struct->gnutls_process_client_cert_vrfy != NULL) | 738 | if (session->internals.auth_struct->mhd_gtls_process_client_cert_vrfy != NULL) |
739 | { | 739 | { |
740 | 740 | ||
741 | if (session->internals.send_cert_req == 0 || | 741 | if (session->internals.send_cert_req == 0 || |
@@ -745,7 +745,7 @@ _gnutls_recv_client_certificate_verify_message (gnutls_session_t session) | |||
745 | } | 745 | } |
746 | 746 | ||
747 | ret = | 747 | ret = |
748 | _gnutls_recv_handshake (session, &data, | 748 | mhd_gtls_recv_handshake (session, &data, |
749 | &datasize, | 749 | &datasize, |
750 | GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY, | 750 | GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY, |
751 | OPTIONAL_PACKET); | 751 | OPTIONAL_PACKET); |
@@ -762,7 +762,7 @@ _gnutls_recv_client_certificate_verify_message (gnutls_session_t session) | |||
762 | 762 | ||
763 | ret = | 763 | ret = |
764 | session->internals.auth_struct-> | 764 | session->internals.auth_struct-> |
765 | gnutls_process_client_cert_vrfy (session, data, datasize); | 765 | mhd_gtls_process_client_cert_vrfy (session, data, datasize); |
766 | gnutls_free (data); | 766 | gnutls_free (data); |
767 | if (ret < 0) | 767 | if (ret < 0) |
768 | return ret; | 768 | return ret; |
diff --git a/src/daemon/https/tls/gnutls_kx.h b/src/daemon/https/tls/gnutls_kx.h index 45ba68bd..bc99eb5c 100644 --- a/src/daemon/https/tls/gnutls_kx.h +++ b/src/daemon/https/tls/gnutls_kx.h | |||
@@ -22,18 +22,18 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_send_server_kx_message (gnutls_session_t session, int again); | 25 | int mhd_gtls_send_server_kx_message (mhd_gtls_session_t session, int again); |
26 | int _gnutls_send_client_kx_message (gnutls_session_t session, int again); | 26 | int mhd_gtls_send_client_kx_message (mhd_gtls_session_t session, int again); |
27 | int _gnutls_recv_server_kx_message (gnutls_session_t session); | 27 | int mhd_gtls_recv_server_kx_message (mhd_gtls_session_t session); |
28 | int _gnutls_recv_client_kx_message (gnutls_session_t session); | 28 | int mhd_gtls_recv_client_kx_message (mhd_gtls_session_t session); |
29 | int _gnutls_send_client_certificate_verify (gnutls_session_t session, | 29 | int mhd_gtls_send_client_certificate_verify (mhd_gtls_session_t session, |
30 | int again); | 30 | int again); |
31 | int _gnutls_send_server_certificate (gnutls_session_t session, int again); | 31 | int mhd_gtls_send_server_certificate (mhd_gtls_session_t session, int again); |
32 | int _gnutls_generate_master (gnutls_session_t session, int keep_premaster); | 32 | int mhd_gtls_generate_master (mhd_gtls_session_t session, int keep_premaster); |
33 | int _gnutls_recv_client_certificate (gnutls_session_t session); | 33 | int mhd_gtls_recv_client_certificate (mhd_gtls_session_t session); |
34 | int _gnutls_recv_server_certificate (gnutls_session_t session); | 34 | int mhd_gtls_recv_server_certificate (mhd_gtls_session_t session); |
35 | int _gnutls_send_client_certificate (gnutls_session_t session, int again); | 35 | int mhd_gtls_send_client_certificate (mhd_gtls_session_t session, int again); |
36 | int _gnutls_recv_server_certificate_request (gnutls_session_t session); | 36 | int mhd_gtls_recv_server_certificate_request (mhd_gtls_session_t session); |
37 | int _gnutls_send_server_certificate_request (gnutls_session_t session, | 37 | int mhd_gtls_send_server_certificate_request (mhd_gtls_session_t session, |
38 | int again); | 38 | int again); |
39 | int _gnutls_recv_client_certificate_verify_message (gnutls_session_t session); | 39 | int mhd_gtls_recv_client_certificate_verify_message (mhd_gtls_session_t session); |
diff --git a/src/daemon/https/tls/gnutls_mem.c b/src/daemon/https/tls/gnutls_mem.c index 91a6fa3c..2d7537b8 100644 --- a/src/daemon/https/tls/gnutls_mem.c +++ b/src/daemon/https/tls/gnutls_mem.c | |||
@@ -32,7 +32,7 @@ gnutls_free_function gnutls_free = free; | |||
32 | gnutls_realloc_function gnutls_realloc = realloc; | 32 | gnutls_realloc_function gnutls_realloc = realloc; |
33 | 33 | ||
34 | void *(*gnutls_calloc) (size_t, size_t) = calloc; | 34 | void *(*gnutls_calloc) (size_t, size_t) = calloc; |
35 | char *(*gnutls_strdup) (const char *) = _gnutls_strdup; | 35 | char *(*gnutls_strdup) (const char *) = mhd_gtls_strdup; |
36 | 36 | ||
37 | int | 37 | int |
38 | _gnutls_is_secure_mem_null (const void *ign) | 38 | _gnutls_is_secure_mem_null (const void *ign) |
@@ -44,7 +44,7 @@ int (*_gnutls_is_secure_memory) (const void *) = _gnutls_is_secure_mem_null; | |||
44 | 44 | ||
45 | 45 | ||
46 | void * | 46 | void * |
47 | _gnutls_calloc (size_t nmemb, size_t size) | 47 | mhd_gtls_calloc (size_t nmemb, size_t size) |
48 | { | 48 | { |
49 | void *ret; | 49 | void *ret; |
50 | size *= nmemb; | 50 | size *= nmemb; |
@@ -55,7 +55,7 @@ _gnutls_calloc (size_t nmemb, size_t size) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | svoid * | 57 | svoid * |
58 | gnutls_secure_calloc (size_t nmemb, size_t size) | 58 | mhd_gtls_secure_calloc (size_t nmemb, size_t size) |
59 | { | 59 | { |
60 | svoid *ret; | 60 | svoid *ret; |
61 | size *= nmemb; | 61 | size *= nmemb; |
@@ -69,7 +69,7 @@ gnutls_secure_calloc (size_t nmemb, size_t size) | |||
69 | * fails. | 69 | * fails. |
70 | */ | 70 | */ |
71 | void * | 71 | void * |
72 | gnutls_realloc_fast (void *ptr, size_t size) | 72 | mhd_gtls_realloc_fast (void *ptr, size_t size) |
73 | { | 73 | { |
74 | void *ret; | 74 | void *ret; |
75 | 75 | ||
@@ -86,7 +86,7 @@ gnutls_realloc_fast (void *ptr, size_t size) | |||
86 | } | 86 | } |
87 | 87 | ||
88 | char * | 88 | char * |
89 | _gnutls_strdup (const char *str) | 89 | mhd_gtls_strdup (const char *str) |
90 | { | 90 | { |
91 | size_t siz = strlen (str) + 1; | 91 | size_t siz = strlen (str) + 1; |
92 | char *ret; | 92 | char *ret; |
@@ -109,7 +109,7 @@ _gnutls_strdup (const char *str) | |||
109 | * return a pointer to memory. This function is supposed | 109 | * return a pointer to memory. This function is supposed |
110 | * to be used by callbacks. | 110 | * to be used by callbacks. |
111 | * | 111 | * |
112 | * The allocation function used is the one set by gnutls_global_set_mem_functions(). | 112 | * The allocation function used is the one set by MHD_gtls_global_set_mem_functions(). |
113 | * | 113 | * |
114 | **/ | 114 | **/ |
115 | void * | 115 | void * |
@@ -123,7 +123,7 @@ gnutls_malloc (size_t s) | |||
123 | * | 123 | * |
124 | * This function will free data pointed by ptr. | 124 | * This function will free data pointed by ptr. |
125 | * | 125 | * |
126 | * The deallocation function used is the one set by gnutls_global_set_mem_functions(). | 126 | * The deallocation function used is the one set by MHD_gtls_global_set_mem_functions(). |
127 | * | 127 | * |
128 | **/ | 128 | **/ |
129 | void | 129 | void |
diff --git a/src/daemon/https/tls/gnutls_mem.h b/src/daemon/https/tls/gnutls_mem.h index f76081e5..2d32d6e1 100644 --- a/src/daemon/https/tls/gnutls_mem.h +++ b/src/daemon/https/tls/gnutls_mem.h | |||
@@ -60,11 +60,11 @@ extern int (*_gnutls_is_secure_memory) (const void *); | |||
60 | /* this realloc function will return ptr if size==0, and | 60 | /* this realloc function will return ptr if size==0, and |
61 | * will free the ptr if the new allocation failed. | 61 | * will free the ptr if the new allocation failed. |
62 | */ | 62 | */ |
63 | void *gnutls_realloc_fast (void *ptr, size_t size); | 63 | void * mhd_gtls_realloc_fast (void *ptr, size_t size); |
64 | 64 | ||
65 | svoid *gnutls_secure_calloc (size_t nmemb, size_t size); | 65 | svoid * mhd_gtls_secure_calloc (size_t nmemb, size_t size); |
66 | 66 | ||
67 | void *_gnutls_calloc (size_t nmemb, size_t size); | 67 | void * mhd_gtls_calloc (size_t nmemb, size_t size); |
68 | char *_gnutls_strdup (const char *); | 68 | char * mhd_gtls_strdup (const char *); |
69 | 69 | ||
70 | #endif /* GNUTLS_MEM_H */ | 70 | #endif /* GNUTLS_MEM_H */ |
diff --git a/src/daemon/https/tls/gnutls_mpi.c b/src/daemon/https/tls/gnutls_mpi.c index 0d807a18..6e2b5c4f 100644 --- a/src/daemon/https/tls/gnutls_mpi.c +++ b/src/daemon/https/tls/gnutls_mpi.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | void | 37 | void |
38 | _gnutls_mpi_release (mpi_t * x) | 38 | mhd_gtls_mpi_release (mpi_t * x) |
39 | { | 39 | { |
40 | if (*x == NULL) | 40 | if (*x == NULL) |
41 | return; | 41 | return; |
@@ -46,7 +46,7 @@ _gnutls_mpi_release (mpi_t * x) | |||
46 | /* returns zero on success | 46 | /* returns zero on success |
47 | */ | 47 | */ |
48 | int | 48 | int |
49 | _gnutls_mpi_scan (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | 49 | mhd_gtls_mpi_scan (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) |
50 | { | 50 | { |
51 | int ret; | 51 | int ret; |
52 | 52 | ||
@@ -60,7 +60,7 @@ _gnutls_mpi_scan (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | |||
60 | /* returns zero on success. Fails if the number is zero. | 60 | /* returns zero on success. Fails if the number is zero. |
61 | */ | 61 | */ |
62 | int | 62 | int |
63 | _gnutls_mpi_scan_nz (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | 63 | mhd_gtls_mpi_scan_nz (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) |
64 | { | 64 | { |
65 | int ret; | 65 | int ret; |
66 | 66 | ||
@@ -72,7 +72,7 @@ _gnutls_mpi_scan_nz (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | |||
72 | */ | 72 | */ |
73 | if (_gnutls_mpi_get_nbits (*ret_mpi) == 0) | 73 | if (_gnutls_mpi_get_nbits (*ret_mpi) == 0) |
74 | { | 74 | { |
75 | _gnutls_mpi_release (ret_mpi); | 75 | mhd_gtls_mpi_release (ret_mpi); |
76 | return GNUTLS_E_MPI_SCAN_FAILED; | 76 | return GNUTLS_E_MPI_SCAN_FAILED; |
77 | } | 77 | } |
78 | 78 | ||
@@ -80,7 +80,7 @@ _gnutls_mpi_scan_nz (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | |||
80 | } | 80 | } |
81 | 81 | ||
82 | int | 82 | int |
83 | _gnutls_mpi_scan_pgp (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | 83 | mhd_gtls_mpi_scan_pgp (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) |
84 | { | 84 | { |
85 | int ret; | 85 | int ret; |
86 | ret = gcry_mpi_scan (ret_mpi, GCRYMPI_FMT_PGP, buffer, *nbytes, nbytes); | 86 | ret = gcry_mpi_scan (ret_mpi, GCRYMPI_FMT_PGP, buffer, *nbytes, nbytes); |
@@ -91,7 +91,7 @@ _gnutls_mpi_scan_pgp (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | |||
91 | */ | 91 | */ |
92 | if (_gnutls_mpi_get_nbits (*ret_mpi) == 0) | 92 | if (_gnutls_mpi_get_nbits (*ret_mpi) == 0) |
93 | { | 93 | { |
94 | _gnutls_mpi_release (ret_mpi); | 94 | mhd_gtls_mpi_release (ret_mpi); |
95 | return GNUTLS_E_MPI_SCAN_FAILED; | 95 | return GNUTLS_E_MPI_SCAN_FAILED; |
96 | } | 96 | } |
97 | 97 | ||
@@ -99,7 +99,7 @@ _gnutls_mpi_scan_pgp (mpi_t * ret_mpi, const opaque * buffer, size_t * nbytes) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | int | 101 | int |
102 | _gnutls_mpi_print (void *buffer, size_t * nbytes, const mpi_t a) | 102 | mhd_gtls_mpi_print (void *buffer, size_t * nbytes, const mpi_t a) |
103 | { | 103 | { |
104 | int ret; | 104 | int ret; |
105 | 105 | ||
@@ -115,7 +115,7 @@ _gnutls_mpi_print (void *buffer, size_t * nbytes, const mpi_t a) | |||
115 | 115 | ||
116 | /* Always has the first bit zero */ | 116 | /* Always has the first bit zero */ |
117 | int | 117 | int |
118 | _gnutls_mpi_print_lz (void *buffer, size_t * nbytes, const mpi_t a) | 118 | mhd_gtls_mpi_print_lz (void *buffer, size_t * nbytes, const mpi_t a) |
119 | { | 119 | { |
120 | int ret; | 120 | int ret; |
121 | 121 | ||
@@ -131,7 +131,7 @@ _gnutls_mpi_print_lz (void *buffer, size_t * nbytes, const mpi_t a) | |||
131 | 131 | ||
132 | /* Always has the first bit zero */ | 132 | /* Always has the first bit zero */ |
133 | int | 133 | int |
134 | _gnutls_mpi_dprint_lz (gnutls_datum_t * dest, const mpi_t a) | 134 | mhd_gtls_mpi_dprint_lz (gnutls_datum_t * dest, const mpi_t a) |
135 | { | 135 | { |
136 | int ret; | 136 | int ret; |
137 | opaque *buf = NULL; | 137 | opaque *buf = NULL; |
@@ -160,7 +160,7 @@ _gnutls_mpi_dprint_lz (gnutls_datum_t * dest, const mpi_t a) | |||
160 | } | 160 | } |
161 | 161 | ||
162 | int | 162 | int |
163 | _gnutls_mpi_dprint (gnutls_datum_t * dest, const mpi_t a) | 163 | mhd_gtls_mpi_dprint (gnutls_datum_t * dest, const mpi_t a) |
164 | { | 164 | { |
165 | int ret; | 165 | int ret; |
166 | opaque *buf = NULL; | 166 | opaque *buf = NULL; |
@@ -225,7 +225,7 @@ _gnutls_x509_read_int (ASN1_TYPE node, const char *value, mpi_t * ret_mpi) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | s_len = tmpstr_size; | 227 | s_len = tmpstr_size; |
228 | if (_gnutls_mpi_scan (ret_mpi, tmpstr, &s_len) != 0) | 228 | if (mhd_gtls_mpi_scan (ret_mpi, tmpstr, &s_len) != 0) |
229 | { | 229 | { |
230 | gnutls_assert (); | 230 | gnutls_assert (); |
231 | gnutls_afree (tmpstr); | 231 | gnutls_afree (tmpstr); |
@@ -248,9 +248,9 @@ _gnutls_x509_write_int (ASN1_TYPE node, const char *value, mpi_t mpi, int lz) | |||
248 | 248 | ||
249 | s_len = 0; | 249 | s_len = 0; |
250 | if (lz) | 250 | if (lz) |
251 | result = _gnutls_mpi_print_lz (NULL, &s_len, mpi); | 251 | result = mhd_gtls_mpi_print_lz (NULL, &s_len, mpi); |
252 | else | 252 | else |
253 | result = _gnutls_mpi_print (NULL, &s_len, mpi); | 253 | result = mhd_gtls_mpi_print (NULL, &s_len, mpi); |
254 | 254 | ||
255 | tmpstr = gnutls_alloca (s_len); | 255 | tmpstr = gnutls_alloca (s_len); |
256 | if (tmpstr == NULL) | 256 | if (tmpstr == NULL) |
@@ -260,9 +260,9 @@ _gnutls_x509_write_int (ASN1_TYPE node, const char *value, mpi_t mpi, int lz) | |||
260 | } | 260 | } |
261 | 261 | ||
262 | if (lz) | 262 | if (lz) |
263 | result = _gnutls_mpi_print_lz (tmpstr, &s_len, mpi); | 263 | result = mhd_gtls_mpi_print_lz (tmpstr, &s_len, mpi); |
264 | else | 264 | else |
265 | result = _gnutls_mpi_print (tmpstr, &s_len, mpi); | 265 | result = mhd_gtls_mpi_print (tmpstr, &s_len, mpi); |
266 | 266 | ||
267 | if (result != 0) | 267 | if (result != 0) |
268 | { | 268 | { |
diff --git a/src/daemon/https/tls/gnutls_mpi.h b/src/daemon/https/tls/gnutls_mpi.h index d242e9e9..dc70e36f 100644 --- a/src/daemon/https/tls/gnutls_mpi.h +++ b/src/daemon/https/tls/gnutls_mpi.h | |||
@@ -60,19 +60,19 @@ typedef gcry_mpi_t mpi_t; | |||
60 | #define _gnutls_mpi_alloc_like(x) _gnutls_mpi_new(_gnutls_mpi_get_nbits(x)) | 60 | #define _gnutls_mpi_alloc_like(x) _gnutls_mpi_new(_gnutls_mpi_get_nbits(x)) |
61 | #define _gnutls_mpi_salloc_like(x) _gnutls_mpi_snew(_gnutls_mpi_get_nbits(x)) | 61 | #define _gnutls_mpi_salloc_like(x) _gnutls_mpi_snew(_gnutls_mpi_get_nbits(x)) |
62 | 62 | ||
63 | void _gnutls_mpi_release (mpi_t * x); | 63 | void mhd_gtls_mpi_release (mpi_t * x); |
64 | 64 | ||
65 | int _gnutls_mpi_scan_nz (mpi_t * ret_mpi, const opaque * buffer, | 65 | int mhd_gtls_mpi_scan_nz (mpi_t * ret_mpi, const opaque * buffer, |
66 | size_t * nbytes); | 66 | size_t * nbytes); |
67 | int _gnutls_mpi_scan (mpi_t * ret_mpi, const opaque * buffer, | 67 | int mhd_gtls_mpi_scan (mpi_t * ret_mpi, const opaque * buffer, |
68 | size_t * nbytes); | 68 | size_t * nbytes); |
69 | int _gnutls_mpi_scan_pgp (mpi_t * ret_mpi, const opaque * buffer, | 69 | int mhd_gtls_mpi_scan_pgp (mpi_t * ret_mpi, const opaque * buffer, |
70 | size_t * nbytes); | 70 | size_t * nbytes); |
71 | 71 | ||
72 | int _gnutls_mpi_print (void *buffer, size_t * nbytes, const mpi_t a); | 72 | int mhd_gtls_mpi_print (void *buffer, size_t * nbytes, const mpi_t a); |
73 | int _gnutls_mpi_print_lz (void *buffer, size_t * nbytes, const mpi_t a); | 73 | int mhd_gtls_mpi_print_lz (void *buffer, size_t * nbytes, const mpi_t a); |
74 | 74 | ||
75 | int _gnutls_mpi_dprint_lz (gnutls_datum_t * dest, const mpi_t a); | 75 | int mhd_gtls_mpi_dprint_lz (gnutls_datum_t * dest, const mpi_t a); |
76 | int _gnutls_mpi_dprint (gnutls_datum_t * dest, const mpi_t a); | 76 | int mhd_gtls_mpi_dprint (gnutls_datum_t * dest, const mpi_t a); |
77 | 77 | ||
78 | #endif | 78 | #endif |
diff --git a/src/daemon/https/tls/gnutls_num.c b/src/daemon/https/tls/gnutls_num.c index 474cb73b..ab5c7196 100644 --- a/src/daemon/https/tls/gnutls_num.c +++ b/src/daemon/https/tls/gnutls_num.c | |||
@@ -35,7 +35,7 @@ | |||
35 | * has been reached. | 35 | * has been reached. |
36 | */ | 36 | */ |
37 | int | 37 | int |
38 | _gnutls_uint64pp (uint64 * x) | 38 | mhd_gtls_uint64pp (uint64 * x) |
39 | { | 39 | { |
40 | register int i, y = 0; | 40 | register int i, y = 0; |
41 | 41 | ||
@@ -60,7 +60,7 @@ _gnutls_uint64pp (uint64 * x) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | uint32_t | 62 | uint32_t |
63 | _gnutls_uint24touint32 (uint24 num) | 63 | mhd_gtls_uint24touint32 (uint24 num) |
64 | { | 64 | { |
65 | uint32_t ret = 0; | 65 | uint32_t ret = 0; |
66 | 66 | ||
@@ -71,7 +71,7 @@ _gnutls_uint24touint32 (uint24 num) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | uint24 | 73 | uint24 |
74 | _gnutls_uint32touint24 (uint32_t num) | 74 | mhd_gtls_uint32touint24 (uint32_t num) |
75 | { | 75 | { |
76 | uint24 ret; | 76 | uint24 ret; |
77 | 77 | ||
@@ -84,7 +84,7 @@ _gnutls_uint32touint24 (uint32_t num) | |||
84 | 84 | ||
85 | /* data should be at least 3 bytes */ | 85 | /* data should be at least 3 bytes */ |
86 | uint32_t | 86 | uint32_t |
87 | _gnutls_read_uint24 (const opaque * data) | 87 | mhd_gtls_read_uint24 (const opaque * data) |
88 | { | 88 | { |
89 | uint32_t res; | 89 | uint32_t res; |
90 | uint24 num; | 90 | uint24 num; |
@@ -93,7 +93,7 @@ _gnutls_read_uint24 (const opaque * data) | |||
93 | num.pint[1] = data[1]; | 93 | num.pint[1] = data[1]; |
94 | num.pint[2] = data[2]; | 94 | num.pint[2] = data[2]; |
95 | 95 | ||
96 | res = _gnutls_uint24touint32 (num); | 96 | res = mhd_gtls_uint24touint32 (num); |
97 | #ifndef WORDS_BIGENDIAN | 97 | #ifndef WORDS_BIGENDIAN |
98 | res = byteswap32 (res); | 98 | res = byteswap32 (res); |
99 | #endif | 99 | #endif |
@@ -101,14 +101,14 @@ _gnutls_read_uint24 (const opaque * data) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | void | 103 | void |
104 | _gnutls_write_uint24 (uint32_t num, opaque * data) | 104 | mhd_gtls_write_uint24 (uint32_t num, opaque * data) |
105 | { | 105 | { |
106 | uint24 tmp; | 106 | uint24 tmp; |
107 | 107 | ||
108 | #ifndef WORDS_BIGENDIAN | 108 | #ifndef WORDS_BIGENDIAN |
109 | num = byteswap32 (num); | 109 | num = byteswap32 (num); |
110 | #endif | 110 | #endif |
111 | tmp = _gnutls_uint32touint24 (num); | 111 | tmp = mhd_gtls_uint32touint24 (num); |
112 | 112 | ||
113 | data[0] = tmp.pint[0]; | 113 | data[0] = tmp.pint[0]; |
114 | data[1] = tmp.pint[1]; | 114 | data[1] = tmp.pint[1]; |
@@ -116,7 +116,7 @@ _gnutls_write_uint24 (uint32_t num, opaque * data) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | uint32_t | 118 | uint32_t |
119 | _gnutls_read_uint32 (const opaque * data) | 119 | mhd_gtls_read_uint32 (const opaque * data) |
120 | { | 120 | { |
121 | uint32_t res; | 121 | uint32_t res; |
122 | 122 | ||
@@ -128,7 +128,7 @@ _gnutls_read_uint32 (const opaque * data) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | void | 130 | void |
131 | _gnutls_write_uint32 (uint32_t num, opaque * data) | 131 | mhd_gtls_write_uint32 (uint32_t num, opaque * data) |
132 | { | 132 | { |
133 | 133 | ||
134 | #ifndef WORDS_BIGENDIAN | 134 | #ifndef WORDS_BIGENDIAN |
@@ -138,7 +138,7 @@ _gnutls_write_uint32 (uint32_t num, opaque * data) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | uint16_t | 140 | uint16_t |
141 | _gnutls_read_uint16 (const opaque * data) | 141 | mhd_gtls_read_uint16 (const opaque * data) |
142 | { | 142 | { |
143 | uint16_t res; | 143 | uint16_t res; |
144 | memcpy (&res, data, sizeof (uint16_t)); | 144 | memcpy (&res, data, sizeof (uint16_t)); |
@@ -149,7 +149,7 @@ _gnutls_read_uint16 (const opaque * data) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | void | 151 | void |
152 | _gnutls_write_uint16 (uint16_t num, opaque * data) | 152 | mhd_gtls_write_uint16 (uint16_t num, opaque * data) |
153 | { | 153 | { |
154 | 154 | ||
155 | #ifndef WORDS_BIGENDIAN | 155 | #ifndef WORDS_BIGENDIAN |
@@ -159,7 +159,7 @@ _gnutls_write_uint16 (uint16_t num, opaque * data) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | uint32_t | 161 | uint32_t |
162 | _gnutls_conv_uint32 (uint32_t data) | 162 | mhd_gtls_conv_uint32 (uint32_t data) |
163 | { | 163 | { |
164 | #ifndef WORDS_BIGENDIAN | 164 | #ifndef WORDS_BIGENDIAN |
165 | return byteswap32 (data); | 165 | return byteswap32 (data); |
@@ -169,7 +169,7 @@ _gnutls_conv_uint32 (uint32_t data) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | uint16_t | 171 | uint16_t |
172 | _gnutls_conv_uint16 (uint16_t data) | 172 | mhd_gtls_conv_uint16 (uint16_t data) |
173 | { | 173 | { |
174 | #ifndef WORDS_BIGENDIAN | 174 | #ifndef WORDS_BIGENDIAN |
175 | return byteswap16 (data); | 175 | return byteswap16 (data); |
@@ -179,7 +179,7 @@ _gnutls_conv_uint16 (uint16_t data) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | uint32_t | 181 | uint32_t |
182 | _gnutls_uint64touint32 (const uint64 * num) | 182 | mhd_gtls_uint64touint32 (const uint64 * num) |
183 | { | 183 | { |
184 | uint32_t ret; | 184 | uint32_t ret; |
185 | 185 | ||
diff --git a/src/daemon/https/tls/gnutls_num.h b/src/daemon/https/tls/gnutls_num.h index 3ab226ae..37ce0c6d 100644 --- a/src/daemon/https/tls/gnutls_num.h +++ b/src/daemon/https/tls/gnutls_num.h | |||
@@ -32,18 +32,18 @@ | |||
32 | #define byteswap16(x) ((rotl16(x, 8) & 0x00ff) | (rotr16(x, 8) & 0xff00)) | 32 | #define byteswap16(x) ((rotl16(x, 8) & 0x00ff) | (rotr16(x, 8) & 0xff00)) |
33 | #define byteswap32(x) ((rotl32(x, 8) & 0x00ff00ffUL) | (rotr32(x, 8) & 0xff00ff00UL)) | 33 | #define byteswap32(x) ((rotl32(x, 8) & 0x00ff00ffUL) | (rotr32(x, 8) & 0xff00ff00UL)) |
34 | 34 | ||
35 | uint32_t _gnutls_uint24touint32 (uint24 num); | 35 | uint32_t mhd_gtls_uint24touint32 (uint24 num); |
36 | uint24 _gnutls_uint32touint24 (uint32_t num); | 36 | uint24 mhd_gtls_uint32touint24 (uint32_t num); |
37 | uint32_t _gnutls_read_uint32 (const opaque * data); | 37 | uint32_t mhd_gtls_read_uint32 (const opaque * data); |
38 | uint16_t _gnutls_read_uint16 (const opaque * data); | 38 | uint16_t mhd_gtls_read_uint16 (const opaque * data); |
39 | uint32_t _gnutls_conv_uint32 (uint32_t data); | 39 | uint32_t mhd_gtls_conv_uint32 (uint32_t data); |
40 | uint16_t _gnutls_conv_uint16 (uint16_t data); | 40 | uint16_t mhd_gtls_conv_uint16 (uint16_t data); |
41 | uint32_t _gnutls_read_uint24 (const opaque * data); | 41 | uint32_t mhd_gtls_read_uint24 (const opaque * data); |
42 | void _gnutls_write_uint24 (uint32_t num, opaque * data); | 42 | void mhd_gtls_write_uint24 (uint32_t num, opaque * data); |
43 | void _gnutls_write_uint32 (uint32_t num, opaque * data); | 43 | void mhd_gtls_write_uint32 (uint32_t num, opaque * data); |
44 | void _gnutls_write_uint16 (uint16_t num, opaque * data); | 44 | void mhd_gtls_write_uint16 (uint16_t num, opaque * data); |
45 | uint32_t _gnutls_uint64touint32 (const uint64 *); | 45 | uint32_t mhd_gtls_uint64touint32 (const uint64 *); |
46 | 46 | ||
47 | int _gnutls_uint64pp (uint64 *); | 47 | int mhd_gtls_uint64pp (uint64 *); |
48 | # define _gnutls_uint64zero(x) x.i[0] = x.i[1] = x.i[2] = x.i[3] = x.i[4] = x.i[5] = x.i[6] = x.i[7] = 0 | 48 | # define _gnutls_uint64zero(x) x.i[0] = x.i[1] = x.i[2] = x.i[3] = x.i[4] = x.i[5] = x.i[6] = x.i[7] = 0 |
49 | # define UINT64DATA(x) x.i | 49 | # define UINT64DATA(x) x.i |
diff --git a/src/daemon/https/tls/gnutls_pk.c b/src/daemon/https/tls/gnutls_pk.c index cfec9463..2e748bab 100644 --- a/src/daemon/https/tls/gnutls_pk.c +++ b/src/daemon/https/tls/gnutls_pk.c | |||
@@ -54,7 +54,7 @@ static int _gnutls_pk_decrypt (int algo, mpi_t * resarr, mpi_t data, | |||
54 | * params is modulus, public exp. | 54 | * params is modulus, public exp. |
55 | */ | 55 | */ |
56 | int | 56 | int |
57 | _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | 57 | mhd_gtls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, |
58 | const gnutls_datum_t * plaintext, | 58 | const gnutls_datum_t * plaintext, |
59 | mpi_t * params, unsigned params_len, | 59 | mpi_t * params, unsigned params_len, |
60 | unsigned btype) | 60 | unsigned btype) |
@@ -143,7 +143,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | |||
143 | ps[psize] = 0; | 143 | ps[psize] = 0; |
144 | memcpy (&ps[psize + 1], plaintext->data, plaintext->size); | 144 | memcpy (&ps[psize + 1], plaintext->data, plaintext->size); |
145 | 145 | ||
146 | if (_gnutls_mpi_scan_nz (&m, edata, &k) != 0) | 146 | if (mhd_gtls_mpi_scan_nz (&m, edata, &k) != 0) |
147 | { | 147 | { |
148 | gnutls_assert (); | 148 | gnutls_assert (); |
149 | gnutls_afree (edata); | 149 | gnutls_afree (edata); |
@@ -156,7 +156,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | |||
156 | else /* sign */ | 156 | else /* sign */ |
157 | ret = _gnutls_pk_sign (GCRY_PK_RSA, &res, m, params, params_len); | 157 | ret = _gnutls_pk_sign (GCRY_PK_RSA, &res, m, params, params_len); |
158 | 158 | ||
159 | _gnutls_mpi_release (&m); | 159 | mhd_gtls_mpi_release (&m); |
160 | 160 | ||
161 | if (ret < 0) | 161 | if (ret < 0) |
162 | { | 162 | { |
@@ -164,7 +164,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | |||
164 | return ret; | 164 | return ret; |
165 | } | 165 | } |
166 | 166 | ||
167 | _gnutls_mpi_print (NULL, &psize, res); | 167 | mhd_gtls_mpi_print (NULL, &psize, res); |
168 | 168 | ||
169 | if (psize < k) | 169 | if (psize < k) |
170 | { | 170 | { |
@@ -180,7 +180,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | |||
180 | { /* psize > k !!! */ | 180 | { /* psize > k !!! */ |
181 | /* This is an impossible situation */ | 181 | /* This is an impossible situation */ |
182 | gnutls_assert (); | 182 | gnutls_assert (); |
183 | _gnutls_mpi_release (&res); | 183 | mhd_gtls_mpi_release (&res); |
184 | return GNUTLS_E_INTERNAL_ERROR; | 184 | return GNUTLS_E_INTERNAL_ERROR; |
185 | } | 185 | } |
186 | 186 | ||
@@ -188,16 +188,16 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | |||
188 | if (ciphertext->data == NULL) | 188 | if (ciphertext->data == NULL) |
189 | { | 189 | { |
190 | gnutls_assert (); | 190 | gnutls_assert (); |
191 | _gnutls_mpi_release (&res); | 191 | mhd_gtls_mpi_release (&res); |
192 | return GNUTLS_E_MEMORY_ERROR; | 192 | return GNUTLS_E_MEMORY_ERROR; |
193 | } | 193 | } |
194 | _gnutls_mpi_print (&ciphertext->data[pad], &psize, res); | 194 | mhd_gtls_mpi_print (&ciphertext->data[pad], &psize, res); |
195 | for (i = 0; i < pad; i++) | 195 | for (i = 0; i < pad; i++) |
196 | ciphertext->data[i] = 0; | 196 | ciphertext->data[i] = 0; |
197 | 197 | ||
198 | ciphertext->size = k; | 198 | ciphertext->size = k; |
199 | 199 | ||
200 | _gnutls_mpi_release (&res); | 200 | mhd_gtls_mpi_release (&res); |
201 | 201 | ||
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
@@ -208,7 +208,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | |||
208 | * Can decrypt block type 1 and type 2 packets. | 208 | * Can decrypt block type 1 and type 2 packets. |
209 | */ | 209 | */ |
210 | int | 210 | int |
211 | _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, | 211 | mhd_gtls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, |
212 | const gnutls_datum_t * ciphertext, | 212 | const gnutls_datum_t * ciphertext, |
213 | mpi_t * params, unsigned params_len, | 213 | mpi_t * params, unsigned params_len, |
214 | unsigned btype) | 214 | unsigned btype) |
@@ -232,7 +232,7 @@ _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, | |||
232 | return GNUTLS_E_PK_DECRYPTION_FAILED; | 232 | return GNUTLS_E_PK_DECRYPTION_FAILED; |
233 | } | 233 | } |
234 | 234 | ||
235 | if (_gnutls_mpi_scan_nz (&c, ciphertext->data, &esize) != 0) | 235 | if (mhd_gtls_mpi_scan_nz (&c, ciphertext->data, &esize) != 0) |
236 | { | 236 | { |
237 | gnutls_assert (); | 237 | gnutls_assert (); |
238 | return GNUTLS_E_MPI_SCAN_FAILED; | 238 | return GNUTLS_E_MPI_SCAN_FAILED; |
@@ -247,7 +247,7 @@ _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, | |||
247 | { | 247 | { |
248 | ret = _gnutls_pk_encrypt (GCRY_PK_RSA, &res, c, params, params_len); | 248 | ret = _gnutls_pk_encrypt (GCRY_PK_RSA, &res, c, params, params_len); |
249 | } | 249 | } |
250 | _gnutls_mpi_release (&c); | 250 | mhd_gtls_mpi_release (&c); |
251 | 251 | ||
252 | if (ret < 0) | 252 | if (ret < 0) |
253 | { | 253 | { |
@@ -255,17 +255,17 @@ _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, | |||
255 | return ret; | 255 | return ret; |
256 | } | 256 | } |
257 | 257 | ||
258 | _gnutls_mpi_print (NULL, &esize, res); | 258 | mhd_gtls_mpi_print (NULL, &esize, res); |
259 | edata = gnutls_alloca (esize + 1); | 259 | edata = gnutls_alloca (esize + 1); |
260 | if (edata == NULL) | 260 | if (edata == NULL) |
261 | { | 261 | { |
262 | gnutls_assert (); | 262 | gnutls_assert (); |
263 | _gnutls_mpi_release (&res); | 263 | mhd_gtls_mpi_release (&res); |
264 | return GNUTLS_E_MEMORY_ERROR; | 264 | return GNUTLS_E_MEMORY_ERROR; |
265 | } | 265 | } |
266 | _gnutls_mpi_print (&edata[1], &esize, res); | 266 | mhd_gtls_mpi_print (&edata[1], &esize, res); |
267 | 267 | ||
268 | _gnutls_mpi_release (&res); | 268 | mhd_gtls_mpi_release (&res); |
269 | 269 | ||
270 | /* EB = 00||BT||PS||00||D | 270 | /* EB = 00||BT||PS||00||D |
271 | * (use block type 'btype') | 271 | * (use block type 'btype') |
@@ -345,7 +345,7 @@ _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, | |||
345 | 345 | ||
346 | 346 | ||
347 | int | 347 | int |
348 | _gnutls_rsa_verify (const gnutls_datum_t * vdata, | 348 | mhd_gtls_rsa_verify (const gnutls_datum_t * vdata, |
349 | const gnutls_datum_t * ciphertext, mpi_t * params, | 349 | const gnutls_datum_t * ciphertext, mpi_t * params, |
350 | int params_len, int btype) | 350 | int params_len, int btype) |
351 | { | 351 | { |
@@ -355,7 +355,7 @@ _gnutls_rsa_verify (const gnutls_datum_t * vdata, | |||
355 | 355 | ||
356 | /* decrypt signature */ | 356 | /* decrypt signature */ |
357 | if ((ret = | 357 | if ((ret = |
358 | _gnutls_pkcs1_rsa_decrypt (&plain, ciphertext, params, params_len, | 358 | mhd_gtls_pkcs1_rsa_decrypt (&plain, ciphertext, params, params_len, |
359 | btype)) < 0) | 359 | btype)) < 0) |
360 | { | 360 | { |
361 | gnutls_assert (); | 361 | gnutls_assert (); |
@@ -433,7 +433,7 @@ encode_ber_rs (gnutls_datum_t * sig_value, mpi_t r, mpi_t s) | |||
433 | /* Do DSA signature calculation. params is p, q, g, y, x in that order. | 433 | /* Do DSA signature calculation. params is p, q, g, y, x in that order. |
434 | */ | 434 | */ |
435 | int | 435 | int |
436 | _gnutls_dsa_sign (gnutls_datum_t * signature, | 436 | mhd_gtls_dsa_sign (gnutls_datum_t * signature, |
437 | const gnutls_datum_t * hash, mpi_t * params, | 437 | const gnutls_datum_t * hash, mpi_t * params, |
438 | unsigned params_len) | 438 | unsigned params_len) |
439 | { | 439 | { |
@@ -448,7 +448,7 @@ _gnutls_dsa_sign (gnutls_datum_t * signature, | |||
448 | return GNUTLS_E_PK_SIGN_FAILED; | 448 | return GNUTLS_E_PK_SIGN_FAILED; |
449 | } | 449 | } |
450 | 450 | ||
451 | if (_gnutls_mpi_scan_nz (&mdata, hash->data, &k) != 0) | 451 | if (mhd_gtls_mpi_scan_nz (&mdata, hash->data, &k) != 0) |
452 | { | 452 | { |
453 | gnutls_assert (); | 453 | gnutls_assert (); |
454 | return GNUTLS_E_MPI_SCAN_FAILED; | 454 | return GNUTLS_E_MPI_SCAN_FAILED; |
@@ -456,7 +456,7 @@ _gnutls_dsa_sign (gnutls_datum_t * signature, | |||
456 | 456 | ||
457 | ret = _gnutls_pk_sign (GCRY_PK_DSA, rs, mdata, params, params_len); | 457 | ret = _gnutls_pk_sign (GCRY_PK_DSA, rs, mdata, params, params_len); |
458 | /* rs[0], rs[1] now hold r,s */ | 458 | /* rs[0], rs[1] now hold r,s */ |
459 | _gnutls_mpi_release (&mdata); | 459 | mhd_gtls_mpi_release (&mdata); |
460 | 460 | ||
461 | if (ret < 0) | 461 | if (ret < 0) |
462 | { | 462 | { |
@@ -467,8 +467,8 @@ _gnutls_dsa_sign (gnutls_datum_t * signature, | |||
467 | ret = encode_ber_rs (signature, rs[0], rs[1]); | 467 | ret = encode_ber_rs (signature, rs[0], rs[1]); |
468 | 468 | ||
469 | /* free r,s */ | 469 | /* free r,s */ |
470 | _gnutls_mpi_release (&rs[0]); | 470 | mhd_gtls_mpi_release (&rs[0]); |
471 | _gnutls_mpi_release (&rs[1]); | 471 | mhd_gtls_mpi_release (&rs[1]); |
472 | 472 | ||
473 | if (ret != 0) | 473 | if (ret != 0) |
474 | { | 474 | { |
@@ -516,7 +516,7 @@ decode_ber_rs (const gnutls_datum_t * sig_value, mpi_t * r, mpi_t * s) | |||
516 | if (result < 0) | 516 | if (result < 0) |
517 | { | 517 | { |
518 | gnutls_assert (); | 518 | gnutls_assert (); |
519 | _gnutls_mpi_release (s); | 519 | mhd_gtls_mpi_release (s); |
520 | asn1_delete_structure (&sig); | 520 | asn1_delete_structure (&sig); |
521 | return result; | 521 | return result; |
522 | } | 522 | } |
@@ -529,7 +529,7 @@ decode_ber_rs (const gnutls_datum_t * sig_value, mpi_t * r, mpi_t * s) | |||
529 | /* params is p, q, g, y in that order | 529 | /* params is p, q, g, y in that order |
530 | */ | 530 | */ |
531 | int | 531 | int |
532 | _gnutls_dsa_verify (const gnutls_datum_t * vdata, | 532 | mhd_gtls_dsa_verify (const gnutls_datum_t * vdata, |
533 | const gnutls_datum_t * sig_value, mpi_t * params, | 533 | const gnutls_datum_t * sig_value, mpi_t * params, |
534 | int params_len) | 534 | int params_len) |
535 | { | 535 | { |
@@ -552,19 +552,19 @@ _gnutls_dsa_verify (const gnutls_datum_t * vdata, | |||
552 | } | 552 | } |
553 | 553 | ||
554 | k = vdata->size; | 554 | k = vdata->size; |
555 | if (_gnutls_mpi_scan_nz (&mdata, vdata->data, &k) != 0) | 555 | if (mhd_gtls_mpi_scan_nz (&mdata, vdata->data, &k) != 0) |
556 | { | 556 | { |
557 | gnutls_assert (); | 557 | gnutls_assert (); |
558 | _gnutls_mpi_release (&rs[0]); | 558 | mhd_gtls_mpi_release (&rs[0]); |
559 | _gnutls_mpi_release (&rs[1]); | 559 | mhd_gtls_mpi_release (&rs[1]); |
560 | return GNUTLS_E_MPI_SCAN_FAILED; | 560 | return GNUTLS_E_MPI_SCAN_FAILED; |
561 | } | 561 | } |
562 | 562 | ||
563 | /* decrypt signature */ | 563 | /* decrypt signature */ |
564 | ret = _gnutls_pk_verify (GCRY_PK_DSA, mdata, rs, params, params_len); | 564 | ret = _gnutls_pk_verify (GCRY_PK_DSA, mdata, rs, params, params_len); |
565 | _gnutls_mpi_release (&mdata); | 565 | mhd_gtls_mpi_release (&mdata); |
566 | _gnutls_mpi_release (&rs[0]); | 566 | mhd_gtls_mpi_release (&rs[0]); |
567 | _gnutls_mpi_release (&rs[1]); | 567 | mhd_gtls_mpi_release (&rs[1]); |
568 | 568 | ||
569 | if (ret < 0) | 569 | if (ret < 0) |
570 | { | 570 | { |
diff --git a/src/daemon/https/tls/gnutls_pk.h b/src/daemon/https/tls/gnutls_pk.h index 83f87689..bde27a2a 100644 --- a/src/daemon/https/tls/gnutls_pk.h +++ b/src/daemon/https/tls/gnutls_pk.h | |||
@@ -25,21 +25,21 @@ | |||
25 | #ifndef GNUTLS_PK_H | 25 | #ifndef GNUTLS_PK_H |
26 | #define GNUTLS_PK_H | 26 | #define GNUTLS_PK_H |
27 | 27 | ||
28 | int _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, | 28 | int mhd_gtls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, |
29 | const gnutls_datum_t * plaintext, | 29 | const gnutls_datum_t * plaintext, |
30 | mpi_t * params, unsigned params_len, | 30 | mpi_t * params, unsigned params_len, |
31 | unsigned btype); | 31 | unsigned btype); |
32 | int _gnutls_dsa_sign (gnutls_datum_t * signature, | 32 | int mhd_gtls_dsa_sign (gnutls_datum_t * signature, |
33 | const gnutls_datum_t * plaintext, mpi_t * params, | 33 | const gnutls_datum_t * plaintext, mpi_t * params, |
34 | unsigned params_len); | 34 | unsigned params_len); |
35 | int _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, | 35 | int mhd_gtls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, |
36 | const gnutls_datum_t * ciphertext, | 36 | const gnutls_datum_t * ciphertext, |
37 | mpi_t * params, unsigned params_len, | 37 | mpi_t * params, unsigned params_len, |
38 | unsigned btype); | 38 | unsigned btype); |
39 | int _gnutls_rsa_verify (const gnutls_datum_t * vdata, | 39 | int mhd_gtls_rsa_verify (const gnutls_datum_t * vdata, |
40 | const gnutls_datum_t * ciphertext, mpi_t * params, | 40 | const gnutls_datum_t * ciphertext, mpi_t * params, |
41 | int params_len, int btype); | 41 | int params_len, int btype); |
42 | int _gnutls_dsa_verify (const gnutls_datum_t * vdata, | 42 | int mhd_gtls_dsa_verify (const gnutls_datum_t * vdata, |
43 | const gnutls_datum_t * sig_value, mpi_t * params, | 43 | const gnutls_datum_t * sig_value, mpi_t * params, |
44 | int params_len); | 44 | int params_len); |
45 | 45 | ||
diff --git a/src/daemon/https/tls/gnutls_priority.c b/src/daemon/https/tls/gnutls_priority.c index cea6446b..e865fd27 100644 --- a/src/daemon/https/tls/gnutls_priority.c +++ b/src/daemon/https/tls/gnutls_priority.c | |||
@@ -33,8 +33,8 @@ | |||
33 | #define MAX_ELEMENTS 48 | 33 | #define MAX_ELEMENTS 48 |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * gnutls_cipher_set_priority - Sets the priority on the ciphers supported by gnutls. | 36 | * MHD_gnutls_cipher_set_priority - Sets the priority on the ciphers supported by gnutls. |
37 | * @session: is a #gnutls_session_t structure. | 37 | * @session: is a #mhd_gtls_session_t structure. |
38 | * @list: is a 0 terminated list of gnutls_cipher_algorithm_t elements. | 38 | * @list: is a 0 terminated list of gnutls_cipher_algorithm_t elements. |
39 | * | 39 | * |
40 | * Sets the priority on the ciphers supported by gnutls. | 40 | * Sets the priority on the ciphers supported by gnutls. |
@@ -48,7 +48,7 @@ | |||
48 | * | 48 | * |
49 | **/ | 49 | **/ |
50 | int | 50 | int |
51 | gnutls_cipher_set_priority (gnutls_session_t session, const int *list) | 51 | MHD_gnutls_cipher_set_priority (mhd_gtls_session_t session, const int *list) |
52 | { | 52 | { |
53 | int num = 0, i; | 53 | int num = 0, i; |
54 | 54 | ||
@@ -67,7 +67,7 @@ gnutls_cipher_set_priority (gnutls_session_t session, const int *list) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | inline static int | 69 | inline static int |
70 | _set_priority (priority_st * st, const int *list) | 70 | _set_priority (mhd_gtls_priority_st * st, const int *list) |
71 | { | 71 | { |
72 | int num = 0, i; | 72 | int num = 0, i; |
73 | 73 | ||
@@ -86,8 +86,8 @@ _set_priority (priority_st * st, const int *list) | |||
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * gnutls_kx_set_priority - Sets the priority on the key exchange algorithms supported by gnutls. | 89 | * MHD_gnutls_kx_set_priority - Sets the priority on the key exchange algorithms supported by gnutls. |
90 | * @session: is a #gnutls_session_t structure. | 90 | * @session: is a #mhd_gtls_session_t structure. |
91 | * @list: is a 0 terminated list of gnutls_kx_algorithm_t elements. | 91 | * @list: is a 0 terminated list of gnutls_kx_algorithm_t elements. |
92 | * | 92 | * |
93 | * Sets the priority on the key exchange algorithms supported by gnutls. | 93 | * Sets the priority on the key exchange algorithms supported by gnutls. |
@@ -101,14 +101,14 @@ _set_priority (priority_st * st, const int *list) | |||
101 | * | 101 | * |
102 | **/ | 102 | **/ |
103 | int | 103 | int |
104 | gnutls_kx_set_priority (gnutls_session_t session, const int *list) | 104 | MHD_gnutls_kx_set_priority (mhd_gtls_session_t session, const int *list) |
105 | { | 105 | { |
106 | return _set_priority (&session->internals.priorities.kx, list); | 106 | return _set_priority (&session->internals.priorities.kx, list); |
107 | } | 107 | } |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * gnutls_mac_set_priority - Sets the priority on the mac algorithms supported by gnutls. | 110 | * MHD_gnutls_mac_set_priority - Sets the priority on the mac algorithms supported by gnutls. |
111 | * @session: is a #gnutls_session_t structure. | 111 | * @session: is a #mhd_gtls_session_t structure. |
112 | * @list: is a 0 terminated list of gnutls_mac_algorithm_t elements. | 112 | * @list: is a 0 terminated list of gnutls_mac_algorithm_t elements. |
113 | * | 113 | * |
114 | * Sets the priority on the mac algorithms supported by gnutls. | 114 | * Sets the priority on the mac algorithms supported by gnutls. |
@@ -122,14 +122,14 @@ gnutls_kx_set_priority (gnutls_session_t session, const int *list) | |||
122 | * | 122 | * |
123 | **/ | 123 | **/ |
124 | int | 124 | int |
125 | gnutls_mac_set_priority (gnutls_session_t session, const int *list) | 125 | MHD_gnutls_mac_set_priority (mhd_gtls_session_t session, const int *list) |
126 | { | 126 | { |
127 | return _set_priority (&session->internals.priorities.mac, list); | 127 | return _set_priority (&session->internals.priorities.mac, list); |
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * gnutls_compression_set_priority - Sets the priority on the compression algorithms supported by gnutls. | 131 | * MHD_gnutls_compression_set_priority - Sets the priority on the compression algorithms supported by gnutls. |
132 | * @session: is a #gnutls_session_t structure. | 132 | * @session: is a #mhd_gtls_session_t structure. |
133 | * @list: is a 0 terminated list of gnutls_compression_method_t elements. | 133 | * @list: is a 0 terminated list of gnutls_compression_method_t elements. |
134 | * | 134 | * |
135 | * Sets the priority on the compression algorithms supported by gnutls. | 135 | * Sets the priority on the compression algorithms supported by gnutls. |
@@ -147,14 +147,14 @@ gnutls_mac_set_priority (gnutls_session_t session, const int *list) | |||
147 | * | 147 | * |
148 | **/ | 148 | **/ |
149 | int | 149 | int |
150 | gnutls_compression_set_priority (gnutls_session_t session, const int *list) | 150 | MHD_gnutls_compression_set_priority (mhd_gtls_session_t session, const int *list) |
151 | { | 151 | { |
152 | return _set_priority (&session->internals.priorities.compression, list); | 152 | return _set_priority (&session->internals.priorities.compression, list); |
153 | } | 153 | } |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * gnutls_protocol_set_priority - Sets the priority on the protocol versions supported by gnutls. | 156 | * MHD_gnutls_protocol_set_priority - Sets the priority on the protocol versions supported by gnutls. |
157 | * @session: is a #gnutls_session_t structure. | 157 | * @session: is a #mhd_gtls_session_t structure. |
158 | * @list: is a 0 terminated list of gnutls_protocol_t elements. | 158 | * @list: is a 0 terminated list of gnutls_protocol_t elements. |
159 | * | 159 | * |
160 | * Sets the priority on the protocol versions supported by gnutls. | 160 | * Sets the priority on the protocol versions supported by gnutls. |
@@ -165,7 +165,7 @@ gnutls_compression_set_priority (gnutls_session_t session, const int *list) | |||
165 | * | 165 | * |
166 | **/ | 166 | **/ |
167 | int | 167 | int |
168 | gnutls_protocol_set_priority (gnutls_session_t session, const int *list) | 168 | MHD_gnutls_protocol_set_priority (mhd_gtls_session_t session, const int *list) |
169 | { | 169 | { |
170 | int ret; | 170 | int ret; |
171 | 171 | ||
@@ -175,14 +175,14 @@ gnutls_protocol_set_priority (gnutls_session_t session, const int *list) | |||
175 | * This will be overridden later. | 175 | * This will be overridden later. |
176 | */ | 176 | */ |
177 | if (list) | 177 | if (list) |
178 | _gnutls_set_current_version (session, list[0]); | 178 | mhd_gtls_set_current_version (session, list[0]); |
179 | 179 | ||
180 | return ret; | 180 | return ret; |
181 | } | 181 | } |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * gnutls_certificate_type_set_priority - Sets the priority on the certificate types supported by gnutls. | 184 | * MHD_gnutls_certificate_type_set_priority - Sets the priority on the certificate types supported by gnutls. |
185 | * @session: is a #gnutls_session_t structure. | 185 | * @session: is a #mhd_gtls_session_t structure. |
186 | * @list: is a 0 terminated list of gnutls_certificate_type_t elements. | 186 | * @list: is a 0 terminated list of gnutls_certificate_type_t elements. |
187 | * | 187 | * |
188 | * Sets the priority on the certificate types supported by gnutls. | 188 | * Sets the priority on the certificate types supported by gnutls. |
@@ -196,7 +196,7 @@ gnutls_protocol_set_priority (gnutls_session_t session, const int *list) | |||
196 | * | 196 | * |
197 | **/ | 197 | **/ |
198 | int | 198 | int |
199 | gnutls_certificate_type_set_priority (gnutls_session_t session, | 199 | MHD_gnutls_certificate_type_set_priority (mhd_gtls_session_t session, |
200 | const int *list) | 200 | const int *list) |
201 | { | 201 | { |
202 | #if ENABLE_OPENPGP | 202 | #if ENABLE_OPENPGP |
@@ -235,11 +235,11 @@ static const int comp_priority[] = { MHD_GNUTLS_COMP_NULL, | |||
235 | 0 | 235 | 0 |
236 | }; | 236 | }; |
237 | 237 | ||
238 | typedef void (rmadd_func) (priority_st * priority_list, int alg); | 238 | typedef void (rmadd_func) (mhd_gtls_priority_st * priority_list, int alg); |
239 | 239 | ||
240 | /** | 240 | /** |
241 | * gnutls_priority_set - Sets priorities for the cipher suites supported by gnutls. | 241 | * MHD_gnutls_priority_set - Sets priorities for the cipher suites supported by gnutls. |
242 | * @session: is a #gnutls_session_t structure. | 242 | * @session: is a #mhd_gtls_session_t structure. |
243 | * @priority: is a #gnutls_priority_t structure. | 243 | * @priority: is a #gnutls_priority_t structure. |
244 | * | 244 | * |
245 | * Sets the priorities to use on the ciphers, key exchange methods, | 245 | * Sets the priorities to use on the ciphers, key exchange methods, |
@@ -249,7 +249,7 @@ typedef void (rmadd_func) (priority_st * priority_list, int alg); | |||
249 | * | 249 | * |
250 | **/ | 250 | **/ |
251 | int | 251 | int |
252 | gnutls_priority_set (gnutls_session_t session, gnutls_priority_t priority) | 252 | MHD_gnutls_priority_set (mhd_gtls_session_t session, gnutls_priority_t priority) |
253 | { | 253 | { |
254 | if (priority == NULL) | 254 | if (priority == NULL) |
255 | { | 255 | { |
@@ -258,13 +258,13 @@ gnutls_priority_set (gnutls_session_t session, gnutls_priority_t priority) | |||
258 | } | 258 | } |
259 | 259 | ||
260 | memcpy (&session->internals.priorities, priority, | 260 | memcpy (&session->internals.priorities, priority, |
261 | sizeof (struct gnutls_priority_st)); | 261 | sizeof (struct MHD_gtls_priority_st)); |
262 | 262 | ||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | /** | 266 | /** |
267 | * gnutls_priority_init - Sets priorities for the cipher suites supported by gnutls. | 267 | * MHD_tls_set_default_priority - Sets priorities for the cipher suites supported by gnutls. |
268 | * @priority_cache: is a #gnutls_prioritity_t structure. | 268 | * @priority_cache: is a #gnutls_prioritity_t structure. |
269 | * @priorities: is a string describing priorities | 269 | * @priorities: is a string describing priorities |
270 | * @err_pos: In case of an error this will have the position in the string the error occured | 270 | * @err_pos: In case of an error this will have the position in the string the error occured |
@@ -329,10 +329,10 @@ gnutls_priority_set (gnutls_session_t session, gnutls_priority_t priority) | |||
329 | * 0 on success. | 329 | * 0 on success. |
330 | **/ | 330 | **/ |
331 | int | 331 | int |
332 | gnutls_priority_init (gnutls_priority_t * priority_cache, | 332 | MHD_tls_set_default_priority (gnutls_priority_t * priority_cache, |
333 | const char *priorities, const char **err_pos) | 333 | const char *priorities, const char **err_pos) |
334 | { | 334 | { |
335 | *priority_cache = gnutls_calloc (1, sizeof (struct gnutls_priority_st)); | 335 | *priority_cache = gnutls_calloc (1, sizeof (struct MHD_gtls_priority_st)); |
336 | if (*priority_cache == NULL) | 336 | if (*priority_cache == NULL) |
337 | { | 337 | { |
338 | gnutls_assert (); | 338 | gnutls_assert (); |
@@ -352,104 +352,54 @@ gnutls_priority_init (gnutls_priority_t * priority_cache, | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * gnutls_priority_deinit - Deinitialize the priorities cache for the cipher suites supported by gnutls. | 355 | * MHD_gnutls_priority_deinit - Deinitialize the priorities cache for the cipher suites supported by gnutls. |
356 | * @priority_cache: is a #gnutls_prioritity_t structure. | 356 | * @priority_cache: is a #gnutls_prioritity_t structure. |
357 | * | 357 | * |
358 | * Deinitializes the priority cache. | 358 | * Deinitializes the priority cache. |
359 | * | 359 | * |
360 | **/ | 360 | **/ |
361 | void | 361 | void |
362 | gnutls_priority_deinit (gnutls_priority_t priority_cache) | 362 | MHD_gnutls_priority_deinit (gnutls_priority_t priority_cache) |
363 | { | 363 | { |
364 | gnutls_free (priority_cache); | 364 | gnutls_free (priority_cache); |
365 | } | 365 | } |
366 | 366 | ||
367 | /** | 367 | /** |
368 | * gnutls_priority_set_direct - Sets priorities for the cipher suites supported by gnutls. | 368 | * MHD_gnutls_priority_set_direct - Sets priorities for the cipher suites supported by gnutls. |
369 | * @session: is a #gnutls_session_t structure. | 369 | * @session: is a #mhd_gtls_session_t structure. |
370 | * @priorities: is a string describing priorities | 370 | * @priorities: is a string describing priorities |
371 | * @err_pos: In case of an error this will have the position in the string the error occured | 371 | * @err_pos: In case of an error this will have the position in the string the error occured |
372 | * | 372 | * |
373 | * Sets the priorities to use on the ciphers, key exchange methods, | 373 | * Sets the priorities to use on the ciphers, key exchange methods, |
374 | * macs and compression methods. This function avoids keeping a | 374 | * macs and compression methods. This function avoids keeping a |
375 | * priority cache and is used to directly set string priorities to a | 375 | * priority cache and is used to directly set string priorities to a |
376 | * TLS session. For documentation check the gnutls_priority_init(). | 376 | * TLS session. For documentation check the MHD_tls_set_default_priority(). |
377 | * | 377 | * |
378 | * On syntax error GNUTLS_E_INVALID_REQUEST is returned and 0 on success. | 378 | * On syntax error GNUTLS_E_INVALID_REQUEST is returned and 0 on success. |
379 | * | 379 | * |
380 | **/ | 380 | **/ |
381 | int | 381 | int |
382 | gnutls_priority_set_direct (gnutls_session_t session, | 382 | MHD_gnutls_priority_set_direct (mhd_gtls_session_t session, |
383 | const char *priorities, const char **err_pos) | 383 | const char *priorities, const char **err_pos) |
384 | { | 384 | { |
385 | gnutls_priority_t prio; | 385 | gnutls_priority_t prio; |
386 | int ret; | 386 | int ret; |
387 | 387 | ||
388 | ret = gnutls_priority_init (&prio, priorities, err_pos); | 388 | ret = MHD_tls_set_default_priority (&prio, priorities, err_pos); |
389 | if (ret < 0) | 389 | if (ret < 0) |
390 | { | 390 | { |
391 | gnutls_assert (); | 391 | gnutls_assert (); |
392 | return ret; | 392 | return ret; |
393 | } | 393 | } |
394 | 394 | ||
395 | ret = gnutls_priority_set (session, prio); | 395 | ret = MHD_gnutls_priority_set (session, prio); |
396 | if (ret < 0) | 396 | if (ret < 0) |
397 | { | 397 | { |
398 | gnutls_assert (); | 398 | gnutls_assert (); |
399 | return ret; | 399 | return ret; |
400 | } | 400 | } |
401 | 401 | ||
402 | gnutls_priority_deinit (prio); | 402 | MHD_gnutls_priority_deinit (prio); |
403 | 403 | ||
404 | return 0; | 404 | return 0; |
405 | } | 405 | } |
406 | |||
407 | /** | ||
408 | * gnutls_set_default_priority - Sets some default priority on the cipher suites supported by gnutls. | ||
409 | * @session: is a #gnutls_session_t structure. | ||
410 | * | ||
411 | * Sets some default priority on the ciphers, key exchange methods, | ||
412 | * macs and compression methods. | ||
413 | * | ||
414 | * This is the same as calling: | ||
415 | * | ||
416 | * gnutls_priority_set_direct (session, "NORMAL", NULL); | ||
417 | * | ||
418 | * This function is kept around for backwards compatibility, but | ||
419 | * because of its wide use it is still fully supported. If you wish | ||
420 | * to allow users to provide a string that specify which ciphers to | ||
421 | * use (which is recommended), you should use | ||
422 | * gnutls_priority_set_direct() or gnutls_priority_set() instead. | ||
423 | * | ||
424 | * Returns 0 on success. | ||
425 | **/ | ||
426 | int | ||
427 | gnutls_set_default_priority (gnutls_session_t session) | ||
428 | { | ||
429 | return gnutls_priority_set_direct (session, "NORMAL", NULL); | ||
430 | } | ||
431 | |||
432 | /** | ||
433 | * gnutls_set_default_export_priority - Sets some default priority on the cipher suites supported by gnutls. | ||
434 | * @session: is a #gnutls_session_t structure. | ||
435 | * | ||
436 | * Sets some default priority on the ciphers, key exchange methods, macs | ||
437 | * and compression methods. This function also includes weak algorithms. | ||
438 | * | ||
439 | * This is the same as calling: | ||
440 | * | ||
441 | * gnutls_priority_set_direct (session, "EXPORT", NULL); | ||
442 | * | ||
443 | * This function is kept around for backwards compatibility, but | ||
444 | * because of its wide use it is still fully supported. If you wish | ||
445 | * to allow users to provide a string that specify which ciphers to | ||
446 | * use (which is recommended), you should use | ||
447 | * gnutls_priority_set_direct() or gnutls_priority_set() instead. | ||
448 | * | ||
449 | * Returns 0 on success. | ||
450 | **/ | ||
451 | int | ||
452 | gnutls_set_default_export_priority (gnutls_session_t session) | ||
453 | { | ||
454 | return gnutls_priority_set_direct (session, "EXPORT", NULL); | ||
455 | } | ||
diff --git a/src/daemon/https/tls/gnutls_record.c b/src/daemon/https/tls/gnutls_record.c index 68c83330..22bf60db 100644 --- a/src/daemon/https/tls/gnutls_record.c +++ b/src/daemon/https/tls/gnutls_record.c | |||
@@ -44,27 +44,27 @@ | |||
44 | #include <gnutls_dh.h> | 44 | #include <gnutls_dh.h> |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * gnutls_protocol_get_version - Returns the version of the currently used protocol | 47 | * MHD_gnutls_protocol_get_version - Returns the version of the currently used protocol |
48 | * @session: is a #gnutls_session_t structure. | 48 | * @session: is a #mhd_gtls_session_t structure. |
49 | * | 49 | * |
50 | * Returns: the version of the currently used protocol. | 50 | * Returns: the version of the currently used protocol. |
51 | **/ | 51 | **/ |
52 | gnutls_protocol_t | 52 | gnutls_protocol_t |
53 | gnutls_protocol_get_version (gnutls_session_t session) | 53 | MHD_gnutls_protocol_get_version (mhd_gtls_session_t session) |
54 | { | 54 | { |
55 | return session->security_parameters.version; | 55 | return session->security_parameters.version; |
56 | } | 56 | } |
57 | 57 | ||
58 | void | 58 | void |
59 | _gnutls_set_current_version (gnutls_session_t session, | 59 | mhd_gtls_set_current_version (mhd_gtls_session_t session, |
60 | gnutls_protocol_t version) | 60 | gnutls_protocol_t version) |
61 | { | 61 | { |
62 | session->security_parameters.version = version; | 62 | session->security_parameters.version = version; |
63 | } | 63 | } |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * gnutls_transport_set_lowat - Used to set the lowat value in order for select to check for pending data. | 66 | * MHD_gnutls_transport_set_lowat - Used to set the lowat value in order for select to check for pending data. |
67 | * @session: is a #gnutls_session_t structure. | 67 | * @session: is a #mhd_gtls_session_t structure. |
68 | * @num: is the low water value. | 68 | * @num: is the low water value. |
69 | * | 69 | * |
70 | * Used to set the lowat value in order for select to check if there | 70 | * Used to set the lowat value in order for select to check if there |
@@ -75,14 +75,14 @@ _gnutls_set_current_version (gnutls_session_t session, | |||
75 | * to zero. | 75 | * to zero. |
76 | **/ | 76 | **/ |
77 | void | 77 | void |
78 | gnutls_transport_set_lowat (gnutls_session_t session, int num) | 78 | MHD_gnutls_transport_set_lowat (mhd_gtls_session_t session, int num) |
79 | { | 79 | { |
80 | session->internals.lowat = num; | 80 | session->internals.lowat = num; |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * gnutls_record_disable_padding - Used to disabled padding in TLS 1.0 and above | 84 | * MHD_gtls_record_disable_padding - Used to disabled padding in TLS 1.0 and above |
85 | * @session: is a #gnutls_session_t structure. | 85 | * @session: is a #mhd_gtls_session_t structure. |
86 | * | 86 | * |
87 | * Used to disabled padding in TLS 1.0 and above. Normally you do | 87 | * Used to disabled padding in TLS 1.0 and above. Normally you do |
88 | * not need to use this function, but there are buggy clients that | 88 | * not need to use this function, but there are buggy clients that |
@@ -93,14 +93,14 @@ gnutls_transport_set_lowat (gnutls_session_t session, int num) | |||
93 | * out there, need to call this function. | 93 | * out there, need to call this function. |
94 | **/ | 94 | **/ |
95 | void | 95 | void |
96 | gnutls_record_disable_padding (gnutls_session_t session) | 96 | MHD_gtls_record_disable_padding (mhd_gtls_session_t session) |
97 | { | 97 | { |
98 | session->internals.priorities.no_padding = 1; | 98 | session->internals.priorities.no_padding = 1; |
99 | } | 99 | } |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * gnutls_transport_set_ptr - Used to set first argument of the transport functions | 102 | * MHD_gnutls_transport_set_ptr - Used to set first argument of the transport functions |
103 | * @session: is a #gnutls_session_t structure. | 103 | * @session: is a #mhd_gtls_session_t structure. |
104 | * @ptr: is the value. | 104 | * @ptr: is the value. |
105 | * | 105 | * |
106 | * Used to set the first argument of the transport function (like | 106 | * Used to set the first argument of the transport function (like |
@@ -108,7 +108,7 @@ gnutls_record_disable_padding (gnutls_session_t session) | |||
108 | * the connection handle. | 108 | * the connection handle. |
109 | **/ | 109 | **/ |
110 | void | 110 | void |
111 | gnutls_transport_set_ptr (gnutls_session_t session, | 111 | MHD_gnutls_transport_set_ptr (mhd_gtls_session_t session, |
112 | gnutls_transport_ptr_t ptr) | 112 | gnutls_transport_ptr_t ptr) |
113 | { | 113 | { |
114 | session->internals.transport_recv_ptr = ptr; | 114 | session->internals.transport_recv_ptr = ptr; |
@@ -116,8 +116,8 @@ gnutls_transport_set_ptr (gnutls_session_t session, | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * gnutls_transport_set_ptr2 - Used to set first argument of the transport functions | 119 | * MHD_gnutls_transport_set_ptr2 - Used to set first argument of the transport functions |
120 | * @session: is a #gnutls_session_t structure. | 120 | * @session: is a #mhd_gtls_session_t structure. |
121 | * @recv_ptr: is the value for the pull function | 121 | * @recv_ptr: is the value for the pull function |
122 | * @send_ptr: is the value for the push function | 122 | * @send_ptr: is the value for the push function |
123 | * | 123 | * |
@@ -127,7 +127,7 @@ gnutls_transport_set_ptr (gnutls_session_t session, | |||
127 | * different pointers for receiving and sending. | 127 | * different pointers for receiving and sending. |
128 | **/ | 128 | **/ |
129 | void | 129 | void |
130 | gnutls_transport_set_ptr2 (gnutls_session_t session, | 130 | MHD_gnutls_transport_set_ptr2 (mhd_gtls_session_t session, |
131 | gnutls_transport_ptr_t recv_ptr, | 131 | gnutls_transport_ptr_t recv_ptr, |
132 | gnutls_transport_ptr_t send_ptr) | 132 | gnutls_transport_ptr_t send_ptr) |
133 | { | 133 | { |
@@ -136,48 +136,12 @@ gnutls_transport_set_ptr2 (gnutls_session_t session, | |||
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * gnutls_transport_get_ptr - Used to return the first argument of the transport functions | 139 | * MHD_gnutls_bye - This function terminates the current TLS/SSL connection. |
140 | * @session: is a #gnutls_session_t structure. | 140 | * @session: is a #mhd_gtls_session_t structure. |
141 | * | ||
142 | * Used to get the first argument of the transport function (like | ||
143 | * PUSH and PULL). This must have been set using | ||
144 | * gnutls_transport_set_ptr(). | ||
145 | * | ||
146 | * Returns: first argument of the transport function. | ||
147 | **/ | ||
148 | gnutls_transport_ptr_t | ||
149 | gnutls_transport_get_ptr (gnutls_session_t session) | ||
150 | { | ||
151 | return session->internals.transport_recv_ptr; | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * gnutls_transport_get_ptr2 - Used to return the first argument of the transport functions | ||
156 | * @session: is a #gnutls_session_t structure. | ||
157 | * @recv_ptr: will hold the value for the pull function | ||
158 | * @send_ptr: will hold the value for the push function | ||
159 | * | ||
160 | * Used to get the arguments of the transport functions (like PUSH | ||
161 | * and PULL). These should have been set using | ||
162 | * gnutls_transport_set_ptr2(). | ||
163 | **/ | ||
164 | void | ||
165 | gnutls_transport_get_ptr2 (gnutls_session_t session, | ||
166 | gnutls_transport_ptr_t * recv_ptr, | ||
167 | gnutls_transport_ptr_t * send_ptr) | ||
168 | { | ||
169 | |||
170 | *recv_ptr = session->internals.transport_recv_ptr; | ||
171 | *send_ptr = session->internals.transport_send_ptr; | ||
172 | } | ||
173 | |||
174 | /** | ||
175 | * gnutls_bye - This function terminates the current TLS/SSL connection. | ||
176 | * @session: is a #gnutls_session_t structure. | ||
177 | * @how: is an integer | 141 | * @how: is an integer |
178 | * | 142 | * |
179 | * Terminates the current TLS/SSL connection. The connection should | 143 | * Terminates the current TLS/SSL connection. The connection should |
180 | * have been initiated using gnutls_handshake(). @how should be one | 144 | * have been initiated using MHD_gnutls_handshake(). @how should be one |
181 | * of %GNUTLS_SHUT_RDWR, %GNUTLS_SHUT_WR. | 145 | * of %GNUTLS_SHUT_RDWR, %GNUTLS_SHUT_WR. |
182 | * | 146 | * |
183 | * In case of %GNUTLS_SHUT_RDWR then the TLS connection gets | 147 | * In case of %GNUTLS_SHUT_RDWR then the TLS connection gets |
@@ -199,13 +163,13 @@ gnutls_transport_get_ptr2 (gnutls_session_t session, | |||
199 | * session, thus this behavior is not recommended. | 163 | * session, thus this behavior is not recommended. |
200 | * | 164 | * |
201 | * This function may also return %GNUTLS_E_AGAIN or | 165 | * This function may also return %GNUTLS_E_AGAIN or |
202 | * %GNUTLS_E_INTERRUPTED; cf. gnutls_record_get_direction(). | 166 | * %GNUTLS_E_INTERRUPTED; cf. MHD_gnutls_record_get_direction(). |
203 | * | 167 | * |
204 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code, see | 168 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code, see |
205 | * function documentation for entire semantics. | 169 | * function documentation for entire semantics. |
206 | **/ | 170 | **/ |
207 | int | 171 | int |
208 | gnutls_bye (gnutls_session_t session, gnutls_close_request_t how) | 172 | MHD_gnutls_bye (mhd_gtls_session_t session, gnutls_close_request_t how) |
209 | { | 173 | { |
210 | int ret = 0; | 174 | int ret = 0; |
211 | 175 | ||
@@ -213,7 +177,7 @@ gnutls_bye (gnutls_session_t session, gnutls_close_request_t how) | |||
213 | { | 177 | { |
214 | case STATE0: | 178 | case STATE0: |
215 | case STATE60: | 179 | case STATE60: |
216 | ret = _gnutls_io_write_flush (session); | 180 | ret = mhd_gtls_io_write_flush (session); |
217 | STATE = STATE60; | 181 | STATE = STATE60; |
218 | if (ret < 0) | 182 | if (ret < 0) |
219 | { | 183 | { |
@@ -223,7 +187,7 @@ gnutls_bye (gnutls_session_t session, gnutls_close_request_t how) | |||
223 | 187 | ||
224 | case STATE61: | 188 | case STATE61: |
225 | ret = | 189 | ret = |
226 | gnutls_alert_send (session, GNUTLS_AL_WARNING, GNUTLS_A_CLOSE_NOTIFY); | 190 | MHD_gnutls_alert_send (session, GNUTLS_AL_WARNING, GNUTLS_A_CLOSE_NOTIFY); |
227 | STATE = STATE61; | 191 | STATE = STATE61; |
228 | if (ret < 0) | 192 | if (ret < 0) |
229 | { | 193 | { |
@@ -237,8 +201,8 @@ gnutls_bye (gnutls_session_t session, gnutls_close_request_t how) | |||
237 | { | 201 | { |
238 | do | 202 | do |
239 | { | 203 | { |
240 | _gnutls_io_clear_peeked_data (session); | 204 | mhd_gtls_io_clear_peeked_data (session); |
241 | ret = _gnutls_recv_int (session, GNUTLS_ALERT, -1, NULL, 0); | 205 | ret = mhd_gtls_recv_int (session, GNUTLS_ALERT, -1, NULL, 0); |
242 | } | 206 | } |
243 | while (ret == GNUTLS_E_GOT_APPLICATION_DATA); | 207 | while (ret == GNUTLS_E_GOT_APPLICATION_DATA); |
244 | 208 | ||
@@ -266,13 +230,13 @@ gnutls_bye (gnutls_session_t session, gnutls_close_request_t how) | |||
266 | } | 230 | } |
267 | 231 | ||
268 | inline static void | 232 | inline static void |
269 | session_invalidate (gnutls_session_t session) | 233 | session_invalidate (mhd_gtls_session_t session) |
270 | { | 234 | { |
271 | session->internals.valid_connection = VALID_FALSE; | 235 | session->internals.valid_connection = VALID_FALSE; |
272 | } | 236 | } |
273 | 237 | ||
274 | inline static void | 238 | inline static void |
275 | session_unresumable (gnutls_session_t session) | 239 | session_unresumable (mhd_gtls_session_t session) |
276 | { | 240 | { |
277 | session->internals.resumable = RESUME_FALSE; | 241 | session->internals.resumable = RESUME_FALSE; |
278 | } | 242 | } |
@@ -280,7 +244,7 @@ session_unresumable (gnutls_session_t session) | |||
280 | /* returns 0 if session is valid | 244 | /* returns 0 if session is valid |
281 | */ | 245 | */ |
282 | inline static int | 246 | inline static int |
283 | session_is_valid (gnutls_session_t session) | 247 | session_is_valid (mhd_gtls_session_t session) |
284 | { | 248 | { |
285 | if (session->internals.valid_connection == VALID_FALSE) | 249 | if (session->internals.valid_connection == VALID_FALSE) |
286 | return GNUTLS_E_INVALID_SESSION; | 250 | return GNUTLS_E_INVALID_SESSION; |
@@ -292,7 +256,7 @@ session_is_valid (gnutls_session_t session) | |||
292 | * version must have 2 bytes at least. | 256 | * version must have 2 bytes at least. |
293 | */ | 257 | */ |
294 | inline static void | 258 | inline static void |
295 | copy_record_version (gnutls_session_t session, | 259 | copy_record_version (mhd_gtls_session_t session, |
296 | gnutls_handshake_description_t htype, opaque version[2]) | 260 | gnutls_handshake_description_t htype, opaque version[2]) |
297 | { | 261 | { |
298 | gnutls_protocol_t lver; | 262 | gnutls_protocol_t lver; |
@@ -300,10 +264,10 @@ copy_record_version (gnutls_session_t session, | |||
300 | if (htype != GNUTLS_HANDSHAKE_CLIENT_HELLO | 264 | if (htype != GNUTLS_HANDSHAKE_CLIENT_HELLO |
301 | || session->internals.default_record_version[0] == 0) | 265 | || session->internals.default_record_version[0] == 0) |
302 | { | 266 | { |
303 | lver = gnutls_protocol_get_version (session); | 267 | lver = MHD_gnutls_protocol_get_version (session); |
304 | 268 | ||
305 | version[0] = _gnutls_version_get_major (lver); | 269 | version[0] = mhd_gtls_version_get_major (lver); |
306 | version[1] = _gnutls_version_get_minor (lver); | 270 | version[1] = mhd_gtls_version_get_minor (lver); |
307 | } | 271 | } |
308 | else | 272 | else |
309 | { | 273 | { |
@@ -313,7 +277,7 @@ copy_record_version (gnutls_session_t session, | |||
313 | } | 277 | } |
314 | 278 | ||
315 | /* This function behaves exactly like write(). The only difference is | 279 | /* This function behaves exactly like write(). The only difference is |
316 | * that it accepts, the gnutls_session_t and the content_type_t of data to | 280 | * that it accepts, the mhd_gtls_session_t and the content_type_t of data to |
317 | * send (if called by the user the Content is specific) | 281 | * send (if called by the user the Content is specific) |
318 | * It is intended to transfer data, under the current session. | 282 | * It is intended to transfer data, under the current session. |
319 | * | 283 | * |
@@ -327,7 +291,7 @@ copy_record_version (gnutls_session_t session, | |||
327 | * | 291 | * |
328 | */ | 292 | */ |
329 | ssize_t | 293 | ssize_t |
330 | _gnutls_send_int (gnutls_session_t session, | 294 | mhd_gtls_send_int (mhd_gtls_session_t session, |
331 | content_type_t type, | 295 | content_type_t type, |
332 | gnutls_handshake_description_t htype, | 296 | gnutls_handshake_description_t htype, |
333 | const void *_data, size_t sizeofdata) | 297 | const void *_data, size_t sizeofdata) |
@@ -366,7 +330,7 @@ _gnutls_send_int (gnutls_session_t session, | |||
366 | 330 | ||
367 | _gnutls_record_log | 331 | _gnutls_record_log |
368 | ("REC[%x]: Sending Packet[%d] %s(%d) with length: %d\n", session, | 332 | ("REC[%x]: Sending Packet[%d] %s(%d) with length: %d\n", session, |
369 | (int) _gnutls_uint64touint32 (&session->connection_state. | 333 | (int) mhd_gtls_uint64touint32 (&session->connection_state. |
370 | write_sequence_number), | 334 | write_sequence_number), |
371 | _gnutls_packet2str (type), type, sizeofdata); | 335 | _gnutls_packet2str (type), type, sizeofdata); |
372 | 336 | ||
@@ -380,7 +344,7 @@ _gnutls_send_int (gnutls_session_t session, | |||
380 | */ | 344 | */ |
381 | if (session->internals.record_send_buffer.length > 0) | 345 | if (session->internals.record_send_buffer.length > 0) |
382 | { | 346 | { |
383 | ret = _gnutls_io_write_flush (session); | 347 | ret = mhd_gtls_io_write_flush (session); |
384 | if (ret > 0) | 348 | if (ret > 0) |
385 | cipher_size = ret; | 349 | cipher_size = ret; |
386 | else | 350 | else |
@@ -403,7 +367,7 @@ _gnutls_send_int (gnutls_session_t session, | |||
403 | } | 367 | } |
404 | 368 | ||
405 | cipher_size = | 369 | cipher_size = |
406 | _gnutls_encrypt (session, headers, RECORD_HEADER_SIZE, data, | 370 | mhd_gtls_encrypt (session, headers, RECORD_HEADER_SIZE, data, |
407 | data2send_size, cipher, cipher_size, type, | 371 | data2send_size, cipher, cipher_size, type, |
408 | (session->internals.priorities.no_padding == | 372 | (session->internals.priorities.no_padding == |
409 | 0) ? 1 : 0); | 373 | 0) ? 1 : 0); |
@@ -421,7 +385,7 @@ _gnutls_send_int (gnutls_session_t session, | |||
421 | 385 | ||
422 | /* increase sequence number | 386 | /* increase sequence number |
423 | */ | 387 | */ |
424 | if (_gnutls_uint64pp | 388 | if (mhd_gtls_uint64pp |
425 | (&session->connection_state.write_sequence_number) != 0) | 389 | (&session->connection_state.write_sequence_number) != 0) |
426 | { | 390 | { |
427 | session_invalidate (session); | 391 | session_invalidate (session); |
@@ -430,13 +394,13 @@ _gnutls_send_int (gnutls_session_t session, | |||
430 | return GNUTLS_E_RECORD_LIMIT_REACHED; | 394 | return GNUTLS_E_RECORD_LIMIT_REACHED; |
431 | } | 395 | } |
432 | 396 | ||
433 | ret = _gnutls_io_write_buffered (session, cipher, cipher_size); | 397 | ret = mhd_gtls_io_write_buffered (session, cipher, cipher_size); |
434 | gnutls_free (cipher); | 398 | gnutls_free (cipher); |
435 | } | 399 | } |
436 | 400 | ||
437 | if (ret != cipher_size) | 401 | if (ret != cipher_size) |
438 | { | 402 | { |
439 | if (ret < 0 && gnutls_error_is_fatal (ret) == 0) | 403 | if (ret < 0 && MHD_gtls_error_is_fatal (ret) == 0) |
440 | { | 404 | { |
441 | /* If we have sent any data then just return | 405 | /* If we have sent any data then just return |
442 | * the error value. Do not invalidate the session. | 406 | * the error value. Do not invalidate the session. |
@@ -460,7 +424,7 @@ _gnutls_send_int (gnutls_session_t session, | |||
460 | 424 | ||
461 | _gnutls_record_log ("REC[%x]: Sent Packet[%d] %s(%d) with length: %d\n", | 425 | _gnutls_record_log ("REC[%x]: Sent Packet[%d] %s(%d) with length: %d\n", |
462 | session, | 426 | session, |
463 | (int) _gnutls_uint64touint32 (&session-> | 427 | (int) mhd_gtls_uint64touint32 (&session-> |
464 | connection_state. | 428 | connection_state. |
465 | write_sequence_number), | 429 | write_sequence_number), |
466 | _gnutls_packet2str (type), type, cipher_size); | 430 | _gnutls_packet2str (type), type, cipher_size); |
@@ -472,7 +436,7 @@ _gnutls_send_int (gnutls_session_t session, | |||
472 | * completed. This sends a Change Cipher Spec packet to the peer. | 436 | * completed. This sends a Change Cipher Spec packet to the peer. |
473 | */ | 437 | */ |
474 | ssize_t | 438 | ssize_t |
475 | _gnutls_send_change_cipher_spec (gnutls_session_t session, int again) | 439 | mhd_gtls_send_change_cipher_spec (mhd_gtls_session_t session, int again) |
476 | { | 440 | { |
477 | static const opaque data[1] = { | 441 | static const opaque data[1] = { |
478 | GNUTLS_TYPE_CHANGE_CIPHER_SPEC | 442 | GNUTLS_TYPE_CHANGE_CIPHER_SPEC |
@@ -481,10 +445,10 @@ _gnutls_send_change_cipher_spec (gnutls_session_t session, int again) | |||
481 | _gnutls_handshake_log ("REC[%x]: Sent ChangeCipherSpec\n", session); | 445 | _gnutls_handshake_log ("REC[%x]: Sent ChangeCipherSpec\n", session); |
482 | 446 | ||
483 | if (again == 0) | 447 | if (again == 0) |
484 | return _gnutls_send_int (session, GNUTLS_CHANGE_CIPHER_SPEC, -1, data, 1); | 448 | return mhd_gtls_send_int (session, GNUTLS_CHANGE_CIPHER_SPEC, -1, data, 1); |
485 | else | 449 | else |
486 | { | 450 | { |
487 | return _gnutls_io_write_flush (session); | 451 | return mhd_gtls_io_write_flush (session); |
488 | } | 452 | } |
489 | } | 453 | } |
490 | 454 | ||
@@ -510,16 +474,16 @@ check_recv_type (content_type_t recv_type) | |||
510 | * then it copies the data. | 474 | * then it copies the data. |
511 | */ | 475 | */ |
512 | static int | 476 | static int |
513 | check_buffers (gnutls_session_t session, | 477 | check_buffers (mhd_gtls_session_t session, |
514 | content_type_t type, opaque * data, int sizeofdata) | 478 | content_type_t type, opaque * data, int sizeofdata) |
515 | { | 479 | { |
516 | if ((type == GNUTLS_APPLICATION_DATA || type == GNUTLS_HANDSHAKE || type | 480 | if ((type == GNUTLS_APPLICATION_DATA || type == GNUTLS_HANDSHAKE || type |
517 | == GNUTLS_INNER_APPLICATION) && _gnutls_record_buffer_get_size (type, | 481 | == GNUTLS_INNER_APPLICATION) && mhd_gnutls_record_buffer_get_size (type, |
518 | session) | 482 | session) |
519 | > 0) | 483 | > 0) |
520 | { | 484 | { |
521 | int ret, ret2; | 485 | int ret, ret2; |
522 | ret = _gnutls_record_buffer_get (type, session, data, sizeofdata); | 486 | ret = mhd_gtls_record_buffer_get (type, session, data, sizeofdata); |
523 | if (ret < 0) | 487 | if (ret < 0) |
524 | { | 488 | { |
525 | gnutls_assert (); | 489 | gnutls_assert (); |
@@ -527,9 +491,9 @@ check_buffers (gnutls_session_t session, | |||
527 | } | 491 | } |
528 | 492 | ||
529 | /* if the buffer just got empty */ | 493 | /* if the buffer just got empty */ |
530 | if (_gnutls_record_buffer_get_size (type, session) == 0) | 494 | if (mhd_gnutls_record_buffer_get_size (type, session) == 0) |
531 | { | 495 | { |
532 | if ((ret2 = _gnutls_io_clear_peeked_data (session)) < 0) | 496 | if ((ret2 = mhd_gtls_io_clear_peeked_data (session)) < 0) |
533 | { | 497 | { |
534 | gnutls_assert (); | 498 | gnutls_assert (); |
535 | return ret2; | 499 | return ret2; |
@@ -546,7 +510,7 @@ check_buffers (gnutls_session_t session, | |||
546 | * content type. | 510 | * content type. |
547 | */ | 511 | */ |
548 | static int | 512 | static int |
549 | record_check_headers (gnutls_session_t session, | 513 | record_check_headers (mhd_gtls_session_t session, |
550 | uint8_t headers[RECORD_HEADER_SIZE], | 514 | uint8_t headers[RECORD_HEADER_SIZE], |
551 | content_type_t type, | 515 | content_type_t type, |
552 | gnutls_handshake_description_t htype, | 516 | gnutls_handshake_description_t htype, |
@@ -594,7 +558,7 @@ record_check_headers (gnutls_session_t session, | |||
594 | 558 | ||
595 | /* No DECR_LEN, since headers has enough size. | 559 | /* No DECR_LEN, since headers has enough size. |
596 | */ | 560 | */ |
597 | *length = _gnutls_read_uint16 (&headers[3]); | 561 | *length = mhd_gtls_read_uint16 (&headers[3]); |
598 | } | 562 | } |
599 | 563 | ||
600 | return 0; | 564 | return 0; |
@@ -604,7 +568,7 @@ record_check_headers (gnutls_session_t session, | |||
604 | * negotiated in the handshake. | 568 | * negotiated in the handshake. |
605 | */ | 569 | */ |
606 | inline static int | 570 | inline static int |
607 | record_check_version (gnutls_session_t session, | 571 | record_check_version (mhd_gtls_session_t session, |
608 | gnutls_handshake_description_t htype, opaque version[2]) | 572 | gnutls_handshake_description_t htype, opaque version[2]) |
609 | { | 573 | { |
610 | if (htype == GNUTLS_HANDSHAKE_CLIENT_HELLO) | 574 | if (htype == GNUTLS_HANDSHAKE_CLIENT_HELLO) |
@@ -621,8 +585,8 @@ record_check_version (gnutls_session_t session, | |||
621 | } | 585 | } |
622 | } | 586 | } |
623 | else if (htype != GNUTLS_HANDSHAKE_SERVER_HELLO | 587 | else if (htype != GNUTLS_HANDSHAKE_SERVER_HELLO |
624 | && gnutls_protocol_get_version (session) | 588 | && MHD_gnutls_protocol_get_version (session) |
625 | != _gnutls_version_get (version[0], version[1])) | 589 | != mhd_gtls_version_get (version[0], version[1])) |
626 | { | 590 | { |
627 | /* Reject record packets that have a different version than the | 591 | /* Reject record packets that have a different version than the |
628 | * one negotiated. Note that this version is not protected by any | 592 | * one negotiated. Note that this version is not protected by any |
@@ -642,7 +606,7 @@ record_check_version (gnutls_session_t session, | |||
642 | * the one we actually expect. | 606 | * the one we actually expect. |
643 | */ | 607 | */ |
644 | static int | 608 | static int |
645 | record_check_type (gnutls_session_t session, | 609 | record_check_type (mhd_gtls_session_t session, |
646 | content_type_t recv_type, | 610 | content_type_t recv_type, |
647 | content_type_t type, | 611 | content_type_t type, |
648 | gnutls_handshake_description_t htype, | 612 | gnutls_handshake_description_t htype, |
@@ -655,7 +619,7 @@ record_check_type (gnutls_session_t session, | |||
655 | == GNUTLS_HANDSHAKE | 619 | == GNUTLS_HANDSHAKE |
656 | || type == GNUTLS_INNER_APPLICATION)) | 620 | || type == GNUTLS_INNER_APPLICATION)) |
657 | { | 621 | { |
658 | _gnutls_record_buffer_put (type, session, (void *) data, data_size); | 622 | mhd_gnutls_record_buffer_put (type, session, (void *) data, data_size); |
659 | } | 623 | } |
660 | else | 624 | else |
661 | { | 625 | { |
@@ -665,7 +629,7 @@ record_check_type (gnutls_session_t session, | |||
665 | 629 | ||
666 | _gnutls_record_log | 630 | _gnutls_record_log |
667 | ("REC[%x]: Alert[%d|%d] - %s - was received\n", session, | 631 | ("REC[%x]: Alert[%d|%d] - %s - was received\n", session, |
668 | data[0], data[1], gnutls_alert_get_name ((int) data[1])); | 632 | data[0], data[1], MHD_gnutls_alert_get_name ((int) data[1])); |
669 | 633 | ||
670 | session->internals.last_alert = data[1]; | 634 | session->internals.last_alert = data[1]; |
671 | session->internals.last_alert_level = data[0]; | 635 | session->internals.last_alert_level = data[0]; |
@@ -710,7 +674,7 @@ record_check_type (gnutls_session_t session, | |||
710 | case GNUTLS_APPLICATION_DATA: | 674 | case GNUTLS_APPLICATION_DATA: |
711 | /* even if data is unexpected put it into the buffer */ | 675 | /* even if data is unexpected put it into the buffer */ |
712 | if ((ret = | 676 | if ((ret = |
713 | _gnutls_record_buffer_put (recv_type, session, (void *) data, | 677 | mhd_gnutls_record_buffer_put (recv_type, session, (void *) data, |
714 | data_size)) < 0) | 678 | data_size)) < 0) |
715 | { | 679 | { |
716 | gnutls_assert (); | 680 | gnutls_assert (); |
@@ -747,13 +711,13 @@ record_check_type (gnutls_session_t session, | |||
747 | */ | 711 | */ |
748 | 712 | ||
749 | /* So we accept it */ | 713 | /* So we accept it */ |
750 | return _gnutls_recv_hello_request (session, data, data_size); | 714 | return mhd_gtls_recv_hello_request (session, data, data_size); |
751 | 715 | ||
752 | break; | 716 | break; |
753 | case GNUTLS_INNER_APPLICATION: | 717 | case GNUTLS_INNER_APPLICATION: |
754 | /* even if data is unexpected put it into the buffer */ | 718 | /* even if data is unexpected put it into the buffer */ |
755 | if ((ret = | 719 | if ((ret = |
756 | _gnutls_record_buffer_put (recv_type, session, (void *) data, | 720 | mhd_gnutls_record_buffer_put (recv_type, session, (void *) data, |
757 | data_size)) < 0) | 721 | data_size)) < 0) |
758 | { | 722 | { |
759 | gnutls_assert (); | 723 | gnutls_assert (); |
@@ -782,7 +746,7 @@ record_check_type (gnutls_session_t session, | |||
782 | * also initialize it. | 746 | * also initialize it. |
783 | */ | 747 | */ |
784 | inline static int | 748 | inline static int |
785 | get_temp_recv_buffer (gnutls_session_t session, gnutls_datum_t * tmp) | 749 | get_temp_recv_buffer (mhd_gtls_session_t session, gnutls_datum_t * tmp) |
786 | { | 750 | { |
787 | size_t max_record_size; | 751 | size_t max_record_size; |
788 | 752 | ||
@@ -824,14 +788,14 @@ get_temp_recv_buffer (gnutls_session_t session, gnutls_datum_t * tmp) | |||
824 | #define MAX_EMPTY_PACKETS_SEQUENCE 4 | 788 | #define MAX_EMPTY_PACKETS_SEQUENCE 4 |
825 | 789 | ||
826 | /* This function behaves exactly like read(). The only difference is | 790 | /* This function behaves exactly like read(). The only difference is |
827 | * that it accepts the gnutls_session_t and the content_type_t of data to | 791 | * that it accepts the mhd_gtls_session_t and the content_type_t of data to |
828 | * receive (if called by the user the Content is Userdata only) | 792 | * receive (if called by the user the Content is Userdata only) |
829 | * It is intended to receive data, under the current session. | 793 | * It is intended to receive data, under the current session. |
830 | * | 794 | * |
831 | * The gnutls_handshake_description_t was introduced to support SSL V2.0 client hellos. | 795 | * The gnutls_handshake_description_t was introduced to support SSL V2.0 client hellos. |
832 | */ | 796 | */ |
833 | ssize_t | 797 | ssize_t |
834 | _gnutls_recv_int (gnutls_session_t session, | 798 | mhd_gtls_recv_int (mhd_gtls_session_t session, |
835 | content_type_t type, | 799 | content_type_t type, |
836 | gnutls_handshake_description_t htype, | 800 | gnutls_handshake_description_t htype, |
837 | opaque * data, size_t sizeofdata) | 801 | opaque * data, size_t sizeofdata) |
@@ -885,10 +849,10 @@ begin: | |||
885 | */ | 849 | */ |
886 | header_size = RECORD_HEADER_SIZE; | 850 | header_size = RECORD_HEADER_SIZE; |
887 | 851 | ||
888 | if ((ret = _gnutls_io_read_buffered (session, &headers, header_size, -1)) | 852 | if ((ret = mhd_gtls_io_read_buffered (session, &headers, header_size, -1)) |
889 | != header_size) | 853 | != header_size) |
890 | { | 854 | { |
891 | if (ret < 0 && gnutls_error_is_fatal (ret) == 0) | 855 | if (ret < 0 && MHD_gtls_error_is_fatal (ret) == 0) |
892 | return ret; | 856 | return ret; |
893 | 857 | ||
894 | session_invalidate (session); | 858 | session_invalidate (session); |
@@ -930,12 +894,12 @@ begin: | |||
930 | 894 | ||
931 | _gnutls_record_log | 895 | _gnutls_record_log |
932 | ("REC[%x]: Expected Packet[%d] %s(%d) with length: %d\n", session, | 896 | ("REC[%x]: Expected Packet[%d] %s(%d) with length: %d\n", session, |
933 | (int) _gnutls_uint64touint32 (&session->connection_state. | 897 | (int) mhd_gtls_uint64touint32 (&session->connection_state. |
934 | read_sequence_number), | 898 | read_sequence_number), |
935 | _gnutls_packet2str (type), type, sizeofdata); | 899 | _gnutls_packet2str (type), type, sizeofdata); |
936 | _gnutls_record_log | 900 | _gnutls_record_log |
937 | ("REC[%x]: Received Packet[%d] %s(%d) with length: %d\n", session, | 901 | ("REC[%x]: Received Packet[%d] %s(%d) with length: %d\n", session, |
938 | (int) _gnutls_uint64touint32 (&session->connection_state. | 902 | (int) mhd_gtls_uint64touint32 (&session->connection_state. |
939 | read_sequence_number), | 903 | read_sequence_number), |
940 | _gnutls_packet2str (recv_type), recv_type, length); | 904 | _gnutls_packet2str (recv_type), recv_type, length); |
941 | 905 | ||
@@ -953,11 +917,11 @@ begin: | |||
953 | 917 | ||
954 | /* check if we have that data into buffer. | 918 | /* check if we have that data into buffer. |
955 | */ | 919 | */ |
956 | if ((ret = _gnutls_io_read_buffered (session, &recv_data, | 920 | if ((ret = mhd_gtls_io_read_buffered (session, &recv_data, |
957 | header_size + length, recv_type)) | 921 | header_size + length, recv_type)) |
958 | != header_size + length) | 922 | != header_size + length) |
959 | { | 923 | { |
960 | if (ret < 0 && gnutls_error_is_fatal (ret) == 0) | 924 | if (ret < 0 && MHD_gtls_error_is_fatal (ret) == 0) |
961 | return ret; | 925 | return ret; |
962 | 926 | ||
963 | session_unresumable (session); | 927 | session_unresumable (session); |
@@ -969,7 +933,7 @@ begin: | |||
969 | /* ok now we are sure that we can read all the data - so | 933 | /* ok now we are sure that we can read all the data - so |
970 | * move on ! | 934 | * move on ! |
971 | */ | 935 | */ |
972 | _gnutls_io_clear_read_buffer (session); | 936 | mhd_gtls_io_clear_read_buffer (session); |
973 | ciphertext = &recv_data[header_size]; | 937 | ciphertext = &recv_data[header_size]; |
974 | 938 | ||
975 | ret = get_temp_recv_buffer (session, &tmp); | 939 | ret = get_temp_recv_buffer (session, &tmp); |
@@ -980,7 +944,7 @@ begin: | |||
980 | } | 944 | } |
981 | 945 | ||
982 | /* decrypt the data we got. */ | 946 | /* decrypt the data we got. */ |
983 | ret = _gnutls_decrypt (session, ciphertext, length, tmp.data, tmp.size, | 947 | ret = mhd_gtls_decrypt (session, ciphertext, length, tmp.data, tmp.size, |
984 | recv_type); | 948 | recv_type); |
985 | if (ret < 0) | 949 | if (ret < 0) |
986 | { | 950 | { |
@@ -1012,13 +976,13 @@ begin: | |||
1012 | 976 | ||
1013 | _gnutls_record_log | 977 | _gnutls_record_log |
1014 | ("REC[%x]: Decrypted Packet[%d] %s(%d) with length: %d\n", session, | 978 | ("REC[%x]: Decrypted Packet[%d] %s(%d) with length: %d\n", session, |
1015 | (int) _gnutls_uint64touint32 (&session->connection_state. | 979 | (int) mhd_gtls_uint64touint32 (&session->connection_state. |
1016 | read_sequence_number), | 980 | read_sequence_number), |
1017 | _gnutls_packet2str (recv_type), recv_type, decrypted_length); | 981 | _gnutls_packet2str (recv_type), recv_type, decrypted_length); |
1018 | 982 | ||
1019 | /* increase sequence number | 983 | /* increase sequence number |
1020 | */ | 984 | */ |
1021 | if (_gnutls_uint64pp (&session->connection_state.read_sequence_number) != 0) | 985 | if (mhd_gtls_uint64pp (&session->connection_state.read_sequence_number) != 0) |
1022 | { | 986 | { |
1023 | session_invalidate (session); | 987 | session_invalidate (session); |
1024 | gnutls_assert (); | 988 | gnutls_assert (); |
@@ -1043,7 +1007,7 @@ begin: | |||
1043 | || type == GNUTLS_INNER_APPLICATION)) | 1007 | || type == GNUTLS_INNER_APPLICATION)) |
1044 | { | 1008 | { |
1045 | 1009 | ||
1046 | ret = _gnutls_record_buffer_get (type, session, data, sizeofdata); | 1010 | ret = mhd_gtls_record_buffer_get (type, session, data, sizeofdata); |
1047 | if (ret < 0) | 1011 | if (ret < 0) |
1048 | { | 1012 | { |
1049 | gnutls_assert (); | 1013 | gnutls_assert (); |
@@ -1052,9 +1016,9 @@ begin: | |||
1052 | 1016 | ||
1053 | /* if the buffer just got empty | 1017 | /* if the buffer just got empty |
1054 | */ | 1018 | */ |
1055 | if (_gnutls_record_buffer_get_size (type, session) == 0) | 1019 | if (mhd_gnutls_record_buffer_get_size (type, session) == 0) |
1056 | { | 1020 | { |
1057 | if ((ret2 = _gnutls_io_clear_peeked_data (session)) < 0) | 1021 | if ((ret2 = mhd_gtls_io_clear_peeked_data (session)) < 0) |
1058 | { | 1022 | { |
1059 | gnutls_assert (); | 1023 | gnutls_assert (); |
1060 | return ret2; | 1024 | return ret2; |
@@ -1086,8 +1050,8 @@ begin: | |||
1086 | } | 1050 | } |
1087 | 1051 | ||
1088 | /** | 1052 | /** |
1089 | * gnutls_record_send - sends to the peer the specified data | 1053 | * MHD_gnutls_record_send - sends to the peer the specified data |
1090 | * @session: is a #gnutls_session_t structure. | 1054 | * @session: is a #mhd_gtls_session_t structure. |
1091 | * @data: contains the data to send | 1055 | * @data: contains the data to send |
1092 | * @sizeofdata: is the length of the data | 1056 | * @sizeofdata: is the length of the data |
1093 | * | 1057 | * |
@@ -1098,7 +1062,7 @@ begin: | |||
1098 | * Note that if the send buffer is full, send() will block this | 1062 | * Note that if the send buffer is full, send() will block this |
1099 | * function. See the send() documentation for full information. You | 1063 | * function. See the send() documentation for full information. You |
1100 | * can replace the default push function by using | 1064 | * can replace the default push function by using |
1101 | * gnutls_transport_set_ptr2() with a call to send() with a | 1065 | * MHD_gnutls_transport_set_ptr2() with a call to send() with a |
1102 | * MSG_DONTWAIT flag if blocking is a problem. | 1066 | * MSG_DONTWAIT flag if blocking is a problem. |
1103 | * | 1067 | * |
1104 | * If the EINTR is returned by the internal push function (the | 1068 | * If the EINTR is returned by the internal push function (the |
@@ -1106,7 +1070,7 @@ begin: | |||
1106 | * %GNUTLS_E_INTERRUPTED or %GNUTLS_E_AGAIN is returned, you must | 1070 | * %GNUTLS_E_INTERRUPTED or %GNUTLS_E_AGAIN is returned, you must |
1107 | * call this function again, with the same parameters; alternatively | 1071 | * call this function again, with the same parameters; alternatively |
1108 | * you could provide a %NULL pointer for data, and 0 for | 1072 | * you could provide a %NULL pointer for data, and 0 for |
1109 | * size. cf. gnutls_record_get_direction(). | 1073 | * size. cf. MHD_gnutls_record_get_direction(). |
1110 | * | 1074 | * |
1111 | * Returns: the number of bytes sent, or a negative error code. The | 1075 | * Returns: the number of bytes sent, or a negative error code. The |
1112 | * number of bytes sent might be less than @sizeofdata. The maximum | 1076 | * number of bytes sent might be less than @sizeofdata. The maximum |
@@ -1114,16 +1078,16 @@ begin: | |||
1114 | * the negotiated maximum record size. | 1078 | * the negotiated maximum record size. |
1115 | **/ | 1079 | **/ |
1116 | ssize_t | 1080 | ssize_t |
1117 | gnutls_record_send (gnutls_session_t session, | 1081 | MHD_gnutls_record_send (mhd_gtls_session_t session, |
1118 | const void *data, size_t sizeofdata) | 1082 | const void *data, size_t sizeofdata) |
1119 | { | 1083 | { |
1120 | return _gnutls_send_int (session, GNUTLS_APPLICATION_DATA, -1, data, | 1084 | return mhd_gtls_send_int (session, GNUTLS_APPLICATION_DATA, -1, data, |
1121 | sizeofdata); | 1085 | sizeofdata); |
1122 | } | 1086 | } |
1123 | 1087 | ||
1124 | /** | 1088 | /** |
1125 | * gnutls_record_recv - reads data from the TLS record protocol | 1089 | * MHD_gnutls_record_recv - reads data from the TLS record protocol |
1126 | * @session: is a #gnutls_session_t structure. | 1090 | * @session: is a #mhd_gtls_session_t structure. |
1127 | * @data: the buffer that the data will be read into | 1091 | * @data: the buffer that the data will be read into |
1128 | * @sizeofdata: the number of requested bytes | 1092 | * @sizeofdata: the number of requested bytes |
1129 | * | 1093 | * |
@@ -1141,7 +1105,7 @@ gnutls_record_send (gnutls_session_t session, | |||
1141 | * is recv()) then %GNUTLS_E_INTERRUPTED will be returned. If | 1105 | * is recv()) then %GNUTLS_E_INTERRUPTED will be returned. If |
1142 | * %GNUTLS_E_INTERRUPTED or %GNUTLS_E_AGAIN is returned, you must | 1106 | * %GNUTLS_E_INTERRUPTED or %GNUTLS_E_AGAIN is returned, you must |
1143 | * call this function again to get the data. See also | 1107 | * call this function again to get the data. See also |
1144 | * gnutls_record_get_direction(). | 1108 | * MHD_gnutls_record_get_direction(). |
1145 | * | 1109 | * |
1146 | * A server may also receive %GNUTLS_E_REHANDSHAKE when a client has | 1110 | * A server may also receive %GNUTLS_E_REHANDSHAKE when a client has |
1147 | * initiated a handshake. In that case the server can only initiate a | 1111 | * initiated a handshake. In that case the server can only initiate a |
@@ -1152,22 +1116,22 @@ gnutls_record_send (gnutls_session_t session, | |||
1152 | * received might be less than @sizeofdata. | 1116 | * received might be less than @sizeofdata. |
1153 | **/ | 1117 | **/ |
1154 | ssize_t | 1118 | ssize_t |
1155 | gnutls_record_recv (gnutls_session_t session, void *data, size_t sizeofdata) | 1119 | MHD_gnutls_record_recv (mhd_gtls_session_t session, void *data, size_t sizeofdata) |
1156 | { | 1120 | { |
1157 | return _gnutls_recv_int (session, GNUTLS_APPLICATION_DATA, -1, data, | 1121 | return mhd_gtls_recv_int (session, GNUTLS_APPLICATION_DATA, -1, data, |
1158 | sizeofdata); | 1122 | sizeofdata); |
1159 | } | 1123 | } |
1160 | 1124 | ||
1161 | /** | 1125 | /** |
1162 | * gnutls_record_get_max_size - returns the maximum record size | 1126 | * MHD_gnutls_record_get_max_size - returns the maximum record size |
1163 | * @session: is a #gnutls_session_t structure. | 1127 | * @session: is a #mhd_gtls_session_t structure. |
1164 | * | 1128 | * |
1165 | * This function returns the maximum record packet size in this | 1129 | * This function returns the maximum record packet size in this |
1166 | * connection. The maximum record size is negotiated by the client | 1130 | * connection. The maximum record size is negotiated by the client |
1167 | * after the first handshake message. | 1131 | * after the first handshake message. |
1168 | **/ | 1132 | **/ |
1169 | size_t | 1133 | size_t |
1170 | gnutls_record_get_max_size (gnutls_session_t session) | 1134 | MHD_gnutls_record_get_max_size (mhd_gtls_session_t session) |
1171 | { | 1135 | { |
1172 | /* Recv will hold the negotiated max record size | 1136 | /* Recv will hold the negotiated max record size |
1173 | * always. | 1137 | * always. |
@@ -1176,8 +1140,8 @@ gnutls_record_get_max_size (gnutls_session_t session) | |||
1176 | } | 1140 | } |
1177 | 1141 | ||
1178 | /** | 1142 | /** |
1179 | * gnutls_record_set_max_size - sets the maximum record size | 1143 | * MHD_gnutls_record_set_max_size - sets the maximum record size |
1180 | * @session: is a #gnutls_session_t structure. | 1144 | * @session: is a #mhd_gtls_session_t structure. |
1181 | * @size: is the new size | 1145 | * @size: is the new size |
1182 | * | 1146 | * |
1183 | * This function sets the maximum record packet size in this | 1147 | * This function sets the maximum record packet size in this |
@@ -1193,14 +1157,14 @@ gnutls_record_get_max_size (gnutls_session_t session) | |||
1193 | * all TLS implementations use or even understand this extension. | 1157 | * all TLS implementations use or even understand this extension. |
1194 | **/ | 1158 | **/ |
1195 | ssize_t | 1159 | ssize_t |
1196 | gnutls_record_set_max_size (gnutls_session_t session, size_t size) | 1160 | MHD_gnutls_record_set_max_size (mhd_gtls_session_t session, size_t size) |
1197 | { | 1161 | { |
1198 | ssize_t new_size; | 1162 | ssize_t new_size; |
1199 | 1163 | ||
1200 | if (session->security_parameters.entity == GNUTLS_SERVER) | 1164 | if (session->security_parameters.entity == GNUTLS_SERVER) |
1201 | return GNUTLS_E_INVALID_REQUEST; | 1165 | return GNUTLS_E_INVALID_REQUEST; |
1202 | 1166 | ||
1203 | new_size = _gnutls_mre_record2num (size); | 1167 | new_size = mhd_gtls_mre_record2num (size); |
1204 | 1168 | ||
1205 | if (new_size < 0) | 1169 | if (new_size < 0) |
1206 | { | 1170 | { |
diff --git a/src/daemon/https/tls/gnutls_record.h b/src/daemon/https/tls/gnutls_record.h index 5595f32a..74069bfc 100644 --- a/src/daemon/https/tls/gnutls_record.h +++ b/src/daemon/https/tls/gnutls_record.h | |||
@@ -22,11 +22,11 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | ssize_t _gnutls_send_int (gnutls_session_t session, content_type_t type, | 25 | ssize_t mhd_gtls_send_int (mhd_gtls_session_t session, content_type_t type, |
26 | gnutls_handshake_description_t htype, | 26 | gnutls_handshake_description_t htype, |
27 | const void *data, size_t sizeofdata); | 27 | const void *data, size_t sizeofdata); |
28 | ssize_t _gnutls_recv_int (gnutls_session_t session, content_type_t type, | 28 | ssize_t mhd_gtls_recv_int (mhd_gtls_session_t session, content_type_t type, |
29 | gnutls_handshake_description_t, opaque * data, | 29 | gnutls_handshake_description_t, opaque * data, |
30 | size_t sizeofdata); | 30 | size_t sizeofdata); |
31 | ssize_t _gnutls_send_change_cipher_spec (gnutls_session_t session, int again); | 31 | ssize_t mhd_gtls_send_change_cipher_spec (mhd_gtls_session_t session, int again); |
32 | void gnutls_transport_set_lowat (gnutls_session_t session, int num); | 32 | void MHD_gnutls_transport_set_lowat (mhd_gtls_session_t session, int num); |
diff --git a/src/daemon/https/tls/gnutls_rsa_export.c b/src/daemon/https/tls/gnutls_rsa_export.c index 7f4fafe1..c939f06e 100644 --- a/src/daemon/https/tls/gnutls_rsa_export.c +++ b/src/daemon/https/tls/gnutls_rsa_export.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * We only support limited key sizes. | 46 | * We only support limited key sizes. |
47 | */ | 47 | */ |
48 | const mpi_t * | 48 | const mpi_t * |
49 | _gnutls_rsa_params_to_mpi (gnutls_rsa_params_t rsa_params) | 49 | _gnutls_rsa_params_to_mpi (mhd_gtls_rsa_params_t rsa_params) |
50 | { | 50 | { |
51 | if (rsa_params == NULL) | 51 | if (rsa_params == NULL) |
52 | { | 52 | { |
@@ -167,42 +167,15 @@ _gnutls_rsa_generate_params (mpi_t * resarr, int *resarr_len, int bits) | |||
167 | 167 | ||
168 | } | 168 | } |
169 | 169 | ||
170 | |||
171 | /** | ||
172 | * gnutls_rsa_params_import_raw - This function will replace the old RSA parameters | ||
173 | * @rsa_params: Is a structure will hold the parameters | ||
174 | * @m: holds the modulus | ||
175 | * @e: holds the public exponent | ||
176 | * @d: holds the private exponent | ||
177 | * @p: holds the first prime (p) | ||
178 | * @q: holds the second prime (q) | ||
179 | * @u: holds the coefficient | ||
180 | * | ||
181 | * This function will replace the parameters in the given structure. | ||
182 | * The new parameters should be stored in the appropriate gnutls_datum. | ||
183 | * | ||
184 | **/ | ||
185 | int | ||
186 | gnutls_rsa_params_import_raw (gnutls_rsa_params_t rsa_params, | ||
187 | const gnutls_datum_t * m, | ||
188 | const gnutls_datum_t * e, | ||
189 | const gnutls_datum_t * d, | ||
190 | const gnutls_datum_t * p, | ||
191 | const gnutls_datum_t * q, | ||
192 | const gnutls_datum_t * u) | ||
193 | { | ||
194 | return gnutls_x509_privkey_import_rsa_raw (rsa_params, m, e, d, p, q, u); | ||
195 | } | ||
196 | |||
197 | /** | 170 | /** |
198 | * gnutls_rsa_params_init - This function will initialize the temporary RSA parameters | 171 | * MHD_gnutls_rsa_params_init - This function will initialize the temporary RSA parameters |
199 | * @rsa_params: Is a structure that will hold the parameters | 172 | * @rsa_params: Is a structure that will hold the parameters |
200 | * | 173 | * |
201 | * This function will initialize the temporary RSA parameters structure. | 174 | * This function will initialize the temporary RSA parameters structure. |
202 | * | 175 | * |
203 | **/ | 176 | **/ |
204 | int | 177 | int |
205 | gnutls_rsa_params_init (gnutls_rsa_params_t * rsa_params) | 178 | MHD_gnutls_rsa_params_init (mhd_gtls_rsa_params_t * rsa_params) |
206 | { | 179 | { |
207 | int ret; | 180 | int ret; |
208 | 181 | ||
@@ -219,42 +192,27 @@ gnutls_rsa_params_init (gnutls_rsa_params_t * rsa_params) | |||
219 | } | 192 | } |
220 | 193 | ||
221 | /** | 194 | /** |
222 | * gnutls_rsa_params_deinit - This function will deinitialize the RSA parameters | 195 | * MHD_gnutls_rsa_params_deinit - This function will deinitialize the RSA parameters |
223 | * @rsa_params: Is a structure that holds the parameters | 196 | * @rsa_params: Is a structure that holds the parameters |
224 | * | 197 | * |
225 | * This function will deinitialize the RSA parameters structure. | 198 | * This function will deinitialize the RSA parameters structure. |
226 | * | 199 | * |
227 | **/ | 200 | **/ |
228 | void | 201 | void |
229 | gnutls_rsa_params_deinit (gnutls_rsa_params_t rsa_params) | 202 | MHD_gnutls_rsa_params_deinit (mhd_gtls_rsa_params_t rsa_params) |
230 | { | 203 | { |
231 | gnutls_x509_privkey_deinit (rsa_params); | 204 | gnutls_x509_privkey_deinit (rsa_params); |
232 | } | 205 | } |
233 | 206 | ||
234 | /** | 207 | /** |
235 | * gnutls_rsa_params_cpy - This function will copy an RSA parameters structure | 208 | * MHD_gnutls_rsa_params_generate2 - This function will generate temporary RSA parameters |
236 | * @dst: Is the destination structure, which should be initialized. | ||
237 | * @src: Is the source structure | ||
238 | * | ||
239 | * This function will copy the RSA parameters structure from source | ||
240 | * to destination. | ||
241 | * | ||
242 | **/ | ||
243 | int | ||
244 | gnutls_rsa_params_cpy (gnutls_rsa_params_t dst, gnutls_rsa_params_t src) | ||
245 | { | ||
246 | return gnutls_x509_privkey_cpy (dst, src); | ||
247 | } | ||
248 | |||
249 | /** | ||
250 | * gnutls_rsa_params_generate2 - This function will generate temporary RSA parameters | ||
251 | * @params: The structure where the parameters will be stored | 209 | * @params: The structure where the parameters will be stored |
252 | * @bits: is the prime's number of bits | 210 | * @bits: is the prime's number of bits |
253 | * | 211 | * |
254 | * This function will generate new temporary RSA parameters for use in | 212 | * This function will generate new temporary RSA parameters for use in |
255 | * RSA-EXPORT ciphersuites. This function is normally slow. | 213 | * RSA-EXPORT ciphersuites. This function is normally slow. |
256 | * | 214 | * |
257 | * Note that if the parameters are to be used in export cipher suites the | 215 | * Note that if the parameters are to be used in export cipher suites the |
258 | * bits value should be 512 or less. | 216 | * bits value should be 512 or less. |
259 | * Also note that the generation of new RSA parameters is only useful | 217 | * Also note that the generation of new RSA parameters is only useful |
260 | * to servers. Clients use the parameters sent by the server, thus it's | 218 | * to servers. Clients use the parameters sent by the server, thus it's |
@@ -262,100 +220,7 @@ gnutls_rsa_params_cpy (gnutls_rsa_params_t dst, gnutls_rsa_params_t src) | |||
262 | * | 220 | * |
263 | **/ | 221 | **/ |
264 | int | 222 | int |
265 | gnutls_rsa_params_generate2 (gnutls_rsa_params_t params, unsigned int bits) | 223 | MHD_gnutls_rsa_params_generate2 (mhd_gtls_rsa_params_t params, unsigned int bits) |
266 | { | 224 | { |
267 | return gnutls_x509_privkey_generate (params, MHD_GNUTLS_PK_RSA, bits, 0); | 225 | return gnutls_x509_privkey_generate (params, MHD_GNUTLS_PK_RSA, bits, 0); |
268 | } | 226 | } |
269 | |||
270 | /** | ||
271 | * gnutls_rsa_params_import_pkcs1 - This function will import RSA params from a pkcs1 structure | ||
272 | * @params: A structure where the parameters will be copied to | ||
273 | * @pkcs1_params: should contain a PKCS1 RSAPublicKey structure PEM or DER encoded | ||
274 | * @format: the format of params. PEM or DER. | ||
275 | * | ||
276 | * This function will extract the RSAPublicKey found in a PKCS1 formatted | ||
277 | * structure. | ||
278 | * | ||
279 | * If the structure is PEM encoded, it should have a header | ||
280 | * of "BEGIN RSA PRIVATE KEY". | ||
281 | * | ||
282 | * In case of failure a negative value will be returned, and | ||
283 | * 0 on success. | ||
284 | * | ||
285 | **/ | ||
286 | int | ||
287 | gnutls_rsa_params_import_pkcs1 (gnutls_rsa_params_t params, | ||
288 | const gnutls_datum_t * pkcs1_params, | ||
289 | gnutls_x509_crt_fmt_t format) | ||
290 | { | ||
291 | return gnutls_x509_privkey_import (params, pkcs1_params, format); | ||
292 | } | ||
293 | |||
294 | |||
295 | /** | ||
296 | * gnutls_rsa_params_export_pkcs1 - This function will export RSA params to a pkcs1 structure | ||
297 | * @params: Holds the RSA parameters | ||
298 | * @format: the format of output params. One of PEM or DER. | ||
299 | * @params_data: will contain a PKCS1 RSAPublicKey structure PEM or DER encoded | ||
300 | * @params_data_size: holds the size of params_data (and will be replaced by the actual size of parameters) | ||
301 | * | ||
302 | * This function will export the given RSA parameters to a PKCS1 | ||
303 | * RSAPublicKey structure. If the buffer provided is not long enough to | ||
304 | * hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. | ||
305 | * | ||
306 | * If the structure is PEM encoded, it will have a header | ||
307 | * of "BEGIN RSA PRIVATE KEY". | ||
308 | * | ||
309 | * In case of failure a negative value will be returned, and | ||
310 | * 0 on success. | ||
311 | * | ||
312 | **/ | ||
313 | int | ||
314 | gnutls_rsa_params_export_pkcs1 (gnutls_rsa_params_t params, | ||
315 | gnutls_x509_crt_fmt_t format, | ||
316 | unsigned char *params_data, | ||
317 | size_t * params_data_size) | ||
318 | { | ||
319 | return gnutls_x509_privkey_export (params, format, | ||
320 | params_data, params_data_size); | ||
321 | } | ||
322 | |||
323 | |||
324 | /** | ||
325 | * gnutls_rsa_params_export_raw - This function will export the RSA parameters | ||
326 | * @params: a structure that holds the rsa parameters | ||
327 | * @m: will hold the modulus | ||
328 | * @e: will hold the public exponent | ||
329 | * @d: will hold the private exponent | ||
330 | * @p: will hold the first prime (p) | ||
331 | * @q: will hold the second prime (q) | ||
332 | * @u: will hold the coefficient | ||
333 | * @bits: if non null will hold the prime's number of bits | ||
334 | * | ||
335 | * This function will export the RSA parameters found in the given | ||
336 | * structure. The new parameters will be allocated using | ||
337 | * gnutls_malloc() and will be stored in the appropriate datum. | ||
338 | * | ||
339 | **/ | ||
340 | int | ||
341 | gnutls_rsa_params_export_raw (gnutls_rsa_params_t params, | ||
342 | gnutls_datum_t * m, gnutls_datum_t * e, | ||
343 | gnutls_datum_t * d, gnutls_datum_t * p, | ||
344 | gnutls_datum_t * q, gnutls_datum_t * u, | ||
345 | unsigned int *bits) | ||
346 | { | ||
347 | int ret; | ||
348 | |||
349 | ret = gnutls_x509_privkey_export_rsa_raw (params, m, e, d, p, q, u); | ||
350 | if (ret < 0) | ||
351 | { | ||
352 | gnutls_assert (); | ||
353 | return ret; | ||
354 | } | ||
355 | |||
356 | if (bits) | ||
357 | *bits = _gnutls_mpi_get_nbits (params->params[3]); | ||
358 | |||
359 | return 0; | ||
360 | |||
361 | } | ||
diff --git a/src/daemon/https/tls/gnutls_rsa_export.h b/src/daemon/https/tls/gnutls_rsa_export.h index b39e5e93..029e38c5 100644 --- a/src/daemon/https/tls/gnutls_rsa_export.h +++ b/src/daemon/https/tls/gnutls_rsa_export.h | |||
@@ -22,6 +22,6 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | const mpi_t *_gnutls_rsa_params_to_mpi (gnutls_rsa_params_t); | 25 | const mpi_t * _gnutls_rsa_params_to_mpi (mhd_gtls_rsa_params_t); |
26 | int _gnutls_peers_cert_less_512 (gnutls_session_t session); | 26 | int _gnutls_peers_cert_less_512 (mhd_gtls_session_t session); |
27 | int _gnutls_rsa_generate_params (mpi_t * resarr, int *resarr_len, int bits); | 27 | int _gnutls_rsa_generate_params (mpi_t * resarr, int *resarr_len, int bits); |
diff --git a/src/daemon/https/tls/gnutls_session.c b/src/daemon/https/tls/gnutls_session.c index fb9b5e80..94c7405b 100644 --- a/src/daemon/https/tls/gnutls_session.c +++ b/src/daemon/https/tls/gnutls_session.c | |||
@@ -27,9 +27,11 @@ | |||
27 | #include "gnutls_session_pack.h" | 27 | #include "gnutls_session_pack.h" |
28 | #include <gnutls_datum.h> | 28 | #include <gnutls_datum.h> |
29 | 29 | ||
30 | /* TODO this file should be removed if session resumption will be abandoned */ | ||
31 | |||
30 | /** | 32 | /** |
31 | * gnutls_session_get_data - Returns all session parameters. | 33 | * gnutls_session_get_data - Returns all session parameters. |
32 | * @session: is a #gnutls_session_t structure. | 34 | * @session: is a #mhd_gtls_session_t structure. |
33 | * @session_data: is a pointer to space to hold the session. | 35 | * @session_data: is a pointer to space to hold the session. |
34 | * @session_data_size: is the session_data's size, or it will be set by the function. | 36 | * @session_data_size: is the session_data's size, or it will be set by the function. |
35 | * | 37 | * |
@@ -40,46 +42,46 @@ | |||
40 | * | 42 | * |
41 | * Resuming sessions is really useful and speedups connections after a succesful one. | 43 | * Resuming sessions is really useful and speedups connections after a succesful one. |
42 | **/ | 44 | **/ |
43 | int | 45 | //int |
44 | gnutls_session_get_data (gnutls_session_t session, | 46 | //gnutls_session_get_data (mhd_gtls_session_t session, |
45 | void *session_data, size_t * session_data_size) | 47 | // void *session_data, size_t * session_data_size) |
46 | { | 48 | //{ |
47 | 49 | // | |
48 | gnutls_datum_t psession; | 50 | // gnutls_datum_t psession; |
49 | int ret; | 51 | // int ret; |
50 | 52 | // | |
51 | if (session->internals.resumable == RESUME_FALSE) | 53 | // if (session->internals.resumable == RESUME_FALSE) |
52 | return GNUTLS_E_INVALID_SESSION; | 54 | // return GNUTLS_E_INVALID_SESSION; |
53 | 55 | // | |
54 | psession.data = session_data; | 56 | // psession.data = session_data; |
55 | 57 | // | |
56 | ret = _gnutls_session_pack (session, &psession); | 58 | // ret = _gnutls_session_pack (session, &psession); |
57 | if (ret < 0) | 59 | // if (ret < 0) |
58 | { | 60 | // { |
59 | gnutls_assert (); | 61 | // gnutls_assert (); |
60 | return ret; | 62 | // return ret; |
61 | } | 63 | // } |
62 | *session_data_size = psession.size; | 64 | // *session_data_size = psession.size; |
63 | 65 | // | |
64 | if (psession.size > *session_data_size) | 66 | // if (psession.size > *session_data_size) |
65 | { | 67 | // { |
66 | ret = GNUTLS_E_SHORT_MEMORY_BUFFER; | 68 | // ret = GNUTLS_E_SHORT_MEMORY_BUFFER; |
67 | goto error; | 69 | // goto error; |
68 | } | 70 | // } |
69 | 71 | // | |
70 | if (session_data != NULL) | 72 | // if (session_data != NULL) |
71 | memcpy (session_data, psession.data, psession.size); | 73 | // memcpy (session_data, psession.data, psession.size); |
72 | 74 | // | |
73 | ret = 0; | 75 | // ret = 0; |
74 | 76 | // | |
75 | error: | 77 | //error: |
76 | _gnutls_free_datum (&psession); | 78 | // _gnutls_free_datum (&psession); |
77 | return ret; | 79 | // return ret; |
78 | } | 80 | //} |
79 | 81 | ||
80 | /** | 82 | /** |
81 | * gnutls_session_get_data2 - Returns all session parameters. | 83 | * gnutls_session_get_data2 - Returns all session parameters. |
82 | * @session: is a #gnutls_session_t structure. | 84 | * @session: is a #mhd_gtls_session_t structure. |
83 | * @session_data: is a pointer to a datum that will hold the session. | 85 | * @session_data: is a pointer to a datum that will hold the session. |
84 | * | 86 | * |
85 | * Returns all session parameters, in order to support resuming. | 87 | * Returns all session parameters, in order to support resuming. |
@@ -90,34 +92,34 @@ error: | |||
90 | * | 92 | * |
91 | * Resuming sessions is really useful and speedups connections after a succesful one. | 93 | * Resuming sessions is really useful and speedups connections after a succesful one. |
92 | **/ | 94 | **/ |
93 | int | 95 | //int |
94 | gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum_t * data) | 96 | //gnutls_session_get_data2 (mhd_gtls_session_t session, gnutls_datum_t * data) |
95 | { | 97 | //{ |
96 | 98 | // | |
97 | int ret; | 99 | // int ret; |
98 | 100 | // | |
99 | if (data == NULL) | 101 | // if (data == NULL) |
100 | { | 102 | // { |
101 | return GNUTLS_E_INVALID_REQUEST; | 103 | // return GNUTLS_E_INVALID_REQUEST; |
102 | } | 104 | // } |
103 | 105 | // | |
104 | if (session->internals.resumable == RESUME_FALSE) | 106 | // if (session->internals.resumable == RESUME_FALSE) |
105 | return GNUTLS_E_INVALID_SESSION; | 107 | // return GNUTLS_E_INVALID_SESSION; |
106 | 108 | // | |
107 | ret = _gnutls_session_pack (session, data); | 109 | // ret = _gnutls_session_pack (session, data); |
108 | if (ret < 0) | 110 | // if (ret < 0) |
109 | { | 111 | // { |
110 | gnutls_assert (); | 112 | // gnutls_assert (); |
111 | return ret; | 113 | // return ret; |
112 | } | 114 | // } |
113 | 115 | // | |
114 | return 0; | 116 | // return 0; |
115 | } | 117 | //} |
116 | 118 | ||
117 | 119 | ||
118 | /** | 120 | /** |
119 | * gnutls_session_get_id - Returns session id. | 121 | * MHD_gtls_session_get_id - Returns session id. |
120 | * @session: is a #gnutls_session_t structure. | 122 | * @session: is a #mhd_gtls_session_t structure. |
121 | * @session_id: is a pointer to space to hold the session id. | 123 | * @session_id: is a pointer to space to hold the session id. |
122 | * @session_id_size: is the session id's size, or it will be set by the function. | 124 | * @session_id_size: is the session id's size, or it will be set by the function. |
123 | * | 125 | * |
@@ -132,7 +134,7 @@ gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum_t * data) | |||
132 | * Returns zero on success. | 134 | * Returns zero on success. |
133 | **/ | 135 | **/ |
134 | int | 136 | int |
135 | gnutls_session_get_id (gnutls_session_t session, | 137 | MHD_gtls_session_get_id (mhd_gtls_session_t session, |
136 | void *session_id, size_t * session_id_size) | 138 | void *session_id, size_t * session_id_size) |
137 | { | 139 | { |
138 | size_t given_session_id_size = *session_id_size; | 140 | size_t given_session_id_size = *session_id_size; |
@@ -158,13 +160,13 @@ gnutls_session_get_id (gnutls_session_t session, | |||
158 | 160 | ||
159 | /** | 161 | /** |
160 | * gnutls_session_set_data - Sets all session parameters | 162 | * gnutls_session_set_data - Sets all session parameters |
161 | * @session: is a #gnutls_session_t structure. | 163 | * @session: is a #mhd_gtls_session_t structure. |
162 | * @session_data: is a pointer to space to hold the session. | 164 | * @session_data: is a pointer to space to hold the session. |
163 | * @session_data_size: is the session's size | 165 | * @session_data_size: is the session's size |
164 | * | 166 | * |
165 | * Sets all session parameters, in order to resume a previously established | 167 | * Sets all session parameters, in order to resume a previously established |
166 | * session. The session data given must be the one returned by gnutls_session_get_data(). | 168 | * session. The session data given must be the one returned by gnutls_session_get_data(). |
167 | * This function should be called before gnutls_handshake(). | 169 | * This function should be called before MHD_gnutls_handshake(). |
168 | * | 170 | * |
169 | * Keep in mind that session resuming is advisory. The server may | 171 | * Keep in mind that session resuming is advisory. The server may |
170 | * choose not to resume the session, thus a full handshake will be | 172 | * choose not to resume the session, thus a full handshake will be |
@@ -173,27 +175,27 @@ gnutls_session_get_id (gnutls_session_t session, | |||
173 | * Returns a negative value on error. | 175 | * Returns a negative value on error. |
174 | * | 176 | * |
175 | **/ | 177 | **/ |
176 | int | 178 | //int |
177 | gnutls_session_set_data (gnutls_session_t session, | 179 | //gnutls_session_set_data (mhd_gtls_session_t session, |
178 | const void *session_data, size_t session_data_size) | 180 | // const void *session_data, size_t session_data_size) |
179 | { | 181 | //{ |
180 | int ret; | 182 | // int ret; |
181 | gnutls_datum_t psession; | 183 | // gnutls_datum_t psession; |
182 | 184 | // | |
183 | psession.data = (opaque *) session_data; | 185 | // psession.data = (opaque *) session_data; |
184 | psession.size = session_data_size; | 186 | // psession.size = session_data_size; |
185 | 187 | // | |
186 | if (session_data == NULL || session_data_size == 0) | 188 | // if (session_data == NULL || session_data_size == 0) |
187 | { | 189 | // { |
188 | gnutls_assert (); | 190 | // gnutls_assert (); |
189 | return GNUTLS_E_INVALID_REQUEST; | 191 | // return GNUTLS_E_INVALID_REQUEST; |
190 | } | 192 | // } |
191 | ret = _gnutls_session_unpack (session, &psession); | 193 | // ret = _gnutls_session_unpack (session, &psession); |
192 | if (ret < 0) | 194 | // if (ret < 0) |
193 | { | 195 | // { |
194 | gnutls_assert (); | 196 | // gnutls_assert (); |
195 | return ret; | 197 | // return ret; |
196 | } | 198 | // } |
197 | 199 | // | |
198 | return 0; | 200 | // return 0; |
199 | } | 201 | //} |
diff --git a/src/daemon/https/tls/gnutls_session_pack.c b/src/daemon/https/tls/gnutls_session_pack.c index 3e549c4c..c11f6d77 100644 --- a/src/daemon/https/tls/gnutls_session_pack.c +++ b/src/daemon/https/tls/gnutls_session_pack.c | |||
@@ -43,15 +43,15 @@ | |||
43 | 43 | ||
44 | #define PACK_HEADER_SIZE 1 | 44 | #define PACK_HEADER_SIZE 1 |
45 | #define MAX_SEC_PARAMS 7+MAX_SRP_USERNAME+MAX_SERVER_NAME_EXTENSIONS*(3+MAX_SERVER_NAME_SIZE)+165 | 45 | #define MAX_SEC_PARAMS 7+MAX_SRP_USERNAME+MAX_SERVER_NAME_EXTENSIONS*(3+MAX_SERVER_NAME_SIZE)+165 |
46 | static int pack_certificate_auth_info (gnutls_session_t, | 46 | static int pack_certificate_auth_info (mhd_gtls_session_t, |
47 | gnutls_datum_t * packed_session); | 47 | gnutls_datum_t * packed_session); |
48 | static int unpack_certificate_auth_info (gnutls_session_t, | 48 | static int unpack_certificate_auth_info (mhd_gtls_session_t, |
49 | const gnutls_datum_t * | 49 | const gnutls_datum_t * |
50 | packed_session); | 50 | packed_session); |
51 | 51 | ||
52 | static int unpack_security_parameters (gnutls_session_t session, | 52 | static int unpack_security_parameters (mhd_gtls_session_t session, |
53 | const gnutls_datum_t * packed_session); | 53 | const gnutls_datum_t * packed_session); |
54 | static int pack_security_parameters (gnutls_session_t session, | 54 | static int pack_security_parameters (mhd_gtls_session_t session, |
55 | gnutls_datum_t * packed_session); | 55 | gnutls_datum_t * packed_session); |
56 | 56 | ||
57 | /* Packs the ANON session authentication data. */ | 57 | /* Packs the ANON session authentication data. */ |
@@ -69,9 +69,9 @@ static int pack_security_parameters (gnutls_session_t session, | |||
69 | * x bytes the public key | 69 | * x bytes the public key |
70 | */ | 70 | */ |
71 | static int | 71 | static int |
72 | pack_anon_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | 72 | pack_anon_auth_info (mhd_gtls_session_t session, gnutls_datum_t * packed_session) |
73 | { | 73 | { |
74 | anon_auth_info_t info = _gnutls_get_auth_info (session); | 74 | mhd_anon_auth_info_t info = mhd_gtls_get_auth_info (session); |
75 | int pos = 0; | 75 | int pos = 0; |
76 | size_t pack_size; | 76 | size_t pack_size; |
77 | 77 | ||
@@ -95,19 +95,19 @@ pack_anon_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | packed_session->data[0] = MHD_GNUTLS_CRD_ANON; | 97 | packed_session->data[0] = MHD_GNUTLS_CRD_ANON; |
98 | _gnutls_write_uint32 (pack_size, &packed_session->data[PACK_HEADER_SIZE]); | 98 | mhd_gtls_write_uint32 (pack_size, &packed_session->data[PACK_HEADER_SIZE]); |
99 | pos += 4 + PACK_HEADER_SIZE; | 99 | pos += 4 + PACK_HEADER_SIZE; |
100 | 100 | ||
101 | if (pack_size > 0) | 101 | if (pack_size > 0) |
102 | { | 102 | { |
103 | _gnutls_write_uint16 (info->dh.secret_bits, &packed_session->data[pos]); | 103 | mhd_gtls_write_uint16 (info->dh.secret_bits, &packed_session->data[pos]); |
104 | pos += 2; | 104 | pos += 2; |
105 | 105 | ||
106 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.prime); | 106 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.prime); |
107 | pos += 4 + info->dh.prime.size; | 107 | pos += 4 + info->dh.prime.size; |
108 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.generator); | 108 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.generator); |
109 | pos += 4 + info->dh.generator.size; | 109 | pos += 4 + info->dh.generator.size; |
110 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.public_key); | 110 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.public_key); |
111 | pos += 4 + info->dh.public_key.size; | 111 | pos += 4 + info->dh.public_key.size; |
112 | 112 | ||
113 | } | 113 | } |
@@ -127,12 +127,12 @@ pack_anon_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | |||
127 | * x bytes the public key | 127 | * x bytes the public key |
128 | */ | 128 | */ |
129 | static int | 129 | static int |
130 | unpack_anon_auth_info (gnutls_session_t session, | 130 | unpack_anon_auth_info (mhd_gtls_session_t session, |
131 | const gnutls_datum_t * packed_session) | 131 | const gnutls_datum_t * packed_session) |
132 | { | 132 | { |
133 | size_t pack_size; | 133 | size_t pack_size; |
134 | int pos = 0, size, ret; | 134 | int pos = 0, size, ret; |
135 | anon_auth_info_t info; | 135 | mhd_anon_auth_info_t info; |
136 | 136 | ||
137 | if (packed_session->data[0] != MHD_GNUTLS_CRD_ANON) | 137 | if (packed_session->data[0] != MHD_GNUTLS_CRD_ANON) |
138 | { | 138 | { |
@@ -140,7 +140,7 @@ unpack_anon_auth_info (gnutls_session_t session, | |||
140 | return GNUTLS_E_INVALID_REQUEST; | 140 | return GNUTLS_E_INVALID_REQUEST; |
141 | } | 141 | } |
142 | 142 | ||
143 | pack_size = _gnutls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); | 143 | pack_size = mhd_gtls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); |
144 | pos += PACK_HEADER_SIZE + 4; | 144 | pos += PACK_HEADER_SIZE + 4; |
145 | 145 | ||
146 | 146 | ||
@@ -157,7 +157,7 @@ unpack_anon_auth_info (gnutls_session_t session, | |||
157 | /* client and serer have the same auth_info here | 157 | /* client and serer have the same auth_info here |
158 | */ | 158 | */ |
159 | ret = | 159 | ret = |
160 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_ANON, | 160 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_ANON, |
161 | sizeof (anon_auth_info_st), 1); | 161 | sizeof (anon_auth_info_st), 1); |
162 | if (ret < 0) | 162 | if (ret < 0) |
163 | { | 163 | { |
@@ -165,17 +165,17 @@ unpack_anon_auth_info (gnutls_session_t session, | |||
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
167 | 167 | ||
168 | info = _gnutls_get_auth_info (session); | 168 | info = mhd_gtls_get_auth_info (session); |
169 | if (info == NULL) | 169 | if (info == NULL) |
170 | { | 170 | { |
171 | gnutls_assert (); | 171 | gnutls_assert (); |
172 | return GNUTLS_E_INTERNAL_ERROR; | 172 | return GNUTLS_E_INTERNAL_ERROR; |
173 | } | 173 | } |
174 | 174 | ||
175 | info->dh.secret_bits = _gnutls_read_uint16 (&packed_session->data[pos]); | 175 | info->dh.secret_bits = mhd_gtls_read_uint16 (&packed_session->data[pos]); |
176 | pos += 2; | 176 | pos += 2; |
177 | 177 | ||
178 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 178 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
179 | pos += 4; | 179 | pos += 4; |
180 | ret = _gnutls_set_datum (&info->dh.prime, &packed_session->data[pos], size); | 180 | ret = _gnutls_set_datum (&info->dh.prime, &packed_session->data[pos], size); |
181 | if (ret < 0) | 181 | if (ret < 0) |
@@ -185,7 +185,7 @@ unpack_anon_auth_info (gnutls_session_t session, | |||
185 | } | 185 | } |
186 | pos += size; | 186 | pos += size; |
187 | 187 | ||
188 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 188 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
189 | pos += 4; | 189 | pos += 4; |
190 | ret = | 190 | ret = |
191 | _gnutls_set_datum (&info->dh.generator, &packed_session->data[pos], size); | 191 | _gnutls_set_datum (&info->dh.generator, &packed_session->data[pos], size); |
@@ -196,7 +196,7 @@ unpack_anon_auth_info (gnutls_session_t session, | |||
196 | } | 196 | } |
197 | pos += size; | 197 | pos += size; |
198 | 198 | ||
199 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 199 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
200 | pos += 4; | 200 | pos += 4; |
201 | ret = | 201 | ret = |
202 | _gnutls_set_datum (&info->dh.public_key, &packed_session->data[pos], | 202 | _gnutls_set_datum (&info->dh.public_key, &packed_session->data[pos], |
@@ -227,7 +227,7 @@ error: | |||
227 | * The data will be in a platform independent format. | 227 | * The data will be in a platform independent format. |
228 | */ | 228 | */ |
229 | int | 229 | int |
230 | _gnutls_session_pack (gnutls_session_t session, | 230 | _gnutls_session_pack (mhd_gtls_session_t session, |
231 | gnutls_datum_t * packed_session) | 231 | gnutls_datum_t * packed_session) |
232 | { | 232 | { |
233 | int ret; | 233 | int ret; |
@@ -239,7 +239,7 @@ _gnutls_session_pack (gnutls_session_t session, | |||
239 | } | 239 | } |
240 | 240 | ||
241 | 241 | ||
242 | switch (gnutls_auth_get_type (session)) | 242 | switch (MHD_gtls_auth_get_type (session)) |
243 | { | 243 | { |
244 | #ifdef ENABLE_SRP | 244 | #ifdef ENABLE_SRP |
245 | case MHD_GNUTLS_CRD_SRP: | 245 | case MHD_GNUTLS_CRD_SRP: |
@@ -284,7 +284,7 @@ _gnutls_session_pack (gnutls_session_t session, | |||
284 | 284 | ||
285 | } | 285 | } |
286 | 286 | ||
287 | /* Auth_info structures copied. Now copy security_parameters_st. | 287 | /* Auth_info structures copied. Now copy mhd_gtls_security_param_st. |
288 | * packed_session must have allocated space for the security parameters. | 288 | * packed_session must have allocated space for the security parameters. |
289 | */ | 289 | */ |
290 | ret = pack_security_parameters (session, packed_session); | 290 | ret = pack_security_parameters (session, packed_session); |
@@ -302,7 +302,7 @@ _gnutls_session_pack (gnutls_session_t session, | |||
302 | /* Load session data from a buffer. | 302 | /* Load session data from a buffer. |
303 | */ | 303 | */ |
304 | int | 304 | int |
305 | _gnutls_session_unpack (gnutls_session_t session, | 305 | _gnutls_session_unpack (mhd_gtls_session_t session, |
306 | const gnutls_datum_t * packed_session) | 306 | const gnutls_datum_t * packed_session) |
307 | { | 307 | { |
308 | int ret; | 308 | int ret; |
@@ -313,9 +313,9 @@ _gnutls_session_unpack (gnutls_session_t session, | |||
313 | return GNUTLS_E_INTERNAL_ERROR; | 313 | return GNUTLS_E_INTERNAL_ERROR; |
314 | } | 314 | } |
315 | 315 | ||
316 | if (_gnutls_get_auth_info (session) != NULL) | 316 | if (mhd_gtls_get_auth_info (session) != NULL) |
317 | { | 317 | { |
318 | _gnutls_free_auth_info (session); | 318 | mhd_gtls_free_auth_info (session); |
319 | } | 319 | } |
320 | 320 | ||
321 | switch (packed_session->data[0]) | 321 | switch (packed_session->data[0]) |
@@ -364,7 +364,7 @@ _gnutls_session_unpack (gnutls_session_t session, | |||
364 | 364 | ||
365 | } | 365 | } |
366 | 366 | ||
367 | /* Auth_info structures copied. Now copy security_parameters_st. | 367 | /* Auth_info structures copied. Now copy mhd_gtls_security_param_st. |
368 | * packed_session must have allocated space for the security parameters. | 368 | * packed_session must have allocated space for the security parameters. |
369 | */ | 369 | */ |
370 | ret = unpack_security_parameters (session, packed_session); | 370 | ret = unpack_security_parameters (session, packed_session); |
@@ -401,12 +401,12 @@ _gnutls_session_unpack (gnutls_session_t session, | |||
401 | * and so on... | 401 | * and so on... |
402 | */ | 402 | */ |
403 | static int | 403 | static int |
404 | pack_certificate_auth_info (gnutls_session_t session, | 404 | pack_certificate_auth_info (mhd_gtls_session_t session, |
405 | gnutls_datum_t * packed_session) | 405 | gnutls_datum_t * packed_session) |
406 | { | 406 | { |
407 | unsigned int pos = 0, i; | 407 | unsigned int pos = 0, i; |
408 | int cert_size, pack_size; | 408 | int cert_size, pack_size; |
409 | cert_auth_info_t info = _gnutls_get_auth_info (session); | 409 | cert_auth_info_t info = mhd_gtls_get_auth_info (session); |
410 | 410 | ||
411 | if (info) | 411 | if (info) |
412 | { | 412 | { |
@@ -437,36 +437,36 @@ pack_certificate_auth_info (gnutls_session_t session, | |||
437 | } | 437 | } |
438 | 438 | ||
439 | packed_session->data[0] = MHD_GNUTLS_CRD_CERTIFICATE; | 439 | packed_session->data[0] = MHD_GNUTLS_CRD_CERTIFICATE; |
440 | _gnutls_write_uint32 (pack_size, &packed_session->data[PACK_HEADER_SIZE]); | 440 | mhd_gtls_write_uint32 (pack_size, &packed_session->data[PACK_HEADER_SIZE]); |
441 | pos += 4 + PACK_HEADER_SIZE; | 441 | pos += 4 + PACK_HEADER_SIZE; |
442 | 442 | ||
443 | 443 | ||
444 | if (pack_size > 0) | 444 | if (pack_size > 0) |
445 | { | 445 | { |
446 | 446 | ||
447 | _gnutls_write_uint16 (info->dh.secret_bits, &packed_session->data[pos]); | 447 | mhd_gtls_write_uint16 (info->dh.secret_bits, &packed_session->data[pos]); |
448 | pos += 2; | 448 | pos += 2; |
449 | 449 | ||
450 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.prime); | 450 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.prime); |
451 | pos += 4 + info->dh.prime.size; | 451 | pos += 4 + info->dh.prime.size; |
452 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.generator); | 452 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.generator); |
453 | pos += 4 + info->dh.generator.size; | 453 | pos += 4 + info->dh.generator.size; |
454 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.public_key); | 454 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.public_key); |
455 | pos += 4 + info->dh.public_key.size; | 455 | pos += 4 + info->dh.public_key.size; |
456 | 456 | ||
457 | _gnutls_write_datum32 (&packed_session->data[pos], | 457 | mhd_gtls_write_datum32 (&packed_session->data[pos], |
458 | info->rsa_export.modulus); | 458 | info->rsa_export.modulus); |
459 | pos += 4 + info->rsa_export.modulus.size; | 459 | pos += 4 + info->rsa_export.modulus.size; |
460 | _gnutls_write_datum32 (&packed_session->data[pos], | 460 | mhd_gtls_write_datum32 (&packed_session->data[pos], |
461 | info->rsa_export.exponent); | 461 | info->rsa_export.exponent); |
462 | pos += 4 + info->rsa_export.exponent.size; | 462 | pos += 4 + info->rsa_export.exponent.size; |
463 | 463 | ||
464 | _gnutls_write_uint32 (info->ncerts, &packed_session->data[pos]); | 464 | mhd_gtls_write_uint32 (info->ncerts, &packed_session->data[pos]); |
465 | pos += 4; | 465 | pos += 4; |
466 | 466 | ||
467 | for (i = 0; i < info->ncerts; i++) | 467 | for (i = 0; i < info->ncerts; i++) |
468 | { | 468 | { |
469 | _gnutls_write_datum32 (&packed_session->data[pos], | 469 | mhd_gtls_write_datum32 (&packed_session->data[pos], |
470 | info->raw_certificate_list[i]); | 470 | info->raw_certificate_list[i]); |
471 | pos += sizeof (uint32_t) + info->raw_certificate_list[i].size; | 471 | pos += sizeof (uint32_t) + info->raw_certificate_list[i].size; |
472 | } | 472 | } |
@@ -479,7 +479,7 @@ pack_certificate_auth_info (gnutls_session_t session, | |||
479 | /* Upack certificate info. | 479 | /* Upack certificate info. |
480 | */ | 480 | */ |
481 | static int | 481 | static int |
482 | unpack_certificate_auth_info (gnutls_session_t session, | 482 | unpack_certificate_auth_info (mhd_gtls_session_t session, |
483 | const gnutls_datum_t * packed_session) | 483 | const gnutls_datum_t * packed_session) |
484 | { | 484 | { |
485 | int pos = 0, size, ret; | 485 | int pos = 0, size, ret; |
@@ -493,7 +493,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
493 | return GNUTLS_E_INVALID_REQUEST; | 493 | return GNUTLS_E_INVALID_REQUEST; |
494 | } | 494 | } |
495 | 495 | ||
496 | pack_size = _gnutls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); | 496 | pack_size = mhd_gtls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); |
497 | pos += PACK_HEADER_SIZE + 4; | 497 | pos += PACK_HEADER_SIZE + 4; |
498 | 498 | ||
499 | if (pack_size == 0) | 499 | if (pack_size == 0) |
@@ -509,7 +509,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
509 | /* client and server have the same auth_info here | 509 | /* client and server have the same auth_info here |
510 | */ | 510 | */ |
511 | ret = | 511 | ret = |
512 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, | 512 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_CERTIFICATE, |
513 | sizeof (cert_auth_info_st), 1); | 513 | sizeof (cert_auth_info_st), 1); |
514 | if (ret < 0) | 514 | if (ret < 0) |
515 | { | 515 | { |
@@ -517,17 +517,17 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
517 | return ret; | 517 | return ret; |
518 | } | 518 | } |
519 | 519 | ||
520 | info = _gnutls_get_auth_info (session); | 520 | info = mhd_gtls_get_auth_info (session); |
521 | if (info == NULL) | 521 | if (info == NULL) |
522 | { | 522 | { |
523 | gnutls_assert (); | 523 | gnutls_assert (); |
524 | return GNUTLS_E_INTERNAL_ERROR; | 524 | return GNUTLS_E_INTERNAL_ERROR; |
525 | } | 525 | } |
526 | 526 | ||
527 | info->dh.secret_bits = _gnutls_read_uint16 (&packed_session->data[pos]); | 527 | info->dh.secret_bits = mhd_gtls_read_uint16 (&packed_session->data[pos]); |
528 | pos += 2; | 528 | pos += 2; |
529 | 529 | ||
530 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 530 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
531 | pos += 4; | 531 | pos += 4; |
532 | ret = _gnutls_set_datum (&info->dh.prime, &packed_session->data[pos], size); | 532 | ret = _gnutls_set_datum (&info->dh.prime, &packed_session->data[pos], size); |
533 | if (ret < 0) | 533 | if (ret < 0) |
@@ -537,7 +537,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
537 | } | 537 | } |
538 | pos += size; | 538 | pos += size; |
539 | 539 | ||
540 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 540 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
541 | pos += 4; | 541 | pos += 4; |
542 | ret = | 542 | ret = |
543 | _gnutls_set_datum (&info->dh.generator, &packed_session->data[pos], size); | 543 | _gnutls_set_datum (&info->dh.generator, &packed_session->data[pos], size); |
@@ -548,7 +548,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
548 | } | 548 | } |
549 | pos += size; | 549 | pos += size; |
550 | 550 | ||
551 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 551 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
552 | pos += 4; | 552 | pos += 4; |
553 | ret = | 553 | ret = |
554 | _gnutls_set_datum (&info->dh.public_key, &packed_session->data[pos], | 554 | _gnutls_set_datum (&info->dh.public_key, &packed_session->data[pos], |
@@ -560,7 +560,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
560 | } | 560 | } |
561 | pos += size; | 561 | pos += size; |
562 | 562 | ||
563 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 563 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
564 | pos += 4; | 564 | pos += 4; |
565 | ret = | 565 | ret = |
566 | _gnutls_set_datum (&info->rsa_export.modulus, | 566 | _gnutls_set_datum (&info->rsa_export.modulus, |
@@ -572,7 +572,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
572 | } | 572 | } |
573 | pos += size; | 573 | pos += size; |
574 | 574 | ||
575 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 575 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
576 | pos += 4; | 576 | pos += 4; |
577 | ret = | 577 | ret = |
578 | _gnutls_set_datum (&info->rsa_export.exponent, | 578 | _gnutls_set_datum (&info->rsa_export.exponent, |
@@ -584,7 +584,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
584 | } | 584 | } |
585 | pos += size; | 585 | pos += size; |
586 | 586 | ||
587 | info->ncerts = _gnutls_read_uint32 (&packed_session->data[pos]); | 587 | info->ncerts = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
588 | pos += 4; | 588 | pos += 4; |
589 | 589 | ||
590 | if (info->ncerts > 0) | 590 | if (info->ncerts > 0) |
@@ -601,7 +601,7 @@ unpack_certificate_auth_info (gnutls_session_t session, | |||
601 | 601 | ||
602 | for (i = 0; i < info->ncerts; i++) | 602 | for (i = 0; i < info->ncerts; i++) |
603 | { | 603 | { |
604 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 604 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
605 | pos += sizeof (uint32_t); | 605 | pos += sizeof (uint32_t); |
606 | 606 | ||
607 | ret = | 607 | ret = |
@@ -646,9 +646,9 @@ error: | |||
646 | * x bytes the SRP username | 646 | * x bytes the SRP username |
647 | */ | 647 | */ |
648 | static int | 648 | static int |
649 | pack_srp_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | 649 | pack_srp_auth_info (mhd_gtls_session_t session, gnutls_datum_t * packed_session) |
650 | { | 650 | { |
651 | srp_server_auth_info_t info = _gnutls_get_auth_info (session); | 651 | srp_server_auth_info_t info = mhd_gtls_get_auth_info (session); |
652 | int pack_size; | 652 | int pack_size; |
653 | 653 | ||
654 | if (info && info->username) | 654 | if (info && info->username) |
@@ -670,7 +670,7 @@ pack_srp_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | |||
670 | } | 670 | } |
671 | 671 | ||
672 | packed_session->data[0] = MHD_GNUTLS_CRD_SRP; | 672 | packed_session->data[0] = MHD_GNUTLS_CRD_SRP; |
673 | _gnutls_write_uint32 (pack_size, &packed_session->data[PACK_HEADER_SIZE]); | 673 | mhd_gtls_write_uint32 (pack_size, &packed_session->data[PACK_HEADER_SIZE]); |
674 | 674 | ||
675 | if (pack_size > 0) | 675 | if (pack_size > 0) |
676 | memcpy (&packed_session->data[PACK_HEADER_SIZE + sizeof (uint32_t)], | 676 | memcpy (&packed_session->data[PACK_HEADER_SIZE + sizeof (uint32_t)], |
@@ -681,7 +681,7 @@ pack_srp_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | |||
681 | 681 | ||
682 | 682 | ||
683 | static int | 683 | static int |
684 | unpack_srp_auth_info (gnutls_session_t session, | 684 | unpack_srp_auth_info (mhd_gtls_session_t session, |
685 | const gnutls_datum_t * packed_session) | 685 | const gnutls_datum_t * packed_session) |
686 | { | 686 | { |
687 | size_t username_size; | 687 | size_t username_size; |
@@ -695,7 +695,7 @@ unpack_srp_auth_info (gnutls_session_t session, | |||
695 | } | 695 | } |
696 | 696 | ||
697 | username_size = | 697 | username_size = |
698 | _gnutls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); | 698 | mhd_gtls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); |
699 | 699 | ||
700 | if (username_size == 0) | 700 | if (username_size == 0) |
701 | return 0; /* nothing to be done */ | 701 | return 0; /* nothing to be done */ |
@@ -708,7 +708,7 @@ unpack_srp_auth_info (gnutls_session_t session, | |||
708 | } | 708 | } |
709 | 709 | ||
710 | ret = | 710 | ret = |
711 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_SRP, | 711 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_SRP, |
712 | sizeof (srp_server_auth_info_st), 1); | 712 | sizeof (srp_server_auth_info_st), 1); |
713 | if (ret < 0) | 713 | if (ret < 0) |
714 | { | 714 | { |
@@ -716,7 +716,7 @@ unpack_srp_auth_info (gnutls_session_t session, | |||
716 | return ret; | 716 | return ret; |
717 | } | 717 | } |
718 | 718 | ||
719 | info = _gnutls_get_auth_info (session); | 719 | info = mhd_gtls_get_auth_info (session); |
720 | if (info == NULL) | 720 | if (info == NULL) |
721 | { | 721 | { |
722 | gnutls_assert (); | 722 | gnutls_assert (); |
@@ -751,12 +751,12 @@ unpack_srp_auth_info (gnutls_session_t session, | |||
751 | * x bytes the public key | 751 | * x bytes the public key |
752 | */ | 752 | */ |
753 | static int | 753 | static int |
754 | pack_psk_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | 754 | pack_psk_auth_info (mhd_gtls_session_t session, gnutls_datum_t * packed_session) |
755 | { | 755 | { |
756 | psk_auth_info_t info; | 756 | psk_auth_info_t info; |
757 | int pack_size, username_size = 0, pos; | 757 | int pack_size, username_size = 0, pos; |
758 | 758 | ||
759 | info = _gnutls_get_auth_info (session); | 759 | info = mhd_gtls_get_auth_info (session); |
760 | 760 | ||
761 | if (info) | 761 | if (info) |
762 | { | 762 | { |
@@ -786,26 +786,26 @@ pack_psk_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | |||
786 | packed_session->data[pos] = MHD_GNUTLS_CRD_PSK; | 786 | packed_session->data[pos] = MHD_GNUTLS_CRD_PSK; |
787 | pos++; | 787 | pos++; |
788 | 788 | ||
789 | _gnutls_write_uint32 (pack_size, &packed_session->data[pos]); | 789 | mhd_gtls_write_uint32 (pack_size, &packed_session->data[pos]); |
790 | pos += 4; | 790 | pos += 4; |
791 | 791 | ||
792 | 792 | ||
793 | if (pack_size > 0) | 793 | if (pack_size > 0) |
794 | { | 794 | { |
795 | _gnutls_write_uint32 (username_size, &packed_session->data[pos]); | 795 | mhd_gtls_write_uint32 (username_size, &packed_session->data[pos]); |
796 | pos += 4; | 796 | pos += 4; |
797 | 797 | ||
798 | memcpy (&packed_session->data[pos], info->username, username_size); | 798 | memcpy (&packed_session->data[pos], info->username, username_size); |
799 | pos += username_size; | 799 | pos += username_size; |
800 | 800 | ||
801 | _gnutls_write_uint16 (info->dh.secret_bits, &packed_session->data[pos]); | 801 | mhd_gtls_write_uint16 (info->dh.secret_bits, &packed_session->data[pos]); |
802 | pos += 2; | 802 | pos += 2; |
803 | 803 | ||
804 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.prime); | 804 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.prime); |
805 | pos += 4 + info->dh.prime.size; | 805 | pos += 4 + info->dh.prime.size; |
806 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.generator); | 806 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.generator); |
807 | pos += 4 + info->dh.generator.size; | 807 | pos += 4 + info->dh.generator.size; |
808 | _gnutls_write_datum32 (&packed_session->data[pos], info->dh.public_key); | 808 | mhd_gtls_write_datum32 (&packed_session->data[pos], info->dh.public_key); |
809 | pos += 4 + info->dh.public_key.size; | 809 | pos += 4 + info->dh.public_key.size; |
810 | 810 | ||
811 | } | 811 | } |
@@ -815,7 +815,7 @@ pack_psk_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) | |||
815 | } | 815 | } |
816 | 816 | ||
817 | static int | 817 | static int |
818 | unpack_psk_auth_info (gnutls_session_t session, | 818 | unpack_psk_auth_info (mhd_gtls_session_t session, |
819 | const gnutls_datum_t * packed_session) | 819 | const gnutls_datum_t * packed_session) |
820 | { | 820 | { |
821 | size_t username_size; | 821 | size_t username_size; |
@@ -829,7 +829,7 @@ unpack_psk_auth_info (gnutls_session_t session, | |||
829 | return GNUTLS_E_INVALID_REQUEST; | 829 | return GNUTLS_E_INVALID_REQUEST; |
830 | } | 830 | } |
831 | 831 | ||
832 | pack_size = _gnutls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); | 832 | pack_size = mhd_gtls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]); |
833 | pos += PACK_HEADER_SIZE + 4; | 833 | pos += PACK_HEADER_SIZE + 4; |
834 | 834 | ||
835 | 835 | ||
@@ -846,7 +846,7 @@ unpack_psk_auth_info (gnutls_session_t session, | |||
846 | /* client and serer have the same auth_info here | 846 | /* client and serer have the same auth_info here |
847 | */ | 847 | */ |
848 | ret = | 848 | ret = |
849 | _gnutls_auth_info_set (session, MHD_GNUTLS_CRD_PSK, | 849 | mhd_gtls_auth_info_set (session, MHD_GNUTLS_CRD_PSK, |
850 | sizeof (psk_auth_info_st), 1); | 850 | sizeof (psk_auth_info_st), 1); |
851 | if (ret < 0) | 851 | if (ret < 0) |
852 | { | 852 | { |
@@ -854,23 +854,23 @@ unpack_psk_auth_info (gnutls_session_t session, | |||
854 | return ret; | 854 | return ret; |
855 | } | 855 | } |
856 | 856 | ||
857 | info = _gnutls_get_auth_info (session); | 857 | info = mhd_gtls_get_auth_info (session); |
858 | if (info == NULL) | 858 | if (info == NULL) |
859 | { | 859 | { |
860 | gnutls_assert (); | 860 | gnutls_assert (); |
861 | return GNUTLS_E_INTERNAL_ERROR; | 861 | return GNUTLS_E_INTERNAL_ERROR; |
862 | } | 862 | } |
863 | 863 | ||
864 | username_size = _gnutls_read_uint32 (&packed_session->data[pos]); | 864 | username_size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
865 | pos += 4; | 865 | pos += 4; |
866 | 866 | ||
867 | memcpy (info->username, &packed_session->data[pos], username_size); | 867 | memcpy (info->username, &packed_session->data[pos], username_size); |
868 | pos += username_size; | 868 | pos += username_size; |
869 | 869 | ||
870 | info->dh.secret_bits = _gnutls_read_uint16 (&packed_session->data[pos]); | 870 | info->dh.secret_bits = mhd_gtls_read_uint16 (&packed_session->data[pos]); |
871 | pos += 2; | 871 | pos += 2; |
872 | 872 | ||
873 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 873 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
874 | pos += 4; | 874 | pos += 4; |
875 | ret = _gnutls_set_datum (&info->dh.prime, &packed_session->data[pos], size); | 875 | ret = _gnutls_set_datum (&info->dh.prime, &packed_session->data[pos], size); |
876 | if (ret < 0) | 876 | if (ret < 0) |
@@ -880,7 +880,7 @@ unpack_psk_auth_info (gnutls_session_t session, | |||
880 | } | 880 | } |
881 | pos += size; | 881 | pos += size; |
882 | 882 | ||
883 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 883 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
884 | pos += 4; | 884 | pos += 4; |
885 | ret = | 885 | ret = |
886 | _gnutls_set_datum (&info->dh.generator, &packed_session->data[pos], size); | 886 | _gnutls_set_datum (&info->dh.generator, &packed_session->data[pos], size); |
@@ -891,7 +891,7 @@ unpack_psk_auth_info (gnutls_session_t session, | |||
891 | } | 891 | } |
892 | pos += size; | 892 | pos += size; |
893 | 893 | ||
894 | size = _gnutls_read_uint32 (&packed_session->data[pos]); | 894 | size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
895 | pos += 4; | 895 | pos += 4; |
896 | ret = | 896 | ret = |
897 | _gnutls_set_datum (&info->dh.public_key, &packed_session->data[pos], | 897 | _gnutls_set_datum (&info->dh.public_key, &packed_session->data[pos], |
@@ -963,7 +963,7 @@ error: | |||
963 | * MAX: 7+MAX_SRP_USERNAME+MAX_SERVER_NAME_EXTENSIONS*(3+MAX_SERVER_NAME_SIZE) | 963 | * MAX: 7+MAX_SRP_USERNAME+MAX_SERVER_NAME_EXTENSIONS*(3+MAX_SERVER_NAME_SIZE) |
964 | */ | 964 | */ |
965 | static int | 965 | static int |
966 | pack_security_parameters (gnutls_session_t session, | 966 | pack_security_parameters (mhd_gtls_session_t session, |
967 | gnutls_datum_t * packed_session) | 967 | gnutls_datum_t * packed_session) |
968 | { | 968 | { |
969 | int pos = 0; | 969 | int pos = 0; |
@@ -972,7 +972,7 @@ pack_security_parameters (gnutls_session_t session, | |||
972 | /* move after the auth info stuff. | 972 | /* move after the auth info stuff. |
973 | */ | 973 | */ |
974 | init = | 974 | init = |
975 | _gnutls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]) + 4 + | 975 | mhd_gtls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]) + 4 + |
976 | PACK_HEADER_SIZE; | 976 | PACK_HEADER_SIZE; |
977 | 977 | ||
978 | pos = init + 4; /* make some space to write later the size */ | 978 | pos = init + 4; /* make some space to write later the size */ |
@@ -1015,16 +1015,16 @@ pack_security_parameters (gnutls_session_t session, | |||
1015 | session->security_parameters.session_id_size); | 1015 | session->security_parameters.session_id_size); |
1016 | pos += session->security_parameters.session_id_size; | 1016 | pos += session->security_parameters.session_id_size; |
1017 | 1017 | ||
1018 | _gnutls_write_uint32 (session->security_parameters.timestamp, | 1018 | mhd_gtls_write_uint32 (session->security_parameters.timestamp, |
1019 | &packed_session->data[pos]); | 1019 | &packed_session->data[pos]); |
1020 | pos += 4; | 1020 | pos += 4; |
1021 | 1021 | ||
1022 | /* Extensions */ | 1022 | /* Extensions */ |
1023 | _gnutls_write_uint16 (session->security_parameters.max_record_send_size, | 1023 | mhd_gtls_write_uint16 (session->security_parameters.max_record_send_size, |
1024 | &packed_session->data[pos]); | 1024 | &packed_session->data[pos]); |
1025 | pos += 2; | 1025 | pos += 2; |
1026 | 1026 | ||
1027 | _gnutls_write_uint16 (session->security_parameters.max_record_recv_size, | 1027 | mhd_gtls_write_uint16 (session->security_parameters.max_record_recv_size, |
1028 | &packed_session->data[pos]); | 1028 | &packed_session->data[pos]); |
1029 | pos += 2; | 1029 | pos += 2; |
1030 | 1030 | ||
@@ -1036,7 +1036,7 @@ pack_security_parameters (gnutls_session_t session, | |||
1036 | session->security_parameters.extensions.srp_username, len); | 1036 | session->security_parameters.extensions.srp_username, len); |
1037 | pos += len; | 1037 | pos += len; |
1038 | 1038 | ||
1039 | _gnutls_write_uint16 (session->security_parameters.extensions. | 1039 | mhd_gtls_write_uint16 (session->security_parameters.extensions. |
1040 | server_names_size, &packed_session->data[pos]); | 1040 | server_names_size, &packed_session->data[pos]); |
1041 | pos += 2; | 1041 | pos += 2; |
1042 | 1042 | ||
@@ -1045,7 +1045,7 @@ pack_security_parameters (gnutls_session_t session, | |||
1045 | { | 1045 | { |
1046 | packed_session->data[pos++] = | 1046 | packed_session->data[pos++] = |
1047 | session->security_parameters.extensions.server_names[i].type; | 1047 | session->security_parameters.extensions.server_names[i].type; |
1048 | _gnutls_write_uint16 (session->security_parameters.extensions. | 1048 | mhd_gtls_write_uint16 (session->security_parameters.extensions. |
1049 | server_names[i].name_length, | 1049 | server_names[i].name_length, |
1050 | &packed_session->data[pos]); | 1050 | &packed_session->data[pos]); |
1051 | pos += 2; | 1051 | pos += 2; |
@@ -1059,7 +1059,7 @@ pack_security_parameters (gnutls_session_t session, | |||
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | /* write the total size */ | 1061 | /* write the total size */ |
1062 | _gnutls_write_uint32 (pos - init - 4, &packed_session->data[init]); | 1062 | mhd_gtls_write_uint32 (pos - init - 4, &packed_session->data[init]); |
1063 | packed_session->size += pos - init; | 1063 | packed_session->size += pos - init; |
1064 | 1064 | ||
1065 | return 0; | 1065 | return 0; |
@@ -1067,7 +1067,7 @@ pack_security_parameters (gnutls_session_t session, | |||
1067 | 1067 | ||
1068 | 1068 | ||
1069 | static int | 1069 | static int |
1070 | unpack_security_parameters (gnutls_session_t session, | 1070 | unpack_security_parameters (mhd_gtls_session_t session, |
1071 | const gnutls_datum_t * packed_session) | 1071 | const gnutls_datum_t * packed_session) |
1072 | { | 1072 | { |
1073 | size_t pack_size, init, i; | 1073 | size_t pack_size, init, i; |
@@ -1077,12 +1077,12 @@ unpack_security_parameters (gnutls_session_t session, | |||
1077 | 1077 | ||
1078 | /* skip the auth info stuff */ | 1078 | /* skip the auth info stuff */ |
1079 | init = | 1079 | init = |
1080 | _gnutls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]) + 4 + | 1080 | mhd_gtls_read_uint32 (&packed_session->data[PACK_HEADER_SIZE]) + 4 + |
1081 | PACK_HEADER_SIZE; | 1081 | PACK_HEADER_SIZE; |
1082 | 1082 | ||
1083 | pos = init; | 1083 | pos = init; |
1084 | 1084 | ||
1085 | pack_size = _gnutls_read_uint32 (&packed_session->data[pos]); | 1085 | pack_size = mhd_gtls_read_uint32 (&packed_session->data[pos]); |
1086 | pos += 4; | 1086 | pos += 4; |
1087 | 1087 | ||
1088 | 1088 | ||
@@ -1141,7 +1141,7 @@ unpack_security_parameters (gnutls_session_t session, | |||
1141 | pos += session->internals.resumed_security_parameters.session_id_size; | 1141 | pos += session->internals.resumed_security_parameters.session_id_size; |
1142 | 1142 | ||
1143 | session->internals.resumed_security_parameters.timestamp = | 1143 | session->internals.resumed_security_parameters.timestamp = |
1144 | _gnutls_read_uint32 (&packed_session->data[pos]); | 1144 | mhd_gtls_read_uint32 (&packed_session->data[pos]); |
1145 | pos += 4; | 1145 | pos += 4; |
1146 | 1146 | ||
1147 | if (timestamp - session->internals.resumed_security_parameters.timestamp > | 1147 | if (timestamp - session->internals.resumed_security_parameters.timestamp > |
@@ -1154,11 +1154,11 @@ unpack_security_parameters (gnutls_session_t session, | |||
1154 | 1154 | ||
1155 | /* Extensions */ | 1155 | /* Extensions */ |
1156 | session->internals.resumed_security_parameters.max_record_send_size = | 1156 | session->internals.resumed_security_parameters.max_record_send_size = |
1157 | _gnutls_read_uint16 (&packed_session->data[pos]); | 1157 | mhd_gtls_read_uint16 (&packed_session->data[pos]); |
1158 | pos += 2; | 1158 | pos += 2; |
1159 | 1159 | ||
1160 | session->internals.resumed_security_parameters.max_record_recv_size = | 1160 | session->internals.resumed_security_parameters.max_record_recv_size = |
1161 | _gnutls_read_uint16 (&packed_session->data[pos]); | 1161 | mhd_gtls_read_uint16 (&packed_session->data[pos]); |
1162 | pos += 2; | 1162 | pos += 2; |
1163 | 1163 | ||
1164 | 1164 | ||
@@ -1171,7 +1171,7 @@ unpack_security_parameters (gnutls_session_t session, | |||
1171 | pos += len; | 1171 | pos += len; |
1172 | 1172 | ||
1173 | session->internals.resumed_security_parameters.extensions. | 1173 | session->internals.resumed_security_parameters.extensions. |
1174 | server_names_size = _gnutls_read_uint16 (&packed_session->data[pos]); | 1174 | server_names_size = mhd_gtls_read_uint16 (&packed_session->data[pos]); |
1175 | pos += 2; | 1175 | pos += 2; |
1176 | for (i = 0; | 1176 | for (i = 0; |
1177 | i < | 1177 | i < |
@@ -1182,7 +1182,7 @@ unpack_security_parameters (gnutls_session_t session, | |||
1182 | server_names[i].type = packed_session->data[pos++]; | 1182 | server_names[i].type = packed_session->data[pos++]; |
1183 | session->internals.resumed_security_parameters.extensions. | 1183 | session->internals.resumed_security_parameters.extensions. |
1184 | server_names[i].name_length = | 1184 | server_names[i].name_length = |
1185 | _gnutls_read_uint16 (&packed_session->data[pos]); | 1185 | mhd_gtls_read_uint16 (&packed_session->data[pos]); |
1186 | pos += 2; | 1186 | pos += 2; |
1187 | 1187 | ||
1188 | memcpy (session->internals.resumed_security_parameters.extensions. | 1188 | memcpy (session->internals.resumed_security_parameters.extensions. |
diff --git a/src/daemon/https/tls/gnutls_session_pack.h b/src/daemon/https/tls/gnutls_session_pack.h index 93dd32de..abc3fe46 100644 --- a/src/daemon/https/tls/gnutls_session_pack.h +++ b/src/daemon/https/tls/gnutls_session_pack.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | int _gnutls_session_pack (gnutls_session_t session, | 25 | int _gnutls_session_pack (mhd_gtls_session_t session, |
26 | gnutls_datum_t * packed_session); | 26 | gnutls_datum_t * packed_session); |
27 | int _gnutls_session_unpack (gnutls_session_t session, | 27 | int _gnutls_session_unpack (mhd_gtls_session_t session, |
28 | const gnutls_datum_t * packed_session); | 28 | const gnutls_datum_t * packed_session); |
diff --git a/src/daemon/https/tls/gnutls_sig.c b/src/daemon/https/tls/gnutls_sig.c index da09e199..1d926649 100644 --- a/src/daemon/https/tls/gnutls_sig.c +++ b/src/daemon/https/tls/gnutls_sig.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <gnutls_sig.h> | 37 | #include <gnutls_sig.h> |
38 | #include <gnutls_kx.h> | 38 | #include <gnutls_kx.h> |
39 | 39 | ||
40 | static int _gnutls_tls_sign (gnutls_session_t session, | 40 | static int _gnutls_tls_sign (mhd_gtls_session_t session, |
41 | gnutls_cert * cert, | 41 | gnutls_cert * cert, |
42 | gnutls_privkey * pkey, | 42 | gnutls_privkey * pkey, |
43 | const gnutls_datum_t * hash_concat, | 43 | const gnutls_datum_t * hash_concat, |
@@ -47,7 +47,7 @@ static int _gnutls_tls_sign (gnutls_session_t session, | |||
47 | * handshake procedure. (20040227: now it works for SSL 3.0 as well) | 47 | * handshake procedure. (20040227: now it works for SSL 3.0 as well) |
48 | */ | 48 | */ |
49 | int | 49 | int |
50 | _gnutls_tls_sign_hdata (gnutls_session_t session, | 50 | mhd_gtls_tls_sign_hdata (mhd_gtls_session_t session, |
51 | gnutls_cert * cert, | 51 | gnutls_cert * cert, |
52 | gnutls_privkey * pkey, gnutls_datum_t * signature) | 52 | gnutls_privkey * pkey, gnutls_datum_t * signature) |
53 | { | 53 | { |
@@ -56,9 +56,9 @@ _gnutls_tls_sign_hdata (gnutls_session_t session, | |||
56 | opaque concat[36]; | 56 | opaque concat[36]; |
57 | mac_hd_t td_md5; | 57 | mac_hd_t td_md5; |
58 | mac_hd_t td_sha; | 58 | mac_hd_t td_sha; |
59 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 59 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
60 | 60 | ||
61 | td_sha = _gnutls_hash_copy (session->internals.handshake_mac_handle_sha); | 61 | td_sha = mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_sha); |
62 | if (td_sha == NULL) | 62 | if (td_sha == NULL) |
63 | { | 63 | { |
64 | gnutls_assert (); | 64 | gnutls_assert (); |
@@ -67,25 +67,25 @@ _gnutls_tls_sign_hdata (gnutls_session_t session, | |||
67 | 67 | ||
68 | if (ver == MHD_GNUTLS_SSL3) | 68 | if (ver == MHD_GNUTLS_SSL3) |
69 | { | 69 | { |
70 | ret = _gnutls_generate_master (session, 1); | 70 | ret = mhd_gtls_generate_master (session, 1); |
71 | if (ret < 0) | 71 | if (ret < 0) |
72 | { | 72 | { |
73 | gnutls_assert (); | 73 | gnutls_assert (); |
74 | return ret; | 74 | return ret; |
75 | } | 75 | } |
76 | 76 | ||
77 | _gnutls_mac_deinit_ssl3_handshake (td_sha, &concat[16], | 77 | mhd_gnutls_mac_deinit_ssl3_handshake (td_sha, &concat[16], |
78 | session->security_parameters. | 78 | session->security_parameters. |
79 | master_secret, TLS_MASTER_SIZE); | 79 | master_secret, TLS_MASTER_SIZE); |
80 | } | 80 | } |
81 | else | 81 | else |
82 | _gnutls_hash_deinit (td_sha, &concat[16]); | 82 | mhd_gnutls_hash_deinit (td_sha, &concat[16]); |
83 | 83 | ||
84 | switch (cert->subject_pk_algorithm) | 84 | switch (cert->subject_pk_algorithm) |
85 | { | 85 | { |
86 | case MHD_GNUTLS_PK_RSA: | 86 | case MHD_GNUTLS_PK_RSA: |
87 | td_md5 = | 87 | td_md5 = |
88 | _gnutls_hash_copy (session->internals.handshake_mac_handle_md5); | 88 | mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_md5); |
89 | if (td_md5 == NULL) | 89 | if (td_md5 == NULL) |
90 | { | 90 | { |
91 | gnutls_assert (); | 91 | gnutls_assert (); |
@@ -93,11 +93,11 @@ _gnutls_tls_sign_hdata (gnutls_session_t session, | |||
93 | } | 93 | } |
94 | 94 | ||
95 | if (ver == MHD_GNUTLS_SSL3) | 95 | if (ver == MHD_GNUTLS_SSL3) |
96 | _gnutls_mac_deinit_ssl3_handshake (td_md5, concat, | 96 | mhd_gnutls_mac_deinit_ssl3_handshake (td_md5, concat, |
97 | session->security_parameters. | 97 | session->security_parameters. |
98 | master_secret, TLS_MASTER_SIZE); | 98 | master_secret, TLS_MASTER_SIZE); |
99 | else | 99 | else |
100 | _gnutls_hash_deinit (td_md5, concat); | 100 | mhd_gnutls_hash_deinit (td_md5, concat); |
101 | 101 | ||
102 | dconcat.data = concat; | 102 | dconcat.data = concat; |
103 | dconcat.size = 36; | 103 | dconcat.size = 36; |
@@ -119,7 +119,7 @@ _gnutls_tls_sign_hdata (gnutls_session_t session, | |||
119 | * Used in DHE_* ciphersuites. | 119 | * Used in DHE_* ciphersuites. |
120 | */ | 120 | */ |
121 | int | 121 | int |
122 | _gnutls_tls_sign_params (gnutls_session_t session, | 122 | mhd_gtls_tls_sign_params (mhd_gtls_session_t session, |
123 | gnutls_cert * cert, | 123 | gnutls_cert * cert, |
124 | gnutls_privkey * pkey, | 124 | gnutls_privkey * pkey, |
125 | gnutls_datum_t * params, gnutls_datum_t * signature) | 125 | gnutls_datum_t * params, gnutls_datum_t * signature) |
@@ -128,41 +128,41 @@ _gnutls_tls_sign_params (gnutls_session_t session, | |||
128 | int ret; | 128 | int ret; |
129 | mac_hd_t td_sha; | 129 | mac_hd_t td_sha; |
130 | opaque concat[36]; | 130 | opaque concat[36]; |
131 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 131 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
132 | 132 | ||
133 | td_sha = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 133 | td_sha = mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
134 | if (td_sha == NULL) | 134 | if (td_sha == NULL) |
135 | { | 135 | { |
136 | gnutls_assert (); | 136 | gnutls_assert (); |
137 | return GNUTLS_E_HASH_FAILED; | 137 | return GNUTLS_E_HASH_FAILED; |
138 | } | 138 | } |
139 | 139 | ||
140 | _gnutls_hash (td_sha, session->security_parameters.client_random, | 140 | mhd_gnutls_hash (td_sha, session->security_parameters.client_random, |
141 | TLS_RANDOM_SIZE); | 141 | TLS_RANDOM_SIZE); |
142 | _gnutls_hash (td_sha, session->security_parameters.server_random, | 142 | mhd_gnutls_hash (td_sha, session->security_parameters.server_random, |
143 | TLS_RANDOM_SIZE); | 143 | TLS_RANDOM_SIZE); |
144 | _gnutls_hash (td_sha, params->data, params->size); | 144 | mhd_gnutls_hash (td_sha, params->data, params->size); |
145 | 145 | ||
146 | switch (cert->subject_pk_algorithm) | 146 | switch (cert->subject_pk_algorithm) |
147 | { | 147 | { |
148 | case MHD_GNUTLS_PK_RSA: | 148 | case MHD_GNUTLS_PK_RSA: |
149 | if (ver < MHD_GNUTLS_TLS1_2) | 149 | if (ver < MHD_GNUTLS_TLS1_2) |
150 | { | 150 | { |
151 | mac_hd_t td_md5 = _gnutls_hash_init (MHD_GNUTLS_MAC_MD5); | 151 | mac_hd_t td_md5 = mhd_gtls_hash_init (MHD_GNUTLS_MAC_MD5); |
152 | if (td_md5 == NULL) | 152 | if (td_md5 == NULL) |
153 | { | 153 | { |
154 | gnutls_assert (); | 154 | gnutls_assert (); |
155 | return GNUTLS_E_HASH_FAILED; | 155 | return GNUTLS_E_HASH_FAILED; |
156 | } | 156 | } |
157 | 157 | ||
158 | _gnutls_hash (td_md5, session->security_parameters.client_random, | 158 | mhd_gnutls_hash (td_md5, session->security_parameters.client_random, |
159 | TLS_RANDOM_SIZE); | 159 | TLS_RANDOM_SIZE); |
160 | _gnutls_hash (td_md5, session->security_parameters.server_random, | 160 | mhd_gnutls_hash (td_md5, session->security_parameters.server_random, |
161 | TLS_RANDOM_SIZE); | 161 | TLS_RANDOM_SIZE); |
162 | _gnutls_hash (td_md5, params->data, params->size); | 162 | mhd_gnutls_hash (td_md5, params->data, params->size); |
163 | 163 | ||
164 | _gnutls_hash_deinit (td_md5, concat); | 164 | mhd_gnutls_hash_deinit (td_md5, concat); |
165 | _gnutls_hash_deinit (td_sha, &concat[16]); | 165 | mhd_gnutls_hash_deinit (td_sha, &concat[16]); |
166 | 166 | ||
167 | dconcat.size = 36; | 167 | dconcat.size = 36; |
168 | } | 168 | } |
@@ -173,13 +173,13 @@ _gnutls_tls_sign_params (gnutls_session_t session, | |||
173 | memcpy (concat, | 173 | memcpy (concat, |
174 | "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14", | 174 | "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14", |
175 | 15); | 175 | 15); |
176 | _gnutls_hash_deinit (td_sha, &concat[15]); | 176 | mhd_gnutls_hash_deinit (td_sha, &concat[15]); |
177 | dconcat.size = 35; | 177 | dconcat.size = 35; |
178 | #else | 178 | #else |
179 | /* No parameters field. */ | 179 | /* No parameters field. */ |
180 | memcpy (concat, | 180 | memcpy (concat, |
181 | "\x30\x1f\x30\x07\x06\x05\x2b\x0e\x03\x02\x1a\x04\x14", 13); | 181 | "\x30\x1f\x30\x07\x06\x05\x2b\x0e\x03\x02\x1a\x04\x14", 13); |
182 | _gnutls_hash_deinit (td_sha, &concat[13]); | 182 | mhd_gnutls_hash_deinit (td_sha, &concat[13]); |
183 | dconcat.size = 33; | 183 | dconcat.size = 33; |
184 | #endif | 184 | #endif |
185 | } | 185 | } |
@@ -187,7 +187,7 @@ _gnutls_tls_sign_params (gnutls_session_t session, | |||
187 | break; | 187 | break; |
188 | default: | 188 | default: |
189 | gnutls_assert (); | 189 | gnutls_assert (); |
190 | _gnutls_hash_deinit (td_sha, NULL); | 190 | mhd_gnutls_hash_deinit (td_sha, NULL); |
191 | return GNUTLS_E_INTERNAL_ERROR; | 191 | return GNUTLS_E_INTERNAL_ERROR; |
192 | } | 192 | } |
193 | ret = _gnutls_tls_sign (session, cert, pkey, &dconcat, signature); | 193 | ret = _gnutls_tls_sign (session, cert, pkey, &dconcat, signature); |
@@ -204,7 +204,7 @@ _gnutls_tls_sign_params (gnutls_session_t session, | |||
204 | * given data. The output will be allocated and be put in signature. | 204 | * given data. The output will be allocated and be put in signature. |
205 | */ | 205 | */ |
206 | int | 206 | int |
207 | _gnutls_sign (gnutls_pk_algorithm_t algo, | 207 | mhd_gtls_sign (gnutls_pk_algorithm_t algo, |
208 | mpi_t * params, | 208 | mpi_t * params, |
209 | int params_size, | 209 | int params_size, |
210 | const gnutls_datum_t * data, gnutls_datum_t * signature) | 210 | const gnutls_datum_t * data, gnutls_datum_t * signature) |
@@ -216,7 +216,7 @@ _gnutls_sign (gnutls_pk_algorithm_t algo, | |||
216 | case MHD_GNUTLS_PK_RSA: | 216 | case MHD_GNUTLS_PK_RSA: |
217 | /* encrypt */ | 217 | /* encrypt */ |
218 | if ((ret = | 218 | if ((ret = |
219 | _gnutls_pkcs1_rsa_encrypt (signature, data, params, params_size, | 219 | mhd_gtls_pkcs1_rsa_encrypt (signature, data, params, params_size, |
220 | 1)) < 0) | 220 | 1)) < 0) |
221 | { | 221 | { |
222 | gnutls_assert (); | 222 | gnutls_assert (); |
@@ -238,7 +238,7 @@ _gnutls_sign (gnutls_pk_algorithm_t algo, | |||
238 | * it supports signing. | 238 | * it supports signing. |
239 | */ | 239 | */ |
240 | static int | 240 | static int |
241 | _gnutls_tls_sign (gnutls_session_t session, | 241 | _gnutls_tls_sign (mhd_gtls_session_t session, |
242 | gnutls_cert * cert, | 242 | gnutls_cert * cert, |
243 | gnutls_privkey * pkey, | 243 | gnutls_privkey * pkey, |
244 | const gnutls_datum_t * hash_concat, | 244 | const gnutls_datum_t * hash_concat, |
@@ -269,7 +269,7 @@ _gnutls_tls_sign (gnutls_session_t session, | |||
269 | hash_concat, signature); | 269 | hash_concat, signature); |
270 | } | 270 | } |
271 | 271 | ||
272 | return _gnutls_sign (pkey->pk_algorithm, pkey->params, pkey->params_size, | 272 | return mhd_gtls_sign (pkey->pk_algorithm, pkey->params, pkey->params_size, |
273 | hash_concat, signature); | 273 | hash_concat, signature); |
274 | } | 274 | } |
275 | 275 | ||
@@ -307,7 +307,7 @@ _gnutls_verify_sig (gnutls_cert * cert, | |||
307 | vdata.size = hash_concat->size; | 307 | vdata.size = hash_concat->size; |
308 | 308 | ||
309 | /* verify signature */ | 309 | /* verify signature */ |
310 | if ((ret = _gnutls_rsa_verify (&vdata, signature, cert->params, | 310 | if ((ret = mhd_gtls_rsa_verify (&vdata, signature, cert->params, |
311 | cert->params_size, 1)) < 0) | 311 | cert->params_size, 1)) < 0) |
312 | { | 312 | { |
313 | gnutls_assert (); | 313 | gnutls_assert (); |
@@ -327,7 +327,7 @@ _gnutls_verify_sig (gnutls_cert * cert, | |||
327 | * verify message). | 327 | * verify message). |
328 | */ | 328 | */ |
329 | int | 329 | int |
330 | _gnutls_verify_sig_hdata (gnutls_session_t session, | 330 | mhd_gtls_verify_sig_hdata (mhd_gtls_session_t session, |
331 | gnutls_cert * cert, gnutls_datum_t * signature) | 331 | gnutls_cert * cert, gnutls_datum_t * signature) |
332 | { | 332 | { |
333 | int ret; | 333 | int ret; |
@@ -335,43 +335,43 @@ _gnutls_verify_sig_hdata (gnutls_session_t session, | |||
335 | mac_hd_t td_md5; | 335 | mac_hd_t td_md5; |
336 | mac_hd_t td_sha; | 336 | mac_hd_t td_sha; |
337 | gnutls_datum_t dconcat; | 337 | gnutls_datum_t dconcat; |
338 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 338 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
339 | 339 | ||
340 | td_md5 = _gnutls_hash_copy (session->internals.handshake_mac_handle_md5); | 340 | td_md5 = mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_md5); |
341 | if (td_md5 == NULL) | 341 | if (td_md5 == NULL) |
342 | { | 342 | { |
343 | gnutls_assert (); | 343 | gnutls_assert (); |
344 | return GNUTLS_E_HASH_FAILED; | 344 | return GNUTLS_E_HASH_FAILED; |
345 | } | 345 | } |
346 | 346 | ||
347 | td_sha = _gnutls_hash_copy (session->internals.handshake_mac_handle_sha); | 347 | td_sha = mhd_gnutls_hash_copy (session->internals.handshake_mac_handle_sha); |
348 | if (td_sha == NULL) | 348 | if (td_sha == NULL) |
349 | { | 349 | { |
350 | gnutls_assert (); | 350 | gnutls_assert (); |
351 | _gnutls_hash_deinit (td_md5, NULL); | 351 | mhd_gnutls_hash_deinit (td_md5, NULL); |
352 | return GNUTLS_E_HASH_FAILED; | 352 | return GNUTLS_E_HASH_FAILED; |
353 | } | 353 | } |
354 | 354 | ||
355 | if (ver == MHD_GNUTLS_SSL3) | 355 | if (ver == MHD_GNUTLS_SSL3) |
356 | { | 356 | { |
357 | ret = _gnutls_generate_master (session, 1); | 357 | ret = mhd_gtls_generate_master (session, 1); |
358 | if (ret < 0) | 358 | if (ret < 0) |
359 | { | 359 | { |
360 | gnutls_assert (); | 360 | gnutls_assert (); |
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
363 | 363 | ||
364 | _gnutls_mac_deinit_ssl3_handshake (td_md5, concat, | 364 | mhd_gnutls_mac_deinit_ssl3_handshake (td_md5, concat, |
365 | session->security_parameters. | 365 | session->security_parameters. |
366 | master_secret, TLS_MASTER_SIZE); | 366 | master_secret, TLS_MASTER_SIZE); |
367 | _gnutls_mac_deinit_ssl3_handshake (td_sha, &concat[16], | 367 | mhd_gnutls_mac_deinit_ssl3_handshake (td_sha, &concat[16], |
368 | session->security_parameters. | 368 | session->security_parameters. |
369 | master_secret, TLS_MASTER_SIZE); | 369 | master_secret, TLS_MASTER_SIZE); |
370 | } | 370 | } |
371 | else | 371 | else |
372 | { | 372 | { |
373 | _gnutls_hash_deinit (td_md5, concat); | 373 | mhd_gnutls_hash_deinit (td_md5, concat); |
374 | _gnutls_hash_deinit (td_sha, &concat[16]); | 374 | mhd_gnutls_hash_deinit (td_sha, &concat[16]); |
375 | } | 375 | } |
376 | 376 | ||
377 | dconcat.data = concat; | 377 | dconcat.data = concat; |
@@ -392,7 +392,7 @@ _gnutls_verify_sig_hdata (gnutls_session_t session, | |||
392 | * Used in DHE_* ciphersuites. | 392 | * Used in DHE_* ciphersuites. |
393 | */ | 393 | */ |
394 | int | 394 | int |
395 | _gnutls_verify_sig_params (gnutls_session_t session, | 395 | mhd_gtls_verify_sig_params (mhd_gtls_session_t session, |
396 | gnutls_cert * cert, | 396 | gnutls_cert * cert, |
397 | const gnutls_datum_t * params, | 397 | const gnutls_datum_t * params, |
398 | gnutls_datum_t * signature) | 398 | gnutls_datum_t * signature) |
@@ -402,43 +402,43 @@ _gnutls_verify_sig_params (gnutls_session_t session, | |||
402 | mac_hd_t td_md5 = NULL; | 402 | mac_hd_t td_md5 = NULL; |
403 | mac_hd_t td_sha; | 403 | mac_hd_t td_sha; |
404 | opaque concat[36]; | 404 | opaque concat[36]; |
405 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 405 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
406 | 406 | ||
407 | if (ver < MHD_GNUTLS_TLS1_2) | 407 | if (ver < MHD_GNUTLS_TLS1_2) |
408 | { | 408 | { |
409 | td_md5 = _gnutls_hash_init (MHD_GNUTLS_MAC_MD5); | 409 | td_md5 = mhd_gtls_hash_init (MHD_GNUTLS_MAC_MD5); |
410 | if (td_md5 == NULL) | 410 | if (td_md5 == NULL) |
411 | { | 411 | { |
412 | gnutls_assert (); | 412 | gnutls_assert (); |
413 | return GNUTLS_E_HASH_FAILED; | 413 | return GNUTLS_E_HASH_FAILED; |
414 | } | 414 | } |
415 | 415 | ||
416 | _gnutls_hash (td_md5, session->security_parameters.client_random, | 416 | mhd_gnutls_hash (td_md5, session->security_parameters.client_random, |
417 | TLS_RANDOM_SIZE); | 417 | TLS_RANDOM_SIZE); |
418 | _gnutls_hash (td_md5, session->security_parameters.server_random, | 418 | mhd_gnutls_hash (td_md5, session->security_parameters.server_random, |
419 | TLS_RANDOM_SIZE); | 419 | TLS_RANDOM_SIZE); |
420 | _gnutls_hash (td_md5, params->data, params->size); | 420 | mhd_gnutls_hash (td_md5, params->data, params->size); |
421 | } | 421 | } |
422 | 422 | ||
423 | td_sha = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 423 | td_sha = mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
424 | if (td_sha == NULL) | 424 | if (td_sha == NULL) |
425 | { | 425 | { |
426 | gnutls_assert (); | 426 | gnutls_assert (); |
427 | if (td_md5) | 427 | if (td_md5) |
428 | _gnutls_hash_deinit (td_md5, NULL); | 428 | mhd_gnutls_hash_deinit (td_md5, NULL); |
429 | return GNUTLS_E_HASH_FAILED; | 429 | return GNUTLS_E_HASH_FAILED; |
430 | } | 430 | } |
431 | 431 | ||
432 | _gnutls_hash (td_sha, session->security_parameters.client_random, | 432 | mhd_gnutls_hash (td_sha, session->security_parameters.client_random, |
433 | TLS_RANDOM_SIZE); | 433 | TLS_RANDOM_SIZE); |
434 | _gnutls_hash (td_sha, session->security_parameters.server_random, | 434 | mhd_gnutls_hash (td_sha, session->security_parameters.server_random, |
435 | TLS_RANDOM_SIZE); | 435 | TLS_RANDOM_SIZE); |
436 | _gnutls_hash (td_sha, params->data, params->size); | 436 | mhd_gnutls_hash (td_sha, params->data, params->size); |
437 | 437 | ||
438 | if (ver < MHD_GNUTLS_TLS1_2) | 438 | if (ver < MHD_GNUTLS_TLS1_2) |
439 | { | 439 | { |
440 | _gnutls_hash_deinit (td_md5, concat); | 440 | mhd_gnutls_hash_deinit (td_md5, concat); |
441 | _gnutls_hash_deinit (td_sha, &concat[16]); | 441 | mhd_gnutls_hash_deinit (td_sha, &concat[16]); |
442 | dconcat.size = 36; | 442 | dconcat.size = 36; |
443 | } | 443 | } |
444 | else | 444 | else |
@@ -448,13 +448,13 @@ _gnutls_verify_sig_params (gnutls_session_t session, | |||
448 | memcpy (concat, | 448 | memcpy (concat, |
449 | "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14", | 449 | "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14", |
450 | 15); | 450 | 15); |
451 | _gnutls_hash_deinit (td_sha, &concat[15]); | 451 | mhd_gnutls_hash_deinit (td_sha, &concat[15]); |
452 | dconcat.size = 35; | 452 | dconcat.size = 35; |
453 | #else | 453 | #else |
454 | /* No parameters field. */ | 454 | /* No parameters field. */ |
455 | memcpy (concat, | 455 | memcpy (concat, |
456 | "\x30\x1f\x30\x07\x06\x05\x2b\x0e\x03\x02\x1a\x04\x14", 13); | 456 | "\x30\x1f\x30\x07\x06\x05\x2b\x0e\x03\x02\x1a\x04\x14", 13); |
457 | _gnutls_hash_deinit (td_sha, &concat[13]); | 457 | mhd_gnutls_hash_deinit (td_sha, &concat[13]); |
458 | dconcat.size = 33; | 458 | dconcat.size = 33; |
459 | #endif | 459 | #endif |
460 | } | 460 | } |
diff --git a/src/daemon/https/tls/gnutls_sig.h b/src/daemon/https/tls/gnutls_sig.h index 4d770716..b484137b 100644 --- a/src/daemon/https/tls/gnutls_sig.h +++ b/src/daemon/https/tls/gnutls_sig.h | |||
@@ -25,26 +25,26 @@ | |||
25 | #ifndef GNUTLS_SIG_H | 25 | #ifndef GNUTLS_SIG_H |
26 | # define GNUTLS_SIG_H | 26 | # define GNUTLS_SIG_H |
27 | 27 | ||
28 | int _gnutls_tls_sign_hdata (gnutls_session_t session, | 28 | int mhd_gtls_tls_sign_hdata (mhd_gtls_session_t session, |
29 | gnutls_cert * cert, | 29 | gnutls_cert * cert, |
30 | gnutls_privkey * pkey, | 30 | gnutls_privkey * pkey, |
31 | gnutls_datum_t * signature); | 31 | gnutls_datum_t * signature); |
32 | 32 | ||
33 | int _gnutls_tls_sign_params (gnutls_session_t session, | 33 | int mhd_gtls_tls_sign_params (mhd_gtls_session_t session, |
34 | gnutls_cert * cert, | 34 | gnutls_cert * cert, |
35 | gnutls_privkey * pkey, | 35 | gnutls_privkey * pkey, |
36 | gnutls_datum_t * params, | 36 | gnutls_datum_t * params, |
37 | gnutls_datum_t * signature); | 37 | gnutls_datum_t * signature); |
38 | 38 | ||
39 | int _gnutls_verify_sig_hdata (gnutls_session_t session, | 39 | int mhd_gtls_verify_sig_hdata (mhd_gtls_session_t session, |
40 | gnutls_cert * cert, gnutls_datum_t * signature); | 40 | gnutls_cert * cert, gnutls_datum_t * signature); |
41 | 41 | ||
42 | int _gnutls_verify_sig_params (gnutls_session_t session, | 42 | int mhd_gtls_verify_sig_params (mhd_gtls_session_t session, |
43 | gnutls_cert * cert, | 43 | gnutls_cert * cert, |
44 | const gnutls_datum_t * params, | 44 | const gnutls_datum_t * params, |
45 | gnutls_datum_t * signature); | 45 | gnutls_datum_t * signature); |
46 | 46 | ||
47 | int _gnutls_sign (gnutls_pk_algorithm_t algo, | 47 | int mhd_gtls_sign (gnutls_pk_algorithm_t algo, |
48 | mpi_t * params, int params_size, | 48 | mpi_t * params, int params_size, |
49 | const gnutls_datum_t * data, gnutls_datum_t * signature); | 49 | const gnutls_datum_t * data, gnutls_datum_t * signature); |
50 | 50 | ||
diff --git a/src/daemon/https/tls/gnutls_state.c b/src/daemon/https/tls/gnutls_state.c index 3931b393..bb5b8390 100644 --- a/src/daemon/https/tls/gnutls_state.c +++ b/src/daemon/https/tls/gnutls_state.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <gnutls_rsa_export.h> | 43 | #include <gnutls_rsa_export.h> |
44 | 44 | ||
45 | void | 45 | void |
46 | _gnutls_session_cert_type_set (gnutls_session_t session, | 46 | _gnutls_session_cert_type_set (mhd_gtls_session_t session, |
47 | gnutls_certificate_type_t ct) | 47 | gnutls_certificate_type_t ct) |
48 | { | 48 | { |
49 | session->security_parameters.cert_type = ct; | 49 | session->security_parameters.cert_type = ct; |
@@ -51,19 +51,19 @@ _gnutls_session_cert_type_set (gnutls_session_t session, | |||
51 | 51 | ||
52 | /** | 52 | /** |
53 | * gnutls_cipher_get - Returns the currently used cipher. | 53 | * gnutls_cipher_get - Returns the currently used cipher. |
54 | * @session: is a #gnutls_session_t structure. | 54 | * @session: is a #mhd_gtls_session_t structure. |
55 | * | 55 | * |
56 | * Returns: the currently used cipher. | 56 | * Returns: the currently used cipher. |
57 | **/ | 57 | **/ |
58 | gnutls_cipher_algorithm_t | 58 | gnutls_cipher_algorithm_t |
59 | gnutls_cipher_get (gnutls_session_t session) | 59 | gnutls_cipher_get (mhd_gtls_session_t session) |
60 | { | 60 | { |
61 | return session->security_parameters.read_bulk_cipher_algorithm; | 61 | return session->security_parameters.read_bulk_cipher_algorithm; |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * gnutls_certificate_type_get - Returns the currently used certificate type. | 65 | * gnutls_certificate_type_get - Returns the currently used certificate type. |
66 | * @session: is a #gnutls_session_t structure. | 66 | * @session: is a #mhd_gtls_session_t structure. |
67 | * | 67 | * |
68 | * The certificate type is by default X.509, unless it is negotiated | 68 | * The certificate type is by default X.509, unless it is negotiated |
69 | * as a TLS extension. | 69 | * as a TLS extension. |
@@ -72,43 +72,43 @@ gnutls_cipher_get (gnutls_session_t session) | |||
72 | * type. | 72 | * type. |
73 | **/ | 73 | **/ |
74 | gnutls_certificate_type_t | 74 | gnutls_certificate_type_t |
75 | gnutls_certificate_type_get (gnutls_session_t session) | 75 | gnutls_certificate_type_get (mhd_gtls_session_t session) |
76 | { | 76 | { |
77 | return session->security_parameters.cert_type; | 77 | return session->security_parameters.cert_type; |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * gnutls_kx_get - Returns the key exchange algorithm. | 81 | * gnutls_kx_get - Returns the key exchange algorithm. |
82 | * @session: is a #gnutls_session_t structure. | 82 | * @session: is a #mhd_gtls_session_t structure. |
83 | * | 83 | * |
84 | * Returns: the key exchange algorithm used in the last handshake. | 84 | * Returns: the key exchange algorithm used in the last handshake. |
85 | **/ | 85 | **/ |
86 | gnutls_kx_algorithm_t | 86 | gnutls_kx_algorithm_t |
87 | gnutls_kx_get (gnutls_session_t session) | 87 | gnutls_kx_get (mhd_gtls_session_t session) |
88 | { | 88 | { |
89 | return session->security_parameters.kx_algorithm; | 89 | return session->security_parameters.kx_algorithm; |
90 | } | 90 | } |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * gnutls_mac_get - Returns the currently used mac algorithm. | 93 | * gnutls_mac_get - Returns the currently used mac algorithm. |
94 | * @session: is a #gnutls_session_t structure. | 94 | * @session: is a #mhd_gtls_session_t structure. |
95 | * | 95 | * |
96 | * Returns: the currently used mac algorithm. | 96 | * Returns: the currently used mac algorithm. |
97 | **/ | 97 | **/ |
98 | gnutls_mac_algorithm_t | 98 | gnutls_mac_algorithm_t |
99 | gnutls_mac_get (gnutls_session_t session) | 99 | gnutls_mac_get (mhd_gtls_session_t session) |
100 | { | 100 | { |
101 | return session->security_parameters.read_mac_algorithm; | 101 | return session->security_parameters.read_mac_algorithm; |
102 | } | 102 | } |
103 | 103 | ||
104 | /** | 104 | /** |
105 | * gnutls_compression_get - Returns the currently used compression algorithm. | 105 | * gnutls_compression_get - Returns the currently used compression algorithm. |
106 | * @session: is a #gnutls_session_t structure. | 106 | * @session: is a #mhd_gtls_session_t structure. |
107 | * | 107 | * |
108 | * Returns: the currently used compression method. | 108 | * Returns: the currently used compression method. |
109 | **/ | 109 | **/ |
110 | gnutls_compression_method_t | 110 | gnutls_compression_method_t |
111 | gnutls_compression_get (gnutls_session_t session) | 111 | gnutls_compression_get (mhd_gtls_session_t session) |
112 | { | 112 | { |
113 | return session->security_parameters.read_compression_algorithm; | 113 | return session->security_parameters.read_compression_algorithm; |
114 | } | 114 | } |
@@ -118,17 +118,17 @@ gnutls_compression_get (gnutls_session_t session) | |||
118 | * and a matching certificate exists. | 118 | * and a matching certificate exists. |
119 | */ | 119 | */ |
120 | int | 120 | int |
121 | _gnutls_session_cert_type_supported (gnutls_session_t session, | 121 | mhd_gtls_session_cert_type_supported (mhd_gtls_session_t session, |
122 | gnutls_certificate_type_t cert_type) | 122 | gnutls_certificate_type_t cert_type) |
123 | { | 123 | { |
124 | unsigned i; | 124 | unsigned i; |
125 | unsigned cert_found = 0; | 125 | unsigned cert_found = 0; |
126 | gnutls_certificate_credentials_t cred; | 126 | mhd_gtls_cert_credentials_t cred; |
127 | 127 | ||
128 | if (session->security_parameters.entity == GNUTLS_SERVER) | 128 | if (session->security_parameters.entity == GNUTLS_SERVER) |
129 | { | 129 | { |
130 | cred | 130 | cred |
131 | = (gnutls_certificate_credentials_t) _gnutls_get_cred (session->key, | 131 | = (mhd_gtls_cert_credentials_t) mhd_gtls_get_cred (session->key, |
132 | MHD_GNUTLS_CRD_CERTIFICATE, | 132 | MHD_GNUTLS_CRD_CERTIFICATE, |
133 | NULL); | 133 | NULL); |
134 | 134 | ||
@@ -172,13 +172,13 @@ _gnutls_session_cert_type_supported (gnutls_session_t session, | |||
172 | * in a session struct. | 172 | * in a session struct. |
173 | */ | 173 | */ |
174 | inline static void | 174 | inline static void |
175 | deinit_internal_params (gnutls_session_t session) | 175 | deinit_internal_params (mhd_gtls_session_t session) |
176 | { | 176 | { |
177 | if (session->internals.params.free_dh_params) | 177 | if (session->internals.params.free_dh_params) |
178 | gnutls_dh_params_deinit (session->internals.params.dh_params); | 178 | MHD_gnutls_dh_params_deinit (session->internals.params.dh_params); |
179 | 179 | ||
180 | if (session->internals.params.free_rsa_params) | 180 | if (session->internals.params.free_rsa_params) |
181 | gnutls_rsa_params_deinit (session->internals.params.rsa_params); | 181 | MHD_gnutls_rsa_params_deinit (session->internals.params.rsa_params); |
182 | 182 | ||
183 | memset (&session->internals.params, 0, sizeof (session->internals.params)); | 183 | memset (&session->internals.params, 0, sizeof (session->internals.params)); |
184 | } | 184 | } |
@@ -188,7 +188,7 @@ deinit_internal_params (gnutls_session_t session) | |||
188 | * This is used to allow further handshakes. | 188 | * This is used to allow further handshakes. |
189 | */ | 189 | */ |
190 | void | 190 | void |
191 | _gnutls_handshake_internal_state_clear (gnutls_session_t session) | 191 | mhd_gtls_handshake_internal_state_clear (mhd_gtls_session_t session) |
192 | { | 192 | { |
193 | session->internals.extensions_sent_size = 0; | 193 | session->internals.extensions_sent_size = 0; |
194 | 194 | ||
@@ -198,7 +198,7 @@ _gnutls_handshake_internal_state_clear (gnutls_session_t session) | |||
198 | session->internals.adv_version_minor = 0; | 198 | session->internals.adv_version_minor = 0; |
199 | session->internals.v2_hello = 0; | 199 | session->internals.v2_hello = 0; |
200 | memset (&session->internals.handshake_header_buffer, 0, | 200 | memset (&session->internals.handshake_header_buffer, 0, |
201 | sizeof (handshake_header_buffer_st)); | 201 | sizeof (mhd_gtls_handshake_header_buffer_st)); |
202 | session->internals.adv_version_minor = 0; | 202 | session->internals.adv_version_minor = 0; |
203 | session->internals.adv_version_minor = 0; | 203 | session->internals.adv_version_minor = 0; |
204 | session->internals.direction = 0; | 204 | session->internals.direction = 0; |
@@ -218,14 +218,14 @@ _gnutls_handshake_internal_state_clear (gnutls_session_t session) | |||
218 | 218 | ||
219 | #define MIN_DH_BITS 727 | 219 | #define MIN_DH_BITS 727 |
220 | /** | 220 | /** |
221 | * gnutls_init - This function initializes the session to null (null encryption etc...). | 221 | * MHD_gnutls_init - This function initializes the session to null (null encryption etc...). |
222 | * @con_end: indicate if this session is to be used for server or client. | 222 | * @con_end: indicate if this session is to be used for server or client. |
223 | * @session: is a pointer to a #gnutls_session_t structure. | 223 | * @session: is a pointer to a #mhd_gtls_session_t structure. |
224 | * | 224 | * |
225 | * This function initializes the current session to null. Every | 225 | * This function initializes the current session to null. Every |
226 | * session must be initialized before use, so internal structures can | 226 | * session must be initialized before use, so internal structures can |
227 | * be allocated. This function allocates structures which can only | 227 | * be allocated. This function allocates structures which can only |
228 | * be free'd by calling gnutls_deinit(). Returns zero on success. | 228 | * be free'd by calling MHD_gnutls_deinit(). Returns zero on success. |
229 | * | 229 | * |
230 | * @con_end can be one of %GNUTLS_CLIENT and %GNUTLS_SERVER. | 230 | * @con_end can be one of %GNUTLS_CLIENT and %GNUTLS_SERVER. |
231 | * | 231 | * |
@@ -234,9 +234,9 @@ _gnutls_handshake_internal_state_clear (gnutls_session_t session) | |||
234 | 234 | ||
235 | /* TODO rm redundent pointer ref */ | 235 | /* TODO rm redundent pointer ref */ |
236 | int | 236 | int |
237 | gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end) | 237 | MHD_gnutls_init (mhd_gtls_session_t * session, gnutls_connection_end_t con_end) |
238 | { | 238 | { |
239 | *session = gnutls_calloc (1, sizeof (struct gnutls_session_int)); | 239 | *session = gnutls_calloc (1, sizeof (struct MHD_gtls_session_int)); |
240 | if (*session == NULL) | 240 | if (*session == NULL) |
241 | return GNUTLS_E_MEMORY_ERROR; | 241 | return GNUTLS_E_MEMORY_ERROR; |
242 | 242 | ||
@@ -261,18 +261,18 @@ gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end) | |||
261 | (*session)->internals.enable_private = 0; | 261 | (*session)->internals.enable_private = 0; |
262 | 262 | ||
263 | /* Initialize buffers */ | 263 | /* Initialize buffers */ |
264 | _gnutls_buffer_init (&(*session)->internals.application_data_buffer); | 264 | mhd_gtls_buffer_init (&(*session)->internals.application_data_buffer); |
265 | _gnutls_buffer_init (&(*session)->internals.handshake_data_buffer); | 265 | mhd_gtls_buffer_init (&(*session)->internals.handshake_data_buffer); |
266 | _gnutls_buffer_init (&(*session)->internals.handshake_hash_buffer); | 266 | mhd_gtls_buffer_init (&(*session)->internals.handshake_hash_buffer); |
267 | _gnutls_buffer_init (&(*session)->internals.ia_data_buffer); | 267 | mhd_gtls_buffer_init (&(*session)->internals.ia_data_buffer); |
268 | 268 | ||
269 | _gnutls_buffer_init (&(*session)->internals.record_send_buffer); | 269 | mhd_gtls_buffer_init (&(*session)->internals.record_send_buffer); |
270 | _gnutls_buffer_init (&(*session)->internals.record_recv_buffer); | 270 | mhd_gtls_buffer_init (&(*session)->internals.record_recv_buffer); |
271 | 271 | ||
272 | _gnutls_buffer_init (&(*session)->internals.handshake_send_buffer); | 272 | mhd_gtls_buffer_init (&(*session)->internals.handshake_send_buffer); |
273 | _gnutls_buffer_init (&(*session)->internals.handshake_recv_buffer); | 273 | mhd_gtls_buffer_init (&(*session)->internals.handshake_recv_buffer); |
274 | 274 | ||
275 | (*session)->key = gnutls_calloc (1, sizeof (struct gnutls_key_st)); | 275 | (*session)->key = gnutls_calloc (1, sizeof (struct mhd_gtls_key)); |
276 | if ((*session)->key == NULL) | 276 | if ((*session)->key == NULL) |
277 | { | 277 | { |
278 | cleanup_session:gnutls_free (*session); | 278 | cleanup_session:gnutls_free (*session); |
@@ -282,11 +282,11 @@ gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end) | |||
282 | 282 | ||
283 | (*session)->internals.expire_time = DEFAULT_EXPIRE_TIME; /* one hour default */ | 283 | (*session)->internals.expire_time = DEFAULT_EXPIRE_TIME; /* one hour default */ |
284 | 284 | ||
285 | gnutls_dh_set_prime_bits ((*session), MIN_DH_BITS); | 285 | MHD_gnutls_dh_set_prime_bits ((*session), MIN_DH_BITS); |
286 | 286 | ||
287 | gnutls_transport_set_lowat ((*session), DEFAULT_LOWAT); /* the default for tcp */ | 287 | MHD_gnutls_transport_set_lowat ((*session), DEFAULT_LOWAT); /* the default for tcp */ |
288 | 288 | ||
289 | gnutls_handshake_set_max_packet_length ((*session), | 289 | MHD_gnutls_handshake_set_max_packet_length ((*session), |
290 | MAX_HANDSHAKE_PACKET_SIZE); | 290 | MAX_HANDSHAKE_PACKET_SIZE); |
291 | 291 | ||
292 | /* Allocate a minimum size for recv_data | 292 | /* Allocate a minimum size for recv_data |
@@ -316,7 +316,7 @@ gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end) | |||
316 | * as NULL or 0. This is why calloc is used. | 316 | * as NULL or 0. This is why calloc is used. |
317 | */ | 317 | */ |
318 | 318 | ||
319 | _gnutls_handshake_internal_state_clear (*session); | 319 | mhd_gtls_handshake_internal_state_clear (*session); |
320 | 320 | ||
321 | return 0; | 321 | return 0; |
322 | } | 322 | } |
@@ -324,54 +324,54 @@ gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end) | |||
324 | /* returns RESUME_FALSE or RESUME_TRUE. | 324 | /* returns RESUME_FALSE or RESUME_TRUE. |
325 | */ | 325 | */ |
326 | int | 326 | int |
327 | _gnutls_session_is_resumable (gnutls_session_t session) | 327 | mhd_gtls_session_is_resumable (mhd_gtls_session_t session) |
328 | { | 328 | { |
329 | return session->internals.resumable; | 329 | return session->internals.resumable; |
330 | } | 330 | } |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * gnutls_deinit - This function clears all buffers associated with a session | 333 | * MHD_gnutls_deinit - This function clears all buffers associated with a session |
334 | * @session: is a #gnutls_session_t structure. | 334 | * @session: is a #mhd_gtls_session_t structure. |
335 | * | 335 | * |
336 | * This function clears all buffers associated with the @session. | 336 | * This function clears all buffers associated with the @session. |
337 | * This function will also remove session data from the session | 337 | * This function will also remove session data from the session |
338 | * database if the session was terminated abnormally. | 338 | * database if the session was terminated abnormally. |
339 | **/ | 339 | **/ |
340 | void | 340 | void |
341 | gnutls_deinit (gnutls_session_t session) | 341 | MHD_gnutls_deinit (mhd_gtls_session_t session) |
342 | { | 342 | { |
343 | 343 | ||
344 | if (session == NULL) | 344 | if (session == NULL) |
345 | return; | 345 | return; |
346 | 346 | ||
347 | /* remove auth info firstly */ | 347 | /* remove auth info firstly */ |
348 | _gnutls_free_auth_info (session); | 348 | mhd_gtls_free_auth_info (session); |
349 | 349 | ||
350 | _gnutls_handshake_internal_state_clear (session); | 350 | mhd_gtls_handshake_internal_state_clear (session); |
351 | _gnutls_handshake_io_buffer_clear (session); | 351 | _gnutls_handshake_io_buffer_clear (session); |
352 | 352 | ||
353 | _gnutls_free_datum (&session->connection_state.read_mac_secret); | 353 | _gnutls_free_datum (&session->connection_state.read_mac_secret); |
354 | _gnutls_free_datum (&session->connection_state.write_mac_secret); | 354 | _gnutls_free_datum (&session->connection_state.write_mac_secret); |
355 | 355 | ||
356 | _gnutls_buffer_clear (&session->internals.ia_data_buffer); | 356 | mhd_gtls_buffer_clear (&session->internals.ia_data_buffer); |
357 | _gnutls_buffer_clear (&session->internals.handshake_hash_buffer); | 357 | mhd_gtls_buffer_clear (&session->internals.handshake_hash_buffer); |
358 | _gnutls_buffer_clear (&session->internals.handshake_data_buffer); | 358 | mhd_gtls_buffer_clear (&session->internals.handshake_data_buffer); |
359 | _gnutls_buffer_clear (&session->internals.application_data_buffer); | 359 | mhd_gtls_buffer_clear (&session->internals.application_data_buffer); |
360 | _gnutls_buffer_clear (&session->internals.record_recv_buffer); | 360 | mhd_gtls_buffer_clear (&session->internals.record_recv_buffer); |
361 | _gnutls_buffer_clear (&session->internals.record_send_buffer); | 361 | mhd_gtls_buffer_clear (&session->internals.record_send_buffer); |
362 | 362 | ||
363 | gnutls_credentials_clear (session); | 363 | MHD_gnutls_credentials_clear (session); |
364 | _gnutls_selected_certs_deinit (session); | 364 | mhd_gtls_selected_certs_deinit (session); |
365 | 365 | ||
366 | if (session->connection_state.read_cipher_state != NULL) | 366 | if (session->connection_state.read_cipher_state != NULL) |
367 | _gnutls_cipher_deinit (session->connection_state.read_cipher_state); | 367 | mhd_gnutls_cipher_deinit (session->connection_state.read_cipher_state); |
368 | if (session->connection_state.write_cipher_state != NULL) | 368 | if (session->connection_state.write_cipher_state != NULL) |
369 | _gnutls_cipher_deinit (session->connection_state.write_cipher_state); | 369 | mhd_gnutls_cipher_deinit (session->connection_state.write_cipher_state); |
370 | 370 | ||
371 | if (session->connection_state.read_compression_state != NULL) | 371 | if (session->connection_state.read_compression_state != NULL) |
372 | _gnutls_comp_deinit (session->connection_state.read_compression_state, 1); | 372 | mhd_gtls_comp_deinit (session->connection_state.read_compression_state, 1); |
373 | if (session->connection_state.write_compression_state != NULL) | 373 | if (session->connection_state.write_compression_state != NULL) |
374 | _gnutls_comp_deinit (session->connection_state. | 374 | mhd_gtls_comp_deinit (session->connection_state. |
375 | write_compression_state, 0); | 375 | write_compression_state, 0); |
376 | 376 | ||
377 | _gnutls_free_datum (&session->cipher_specs.server_write_mac_secret); | 377 | _gnutls_free_datum (&session->cipher_specs.server_write_mac_secret); |
@@ -383,23 +383,23 @@ gnutls_deinit (gnutls_session_t session) | |||
383 | 383 | ||
384 | if (session->key != NULL) | 384 | if (session->key != NULL) |
385 | { | 385 | { |
386 | _gnutls_mpi_release (&session->key->KEY); | 386 | mhd_gtls_mpi_release (&session->key->KEY); |
387 | _gnutls_mpi_release (&session->key->client_Y); | 387 | mhd_gtls_mpi_release (&session->key->client_Y); |
388 | _gnutls_mpi_release (&session->key->client_p); | 388 | mhd_gtls_mpi_release (&session->key->client_p); |
389 | _gnutls_mpi_release (&session->key->client_g); | 389 | mhd_gtls_mpi_release (&session->key->client_g); |
390 | 390 | ||
391 | _gnutls_mpi_release (&session->key->u); | 391 | mhd_gtls_mpi_release (&session->key->u); |
392 | _gnutls_mpi_release (&session->key->a); | 392 | mhd_gtls_mpi_release (&session->key->a); |
393 | _gnutls_mpi_release (&session->key->x); | 393 | mhd_gtls_mpi_release (&session->key->x); |
394 | _gnutls_mpi_release (&session->key->A); | 394 | mhd_gtls_mpi_release (&session->key->A); |
395 | _gnutls_mpi_release (&session->key->B); | 395 | mhd_gtls_mpi_release (&session->key->B); |
396 | _gnutls_mpi_release (&session->key->b); | 396 | mhd_gtls_mpi_release (&session->key->b); |
397 | 397 | ||
398 | /* RSA */ | 398 | /* RSA */ |
399 | _gnutls_mpi_release (&session->key->rsa[0]); | 399 | mhd_gtls_mpi_release (&session->key->rsa[0]); |
400 | _gnutls_mpi_release (&session->key->rsa[1]); | 400 | mhd_gtls_mpi_release (&session->key->rsa[1]); |
401 | 401 | ||
402 | _gnutls_mpi_release (&session->key->dh_secret); | 402 | mhd_gtls_mpi_release (&session->key->dh_secret); |
403 | gnutls_free (session->key); | 403 | gnutls_free (session->key); |
404 | 404 | ||
405 | session->key = NULL; | 405 | session->key = NULL; |
@@ -414,30 +414,30 @@ gnutls_deinit (gnutls_session_t session) | |||
414 | gnutls_free (session->internals.srp_password); | 414 | gnutls_free (session->internals.srp_password); |
415 | } | 415 | } |
416 | 416 | ||
417 | memset (session, 0, sizeof (struct gnutls_session_int)); | 417 | memset (session, 0, sizeof (struct MHD_gtls_session_int)); |
418 | gnutls_free (session); | 418 | gnutls_free (session); |
419 | } | 419 | } |
420 | 420 | ||
421 | /* Returns the minimum prime bits that are acceptable. | 421 | /* Returns the minimum prime bits that are acceptable. |
422 | */ | 422 | */ |
423 | int | 423 | int |
424 | _gnutls_dh_get_allowed_prime_bits (gnutls_session_t session) | 424 | mhd_gtls_dh_get_allowed_prime_bits (mhd_gtls_session_t session) |
425 | { | 425 | { |
426 | return session->internals.dh_prime_bits; | 426 | return session->internals.dh_prime_bits; |
427 | } | 427 | } |
428 | 428 | ||
429 | int | 429 | int |
430 | _gnutls_dh_set_peer_public (gnutls_session_t session, mpi_t public) | 430 | mhd_gtls_dh_set_peer_public (mhd_gtls_session_t session, mpi_t public) |
431 | { | 431 | { |
432 | dh_info_st *dh; | 432 | dh_info_st *dh; |
433 | int ret; | 433 | int ret; |
434 | 434 | ||
435 | switch (gnutls_auth_get_type (session)) | 435 | switch (MHD_gtls_auth_get_type (session)) |
436 | { | 436 | { |
437 | case MHD_GNUTLS_CRD_ANON: | 437 | case MHD_GNUTLS_CRD_ANON: |
438 | { | 438 | { |
439 | anon_auth_info_t info; | 439 | mhd_anon_auth_info_t info; |
440 | info = _gnutls_get_auth_info (session); | 440 | info = mhd_gtls_get_auth_info (session); |
441 | if (info == NULL) | 441 | if (info == NULL) |
442 | return GNUTLS_E_INTERNAL_ERROR; | 442 | return GNUTLS_E_INTERNAL_ERROR; |
443 | 443 | ||
@@ -448,7 +448,7 @@ _gnutls_dh_set_peer_public (gnutls_session_t session, mpi_t public) | |||
448 | { | 448 | { |
449 | cert_auth_info_t info; | 449 | cert_auth_info_t info; |
450 | 450 | ||
451 | info = _gnutls_get_auth_info (session); | 451 | info = mhd_gtls_get_auth_info (session); |
452 | if (info == NULL) | 452 | if (info == NULL) |
453 | return GNUTLS_E_INTERNAL_ERROR; | 453 | return GNUTLS_E_INTERNAL_ERROR; |
454 | 454 | ||
@@ -460,7 +460,7 @@ _gnutls_dh_set_peer_public (gnutls_session_t session, mpi_t public) | |||
460 | return GNUTLS_E_INTERNAL_ERROR; | 460 | return GNUTLS_E_INTERNAL_ERROR; |
461 | } | 461 | } |
462 | 462 | ||
463 | ret = _gnutls_mpi_dprint_lz (&dh->public_key, public); | 463 | ret = mhd_gtls_mpi_dprint_lz (&dh->public_key, public); |
464 | if (ret < 0) | 464 | if (ret < 0) |
465 | { | 465 | { |
466 | gnutls_assert (); | 466 | gnutls_assert (); |
@@ -471,14 +471,14 @@ _gnutls_dh_set_peer_public (gnutls_session_t session, mpi_t public) | |||
471 | } | 471 | } |
472 | 472 | ||
473 | int | 473 | int |
474 | _gnutls_dh_set_secret_bits (gnutls_session_t session, unsigned bits) | 474 | mhd_gtls_dh_set_secret_bits (mhd_gtls_session_t session, unsigned bits) |
475 | { | 475 | { |
476 | switch (gnutls_auth_get_type (session)) | 476 | switch (MHD_gtls_auth_get_type (session)) |
477 | { | 477 | { |
478 | case MHD_GNUTLS_CRD_ANON: | 478 | case MHD_GNUTLS_CRD_ANON: |
479 | { | 479 | { |
480 | anon_auth_info_t info; | 480 | mhd_anon_auth_info_t info; |
481 | info = _gnutls_get_auth_info (session); | 481 | info = mhd_gtls_get_auth_info (session); |
482 | if (info == NULL) | 482 | if (info == NULL) |
483 | return GNUTLS_E_INTERNAL_ERROR; | 483 | return GNUTLS_E_INTERNAL_ERROR; |
484 | info->dh.secret_bits = bits; | 484 | info->dh.secret_bits = bits; |
@@ -488,7 +488,7 @@ _gnutls_dh_set_secret_bits (gnutls_session_t session, unsigned bits) | |||
488 | { | 488 | { |
489 | cert_auth_info_t info; | 489 | cert_auth_info_t info; |
490 | 490 | ||
491 | info = _gnutls_get_auth_info (session); | 491 | info = mhd_gtls_get_auth_info (session); |
492 | if (info == NULL) | 492 | if (info == NULL) |
493 | return GNUTLS_E_INTERNAL_ERROR; | 493 | return GNUTLS_E_INTERNAL_ERROR; |
494 | 494 | ||
@@ -507,24 +507,24 @@ _gnutls_dh_set_secret_bits (gnutls_session_t session, unsigned bits) | |||
507 | * RSA exponent and the modulus. | 507 | * RSA exponent and the modulus. |
508 | */ | 508 | */ |
509 | int | 509 | int |
510 | _gnutls_rsa_export_set_pubkey (gnutls_session_t session, | 510 | mhd_gtls_rsa_export_set_pubkey (mhd_gtls_session_t session, |
511 | mpi_t exponent, mpi_t modulus) | 511 | mpi_t exponent, mpi_t modulus) |
512 | { | 512 | { |
513 | cert_auth_info_t info; | 513 | cert_auth_info_t info; |
514 | int ret; | 514 | int ret; |
515 | 515 | ||
516 | info = _gnutls_get_auth_info (session); | 516 | info = mhd_gtls_get_auth_info (session); |
517 | if (info == NULL) | 517 | if (info == NULL) |
518 | return GNUTLS_E_INTERNAL_ERROR; | 518 | return GNUTLS_E_INTERNAL_ERROR; |
519 | 519 | ||
520 | ret = _gnutls_mpi_dprint_lz (&info->rsa_export.modulus, modulus); | 520 | ret = mhd_gtls_mpi_dprint_lz (&info->rsa_export.modulus, modulus); |
521 | if (ret < 0) | 521 | if (ret < 0) |
522 | { | 522 | { |
523 | gnutls_assert (); | 523 | gnutls_assert (); |
524 | return ret; | 524 | return ret; |
525 | } | 525 | } |
526 | 526 | ||
527 | ret = _gnutls_mpi_dprint_lz (&info->rsa_export.exponent, exponent); | 527 | ret = mhd_gtls_mpi_dprint_lz (&info->rsa_export.exponent, exponent); |
528 | if (ret < 0) | 528 | if (ret < 0) |
529 | { | 529 | { |
530 | gnutls_assert (); | 530 | gnutls_assert (); |
@@ -538,17 +538,17 @@ _gnutls_rsa_export_set_pubkey (gnutls_session_t session, | |||
538 | /* Sets the prime and the generator in the auth info structure. | 538 | /* Sets the prime and the generator in the auth info structure. |
539 | */ | 539 | */ |
540 | int | 540 | int |
541 | _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) | 541 | mhd_gtls_dh_set_group (mhd_gtls_session_t session, mpi_t gen, mpi_t prime) |
542 | { | 542 | { |
543 | dh_info_st *dh; | 543 | dh_info_st *dh; |
544 | int ret; | 544 | int ret; |
545 | 545 | ||
546 | switch (gnutls_auth_get_type (session)) | 546 | switch (MHD_gtls_auth_get_type (session)) |
547 | { | 547 | { |
548 | case MHD_GNUTLS_CRD_ANON: | 548 | case MHD_GNUTLS_CRD_ANON: |
549 | { | 549 | { |
550 | anon_auth_info_t info; | 550 | mhd_anon_auth_info_t info; |
551 | info = _gnutls_get_auth_info (session); | 551 | info = mhd_gtls_get_auth_info (session); |
552 | if (info == NULL) | 552 | if (info == NULL) |
553 | return GNUTLS_E_INTERNAL_ERROR; | 553 | return GNUTLS_E_INTERNAL_ERROR; |
554 | 554 | ||
@@ -559,7 +559,7 @@ _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) | |||
559 | { | 559 | { |
560 | cert_auth_info_t info; | 560 | cert_auth_info_t info; |
561 | 561 | ||
562 | info = _gnutls_get_auth_info (session); | 562 | info = mhd_gtls_get_auth_info (session); |
563 | if (info == NULL) | 563 | if (info == NULL) |
564 | return GNUTLS_E_INTERNAL_ERROR; | 564 | return GNUTLS_E_INTERNAL_ERROR; |
565 | 565 | ||
@@ -573,7 +573,7 @@ _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) | |||
573 | 573 | ||
574 | /* prime | 574 | /* prime |
575 | */ | 575 | */ |
576 | ret = _gnutls_mpi_dprint_lz (&dh->prime, prime); | 576 | ret = mhd_gtls_mpi_dprint_lz (&dh->prime, prime); |
577 | if (ret < 0) | 577 | if (ret < 0) |
578 | { | 578 | { |
579 | gnutls_assert (); | 579 | gnutls_assert (); |
@@ -582,7 +582,7 @@ _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) | |||
582 | 582 | ||
583 | /* generator | 583 | /* generator |
584 | */ | 584 | */ |
585 | ret = _gnutls_mpi_dprint_lz (&dh->generator, gen); | 585 | ret = mhd_gtls_mpi_dprint_lz (&dh->generator, gen); |
586 | if (ret < 0) | 586 | if (ret < 0) |
587 | { | 587 | { |
588 | gnutls_assert (); | 588 | gnutls_assert (); |
@@ -594,8 +594,8 @@ _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) | |||
594 | } | 594 | } |
595 | 595 | ||
596 | /** | 596 | /** |
597 | * gnutls_openpgp_send_cert - This function will order gnutls to send the openpgp fingerprint instead of the key | 597 | * MHD_gtls_openpgp_send_cert - This function will order gnutls to send the openpgp fingerprint instead of the key |
598 | * @session: is a pointer to a #gnutls_session_t structure. | 598 | * @session: is a pointer to a #mhd_gtls_session_t structure. |
599 | * @status: is one of GNUTLS_OPENPGP_CERT, or GNUTLS_OPENPGP_CERT_FINGERPRINT | 599 | * @status: is one of GNUTLS_OPENPGP_CERT, or GNUTLS_OPENPGP_CERT_FINGERPRINT |
600 | * | 600 | * |
601 | * This function will order gnutls to send the key fingerprint | 601 | * This function will order gnutls to send the key fingerprint |
@@ -604,15 +604,15 @@ _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) | |||
604 | * that the server can obtain the client's key. | 604 | * that the server can obtain the client's key. |
605 | **/ | 605 | **/ |
606 | void | 606 | void |
607 | gnutls_openpgp_send_cert (gnutls_session_t session, | 607 | MHD_gtls_openpgp_send_cert (mhd_gtls_session_t session, |
608 | gnutls_openpgp_crt_status_t status) | 608 | gnutls_openpgp_crt_status_t status) |
609 | { | 609 | { |
610 | session->internals.pgp_fingerprint = status; | 610 | session->internals.pgp_fingerprint = status; |
611 | } | 611 | } |
612 | 612 | ||
613 | /** | 613 | /** |
614 | * gnutls_certificate_send_x509_rdn_sequence - This function will order gnutls to send or not the x.509 rdn sequence | 614 | * MHD_gnutls_certificate_send_x509_rdn_sequence - This function will order gnutls to send or not the x.509 rdn sequence |
615 | * @session: is a pointer to a #gnutls_session_t structure. | 615 | * @session: is a pointer to a #mhd_gtls_session_t structure. |
616 | * @status: is 0 or 1 | 616 | * @status: is 0 or 1 |
617 | * | 617 | * |
618 | * If status is non zero, this function will order gnutls not to send | 618 | * If status is non zero, this function will order gnutls not to send |
@@ -625,21 +625,21 @@ gnutls_openpgp_send_cert (gnutls_session_t session, | |||
625 | * methods other than certificate with X.509 certificates. | 625 | * methods other than certificate with X.509 certificates. |
626 | **/ | 626 | **/ |
627 | void | 627 | void |
628 | gnutls_certificate_send_x509_rdn_sequence (gnutls_session_t session, | 628 | MHD_gnutls_certificate_send_x509_rdn_sequence (mhd_gtls_session_t session, |
629 | int status) | 629 | int status) |
630 | { | 630 | { |
631 | session->internals.ignore_rdn_sequence = status; | 631 | session->internals.ignore_rdn_sequence = status; |
632 | } | 632 | } |
633 | 633 | ||
634 | int | 634 | int |
635 | _gnutls_openpgp_send_fingerprint (gnutls_session_t session) | 635 | mhd_gtls_openpgp_send_fingerprint (mhd_gtls_session_t session) |
636 | { | 636 | { |
637 | return session->internals.pgp_fingerprint; | 637 | return session->internals.pgp_fingerprint; |
638 | } | 638 | } |
639 | 639 | ||
640 | /*- | 640 | /*- |
641 | * _gnutls_record_set_default_version - Used to set the default version for the first record packet | 641 | * _gnutls_record_set_default_version - Used to set the default version for the first record packet |
642 | * @session: is a #gnutls_session_t structure. | 642 | * @session: is a #mhd_gtls_session_t structure. |
643 | * @major: is a tls major version | 643 | * @major: is a tls major version |
644 | * @minor: is a tls minor version | 644 | * @minor: is a tls minor version |
645 | * | 645 | * |
@@ -649,7 +649,7 @@ _gnutls_openpgp_send_fingerprint (gnutls_session_t session) | |||
649 | * | 649 | * |
650 | -*/ | 650 | -*/ |
651 | void | 651 | void |
652 | _gnutls_record_set_default_version (gnutls_session_t session, | 652 | _gnutls_record_set_default_version (mhd_gtls_session_t session, |
653 | unsigned char major, unsigned char minor) | 653 | unsigned char major, unsigned char minor) |
654 | { | 654 | { |
655 | session->internals.default_record_version[0] = major; | 655 | session->internals.default_record_version[0] = major; |
@@ -657,8 +657,8 @@ _gnutls_record_set_default_version (gnutls_session_t session, | |||
657 | } | 657 | } |
658 | 658 | ||
659 | /** | 659 | /** |
660 | * gnutls_handshake_set_private_extensions - Used to enable the private cipher suites | 660 | * MHD_gtls_handshake_set_private_extensions - Used to enable the private cipher suites |
661 | * @session: is a #gnutls_session_t structure. | 661 | * @session: is a #mhd_gtls_session_t structure. |
662 | * @allow: is an integer (0 or 1) | 662 | * @allow: is an integer (0 or 1) |
663 | * | 663 | * |
664 | * This function will enable or disable the use of private cipher | 664 | * This function will enable or disable the use of private cipher |
@@ -673,7 +673,7 @@ _gnutls_record_set_default_version (gnutls_session_t session, | |||
673 | * gnutls servers and clients may cause interoperability problems. | 673 | * gnutls servers and clients may cause interoperability problems. |
674 | **/ | 674 | **/ |
675 | void | 675 | void |
676 | gnutls_handshake_set_private_extensions (gnutls_session_t session, int allow) | 676 | MHD_gtls_handshake_set_private_extensions (mhd_gtls_session_t session, int allow) |
677 | { | 677 | { |
678 | session->internals.enable_private = allow; | 678 | session->internals.enable_private = allow; |
679 | } | 679 | } |
@@ -686,15 +686,15 @@ _gnutls_cal_PRF_A (gnutls_mac_algorithm_t algorithm, | |||
686 | { | 686 | { |
687 | mac_hd_t td1; | 687 | mac_hd_t td1; |
688 | 688 | ||
689 | td1 = _gnutls_hmac_init (algorithm, secret, secret_size); | 689 | td1 = mhd_gtls_hmac_init (algorithm, secret, secret_size); |
690 | if (td1 == GNUTLS_MAC_FAILED) | 690 | if (td1 == GNUTLS_MAC_FAILED) |
691 | { | 691 | { |
692 | gnutls_assert (); | 692 | gnutls_assert (); |
693 | return GNUTLS_E_INTERNAL_ERROR; | 693 | return GNUTLS_E_INTERNAL_ERROR; |
694 | } | 694 | } |
695 | 695 | ||
696 | _gnutls_hmac (td1, seed, seed_size); | 696 | mhd_gnutls_hash (td1, seed, seed_size); |
697 | _gnutls_hmac_deinit (td1, result); | 697 | mhd_gnutls_hmac_deinit (td1, result); |
698 | 698 | ||
699 | return 0; | 699 | return 0; |
700 | } | 700 | } |
@@ -723,7 +723,7 @@ _gnutls_P_hash (gnutls_mac_algorithm_t algorithm, | |||
723 | return GNUTLS_E_INTERNAL_ERROR; | 723 | return GNUTLS_E_INTERNAL_ERROR; |
724 | } | 724 | } |
725 | 725 | ||
726 | blocksize = _gnutls_hmac_get_algo_len (algorithm); | 726 | blocksize = mhd_gnutls_hash_get_algo_len (algorithm); |
727 | 727 | ||
728 | output_bytes = 0; | 728 | output_bytes = 0; |
729 | do | 729 | do |
@@ -741,7 +741,7 @@ _gnutls_P_hash (gnutls_mac_algorithm_t algorithm, | |||
741 | 741 | ||
742 | for (i = 0; i < times; i++) | 742 | for (i = 0; i < times; i++) |
743 | { | 743 | { |
744 | td2 = _gnutls_hmac_init (algorithm, secret, secret_size); | 744 | td2 = mhd_gtls_hmac_init (algorithm, secret, secret_size); |
745 | if (td2 == GNUTLS_MAC_FAILED) | 745 | if (td2 == GNUTLS_MAC_FAILED) |
746 | { | 746 | { |
747 | gnutls_assert (); | 747 | gnutls_assert (); |
@@ -753,15 +753,15 @@ _gnutls_P_hash (gnutls_mac_algorithm_t algorithm, | |||
753 | A_size, Atmp)) < 0) | 753 | A_size, Atmp)) < 0) |
754 | { | 754 | { |
755 | gnutls_assert (); | 755 | gnutls_assert (); |
756 | _gnutls_hmac_deinit (td2, final); | 756 | mhd_gnutls_hmac_deinit (td2, final); |
757 | return result; | 757 | return result; |
758 | } | 758 | } |
759 | 759 | ||
760 | A_size = blocksize; | 760 | A_size = blocksize; |
761 | 761 | ||
762 | _gnutls_hmac (td2, Atmp, A_size); | 762 | mhd_gnutls_hash (td2, Atmp, A_size); |
763 | _gnutls_hmac (td2, seed, seed_size); | 763 | mhd_gnutls_hash (td2, seed, seed_size); |
764 | _gnutls_hmac_deinit (td2, final); | 764 | mhd_gnutls_hmac_deinit (td2, final); |
765 | 765 | ||
766 | if ((1 + i) * blocksize < total_bytes) | 766 | if ((1 + i) * blocksize < total_bytes) |
767 | { | 767 | { |
@@ -800,7 +800,7 @@ _gnutls_xor (opaque * o1, opaque * o2, int length) | |||
800 | * available. | 800 | * available. |
801 | */ | 801 | */ |
802 | int | 802 | int |
803 | _gnutls_PRF (gnutls_session_t session, | 803 | mhd_gtls_PRF (mhd_gtls_session_t session, |
804 | const opaque * secret, | 804 | const opaque * secret, |
805 | int secret_size, | 805 | int secret_size, |
806 | const char *label, | 806 | const char *label, |
@@ -812,7 +812,7 @@ _gnutls_PRF (gnutls_session_t session, | |||
812 | opaque s_seed[MAX_SEED_SIZE]; | 812 | opaque s_seed[MAX_SEED_SIZE]; |
813 | opaque o1[MAX_PRF_BYTES], o2[MAX_PRF_BYTES]; | 813 | opaque o1[MAX_PRF_BYTES], o2[MAX_PRF_BYTES]; |
814 | int result; | 814 | int result; |
815 | gnutls_protocol_t ver = gnutls_protocol_get_version (session); | 815 | gnutls_protocol_t ver = MHD_gnutls_protocol_get_version (session); |
816 | 816 | ||
817 | if (total_bytes > MAX_PRF_BYTES) | 817 | if (total_bytes > MAX_PRF_BYTES) |
818 | { | 818 | { |
@@ -882,8 +882,8 @@ _gnutls_PRF (gnutls_session_t session, | |||
882 | } | 882 | } |
883 | 883 | ||
884 | /** | 884 | /** |
885 | * gnutls_prf_raw - access the TLS PRF directly | 885 | * MHD_gnutls_prf_raw - access the TLS PRF directly |
886 | * @session: is a #gnutls_session_t structure. | 886 | * @session: is a #mhd_gtls_session_t structure. |
887 | * @label_size: length of the @label variable. | 887 | * @label_size: length of the @label variable. |
888 | * @label: label used in PRF computation, typically a short string. | 888 | * @label: label used in PRF computation, typically a short string. |
889 | * @seed_size: length of the @seed variable. | 889 | * @seed_size: length of the @seed variable. |
@@ -904,21 +904,21 @@ _gnutls_PRF (gnutls_session_t session, | |||
904 | * session unless @seed include the client random and server random | 904 | * session unless @seed include the client random and server random |
905 | * fields (the PRF would output the same data on another connection | 905 | * fields (the PRF would output the same data on another connection |
906 | * resumed from the first one), it is not recommended to use this | 906 | * resumed from the first one), it is not recommended to use this |
907 | * function directly. The gnutls_prf() function seed the PRF with the | 907 | * function directly. The MHD_gnutls_prf() function seed the PRF with the |
908 | * client and server random fields directly, and is recommended if you | 908 | * client and server random fields directly, and is recommended if you |
909 | * want to generate pseudo random data unique for each session. | 909 | * want to generate pseudo random data unique for each session. |
910 | * | 910 | * |
911 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 911 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
912 | **/ | 912 | **/ |
913 | int | 913 | int |
914 | gnutls_prf_raw (gnutls_session_t session, | 914 | MHD_gnutls_prf_raw (mhd_gtls_session_t session, |
915 | size_t label_size, | 915 | size_t label_size, |
916 | const char *label, | 916 | const char *label, |
917 | size_t seed_size, const char *seed, size_t outsize, char *out) | 917 | size_t seed_size, const char *seed, size_t outsize, char *out) |
918 | { | 918 | { |
919 | int ret; | 919 | int ret; |
920 | 920 | ||
921 | ret = _gnutls_PRF (session, session->security_parameters.master_secret, | 921 | ret = mhd_gtls_PRF (session, session->security_parameters.master_secret, |
922 | TLS_MASTER_SIZE, label, label_size, (opaque *) seed, | 922 | TLS_MASTER_SIZE, label, label_size, (opaque *) seed, |
923 | seed_size, outsize, out); | 923 | seed_size, outsize, out); |
924 | 924 | ||
@@ -926,8 +926,8 @@ gnutls_prf_raw (gnutls_session_t session, | |||
926 | } | 926 | } |
927 | 927 | ||
928 | /** | 928 | /** |
929 | * gnutls_prf - derive pseudo-random data using the TLS PRF | 929 | * MHD_gnutls_prf - derive pseudo-random data using the TLS PRF |
930 | * @session: is a #gnutls_session_t structure. | 930 | * @session: is a #mhd_gtls_session_t structure. |
931 | * @label_size: length of the @label variable. | 931 | * @label_size: length of the @label variable. |
932 | * @label: label used in PRF computation, typically a short string. | 932 | * @label: label used in PRF computation, typically a short string. |
933 | * @server_random_first: non-0 if server random field should be first in seed | 933 | * @server_random_first: non-0 if server random field should be first in seed |
@@ -955,7 +955,7 @@ gnutls_prf_raw (gnutls_session_t session, | |||
955 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 955 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
956 | **/ | 956 | **/ |
957 | int | 957 | int |
958 | gnutls_prf (gnutls_session_t session, | 958 | MHD_gnutls_prf (mhd_gtls_session_t session, |
959 | size_t label_size, | 959 | size_t label_size, |
960 | const char *label, | 960 | const char *label, |
961 | int server_random_first, | 961 | int server_random_first, |
@@ -981,7 +981,7 @@ gnutls_prf (gnutls_session_t session, | |||
981 | 981 | ||
982 | memcpy (seed + 2 * TLS_RANDOM_SIZE, extra, extra_size); | 982 | memcpy (seed + 2 * TLS_RANDOM_SIZE, extra, extra_size); |
983 | 983 | ||
984 | ret = _gnutls_PRF (session, session->security_parameters.master_secret, | 984 | ret = mhd_gtls_PRF (session, session->security_parameters.master_secret, |
985 | TLS_MASTER_SIZE, label, label_size, seed, seedsize, | 985 | TLS_MASTER_SIZE, label, label_size, seed, seedsize, |
986 | outsize, out); | 986 | outsize, out); |
987 | 987 | ||
@@ -991,8 +991,8 @@ gnutls_prf (gnutls_session_t session, | |||
991 | } | 991 | } |
992 | 992 | ||
993 | /** | 993 | /** |
994 | * gnutls_session_get_client_random - get the session's client random value | 994 | * MHD_gtls_session_get_client_random - get the session's client random value |
995 | * @session: is a #gnutls_session_t structure. | 995 | * @session: is a #mhd_gtls_session_t structure. |
996 | * | 996 | * |
997 | * Return a pointer to the 32-byte client random field used in the | 997 | * Return a pointer to the 32-byte client random field used in the |
998 | * session. The pointer must not be modified or deallocated. | 998 | * session. The pointer must not be modified or deallocated. |
@@ -1004,14 +1004,14 @@ gnutls_prf (gnutls_session_t session, | |||
1004 | * Returns: pointer to client random data. | 1004 | * Returns: pointer to client random data. |
1005 | **/ | 1005 | **/ |
1006 | const void * | 1006 | const void * |
1007 | gnutls_session_get_client_random (gnutls_session_t session) | 1007 | MHD_gtls_session_get_client_random (mhd_gtls_session_t session) |
1008 | { | 1008 | { |
1009 | return (char *) session->security_parameters.client_random; | 1009 | return (char *) session->security_parameters.client_random; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | /** | 1012 | /** |
1013 | * gnutls_session_get_server_random - get the session's server random value | 1013 | * MHD_gtls_session_get_server_random - get the session's server random value |
1014 | * @session: is a #gnutls_session_t structure. | 1014 | * @session: is a #mhd_gtls_session_t structure. |
1015 | * | 1015 | * |
1016 | * Return a pointer to the 32-byte server random field used in the | 1016 | * Return a pointer to the 32-byte server random field used in the |
1017 | * session. The pointer must not be modified or deallocated. | 1017 | * session. The pointer must not be modified or deallocated. |
@@ -1023,14 +1023,14 @@ gnutls_session_get_client_random (gnutls_session_t session) | |||
1023 | * Returns: pointer to server random data. | 1023 | * Returns: pointer to server random data. |
1024 | **/ | 1024 | **/ |
1025 | const void * | 1025 | const void * |
1026 | gnutls_session_get_server_random (gnutls_session_t session) | 1026 | MHD_gtls_session_get_server_random (mhd_gtls_session_t session) |
1027 | { | 1027 | { |
1028 | return (char *) session->security_parameters.server_random; | 1028 | return (char *) session->security_parameters.server_random; |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | /** | 1031 | /** |
1032 | * gnutls_session_get_master_secret - get the session's master secret value | 1032 | * MHD_gtls_session_get_master_secret - get the session's master secret value |
1033 | * @session: is a #gnutls_session_t structure. | 1033 | * @session: is a #mhd_gtls_session_t structure. |
1034 | * | 1034 | * |
1035 | * Return a pointer to the 48-byte master secret in the session. The | 1035 | * Return a pointer to the 48-byte master secret in the session. The |
1036 | * pointer must not be modified or deallocated. | 1036 | * pointer must not be modified or deallocated. |
@@ -1039,26 +1039,26 @@ gnutls_session_get_server_random (gnutls_session_t session) | |||
1039 | * will be garbage; in particular, a %NULL return value should not be | 1039 | * will be garbage; in particular, a %NULL return value should not be |
1040 | * expected. | 1040 | * expected. |
1041 | * | 1041 | * |
1042 | * Consider using gnutls_prf() rather than extracting the master | 1042 | * Consider using MHD_gnutls_prf() rather than extracting the master |
1043 | * secret and use it to derive further data. | 1043 | * secret and use it to derive further data. |
1044 | * | 1044 | * |
1045 | * Returns: pointer to master secret data. | 1045 | * Returns: pointer to master secret data. |
1046 | **/ | 1046 | **/ |
1047 | const void * | 1047 | const void * |
1048 | gnutls_session_get_master_secret (gnutls_session_t session) | 1048 | MHD_gtls_session_get_master_secret (mhd_gtls_session_t session) |
1049 | { | 1049 | { |
1050 | return (char *) session->security_parameters.master_secret; | 1050 | return (char *) session->security_parameters.master_secret; |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | /** | 1053 | /** |
1054 | * gnutls_session_is_resumed - Used to check whether this session is a resumed one | 1054 | * MHD_gtls_session_is_resumed - Used to check whether this session is a resumed one |
1055 | * @session: is a #gnutls_session_t structure. | 1055 | * @session: is a #mhd_gtls_session_t structure. |
1056 | * | 1056 | * |
1057 | * Returns: non zero if this session is resumed, or a zero if this is | 1057 | * Returns: non zero if this session is resumed, or a zero if this is |
1058 | * a new session. | 1058 | * a new session. |
1059 | **/ | 1059 | **/ |
1060 | int | 1060 | int |
1061 | gnutls_session_is_resumed (gnutls_session_t session) | 1061 | MHD_gtls_session_is_resumed (mhd_gtls_session_t session) |
1062 | { | 1062 | { |
1063 | if (session->security_parameters.entity == GNUTLS_CLIENT) | 1063 | if (session->security_parameters.entity == GNUTLS_CLIENT) |
1064 | { | 1064 | { |
@@ -1081,81 +1081,81 @@ gnutls_session_is_resumed (gnutls_session_t session) | |||
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | /*- | 1083 | /*- |
1084 | * _gnutls_session_is_export - Used to check whether this session is of export grade | 1084 | * mhd_gtls_session_is_export - Used to check whether this session is of export grade |
1085 | * @session: is a #gnutls_session_t structure. | 1085 | * @session: is a #mhd_gtls_session_t structure. |
1086 | * | 1086 | * |
1087 | * This function will return non zero if this session is of export grade. | 1087 | * This function will return non zero if this session is of export grade. |
1088 | * | 1088 | * |
1089 | -*/ | 1089 | -*/ |
1090 | int | 1090 | int |
1091 | _gnutls_session_is_export (gnutls_session_t session) | 1091 | mhd_gtls_session_is_export (mhd_gtls_session_t session) |
1092 | { | 1092 | { |
1093 | gnutls_cipher_algorithm_t cipher; | 1093 | gnutls_cipher_algorithm_t cipher; |
1094 | 1094 | ||
1095 | cipher = | 1095 | cipher = |
1096 | _gnutls_cipher_suite_get_cipher_algo (&session->security_parameters. | 1096 | mhd_gtls_cipher_suite_get_cipher_algo (&session->security_parameters. |
1097 | current_cipher_suite); | 1097 | current_cipher_suite); |
1098 | 1098 | ||
1099 | if (_gnutls_cipher_get_export_flag (cipher) != 0) | 1099 | if (mhd_gtls_cipher_get_export_flag (cipher) != 0) |
1100 | return 1; | 1100 | return 1; |
1101 | 1101 | ||
1102 | return 0; | 1102 | return 0; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | /** | 1105 | /** |
1106 | * gnutls_session_get_ptr - Used to get the user pointer from the session structure | 1106 | * MHD_gtls_session_get_ptr - Used to get the user pointer from the session structure |
1107 | * @session: is a #gnutls_session_t structure. | 1107 | * @session: is a #mhd_gtls_session_t structure. |
1108 | * | 1108 | * |
1109 | * Returns: the user given pointer from the session structure. This | 1109 | * Returns: the user given pointer from the session structure. This |
1110 | * is the pointer set with gnutls_session_set_ptr(). | 1110 | * is the pointer set with MHD_gnutls_session_set_ptr(). |
1111 | **/ | 1111 | **/ |
1112 | void * | 1112 | void * |
1113 | gnutls_session_get_ptr (gnutls_session_t session) | 1113 | MHD_gtls_session_get_ptr (mhd_gtls_session_t session) |
1114 | { | 1114 | { |
1115 | return session->internals.user_ptr; | 1115 | return session->internals.user_ptr; |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | /** | 1118 | /** |
1119 | * gnutls_session_set_ptr - Used to set the user pointer to the session structure | 1119 | * MHD_gnutls_session_set_ptr - Used to set the user pointer to the session structure |
1120 | * @session: is a #gnutls_session_t structure. | 1120 | * @session: is a #mhd_gtls_session_t structure. |
1121 | * @ptr: is the user pointer | 1121 | * @ptr: is the user pointer |
1122 | * | 1122 | * |
1123 | * This function will set (associate) the user given pointer to the | 1123 | * This function will set (associate) the user given pointer to the |
1124 | * session structure. This is pointer can be accessed with | 1124 | * session structure. This is pointer can be accessed with |
1125 | * gnutls_session_get_ptr(). | 1125 | * MHD_gtls_session_get_ptr(). |
1126 | **/ | 1126 | **/ |
1127 | void | 1127 | void |
1128 | gnutls_session_set_ptr (gnutls_session_t session, void *ptr) | 1128 | MHD_gnutls_session_set_ptr (mhd_gtls_session_t session, void *ptr) |
1129 | { | 1129 | { |
1130 | session->internals.user_ptr = ptr; | 1130 | session->internals.user_ptr = ptr; |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | /** | 1133 | /** |
1134 | * gnutls_record_get_direction - This function will return the direction of the last interrupted function call | 1134 | * MHD_gnutls_record_get_direction - This function will return the direction of the last interrupted function call |
1135 | * @session: is a #gnutls_session_t structure. | 1135 | * @session: is a #mhd_gtls_session_t structure. |
1136 | * | 1136 | * |
1137 | * This function provides information about the internals of the | 1137 | * This function provides information about the internals of the |
1138 | * record protocol and is only useful if a prior gnutls function call | 1138 | * record protocol and is only useful if a prior gnutls function call |
1139 | * (e.g. gnutls_handshake()) was interrupted for some reason, that | 1139 | * (e.g. MHD_gnutls_handshake()) was interrupted for some reason, that |
1140 | * is, if a function returned %GNUTLS_E_INTERRUPTED or | 1140 | * is, if a function returned %GNUTLS_E_INTERRUPTED or |
1141 | * %GNUTLS_E_AGAIN. In such a case, you might want to call select() | 1141 | * %GNUTLS_E_AGAIN. In such a case, you might want to call select() |
1142 | * or poll() before calling the interrupted gnutls function again. | 1142 | * or poll() before calling the interrupted gnutls function again. |
1143 | * To tell you whether a file descriptor should be selected for | 1143 | * To tell you whether a file descriptor should be selected for |
1144 | * either reading or writing, gnutls_record_get_direction() returns 0 | 1144 | * either reading or writing, MHD_gnutls_record_get_direction() returns 0 |
1145 | * if the interrupted function was trying to read data, and 1 if it | 1145 | * if the interrupted function was trying to read data, and 1 if it |
1146 | * was trying to write data. | 1146 | * was trying to write data. |
1147 | * | 1147 | * |
1148 | * Returns: 0 if trying to read data, 1 if trying to write data. | 1148 | * Returns: 0 if trying to read data, 1 if trying to write data. |
1149 | **/ | 1149 | **/ |
1150 | int | 1150 | int |
1151 | gnutls_record_get_direction (gnutls_session_t session) | 1151 | MHD_gnutls_record_get_direction (mhd_gtls_session_t session) |
1152 | { | 1152 | { |
1153 | return session->internals.direction; | 1153 | return session->internals.direction; |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | /*- | 1156 | /*- |
1157 | * _gnutls_rsa_pms_set_version - Sets a version to be used at the RSA PMS | 1157 | * _gnutls_rsa_pms_set_version - Sets a version to be used at the RSA PMS |
1158 | * @session: is a #gnutls_session_t structure. | 1158 | * @session: is a #mhd_gtls_session_t structure. |
1159 | * @major: is the major version to use | 1159 | * @major: is the major version to use |
1160 | * @minor: is the minor version to use | 1160 | * @minor: is the minor version to use |
1161 | * | 1161 | * |
@@ -1165,7 +1165,7 @@ gnutls_record_get_direction (gnutls_session_t session) | |||
1165 | * | 1165 | * |
1166 | -*/ | 1166 | -*/ |
1167 | void | 1167 | void |
1168 | _gnutls_rsa_pms_set_version (gnutls_session_t session, | 1168 | _gnutls_rsa_pms_set_version (mhd_gtls_session_t session, |
1169 | unsigned char major, unsigned char minor) | 1169 | unsigned char major, unsigned char minor) |
1170 | { | 1170 | { |
1171 | session->internals.rsa_pms_version[0] = major; | 1171 | session->internals.rsa_pms_version[0] = major; |
@@ -1173,8 +1173,8 @@ _gnutls_rsa_pms_set_version (gnutls_session_t session, | |||
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | /** | 1175 | /** |
1176 | * gnutls_handshake_set_post_client_hello_function - This function will a callback to be called after the client hello is received | 1176 | * MHD_gnutls_handshake_set_post_client_hello_function - This function will a callback to be called after the client hello is received |
1177 | * @res: is a gnutls_anon_server_credentials_t structure | 1177 | * @res: is a mhd_gtls_anon_server_credentials_t structure |
1178 | * @func: is the function to be called | 1178 | * @func: is the function to be called |
1179 | * | 1179 | * |
1180 | * This function will set a callback to be called after the client | 1180 | * This function will set a callback to be called after the client |
@@ -1195,27 +1195,9 @@ _gnutls_rsa_pms_set_version (gnutls_session_t session, | |||
1195 | * | 1195 | * |
1196 | **/ | 1196 | **/ |
1197 | void | 1197 | void |
1198 | gnutls_handshake_set_post_client_hello_function (gnutls_session_t session, | 1198 | MHD_gnutls_handshake_set_post_client_hello_function (mhd_gtls_session_t session, |
1199 | gnutls_handshake_post_client_hello_func | 1199 | gnutls_handshake_post_client_hello_func |
1200 | func) | 1200 | func) |
1201 | { | 1201 | { |
1202 | session->internals.user_hello_func = func; | 1202 | session->internals.user_hello_func = func; |
1203 | } | 1203 | } |
1204 | |||
1205 | /** | ||
1206 | * gnutls_session_enable_compatibility_mode - Used to disable certain features in TLS in order to honour compatibility | ||
1207 | * @session: is a #gnutls_session_t structure. | ||
1208 | * | ||
1209 | * This function can be used to disable certain (security) features | ||
1210 | * in TLS in order to maintain maximum compatibility with buggy | ||
1211 | * clients. It is equivalent to calling: | ||
1212 | * gnutls_record_disable_padding() | ||
1213 | * | ||
1214 | * Normally only servers that require maximum compatibility with | ||
1215 | * everything out there, need to call this function. | ||
1216 | **/ | ||
1217 | void | ||
1218 | gnutls_session_enable_compatibility_mode (gnutls_session_t session) | ||
1219 | { | ||
1220 | gnutls_record_disable_padding (session); | ||
1221 | } | ||
diff --git a/src/daemon/https/tls/gnutls_state.h b/src/daemon/https/tls/gnutls_state.h index 246432e6..2616b71d 100644 --- a/src/daemon/https/tls/gnutls_state.h +++ b/src/daemon/https/tls/gnutls_state.h | |||
@@ -27,46 +27,46 @@ | |||
27 | 27 | ||
28 | #include <gnutls_int.h> | 28 | #include <gnutls_int.h> |
29 | 29 | ||
30 | void _gnutls_session_cert_type_set (gnutls_session_t session, | 30 | void _gnutls_session_cert_type_set (mhd_gtls_session_t session, |
31 | gnutls_certificate_type_t); | 31 | gnutls_certificate_type_t); |
32 | gnutls_kx_algorithm_t gnutls_kx_get (gnutls_session_t session); | 32 | gnutls_kx_algorithm_t gnutls_kx_get (mhd_gtls_session_t session); |
33 | gnutls_cipher_algorithm_t gnutls_cipher_get (gnutls_session_t session); | 33 | gnutls_cipher_algorithm_t gnutls_cipher_get (mhd_gtls_session_t session); |
34 | gnutls_certificate_type_t gnutls_certificate_type_get (gnutls_session_t); | 34 | gnutls_certificate_type_t gnutls_certificate_type_get (mhd_gtls_session_t); |
35 | 35 | ||
36 | #include <gnutls_auth_int.h> | 36 | #include <gnutls_auth_int.h> |
37 | 37 | ||
38 | #define CHECK_AUTH(auth, ret) if (gnutls_auth_get_type(session) != auth) { \ | 38 | #define CHECK_AUTH(auth, ret) if (MHD_gtls_auth_get_type(session) != auth) { \ |
39 | gnutls_assert(); \ | 39 | gnutls_assert(); \ |
40 | return ret; \ | 40 | return ret; \ |
41 | } | 41 | } |
42 | 42 | ||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | int _gnutls_session_cert_type_supported (gnutls_session_t, | 45 | int mhd_gtls_session_cert_type_supported (mhd_gtls_session_t, |
46 | gnutls_certificate_type_t); | 46 | gnutls_certificate_type_t); |
47 | 47 | ||
48 | int _gnutls_dh_set_secret_bits (gnutls_session_t session, unsigned bits); | 48 | int mhd_gtls_dh_set_secret_bits (mhd_gtls_session_t session, unsigned bits); |
49 | 49 | ||
50 | int _gnutls_dh_set_peer_public (gnutls_session_t session, mpi_t public); | 50 | int mhd_gtls_dh_set_peer_public (mhd_gtls_session_t session, mpi_t public); |
51 | int _gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime); | 51 | int mhd_gtls_dh_set_group (mhd_gtls_session_t session, mpi_t gen, mpi_t prime); |
52 | 52 | ||
53 | int _gnutls_dh_get_allowed_prime_bits (gnutls_session_t session); | 53 | int mhd_gtls_dh_get_allowed_prime_bits (mhd_gtls_session_t session); |
54 | void _gnutls_handshake_internal_state_clear (gnutls_session_t); | 54 | void mhd_gtls_handshake_internal_state_clear (mhd_gtls_session_t); |
55 | 55 | ||
56 | int _gnutls_rsa_export_set_pubkey (gnutls_session_t session, | 56 | int mhd_gtls_rsa_export_set_pubkey (mhd_gtls_session_t session, |
57 | mpi_t exponent, mpi_t modulus); | 57 | mpi_t exponent, mpi_t modulus); |
58 | 58 | ||
59 | int _gnutls_session_is_resumable (gnutls_session_t session); | 59 | int mhd_gtls_session_is_resumable (mhd_gtls_session_t session); |
60 | int _gnutls_session_is_export (gnutls_session_t session); | 60 | int mhd_gtls_session_is_export (mhd_gtls_session_t session); |
61 | 61 | ||
62 | int _gnutls_openpgp_send_fingerprint (gnutls_session_t session); | 62 | int mhd_gtls_openpgp_send_fingerprint (mhd_gtls_session_t session); |
63 | 63 | ||
64 | int _gnutls_PRF (gnutls_session_t session, | 64 | int mhd_gtls_PRF (mhd_gtls_session_t session, |
65 | const opaque * secret, int secret_size, | 65 | const opaque * secret, int secret_size, |
66 | const char *label, int label_size, | 66 | const char *label, int label_size, |
67 | const opaque * seed, int seed_size, | 67 | const opaque * seed, int seed_size, |
68 | int total_bytes, void *ret); | 68 | int total_bytes, void *ret); |
69 | 69 | ||
70 | int gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end); | 70 | int MHD_gnutls_init (mhd_gtls_session_t * session, gnutls_connection_end_t con_end); |
71 | 71 | ||
72 | #define DEFAULT_CERT_TYPE MHD_GNUTLS_CRT_X509 | 72 | #define DEFAULT_CERT_TYPE MHD_GNUTLS_CRT_X509 |
diff --git a/src/daemon/https/tls/gnutls_str.c b/src/daemon/https/tls/gnutls_str.c index 34657c03..0a2a656a 100644 --- a/src/daemon/https/tls/gnutls_str.c +++ b/src/daemon/https/tls/gnutls_str.c | |||
@@ -34,7 +34,7 @@ | |||
34 | * They should be used only with null terminated strings. | 34 | * They should be used only with null terminated strings. |
35 | */ | 35 | */ |
36 | void | 36 | void |
37 | _gnutls_str_cat (char *dest, size_t dest_tot_size, const char *src) | 37 | mhd_gtls_str_cat (char *dest, size_t dest_tot_size, const char *src) |
38 | { | 38 | { |
39 | size_t str_size = strlen (src); | 39 | size_t str_size = strlen (src); |
40 | size_t dest_size = strlen (dest); | 40 | size_t dest_size = strlen (dest); |
@@ -54,7 +54,7 @@ _gnutls_str_cat (char *dest, size_t dest_tot_size, const char *src) | |||
54 | } | 54 | } |
55 | 55 | ||
56 | void | 56 | void |
57 | _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src) | 57 | mhd_gtls_str_cpy (char *dest, size_t dest_tot_size, const char *src) |
58 | { | 58 | { |
59 | size_t str_size = strlen (src); | 59 | size_t str_size = strlen (src); |
60 | 60 | ||
@@ -73,7 +73,7 @@ _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | void | 75 | void |
76 | _gnutls_mem_cpy (char *dest, | 76 | mhd_gtls_mem_cpy (char *dest, |
77 | size_t dest_tot_size, const char *src, size_t src_size) | 77 | size_t dest_tot_size, const char *src, size_t src_size) |
78 | { | 78 | { |
79 | 79 | ||
@@ -91,7 +91,7 @@ _gnutls_mem_cpy (char *dest, | |||
91 | } | 91 | } |
92 | 92 | ||
93 | void | 93 | void |
94 | _gnutls_string_init (gnutls_string * str, | 94 | mhd_gtls_string_init (mhd_gtls_string * str, |
95 | gnutls_alloc_function alloc_func, | 95 | gnutls_alloc_function alloc_func, |
96 | gnutls_realloc_function realloc_func, | 96 | gnutls_realloc_function realloc_func, |
97 | gnutls_free_function free_func) | 97 | gnutls_free_function free_func) |
@@ -106,7 +106,7 @@ _gnutls_string_init (gnutls_string * str, | |||
106 | } | 106 | } |
107 | 107 | ||
108 | void | 108 | void |
109 | _gnutls_string_clear (gnutls_string * str) | 109 | mhd_gtls_string_clear (mhd_gtls_string * str) |
110 | { | 110 | { |
111 | if (str == NULL || str->data == NULL) | 111 | if (str == NULL || str->data == NULL) |
112 | return; | 112 | return; |
@@ -120,7 +120,7 @@ _gnutls_string_clear (gnutls_string * str) | |||
120 | /* This one does not copy the string. | 120 | /* This one does not copy the string. |
121 | */ | 121 | */ |
122 | gnutls_datum_t | 122 | gnutls_datum_t |
123 | _gnutls_string2datum (gnutls_string * str) | 123 | mhd_gtls_string2datum (mhd_gtls_string * str) |
124 | { | 124 | { |
125 | gnutls_datum_t ret; | 125 | gnutls_datum_t ret; |
126 | 126 | ||
@@ -133,7 +133,7 @@ _gnutls_string2datum (gnutls_string * str) | |||
133 | #define MIN_CHUNK 256 | 133 | #define MIN_CHUNK 256 |
134 | 134 | ||
135 | int | 135 | int |
136 | _gnutls_string_copy_str (gnutls_string * dest, const char *src) | 136 | mhd_gtls_string_copy_str (mhd_gtls_string * dest, const char *src) |
137 | { | 137 | { |
138 | size_t src_len = strlen (src); | 138 | size_t src_len = strlen (src); |
139 | size_t max; | 139 | size_t max; |
@@ -163,7 +163,7 @@ _gnutls_string_copy_str (gnutls_string * dest, const char *src) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | int | 165 | int |
166 | _gnutls_string_append_str (gnutls_string * dest, const char *src) | 166 | mhd_gtls_string_append_str (mhd_gtls_string * dest, const char *src) |
167 | { | 167 | { |
168 | size_t src_len = strlen (src); | 168 | size_t src_len = strlen (src); |
169 | size_t tot_len = src_len + dest->length; | 169 | size_t tot_len = src_len + dest->length; |
@@ -196,7 +196,7 @@ _gnutls_string_append_str (gnutls_string * dest, const char *src) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | int | 198 | int |
199 | _gnutls_string_append_data (gnutls_string * dest, | 199 | mhd_gtls_string_append_data (mhd_gtls_string * dest, |
200 | const void *data, size_t data_size) | 200 | const void *data, size_t data_size) |
201 | { | 201 | { |
202 | size_t tot_len = data_size + dest->length; | 202 | size_t tot_len = data_size + dest->length; |
@@ -229,7 +229,7 @@ _gnutls_string_append_data (gnutls_string * dest, | |||
229 | } | 229 | } |
230 | 230 | ||
231 | int | 231 | int |
232 | _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...) | 232 | mhd_gtls_string_append_printf (mhd_gtls_string * dest, const char *fmt, ...) |
233 | { | 233 | { |
234 | va_list args; | 234 | va_list args; |
235 | int len; | 235 | int len; |
@@ -242,7 +242,7 @@ _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...) | |||
242 | if (len < 0 || !str) | 242 | if (len < 0 || !str) |
243 | return -1; | 243 | return -1; |
244 | 244 | ||
245 | len = _gnutls_string_append_str (dest, str); | 245 | len = mhd_gtls_string_append_str (dest, str); |
246 | 246 | ||
247 | free (str); | 247 | free (str); |
248 | 248 | ||
@@ -255,7 +255,7 @@ _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...) | |||
255 | * truncated hex string is returned (always null terminated). | 255 | * truncated hex string is returned (always null terminated). |
256 | */ | 256 | */ |
257 | char * | 257 | char * |
258 | _gnutls_bin2hex (const void *_old, | 258 | mhd_gtls_bin2hex (const void *_old, |
259 | size_t oldlen, char *buffer, size_t buffer_size) | 259 | size_t oldlen, char *buffer, size_t buffer_size) |
260 | { | 260 | { |
261 | unsigned int i, j; | 261 | unsigned int i, j; |
@@ -274,7 +274,7 @@ _gnutls_bin2hex (const void *_old, | |||
274 | /* just a hex2bin function. | 274 | /* just a hex2bin function. |
275 | */ | 275 | */ |
276 | int | 276 | int |
277 | _gnutls_hex2bin (const opaque * hex_data, | 277 | mhd_gtls_hex2bin (const opaque * hex_data, |
278 | int hex_size, opaque * bin_data, size_t * bin_size) | 278 | int hex_size, opaque * bin_data, size_t * bin_size) |
279 | { | 279 | { |
280 | int i, j; | 280 | int i, j; |
diff --git a/src/daemon/https/tls/gnutls_str.h b/src/daemon/https/tls/gnutls_str.h index 62415557..84ff8eb5 100644 --- a/src/daemon/https/tls/gnutls_str.h +++ b/src/daemon/https/tls/gnutls_str.h | |||
@@ -27,10 +27,10 @@ | |||
27 | 27 | ||
28 | #include <gnutls_int.h> | 28 | #include <gnutls_int.h> |
29 | 29 | ||
30 | void _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src); | 30 | void mhd_gtls_str_cpy (char *dest, size_t dest_tot_size, const char *src); |
31 | void _gnutls_mem_cpy (char *dest, size_t dest_tot_size, const char *src, | 31 | void mhd_gtls_mem_cpy (char *dest, size_t dest_tot_size, const char *src, |
32 | size_t src_size); | 32 | size_t src_size); |
33 | void _gnutls_str_cat (char *dest, size_t dest_tot_size, const char *src); | 33 | void mhd_gtls_str_cat (char *dest, size_t dest_tot_size, const char *src); |
34 | 34 | ||
35 | typedef struct | 35 | typedef struct |
36 | { | 36 | { |
@@ -40,26 +40,26 @@ typedef struct | |||
40 | gnutls_realloc_function realloc_func; | 40 | gnutls_realloc_function realloc_func; |
41 | gnutls_alloc_function alloc_func; | 41 | gnutls_alloc_function alloc_func; |
42 | gnutls_free_function free_func; | 42 | gnutls_free_function free_func; |
43 | } gnutls_string; | 43 | } mhd_gtls_string; |
44 | 44 | ||
45 | void _gnutls_string_init (gnutls_string *, gnutls_alloc_function, | 45 | void mhd_gtls_string_init (mhd_gtls_string *, gnutls_alloc_function, |
46 | gnutls_realloc_function, gnutls_free_function); | 46 | gnutls_realloc_function, gnutls_free_function); |
47 | void _gnutls_string_clear (gnutls_string *); | 47 | void mhd_gtls_string_clear (mhd_gtls_string *); |
48 | 48 | ||
49 | /* Beware, do not clear the string, after calling this | 49 | /* Beware, do not clear the string, after calling this |
50 | * function | 50 | * function |
51 | */ | 51 | */ |
52 | gnutls_datum_t _gnutls_string2datum (gnutls_string * str); | 52 | gnutls_datum_t mhd_gtls_string2datum (mhd_gtls_string * str); |
53 | 53 | ||
54 | int _gnutls_string_copy_str (gnutls_string * dest, const char *src); | 54 | int mhd_gtls_string_copy_str (mhd_gtls_string * dest, const char *src); |
55 | int _gnutls_string_append_str (gnutls_string *, const char *str); | 55 | int mhd_gtls_string_append_str (mhd_gtls_string *, const char *str); |
56 | int _gnutls_string_append_data (gnutls_string *, const void *data, | 56 | int mhd_gtls_string_append_data (mhd_gtls_string *, const void *data, |
57 | size_t data_size); | 57 | size_t data_size); |
58 | int _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...); | 58 | int mhd_gtls_string_append_printf (mhd_gtls_string * dest, const char *fmt, ...); |
59 | 59 | ||
60 | char *_gnutls_bin2hex (const void *old, size_t oldlen, char *buffer, | 60 | char * mhd_gtls_bin2hex (const void *old, size_t oldlen, char *buffer, |
61 | size_t buffer_size); | 61 | size_t buffer_size); |
62 | int _gnutls_hex2bin (const opaque * hex_data, int hex_size, opaque * bin_data, | 62 | int mhd_gtls_hex2bin (const opaque * hex_data, int hex_size, opaque * bin_data, |
63 | size_t * bin_size); | 63 | size_t * bin_size); |
64 | 64 | ||
65 | #endif | 65 | #endif |
diff --git a/src/daemon/https/tls/gnutls_supplemental.c b/src/daemon/https/tls/gnutls_supplemental.c index a47b9aaa..1a5fcd6f 100644 --- a/src/daemon/https/tls/gnutls_supplemental.c +++ b/src/daemon/https/tls/gnutls_supplemental.c | |||
@@ -25,7 +25,7 @@ | |||
25 | /* This file contains support functions for 'TLS Handshake Message for | 25 | /* This file contains support functions for 'TLS Handshake Message for |
26 | * Supplemental Data' (RFC 4680). | 26 | * Supplemental Data' (RFC 4680). |
27 | * | 27 | * |
28 | * The idea here is simple. gnutls_handshake() in gnuts_handshake.c | 28 | * The idea here is simple. MHD_gnutls_handshake() in gnuts_handshake.c |
29 | * will call _gnutls_gen_supplemental and _gnutls_parse_supplemental | 29 | * will call _gnutls_gen_supplemental and _gnutls_parse_supplemental |
30 | * when some extension requested that supplemental data be sent or | 30 | * when some extension requested that supplemental data be sent or |
31 | * received. Extension request this by setting the flags | 31 | * received. Extension request this by setting the flags |
@@ -50,9 +50,9 @@ | |||
50 | #include "gnutls_errors.h" | 50 | #include "gnutls_errors.h" |
51 | #include "gnutls_num.h" | 51 | #include "gnutls_num.h" |
52 | 52 | ||
53 | typedef int (*supp_recv_func) (gnutls_session_t session, | 53 | typedef int (*supp_recv_func) (mhd_gtls_session_t session, |
54 | const opaque * data, size_t data_size); | 54 | const opaque * data, size_t data_size); |
55 | typedef int (*supp_send_func) (gnutls_session_t session, gnutls_buffer * buf); | 55 | typedef int (*supp_send_func) (mhd_gtls_session_t session, mhd_gtls_buffer * buf); |
56 | 56 | ||
57 | typedef struct | 57 | typedef struct |
58 | { | 58 | { |
@@ -67,7 +67,7 @@ gnutls_supplemental_entry _gnutls_supplemental[] = { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | const char * | 69 | const char * |
70 | gnutls_supplemental_get_name (gnutls_supplemental_data_format_type_t type) | 70 | MHD_gtls_supplemental_get_name (gnutls_supplemental_data_format_type_t type) |
71 | { | 71 | { |
72 | gnutls_supplemental_entry *p; | 72 | gnutls_supplemental_entry *p; |
73 | 73 | ||
@@ -91,13 +91,13 @@ get_supp_func_recv (gnutls_supplemental_data_format_type_t type) | |||
91 | } | 91 | } |
92 | 92 | ||
93 | int | 93 | int |
94 | _gnutls_gen_supplemental (gnutls_session_t session, gnutls_buffer * buf) | 94 | _gnutls_gen_supplemental (mhd_gtls_session_t session, mhd_gtls_buffer * buf) |
95 | { | 95 | { |
96 | gnutls_supplemental_entry *p; | 96 | gnutls_supplemental_entry *p; |
97 | int ret; | 97 | int ret; |
98 | 98 | ||
99 | /* Make room for 3 byte length field. */ | 99 | /* Make room for 3 byte length field. */ |
100 | ret = _gnutls_buffer_append (buf, "\0\0\0", 3); | 100 | ret = mhd_gtls_buffer_append (buf, "\0\0\0", 3); |
101 | if (ret < 0) | 101 | if (ret < 0) |
102 | { | 102 | { |
103 | gnutls_assert (); | 103 | gnutls_assert (); |
@@ -111,7 +111,7 @@ _gnutls_gen_supplemental (gnutls_session_t session, gnutls_buffer * buf) | |||
111 | int ret; | 111 | int ret; |
112 | 112 | ||
113 | /* Make room for supplement type and length byte length field. */ | 113 | /* Make room for supplement type and length byte length field. */ |
114 | ret = _gnutls_buffer_append (buf, "\0\0\0\0", 4); | 114 | ret = mhd_gtls_buffer_append (buf, "\0\0\0\0", 4); |
115 | if (ret < 0) | 115 | if (ret < 0) |
116 | { | 116 | { |
117 | gnutls_assert (); | 117 | gnutls_assert (); |
@@ -148,7 +148,7 @@ _gnutls_gen_supplemental (gnutls_session_t session, gnutls_buffer * buf) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | int | 150 | int |
151 | _gnutls_parse_supplemental (gnutls_session_t session, | 151 | _gnutls_parse_supplemental (mhd_gtls_session_t session, |
152 | const uint8_t * data, int datalen) | 152 | const uint8_t * data, int datalen) |
153 | { | 153 | { |
154 | const opaque *p = data; | 154 | const opaque *p = data; |
@@ -156,7 +156,7 @@ _gnutls_parse_supplemental (gnutls_session_t session, | |||
156 | size_t total_size; | 156 | size_t total_size; |
157 | 157 | ||
158 | DECR_LEN (dsize, 3); | 158 | DECR_LEN (dsize, 3); |
159 | total_size = _gnutls_read_uint24 (p); | 159 | total_size = mhd_gtls_read_uint24 (p); |
160 | p += 3; | 160 | p += 3; |
161 | 161 | ||
162 | if (dsize != total_size) | 162 | if (dsize != total_size) |
@@ -172,11 +172,11 @@ _gnutls_parse_supplemental (gnutls_session_t session, | |||
172 | supp_recv_func recv_func; | 172 | supp_recv_func recv_func; |
173 | 173 | ||
174 | DECR_LEN (dsize, 2); | 174 | DECR_LEN (dsize, 2); |
175 | supp_data_type = _gnutls_read_uint16 (p); | 175 | supp_data_type = mhd_gtls_read_uint16 (p); |
176 | p += 2; | 176 | p += 2; |
177 | 177 | ||
178 | DECR_LEN (dsize, 2); | 178 | DECR_LEN (dsize, 2); |
179 | supp_data_length = _gnutls_read_uint16 (p); | 179 | supp_data_length = mhd_gtls_read_uint16 (p); |
180 | p += 2; | 180 | p += 2; |
181 | 181 | ||
182 | _gnutls_debug_log ("EXT[%x]: Got supplemental type=%02x length=%d\n", | 182 | _gnutls_debug_log ("EXT[%x]: Got supplemental type=%02x length=%d\n", |
diff --git a/src/daemon/https/tls/gnutls_supplemental.h b/src/daemon/https/tls/gnutls_supplemental.h index 0b9c1207..3f8d9217 100644 --- a/src/daemon/https/tls/gnutls_supplemental.h +++ b/src/daemon/https/tls/gnutls_supplemental.h | |||
@@ -24,8 +24,8 @@ | |||
24 | 24 | ||
25 | #include <gnutls_int.h> | 25 | #include <gnutls_int.h> |
26 | 26 | ||
27 | int _gnutls_parse_supplemental (gnutls_session_t session, | 27 | int _gnutls_parse_supplemental (mhd_gtls_session_t session, |
28 | const uint8_t *data, | 28 | const uint8_t *data, |
29 | int data_size); | 29 | int data_size); |
30 | int _gnutls_gen_supplemental (gnutls_session_t session, | 30 | int _gnutls_gen_supplemental (mhd_gtls_session_t session, |
31 | gnutls_buffer *buf); | 31 | mhd_gtls_buffer *buf); |
diff --git a/src/daemon/https/tls/gnutls_ui.c b/src/daemon/https/tls/gnutls_ui.c index e3511baa..b5b0fbee 100644 --- a/src/daemon/https/tls/gnutls_ui.c +++ b/src/daemon/https/tls/gnutls_ui.c | |||
@@ -37,8 +37,8 @@ | |||
37 | /* ANON & DHE */ | 37 | /* ANON & DHE */ |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * gnutls_dh_set_prime_bits - Used to set the bits for a DH ciphersuite | 40 | * MHD_gnutls_dh_set_prime_bits - Used to set the bits for a DH ciphersuite |
41 | * @session: is a #gnutls_session_t structure. | 41 | * @session: is a #mhd_gtls_session_t structure. |
42 | * @bits: is the number of bits | 42 | * @bits: is the number of bits |
43 | * | 43 | * |
44 | * This function sets the number of bits, for use in an | 44 | * This function sets the number of bits, for use in an |
@@ -53,13 +53,13 @@ | |||
53 | * | 53 | * |
54 | **/ | 54 | **/ |
55 | void | 55 | void |
56 | gnutls_dh_set_prime_bits (gnutls_session_t session, unsigned int bits) | 56 | MHD_gnutls_dh_set_prime_bits (mhd_gtls_session_t session, unsigned int bits) |
57 | { | 57 | { |
58 | session->internals.dh_prime_bits = bits; | 58 | session->internals.dh_prime_bits = bits; |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * gnutls_dh_get_group - This function returns the group of the DH authentication | 62 | * MHD_gnutls_dh_get_group - This function returns the group of the DH authentication |
63 | * @session: is a gnutls session | 63 | * @session: is a gnutls session |
64 | * @raw_gen: will hold the generator. | 64 | * @raw_gen: will hold the generator. |
65 | * @raw_prime: will hold the prime. | 65 | * @raw_prime: will hold the prime. |
@@ -73,24 +73,24 @@ gnutls_dh_set_prime_bits (gnutls_session_t session, unsigned int bits) | |||
73 | * | 73 | * |
74 | **/ | 74 | **/ |
75 | int | 75 | int |
76 | gnutls_dh_get_group (gnutls_session_t session, | 76 | MHD_gnutls_dh_get_group (mhd_gtls_session_t session, |
77 | gnutls_datum_t * raw_gen, gnutls_datum_t * raw_prime) | 77 | gnutls_datum_t * raw_gen, gnutls_datum_t * raw_prime) |
78 | { | 78 | { |
79 | dh_info_st *dh; | 79 | dh_info_st *dh; |
80 | int ret; | 80 | int ret; |
81 | anon_auth_info_t anon_info; | 81 | mhd_anon_auth_info_t anon_info; |
82 | cert_auth_info_t cert_info; | 82 | cert_auth_info_t cert_info; |
83 | 83 | ||
84 | switch (gnutls_auth_get_type (session)) | 84 | switch (MHD_gtls_auth_get_type (session)) |
85 | { | 85 | { |
86 | case MHD_GNUTLS_CRD_ANON: | 86 | case MHD_GNUTLS_CRD_ANON: |
87 | anon_info = _gnutls_get_auth_info (session); | 87 | anon_info = mhd_gtls_get_auth_info (session); |
88 | if (anon_info == NULL) | 88 | if (anon_info == NULL) |
89 | return GNUTLS_E_INTERNAL_ERROR; | 89 | return GNUTLS_E_INTERNAL_ERROR; |
90 | dh = &anon_info->dh; | 90 | dh = &anon_info->dh; |
91 | break; | 91 | break; |
92 | case MHD_GNUTLS_CRD_CERTIFICATE: | 92 | case MHD_GNUTLS_CRD_CERTIFICATE: |
93 | cert_info = _gnutls_get_auth_info (session); | 93 | cert_info = mhd_gtls_get_auth_info (session); |
94 | if (cert_info == NULL) | 94 | if (cert_info == NULL) |
95 | return GNUTLS_E_INTERNAL_ERROR; | 95 | return GNUTLS_E_INTERNAL_ERROR; |
96 | dh = &cert_info->dh; | 96 | dh = &cert_info->dh; |
@@ -119,7 +119,7 @@ gnutls_dh_get_group (gnutls_session_t session, | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * gnutls_dh_get_pubkey - This function returns the peer's public key used in DH authentication | 122 | * MHD_gnutls_dh_get_pubkey - This function returns the peer's public key used in DH authentication |
123 | * @session: is a gnutls session | 123 | * @session: is a gnutls session |
124 | * @raw_key: will hold the public key. | 124 | * @raw_key: will hold the public key. |
125 | * | 125 | * |
@@ -131,18 +131,18 @@ gnutls_dh_get_group (gnutls_session_t session, | |||
131 | * | 131 | * |
132 | **/ | 132 | **/ |
133 | int | 133 | int |
134 | gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key) | 134 | MHD_gnutls_dh_get_pubkey (mhd_gtls_session_t session, gnutls_datum_t * raw_key) |
135 | { | 135 | { |
136 | dh_info_st *dh; | 136 | dh_info_st *dh; |
137 | anon_auth_info_t anon_info; | 137 | mhd_anon_auth_info_t anon_info; |
138 | cert_auth_info_t cert_info; | 138 | cert_auth_info_t cert_info; |
139 | cert_auth_info_t psk_info; | 139 | cert_auth_info_t psk_info; |
140 | 140 | ||
141 | switch (gnutls_auth_get_type (session)) | 141 | switch (MHD_gtls_auth_get_type (session)) |
142 | { | 142 | { |
143 | case MHD_GNUTLS_CRD_ANON: | 143 | case MHD_GNUTLS_CRD_ANON: |
144 | { | 144 | { |
145 | anon_info = _gnutls_get_auth_info (session); | 145 | anon_info = mhd_gtls_get_auth_info (session); |
146 | if (anon_info == NULL) | 146 | if (anon_info == NULL) |
147 | return GNUTLS_E_INTERNAL_ERROR; | 147 | return GNUTLS_E_INTERNAL_ERROR; |
148 | dh = &anon_info->dh; | 148 | dh = &anon_info->dh; |
@@ -150,7 +150,7 @@ gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key) | |||
150 | } | 150 | } |
151 | case MHD_GNUTLS_CRD_PSK: | 151 | case MHD_GNUTLS_CRD_PSK: |
152 | { | 152 | { |
153 | psk_info = _gnutls_get_auth_info (session); | 153 | psk_info = mhd_gtls_get_auth_info (session); |
154 | if (psk_info == NULL) | 154 | if (psk_info == NULL) |
155 | return GNUTLS_E_INTERNAL_ERROR; | 155 | return GNUTLS_E_INTERNAL_ERROR; |
156 | dh = &psk_info->dh; | 156 | dh = &psk_info->dh; |
@@ -159,7 +159,7 @@ gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key) | |||
159 | case MHD_GNUTLS_CRD_CERTIFICATE: | 159 | case MHD_GNUTLS_CRD_CERTIFICATE: |
160 | { | 160 | { |
161 | 161 | ||
162 | cert_info = _gnutls_get_auth_info (session); | 162 | cert_info = mhd_gtls_get_auth_info (session); |
163 | if (cert_info == NULL) | 163 | if (cert_info == NULL) |
164 | return GNUTLS_E_INTERNAL_ERROR; | 164 | return GNUTLS_E_INTERNAL_ERROR; |
165 | dh = &cert_info->dh; | 165 | dh = &cert_info->dh; |
@@ -175,7 +175,7 @@ gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key) | |||
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * gnutls_rsa_export_get_pubkey - This function returns the peer's public key used in RSA-EXPORT authentication | 178 | * MHD_gtls_rsa_export_get_pubkey - This function returns the peer's public key used in RSA-EXPORT authentication |
179 | * @session: is a gnutls session | 179 | * @session: is a gnutls session |
180 | * @exponent: will hold the exponent. | 180 | * @exponent: will hold the exponent. |
181 | * @modulus: will hold the modulus. | 181 | * @modulus: will hold the modulus. |
@@ -188,16 +188,16 @@ gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key) | |||
188 | * | 188 | * |
189 | **/ | 189 | **/ |
190 | int | 190 | int |
191 | gnutls_rsa_export_get_pubkey (gnutls_session_t session, | 191 | MHD_gtls_rsa_export_get_pubkey (mhd_gtls_session_t session, |
192 | gnutls_datum_t * exponent, | 192 | gnutls_datum_t * exponent, |
193 | gnutls_datum_t * modulus) | 193 | gnutls_datum_t * modulus) |
194 | { | 194 | { |
195 | cert_auth_info_t info; | 195 | cert_auth_info_t info; |
196 | int ret; | 196 | int ret; |
197 | 197 | ||
198 | if (gnutls_auth_get_type (session) == MHD_GNUTLS_CRD_CERTIFICATE) | 198 | if (MHD_gtls_auth_get_type (session) == MHD_GNUTLS_CRD_CERTIFICATE) |
199 | { | 199 | { |
200 | info = _gnutls_get_auth_info (session); | 200 | info = mhd_gtls_get_auth_info (session); |
201 | if (info == NULL) | 201 | if (info == NULL) |
202 | return GNUTLS_E_INTERNAL_ERROR; | 202 | return GNUTLS_E_INTERNAL_ERROR; |
203 | 203 | ||
@@ -225,7 +225,7 @@ gnutls_rsa_export_get_pubkey (gnutls_session_t session, | |||
225 | } | 225 | } |
226 | 226 | ||
227 | /** | 227 | /** |
228 | * gnutls_dh_get_secret_bits - This function returns the bits used in DH authentication | 228 | * MHD_gnutls_dh_get_secret_bits - This function returns the bits used in DH authentication |
229 | * @session: is a gnutls session | 229 | * @session: is a gnutls session |
230 | * | 230 | * |
231 | * This function will return the bits used in the last Diffie Hellman authentication | 231 | * This function will return the bits used in the last Diffie Hellman authentication |
@@ -234,15 +234,15 @@ gnutls_rsa_export_get_pubkey (gnutls_session_t session, | |||
234 | * | 234 | * |
235 | **/ | 235 | **/ |
236 | int | 236 | int |
237 | gnutls_dh_get_secret_bits (gnutls_session_t session) | 237 | MHD_gnutls_dh_get_secret_bits (mhd_gtls_session_t session) |
238 | { | 238 | { |
239 | switch (gnutls_auth_get_type (session)) | 239 | switch (MHD_gtls_auth_get_type (session)) |
240 | { | 240 | { |
241 | case MHD_GNUTLS_CRD_ANON: | 241 | case MHD_GNUTLS_CRD_ANON: |
242 | { | 242 | { |
243 | anon_auth_info_t info; | 243 | mhd_anon_auth_info_t info; |
244 | 244 | ||
245 | info = _gnutls_get_auth_info (session); | 245 | info = mhd_gtls_get_auth_info (session); |
246 | if (info == NULL) | 246 | if (info == NULL) |
247 | return GNUTLS_E_INTERNAL_ERROR; | 247 | return GNUTLS_E_INTERNAL_ERROR; |
248 | return info->dh.secret_bits; | 248 | return info->dh.secret_bits; |
@@ -251,7 +251,7 @@ gnutls_dh_get_secret_bits (gnutls_session_t session) | |||
251 | { | 251 | { |
252 | cert_auth_info_t info; | 252 | cert_auth_info_t info; |
253 | 253 | ||
254 | info = _gnutls_get_auth_info (session); | 254 | info = mhd_gtls_get_auth_info (session); |
255 | if (info == NULL) | 255 | if (info == NULL) |
256 | return GNUTLS_E_INTERNAL_ERROR; | 256 | return GNUTLS_E_INTERNAL_ERROR; |
257 | 257 | ||
@@ -264,7 +264,7 @@ gnutls_dh_get_secret_bits (gnutls_session_t session) | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /** | 266 | /** |
267 | * gnutls_dh_get_prime_bits - This function returns the bits used in DH authentication | 267 | * MHD_gnutls_dh_get_prime_bits - This function returns the bits used in DH authentication |
268 | * @session: is a gnutls session | 268 | * @session: is a gnutls session |
269 | * | 269 | * |
270 | * This function will return the bits of the prime used in the last Diffie Hellman authentication | 270 | * This function will return the bits of the prime used in the last Diffie Hellman authentication |
@@ -273,17 +273,17 @@ gnutls_dh_get_secret_bits (gnutls_session_t session) | |||
273 | * | 273 | * |
274 | **/ | 274 | **/ |
275 | int | 275 | int |
276 | gnutls_dh_get_prime_bits (gnutls_session_t session) | 276 | MHD_gnutls_dh_get_prime_bits (mhd_gtls_session_t session) |
277 | { | 277 | { |
278 | dh_info_st *dh; | 278 | dh_info_st *dh; |
279 | 279 | ||
280 | switch (gnutls_auth_get_type (session)) | 280 | switch (MHD_gtls_auth_get_type (session)) |
281 | { | 281 | { |
282 | case MHD_GNUTLS_CRD_ANON: | 282 | case MHD_GNUTLS_CRD_ANON: |
283 | { | 283 | { |
284 | anon_auth_info_t info; | 284 | mhd_anon_auth_info_t info; |
285 | 285 | ||
286 | info = _gnutls_get_auth_info (session); | 286 | info = mhd_gtls_get_auth_info (session); |
287 | if (info == NULL) | 287 | if (info == NULL) |
288 | return GNUTLS_E_INTERNAL_ERROR; | 288 | return GNUTLS_E_INTERNAL_ERROR; |
289 | dh = &info->dh; | 289 | dh = &info->dh; |
@@ -293,7 +293,7 @@ gnutls_dh_get_prime_bits (gnutls_session_t session) | |||
293 | { | 293 | { |
294 | cert_auth_info_t info; | 294 | cert_auth_info_t info; |
295 | 295 | ||
296 | info = _gnutls_get_auth_info (session); | 296 | info = mhd_gtls_get_auth_info (session); |
297 | if (info == NULL) | 297 | if (info == NULL) |
298 | return GNUTLS_E_INTERNAL_ERROR; | 298 | return GNUTLS_E_INTERNAL_ERROR; |
299 | 299 | ||
@@ -310,7 +310,7 @@ gnutls_dh_get_prime_bits (gnutls_session_t session) | |||
310 | } | 310 | } |
311 | 311 | ||
312 | /** | 312 | /** |
313 | * gnutls_rsa_export_get_modulus_bits - This function returns the bits used in RSA-export key exchange | 313 | * MHD_gtls_rsa_export_get_modulus_bits - This function returns the bits used in RSA-export key exchange |
314 | * @session: is a gnutls session | 314 | * @session: is a gnutls session |
315 | * | 315 | * |
316 | * This function will return the bits used in the last RSA-EXPORT key exchange | 316 | * This function will return the bits used in the last RSA-EXPORT key exchange |
@@ -319,11 +319,11 @@ gnutls_dh_get_prime_bits (gnutls_session_t session) | |||
319 | * | 319 | * |
320 | **/ | 320 | **/ |
321 | int | 321 | int |
322 | gnutls_rsa_export_get_modulus_bits (gnutls_session_t session) | 322 | MHD_gtls_rsa_export_get_modulus_bits (mhd_gtls_session_t session) |
323 | { | 323 | { |
324 | cert_auth_info_t info; | 324 | cert_auth_info_t info; |
325 | 325 | ||
326 | info = _gnutls_get_auth_info (session); | 326 | info = mhd_gtls_get_auth_info (session); |
327 | if (info == NULL) | 327 | if (info == NULL) |
328 | return GNUTLS_E_INTERNAL_ERROR; | 328 | return GNUTLS_E_INTERNAL_ERROR; |
329 | 329 | ||
@@ -331,7 +331,7 @@ gnutls_rsa_export_get_modulus_bits (gnutls_session_t session) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | /** | 333 | /** |
334 | * gnutls_dh_get_peers_public_bits - This function returns the bits used in DH authentication | 334 | * MHD_gnutls_dh_get_peers_public_bits - This function returns the bits used in DH authentication |
335 | * @session: is a gnutls session | 335 | * @session: is a gnutls session |
336 | * | 336 | * |
337 | * This function will return the bits used in the last Diffie Hellman authentication | 337 | * This function will return the bits used in the last Diffie Hellman authentication |
@@ -340,17 +340,17 @@ gnutls_rsa_export_get_modulus_bits (gnutls_session_t session) | |||
340 | * | 340 | * |
341 | **/ | 341 | **/ |
342 | int | 342 | int |
343 | gnutls_dh_get_peers_public_bits (gnutls_session_t session) | 343 | MHD_gnutls_dh_get_peers_public_bits (mhd_gtls_session_t session) |
344 | { | 344 | { |
345 | dh_info_st *dh; | 345 | dh_info_st *dh; |
346 | 346 | ||
347 | switch (gnutls_auth_get_type (session)) | 347 | switch (MHD_gtls_auth_get_type (session)) |
348 | { | 348 | { |
349 | case MHD_GNUTLS_CRD_ANON: | 349 | case MHD_GNUTLS_CRD_ANON: |
350 | { | 350 | { |
351 | anon_auth_info_t info; | 351 | mhd_anon_auth_info_t info; |
352 | 352 | ||
353 | info = _gnutls_get_auth_info (session); | 353 | info = mhd_gtls_get_auth_info (session); |
354 | if (info == NULL) | 354 | if (info == NULL) |
355 | return GNUTLS_E_INTERNAL_ERROR; | 355 | return GNUTLS_E_INTERNAL_ERROR; |
356 | 356 | ||
@@ -361,7 +361,7 @@ gnutls_dh_get_peers_public_bits (gnutls_session_t session) | |||
361 | { | 361 | { |
362 | cert_auth_info_t info; | 362 | cert_auth_info_t info; |
363 | 363 | ||
364 | info = _gnutls_get_auth_info (session); | 364 | info = mhd_gtls_get_auth_info (session); |
365 | if (info == NULL) | 365 | if (info == NULL) |
366 | return GNUTLS_E_INTERNAL_ERROR; | 366 | return GNUTLS_E_INTERNAL_ERROR; |
367 | 367 | ||
@@ -380,7 +380,7 @@ gnutls_dh_get_peers_public_bits (gnutls_session_t session) | |||
380 | /* CERTIFICATE STUFF */ | 380 | /* CERTIFICATE STUFF */ |
381 | 381 | ||
382 | /** | 382 | /** |
383 | * gnutls_certificate_get_ours - This function returns the raw certificate sent in the last handshake | 383 | * MHD_gtls_certificate_get_ours - This function returns the raw certificate sent in the last handshake |
384 | * @session: is a gnutls session | 384 | * @session: is a gnutls session |
385 | * | 385 | * |
386 | * This function will return the certificate as sent to the peer, | 386 | * This function will return the certificate as sent to the peer, |
@@ -391,14 +391,14 @@ gnutls_dh_get_peers_public_bits (gnutls_session_t session) | |||
391 | * | 391 | * |
392 | **/ | 392 | **/ |
393 | const gnutls_datum_t * | 393 | const gnutls_datum_t * |
394 | gnutls_certificate_get_ours (gnutls_session_t session) | 394 | MHD_gtls_certificate_get_ours (mhd_gtls_session_t session) |
395 | { | 395 | { |
396 | gnutls_certificate_credentials_t cred; | 396 | mhd_gtls_cert_credentials_t cred; |
397 | 397 | ||
398 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 398 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
399 | 399 | ||
400 | cred | 400 | cred |
401 | = (gnutls_certificate_credentials_t) _gnutls_get_cred (session->key, | 401 | = (mhd_gtls_cert_credentials_t) mhd_gtls_get_cred (session->key, |
402 | MHD_GNUTLS_CRD_CERTIFICATE, | 402 | MHD_GNUTLS_CRD_CERTIFICATE, |
403 | NULL); | 403 | NULL); |
404 | if (cred == NULL || cred->cert_list == NULL) | 404 | if (cred == NULL || cred->cert_list == NULL) |
@@ -414,7 +414,7 @@ gnutls_certificate_get_ours (gnutls_session_t session) | |||
414 | } | 414 | } |
415 | 415 | ||
416 | /** | 416 | /** |
417 | * gnutls_certificate_get_peers - This function returns the peer's raw certificate | 417 | * MHD_gtls_certificate_get_peers - This function returns the peer's raw certificate |
418 | * @session: is a gnutls session | 418 | * @session: is a gnutls session |
419 | * @list_size: is the length of the certificate list | 419 | * @list_size: is the length of the certificate list |
420 | * | 420 | * |
@@ -431,14 +431,14 @@ gnutls_certificate_get_ours (gnutls_session_t session) | |||
431 | * | 431 | * |
432 | **/ | 432 | **/ |
433 | const gnutls_datum_t * | 433 | const gnutls_datum_t * |
434 | gnutls_certificate_get_peers (gnutls_session_t | 434 | MHD_gtls_certificate_get_peers (mhd_gtls_session_t |
435 | session, unsigned int *list_size) | 435 | session, unsigned int *list_size) |
436 | { | 436 | { |
437 | cert_auth_info_t info; | 437 | cert_auth_info_t info; |
438 | 438 | ||
439 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 439 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
440 | 440 | ||
441 | info = _gnutls_get_auth_info (session); | 441 | info = mhd_gtls_get_auth_info (session); |
442 | if (info == NULL) | 442 | if (info == NULL) |
443 | return NULL; | 443 | return NULL; |
444 | 444 | ||
@@ -447,7 +447,7 @@ gnutls_certificate_get_peers (gnutls_session_t | |||
447 | } | 447 | } |
448 | 448 | ||
449 | /** | 449 | /** |
450 | * gnutls_certificate_client_get_request_status - This function returns the certificate request status | 450 | * MHD_gtls_certificate_client_get_request_status - This function returns the certificate request status |
451 | * @session: is a gnutls session | 451 | * @session: is a gnutls session |
452 | * | 452 | * |
453 | * This function will return 0 if the peer (server) did not request client | 453 | * This function will return 0 if the peer (server) did not request client |
@@ -456,20 +456,20 @@ gnutls_certificate_get_peers (gnutls_session_t | |||
456 | * | 456 | * |
457 | **/ | 457 | **/ |
458 | int | 458 | int |
459 | gnutls_certificate_client_get_request_status (gnutls_session_t session) | 459 | MHD_gtls_certificate_client_get_request_status (mhd_gtls_session_t session) |
460 | { | 460 | { |
461 | cert_auth_info_t info; | 461 | cert_auth_info_t info; |
462 | 462 | ||
463 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, 0); | 463 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, 0); |
464 | 464 | ||
465 | info = _gnutls_get_auth_info (session); | 465 | info = mhd_gtls_get_auth_info (session); |
466 | if (info == NULL) | 466 | if (info == NULL) |
467 | return GNUTLS_E_INTERNAL_ERROR; | 467 | return GNUTLS_E_INTERNAL_ERROR; |
468 | return info->certificate_requested; | 468 | return info->certificate_requested; |
469 | } | 469 | } |
470 | 470 | ||
471 | /** | 471 | /** |
472 | * gnutls_fingerprint - This function calculates the fingerprint of the given data | 472 | * MHD_gnutls_fingerprint - This function calculates the fingerprint of the given data |
473 | * @algo: is a digest algorithm | 473 | * @algo: is a digest algorithm |
474 | * @data: is the data | 474 | * @data: is the data |
475 | * @result: is the place where the result will be copied (may be null). | 475 | * @result: is the place where the result will be copied (may be null). |
@@ -489,12 +489,12 @@ gnutls_certificate_client_get_request_status (gnutls_session_t session) | |||
489 | * | 489 | * |
490 | **/ | 490 | **/ |
491 | int | 491 | int |
492 | gnutls_fingerprint (gnutls_digest_algorithm_t algo, | 492 | MHD_gnutls_fingerprint (gnutls_digest_algorithm_t algo, |
493 | const gnutls_datum_t * data, | 493 | const gnutls_datum_t * data, |
494 | void *result, size_t * result_size) | 494 | void *result, size_t * result_size) |
495 | { | 495 | { |
496 | GNUTLS_HASH_HANDLE td; | 496 | GNUTLS_HASH_HANDLE td; |
497 | int hash_len = _gnutls_hash_get_algo_len (HASH2MAC (algo)); | 497 | int hash_len = mhd_gnutls_hash_get_algo_len (HASH2MAC (algo)); |
498 | 498 | ||
499 | if (hash_len < 0 || (unsigned) hash_len > *result_size || result == NULL) | 499 | if (hash_len < 0 || (unsigned) hash_len > *result_size || result == NULL) |
500 | { | 500 | { |
@@ -505,21 +505,21 @@ gnutls_fingerprint (gnutls_digest_algorithm_t algo, | |||
505 | 505 | ||
506 | if (result) | 506 | if (result) |
507 | { | 507 | { |
508 | td = _gnutls_hash_init (HASH2MAC (algo)); | 508 | td = mhd_gtls_hash_init (HASH2MAC (algo)); |
509 | if (td == NULL) | 509 | if (td == NULL) |
510 | return GNUTLS_E_HASH_FAILED; | 510 | return GNUTLS_E_HASH_FAILED; |
511 | 511 | ||
512 | _gnutls_hash (td, data->data, data->size); | 512 | mhd_gnutls_hash (td, data->data, data->size); |
513 | 513 | ||
514 | _gnutls_hash_deinit (td, result); | 514 | mhd_gnutls_hash_deinit (td, result); |
515 | } | 515 | } |
516 | 516 | ||
517 | return 0; | 517 | return 0; |
518 | } | 518 | } |
519 | 519 | ||
520 | /** | 520 | /** |
521 | * gnutls_certificate_set_dh_params - This function will set the DH parameters for a server to use | 521 | * MHD_gnutls_certificate_set_dh_params - This function will set the DH parameters for a server to use |
522 | * @res: is a gnutls_certificate_credentials_t structure | 522 | * @res: is a mhd_gtls_cert_credentials_t structure |
523 | * @dh_params: is a structure that holds diffie hellman parameters. | 523 | * @dh_params: is a structure that holds diffie hellman parameters. |
524 | * | 524 | * |
525 | * This function will set the diffie hellman parameters for a | 525 | * This function will set the diffie hellman parameters for a |
@@ -531,15 +531,15 @@ gnutls_fingerprint (gnutls_digest_algorithm_t algo, | |||
531 | * | 531 | * |
532 | **/ | 532 | **/ |
533 | void | 533 | void |
534 | gnutls_certificate_set_dh_params (gnutls_certificate_credentials_t res, | 534 | MHD_gnutls_certificate_set_dh_params (mhd_gtls_cert_credentials_t res, |
535 | gnutls_dh_params_t dh_params) | 535 | mhd_gtls_dh_params_t dh_params) |
536 | { | 536 | { |
537 | res->dh_params = dh_params; | 537 | res->dh_params = dh_params; |
538 | } | 538 | } |
539 | 539 | ||
540 | /** | 540 | /** |
541 | * gnutls_certificate_set_params_function - This function will set the DH or RSA parameters callback | 541 | * gnutls_certificate_set_params_function - This function will set the DH or RSA parameters callback |
542 | * @res: is a gnutls_certificate_credentials_t structure | 542 | * @res: is a mhd_gtls_cert_credentials_t structure |
543 | * @func: is the function to be called | 543 | * @func: is the function to be called |
544 | * | 544 | * |
545 | * This function will set a callback in order for the server to get the | 545 | * This function will set a callback in order for the server to get the |
@@ -548,15 +548,15 @@ gnutls_certificate_set_dh_params (gnutls_certificate_credentials_t res, | |||
548 | * | 548 | * |
549 | **/ | 549 | **/ |
550 | void | 550 | void |
551 | gnutls_certificate_set_params_function (gnutls_certificate_credentials_t res, | 551 | gnutls_certificate_set_params_function (mhd_gtls_cert_credentials_t res, |
552 | gnutls_params_function * func) | 552 | gnutls_params_function * func) |
553 | { | 553 | { |
554 | res->params_func = func; | 554 | res->params_func = func; |
555 | } | 555 | } |
556 | 556 | ||
557 | /** | 557 | /** |
558 | * gnutls_certificate_set_verify_flags - This function will set the flags to be used at certificate verification | 558 | * MHD_gnutls_certificate_set_verify_flags - This function will set the flags to be used at certificate verification |
559 | * @res: is a gnutls_certificate_credentials_t structure | 559 | * @res: is a mhd_gtls_cert_credentials_t structure |
560 | * @flags: are the flags | 560 | * @flags: are the flags |
561 | * | 561 | * |
562 | * This function will set the flags to be used at verification of the | 562 | * This function will set the flags to be used at verification of the |
@@ -565,25 +565,25 @@ gnutls_certificate_set_params_function (gnutls_certificate_credentials_t res, | |||
565 | * | 565 | * |
566 | **/ | 566 | **/ |
567 | void | 567 | void |
568 | gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_t | 568 | MHD_gnutls_certificate_set_verify_flags (mhd_gtls_cert_credentials_t |
569 | res, unsigned int flags) | 569 | res, unsigned int flags) |
570 | { | 570 | { |
571 | res->verify_flags = flags; | 571 | res->verify_flags = flags; |
572 | } | 572 | } |
573 | 573 | ||
574 | /** | 574 | /** |
575 | * gnutls_certificate_set_verify_limits - This function will set the upper limits to be used at certificate verification | 575 | * MHD_gnutls_certificate_set_verify_limits - This function will set the upper limits to be used at certificate verification |
576 | * @res: is a gnutls_certificate_credentials structure | 576 | * @res: is a gnutls_certificate_credentials structure |
577 | * @max_bits: is the number of bits of an acceptable certificate (default 8200) | 577 | * @max_bits: is the number of bits of an acceptable certificate (default 8200) |
578 | * @max_depth: is maximum depth of the verification of a certificate chain (default 5) | 578 | * @max_depth: is maximum depth of the verification of a certificate chain (default 5) |
579 | * | 579 | * |
580 | * This function will set some upper limits for the default verification function, | 580 | * This function will set some upper limits for the default verification function, |
581 | * gnutls_certificate_verify_peers2(), to avoid denial of service attacks. | 581 | * MHD_gtls_certificate_verify_peers2(), to avoid denial of service attacks. |
582 | * You can set them to zero to disable limits. | 582 | * You can set them to zero to disable limits. |
583 | * | 583 | * |
584 | **/ | 584 | **/ |
585 | void | 585 | void |
586 | gnutls_certificate_set_verify_limits (gnutls_certificate_credentials_t | 586 | MHD_gnutls_certificate_set_verify_limits (mhd_gtls_cert_credentials_t |
587 | res, | 587 | res, |
588 | unsigned int max_bits, | 588 | unsigned int max_bits, |
589 | unsigned int max_depth) | 589 | unsigned int max_depth) |
@@ -593,8 +593,8 @@ gnutls_certificate_set_verify_limits (gnutls_certificate_credentials_t | |||
593 | } | 593 | } |
594 | 594 | ||
595 | /** | 595 | /** |
596 | * gnutls_certificate_set_rsa_export_params - This function will set the RSA parameters for a server to use | 596 | * MHD_gnutls_certificate_set_rsa_export_params - This function will set the RSA parameters for a server to use |
597 | * @res: is a gnutls_certificate_credentials_t structure | 597 | * @res: is a mhd_gtls_cert_credentials_t structure |
598 | * @rsa_params: is a structure that holds temporary RSA parameters. | 598 | * @rsa_params: is a structure that holds temporary RSA parameters. |
599 | * | 599 | * |
600 | * This function will set the temporary RSA parameters for a certificate | 600 | * This function will set the temporary RSA parameters for a certificate |
@@ -603,15 +603,15 @@ gnutls_certificate_set_verify_limits (gnutls_certificate_credentials_t | |||
603 | * | 603 | * |
604 | **/ | 604 | **/ |
605 | void | 605 | void |
606 | gnutls_certificate_set_rsa_export_params (gnutls_certificate_credentials_t | 606 | MHD_gnutls_certificate_set_rsa_export_params (mhd_gtls_cert_credentials_t |
607 | res, gnutls_rsa_params_t rsa_params) | 607 | res, mhd_gtls_rsa_params_t rsa_params) |
608 | { | 608 | { |
609 | res->rsa_params = rsa_params; | 609 | res->rsa_params = rsa_params; |
610 | } | 610 | } |
611 | 611 | ||
612 | /** | 612 | /** |
613 | * gnutls_anon_set_params_function - This function will set the DH or RSA parameters callback | 613 | * gnutls_anon_set_params_function - This function will set the DH or RSA parameters callback |
614 | * @res: is a gnutls_anon_server_credentials_t structure | 614 | * @res: is a mhd_gtls_anon_server_credentials_t structure |
615 | * @func: is the function to be called | 615 | * @func: is the function to be called |
616 | * | 616 | * |
617 | * This function will set a callback in order for the server to get the | 617 | * This function will set a callback in order for the server to get the |
@@ -620,7 +620,7 @@ gnutls_certificate_set_rsa_export_params (gnutls_certificate_credentials_t | |||
620 | * | 620 | * |
621 | **/ | 621 | **/ |
622 | void | 622 | void |
623 | gnutls_anon_set_params_function (gnutls_anon_server_credentials_t res, | 623 | gnutls_anon_set_params_function (mhd_gtls_anon_server_credentials_t res, |
624 | gnutls_params_function * func) | 624 | gnutls_params_function * func) |
625 | { | 625 | { |
626 | res->params_func = func; | 626 | res->params_func = func; |
diff --git a/src/daemon/https/tls/gnutls_x509.c b/src/daemon/https/tls/gnutls_x509.c index a9b6829d..bf66e632 100644 --- a/src/daemon/https/tls/gnutls_x509.c +++ b/src/daemon/https/tls/gnutls_x509.c | |||
@@ -100,25 +100,25 @@ check_bits (gnutls_x509_crt_t crt, unsigned int max_bits) | |||
100 | * | 100 | * |
101 | -*/ | 101 | -*/ |
102 | int | 102 | int |
103 | _gnutls_x509_cert_verify_peers (gnutls_session_t session, | 103 | _gnutls_x509_cert_verify_peers (mhd_gtls_session_t session, |
104 | unsigned int *status) | 104 | unsigned int *status) |
105 | { | 105 | { |
106 | cert_auth_info_t info; | 106 | cert_auth_info_t info; |
107 | gnutls_certificate_credentials_t cred; | 107 | mhd_gtls_cert_credentials_t cred; |
108 | gnutls_x509_crt_t *peer_certificate_list; | 108 | gnutls_x509_crt_t *peer_certificate_list; |
109 | int peer_certificate_list_size, i, x, ret; | 109 | int peer_certificate_list_size, i, x, ret; |
110 | 110 | ||
111 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); | 111 | CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); |
112 | 112 | ||
113 | info = _gnutls_get_auth_info (session); | 113 | info = mhd_gtls_get_auth_info (session); |
114 | if (info == NULL) | 114 | if (info == NULL) |
115 | { | 115 | { |
116 | gnutls_assert (); | 116 | gnutls_assert (); |
117 | return GNUTLS_E_INVALID_REQUEST; | 117 | return GNUTLS_E_INVALID_REQUEST; |
118 | } | 118 | } |
119 | 119 | ||
120 | cred = (gnutls_certificate_credentials_t) | 120 | cred = (mhd_gtls_cert_credentials_t) |
121 | _gnutls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); | 121 | mhd_gtls_get_cred (session->key, MHD_GNUTLS_CRD_CERTIFICATE, NULL); |
122 | if (cred == NULL) | 122 | if (cred == NULL) |
123 | { | 123 | { |
124 | gnutls_assert (); | 124 | gnutls_assert (); |
@@ -206,7 +206,7 @@ _gnutls_x509_cert_verify_peers (gnutls_session_t session, | |||
206 | * the given key parameters. | 206 | * the given key parameters. |
207 | */ | 207 | */ |
208 | static int | 208 | static int |
209 | _gnutls_check_key_cert_match (gnutls_certificate_credentials_t res) | 209 | _gnutls_check_key_cert_match (mhd_gtls_cert_credentials_t res) |
210 | { | 210 | { |
211 | gnutls_datum_t cid; | 211 | gnutls_datum_t cid; |
212 | gnutls_datum_t kid; | 212 | gnutls_datum_t kid; |
@@ -263,7 +263,7 @@ parse_crt_mem (gnutls_cert ** cert_list, unsigned *ncerts, | |||
263 | i = *ncerts + 1; | 263 | i = *ncerts + 1; |
264 | 264 | ||
265 | *cert_list = | 265 | *cert_list = |
266 | (gnutls_cert *) gnutls_realloc_fast (*cert_list, | 266 | (gnutls_cert *) mhd_gtls_realloc_fast (*cert_list, |
267 | i * sizeof (gnutls_cert)); | 267 | i * sizeof (gnutls_cert)); |
268 | 268 | ||
269 | if (*cert_list == NULL) | 269 | if (*cert_list == NULL) |
@@ -272,7 +272,7 @@ parse_crt_mem (gnutls_cert ** cert_list, unsigned *ncerts, | |||
272 | return GNUTLS_E_MEMORY_ERROR; | 272 | return GNUTLS_E_MEMORY_ERROR; |
273 | } | 273 | } |
274 | 274 | ||
275 | ret = _gnutls_x509_crt_to_gcert (&cert_list[0][i - 1], cert, 0); | 275 | ret = mhd_gtls_x509_crt_to_gcert (&cert_list[0][i - 1], cert, 0); |
276 | if (ret < 0) | 276 | if (ret < 0) |
277 | { | 277 | { |
278 | gnutls_assert (); | 278 | gnutls_assert (); |
@@ -408,7 +408,7 @@ parse_pkcs7_cert_mem (gnutls_cert ** cert_list, unsigned *ncerts, const | |||
408 | if (ret >= 0) | 408 | if (ret >= 0) |
409 | { | 409 | { |
410 | *cert_list = | 410 | *cert_list = |
411 | (gnutls_cert *) gnutls_realloc_fast (*cert_list, | 411 | (gnutls_cert *) mhd_gtls_realloc_fast (*cert_list, |
412 | i * sizeof (gnutls_cert)); | 412 | i * sizeof (gnutls_cert)); |
413 | 413 | ||
414 | if (*cert_list == NULL) | 414 | if (*cert_list == NULL) |
@@ -422,7 +422,7 @@ parse_pkcs7_cert_mem (gnutls_cert ** cert_list, unsigned *ncerts, const | |||
422 | tmp2.size = pcert_size; | 422 | tmp2.size = pcert_size; |
423 | 423 | ||
424 | ret = | 424 | ret = |
425 | _gnutls_x509_raw_cert_to_gcert (&cert_list[0][i - 1], &tmp2, 0); | 425 | mhd_gtls_x509_raw_cert_to_gcert (&cert_list[0][i - 1], &tmp2, 0); |
426 | 426 | ||
427 | if (ret < 0) | 427 | if (ret < 0) |
428 | { | 428 | { |
@@ -502,7 +502,7 @@ parse_pem_cert_mem (gnutls_cert ** cert_list, unsigned *ncerts, | |||
502 | } | 502 | } |
503 | 503 | ||
504 | *cert_list = | 504 | *cert_list = |
505 | (gnutls_cert *) gnutls_realloc_fast (*cert_list, | 505 | (gnutls_cert *) mhd_gtls_realloc_fast (*cert_list, |
506 | i * sizeof (gnutls_cert)); | 506 | i * sizeof (gnutls_cert)); |
507 | 507 | ||
508 | if (*cert_list == NULL) | 508 | if (*cert_list == NULL) |
@@ -514,7 +514,7 @@ parse_pem_cert_mem (gnutls_cert ** cert_list, unsigned *ncerts, | |||
514 | tmp.data = ptr2; | 514 | tmp.data = ptr2; |
515 | tmp.size = siz2; | 515 | tmp.size = siz2; |
516 | 516 | ||
517 | ret = _gnutls_x509_raw_cert_to_gcert (&cert_list[0][i - 1], &tmp, 0); | 517 | ret = mhd_gtls_x509_raw_cert_to_gcert (&cert_list[0][i - 1], &tmp, 0); |
518 | if (ret < 0) | 518 | if (ret < 0) |
519 | { | 519 | { |
520 | gnutls_assert (); | 520 | gnutls_assert (); |
@@ -559,14 +559,14 @@ parse_pem_cert_mem (gnutls_cert ** cert_list, unsigned *ncerts, | |||
559 | /* Reads a DER or PEM certificate from memory | 559 | /* Reads a DER or PEM certificate from memory |
560 | */ | 560 | */ |
561 | static int | 561 | static int |
562 | read_cert_mem (gnutls_certificate_credentials_t res, const void *cert, | 562 | read_cert_mem (mhd_gtls_cert_credentials_t res, const void *cert, |
563 | int cert_size, gnutls_x509_crt_fmt_t type) | 563 | int cert_size, gnutls_x509_crt_fmt_t type) |
564 | { | 564 | { |
565 | int ret; | 565 | int ret; |
566 | 566 | ||
567 | /* allocate space for the certificate to add | 567 | /* allocate space for the certificate to add |
568 | */ | 568 | */ |
569 | res->cert_list = gnutls_realloc_fast (res->cert_list, | 569 | res->cert_list = mhd_gtls_realloc_fast (res->cert_list, |
570 | (1 + | 570 | (1 + |
571 | res->ncerts) * | 571 | res->ncerts) * |
572 | sizeof (gnutls_cert *)); | 572 | sizeof (gnutls_cert *)); |
@@ -576,7 +576,7 @@ read_cert_mem (gnutls_certificate_credentials_t res, const void *cert, | |||
576 | return GNUTLS_E_MEMORY_ERROR; | 576 | return GNUTLS_E_MEMORY_ERROR; |
577 | } | 577 | } |
578 | 578 | ||
579 | res->cert_list_length = gnutls_realloc_fast (res->cert_list_length, | 579 | res->cert_list_length = mhd_gtls_realloc_fast (res->cert_list_length, |
580 | (1 + | 580 | (1 + |
581 | res->ncerts) * sizeof (int)); | 581 | res->ncerts) * sizeof (int)); |
582 | if (res->cert_list_length == NULL) | 582 | if (res->cert_list_length == NULL) |
@@ -636,13 +636,13 @@ cleanup: | |||
636 | 636 | ||
637 | for (i = 0; i < src->params_size; i++) | 637 | for (i = 0; i < src->params_size; i++) |
638 | { | 638 | { |
639 | _gnutls_mpi_release (&dest->params[i]); | 639 | mhd_gtls_mpi_release (&dest->params[i]); |
640 | } | 640 | } |
641 | return ret; | 641 | return ret; |
642 | } | 642 | } |
643 | 643 | ||
644 | void | 644 | void |
645 | _gnutls_gkey_deinit (gnutls_privkey * key) | 645 | mhd_gtls_gkey_deinit (gnutls_privkey * key) |
646 | { | 646 | { |
647 | int i; | 647 | int i; |
648 | if (key == NULL) | 648 | if (key == NULL) |
@@ -650,7 +650,7 @@ _gnutls_gkey_deinit (gnutls_privkey * key) | |||
650 | 650 | ||
651 | for (i = 0; i < key->params_size; i++) | 651 | for (i = 0; i < key->params_size; i++) |
652 | { | 652 | { |
653 | _gnutls_mpi_release (&key->params[i]); | 653 | mhd_gtls_mpi_release (&key->params[i]); |
654 | } | 654 | } |
655 | } | 655 | } |
656 | 656 | ||
@@ -702,7 +702,7 @@ _gnutls_x509_raw_privkey_to_gkey (gnutls_privkey * privkey, | |||
702 | * that GnuTLS doesn't know the private key. | 702 | * that GnuTLS doesn't know the private key. |
703 | */ | 703 | */ |
704 | static int | 704 | static int |
705 | read_key_mem (gnutls_certificate_credentials_t res, | 705 | read_key_mem (mhd_gtls_cert_credentials_t res, |
706 | const void *key, int key_size, gnutls_x509_crt_fmt_t type) | 706 | const void *key, int key_size, gnutls_x509_crt_fmt_t type) |
707 | { | 707 | { |
708 | int ret; | 708 | int ret; |
@@ -711,7 +711,7 @@ read_key_mem (gnutls_certificate_credentials_t res, | |||
711 | /* allocate space for the pkey list | 711 | /* allocate space for the pkey list |
712 | */ | 712 | */ |
713 | res->pkey = | 713 | res->pkey = |
714 | gnutls_realloc_fast (res->pkey, | 714 | mhd_gtls_realloc_fast (res->pkey, |
715 | (res->ncerts + 1) * sizeof (gnutls_privkey)); | 715 | (res->ncerts + 1) * sizeof (gnutls_privkey)); |
716 | if (res->pkey == NULL) | 716 | if (res->pkey == NULL) |
717 | { | 717 | { |
@@ -742,7 +742,7 @@ read_key_mem (gnutls_certificate_credentials_t res, | |||
742 | /* Reads a certificate file | 742 | /* Reads a certificate file |
743 | */ | 743 | */ |
744 | static int | 744 | static int |
745 | read_cert_file (gnutls_certificate_credentials_t res, | 745 | read_cert_file (mhd_gtls_cert_credentials_t res, |
746 | const char *certfile, gnutls_x509_crt_fmt_t type) | 746 | const char *certfile, gnutls_x509_crt_fmt_t type) |
747 | { | 747 | { |
748 | int ret; | 748 | int ret; |
@@ -768,7 +768,7 @@ read_cert_file (gnutls_certificate_credentials_t res, | |||
768 | * stores it). | 768 | * stores it). |
769 | */ | 769 | */ |
770 | static int | 770 | static int |
771 | read_key_file (gnutls_certificate_credentials_t res, | 771 | read_key_file (mhd_gtls_cert_credentials_t res, |
772 | const char *keyfile, gnutls_x509_crt_fmt_t type) | 772 | const char *keyfile, gnutls_x509_crt_fmt_t type) |
773 | { | 773 | { |
774 | int ret; | 774 | int ret; |
@@ -788,14 +788,14 @@ read_key_file (gnutls_certificate_credentials_t res, | |||
788 | } | 788 | } |
789 | 789 | ||
790 | /** | 790 | /** |
791 | * gnutls_certificate_set_x509_key_mem - Used to set keys in a gnutls_certificate_credentials_t structure | 791 | * MHD_gnutls_certificate_set_x509_key_mem - Used to set keys in a mhd_gtls_cert_credentials_t structure |
792 | * @res: is an #gnutls_certificate_credentials_t structure. | 792 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
793 | * @cert: contains a certificate list (path) for the specified private key | 793 | * @cert: contains a certificate list (path) for the specified private key |
794 | * @key: is the private key, or %NULL | 794 | * @key: is the private key, or %NULL |
795 | * @type: is PEM or DER | 795 | * @type: is PEM or DER |
796 | * | 796 | * |
797 | * This function sets a certificate/private key pair in the | 797 | * This function sets a certificate/private key pair in the |
798 | * gnutls_certificate_credentials_t structure. This function may be called | 798 | * mhd_gtls_cert_credentials_t structure. This function may be called |
799 | * more than once (in case multiple keys/certificates exist for the | 799 | * more than once (in case multiple keys/certificates exist for the |
800 | * server). | 800 | * server). |
801 | * | 801 | * |
@@ -813,12 +813,12 @@ read_key_file (gnutls_certificate_credentials_t res, | |||
813 | * then the strings that hold their values must be null terminated. | 813 | * then the strings that hold their values must be null terminated. |
814 | * | 814 | * |
815 | * The @key may be %NULL if you are using a sign callback, see | 815 | * The @key may be %NULL if you are using a sign callback, see |
816 | * gnutls_sign_callback_set(). | 816 | * MHD_gtls_sign_callback_set(). |
817 | * | 817 | * |
818 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 818 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
819 | **/ | 819 | **/ |
820 | int | 820 | int |
821 | gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t | 821 | MHD_gnutls_certificate_set_x509_key_mem (mhd_gtls_cert_credentials_t |
822 | res, const gnutls_datum_t * cert, | 822 | res, const gnutls_datum_t * cert, |
823 | const gnutls_datum_t * key, | 823 | const gnutls_datum_t * key, |
824 | gnutls_x509_crt_fmt_t type) | 824 | gnutls_x509_crt_fmt_t type) |
@@ -846,100 +846,15 @@ gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t | |||
846 | } | 846 | } |
847 | 847 | ||
848 | /** | 848 | /** |
849 | * gnutls_certificate_set_x509_key - Used to set keys in a gnutls_certificate_credentials_t structure | 849 | * MHD_gnutls_certificate_set_x509_key_file - Used to set keys in a mhd_gtls_cert_credentials_t structure |
850 | * @res: is an #gnutls_certificate_credentials_t structure. | 850 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
851 | * @cert_list: contains a certificate list (path) for the specified private key | ||
852 | * @cert_list_size: holds the size of the certificate list | ||
853 | * @key: is a gnutls_x509_privkey_t key | ||
854 | * | ||
855 | * This function sets a certificate/private key pair in the | ||
856 | * gnutls_certificate_credentials_t structure. This function may be | ||
857 | * called more than once (in case multiple keys/certificates exist | ||
858 | * for the server). | ||
859 | * | ||
860 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | ||
861 | **/ | ||
862 | int | ||
863 | gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res, | ||
864 | gnutls_x509_crt_t * cert_list, | ||
865 | int cert_list_size, | ||
866 | gnutls_x509_privkey_t key) | ||
867 | { | ||
868 | int ret, i; | ||
869 | |||
870 | /* this should be first | ||
871 | */ | ||
872 | |||
873 | res->pkey = | ||
874 | gnutls_realloc_fast (res->pkey, | ||
875 | (res->ncerts + 1) * sizeof (gnutls_privkey)); | ||
876 | if (res->pkey == NULL) | ||
877 | { | ||
878 | gnutls_assert (); | ||
879 | return GNUTLS_E_MEMORY_ERROR; | ||
880 | } | ||
881 | |||
882 | ret = _gnutls_x509_privkey_to_gkey (&res->pkey[res->ncerts], key); | ||
883 | if (ret < 0) | ||
884 | { | ||
885 | gnutls_assert (); | ||
886 | return ret; | ||
887 | } | ||
888 | |||
889 | res->cert_list = gnutls_realloc_fast (res->cert_list, | ||
890 | (1 + | ||
891 | res->ncerts) * | ||
892 | sizeof (gnutls_cert *)); | ||
893 | if (res->cert_list == NULL) | ||
894 | { | ||
895 | gnutls_assert (); | ||
896 | return GNUTLS_E_MEMORY_ERROR; | ||
897 | } | ||
898 | |||
899 | res->cert_list_length = gnutls_realloc_fast (res->cert_list_length, | ||
900 | (1 + | ||
901 | res->ncerts) * sizeof (int)); | ||
902 | if (res->cert_list_length == NULL) | ||
903 | { | ||
904 | gnutls_assert (); | ||
905 | return GNUTLS_E_MEMORY_ERROR; | ||
906 | } | ||
907 | |||
908 | res->cert_list[res->ncerts] = NULL; /* for realloc */ | ||
909 | res->cert_list_length[res->ncerts] = 0; | ||
910 | |||
911 | |||
912 | for (i = 0; i < cert_list_size; i++) | ||
913 | { | ||
914 | ret = parse_crt_mem (&res->cert_list[res->ncerts], | ||
915 | &res->cert_list_length[res->ncerts], cert_list[i]); | ||
916 | if (ret < 0) | ||
917 | { | ||
918 | gnutls_assert (); | ||
919 | return ret; | ||
920 | } | ||
921 | } | ||
922 | res->ncerts++; | ||
923 | |||
924 | if ((ret = _gnutls_check_key_cert_match (res)) < 0) | ||
925 | { | ||
926 | gnutls_assert (); | ||
927 | return ret; | ||
928 | } | ||
929 | |||
930 | return 0; | ||
931 | } | ||
932 | |||
933 | /** | ||
934 | * gnutls_certificate_set_x509_key_file - Used to set keys in a gnutls_certificate_credentials_t structure | ||
935 | * @res: is an #gnutls_certificate_credentials_t structure. | ||
936 | * @CERTFILE: is a file that containing the certificate list (path) for | 851 | * @CERTFILE: is a file that containing the certificate list (path) for |
937 | * the specified private key, in PKCS7 format, or a list of certificates | 852 | * the specified private key, in PKCS7 format, or a list of certificates |
938 | * @KEYFILE: is a file that contains the private key | 853 | * @KEYFILE: is a file that contains the private key |
939 | * @type: is PEM or DER | 854 | * @type: is PEM or DER |
940 | * | 855 | * |
941 | * This function sets a certificate/private key pair in the | 856 | * This function sets a certificate/private key pair in the |
942 | * gnutls_certificate_credentials_t structure. This function may be | 857 | * mhd_gtls_cert_credentials_t structure. This function may be |
943 | * called more than once (in case multiple keys/certificates exist | 858 | * called more than once (in case multiple keys/certificates exist |
944 | * for the server). | 859 | * for the server). |
945 | * | 860 | * |
@@ -949,7 +864,7 @@ gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res, | |||
949 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 864 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
950 | **/ | 865 | **/ |
951 | int | 866 | int |
952 | gnutls_certificate_set_x509_key_file (gnutls_certificate_credentials_t | 867 | MHD_gnutls_certificate_set_x509_key_file (mhd_gtls_cert_credentials_t |
953 | res, const char *CERTFILE, | 868 | res, const char *CERTFILE, |
954 | const char *KEYFILE, | 869 | const char *KEYFILE, |
955 | gnutls_x509_crt_fmt_t type) | 870 | gnutls_x509_crt_fmt_t type) |
@@ -976,7 +891,7 @@ gnutls_certificate_set_x509_key_file (gnutls_certificate_credentials_t | |||
976 | } | 891 | } |
977 | 892 | ||
978 | static int | 893 | static int |
979 | generate_rdn_seq (gnutls_certificate_credentials_t res) | 894 | generate_rdn_seq (mhd_gtls_cert_credentials_t res) |
980 | { | 895 | { |
981 | gnutls_datum_t tmp; | 896 | gnutls_datum_t tmp; |
982 | int ret; | 897 | int ret; |
@@ -1028,7 +943,7 @@ generate_rdn_seq (gnutls_certificate_credentials_t res) | |||
1028 | return ret; | 943 | return ret; |
1029 | } | 944 | } |
1030 | 945 | ||
1031 | _gnutls_write_datum16 (pdata, tmp); | 946 | mhd_gtls_write_datum16 (pdata, tmp); |
1032 | pdata += (2 + tmp.size); | 947 | pdata += (2 + tmp.size); |
1033 | _gnutls_free_datum (&tmp); | 948 | _gnutls_free_datum (&tmp); |
1034 | } | 949 | } |
@@ -1051,13 +966,13 @@ _gnutls_check_key_usage (const gnutls_cert * cert, gnutls_kx_algorithm_t alg) | |||
1051 | return GNUTLS_E_INTERNAL_ERROR; | 966 | return GNUTLS_E_INTERNAL_ERROR; |
1052 | } | 967 | } |
1053 | 968 | ||
1054 | if (_gnutls_map_kx_get_cred (alg, 1) == MHD_GNUTLS_CRD_CERTIFICATE || | 969 | if (mhd_gtls_map_kx_get_cred (alg, 1) == MHD_GNUTLS_CRD_CERTIFICATE || |
1055 | _gnutls_map_kx_get_cred (alg, 0) == MHD_GNUTLS_CRD_CERTIFICATE) | 970 | mhd_gtls_map_kx_get_cred (alg, 0) == MHD_GNUTLS_CRD_CERTIFICATE) |
1056 | { | 971 | { |
1057 | 972 | ||
1058 | key_usage = cert->key_usage; | 973 | key_usage = cert->key_usage; |
1059 | 974 | ||
1060 | encipher_type = _gnutls_kx_encipher_type (alg); | 975 | encipher_type = mhd_gtls_kx_encipher_type (alg); |
1061 | 976 | ||
1062 | if (key_usage != 0 && encipher_type != CIPHER_IGN) | 977 | if (key_usage != 0 && encipher_type != CIPHER_IGN) |
1063 | { | 978 | { |
@@ -1125,7 +1040,7 @@ parse_pem_ca_mem (gnutls_x509_crt_t ** cert_list, unsigned *ncerts, | |||
1125 | { | 1040 | { |
1126 | 1041 | ||
1127 | *cert_list = | 1042 | *cert_list = |
1128 | (gnutls_x509_crt_t *) gnutls_realloc_fast (*cert_list, | 1043 | (gnutls_x509_crt_t *) mhd_gtls_realloc_fast (*cert_list, |
1129 | i * | 1044 | i * |
1130 | sizeof | 1045 | sizeof |
1131 | (gnutls_x509_crt_t)); | 1046 | (gnutls_x509_crt_t)); |
@@ -1203,7 +1118,7 @@ parse_der_ca_mem (gnutls_x509_crt_t ** cert_list, unsigned *ncerts, | |||
1203 | i = *ncerts + 1; | 1118 | i = *ncerts + 1; |
1204 | 1119 | ||
1205 | *cert_list = | 1120 | *cert_list = |
1206 | (gnutls_x509_crt_t *) gnutls_realloc_fast (*cert_list, | 1121 | (gnutls_x509_crt_t *) mhd_gtls_realloc_fast (*cert_list, |
1207 | i * | 1122 | i * |
1208 | sizeof (gnutls_x509_crt_t)); | 1123 | sizeof (gnutls_x509_crt_t)); |
1209 | 1124 | ||
@@ -1237,26 +1152,26 @@ parse_der_ca_mem (gnutls_x509_crt_t ** cert_list, unsigned *ncerts, | |||
1237 | } | 1152 | } |
1238 | 1153 | ||
1239 | /** | 1154 | /** |
1240 | * gnutls_certificate_set_x509_trust_mem - Used to add trusted CAs in a gnutls_certificate_credentials_t structure | 1155 | * MHD_gnutls_certificate_set_x509_trust_mem - Used to add trusted CAs in a mhd_gtls_cert_credentials_t structure |
1241 | * @res: is an #gnutls_certificate_credentials_t structure. | 1156 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
1242 | * @ca: is a list of trusted CAs or a DER certificate | 1157 | * @ca: is a list of trusted CAs or a DER certificate |
1243 | * @type: is DER or PEM | 1158 | * @type: is DER or PEM |
1244 | * | 1159 | * |
1245 | * This function adds the trusted CAs in order to verify client or | 1160 | * This function adds the trusted CAs in order to verify client or |
1246 | * server certificates. In case of a client this is not required to | 1161 | * server certificates. In case of a client this is not required to |
1247 | * be called if the certificates are not verified using | 1162 | * be called if the certificates are not verified using |
1248 | * gnutls_certificate_verify_peers2(). This function may be called | 1163 | * MHD_gtls_certificate_verify_peers2(). This function may be called |
1249 | * multiple times. | 1164 | * multiple times. |
1250 | * | 1165 | * |
1251 | * In case of a server the CAs set here will be sent to the client if | 1166 | * In case of a server the CAs set here will be sent to the client if |
1252 | * a certificate request is sent. This can be disabled using | 1167 | * a certificate request is sent. This can be disabled using |
1253 | * gnutls_certificate_send_x509_rdn_sequence(). | 1168 | * MHD_gnutls_certificate_send_x509_rdn_sequence(). |
1254 | * | 1169 | * |
1255 | * Returns: the number of certificates processed or a negative value | 1170 | * Returns: the number of certificates processed or a negative value |
1256 | * on error. | 1171 | * on error. |
1257 | **/ | 1172 | **/ |
1258 | int | 1173 | int |
1259 | gnutls_certificate_set_x509_trust_mem (gnutls_certificate_credentials_t | 1174 | MHD_gnutls_certificate_set_x509_trust_mem (mhd_gtls_cert_credentials_t |
1260 | res, const gnutls_datum_t * ca, | 1175 | res, const gnutls_datum_t * ca, |
1261 | gnutls_x509_crt_fmt_t type) | 1176 | gnutls_x509_crt_fmt_t type) |
1262 | { | 1177 | { |
@@ -1276,87 +1191,26 @@ gnutls_certificate_set_x509_trust_mem (gnutls_certificate_credentials_t | |||
1276 | } | 1191 | } |
1277 | 1192 | ||
1278 | /** | 1193 | /** |
1279 | * gnutls_certificate_set_x509_trust - Used to add trusted CAs in a gnutls_certificate_credentials_t structure | 1194 | * MHD_gnutls_certificate_set_x509_trust_file - Used to add trusted CAs in a mhd_gtls_cert_credentials_t structure |
1280 | * @res: is an #gnutls_certificate_credentials_t structure. | 1195 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
1281 | * @ca_list: is a list of trusted CAs | ||
1282 | * @ca_list_size: holds the size of the CA list | ||
1283 | * | ||
1284 | * This function adds the trusted CAs in order to verify client | ||
1285 | * or server certificates. In case of a client this is not required | ||
1286 | * to be called if the certificates are not verified using | ||
1287 | * gnutls_certificate_verify_peers2(). | ||
1288 | * This function may be called multiple times. | ||
1289 | * | ||
1290 | * In case of a server the CAs set here will be sent to the client if | ||
1291 | * a certificate request is sent. This can be disabled using | ||
1292 | * gnutls_certificate_send_x509_rdn_sequence(). | ||
1293 | * | ||
1294 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | ||
1295 | **/ | ||
1296 | int | ||
1297 | gnutls_certificate_set_x509_trust (gnutls_certificate_credentials_t res, | ||
1298 | gnutls_x509_crt_t * ca_list, | ||
1299 | int ca_list_size) | ||
1300 | { | ||
1301 | int ret, i, ret2; | ||
1302 | |||
1303 | res->x509_ca_list = gnutls_realloc_fast (res->x509_ca_list, | ||
1304 | (ca_list_size + | ||
1305 | res->x509_ncas) * | ||
1306 | sizeof (gnutls_x509_crt_t)); | ||
1307 | if (res->x509_ca_list == NULL) | ||
1308 | { | ||
1309 | gnutls_assert (); | ||
1310 | return GNUTLS_E_MEMORY_ERROR; | ||
1311 | } | ||
1312 | |||
1313 | for (i = 0; i < ca_list_size; i++) | ||
1314 | { | ||
1315 | ret = gnutls_x509_crt_init (&res->x509_ca_list[res->x509_ncas]); | ||
1316 | if (ret < 0) | ||
1317 | { | ||
1318 | gnutls_assert (); | ||
1319 | return ret; | ||
1320 | } | ||
1321 | |||
1322 | ret = _gnutls_x509_crt_cpy (res->x509_ca_list[res->x509_ncas], | ||
1323 | ca_list[i]); | ||
1324 | if (ret < 0) | ||
1325 | { | ||
1326 | gnutls_assert (); | ||
1327 | gnutls_x509_crt_deinit (res->x509_ca_list[res->x509_ncas]); | ||
1328 | return ret; | ||
1329 | } | ||
1330 | res->x509_ncas++; | ||
1331 | } | ||
1332 | |||
1333 | if ((ret2 = generate_rdn_seq (res)) < 0) | ||
1334 | return ret2; | ||
1335 | |||
1336 | return 0; | ||
1337 | } | ||
1338 | |||
1339 | /** | ||
1340 | * gnutls_certificate_set_x509_trust_file - Used to add trusted CAs in a gnutls_certificate_credentials_t structure | ||
1341 | * @res: is an #gnutls_certificate_credentials_t structure. | ||
1342 | * @cafile: is a file containing the list of trusted CAs (DER or PEM list) | 1196 | * @cafile: is a file containing the list of trusted CAs (DER or PEM list) |
1343 | * @type: is PEM or DER | 1197 | * @type: is PEM or DER |
1344 | * | 1198 | * |
1345 | * This function adds the trusted CAs in order to verify client or | 1199 | * This function adds the trusted CAs in order to verify client or |
1346 | * server certificates. In case of a client this is not required to | 1200 | * server certificates. In case of a client this is not required to |
1347 | * be called if the certificates are not verified using | 1201 | * be called if the certificates are not verified using |
1348 | * gnutls_certificate_verify_peers2(). This function may be called | 1202 | * MHD_gtls_certificate_verify_peers2(). This function may be called |
1349 | * multiple times. | 1203 | * multiple times. |
1350 | * | 1204 | * |
1351 | * In case of a server the names of the CAs set here will be sent to | 1205 | * In case of a server the names of the CAs set here will be sent to |
1352 | * the client if a certificate request is sent. This can be disabled | 1206 | * the client if a certificate request is sent. This can be disabled |
1353 | * using gnutls_certificate_send_x509_rdn_sequence(). | 1207 | * using MHD_gnutls_certificate_send_x509_rdn_sequence(). |
1354 | * | 1208 | * |
1355 | * Returns: number of certificates processed, or a negative value on | 1209 | * Returns: number of certificates processed, or a negative value on |
1356 | * error. | 1210 | * error. |
1357 | **/ | 1211 | **/ |
1358 | int | 1212 | int |
1359 | gnutls_certificate_set_x509_trust_file (gnutls_certificate_credentials_t | 1213 | MHD_gnutls_certificate_set_x509_trust_file (mhd_gtls_cert_credentials_t |
1360 | res, const char *cafile, | 1214 | res, const char *cafile, |
1361 | gnutls_x509_crt_fmt_t type) | 1215 | gnutls_x509_crt_fmt_t type) |
1362 | { | 1216 | { |
@@ -1419,7 +1273,7 @@ parse_pem_crl_mem (gnutls_x509_crl_t ** crl_list, unsigned *ncrls, | |||
1419 | { | 1273 | { |
1420 | 1274 | ||
1421 | *crl_list = | 1275 | *crl_list = |
1422 | (gnutls_x509_crl_t *) gnutls_realloc_fast (*crl_list, | 1276 | (gnutls_x509_crl_t *) mhd_gtls_realloc_fast (*crl_list, |
1423 | i * | 1277 | i * |
1424 | sizeof | 1278 | sizeof |
1425 | (gnutls_x509_crl_t)); | 1279 | (gnutls_x509_crl_t)); |
@@ -1487,7 +1341,7 @@ parse_der_crl_mem (gnutls_x509_crl_t ** crl_list, unsigned *ncrls, | |||
1487 | i = *ncrls + 1; | 1341 | i = *ncrls + 1; |
1488 | 1342 | ||
1489 | *crl_list = | 1343 | *crl_list = |
1490 | (gnutls_x509_crl_t *) gnutls_realloc_fast (*crl_list, | 1344 | (gnutls_x509_crl_t *) mhd_gtls_realloc_fast (*crl_list, |
1491 | i * | 1345 | i * |
1492 | sizeof (gnutls_x509_crl_t)); | 1346 | sizeof (gnutls_x509_crl_t)); |
1493 | 1347 | ||
@@ -1524,14 +1378,14 @@ parse_der_crl_mem (gnutls_x509_crl_t ** crl_list, unsigned *ncrls, | |||
1524 | /* Reads a DER or PEM CRL from memory | 1378 | /* Reads a DER or PEM CRL from memory |
1525 | */ | 1379 | */ |
1526 | static int | 1380 | static int |
1527 | read_crl_mem (gnutls_certificate_credentials_t res, const void *crl, | 1381 | read_crl_mem (mhd_gtls_cert_credentials_t res, const void *crl, |
1528 | int crl_size, gnutls_x509_crt_fmt_t type) | 1382 | int crl_size, gnutls_x509_crt_fmt_t type) |
1529 | { | 1383 | { |
1530 | int ret; | 1384 | int ret; |
1531 | 1385 | ||
1532 | /* allocate space for the certificate to add | 1386 | /* allocate space for the certificate to add |
1533 | */ | 1387 | */ |
1534 | res->x509_crl_list = gnutls_realloc_fast (res->x509_crl_list, | 1388 | res->x509_crl_list = mhd_gtls_realloc_fast (res->x509_crl_list, |
1535 | (1 + | 1389 | (1 + |
1536 | res->x509_ncrls) * | 1390 | res->x509_ncrls) * |
1537 | sizeof (gnutls_x509_crl_t)); | 1391 | sizeof (gnutls_x509_crl_t)); |
@@ -1558,21 +1412,21 @@ read_crl_mem (gnutls_certificate_credentials_t res, const void *crl, | |||
1558 | } | 1412 | } |
1559 | 1413 | ||
1560 | /** | 1414 | /** |
1561 | * gnutls_certificate_set_x509_crl_mem - Used to add CRLs in a gnutls_certificate_credentials_t structure | 1415 | * MHD_gnutls_certificate_set_x509_crl_mem - Used to add CRLs in a mhd_gtls_cert_credentials_t structure |
1562 | * @res: is an #gnutls_certificate_credentials_t structure. | 1416 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
1563 | * @CRL: is a list of trusted CRLs. They should have been verified before. | 1417 | * @CRL: is a list of trusted CRLs. They should have been verified before. |
1564 | * @type: is DER or PEM | 1418 | * @type: is DER or PEM |
1565 | * | 1419 | * |
1566 | * This function adds the trusted CRLs in order to verify client or | 1420 | * This function adds the trusted CRLs in order to verify client or |
1567 | * server certificates. In case of a client this is not required to | 1421 | * server certificates. In case of a client this is not required to |
1568 | * be called if the certificates are not verified using | 1422 | * be called if the certificates are not verified using |
1569 | * gnutls_certificate_verify_peers2(). This function may be called | 1423 | * MHD_gtls_certificate_verify_peers2(). This function may be called |
1570 | * multiple times. | 1424 | * multiple times. |
1571 | * | 1425 | * |
1572 | * Returns: number of CRLs processed, or a negative value on error. | 1426 | * Returns: number of CRLs processed, or a negative value on error. |
1573 | **/ | 1427 | **/ |
1574 | int | 1428 | int |
1575 | gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_t | 1429 | MHD_gnutls_certificate_set_x509_crl_mem (mhd_gtls_cert_credentials_t |
1576 | res, const gnutls_datum_t * CRL, | 1430 | res, const gnutls_datum_t * CRL, |
1577 | gnutls_x509_crt_fmt_t type) | 1431 | gnutls_x509_crt_fmt_t type) |
1578 | { | 1432 | { |
@@ -1585,74 +1439,21 @@ gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_t | |||
1585 | } | 1439 | } |
1586 | 1440 | ||
1587 | /** | 1441 | /** |
1588 | * gnutls_certificate_set_x509_crl - Used to add CRLs in a gnutls_certificate_credentials_t structure | 1442 | * MHD_gnutls_certificate_set_x509_crl_file - Used to add CRLs in a mhd_gtls_cert_credentials_t structure |
1589 | * @res: is an #gnutls_certificate_credentials_t structure. | 1443 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
1590 | * @crl_list: is a list of trusted CRLs. They should have been verified before. | ||
1591 | * @crl_list_size: holds the size of the crl_list | ||
1592 | * | ||
1593 | * This function adds the trusted CRLs in order to verify client or | ||
1594 | * server certificates. In case of a client this is not required to | ||
1595 | * be called if the certificates are not verified using | ||
1596 | * gnutls_certificate_verify_peers2(). This function may be called | ||
1597 | * multiple times. | ||
1598 | * | ||
1599 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | ||
1600 | **/ | ||
1601 | int | ||
1602 | gnutls_certificate_set_x509_crl (gnutls_certificate_credentials_t res, | ||
1603 | gnutls_x509_crl_t * crl_list, | ||
1604 | int crl_list_size) | ||
1605 | { | ||
1606 | int ret, i; | ||
1607 | |||
1608 | res->x509_crl_list = gnutls_realloc_fast (res->x509_crl_list, | ||
1609 | (crl_list_size + | ||
1610 | res->x509_ncrls) * | ||
1611 | sizeof (gnutls_x509_crl_t)); | ||
1612 | if (res->x509_crl_list == NULL) | ||
1613 | { | ||
1614 | gnutls_assert (); | ||
1615 | return GNUTLS_E_MEMORY_ERROR; | ||
1616 | } | ||
1617 | |||
1618 | for (i = 0; i < crl_list_size; i++) | ||
1619 | { | ||
1620 | ret = gnutls_x509_crl_init (&res->x509_crl_list[res->x509_ncrls]); | ||
1621 | if (ret < 0) | ||
1622 | { | ||
1623 | gnutls_assert (); | ||
1624 | return ret; | ||
1625 | } | ||
1626 | |||
1627 | ret = _gnutls_x509_crl_cpy (res->x509_crl_list[res->x509_ncrls], | ||
1628 | crl_list[i]); | ||
1629 | if (ret < 0) | ||
1630 | { | ||
1631 | gnutls_assert (); | ||
1632 | return ret; | ||
1633 | } | ||
1634 | res->x509_ncrls++; | ||
1635 | } | ||
1636 | |||
1637 | return 0; | ||
1638 | } | ||
1639 | |||
1640 | /** | ||
1641 | * gnutls_certificate_set_x509_crl_file - Used to add CRLs in a gnutls_certificate_credentials_t structure | ||
1642 | * @res: is an #gnutls_certificate_credentials_t structure. | ||
1643 | * @crlfile: is a file containing the list of verified CRLs (DER or PEM list) | 1444 | * @crlfile: is a file containing the list of verified CRLs (DER or PEM list) |
1644 | * @type: is PEM or DER | 1445 | * @type: is PEM or DER |
1645 | * | 1446 | * |
1646 | * This function adds the trusted CRLs in order to verify client or server | 1447 | * This function adds the trusted CRLs in order to verify client or server |
1647 | * certificates. In case of a client this is not required | 1448 | * certificates. In case of a client this is not required |
1648 | * to be called if the certificates are not verified using | 1449 | * to be called if the certificates are not verified using |
1649 | * gnutls_certificate_verify_peers2(). | 1450 | * MHD_gtls_certificate_verify_peers2(). |
1650 | * This function may be called multiple times. | 1451 | * This function may be called multiple times. |
1651 | * | 1452 | * |
1652 | * Returns: number of CRLs processed or a negative value on error. | 1453 | * Returns: number of CRLs processed or a negative value on error. |
1653 | **/ | 1454 | **/ |
1654 | int | 1455 | int |
1655 | gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t | 1456 | MHD_gnutls_certificate_set_x509_crl_file (mhd_gtls_cert_credentials_t |
1656 | res, const char *crlfile, | 1457 | res, const char *crlfile, |
1657 | gnutls_x509_crt_fmt_t type) | 1458 | gnutls_x509_crt_fmt_t type) |
1658 | { | 1459 | { |
@@ -1687,7 +1488,7 @@ gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t | |||
1687 | #include <pkcs12.h> | 1488 | #include <pkcs12.h> |
1688 | 1489 | ||
1689 | static int | 1490 | static int |
1690 | parse_pkcs12 (gnutls_certificate_credentials_t res, | 1491 | parse_pkcs12 (mhd_gtls_cert_credentials_t res, |
1691 | gnutls_pkcs12_t p12, | 1492 | gnutls_pkcs12_t p12, |
1692 | const char *password, | 1493 | const char *password, |
1693 | gnutls_x509_privkey_t * key, | 1494 | gnutls_x509_privkey_t * key, |
@@ -1840,13 +1641,13 @@ done: | |||
1840 | 1641 | ||
1841 | /** | 1642 | /** |
1842 | * gnutls_certificate_set_x509_simple_pkcs12_file: | 1643 | * gnutls_certificate_set_x509_simple_pkcs12_file: |
1843 | * @res: is an #gnutls_certificate_credentials_t structure. | 1644 | * @res: is an #mhd_gtls_cert_credentials_t structure. |
1844 | * @pkcs12file: filename of file containing PKCS#12 blob. | 1645 | * @pkcs12file: filename of file containing PKCS#12 blob. |
1845 | * @type: is PEM or DER of the @pkcs12file. | 1646 | * @type: is PEM or DER of the @pkcs12file. |
1846 | * @password: optional password used to decrypt PKCS#12 file, bags and keys. | 1647 | * @password: optional password used to decrypt PKCS#12 file, bags and keys. |
1847 | * | 1648 | * |
1848 | * This function sets a certificate/private key pair and/or a CRL in | 1649 | * This function sets a certificate/private key pair and/or a CRL in |
1849 | * the gnutls_certificate_credentials_t structure. This function may | 1650 | * the mhd_gtls_cert_credentials_t structure. This function may |
1850 | * be called more than once (in case multiple keys/certificates exist | 1651 | * be called more than once (in case multiple keys/certificates exist |
1851 | * for the server). | 1652 | * for the server). |
1852 | * | 1653 | * |
@@ -1870,107 +1671,107 @@ done: | |||
1870 | * | 1671 | * |
1871 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. | 1672 | * Returns: %GNUTLS_E_SUCCESS on success, or an error code. |
1872 | **/ | 1673 | **/ |
1873 | int | 1674 | //int |
1874 | gnutls_certificate_set_x509_simple_pkcs12_file | 1675 | // gnutls_certificate_set_x509_simple_pkcs12_file |
1875 | (gnutls_certificate_credentials_t res, const char *pkcs12file, | 1676 | // (mhd_gtls_cert_credentials_t res, const char *pkcs12file, |
1876 | gnutls_x509_crt_fmt_t type, const char *password) | 1677 | // gnutls_x509_crt_fmt_t type, const char *password) |
1877 | { | 1678 | //{ |
1878 | gnutls_pkcs12_t p12; | 1679 | // gnutls_pkcs12_t p12; |
1879 | gnutls_datum_t p12blob; | 1680 | // gnutls_datum_t p12blob; |
1880 | gnutls_x509_privkey_t key = NULL; | 1681 | // gnutls_x509_privkey_t key = NULL; |
1881 | gnutls_x509_crt_t cert = NULL; | 1682 | // gnutls_x509_crt_t cert = NULL; |
1882 | gnutls_x509_crl_t crl = NULL; | 1683 | // gnutls_x509_crl_t crl = NULL; |
1883 | int ret; | 1684 | // int ret; |
1884 | size_t size; | 1685 | // size_t size; |
1885 | 1686 | // | |
1886 | ret = gnutls_pkcs12_init (&p12); | 1687 | // ret = gnutls_pkcs12_init (&p12); |
1887 | if (ret < 0) | 1688 | // if (ret < 0) |
1888 | { | 1689 | // { |
1889 | gnutls_assert (); | 1690 | // gnutls_assert (); |
1890 | return ret; | 1691 | // return ret; |
1891 | } | 1692 | // } |
1892 | 1693 | // | |
1893 | p12blob.data = read_binary_file (pkcs12file, &size); | 1694 | // p12blob.data = read_binary_file (pkcs12file, &size); |
1894 | p12blob.size = (unsigned int) size; | 1695 | // p12blob.size = (unsigned int) size; |
1895 | if (p12blob.data == NULL) | 1696 | // if (p12blob.data == NULL) |
1896 | { | 1697 | // { |
1897 | gnutls_assert (); | 1698 | // gnutls_assert (); |
1898 | gnutls_pkcs12_deinit (p12); | 1699 | // gnutls_pkcs12_deinit (p12); |
1899 | return GNUTLS_E_FILE_ERROR; | 1700 | // return GNUTLS_E_FILE_ERROR; |
1900 | } | 1701 | // } |
1901 | 1702 | // | |
1902 | ret = gnutls_pkcs12_import (p12, &p12blob, type, 0); | 1703 | // ret = gnutls_pkcs12_import (p12, &p12blob, type, 0); |
1903 | free (p12blob.data); | 1704 | // free (p12blob.data); |
1904 | if (ret < 0) | 1705 | // if (ret < 0) |
1905 | { | 1706 | // { |
1906 | gnutls_assert (); | 1707 | // gnutls_assert (); |
1907 | gnutls_pkcs12_deinit (p12); | 1708 | // gnutls_pkcs12_deinit (p12); |
1908 | return ret; | 1709 | // return ret; |
1909 | } | 1710 | // } |
1910 | 1711 | // | |
1911 | if (password) | 1712 | // if (password) |
1912 | { | 1713 | // { |
1913 | ret = gnutls_pkcs12_verify_mac (p12, password); | 1714 | // ret = gnutls_pkcs12_verify_mac (p12, password); |
1914 | if (ret < 0) | 1715 | // if (ret < 0) |
1915 | { | 1716 | // { |
1916 | gnutls_assert (); | 1717 | // gnutls_assert (); |
1917 | gnutls_pkcs12_deinit (p12); | 1718 | // gnutls_pkcs12_deinit (p12); |
1918 | return ret; | 1719 | // return ret; |
1919 | } | 1720 | // } |
1920 | } | 1721 | // } |
1921 | 1722 | // | |
1922 | ret = parse_pkcs12 (res, p12, password, &key, &cert, &crl); | 1723 | // ret = parse_pkcs12 (res, p12, password, &key, &cert, &crl); |
1923 | gnutls_pkcs12_deinit (p12); | 1724 | // gnutls_pkcs12_deinit (p12); |
1924 | if (ret < 0) | 1725 | // if (ret < 0) |
1925 | { | 1726 | // { |
1926 | gnutls_assert (); | 1727 | // gnutls_assert (); |
1927 | return ret; | 1728 | // return ret; |
1928 | } | 1729 | // } |
1929 | 1730 | // | |
1930 | if (key && cert) | 1731 | // if (key && cert) |
1931 | { | 1732 | // { |
1932 | ret = gnutls_certificate_set_x509_key (res, &cert, 1, key); | 1733 | // ret = gnutls_certificate_set_x509_key (res, &cert, 1, key); |
1933 | if (ret < 0) | 1734 | // if (ret < 0) |
1934 | { | 1735 | // { |
1935 | gnutls_assert (); | 1736 | // gnutls_assert (); |
1936 | goto done; | 1737 | // goto done; |
1937 | } | 1738 | // } |
1938 | } | 1739 | // } |
1939 | 1740 | // | |
1940 | if (crl) | 1741 | // if (crl) |
1941 | { | 1742 | // { |
1942 | ret = gnutls_certificate_set_x509_crl (res, &crl, 1); | 1743 | // ret = gnutls_certificate_set_x509_crl (res, &crl, 1); |
1943 | if (ret < 0) | 1744 | // if (ret < 0) |
1944 | { | 1745 | // { |
1945 | gnutls_assert (); | 1746 | // gnutls_assert (); |
1946 | goto done; | 1747 | // goto done; |
1947 | } | 1748 | // } |
1948 | } | 1749 | // } |
1949 | 1750 | // | |
1950 | ret = 0; | 1751 | // ret = 0; |
1951 | 1752 | // | |
1952 | done: | 1753 | //done: |
1953 | if (cert) | 1754 | // if (cert) |
1954 | gnutls_x509_crt_deinit (cert); | 1755 | // gnutls_x509_crt_deinit (cert); |
1955 | if (key) | 1756 | // if (key) |
1956 | gnutls_x509_privkey_deinit (key); | 1757 | // gnutls_x509_privkey_deinit (key); |
1957 | if (crl) | 1758 | // if (crl) |
1958 | gnutls_x509_crl_deinit (crl); | 1759 | // gnutls_x509_crl_deinit (crl); |
1959 | 1760 | // | |
1960 | return ret; | 1761 | // return ret; |
1961 | } | 1762 | //} |
1962 | 1763 | ||
1963 | 1764 | ||
1964 | /** | 1765 | /** |
1965 | * gnutls_certificate_free_crls - Used to free all the CRLs from a gnutls_certificate_credentials_t structure | 1766 | * MHD_gnutls_certificate_free_crls - Used to free all the CRLs from a mhd_gtls_cert_credentials_t structure |
1966 | * @sc: is an #gnutls_certificate_credentials_t structure. | 1767 | * @sc: is an #mhd_gtls_cert_credentials_t structure. |
1967 | * | 1768 | * |
1968 | * This function will delete all the CRLs associated | 1769 | * This function will delete all the CRLs associated |
1969 | * with the given credentials. | 1770 | * with the given credentials. |
1970 | * | 1771 | * |
1971 | **/ | 1772 | **/ |
1972 | void | 1773 | void |
1973 | gnutls_certificate_free_crls (gnutls_certificate_credentials_t sc) | 1774 | MHD_gnutls_certificate_free_crls (mhd_gtls_cert_credentials_t sc) |
1974 | { | 1775 | { |
1975 | unsigned j; | 1776 | unsigned j; |
1976 | 1777 | ||
diff --git a/src/daemon/https/tls/gnutls_x509.h b/src/daemon/https/tls/gnutls_x509.h index 3aa0d915..aaf32cae 100644 --- a/src/daemon/https/tls/gnutls_x509.h +++ b/src/daemon/https/tls/gnutls_x509.h | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include <libtasn1.h> | 25 | #include <libtasn1.h> |
26 | 26 | ||
27 | int _gnutls_x509_cert_verify_peers (gnutls_session_t session, | 27 | int _gnutls_x509_cert_verify_peers (mhd_gtls_session_t session, |
28 | unsigned int *status); | 28 | unsigned int *status); |
29 | 29 | ||
30 | #define PEM_CERT_SEP2 "-----BEGIN X509 CERTIFICATE" | 30 | #define PEM_CERT_SEP2 "-----BEGIN X509 CERTIFICATE" |
diff --git a/src/daemon/https/tls/x509_b64.c b/src/daemon/https/tls/x509_b64.c index 50a9b475..5bb2b4a5 100644 --- a/src/daemon/https/tls/x509_b64.c +++ b/src/daemon/https/tls/x509_b64.c | |||
@@ -287,7 +287,7 @@ _gnutls_fbase64_encode (const char *msg, const uint8_t * data, | |||
287 | } | 287 | } |
288 | 288 | ||
289 | /** | 289 | /** |
290 | * gnutls_pem_base64_encode - This function will convert raw data to Base64 encoded | 290 | * MHD_gtls_pem_base64_encode - This function will convert raw data to Base64 encoded |
291 | * @msg: is a message to be put in the header | 291 | * @msg: is a message to be put in the header |
292 | * @data: contain the raw data | 292 | * @data: contain the raw data |
293 | * @result: the place where base64 data will be copied | 293 | * @result: the place where base64 data will be copied |
@@ -302,7 +302,7 @@ _gnutls_fbase64_encode (const char *msg, const uint8_t * data, | |||
302 | * | 302 | * |
303 | **/ | 303 | **/ |
304 | int | 304 | int |
305 | gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, | 305 | MHD_gtls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, |
306 | char *result, size_t * result_size) | 306 | char *result, size_t * result_size) |
307 | { | 307 | { |
308 | opaque *ret; | 308 | opaque *ret; |
@@ -329,7 +329,7 @@ gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, | |||
329 | } | 329 | } |
330 | 330 | ||
331 | /** | 331 | /** |
332 | * gnutls_pem_base64_encode_alloc - This function will convert raw data to Base64 encoded | 332 | * MHD_gtls_pem_base64_encode_alloc - This function will convert raw data to Base64 encoded |
333 | * @msg: is a message to be put in the encoded header | 333 | * @msg: is a message to be put in the encoded header |
334 | * @data: contains the raw data | 334 | * @data: contains the raw data |
335 | * @result: will hold the newly allocated encoded data | 335 | * @result: will hold the newly allocated encoded data |
@@ -342,7 +342,7 @@ gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * data, | |||
342 | * | 342 | * |
343 | **/ | 343 | **/ |
344 | int | 344 | int |
345 | gnutls_pem_base64_encode_alloc (const char *msg, | 345 | MHD_gtls_pem_base64_encode_alloc (const char *msg, |
346 | const gnutls_datum_t * data, | 346 | const gnutls_datum_t * data, |
347 | gnutls_datum_t * result) | 347 | gnutls_datum_t * result) |
348 | { | 348 | { |
@@ -436,9 +436,9 @@ _gnutls_fbase64_decode (const char *header, const opaque * data, | |||
436 | int kdata_size; | 436 | int kdata_size; |
437 | char pem_header[128]; | 437 | char pem_header[128]; |
438 | 438 | ||
439 | _gnutls_str_cpy (pem_header, sizeof (pem_header), top); | 439 | mhd_gtls_str_cpy (pem_header, sizeof (pem_header), top); |
440 | if (header != NULL) | 440 | if (header != NULL) |
441 | _gnutls_str_cat (pem_header, sizeof (pem_header), header); | 441 | mhd_gtls_str_cat (pem_header, sizeof (pem_header), header); |
442 | 442 | ||
443 | rdata = memmem (data, data_size, pem_header, strlen (pem_header)); | 443 | rdata = memmem (data, data_size, pem_header, strlen (pem_header)); |
444 | 444 | ||
@@ -520,7 +520,7 @@ _gnutls_fbase64_decode (const char *header, const opaque * data, | |||
520 | } | 520 | } |
521 | 521 | ||
522 | /** | 522 | /** |
523 | * gnutls_pem_base64_decode - This function will decode base64 encoded data | 523 | * MHD_gtls_pem_base64_decode - This function will decode base64 encoded data |
524 | * @header: A null terminated string with the PEM header (eg. CERTIFICATE) | 524 | * @header: A null terminated string with the PEM header (eg. CERTIFICATE) |
525 | * @b64_data: contain the encoded data | 525 | * @b64_data: contain the encoded data |
526 | * @result: the place where decoded data will be copied | 526 | * @result: the place where decoded data will be copied |
@@ -534,7 +534,7 @@ _gnutls_fbase64_decode (const char *header, const opaque * data, | |||
534 | * or 0 on success. | 534 | * or 0 on success. |
535 | **/ | 535 | **/ |
536 | int | 536 | int |
537 | gnutls_pem_base64_decode (const char *header, | 537 | MHD_gtls_pem_base64_decode (const char *header, |
538 | const gnutls_datum_t * b64_data, | 538 | const gnutls_datum_t * b64_data, |
539 | unsigned char *result, size_t * result_size) | 539 | unsigned char *result, size_t * result_size) |
540 | { | 540 | { |
@@ -563,7 +563,7 @@ gnutls_pem_base64_decode (const char *header, | |||
563 | } | 563 | } |
564 | 564 | ||
565 | /** | 565 | /** |
566 | * gnutls_pem_base64_decode_alloc - This function will decode base64 encoded data | 566 | * MHD_gtls_pem_base64_decode_alloc - This function will decode base64 encoded data |
567 | * @header: The PEM header (eg. CERTIFICATE) | 567 | * @header: The PEM header (eg. CERTIFICATE) |
568 | * @b64_data: contains the encoded data | 568 | * @b64_data: contains the encoded data |
569 | * @result: the place where decoded data lie | 569 | * @result: the place where decoded data lie |
@@ -578,7 +578,7 @@ gnutls_pem_base64_decode (const char *header, | |||
578 | * | 578 | * |
579 | **/ | 579 | **/ |
580 | int | 580 | int |
581 | gnutls_pem_base64_decode_alloc (const char *header, | 581 | MHD_gtls_pem_base64_decode_alloc (const char *header, |
582 | const gnutls_datum_t * b64_data, | 582 | const gnutls_datum_t * b64_data, |
583 | gnutls_datum_t * result) | 583 | gnutls_datum_t * result) |
584 | { | 584 | { |
diff --git a/src/daemon/https/x509/Makefile.am b/src/daemon/https/x509/Makefile.am index 2bdb5799..8fb1ca59 100644 --- a/src/daemon/https/x509/Makefile.am +++ b/src/daemon/https/x509/Makefile.am | |||
@@ -32,6 +32,5 @@ sign.c \ | |||
32 | x509_verify.c \ | 32 | x509_verify.c \ |
33 | x509.c \ | 33 | x509.c \ |
34 | x509_write.c | 34 | x509_write.c |
35 | # output.c | ||
36 | 35 | ||
37 | 36 | ||
diff --git a/src/daemon/https/x509/common.c b/src/daemon/https/x509/common.c index 82d433ce..b31edcec 100644 --- a/src/daemon/https/x509/common.c +++ b/src/daemon/https/x509/common.c | |||
@@ -288,8 +288,8 @@ _gnutls_x509_oid_data2string (const char *oid, | |||
288 | return GNUTLS_E_INTERNAL_ERROR; | 288 | return GNUTLS_E_INTERNAL_ERROR; |
289 | } | 289 | } |
290 | 290 | ||
291 | _gnutls_str_cpy (str, sizeof (str), "PKIX1."); | 291 | mhd_gtls_str_cpy (str, sizeof (str), "PKIX1."); |
292 | _gnutls_str_cat (str, sizeof (str), ANAME); | 292 | mhd_gtls_str_cat (str, sizeof (str), ANAME); |
293 | 293 | ||
294 | if ((result = asn1_create_element (_gnutls_get_pkix (), str, | 294 | if ((result = asn1_create_element (_gnutls_get_pkix (), str, |
295 | &tmpasn)) != ASN1_SUCCESS) | 295 | &tmpasn)) != ASN1_SUCCESS) |
@@ -323,7 +323,7 @@ _gnutls_x509_oid_data2string (const char *oid, | |||
323 | str[len] = 0; | 323 | str[len] = 0; |
324 | 324 | ||
325 | if (res) | 325 | if (res) |
326 | _gnutls_str_cpy (res, *res_size, str); | 326 | mhd_gtls_str_cpy (res, *res_size, str); |
327 | *res_size = len; | 327 | *res_size = len; |
328 | 328 | ||
329 | asn1_delete_structure (&tmpasn); | 329 | asn1_delete_structure (&tmpasn); |
@@ -345,7 +345,7 @@ _gnutls_x509_oid_data2string (const char *oid, | |||
345 | if (strcmp (str, "teletexString") == 0) | 345 | if (strcmp (str, "teletexString") == 0) |
346 | teletex = 1; | 346 | teletex = 1; |
347 | 347 | ||
348 | _gnutls_str_cpy (tmpname, sizeof (tmpname), str); | 348 | mhd_gtls_str_cpy (tmpname, sizeof (tmpname), str); |
349 | 349 | ||
350 | len = sizeof (str) - 1; | 350 | len = sizeof (str) - 1; |
351 | if ((result = asn1_read_value (tmpasn, tmpname, str, &len)) | 351 | if ((result = asn1_read_value (tmpasn, tmpname, str, &len)) |
@@ -376,7 +376,7 @@ _gnutls_x509_oid_data2string (const char *oid, | |||
376 | if (non_printable == 0) | 376 | if (non_printable == 0) |
377 | { | 377 | { |
378 | str[len] = 0; | 378 | str[len] = 0; |
379 | _gnutls_str_cpy (res, *res_size, str); | 379 | mhd_gtls_str_cpy (res, *res_size, str); |
380 | *res_size = len; | 380 | *res_size = len; |
381 | } | 381 | } |
382 | else | 382 | else |
@@ -411,7 +411,7 @@ _gnutls_x509_data2hex (const opaque * data, | |||
411 | return GNUTLS_E_INTERNAL_ERROR; | 411 | return GNUTLS_E_INTERNAL_ERROR; |
412 | } | 412 | } |
413 | 413 | ||
414 | res = _gnutls_bin2hex (data, data_size, escaped, sizeof (escaped)); | 414 | res = mhd_gtls_bin2hex (data, data_size, escaped, sizeof (escaped)); |
415 | 415 | ||
416 | if (res) | 416 | if (res) |
417 | { | 417 | { |
@@ -694,7 +694,7 @@ _gnutls_x509_get_time (ASN1_TYPE c2, const char *when) | |||
694 | time_t c_time = (time_t) - 1; | 694 | time_t c_time = (time_t) - 1; |
695 | int len, result; | 695 | int len, result; |
696 | 696 | ||
697 | _gnutls_str_cpy (name, sizeof (name), when); | 697 | mhd_gtls_str_cpy (name, sizeof (name), when); |
698 | 698 | ||
699 | len = sizeof (ttime) - 1; | 699 | len = sizeof (ttime) - 1; |
700 | if ((result = asn1_read_value (c2, name, ttime, &len)) < 0) | 700 | if ((result = asn1_read_value (c2, name, ttime, &len)) < 0) |
@@ -707,7 +707,7 @@ _gnutls_x509_get_time (ASN1_TYPE c2, const char *when) | |||
707 | if (strcmp (ttime, "generalTime") == 0) | 707 | if (strcmp (ttime, "generalTime") == 0) |
708 | { | 708 | { |
709 | 709 | ||
710 | _gnutls_str_cat (name, sizeof (name), ".generalTime"); | 710 | mhd_gtls_str_cat (name, sizeof (name), ".generalTime"); |
711 | len = sizeof (ttime) - 1; | 711 | len = sizeof (ttime) - 1; |
712 | result = asn1_read_value (c2, name, ttime, &len); | 712 | result = asn1_read_value (c2, name, ttime, &len); |
713 | if (result == ASN1_SUCCESS) | 713 | if (result == ASN1_SUCCESS) |
@@ -716,7 +716,7 @@ _gnutls_x509_get_time (ASN1_TYPE c2, const char *when) | |||
716 | else | 716 | else |
717 | { /* UTCTIME */ | 717 | { /* UTCTIME */ |
718 | 718 | ||
719 | _gnutls_str_cat (name, sizeof (name), ".utcTime"); | 719 | mhd_gtls_str_cat (name, sizeof (name), ".utcTime"); |
720 | len = sizeof (ttime) - 1; | 720 | len = sizeof (ttime) - 1; |
721 | result = asn1_read_value (c2, name, ttime, &len); | 721 | result = asn1_read_value (c2, name, ttime, &len); |
722 | if (result == ASN1_SUCCESS) | 722 | if (result == ASN1_SUCCESS) |
@@ -745,7 +745,7 @@ _gnutls_x509_set_time (ASN1_TYPE c2, const char *where, time_t tim) | |||
745 | char name[128]; | 745 | char name[128]; |
746 | int result, len; | 746 | int result, len; |
747 | 747 | ||
748 | _gnutls_str_cpy (name, sizeof (name), where); | 748 | mhd_gtls_str_cpy (name, sizeof (name), where); |
749 | 749 | ||
750 | if ((result = asn1_write_value (c2, name, "utcTime", 1)) < 0) | 750 | if ((result = asn1_write_value (c2, name, "utcTime", 1)) < 0) |
751 | { | 751 | { |
@@ -760,7 +760,7 @@ _gnutls_x509_set_time (ASN1_TYPE c2, const char *where, time_t tim) | |||
760 | return result; | 760 | return result; |
761 | } | 761 | } |
762 | 762 | ||
763 | _gnutls_str_cat (name, sizeof (name), ".utcTime"); | 763 | mhd_gtls_str_cat (name, sizeof (name), ".utcTime"); |
764 | 764 | ||
765 | len = strlen (str_time); | 765 | len = strlen (str_time); |
766 | result = asn1_write_value (c2, name, str_time, len); | 766 | result = asn1_write_value (c2, name, str_time, len); |
@@ -894,11 +894,11 @@ _gnutls_x509_decode_octet_string (const char *string_type, | |||
894 | char strname[64]; | 894 | char strname[64]; |
895 | 895 | ||
896 | if (string_type == NULL) | 896 | if (string_type == NULL) |
897 | _gnutls_str_cpy (strname, sizeof (strname), "PKIX1.pkcs-7-Data"); | 897 | mhd_gtls_str_cpy (strname, sizeof (strname), "PKIX1.pkcs-7-Data"); |
898 | else | 898 | else |
899 | { | 899 | { |
900 | _gnutls_str_cpy (strname, sizeof (strname), "PKIX1."); | 900 | mhd_gtls_str_cpy (strname, sizeof (strname), "PKIX1."); |
901 | _gnutls_str_cat (strname, sizeof (strname), string_type); | 901 | mhd_gtls_str_cat (strname, sizeof (strname), string_type); |
902 | } | 902 | } |
903 | 903 | ||
904 | if ((result = | 904 | if ((result = |
@@ -1226,7 +1226,7 @@ _gnutls_x509_encode_and_copy_PKI_params (ASN1_TYPE dst, | |||
1226 | int result; | 1226 | int result; |
1227 | char name[128]; | 1227 | char name[128]; |
1228 | 1228 | ||
1229 | pk = _gnutls_x509_pk_to_oid (pk_algorithm); | 1229 | pk = mhd_gtls_x509_pk_to_oid (pk_algorithm); |
1230 | if (pk == NULL) | 1230 | if (pk == NULL) |
1231 | { | 1231 | { |
1232 | gnutls_assert (); | 1232 | gnutls_assert (); |
@@ -1235,8 +1235,8 @@ _gnutls_x509_encode_and_copy_PKI_params (ASN1_TYPE dst, | |||
1235 | 1235 | ||
1236 | /* write the OID | 1236 | /* write the OID |
1237 | */ | 1237 | */ |
1238 | _gnutls_str_cpy (name, sizeof (name), dst_name); | 1238 | mhd_gtls_str_cpy (name, sizeof (name), dst_name); |
1239 | _gnutls_str_cat (name, sizeof (name), ".algorithm.algorithm"); | 1239 | mhd_gtls_str_cat (name, sizeof (name), ".algorithm.algorithm"); |
1240 | result = asn1_write_value (dst, name, pk, 1); | 1240 | result = asn1_write_value (dst, name, pk, 1); |
1241 | if (result != ASN1_SUCCESS) | 1241 | if (result != ASN1_SUCCESS) |
1242 | { | 1242 | { |
@@ -1248,8 +1248,8 @@ _gnutls_x509_encode_and_copy_PKI_params (ASN1_TYPE dst, | |||
1248 | { | 1248 | { |
1249 | /* disable parameters, which are not used in RSA. | 1249 | /* disable parameters, which are not used in RSA. |
1250 | */ | 1250 | */ |
1251 | _gnutls_str_cpy (name, sizeof (name), dst_name); | 1251 | mhd_gtls_str_cpy (name, sizeof (name), dst_name); |
1252 | _gnutls_str_cat (name, sizeof (name), ".algorithm.parameters"); | 1252 | mhd_gtls_str_cat (name, sizeof (name), ".algorithm.parameters"); |
1253 | result = asn1_write_value (dst, name, NULL, 0); | 1253 | result = asn1_write_value (dst, name, NULL, 0); |
1254 | if (result != ASN1_SUCCESS) | 1254 | if (result != ASN1_SUCCESS) |
1255 | { | 1255 | { |
@@ -1266,8 +1266,8 @@ _gnutls_x509_encode_and_copy_PKI_params (ASN1_TYPE dst, | |||
1266 | 1266 | ||
1267 | /* Write the DER parameters. (in bits) | 1267 | /* Write the DER parameters. (in bits) |
1268 | */ | 1268 | */ |
1269 | _gnutls_str_cpy (name, sizeof (name), dst_name); | 1269 | mhd_gtls_str_cpy (name, sizeof (name), dst_name); |
1270 | _gnutls_str_cat (name, sizeof (name), ".subjectPublicKey"); | 1270 | mhd_gtls_str_cat (name, sizeof (name), ".subjectPublicKey"); |
1271 | result = asn1_write_value (dst, name, der.data, der.size * 8); | 1271 | result = asn1_write_value (dst, name, der.data, der.size * 8); |
1272 | 1272 | ||
1273 | _gnutls_free_datum (&der); | 1273 | _gnutls_free_datum (&der); |
@@ -1299,8 +1299,8 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, | |||
1299 | mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; | 1299 | mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; |
1300 | char name[128]; | 1300 | char name[128]; |
1301 | 1301 | ||
1302 | _gnutls_str_cpy (name, sizeof (name), src_name); | 1302 | mhd_gtls_str_cpy (name, sizeof (name), src_name); |
1303 | _gnutls_str_cat (name, sizeof (name), ".algorithm.algorithm"); | 1303 | mhd_gtls_str_cat (name, sizeof (name), ".algorithm.algorithm"); |
1304 | 1304 | ||
1305 | len = sizeof (oid); | 1305 | len = sizeof (oid); |
1306 | result = asn1_read_value (src, name, oid, &len); | 1306 | result = asn1_read_value (src, name, oid, &len); |
@@ -1311,7 +1311,7 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, | |||
1311 | return _gnutls_asn2err (result); | 1311 | return _gnutls_asn2err (result); |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | algo = _gnutls_x509_oid2pk_algorithm (oid); | 1314 | algo = mhd_gtls_x509_oid2pk_algorithm (oid); |
1315 | 1315 | ||
1316 | if (bits == NULL) | 1316 | if (bits == NULL) |
1317 | { | 1317 | { |
@@ -1321,8 +1321,8 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, | |||
1321 | 1321 | ||
1322 | /* Now read the parameters' bits | 1322 | /* Now read the parameters' bits |
1323 | */ | 1323 | */ |
1324 | _gnutls_str_cpy (name, sizeof (name), src_name); | 1324 | mhd_gtls_str_cpy (name, sizeof (name), src_name); |
1325 | _gnutls_str_cat (name, sizeof (name), ".subjectPublicKey"); | 1325 | mhd_gtls_str_cat (name, sizeof (name), ".subjectPublicKey"); |
1326 | 1326 | ||
1327 | len = 0; | 1327 | len = 0; |
1328 | result = asn1_read_value (src, name, NULL, &len); | 1328 | result = asn1_read_value (src, name, NULL, &len); |
@@ -1347,8 +1347,8 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, | |||
1347 | return GNUTLS_E_MEMORY_ERROR; | 1347 | return GNUTLS_E_MEMORY_ERROR; |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | _gnutls_str_cpy (name, sizeof (name), src_name); | 1350 | mhd_gtls_str_cpy (name, sizeof (name), src_name); |
1351 | _gnutls_str_cat (name, sizeof (name), ".subjectPublicKey"); | 1351 | mhd_gtls_str_cat (name, sizeof (name), ".subjectPublicKey"); |
1352 | 1352 | ||
1353 | result = asn1_read_value (src, name, str, &len); | 1353 | result = asn1_read_value (src, name, str, &len); |
1354 | 1354 | ||
@@ -1373,8 +1373,8 @@ _gnutls_x509_get_pk_algorithm (ASN1_TYPE src, | |||
1373 | 1373 | ||
1374 | bits[0] = _gnutls_mpi_get_nbits (params[0]); | 1374 | bits[0] = _gnutls_mpi_get_nbits (params[0]); |
1375 | 1375 | ||
1376 | _gnutls_mpi_release (¶ms[0]); | 1376 | mhd_gtls_mpi_release (¶ms[0]); |
1377 | _gnutls_mpi_release (¶ms[1]); | 1377 | mhd_gtls_mpi_release (¶ms[1]); |
1378 | } | 1378 | } |
1379 | break; | 1379 | break; |
1380 | default: | 1380 | default: |
diff --git a/src/daemon/https/x509/crl.c b/src/daemon/https/x509/crl.c index d3b5c954..80dd6f9e 100644 --- a/src/daemon/https/x509/crl.c +++ b/src/daemon/https/x509/crl.c | |||
@@ -305,7 +305,7 @@ gnutls_x509_crl_get_signature_algorithm (gnutls_x509_crl_t crl) | |||
305 | return result; | 305 | return result; |
306 | } | 306 | } |
307 | 307 | ||
308 | result = _gnutls_x509_oid2sign_algorithm ((const char *) sa.data); | 308 | result = mhd_gtls_x509_oid2sign_algorithm ((const char *) sa.data); |
309 | 309 | ||
310 | _gnutls_free_datum (&sa); | 310 | _gnutls_free_datum (&sa); |
311 | 311 | ||
diff --git a/src/daemon/https/x509/crq.c b/src/daemon/https/x509/crq.c index 8a60d35f..6ce01583 100644 --- a/src/daemon/https/x509/crq.c +++ b/src/daemon/https/x509/crq.c | |||
@@ -338,8 +338,8 @@ parse_attribute (ASN1_TYPE asn1_struct, | |||
338 | */ | 338 | */ |
339 | /* Read the OID | 339 | /* Read the OID |
340 | */ | 340 | */ |
341 | _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer1); | 341 | mhd_gtls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer1); |
342 | _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); | 342 | mhd_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); |
343 | 343 | ||
344 | len = sizeof (oid) - 1; | 344 | len = sizeof (oid) - 1; |
345 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); | 345 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); |
diff --git a/src/daemon/https/x509/dn.c b/src/daemon/https/x509/dn.c index c356aac1..57f71330 100644 --- a/src/daemon/https/x509/dn.c +++ b/src/daemon/https/x509/dn.c | |||
@@ -91,7 +91,7 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, | |||
91 | const char *asn1_rdn_name, char *buf, | 91 | const char *asn1_rdn_name, char *buf, |
92 | size_t * sizeof_buf) | 92 | size_t * sizeof_buf) |
93 | { | 93 | { |
94 | gnutls_string out_str; | 94 | mhd_gtls_string out_str; |
95 | int k2, k1, result; | 95 | int k2, k1, result; |
96 | char tmpbuffer1[MAX_NAME_SIZE]; | 96 | char tmpbuffer1[MAX_NAME_SIZE]; |
97 | char tmpbuffer2[MAX_NAME_SIZE]; | 97 | char tmpbuffer2[MAX_NAME_SIZE]; |
@@ -115,7 +115,7 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, | |||
115 | else | 115 | else |
116 | *sizeof_buf = 0; | 116 | *sizeof_buf = 0; |
117 | 117 | ||
118 | _gnutls_string_init (&out_str, gnutls_malloc, gnutls_realloc, gnutls_free); | 118 | mhd_gtls_string_init (&out_str, gnutls_malloc, gnutls_realloc, gnutls_free); |
119 | 119 | ||
120 | k1 = 0; | 120 | k1 = 0; |
121 | do | 121 | do |
@@ -175,8 +175,8 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, | |||
175 | 175 | ||
176 | /* Read the OID | 176 | /* Read the OID |
177 | */ | 177 | */ |
178 | _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); | 178 | mhd_gtls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); |
179 | _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); | 179 | mhd_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); |
180 | 180 | ||
181 | len = sizeof (oid) - 1; | 181 | len = sizeof (oid) - 1; |
182 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); | 182 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); |
@@ -192,8 +192,8 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, | |||
192 | 192 | ||
193 | /* Read the Value | 193 | /* Read the Value |
194 | */ | 194 | */ |
195 | _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); | 195 | mhd_gtls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); |
196 | _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); | 196 | mhd_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); |
197 | 197 | ||
198 | len = 0; | 198 | len = 0; |
199 | result = asn1_read_value (asn1_struct, tmpbuffer3, NULL, &len); | 199 | result = asn1_read_value (asn1_struct, tmpbuffer3, NULL, &len); |
@@ -214,7 +214,7 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, | |||
214 | result = _gnutls_asn2err (result); | 214 | result = _gnutls_asn2err (result); |
215 | goto cleanup; | 215 | goto cleanup; |
216 | } | 216 | } |
217 | #define STR_APPEND(y) if ((result=_gnutls_string_append_str( &out_str, y)) < 0) { \ | 217 | #define STR_APPEND(y) if ((result=mhd_gtls_string_append_str( &out_str, y)) < 0) { \ |
218 | gnutls_assert(); \ | 218 | gnutls_assert(); \ |
219 | goto cleanup; \ | 219 | goto cleanup; \ |
220 | } | 220 | } |
@@ -280,7 +280,7 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, | |||
280 | gnutls_assert (); | 280 | gnutls_assert (); |
281 | _gnutls_x509_log | 281 | _gnutls_x509_log |
282 | ("Found OID: '%s' with value '%s'\n", | 282 | ("Found OID: '%s' with value '%s'\n", |
283 | oid, _gnutls_bin2hex (value2, len, escaped, sizeof_escaped)); | 283 | oid, mhd_gtls_bin2hex (value2, len, escaped, sizeof_escaped)); |
284 | goto cleanup; | 284 | goto cleanup; |
285 | } | 285 | } |
286 | STR_APPEND (str_escape (string, escaped, sizeof_escaped)); | 286 | STR_APPEND (str_escape (string, escaped, sizeof_escaped)); |
@@ -319,7 +319,7 @@ cleanup: | |||
319 | gnutls_free (value2); | 319 | gnutls_free (value2); |
320 | gnutls_free (string); | 320 | gnutls_free (string); |
321 | gnutls_free (escaped); | 321 | gnutls_free (escaped); |
322 | _gnutls_string_clear (&out_str); | 322 | mhd_gtls_string_clear (&out_str); |
323 | return result; | 323 | return result; |
324 | } | 324 | } |
325 | 325 | ||
@@ -418,8 +418,8 @@ _gnutls_x509_parse_dn_oid (ASN1_TYPE asn1_struct, | |||
418 | 418 | ||
419 | /* Read the OID | 419 | /* Read the OID |
420 | */ | 420 | */ |
421 | _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); | 421 | mhd_gtls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); |
422 | _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); | 422 | mhd_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); |
423 | 423 | ||
424 | len = sizeof (oid) - 1; | 424 | len = sizeof (oid) - 1; |
425 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); | 425 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); |
@@ -438,8 +438,8 @@ _gnutls_x509_parse_dn_oid (ASN1_TYPE asn1_struct, | |||
438 | 438 | ||
439 | /* Read the Value | 439 | /* Read the Value |
440 | */ | 440 | */ |
441 | _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); | 441 | mhd_gtls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); |
442 | _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); | 442 | mhd_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); |
443 | 443 | ||
444 | len = *sizeof_buf; | 444 | len = *sizeof_buf; |
445 | result = asn1_read_value (asn1_struct, tmpbuffer3, buf, &len); | 445 | result = asn1_read_value (asn1_struct, tmpbuffer3, buf, &len); |
@@ -587,8 +587,8 @@ _gnutls_x509_get_dn_oid (ASN1_TYPE asn1_struct, | |||
587 | 587 | ||
588 | /* Read the OID | 588 | /* Read the OID |
589 | */ | 589 | */ |
590 | _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); | 590 | mhd_gtls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); |
591 | _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); | 591 | mhd_gtls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); |
592 | 592 | ||
593 | len = sizeof (oid) - 1; | 593 | len = sizeof (oid) - 1; |
594 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); | 594 | result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); |
@@ -660,8 +660,8 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, | |||
660 | return GNUTLS_E_X509_UNSUPPORTED_OID; | 660 | return GNUTLS_E_X509_UNSUPPORTED_OID; |
661 | } | 661 | } |
662 | 662 | ||
663 | _gnutls_str_cpy (tmp, sizeof (tmp), "PKIX1."); | 663 | mhd_gtls_str_cpy (tmp, sizeof (tmp), "PKIX1."); |
664 | _gnutls_str_cat (tmp, sizeof (tmp), val_name); | 664 | mhd_gtls_str_cat (tmp, sizeof (tmp), val_name); |
665 | 665 | ||
666 | result = asn1_create_element (_gnutls_get_pkix (), tmp, &c2); | 666 | result = asn1_create_element (_gnutls_get_pkix (), tmp, &c2); |
667 | if (result != ASN1_SUCCESS) | 667 | if (result != ASN1_SUCCESS) |
@@ -702,7 +702,7 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, | |||
702 | return _gnutls_asn2err (result); | 702 | return _gnutls_asn2err (result); |
703 | } | 703 | } |
704 | 704 | ||
705 | _gnutls_str_cpy (tmp, sizeof (tmp), string_type); | 705 | mhd_gtls_str_cpy (tmp, sizeof (tmp), string_type); |
706 | } | 706 | } |
707 | 707 | ||
708 | result = asn1_write_value (c2, tmp, data, sizeof_data); | 708 | result = asn1_write_value (c2, tmp, data, sizeof_data); |
@@ -717,12 +717,12 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, | |||
717 | /* write the data (value) | 717 | /* write the data (value) |
718 | */ | 718 | */ |
719 | 719 | ||
720 | _gnutls_str_cpy (tmp, sizeof (tmp), where); | 720 | mhd_gtls_str_cpy (tmp, sizeof (tmp), where); |
721 | _gnutls_str_cat (tmp, sizeof (tmp), ".value"); | 721 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".value"); |
722 | 722 | ||
723 | if (multi != 0) | 723 | if (multi != 0) |
724 | { /* if not writing an AttributeTypeAndValue, but an Attribute */ | 724 | { /* if not writing an AttributeTypeAndValue, but an Attribute */ |
725 | _gnutls_str_cat (tmp, sizeof (tmp), "s"); /* values */ | 725 | mhd_gtls_str_cat (tmp, sizeof (tmp), "s"); /* values */ |
726 | 726 | ||
727 | result = asn1_write_value (asn1_struct, tmp, "NEW", 1); | 727 | result = asn1_write_value (asn1_struct, tmp, "NEW", 1); |
728 | if (result != ASN1_SUCCESS) | 728 | if (result != ASN1_SUCCESS) |
@@ -731,7 +731,7 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, | |||
731 | return _gnutls_asn2err (result); | 731 | return _gnutls_asn2err (result); |
732 | } | 732 | } |
733 | 733 | ||
734 | _gnutls_str_cat (tmp, sizeof (tmp), ".?LAST"); | 734 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".?LAST"); |
735 | 735 | ||
736 | } | 736 | } |
737 | 737 | ||
@@ -744,8 +744,8 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, | |||
744 | 744 | ||
745 | /* write the type | 745 | /* write the type |
746 | */ | 746 | */ |
747 | _gnutls_str_cpy (tmp, sizeof (tmp), where); | 747 | mhd_gtls_str_cpy (tmp, sizeof (tmp), where); |
748 | _gnutls_str_cat (tmp, sizeof (tmp), ".type"); | 748 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".type"); |
749 | 749 | ||
750 | result = asn1_write_value (asn1_struct, tmp, given_oid, 1); | 750 | result = asn1_write_value (asn1_struct, tmp, given_oid, 1); |
751 | if (result != ASN1_SUCCESS) | 751 | if (result != ASN1_SUCCESS) |
@@ -772,12 +772,12 @@ _gnutls_x509_write_attribute (const char *given_oid, | |||
772 | /* write the data (value) | 772 | /* write the data (value) |
773 | */ | 773 | */ |
774 | 774 | ||
775 | _gnutls_str_cpy (tmp, sizeof (tmp), where); | 775 | mhd_gtls_str_cpy (tmp, sizeof (tmp), where); |
776 | _gnutls_str_cat (tmp, sizeof (tmp), ".value"); | 776 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".value"); |
777 | 777 | ||
778 | if (multi != 0) | 778 | if (multi != 0) |
779 | { /* if not writing an AttributeTypeAndValue, but an Attribute */ | 779 | { /* if not writing an AttributeTypeAndValue, but an Attribute */ |
780 | _gnutls_str_cat (tmp, sizeof (tmp), "s"); /* values */ | 780 | mhd_gtls_str_cat (tmp, sizeof (tmp), "s"); /* values */ |
781 | 781 | ||
782 | result = asn1_write_value (asn1_struct, tmp, "NEW", 1); | 782 | result = asn1_write_value (asn1_struct, tmp, "NEW", 1); |
783 | if (result != ASN1_SUCCESS) | 783 | if (result != ASN1_SUCCESS) |
@@ -786,7 +786,7 @@ _gnutls_x509_write_attribute (const char *given_oid, | |||
786 | return _gnutls_asn2err (result); | 786 | return _gnutls_asn2err (result); |
787 | } | 787 | } |
788 | 788 | ||
789 | _gnutls_str_cat (tmp, sizeof (tmp), ".?LAST"); | 789 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".?LAST"); |
790 | 790 | ||
791 | } | 791 | } |
792 | 792 | ||
@@ -799,8 +799,8 @@ _gnutls_x509_write_attribute (const char *given_oid, | |||
799 | 799 | ||
800 | /* write the type | 800 | /* write the type |
801 | */ | 801 | */ |
802 | _gnutls_str_cpy (tmp, sizeof (tmp), where); | 802 | mhd_gtls_str_cpy (tmp, sizeof (tmp), where); |
803 | _gnutls_str_cat (tmp, sizeof (tmp), ".type"); | 803 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".type"); |
804 | 804 | ||
805 | result = asn1_write_value (asn1_struct, tmp, given_oid, 1); | 805 | result = asn1_write_value (asn1_struct, tmp, given_oid, 1); |
806 | if (result != ASN1_SUCCESS) | 806 | if (result != ASN1_SUCCESS) |
@@ -832,8 +832,8 @@ _gnutls_x509_decode_and_read_attribute (ASN1_TYPE asn1_struct, | |||
832 | 832 | ||
833 | /* Read the OID | 833 | /* Read the OID |
834 | */ | 834 | */ |
835 | _gnutls_str_cpy (tmpbuffer, sizeof (tmpbuffer), where); | 835 | mhd_gtls_str_cpy (tmpbuffer, sizeof (tmpbuffer), where); |
836 | _gnutls_str_cat (tmpbuffer, sizeof (tmpbuffer), ".type"); | 836 | mhd_gtls_str_cat (tmpbuffer, sizeof (tmpbuffer), ".type"); |
837 | 837 | ||
838 | len = oid_size - 1; | 838 | len = oid_size - 1; |
839 | result = asn1_read_value (asn1_struct, tmpbuffer, oid, &len); | 839 | result = asn1_read_value (asn1_struct, tmpbuffer, oid, &len); |
@@ -848,11 +848,11 @@ _gnutls_x509_decode_and_read_attribute (ASN1_TYPE asn1_struct, | |||
848 | /* Read the Value | 848 | /* Read the Value |
849 | */ | 849 | */ |
850 | 850 | ||
851 | _gnutls_str_cpy (tmpbuffer, sizeof (tmpbuffer), where); | 851 | mhd_gtls_str_cpy (tmpbuffer, sizeof (tmpbuffer), where); |
852 | _gnutls_str_cat (tmpbuffer, sizeof (tmpbuffer), ".value"); | 852 | mhd_gtls_str_cat (tmpbuffer, sizeof (tmpbuffer), ".value"); |
853 | 853 | ||
854 | if (multi) | 854 | if (multi) |
855 | _gnutls_str_cat (tmpbuffer, sizeof (tmpbuffer), "s.?1"); /* .values.?1 */ | 855 | mhd_gtls_str_cat (tmpbuffer, sizeof (tmpbuffer), "s.?1"); /* .values.?1 */ |
856 | 856 | ||
857 | result = | 857 | result = |
858 | _gnutls_x509_read_value (asn1_struct, tmpbuffer, value, octet_string); | 858 | _gnutls_x509_read_value (asn1_struct, tmpbuffer, value, octet_string); |
@@ -896,8 +896,8 @@ _gnutls_x509_set_dn_oid (ASN1_TYPE asn1_struct, | |||
896 | return _gnutls_asn2err (result); | 896 | return _gnutls_asn2err (result); |
897 | } | 897 | } |
898 | 898 | ||
899 | _gnutls_str_cpy (asn1_rdn_name, sizeof (asn1_rdn_name), asn1_name); | 899 | mhd_gtls_str_cpy (asn1_rdn_name, sizeof (asn1_rdn_name), asn1_name); |
900 | _gnutls_str_cat (asn1_rdn_name, sizeof (asn1_rdn_name), ".rdnSequence"); | 900 | mhd_gtls_str_cat (asn1_rdn_name, sizeof (asn1_rdn_name), ".rdnSequence"); |
901 | 901 | ||
902 | /* create a new element | 902 | /* create a new element |
903 | */ | 903 | */ |
@@ -908,8 +908,8 @@ _gnutls_x509_set_dn_oid (ASN1_TYPE asn1_struct, | |||
908 | return _gnutls_asn2err (result); | 908 | return _gnutls_asn2err (result); |
909 | } | 909 | } |
910 | 910 | ||
911 | _gnutls_str_cpy (tmp, sizeof (tmp), asn1_rdn_name); | 911 | mhd_gtls_str_cpy (tmp, sizeof (tmp), asn1_rdn_name); |
912 | _gnutls_str_cat (tmp, sizeof (tmp), ".?LAST"); | 912 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".?LAST"); |
913 | 913 | ||
914 | /* create the set with only one element | 914 | /* create the set with only one element |
915 | */ | 915 | */ |
@@ -923,8 +923,8 @@ _gnutls_x509_set_dn_oid (ASN1_TYPE asn1_struct, | |||
923 | 923 | ||
924 | /* Encode and write the data | 924 | /* Encode and write the data |
925 | */ | 925 | */ |
926 | _gnutls_str_cpy (tmp, sizeof (tmp), asn1_rdn_name); | 926 | mhd_gtls_str_cpy (tmp, sizeof (tmp), asn1_rdn_name); |
927 | _gnutls_str_cat (tmp, sizeof (tmp), ".?LAST.?LAST"); | 927 | mhd_gtls_str_cat (tmp, sizeof (tmp), ".?LAST.?LAST"); |
928 | 928 | ||
929 | if (!raw_flag) | 929 | if (!raw_flag) |
930 | { | 930 | { |
diff --git a/src/daemon/https/x509/extensions.c b/src/daemon/https/x509/extensions.c index 98379add..ddabd429 100644 --- a/src/daemon/https/x509/extensions.c +++ b/src/daemon/https/x509/extensions.c | |||
@@ -82,8 +82,8 @@ _gnutls_x509_crt_get_extension (gnutls_x509_crt_t cert, | |||
82 | do | 82 | do |
83 | { | 83 | { |
84 | 84 | ||
85 | _gnutls_str_cpy (name2, sizeof (name2), name); | 85 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
86 | _gnutls_str_cat (name2, sizeof (name2), ".extnID"); | 86 | mhd_gtls_str_cat (name2, sizeof (name2), ".extnID"); |
87 | 87 | ||
88 | len = sizeof (extnID) - 1; | 88 | len = sizeof (extnID) - 1; |
89 | result = asn1_read_value (cert->cert, name2, extnID, &len); | 89 | result = asn1_read_value (cert->cert, name2, extnID, &len); |
@@ -108,8 +108,8 @@ _gnutls_x509_crt_get_extension (gnutls_x509_crt_t cert, | |||
108 | 108 | ||
109 | /* read the critical status. | 109 | /* read the critical status. |
110 | */ | 110 | */ |
111 | _gnutls_str_cpy (name2, sizeof (name2), name); | 111 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
112 | _gnutls_str_cat (name2, sizeof (name2), ".critical"); | 112 | mhd_gtls_str_cat (name2, sizeof (name2), ".critical"); |
113 | 113 | ||
114 | len = sizeof (str_critical); | 114 | len = sizeof (str_critical); |
115 | result = | 115 | result = |
@@ -133,8 +133,8 @@ _gnutls_x509_crt_get_extension (gnutls_x509_crt_t cert, | |||
133 | 133 | ||
134 | /* read the value. | 134 | /* read the value. |
135 | */ | 135 | */ |
136 | _gnutls_str_cpy (name2, sizeof (name2), name); | 136 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
137 | _gnutls_str_cat (name2, sizeof (name2), ".extnValue"); | 137 | mhd_gtls_str_cat (name2, sizeof (name2), ".extnValue"); |
138 | 138 | ||
139 | result = _gnutls_x509_read_value (cert->cert, name2, &value, 0); | 139 | result = _gnutls_x509_read_value (cert->cert, name2, &value, 0); |
140 | if (result < 0) | 140 | if (result < 0) |
@@ -206,8 +206,8 @@ _gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t cert, | |||
206 | do | 206 | do |
207 | { | 207 | { |
208 | 208 | ||
209 | _gnutls_str_cpy (name2, sizeof (name2), name); | 209 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
210 | _gnutls_str_cat (name2, sizeof (name2), ".extnID"); | 210 | mhd_gtls_str_cat (name2, sizeof (name2), ".extnID"); |
211 | 211 | ||
212 | len = sizeof (extnID) - 1; | 212 | len = sizeof (extnID) - 1; |
213 | result = asn1_read_value (cert->cert, name2, extnID, &len); | 213 | result = asn1_read_value (cert->cert, name2, extnID, &len); |
@@ -335,8 +335,8 @@ overwrite_extension (ASN1_TYPE asn, unsigned int indx, | |||
335 | else | 335 | else |
336 | str = "TRUE"; | 336 | str = "TRUE"; |
337 | 337 | ||
338 | _gnutls_str_cpy (name2, sizeof (name2), name); | 338 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
339 | _gnutls_str_cat (name2, sizeof (name2), ".critical"); | 339 | mhd_gtls_str_cat (name2, sizeof (name2), ".critical"); |
340 | 340 | ||
341 | result = asn1_write_value (asn, name2, str, 1); | 341 | result = asn1_write_value (asn, name2, str, 1); |
342 | if (result != ASN1_SUCCESS) | 342 | if (result != ASN1_SUCCESS) |
@@ -345,8 +345,8 @@ overwrite_extension (ASN1_TYPE asn, unsigned int indx, | |||
345 | return _gnutls_asn2err (result); | 345 | return _gnutls_asn2err (result); |
346 | } | 346 | } |
347 | 347 | ||
348 | _gnutls_str_cpy (name2, sizeof (name2), name); | 348 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
349 | _gnutls_str_cat (name2, sizeof (name2), ".extnValue"); | 349 | mhd_gtls_str_cat (name2, sizeof (name2), ".extnValue"); |
350 | 350 | ||
351 | result = _gnutls_x509_write_value (asn, name2, ext_data, 0); | 351 | result = _gnutls_x509_write_value (asn, name2, ext_data, 0); |
352 | if (result < 0) | 352 | if (result < 0) |
@@ -397,8 +397,8 @@ _gnutls_x509_crt_set_extension (gnutls_x509_crt_t cert, | |||
397 | do | 397 | do |
398 | { | 398 | { |
399 | 399 | ||
400 | _gnutls_str_cpy (name2, sizeof (name2), name); | 400 | mhd_gtls_str_cpy (name2, sizeof (name2), name); |
401 | _gnutls_str_cat (name2, sizeof (name2), ".extnID"); | 401 | mhd_gtls_str_cat (name2, sizeof (name2), ".extnID"); |
402 | 402 | ||
403 | len = sizeof (extnID) - 1; | 403 | len = sizeof (extnID) - 1; |
404 | result = asn1_read_value (cert->cert, name2, extnID, &len); | 404 | result = asn1_read_value (cert->cert, name2, extnID, &len); |
@@ -687,12 +687,12 @@ write_new_general_name (ASN1_TYPE ext, const char *ext_name, | |||
687 | 687 | ||
688 | if (ext_name[0] == 0) | 688 | if (ext_name[0] == 0) |
689 | { /* no dot */ | 689 | { /* no dot */ |
690 | _gnutls_str_cpy (name, sizeof (name), "?LAST"); | 690 | mhd_gtls_str_cpy (name, sizeof (name), "?LAST"); |
691 | } | 691 | } |
692 | else | 692 | else |
693 | { | 693 | { |
694 | _gnutls_str_cpy (name, sizeof (name), ext_name); | 694 | mhd_gtls_str_cpy (name, sizeof (name), ext_name); |
695 | _gnutls_str_cat (name, sizeof (name), ".?LAST"); | 695 | mhd_gtls_str_cat (name, sizeof (name), ".?LAST"); |
696 | } | 696 | } |
697 | 697 | ||
698 | result = asn1_write_value (ext, name, str, 1); | 698 | result = asn1_write_value (ext, name, str, 1); |
@@ -702,8 +702,8 @@ write_new_general_name (ASN1_TYPE ext, const char *ext_name, | |||
702 | return _gnutls_asn2err (result); | 702 | return _gnutls_asn2err (result); |
703 | } | 703 | } |
704 | 704 | ||
705 | _gnutls_str_cat (name, sizeof (name), "."); | 705 | mhd_gtls_str_cat (name, sizeof (name), "."); |
706 | _gnutls_str_cat (name, sizeof (name), str); | 706 | mhd_gtls_str_cat (name, sizeof (name), str); |
707 | 707 | ||
708 | result = asn1_write_value (ext, name, data_string, strlen (data_string)); | 708 | result = asn1_write_value (ext, name, data_string, strlen (data_string)); |
709 | if (result != ASN1_SUCCESS) | 709 | if (result != ASN1_SUCCESS) |
diff --git a/src/daemon/https/x509/mpi.c b/src/daemon/https/x509/mpi.c index 0d39adb5..b0ba7393 100644 --- a/src/daemon/https/x509/mpi.c +++ b/src/daemon/https/x509/mpi.c | |||
@@ -71,7 +71,7 @@ _gnutls_x509_read_rsa_params (opaque * der, int dersize, mpi_t * params) | |||
71 | _gnutls_x509_read_int (spk, "publicExponent", ¶ms[1])) < 0) | 71 | _gnutls_x509_read_int (spk, "publicExponent", ¶ms[1])) < 0) |
72 | { | 72 | { |
73 | gnutls_assert (); | 73 | gnutls_assert (); |
74 | _gnutls_mpi_release (¶ms[0]); | 74 | mhd_gtls_mpi_release (¶ms[0]); |
75 | asn1_delete_structure (&spk); | 75 | asn1_delete_structure (&spk); |
76 | return GNUTLS_E_ASN1_GENERIC_ERROR; | 76 | return GNUTLS_E_ASN1_GENERIC_ERROR; |
77 | } | 77 | } |
@@ -129,7 +129,7 @@ _gnutls_x509_read_dsa_params (opaque * der, int dersize, mpi_t * params) | |||
129 | { | 129 | { |
130 | gnutls_assert (); | 130 | gnutls_assert (); |
131 | asn1_delete_structure (&spk); | 131 | asn1_delete_structure (&spk); |
132 | _gnutls_mpi_release (¶ms[0]); | 132 | mhd_gtls_mpi_release (¶ms[0]); |
133 | return GNUTLS_E_ASN1_GENERIC_ERROR; | 133 | return GNUTLS_E_ASN1_GENERIC_ERROR; |
134 | } | 134 | } |
135 | 135 | ||
@@ -139,8 +139,8 @@ _gnutls_x509_read_dsa_params (opaque * der, int dersize, mpi_t * params) | |||
139 | { | 139 | { |
140 | gnutls_assert (); | 140 | gnutls_assert (); |
141 | asn1_delete_structure (&spk); | 141 | asn1_delete_structure (&spk); |
142 | _gnutls_mpi_release (¶ms[0]); | 142 | mhd_gtls_mpi_release (¶ms[0]); |
143 | _gnutls_mpi_release (¶ms[1]); | 143 | mhd_gtls_mpi_release (¶ms[1]); |
144 | return GNUTLS_E_ASN1_GENERIC_ERROR; | 144 | return GNUTLS_E_ASN1_GENERIC_ERROR; |
145 | } | 145 | } |
146 | 146 | ||
@@ -343,10 +343,10 @@ _gnutls_x509_write_sig_params (ASN1_TYPE dst, | |||
343 | char name[128]; | 343 | char name[128]; |
344 | const char *pk; | 344 | const char *pk; |
345 | 345 | ||
346 | _gnutls_str_cpy (name, sizeof (name), dst_name); | 346 | mhd_gtls_str_cpy (name, sizeof (name), dst_name); |
347 | _gnutls_str_cat (name, sizeof (name), ".algorithm"); | 347 | mhd_gtls_str_cat (name, sizeof (name), ".algorithm"); |
348 | 348 | ||
349 | pk = _gnutls_x509_sign_to_oid (pk_algorithm, HASH2MAC (dig)); | 349 | pk = mhd_gtls_x509_sign_to_oid (pk_algorithm, HASH2MAC (dig)); |
350 | if (pk == NULL) | 350 | if (pk == NULL) |
351 | { | 351 | { |
352 | gnutls_assert (); | 352 | gnutls_assert (); |
@@ -362,8 +362,8 @@ _gnutls_x509_write_sig_params (ASN1_TYPE dst, | |||
362 | return _gnutls_asn2err (result); | 362 | return _gnutls_asn2err (result); |
363 | } | 363 | } |
364 | 364 | ||
365 | _gnutls_str_cpy (name, sizeof (name), dst_name); | 365 | mhd_gtls_str_cpy (name, sizeof (name), dst_name); |
366 | _gnutls_str_cat (name, sizeof (name), ".parameters"); | 366 | mhd_gtls_str_cat (name, sizeof (name), ".parameters"); |
367 | 367 | ||
368 | if (pk_algorithm == MHD_GNUTLS_PK_RSA) | 368 | if (pk_algorithm == MHD_GNUTLS_PK_RSA) |
369 | { /* RSA */ | 369 | { /* RSA */ |
@@ -536,11 +536,11 @@ _gnutls_x509_read_uint (ASN1_TYPE node, const char *value, unsigned int *ret) | |||
536 | if (len == 1) | 536 | if (len == 1) |
537 | *ret = tmpstr[0]; | 537 | *ret = tmpstr[0]; |
538 | else if (len == 2) | 538 | else if (len == 2) |
539 | *ret = _gnutls_read_uint16 (tmpstr); | 539 | *ret = mhd_gtls_read_uint16 (tmpstr); |
540 | else if (len == 3) | 540 | else if (len == 3) |
541 | *ret = _gnutls_read_uint24 (tmpstr); | 541 | *ret = mhd_gtls_read_uint24 (tmpstr); |
542 | else if (len == 4) | 542 | else if (len == 4) |
543 | *ret = _gnutls_read_uint32 (tmpstr); | 543 | *ret = mhd_gtls_read_uint32 (tmpstr); |
544 | else | 544 | else |
545 | { | 545 | { |
546 | gnutls_assert (); | 546 | gnutls_assert (); |
@@ -561,7 +561,7 @@ _gnutls_x509_write_uint32 (ASN1_TYPE node, const char *value, uint32_t num) | |||
561 | opaque tmpstr[4]; | 561 | opaque tmpstr[4]; |
562 | int result; | 562 | int result; |
563 | 563 | ||
564 | _gnutls_write_uint32 (num, tmpstr); | 564 | mhd_gtls_write_uint32 (num, tmpstr); |
565 | 565 | ||
566 | result = asn1_write_value (node, value, tmpstr, 4); | 566 | result = asn1_write_value (node, value, tmpstr, 4); |
567 | 567 | ||
diff --git a/src/daemon/https/x509/output.c b/src/daemon/https/x509/output.c deleted file mode 100644 index 8892cf4e..00000000 --- a/src/daemon/https/x509/output.c +++ /dev/null | |||
@@ -1,1360 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Free Software Foundation | ||
3 | * | ||
4 | * Author: Simon Josefsson | ||
5 | * | ||
6 | * This file is part of GNUTLS. | ||
7 | * | ||
8 | * The GNUTLS library 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 | ||
19 | * License along with this library; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
21 | * 02110-1301, USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | /* Functions for printing X.509 Certificate structures | ||
26 | */ | ||
27 | |||
28 | #include <gnutls_int.h> | ||
29 | #include <common.h> | ||
30 | #include <gnutls_x509.h> | ||
31 | #include <x509.h> | ||
32 | #include <gnutls_errors.h> | ||
33 | |||
34 | /* I18n of error codes. */ | ||
35 | #include "gettext.h" | ||
36 | #define _(String) dgettext (PACKAGE, String) | ||
37 | #define N_(String) gettext_noop (String) | ||
38 | |||
39 | #define addf _gnutls_string_append_printf | ||
40 | #define adds _gnutls_string_append_str | ||
41 | |||
42 | static void | ||
43 | hexdump (gnutls_string * str, const char *data, size_t len, const char *spc) | ||
44 | { | ||
45 | size_t j; | ||
46 | |||
47 | if (spc) | ||
48 | adds (str, spc); | ||
49 | for (j = 0; j < len; j++) | ||
50 | { | ||
51 | if (((j + 1) % 16) == 0) | ||
52 | { | ||
53 | addf (str, "%.2x\n", (unsigned char) data[j]); | ||
54 | if (spc && j != (len - 1)) | ||
55 | adds (str, spc); | ||
56 | } | ||
57 | else if (j == (len - 1)) | ||
58 | addf (str, "%.2x", (unsigned char) data[j]); | ||
59 | else | ||
60 | addf (str, "%.2x:", (unsigned char) data[j]); | ||
61 | } | ||
62 | if ((j % 16) != 0) | ||
63 | adds (str, "\n"); | ||
64 | } | ||
65 | |||
66 | static void | ||
67 | hexprint (gnutls_string * str, const char *data, size_t len) | ||
68 | { | ||
69 | size_t j; | ||
70 | |||
71 | if (len == 0) | ||
72 | adds (str, "00"); | ||
73 | else | ||
74 | { | ||
75 | for (j = 0; j < len; j++) | ||
76 | addf (str, "%.2x", (unsigned char) data[j]); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | |||
81 | static void | ||
82 | asciiprint (gnutls_string * str, const char *data, size_t len) | ||
83 | { | ||
84 | size_t j; | ||
85 | |||
86 | for (j = 0; j < len; j++) | ||
87 | if (isprint (data[j])) | ||
88 | addf (str, "%c", (unsigned char) data[j]); | ||
89 | else | ||
90 | addf (str, "."); | ||
91 | } | ||
92 | |||
93 | static void | ||
94 | print_proxy (gnutls_string * str, gnutls_x509_crt_t cert) | ||
95 | { | ||
96 | int pathlen; | ||
97 | char *policyLanguage; | ||
98 | char *policy; | ||
99 | size_t npolicy; | ||
100 | int err; | ||
101 | |||
102 | err = gnutls_x509_crt_get_proxy (cert, NULL, | ||
103 | &pathlen, &policyLanguage, | ||
104 | &policy, &npolicy); | ||
105 | if (err < 0) | ||
106 | { | ||
107 | addf (str, "error: get_proxy: %s\n", gnutls_strerror (err)); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | if (pathlen >= 0) | ||
112 | addf (str, _("\t\t\tPath Length Constraint: %d\n"), pathlen); | ||
113 | addf (str, _("\t\t\tPolicy Language: %s"), policyLanguage); | ||
114 | if (strcmp (policyLanguage, "1.3.6.1.5.5.7.21.1") == 0) | ||
115 | adds (str, " (id-ppl-inheritALL)\n"); | ||
116 | else if (strcmp (policyLanguage, "1.3.6.1.5.5.7.21.2") == 0) | ||
117 | adds (str, " (id-ppl-independent)\n"); | ||
118 | else | ||
119 | adds (str, "\n"); | ||
120 | if (npolicy) | ||
121 | { | ||
122 | adds (str, _("\t\t\tPolicy:\n\t\t\t\tASCII: ")); | ||
123 | asciiprint (str, policy, npolicy); | ||
124 | adds (str, _("\n\t\t\t\tHexdump: ")); | ||
125 | hexprint (str, policy, npolicy); | ||
126 | adds (str, "\n"); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | static void | ||
131 | print_ski (gnutls_string * str, gnutls_x509_crt_t cert) | ||
132 | { | ||
133 | char *buffer = NULL; | ||
134 | size_t size = 0; | ||
135 | int err; | ||
136 | |||
137 | err = gnutls_x509_crt_get_subject_key_id (cert, buffer, &size, NULL); | ||
138 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
139 | { | ||
140 | addf (str, "error: get_subject_key_id: %s\n", gnutls_strerror (err)); | ||
141 | return; | ||
142 | } | ||
143 | |||
144 | buffer = gnutls_malloc (size); | ||
145 | if (!buffer) | ||
146 | { | ||
147 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | err = gnutls_x509_crt_get_subject_key_id (cert, buffer, &size, NULL); | ||
152 | if (err < 0) | ||
153 | { | ||
154 | gnutls_free (buffer); | ||
155 | addf (str, "error: get_subject_key_id2: %s\n", gnutls_strerror (err)); | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | adds (str, "\t\t\t"); | ||
160 | hexprint (str, buffer, size); | ||
161 | adds (str, "\n"); | ||
162 | |||
163 | gnutls_free (buffer); | ||
164 | } | ||
165 | |||
166 | static void | ||
167 | print_aki (gnutls_string * str, gnutls_x509_crt_t cert) | ||
168 | { | ||
169 | char *buffer = NULL; | ||
170 | size_t size = 0; | ||
171 | int err; | ||
172 | |||
173 | err = gnutls_x509_crt_get_authority_key_id (cert, buffer, &size, NULL); | ||
174 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
175 | { | ||
176 | addf (str, "error: get_authority_key_id: %s\n", gnutls_strerror (err)); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | buffer = gnutls_malloc (size); | ||
181 | if (!buffer) | ||
182 | { | ||
183 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
184 | return; | ||
185 | } | ||
186 | |||
187 | err = gnutls_x509_crt_get_authority_key_id (cert, buffer, &size, NULL); | ||
188 | if (err < 0) | ||
189 | { | ||
190 | gnutls_free (buffer); | ||
191 | addf (str, "error: get_authority_key_id2: %s\n", gnutls_strerror (err)); | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | adds (str, "\t\t\t"); | ||
196 | hexprint (str, buffer, size); | ||
197 | adds (str, "\n"); | ||
198 | |||
199 | gnutls_free (buffer); | ||
200 | } | ||
201 | |||
202 | static void | ||
203 | print_key_usage (gnutls_string * str, gnutls_x509_crt_t cert) | ||
204 | { | ||
205 | unsigned int key_usage; | ||
206 | int err; | ||
207 | |||
208 | err = gnutls_x509_crt_get_key_usage (cert, &key_usage, NULL); | ||
209 | if (err < 0) | ||
210 | { | ||
211 | addf (str, "error: get_key_usage: %s\n", gnutls_strerror (err)); | ||
212 | return; | ||
213 | } | ||
214 | |||
215 | if (key_usage & GNUTLS_KEY_DIGITAL_SIGNATURE) | ||
216 | addf (str, _("\t\t\tDigital signature.\n")); | ||
217 | if (key_usage & GNUTLS_KEY_NON_REPUDIATION) | ||
218 | addf (str, _("\t\t\tNon repudiation.\n")); | ||
219 | if (key_usage & GNUTLS_KEY_KEY_ENCIPHERMENT) | ||
220 | addf (str, _("\t\t\tKey encipherment.\n")); | ||
221 | if (key_usage & GNUTLS_KEY_DATA_ENCIPHERMENT) | ||
222 | addf (str, _("\t\t\tData encipherment.\n")); | ||
223 | if (key_usage & GNUTLS_KEY_KEY_AGREEMENT) | ||
224 | addf (str, _("\t\t\tKey agreement.\n")); | ||
225 | if (key_usage & GNUTLS_KEY_KEY_CERT_SIGN) | ||
226 | addf (str, _("\t\t\tCertificate signing.\n")); | ||
227 | if (key_usage & GNUTLS_KEY_CRL_SIGN) | ||
228 | addf (str, _("\t\t\tCRL signing.\n")); | ||
229 | if (key_usage & GNUTLS_KEY_ENCIPHER_ONLY) | ||
230 | addf (str, _("\t\t\tKey encipher only.\n")); | ||
231 | if (key_usage & GNUTLS_KEY_DECIPHER_ONLY) | ||
232 | addf (str, _("\t\t\tKey decipher only.\n")); | ||
233 | } | ||
234 | |||
235 | static void | ||
236 | print_crldist (gnutls_string * str, gnutls_x509_crt_t cert) | ||
237 | { | ||
238 | char *buffer = NULL; | ||
239 | size_t size; | ||
240 | int err; | ||
241 | int indx; | ||
242 | |||
243 | for (indx = 0;; indx++) | ||
244 | { | ||
245 | size = 0; | ||
246 | err = gnutls_x509_crt_get_crl_dist_points (cert, indx, buffer, &size, | ||
247 | NULL, NULL); | ||
248 | if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) | ||
249 | return; | ||
250 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
251 | { | ||
252 | addf (str, "error: get_crl_dist_points: %s\n", | ||
253 | gnutls_strerror (err)); | ||
254 | return; | ||
255 | } | ||
256 | |||
257 | buffer = gnutls_malloc (size); | ||
258 | if (!buffer) | ||
259 | { | ||
260 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
261 | return; | ||
262 | } | ||
263 | |||
264 | err = gnutls_x509_crt_get_crl_dist_points (cert, indx, buffer, &size, | ||
265 | NULL, NULL); | ||
266 | if (err < 0) | ||
267 | { | ||
268 | gnutls_free (buffer); | ||
269 | addf (str, "error: get_crl_dist_points2: %s\n", | ||
270 | gnutls_strerror (err)); | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | switch (err) | ||
275 | { | ||
276 | case GNUTLS_SAN_DNSNAME: | ||
277 | addf (str, "\t\t\tDNSname: %.*s\n", size, buffer); | ||
278 | break; | ||
279 | |||
280 | case GNUTLS_SAN_RFC822NAME: | ||
281 | addf (str, "\t\t\tRFC822name: %.*s\n", size, buffer); | ||
282 | break; | ||
283 | |||
284 | case GNUTLS_SAN_URI: | ||
285 | addf (str, "\t\t\tURI: %.*s\n", size, buffer); | ||
286 | break; | ||
287 | |||
288 | case GNUTLS_SAN_IPADDRESS: | ||
289 | addf (str, "\t\t\tIPAddress: %.*s\n", size, buffer); | ||
290 | break; | ||
291 | |||
292 | case GNUTLS_SAN_DN: | ||
293 | addf (str, "\t\t\tdirectoryName: %.*s\n", size, buffer); | ||
294 | break; | ||
295 | |||
296 | default: | ||
297 | addf (str, "error: unknown SAN\n"); | ||
298 | break; | ||
299 | } | ||
300 | gnutls_free (buffer); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | static void | ||
305 | print_key_purpose (gnutls_string * str, gnutls_x509_crt_t cert) | ||
306 | { | ||
307 | int indx; | ||
308 | char *buffer = NULL; | ||
309 | size_t size; | ||
310 | int err; | ||
311 | |||
312 | for (indx = 0;; indx++) | ||
313 | { | ||
314 | size = 0; | ||
315 | err = gnutls_x509_crt_get_key_purpose_oid (cert, indx, buffer, | ||
316 | &size, NULL); | ||
317 | if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) | ||
318 | return; | ||
319 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
320 | { | ||
321 | addf (str, "error: get_key_purpose_oid: %s\n", | ||
322 | gnutls_strerror (err)); | ||
323 | return; | ||
324 | } | ||
325 | |||
326 | buffer = gnutls_malloc (size); | ||
327 | if (!buffer) | ||
328 | { | ||
329 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
330 | return; | ||
331 | } | ||
332 | |||
333 | err = gnutls_x509_crt_get_key_purpose_oid (cert, indx, buffer, | ||
334 | &size, NULL); | ||
335 | if (err < 0) | ||
336 | { | ||
337 | gnutls_free (buffer); | ||
338 | addf (str, "error: get_key_purpose_oid2: %s\n", | ||
339 | gnutls_strerror (err)); | ||
340 | return; | ||
341 | } | ||
342 | |||
343 | if (strcmp (buffer, GNUTLS_KP_TLS_WWW_SERVER) == 0) | ||
344 | addf (str, _("\t\t\tTLS WWW Server.\n")); | ||
345 | else if (strcmp (buffer, GNUTLS_KP_TLS_WWW_CLIENT) == 0) | ||
346 | addf (str, _("\t\t\tTLS WWW Client.\n")); | ||
347 | else if (strcmp (buffer, GNUTLS_KP_CODE_SIGNING) == 0) | ||
348 | addf (str, _("\t\t\tCode signing.\n")); | ||
349 | else if (strcmp (buffer, GNUTLS_KP_EMAIL_PROTECTION) == 0) | ||
350 | addf (str, _("\t\t\tEmail protection.\n")); | ||
351 | else if (strcmp (buffer, GNUTLS_KP_TIME_STAMPING) == 0) | ||
352 | addf (str, _("\t\t\tTime stamping.\n")); | ||
353 | else if (strcmp (buffer, GNUTLS_KP_OCSP_SIGNING) == 0) | ||
354 | addf (str, _("\t\t\tOCSP signing.\n")); | ||
355 | else if (strcmp (buffer, GNUTLS_KP_ANY) == 0) | ||
356 | addf (str, _("\t\t\tAny purpose.\n")); | ||
357 | else | ||
358 | addf (str, "\t\t\t%s\n", buffer); | ||
359 | |||
360 | gnutls_free (buffer); | ||
361 | } | ||
362 | } | ||
363 | |||
364 | static void | ||
365 | print_basic (gnutls_string * str, gnutls_x509_crt_t cert) | ||
366 | { | ||
367 | int pathlen; | ||
368 | int err; | ||
369 | |||
370 | err = gnutls_x509_crt_get_basic_constraints (cert, NULL, NULL, &pathlen); | ||
371 | if (err < 0) | ||
372 | { | ||
373 | addf (str, "error: get_basic_constraints: %s\n", gnutls_strerror (err)); | ||
374 | return; | ||
375 | } | ||
376 | |||
377 | if (err == 0) | ||
378 | addf (str, _("\t\t\tCertificate Authority (CA): FALSE\n")); | ||
379 | else | ||
380 | addf (str, _("\t\t\tCertificate Authority (CA): TRUE\n")); | ||
381 | |||
382 | if (pathlen >= 0) | ||
383 | addf (str, _("\t\t\tPath Length Constraint: %d\n"), pathlen); | ||
384 | } | ||
385 | |||
386 | static void | ||
387 | print_san (gnutls_string * str, gnutls_x509_crt_t cert) | ||
388 | { | ||
389 | unsigned int san_idx; | ||
390 | |||
391 | for (san_idx = 0;; san_idx++) | ||
392 | { | ||
393 | char *buffer = NULL; | ||
394 | size_t size = 0; | ||
395 | int err; | ||
396 | |||
397 | err = | ||
398 | gnutls_x509_crt_get_subject_alt_name (cert, san_idx, buffer, &size, | ||
399 | NULL); | ||
400 | if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) | ||
401 | break; | ||
402 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
403 | { | ||
404 | addf (str, "error: get_subject_alt_name: %s\n", | ||
405 | gnutls_strerror (err)); | ||
406 | return; | ||
407 | } | ||
408 | |||
409 | buffer = gnutls_malloc (size); | ||
410 | if (!buffer) | ||
411 | { | ||
412 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
413 | return; | ||
414 | } | ||
415 | |||
416 | err = gnutls_x509_crt_get_subject_alt_name (cert, san_idx, | ||
417 | buffer, &size, NULL); | ||
418 | if (err < 0) | ||
419 | { | ||
420 | gnutls_free (buffer); | ||
421 | addf (str, "error: get_subject_alt_name2: %s\n", | ||
422 | gnutls_strerror (err)); | ||
423 | return; | ||
424 | } | ||
425 | |||
426 | switch (err) | ||
427 | { | ||
428 | case GNUTLS_SAN_DNSNAME: | ||
429 | addf (str, "\t\t\tDNSname: %.*s\n", size, buffer); | ||
430 | break; | ||
431 | |||
432 | case GNUTLS_SAN_RFC822NAME: | ||
433 | addf (str, "\t\t\tRFC822name: %.*s\n", size, buffer); | ||
434 | break; | ||
435 | |||
436 | case GNUTLS_SAN_URI: | ||
437 | addf (str, "\t\t\tURI: %.*s\n", size, buffer); | ||
438 | break; | ||
439 | |||
440 | case GNUTLS_SAN_IPADDRESS: | ||
441 | addf (str, "\t\t\tIPAddress: %.*s\n", size, buffer); | ||
442 | break; | ||
443 | |||
444 | case GNUTLS_SAN_DN: | ||
445 | addf (str, "\t\t\tdirectoryName: %.*s\n", size, buffer); | ||
446 | break; | ||
447 | |||
448 | case GNUTLS_SAN_OTHERNAME: | ||
449 | { | ||
450 | char *oid = NULL; | ||
451 | size_t oidsize; | ||
452 | |||
453 | oidsize = 0; | ||
454 | err = gnutls_x509_crt_get_subject_alt_othername_oid | ||
455 | (cert, san_idx, oid, &oidsize); | ||
456 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
457 | { | ||
458 | gnutls_free (buffer); | ||
459 | addf (str, "error: get_subject_alt_othername_oid: %s\n", | ||
460 | gnutls_strerror (err)); | ||
461 | return; | ||
462 | } | ||
463 | |||
464 | oid = gnutls_malloc (oidsize); | ||
465 | if (!oid) | ||
466 | { | ||
467 | gnutls_free (buffer); | ||
468 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
469 | return; | ||
470 | } | ||
471 | |||
472 | err = gnutls_x509_crt_get_subject_alt_othername_oid | ||
473 | (cert, san_idx, oid, &oidsize); | ||
474 | if (err < 0) | ||
475 | { | ||
476 | gnutls_free (buffer); | ||
477 | gnutls_free (oid); | ||
478 | addf (str, "error: get_subject_alt_othername_oid2: %s\n", | ||
479 | gnutls_strerror (err)); | ||
480 | return; | ||
481 | } | ||
482 | |||
483 | if (err == GNUTLS_SAN_OTHERNAME_XMPP) | ||
484 | addf (str, _("\t\t\tXMPP Address: %.*s\n"), size, buffer); | ||
485 | else | ||
486 | { | ||
487 | addf (str, _("\t\t\totherName OID: %.*s\n"), oidsize, oid); | ||
488 | addf (str, _("\t\t\totherName DER: ")); | ||
489 | hexprint (str, buffer, size); | ||
490 | addf (str, _("\n\t\t\totherName ASCII: ")); | ||
491 | asciiprint (str, buffer, size); | ||
492 | addf (str, "\n"); | ||
493 | } | ||
494 | gnutls_free (oid); | ||
495 | } | ||
496 | break; | ||
497 | |||
498 | default: | ||
499 | addf (str, "error: unknown SAN\n"); | ||
500 | break; | ||
501 | } | ||
502 | |||
503 | gnutls_free (buffer); | ||
504 | } | ||
505 | } | ||
506 | |||
507 | static void | ||
508 | print_cert (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned) | ||
509 | { | ||
510 | /* Version. */ | ||
511 | { | ||
512 | int version = gnutls_x509_crt_get_version (cert); | ||
513 | if (version < 0) | ||
514 | addf (str, "error: get_version: %s\n", gnutls_strerror (version)); | ||
515 | else | ||
516 | addf (str, _("\tVersion: %d\n"), version); | ||
517 | } | ||
518 | |||
519 | /* Serial. */ | ||
520 | { | ||
521 | char serial[128]; | ||
522 | size_t serial_size = sizeof (serial); | ||
523 | int err; | ||
524 | |||
525 | err = gnutls_x509_crt_get_serial (cert, serial, &serial_size); | ||
526 | if (err < 0) | ||
527 | addf (str, "error: get_serial: %s\n", gnutls_strerror (err)); | ||
528 | else | ||
529 | { | ||
530 | addf (str, _("\tSerial Number (hex): ")); | ||
531 | hexprint (str, serial, serial_size); | ||
532 | addf (str, "\n"); | ||
533 | } | ||
534 | } | ||
535 | |||
536 | /* Issuer. */ | ||
537 | if (!notsigned) | ||
538 | { | ||
539 | char dn[1024]; | ||
540 | size_t dn_size = sizeof (dn); | ||
541 | int err; | ||
542 | |||
543 | err = gnutls_x509_crt_get_issuer_dn (cert, dn, &dn_size); | ||
544 | if (err < 0) | ||
545 | addf (str, "error: get_issuer_dn: %s\n", gnutls_strerror (err)); | ||
546 | else | ||
547 | addf (str, _("\tIssuer: %s\n"), dn); | ||
548 | } | ||
549 | |||
550 | /* Validity. */ | ||
551 | { | ||
552 | time_t tim; | ||
553 | |||
554 | addf (str, _("\tValidity:\n")); | ||
555 | |||
556 | tim = gnutls_x509_crt_get_activation_time (cert); | ||
557 | { | ||
558 | char s[42]; | ||
559 | size_t max = sizeof (s); | ||
560 | struct tm t; | ||
561 | |||
562 | if (gmtime_r (&tim, &t) == NULL) | ||
563 | addf (str, "error: gmtime_r (%d)\n", t); | ||
564 | else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0) | ||
565 | addf (str, "error: strftime (%d)\n", t); | ||
566 | else | ||
567 | addf (str, _("\t\tNot Before: %s\n"), s); | ||
568 | } | ||
569 | |||
570 | tim = gnutls_x509_crt_get_expiration_time (cert); | ||
571 | { | ||
572 | char s[42]; | ||
573 | size_t max = sizeof (s); | ||
574 | struct tm t; | ||
575 | |||
576 | if (gmtime_r (&tim, &t) == NULL) | ||
577 | addf (str, "error: gmtime_r (%d)\n", t); | ||
578 | else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0) | ||
579 | addf (str, "error: strftime (%d)\n", t); | ||
580 | else | ||
581 | addf (str, _("\t\tNot After: %s\n"), s); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | /* Subject. */ | ||
586 | { | ||
587 | char dn[1024]; | ||
588 | size_t dn_size = sizeof (dn); | ||
589 | int err; | ||
590 | |||
591 | err = gnutls_x509_crt_get_dn (cert, dn, &dn_size); | ||
592 | if (err < 0) | ||
593 | addf (str, "error: get_dn: %s\n", gnutls_strerror (err)); | ||
594 | else | ||
595 | addf (str, _("\tSubject: %s\n"), dn); | ||
596 | } | ||
597 | |||
598 | /* SubjectPublicKeyInfo. */ | ||
599 | { | ||
600 | int err; | ||
601 | unsigned int bits; | ||
602 | |||
603 | err = gnutls_x509_crt_get_pk_algorithm (cert, &bits); | ||
604 | if (err < 0) | ||
605 | addf (str, "error: get_pk_algorithm: %s\n", gnutls_strerror (err)); | ||
606 | else | ||
607 | { | ||
608 | const char *name = gnutls_pk_algorithm_get_name (err); | ||
609 | if (name == NULL) | ||
610 | name = "Unknown"; | ||
611 | |||
612 | addf (str, _("\tSubject Public Key Algorithm: %s\n"), name); | ||
613 | switch (err) | ||
614 | { | ||
615 | case MHD_GNUTLS_PK_RSA: | ||
616 | { | ||
617 | gnutls_datum_t m, e; | ||
618 | |||
619 | err = gnutls_x509_crt_get_pk_rsa_raw (cert, &m, &e); | ||
620 | if (err < 0) | ||
621 | addf (str, "error: get_pk_rsa_raw: %s\n", | ||
622 | gnutls_strerror (err)); | ||
623 | else | ||
624 | { | ||
625 | addf (str, _("\t\tModulus (bits %d):\n"), bits); | ||
626 | hexdump (str, m.data, m.size, "\t\t\t"); | ||
627 | addf (str, _("\t\tExponent:\n")); | ||
628 | hexdump (str, e.data, e.size, "\t\t\t"); | ||
629 | } | ||
630 | |||
631 | gnutls_free (m.data); | ||
632 | gnutls_free (e.data); | ||
633 | } | ||
634 | break; | ||
635 | |||
636 | case GNUTLS_PK_DSA: | ||
637 | { | ||
638 | gnutls_datum_t p, q, g, y; | ||
639 | |||
640 | err = gnutls_x509_crt_get_pk_dsa_raw (cert, &p, &q, &g, &y); | ||
641 | if (err < 0) | ||
642 | addf (str, "error: get_pk_dsa_raw: %s\n", | ||
643 | gnutls_strerror (err)); | ||
644 | else | ||
645 | { | ||
646 | addf (str, _("\t\tPublic key (bits %d):\n"), bits); | ||
647 | hexdump (str, y.data, y.size, "\t\t\t"); | ||
648 | addf (str, _("\t\tP:\n")); | ||
649 | hexdump (str, p.data, p.size, "\t\t\t"); | ||
650 | addf (str, _("\t\tQ:\n")); | ||
651 | hexdump (str, q.data, q.size, "\t\t\t"); | ||
652 | addf (str, _("\t\tG:\n")); | ||
653 | hexdump (str, g.data, g.size, "\t\t\t"); | ||
654 | } | ||
655 | } | ||
656 | break; | ||
657 | |||
658 | default: | ||
659 | break; | ||
660 | } | ||
661 | } | ||
662 | } | ||
663 | |||
664 | /* Extensions. */ | ||
665 | if (gnutls_x509_crt_get_version (cert) >= 3) | ||
666 | { | ||
667 | size_t i; | ||
668 | int err = 0; | ||
669 | |||
670 | for (i = 0;; i++) | ||
671 | { | ||
672 | char oid[128] = ""; | ||
673 | size_t sizeof_oid = sizeof (oid); | ||
674 | int critical; | ||
675 | size_t san_idx = 0; | ||
676 | size_t proxy_idx = 0; | ||
677 | size_t basic_idx = 0; | ||
678 | size_t keyusage_idx = 0; | ||
679 | size_t keypurpose_idx = 0; | ||
680 | size_t ski_idx = 0; | ||
681 | size_t aki_idx = 0; | ||
682 | size_t crldist_idx = 0; | ||
683 | |||
684 | err = gnutls_x509_crt_get_extension_info (cert, i, | ||
685 | oid, &sizeof_oid, | ||
686 | &critical); | ||
687 | if (err < 0) | ||
688 | { | ||
689 | if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) | ||
690 | break; | ||
691 | addf (str, "error: get_extension_info: %s\n", | ||
692 | gnutls_strerror (err)); | ||
693 | continue; | ||
694 | } | ||
695 | |||
696 | if (i == 0) | ||
697 | addf (str, _("\tExtensions:\n")); | ||
698 | |||
699 | if (strcmp (oid, "2.5.29.19") == 0) | ||
700 | { | ||
701 | if (basic_idx) | ||
702 | { | ||
703 | addf (str, "error: more than one basic constraint\n"); | ||
704 | continue; | ||
705 | } | ||
706 | |||
707 | addf (str, _("\t\tBasic Constraints (%s):\n"), | ||
708 | critical ? _("critical") : _("not critical")); | ||
709 | |||
710 | print_basic (str, cert); | ||
711 | |||
712 | basic_idx++; | ||
713 | } | ||
714 | else if (strcmp (oid, "2.5.29.14") == 0) | ||
715 | { | ||
716 | if (ski_idx) | ||
717 | { | ||
718 | addf (str, "error: more than one SKI extension\n"); | ||
719 | continue; | ||
720 | } | ||
721 | |||
722 | addf (str, _("\t\tSubject Key Identifier (%s):\n"), | ||
723 | critical ? _("critical") : _("not critical")); | ||
724 | |||
725 | print_ski (str, cert); | ||
726 | |||
727 | ski_idx++; | ||
728 | } | ||
729 | else if (strcmp (oid, "2.5.29.35") == 0) | ||
730 | { | ||
731 | if (aki_idx) | ||
732 | { | ||
733 | addf (str, "error: more than one AKI extension\n"); | ||
734 | continue; | ||
735 | } | ||
736 | |||
737 | addf (str, _("\t\tAuthority Key Identifier (%s):\n"), | ||
738 | critical ? _("critical") : _("not critical")); | ||
739 | |||
740 | print_aki (str, cert); | ||
741 | |||
742 | aki_idx++; | ||
743 | } | ||
744 | else if (strcmp (oid, "2.5.29.15") == 0) | ||
745 | { | ||
746 | if (keyusage_idx) | ||
747 | { | ||
748 | addf (str, "error: more than one key usage extension\n"); | ||
749 | continue; | ||
750 | } | ||
751 | |||
752 | addf (str, _("\t\tKey Usage (%s):\n"), | ||
753 | critical ? _("critical") : _("not critical")); | ||
754 | |||
755 | print_key_usage (str, cert); | ||
756 | |||
757 | keyusage_idx++; | ||
758 | } | ||
759 | else if (strcmp (oid, "2.5.29.37") == 0) | ||
760 | { | ||
761 | if (keypurpose_idx) | ||
762 | { | ||
763 | addf (str, "error: more than one key purpose extension\n"); | ||
764 | continue; | ||
765 | } | ||
766 | |||
767 | addf (str, _("\t\tKey Purpose (%s):\n"), | ||
768 | critical ? _("critical") : _("not critical")); | ||
769 | |||
770 | print_key_purpose (str, cert); | ||
771 | |||
772 | keypurpose_idx++; | ||
773 | } | ||
774 | else if (strcmp (oid, "2.5.29.17") == 0) | ||
775 | { | ||
776 | if (san_idx) | ||
777 | { | ||
778 | addf (str, "error: more than one SKI extension\n"); | ||
779 | continue; | ||
780 | } | ||
781 | |||
782 | addf (str, _("\t\tSubject Alternative Name (%s):\n"), | ||
783 | critical ? _("critical") : _("not critical")); | ||
784 | |||
785 | print_san (str, cert); | ||
786 | |||
787 | san_idx++; | ||
788 | } | ||
789 | else if (strcmp (oid, "2.5.29.31") == 0) | ||
790 | { | ||
791 | if (crldist_idx) | ||
792 | { | ||
793 | addf (str, "error: more than one CRL distribution point\n"); | ||
794 | continue; | ||
795 | } | ||
796 | |||
797 | addf (str, _("\t\tCRL Distribution points (%s):\n"), | ||
798 | critical ? _("critical") : _("not critical")); | ||
799 | |||
800 | print_crldist (str, cert); | ||
801 | |||
802 | crldist_idx++; | ||
803 | } | ||
804 | else if (strcmp (oid, "1.3.6.1.5.5.7.1.14") == 0) | ||
805 | { | ||
806 | if (proxy_idx) | ||
807 | { | ||
808 | addf (str, "error: more than one proxy extension\n"); | ||
809 | continue; | ||
810 | } | ||
811 | |||
812 | addf (str, _("\t\tProxy Certificate Information (%s):\n"), | ||
813 | critical ? _("critical") : _("not critical")); | ||
814 | |||
815 | print_proxy (str, cert); | ||
816 | |||
817 | proxy_idx++; | ||
818 | } | ||
819 | else | ||
820 | { | ||
821 | char *buffer; | ||
822 | size_t extlen = 0; | ||
823 | |||
824 | addf (str, _("\t\tUnknown extension %s (%s):\n"), oid, | ||
825 | critical ? _("critical") : _("not critical")); | ||
826 | |||
827 | err = gnutls_x509_crt_get_extension_data (cert, i, | ||
828 | NULL, &extlen); | ||
829 | if (err < 0) | ||
830 | { | ||
831 | addf (str, "error: get_extension_data: %s\n", | ||
832 | gnutls_strerror (err)); | ||
833 | continue; | ||
834 | } | ||
835 | |||
836 | buffer = gnutls_malloc (extlen); | ||
837 | if (!buffer) | ||
838 | { | ||
839 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
840 | continue; | ||
841 | } | ||
842 | |||
843 | err = gnutls_x509_crt_get_extension_data (cert, i, | ||
844 | buffer, &extlen); | ||
845 | if (err < 0) | ||
846 | { | ||
847 | gnutls_free (buffer); | ||
848 | addf (str, "error: get_extension_data2: %s\n", | ||
849 | gnutls_strerror (err)); | ||
850 | continue; | ||
851 | } | ||
852 | |||
853 | addf (str, _("\t\t\tASCII: ")); | ||
854 | asciiprint (str, buffer, extlen); | ||
855 | addf (str, "\n"); | ||
856 | |||
857 | addf (str, _("\t\t\tHexdump: ")); | ||
858 | hexprint (str, buffer, extlen); | ||
859 | adds (str, "\n"); | ||
860 | |||
861 | gnutls_free (buffer); | ||
862 | } | ||
863 | } | ||
864 | } | ||
865 | |||
866 | /* Signature. */ | ||
867 | if (!notsigned) | ||
868 | { | ||
869 | int err; | ||
870 | size_t size = 0; | ||
871 | char *buffer = NULL; | ||
872 | |||
873 | err = gnutls_x509_crt_get_signature_algorithm (cert); | ||
874 | if (err < 0) | ||
875 | addf (str, "error: get_signature_algorithm: %s\n", | ||
876 | gnutls_strerror (err)); | ||
877 | else | ||
878 | { | ||
879 | const char *name = gnutls_sign_algorithm_get_name (err); | ||
880 | if (name == NULL) | ||
881 | name = "Unknown"; | ||
882 | addf (str, _("\tSignature Algorithm: %s\n"), name); | ||
883 | } | ||
884 | if (err == GNUTLS_SIGN_RSA_MD5 || err == GNUTLS_SIGN_RSA_MD2) | ||
885 | { | ||
886 | addf (str, | ||
887 | _ | ||
888 | ("warning: signed using a broken signature algorithm that can be forged.\n")); | ||
889 | } | ||
890 | |||
891 | err = gnutls_x509_crt_get_signature (cert, buffer, &size); | ||
892 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
893 | { | ||
894 | addf (str, "error: get_signature: %s\n", gnutls_strerror (err)); | ||
895 | return; | ||
896 | } | ||
897 | |||
898 | buffer = gnutls_malloc (size); | ||
899 | if (!buffer) | ||
900 | { | ||
901 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
902 | return; | ||
903 | } | ||
904 | |||
905 | err = gnutls_x509_crt_get_signature (cert, buffer, &size); | ||
906 | if (err < 0) | ||
907 | { | ||
908 | gnutls_free (buffer); | ||
909 | addf (str, "error: get_signature2: %s\n", gnutls_strerror (err)); | ||
910 | return; | ||
911 | } | ||
912 | |||
913 | addf (str, _("\tSignature:\n")); | ||
914 | hexdump (str, buffer, size, "\t\t"); | ||
915 | |||
916 | gnutls_free (buffer); | ||
917 | } | ||
918 | } | ||
919 | |||
920 | static void | ||
921 | print_fingerprint (gnutls_string * str, gnutls_x509_crt_t cert, | ||
922 | gnutls_digest_algorithm_t algo) | ||
923 | { | ||
924 | int err; | ||
925 | char buffer[MAX_HASH_SIZE]; | ||
926 | size_t size = sizeof (buffer); | ||
927 | |||
928 | err = gnutls_x509_crt_get_fingerprint (cert, algo, buffer, &size); | ||
929 | if (err < 0) | ||
930 | { | ||
931 | addf (str, "error: get_fingerprint: %s\n", gnutls_strerror (err)); | ||
932 | return; | ||
933 | } | ||
934 | |||
935 | if (algo == MHD_GNUTLS_DIG_MD5) | ||
936 | addf (str, _("\tMD5 fingerprint:\n\t\t")); | ||
937 | else | ||
938 | addf (str, _("\tSHA-1 fingerprint:\n\t\t")); | ||
939 | hexprint (str, buffer, size); | ||
940 | adds (str, "\n"); | ||
941 | } | ||
942 | |||
943 | static void | ||
944 | print_keyid (gnutls_string * str, gnutls_x509_crt_t cert) | ||
945 | { | ||
946 | int err; | ||
947 | size_t size = 0; | ||
948 | char *buffer = NULL; | ||
949 | |||
950 | err = gnutls_x509_crt_get_key_id (cert, 0, buffer, &size); | ||
951 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
952 | { | ||
953 | addf (str, "error: get_key_id: %s\n", gnutls_strerror (err)); | ||
954 | return; | ||
955 | } | ||
956 | |||
957 | buffer = gnutls_malloc (size); | ||
958 | if (!buffer) | ||
959 | { | ||
960 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
961 | return; | ||
962 | } | ||
963 | |||
964 | err = gnutls_x509_crt_get_key_id (cert, 0, buffer, &size); | ||
965 | if (err < 0) | ||
966 | { | ||
967 | gnutls_free (buffer); | ||
968 | addf (str, "error: get_key_id2: %s\n", gnutls_strerror (err)); | ||
969 | return; | ||
970 | } | ||
971 | |||
972 | addf (str, _("\tPublic Key Id:\n\t\t")); | ||
973 | hexprint (str, buffer, size); | ||
974 | adds (str, "\n"); | ||
975 | |||
976 | gnutls_free (buffer); | ||
977 | } | ||
978 | |||
979 | static void | ||
980 | print_other (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned) | ||
981 | { | ||
982 | if (!notsigned) | ||
983 | { | ||
984 | print_fingerprint (str, cert, MHD_GNUTLS_DIG_MD5); | ||
985 | print_fingerprint (str, cert, MHD_GNUTLS_DIG_SHA1); | ||
986 | } | ||
987 | print_keyid (str, cert); | ||
988 | } | ||
989 | |||
990 | static void | ||
991 | print_oneline (gnutls_string * str, gnutls_x509_crt_t cert) | ||
992 | { | ||
993 | |||
994 | /* Subject. */ | ||
995 | { | ||
996 | char dn[1024]; | ||
997 | size_t dn_size = sizeof (dn); | ||
998 | int err; | ||
999 | |||
1000 | err = gnutls_x509_crt_get_dn (cert, dn, &dn_size); | ||
1001 | if (err < 0) | ||
1002 | addf (str, "unknown subject (%s), ", gnutls_strerror (err)); | ||
1003 | else | ||
1004 | addf (str, "subject `%s', ", dn); | ||
1005 | } | ||
1006 | |||
1007 | /* Issuer. */ | ||
1008 | { | ||
1009 | char dn[1024]; | ||
1010 | size_t dn_size = sizeof (dn); | ||
1011 | int err; | ||
1012 | |||
1013 | err = gnutls_x509_crt_get_issuer_dn (cert, dn, &dn_size); | ||
1014 | if (err < 0) | ||
1015 | addf (str, "unknown issuer (%s), ", gnutls_strerror (err)); | ||
1016 | else | ||
1017 | addf (str, "issuer `%s', ", dn); | ||
1018 | } | ||
1019 | |||
1020 | { | ||
1021 | int bits; | ||
1022 | const char *name = gnutls_pk_algorithm_get_name | ||
1023 | (gnutls_x509_crt_get_pk_algorithm (cert, &bits)); | ||
1024 | if (name == NULL) | ||
1025 | name = "Unknown"; | ||
1026 | addf (str, "%s key %d bits, ", name, bits); | ||
1027 | } | ||
1028 | |||
1029 | /* Validity. */ | ||
1030 | { | ||
1031 | time_t tim; | ||
1032 | |||
1033 | tim = gnutls_x509_crt_get_activation_time (cert); | ||
1034 | { | ||
1035 | char s[42]; | ||
1036 | size_t max = sizeof (s); | ||
1037 | struct tm t; | ||
1038 | |||
1039 | if (gmtime_r (&tim, &t) == NULL) | ||
1040 | addf (str, "unknown activation (%d), ", t); | ||
1041 | else if (strftime (s, max, "%Y-%m-%d %H:%M:%S UTC", &t) == 0) | ||
1042 | addf (str, "failed activation (%d), ", t); | ||
1043 | else | ||
1044 | addf (str, "activated `%s', ", s); | ||
1045 | } | ||
1046 | |||
1047 | tim = gnutls_x509_crt_get_expiration_time (cert); | ||
1048 | { | ||
1049 | char s[42]; | ||
1050 | size_t max = sizeof (s); | ||
1051 | struct tm t; | ||
1052 | |||
1053 | if (gmtime_r (&tim, &t) == NULL) | ||
1054 | addf (str, "unknown expiry (%d), ", t); | ||
1055 | else if (strftime (s, max, "%Y-%m-%d %H:%M:%S UTC", &t) == 0) | ||
1056 | addf (str, "failed expiry (%d), ", t); | ||
1057 | else | ||
1058 | addf (str, "expires `%s', ", s); | ||
1059 | } | ||
1060 | } | ||
1061 | |||
1062 | { | ||
1063 | int pathlen; | ||
1064 | char *policyLanguage; | ||
1065 | int err; | ||
1066 | |||
1067 | err = gnutls_x509_crt_get_proxy (cert, NULL, | ||
1068 | &pathlen, &policyLanguage, NULL, NULL); | ||
1069 | if (err == 0) | ||
1070 | { | ||
1071 | addf (str, "proxy certificate (policy="); | ||
1072 | if (strcmp (policyLanguage, "1.3.6.1.5.5.7.21.1") == 0) | ||
1073 | addf (str, "id-ppl-inheritALL"); | ||
1074 | else if (strcmp (policyLanguage, "1.3.6.1.5.5.7.21.2") == 0) | ||
1075 | addf (str, "id-ppl-independent"); | ||
1076 | else | ||
1077 | addf (str, "%s", policyLanguage); | ||
1078 | if (pathlen >= 0) | ||
1079 | addf (str, ", pathlen=%d), ", pathlen); | ||
1080 | else | ||
1081 | addf (str, "), "); | ||
1082 | gnutls_free (policyLanguage); | ||
1083 | } | ||
1084 | } | ||
1085 | |||
1086 | { | ||
1087 | char buffer[20]; | ||
1088 | size_t size = sizeof (buffer); | ||
1089 | int err; | ||
1090 | |||
1091 | err = gnutls_x509_crt_get_fingerprint (cert, MHD_GNUTLS_DIG_SHA1, | ||
1092 | buffer, &size); | ||
1093 | if (err < 0) | ||
1094 | { | ||
1095 | addf (str, "unknown fingerprint (%s)", gnutls_strerror (err)); | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | addf (str, "SHA-1 fingerprint `"); | ||
1100 | hexprint (str, buffer, size); | ||
1101 | adds (str, "'"); | ||
1102 | } | ||
1103 | } | ||
1104 | |||
1105 | } | ||
1106 | |||
1107 | /** | ||
1108 | * gnutls_x509_crt_print - Pretty print X.509 certificates | ||
1109 | * @cert: The structure to be printed | ||
1110 | * @format: Indicate the format to use | ||
1111 | * @out: Newly allocated datum with zero terminated string. | ||
1112 | * | ||
1113 | * This function will pretty print a X.509 certificate, suitable for | ||
1114 | * display to a human. | ||
1115 | * | ||
1116 | * If the format is %GNUTLS_X509_CRT_FULL then all fields of the | ||
1117 | * certificate will be output, on multiple lines. The | ||
1118 | * %GNUTLS_X509_CRT_ONELINE format will generate one line with some | ||
1119 | * selected fields, which is useful for logging purposes. | ||
1120 | * | ||
1121 | * The output @out needs to be deallocate using gnutls_free(). | ||
1122 | * | ||
1123 | * Returns 0 on success. | ||
1124 | **/ | ||
1125 | int | ||
1126 | gnutls_x509_crt_print (gnutls_x509_crt_t cert, | ||
1127 | gnutls_certificate_print_formats_t format, | ||
1128 | gnutls_datum_t * out) | ||
1129 | { | ||
1130 | gnutls_string str; | ||
1131 | |||
1132 | if (format == GNUTLS_X509_CRT_FULL | ||
1133 | || format == GNUTLS_X509_CRT_UNSIGNED_FULL) | ||
1134 | { | ||
1135 | _gnutls_string_init (&str, gnutls_malloc, gnutls_realloc, gnutls_free); | ||
1136 | |||
1137 | _gnutls_string_append_str (&str, _("X.509 Certificate Information:\n")); | ||
1138 | |||
1139 | print_cert (&str, cert, format == GNUTLS_X509_CRT_UNSIGNED_FULL); | ||
1140 | |||
1141 | _gnutls_string_append_str (&str, _("Other Information:\n")); | ||
1142 | |||
1143 | print_other (&str, cert, format == GNUTLS_X509_CRT_UNSIGNED_FULL); | ||
1144 | |||
1145 | _gnutls_string_append_data (&str, "\0", 1); | ||
1146 | out->data = str.data; | ||
1147 | out->size = strlen (str.data); | ||
1148 | } | ||
1149 | else if (format == GNUTLS_X509_CRT_ONELINE) | ||
1150 | { | ||
1151 | _gnutls_string_init (&str, gnutls_malloc, gnutls_realloc, gnutls_free); | ||
1152 | |||
1153 | print_oneline (&str, cert); | ||
1154 | |||
1155 | _gnutls_string_append_data (&str, "\0", 1); | ||
1156 | out->data = str.data; | ||
1157 | out->size = strlen (str.data); | ||
1158 | } | ||
1159 | else | ||
1160 | { | ||
1161 | gnutls_assert (); | ||
1162 | return GNUTLS_E_INVALID_REQUEST; | ||
1163 | } | ||
1164 | |||
1165 | return 0; | ||
1166 | } | ||
1167 | |||
1168 | static void | ||
1169 | print_crl (gnutls_string * str, gnutls_x509_crl_t crl, int notsigned) | ||
1170 | { | ||
1171 | /* Version. */ | ||
1172 | { | ||
1173 | int version = gnutls_x509_crl_get_version (crl); | ||
1174 | if (version == GNUTLS_E_ASN1_ELEMENT_NOT_FOUND) | ||
1175 | addf (str, _("\tVersion: 1 (default)\n")); | ||
1176 | else if (version < 0) | ||
1177 | addf (str, "error: get_version: %s\n", gnutls_strerror (version)); | ||
1178 | else | ||
1179 | addf (str, _("\tVersion: %d\n"), version); | ||
1180 | } | ||
1181 | |||
1182 | /* Issuer. */ | ||
1183 | if (!notsigned) | ||
1184 | { | ||
1185 | char dn[1024]; | ||
1186 | size_t dn_size = sizeof (dn); | ||
1187 | int err; | ||
1188 | |||
1189 | err = gnutls_x509_crl_get_issuer_dn (crl, dn, &dn_size); | ||
1190 | if (err < 0) | ||
1191 | addf (str, "error: get_issuer_dn: %s\n", gnutls_strerror (err)); | ||
1192 | else | ||
1193 | addf (str, _("\tIssuer: %s\n"), dn); | ||
1194 | } | ||
1195 | |||
1196 | /* Validity. */ | ||
1197 | { | ||
1198 | time_t tim; | ||
1199 | |||
1200 | addf (str, _("\tUpdate dates:\n")); | ||
1201 | |||
1202 | tim = gnutls_x509_crl_get_this_update (crl); | ||
1203 | { | ||
1204 | char s[42]; | ||
1205 | size_t max = sizeof (s); | ||
1206 | struct tm t; | ||
1207 | |||
1208 | if (gmtime_r (&tim, &t) == NULL) | ||
1209 | addf (str, "error: gmtime_r (%d)\n", t); | ||
1210 | else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0) | ||
1211 | addf (str, "error: strftime (%d)\n", t); | ||
1212 | else | ||
1213 | addf (str, _("\t\tIssued: %s\n"), s); | ||
1214 | } | ||
1215 | |||
1216 | tim = gnutls_x509_crl_get_next_update (crl); | ||
1217 | { | ||
1218 | char s[42]; | ||
1219 | size_t max = sizeof (s); | ||
1220 | struct tm t; | ||
1221 | |||
1222 | if (tim == -1) | ||
1223 | addf (str, "\t\tNo next update time.\n"); | ||
1224 | else if (gmtime_r (&tim, &t) == NULL) | ||
1225 | addf (str, "error: gmtime_r (%d)\n", t); | ||
1226 | else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0) | ||
1227 | addf (str, "error: strftime (%d)\n", t); | ||
1228 | else | ||
1229 | addf (str, _("\t\tNext at: %s\n"), s); | ||
1230 | } | ||
1231 | } | ||
1232 | |||
1233 | /* Revoked certificates. */ | ||
1234 | { | ||
1235 | int num = gnutls_x509_crl_get_crt_count (crl); | ||
1236 | int j; | ||
1237 | |||
1238 | if (num) | ||
1239 | addf (str, _("\tRevoked certificates (%d):\n"), num); | ||
1240 | else | ||
1241 | addf (str, _("\tNo revoked certificates.\n")); | ||
1242 | |||
1243 | for (j = 0; j < num; j++) | ||
1244 | { | ||
1245 | char serial[128]; | ||
1246 | size_t serial_size = sizeof (serial); | ||
1247 | int err; | ||
1248 | time_t tim; | ||
1249 | |||
1250 | err = gnutls_x509_crl_get_crt_serial (crl, j, serial, | ||
1251 | &serial_size, &tim); | ||
1252 | if (err < 0) | ||
1253 | addf (str, "error: get_crt_serial: %s\n", gnutls_strerror (err)); | ||
1254 | else | ||
1255 | { | ||
1256 | char s[42]; | ||
1257 | size_t max = sizeof (s); | ||
1258 | struct tm t; | ||
1259 | |||
1260 | addf (str, _("\t\tSerial Number (hex): ")); | ||
1261 | hexprint (str, serial, serial_size); | ||
1262 | adds (str, "\n"); | ||
1263 | |||
1264 | if (gmtime_r (&tim, &t) == NULL) | ||
1265 | addf (str, "error: gmtime_r (%d)\n", t); | ||
1266 | else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0) | ||
1267 | addf (str, "error: strftime (%d)\n", t); | ||
1268 | else | ||
1269 | addf (str, _("\t\tRevoked at: %s\n"), s); | ||
1270 | } | ||
1271 | } | ||
1272 | } | ||
1273 | |||
1274 | /* Signature. */ | ||
1275 | if (!notsigned) | ||
1276 | { | ||
1277 | int err; | ||
1278 | size_t size = 0; | ||
1279 | char *buffer = NULL; | ||
1280 | |||
1281 | err = gnutls_x509_crl_get_signature_algorithm (crl); | ||
1282 | if (err < 0) | ||
1283 | addf (str, "error: get_signature_algorithm: %s\n", | ||
1284 | gnutls_strerror (err)); | ||
1285 | else | ||
1286 | { | ||
1287 | const char *name = gnutls_sign_algorithm_get_name (err); | ||
1288 | if (name == NULL) | ||
1289 | name = "Unknown"; | ||
1290 | addf (str, _("\tSignature Algorithm: %s\n"), name); | ||
1291 | } | ||
1292 | if (err == GNUTLS_SIGN_RSA_MD5 || err == GNUTLS_SIGN_RSA_MD2) | ||
1293 | { | ||
1294 | addf (str, | ||
1295 | _ | ||
1296 | ("warning: signed using a broken signature algorithm that can be forged.\n")); | ||
1297 | } | ||
1298 | |||
1299 | err = gnutls_x509_crl_get_signature (crl, buffer, &size); | ||
1300 | if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) | ||
1301 | { | ||
1302 | addf (str, "error: get_signature: %s\n", gnutls_strerror (err)); | ||
1303 | return; | ||
1304 | } | ||
1305 | |||
1306 | buffer = gnutls_malloc (size); | ||
1307 | if (!buffer) | ||
1308 | { | ||
1309 | addf (str, "error: malloc: %s\n", gnutls_strerror (err)); | ||
1310 | return; | ||
1311 | } | ||
1312 | |||
1313 | err = gnutls_x509_crl_get_signature (crl, buffer, &size); | ||
1314 | if (err < 0) | ||
1315 | { | ||
1316 | gnutls_free (buffer); | ||
1317 | addf (str, "error: get_signature2: %s\n", gnutls_strerror (err)); | ||
1318 | return; | ||
1319 | } | ||
1320 | |||
1321 | addf (str, _("\tSignature:\n")); | ||
1322 | hexdump (str, buffer, size, "\t\t"); | ||
1323 | |||
1324 | gnutls_free (buffer); | ||
1325 | } | ||
1326 | } | ||
1327 | |||
1328 | /** | ||
1329 | * gnutls_x509_crl_print - Pretty print X.509 certificate revocation list | ||
1330 | * @crl: The structure to be printed | ||
1331 | * @format: Indicate the format to use | ||
1332 | * @out: Newly allocated datum with zero terminated string. | ||
1333 | * | ||
1334 | * This function will pretty print a X.509 certificate revocation | ||
1335 | * list, suitable for display to a human. | ||
1336 | * | ||
1337 | * The output @out needs to be deallocate using gnutls_free(). | ||
1338 | * | ||
1339 | * Returns 0 on success. | ||
1340 | **/ | ||
1341 | int | ||
1342 | gnutls_x509_crl_print (gnutls_x509_crl_t crl, | ||
1343 | gnutls_certificate_print_formats_t format, | ||
1344 | gnutls_datum_t * out) | ||
1345 | { | ||
1346 | gnutls_string str; | ||
1347 | |||
1348 | _gnutls_string_init (&str, gnutls_malloc, gnutls_realloc, gnutls_free); | ||
1349 | |||
1350 | _gnutls_string_append_str | ||
1351 | (&str, _("X.509 Certificate Revocation List Information:\n")); | ||
1352 | |||
1353 | print_crl (&str, crl, format == GNUTLS_X509_CRT_UNSIGNED_FULL); | ||
1354 | |||
1355 | _gnutls_string_append_data (&str, "\0", 1); | ||
1356 | out->data = str.data; | ||
1357 | out->size = strlen (str.data); | ||
1358 | |||
1359 | return 0; | ||
1360 | } | ||
diff --git a/src/daemon/https/x509/pkcs12.c b/src/daemon/https/x509/pkcs12.c index abd647b0..df4a2d99 100644 --- a/src/daemon/https/x509/pkcs12.c +++ b/src/daemon/https/x509/pkcs12.c | |||
@@ -161,7 +161,7 @@ gnutls_pkcs12_init (gnutls_pkcs12_t * pkcs12) | |||
161 | * gnutls_pkcs12_deinit - This function deinitializes memory used by a gnutls_pkcs12_t structure | 161 | * gnutls_pkcs12_deinit - This function deinitializes memory used by a gnutls_pkcs12_t structure |
162 | * @pkcs12: The structure to be initialized | 162 | * @pkcs12: The structure to be initialized |
163 | * | 163 | * |
164 | * This function will deinitialize a PKCS12 structure. | 164 | * This function will deinitialize a PKCS12 structure. |
165 | * | 165 | * |
166 | **/ | 166 | **/ |
167 | void | 167 | void |
@@ -338,7 +338,7 @@ ucs2_to_ascii (char *data, int size) | |||
338 | } | 338 | } |
339 | 339 | ||
340 | /* Decodes the SafeContents, and puts the output in | 340 | /* Decodes the SafeContents, and puts the output in |
341 | * the given bag. | 341 | * the given bag. |
342 | */ | 342 | */ |
343 | int | 343 | int |
344 | _pkcs12_decode_safe_contents (const gnutls_datum_t * content, | 344 | _pkcs12_decode_safe_contents (const gnutls_datum_t * content, |
@@ -760,7 +760,7 @@ gnutls_pkcs12_set_bag (gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag) | |||
760 | return result; | 760 | return result; |
761 | } | 761 | } |
762 | 762 | ||
763 | /* Step 3. Encode the bag elements into a SafeContents | 763 | /* Step 3. Encode the bag elements into a SafeContents |
764 | * structure. | 764 | * structure. |
765 | */ | 765 | */ |
766 | result = _pkcs12_encode_safe_contents (bag, &safe_cont, &enc); | 766 | result = _pkcs12_encode_safe_contents (bag, &safe_cont, &enc); |
@@ -924,7 +924,7 @@ gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass) | |||
924 | 924 | ||
925 | /* MAC the data | 925 | /* MAC the data |
926 | */ | 926 | */ |
927 | td1 = _gnutls_hmac_init (MHD_GNUTLS_MAC_SHA1, key, sizeof (key)); | 927 | td1 = mhd_gtls_hmac_init (MHD_GNUTLS_MAC_SHA1, key, sizeof (key)); |
928 | if (td1 == GNUTLS_MAC_FAILED) | 928 | if (td1 == GNUTLS_MAC_FAILED) |
929 | { | 929 | { |
930 | gnutls_assert (); | 930 | gnutls_assert (); |
@@ -932,10 +932,10 @@ gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass) | |||
932 | goto cleanup; | 932 | goto cleanup; |
933 | } | 933 | } |
934 | 934 | ||
935 | _gnutls_hmac (td1, tmp.data, tmp.size); | 935 | mhd_gnutls_hash (td1, tmp.data, tmp.size); |
936 | _gnutls_free_datum (&tmp); | 936 | _gnutls_free_datum (&tmp); |
937 | 937 | ||
938 | _gnutls_hmac_deinit (td1, sha_mac); | 938 | mhd_gnutls_hmac_deinit (td1, sha_mac); |
939 | 939 | ||
940 | 940 | ||
941 | result = | 941 | result = |
@@ -1050,7 +1050,7 @@ gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass) | |||
1050 | 1050 | ||
1051 | /* MAC the data | 1051 | /* MAC the data |
1052 | */ | 1052 | */ |
1053 | td1 = _gnutls_hmac_init (MHD_GNUTLS_MAC_SHA1, key, sizeof (key)); | 1053 | td1 = mhd_gtls_hmac_init (MHD_GNUTLS_MAC_SHA1, key, sizeof (key)); |
1054 | if (td1 == GNUTLS_MAC_FAILED) | 1054 | if (td1 == GNUTLS_MAC_FAILED) |
1055 | { | 1055 | { |
1056 | gnutls_assert (); | 1056 | gnutls_assert (); |
@@ -1058,10 +1058,10 @@ gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass) | |||
1058 | goto cleanup; | 1058 | goto cleanup; |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | _gnutls_hmac (td1, tmp.data, tmp.size); | 1061 | mhd_gnutls_hash (td1, tmp.data, tmp.size); |
1062 | _gnutls_free_datum (&tmp); | 1062 | _gnutls_free_datum (&tmp); |
1063 | 1063 | ||
1064 | _gnutls_hmac_deinit (td1, sha_mac); | 1064 | mhd_gnutls_hmac_deinit (td1, sha_mac); |
1065 | 1065 | ||
1066 | len = sizeof (sha_mac_orig); | 1066 | len = sizeof (sha_mac_orig); |
1067 | result = | 1067 | result = |
@@ -1126,8 +1126,8 @@ write_attributes (gnutls_pkcs12_bag_t bag, int elem, | |||
1126 | return _gnutls_asn2err (result); | 1126 | return _gnutls_asn2err (result); |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | _gnutls_str_cpy (root, sizeof (root), where); | 1129 | mhd_gtls_str_cpy (root, sizeof (root), where); |
1130 | _gnutls_str_cat (root, sizeof (root), ".?LAST"); | 1130 | mhd_gtls_str_cat (root, sizeof (root), ".?LAST"); |
1131 | 1131 | ||
1132 | result = | 1132 | result = |
1133 | _gnutls_x509_encode_and_write_attribute (KEY_ID_OID, c2, root, | 1133 | _gnutls_x509_encode_and_write_attribute (KEY_ID_OID, c2, root, |
@@ -1176,8 +1176,8 @@ write_attributes (gnutls_pkcs12_bag_t bag, int elem, | |||
1176 | p++; | 1176 | p++; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | _gnutls_str_cpy (root, sizeof (root), where); | 1179 | mhd_gtls_str_cpy (root, sizeof (root), where); |
1180 | _gnutls_str_cat (root, sizeof (root), ".?LAST"); | 1180 | mhd_gtls_str_cat (root, sizeof (root), ".?LAST"); |
1181 | 1181 | ||
1182 | result = | 1182 | result = |
1183 | _gnutls_x509_encode_and_write_attribute (FRIENDLY_NAME_OID, c2, | 1183 | _gnutls_x509_encode_and_write_attribute (FRIENDLY_NAME_OID, c2, |
diff --git a/src/daemon/https/x509/pkcs12_encr.c b/src/daemon/https/x509/pkcs12_encr.c index c80d23a3..25a33641 100644 --- a/src/daemon/https/x509/pkcs12_encr.c +++ b/src/daemon/https/x509/pkcs12_encr.c | |||
@@ -134,7 +134,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque * salt, | |||
134 | for (i = 0; i < 64; i++) | 134 | for (i = 0; i < 64; i++) |
135 | buf_b[i] = hash[i % 20]; | 135 | buf_b[i] = hash[i % 20]; |
136 | n = 64; | 136 | n = 64; |
137 | rc = _gnutls_mpi_scan (&num_b1, buf_b, &n); | 137 | rc = mhd_gtls_mpi_scan (&num_b1, buf_b, &n); |
138 | if (rc < 0) | 138 | if (rc < 0) |
139 | { | 139 | { |
140 | gnutls_assert (); | 140 | gnutls_assert (); |
@@ -146,7 +146,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque * salt, | |||
146 | mpi_t num_ij; | 146 | mpi_t num_ij; |
147 | 147 | ||
148 | n = 64; | 148 | n = 64; |
149 | rc = _gnutls_mpi_scan (&num_ij, buf_i + i, &n); | 149 | rc = mhd_gtls_mpi_scan (&num_ij, buf_i + i, &n); |
150 | if (rc < 0) | 150 | if (rc < 0) |
151 | { | 151 | { |
152 | gnutls_assert (); | 152 | gnutls_assert (); |
@@ -155,7 +155,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque * salt, | |||
155 | gcry_mpi_add (num_ij, num_ij, num_b1); | 155 | gcry_mpi_add (num_ij, num_ij, num_b1); |
156 | gcry_mpi_clear_highbit (num_ij, 64 * 8); | 156 | gcry_mpi_clear_highbit (num_ij, 64 * 8); |
157 | n = 64; | 157 | n = 64; |
158 | rc = _gnutls_mpi_print (buf_i + i, &n, num_ij); | 158 | rc = mhd_gtls_mpi_print (buf_i + i, &n, num_ij); |
159 | if (rc < 0) | 159 | if (rc < 0) |
160 | { | 160 | { |
161 | gnutls_assert (); | 161 | gnutls_assert (); |
diff --git a/src/daemon/https/x509/privkey_pkcs8.c b/src/daemon/https/x509/privkey_pkcs8.c index c0ce6a5c..3b33720c 100644 --- a/src/daemon/https/x509/privkey_pkcs8.c +++ b/src/daemon/https/x509/privkey_pkcs8.c | |||
@@ -1424,7 +1424,7 @@ decrypt_data (schema_id schema, ASN1_TYPE pkcs8_asn, | |||
1424 | 1424 | ||
1425 | if (kdf_params->key_size == 0) | 1425 | if (kdf_params->key_size == 0) |
1426 | { | 1426 | { |
1427 | key_size = gnutls_cipher_get_key_size (enc_params->cipher); | 1427 | key_size = MHD_gnutls_cipher_get_key_size (enc_params->cipher); |
1428 | } | 1428 | } |
1429 | else | 1429 | else |
1430 | key_size = kdf_params->key_size; | 1430 | key_size = kdf_params->key_size; |
@@ -1474,7 +1474,7 @@ decrypt_data (schema_id schema, ASN1_TYPE pkcs8_asn, | |||
1474 | 1474 | ||
1475 | d_iv.data = (opaque *) enc_params->iv; | 1475 | d_iv.data = (opaque *) enc_params->iv; |
1476 | d_iv.size = enc_params->iv_size; | 1476 | d_iv.size = enc_params->iv_size; |
1477 | ch = _gnutls_cipher_init (enc_params->cipher, &dkey, &d_iv); | 1477 | ch = mhd_gtls_cipher_init (enc_params->cipher, &dkey, &d_iv); |
1478 | 1478 | ||
1479 | gnutls_afree (key); | 1479 | gnutls_afree (key); |
1480 | key = NULL; | 1480 | key = NULL; |
@@ -1486,7 +1486,7 @@ decrypt_data (schema_id schema, ASN1_TYPE pkcs8_asn, | |||
1486 | goto error; | 1486 | goto error; |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | result = _gnutls_cipher_decrypt (ch, data, data_size); | 1489 | result = mhd_gtls_cipher_decrypt (ch, data, data_size); |
1490 | if (result < 0) | 1490 | if (result < 0) |
1491 | { | 1491 | { |
1492 | gnutls_assert (); | 1492 | gnutls_assert (); |
@@ -1495,12 +1495,12 @@ decrypt_data (schema_id schema, ASN1_TYPE pkcs8_asn, | |||
1495 | 1495 | ||
1496 | decrypted_data->data = data; | 1496 | decrypted_data->data = data; |
1497 | 1497 | ||
1498 | if (_gnutls_cipher_get_block_size (enc_params->cipher) != 1) | 1498 | if (mhd_gtls_cipher_get_block_size (enc_params->cipher) != 1) |
1499 | decrypted_data->size = data_size - data[data_size - 1]; | 1499 | decrypted_data->size = data_size - data[data_size - 1]; |
1500 | else | 1500 | else |
1501 | decrypted_data->size = data_size; | 1501 | decrypted_data->size = data_size; |
1502 | 1502 | ||
1503 | _gnutls_cipher_deinit (ch); | 1503 | mhd_gnutls_cipher_deinit (ch); |
1504 | 1504 | ||
1505 | return 0; | 1505 | return 0; |
1506 | 1506 | ||
@@ -1508,7 +1508,7 @@ error: | |||
1508 | gnutls_free (data); | 1508 | gnutls_free (data); |
1509 | gnutls_afree (key); | 1509 | gnutls_afree (key); |
1510 | if (ch != NULL) | 1510 | if (ch != NULL) |
1511 | _gnutls_cipher_deinit (ch); | 1511 | mhd_gnutls_cipher_deinit (ch); |
1512 | return result; | 1512 | return result; |
1513 | } | 1513 | } |
1514 | 1514 | ||
@@ -1568,7 +1568,7 @@ write_pbkdf2_params (ASN1_TYPE pbes2_asn, | |||
1568 | 1568 | ||
1569 | /* write the iteration count | 1569 | /* write the iteration count |
1570 | */ | 1570 | */ |
1571 | _gnutls_write_uint32 (kdf_params->iter_count, tmp); | 1571 | mhd_gtls_write_uint32 (kdf_params->iter_count, tmp); |
1572 | 1572 | ||
1573 | result = asn1_write_value (pbkdf2_asn, "iterationCount", tmp, 4); | 1573 | result = asn1_write_value (pbkdf2_asn, "iterationCount", tmp, 4); |
1574 | if (result != ASN1_SUCCESS) | 1574 | if (result != ASN1_SUCCESS) |
@@ -1727,9 +1727,9 @@ generate_key (schema_id schema, | |||
1727 | 1727 | ||
1728 | kdf_params->iter_count = 256 + rnd[0]; | 1728 | kdf_params->iter_count = 256 + rnd[0]; |
1729 | key->size = kdf_params->key_size = | 1729 | key->size = kdf_params->key_size = |
1730 | gnutls_cipher_get_key_size (enc_params->cipher); | 1730 | MHD_gnutls_cipher_get_key_size (enc_params->cipher); |
1731 | 1731 | ||
1732 | enc_params->iv_size = _gnutls_cipher_get_iv_size (enc_params->cipher); | 1732 | enc_params->iv_size = mhd_gtls_cipher_get_iv_size (enc_params->cipher); |
1733 | 1733 | ||
1734 | key->data = gnutls_secure_malloc (key->size); | 1734 | key->data = gnutls_secure_malloc (key->size); |
1735 | if (key->data == NULL) | 1735 | if (key->data == NULL) |
@@ -1893,7 +1893,7 @@ encrypt_data (const gnutls_datum_t * plain, | |||
1893 | cipher_hd_t ch = NULL; | 1893 | cipher_hd_t ch = NULL; |
1894 | opaque pad, pad_size; | 1894 | opaque pad, pad_size; |
1895 | 1895 | ||
1896 | pad_size = _gnutls_cipher_get_block_size (enc_params->cipher); | 1896 | pad_size = mhd_gtls_cipher_get_block_size (enc_params->cipher); |
1897 | 1897 | ||
1898 | if (pad_size == 1) /* stream */ | 1898 | if (pad_size == 1) /* stream */ |
1899 | pad_size = 0; | 1899 | pad_size = 0; |
@@ -1921,7 +1921,7 @@ encrypt_data (const gnutls_datum_t * plain, | |||
1921 | 1921 | ||
1922 | d_iv.data = (opaque *) enc_params->iv; | 1922 | d_iv.data = (opaque *) enc_params->iv; |
1923 | d_iv.size = enc_params->iv_size; | 1923 | d_iv.size = enc_params->iv_size; |
1924 | ch = _gnutls_cipher_init (enc_params->cipher, key, &d_iv); | 1924 | ch = mhd_gtls_cipher_init (enc_params->cipher, key, &d_iv); |
1925 | 1925 | ||
1926 | if (ch == GNUTLS_CIPHER_FAILED) | 1926 | if (ch == GNUTLS_CIPHER_FAILED) |
1927 | { | 1927 | { |
@@ -1930,7 +1930,7 @@ encrypt_data (const gnutls_datum_t * plain, | |||
1930 | goto error; | 1930 | goto error; |
1931 | } | 1931 | } |
1932 | 1932 | ||
1933 | result = _gnutls_cipher_encrypt (ch, data, data_size); | 1933 | result = mhd_gtls_cipher_encrypt (ch, data, data_size); |
1934 | if (result < 0) | 1934 | if (result < 0) |
1935 | { | 1935 | { |
1936 | gnutls_assert (); | 1936 | gnutls_assert (); |
@@ -1940,14 +1940,14 @@ encrypt_data (const gnutls_datum_t * plain, | |||
1940 | encrypted->data = data; | 1940 | encrypted->data = data; |
1941 | encrypted->size = data_size; | 1941 | encrypted->size = data_size; |
1942 | 1942 | ||
1943 | _gnutls_cipher_deinit (ch); | 1943 | mhd_gnutls_cipher_deinit (ch); |
1944 | 1944 | ||
1945 | return 0; | 1945 | return 0; |
1946 | 1946 | ||
1947 | error: | 1947 | error: |
1948 | gnutls_free (data); | 1948 | gnutls_free (data); |
1949 | if (ch != NULL) | 1949 | if (ch != NULL) |
1950 | _gnutls_cipher_deinit (ch); | 1950 | mhd_gnutls_cipher_deinit (ch); |
1951 | return result; | 1951 | return result; |
1952 | } | 1952 | } |
1953 | 1953 | ||
diff --git a/src/daemon/https/x509/sign.c b/src/daemon/https/x509/sign.c index 7b21825e..c316cf8a 100644 --- a/src/daemon/https/x509/sign.c +++ b/src/daemon/https/x509/sign.c | |||
@@ -56,7 +56,7 @@ encode_ber_digest_info (gnutls_digest_algorithm_t hash, | |||
56 | int result; | 56 | int result; |
57 | const char *algo; | 57 | const char *algo; |
58 | 58 | ||
59 | algo = _gnutls_x509_mac_to_oid ((gnutls_mac_algorithm_t) hash); | 59 | algo = mhd_gtls_x509_mac_to_oid ((gnutls_mac_algorithm_t) hash); |
60 | if (algo == NULL) | 60 | if (algo == NULL) |
61 | { | 61 | { |
62 | gnutls_assert (); | 62 | gnutls_assert (); |
@@ -140,18 +140,18 @@ pkcs1_rsa_sign (gnutls_digest_algorithm_t hash, const gnutls_datum_t * text, | |||
140 | GNUTLS_HASH_HANDLE hd; | 140 | GNUTLS_HASH_HANDLE hd; |
141 | gnutls_datum_t digest, info; | 141 | gnutls_datum_t digest, info; |
142 | 142 | ||
143 | hd = _gnutls_hash_init (HASH2MAC (hash)); | 143 | hd = mhd_gtls_hash_init (HASH2MAC (hash)); |
144 | if (hd == NULL) | 144 | if (hd == NULL) |
145 | { | 145 | { |
146 | gnutls_assert (); | 146 | gnutls_assert (); |
147 | return GNUTLS_E_HASH_FAILED; | 147 | return GNUTLS_E_HASH_FAILED; |
148 | } | 148 | } |
149 | 149 | ||
150 | _gnutls_hash (hd, text->data, text->size); | 150 | mhd_gnutls_hash (hd, text->data, text->size); |
151 | _gnutls_hash_deinit (hd, _digest); | 151 | mhd_gnutls_hash_deinit (hd, _digest); |
152 | 152 | ||
153 | digest.data = _digest; | 153 | digest.data = _digest; |
154 | digest.size = _gnutls_hash_get_algo_len (HASH2MAC (hash)); | 154 | digest.size = mhd_gnutls_hash_get_algo_len (HASH2MAC (hash)); |
155 | 155 | ||
156 | /* Encode the digest as a DigestInfo | 156 | /* Encode the digest as a DigestInfo |
157 | */ | 157 | */ |
@@ -162,7 +162,7 @@ pkcs1_rsa_sign (gnutls_digest_algorithm_t hash, const gnutls_datum_t * text, | |||
162 | } | 162 | } |
163 | 163 | ||
164 | if ((ret = | 164 | if ((ret = |
165 | _gnutls_sign (MHD_GNUTLS_PK_RSA, params, params_len, &info, | 165 | mhd_gtls_sign (MHD_GNUTLS_PK_RSA, params, params_len, &info, |
166 | signature)) < 0) | 166 | signature)) < 0) |
167 | { | 167 | { |
168 | gnutls_assert (); | 168 | gnutls_assert (); |
@@ -278,8 +278,8 @@ _gnutls_x509_pkix_sign (ASN1_TYPE src, const char *src_name, | |||
278 | 278 | ||
279 | /* Step 1. Copy the issuer's name into the certificate. | 279 | /* Step 1. Copy the issuer's name into the certificate. |
280 | */ | 280 | */ |
281 | _gnutls_str_cpy (name, sizeof (name), src_name); | 281 | mhd_gtls_str_cpy (name, sizeof (name), src_name); |
282 | _gnutls_str_cat (name, sizeof (name), ".issuer"); | 282 | mhd_gtls_str_cat (name, sizeof (name), ".issuer"); |
283 | 283 | ||
284 | result = asn1_copy_node (src, name, issuer->cert, "tbsCertificate.subject"); | 284 | result = asn1_copy_node (src, name, issuer->cert, "tbsCertificate.subject"); |
285 | if (result != ASN1_SUCCESS) | 285 | if (result != ASN1_SUCCESS) |
@@ -290,8 +290,8 @@ _gnutls_x509_pkix_sign (ASN1_TYPE src, const char *src_name, | |||
290 | 290 | ||
291 | /* Step 1.5. Write the signature stuff in the tbsCertificate. | 291 | /* Step 1.5. Write the signature stuff in the tbsCertificate. |
292 | */ | 292 | */ |
293 | _gnutls_str_cpy (name, sizeof (name), src_name); | 293 | mhd_gtls_str_cpy (name, sizeof (name), src_name); |
294 | _gnutls_str_cat (name, sizeof (name), ".signature"); | 294 | mhd_gtls_str_cat (name, sizeof (name), ".signature"); |
295 | 295 | ||
296 | result = _gnutls_x509_write_sig_params (src, name, | 296 | result = _gnutls_x509_write_sig_params (src, name, |
297 | issuer_key->pk_algorithm, dig, | 297 | issuer_key->pk_algorithm, dig, |
diff --git a/src/daemon/https/x509/x509.c b/src/daemon/https/x509/x509.c index 90696168..4b3f04ba 100644 --- a/src/daemon/https/x509/x509.c +++ b/src/daemon/https/x509/x509.c | |||
@@ -487,7 +487,7 @@ gnutls_x509_crt_get_signature_algorithm (gnutls_x509_crt_t cert) | |||
487 | return result; | 487 | return result; |
488 | } | 488 | } |
489 | 489 | ||
490 | result = _gnutls_x509_oid2sign_algorithm (sa.data); | 490 | result = mhd_gtls_x509_oid2sign_algorithm (sa.data); |
491 | 491 | ||
492 | _gnutls_free_datum (&sa); | 492 | _gnutls_free_datum (&sa); |
493 | 493 | ||
@@ -950,9 +950,9 @@ parse_general_name (ASN1_TYPE src, | |||
950 | if (type == GNUTLS_SAN_OTHERNAME) | 950 | if (type == GNUTLS_SAN_OTHERNAME) |
951 | { | 951 | { |
952 | if (othername_oid) | 952 | if (othername_oid) |
953 | _gnutls_str_cat (nptr, sizeof (nptr), ".otherName.type-id"); | 953 | mhd_gtls_str_cat (nptr, sizeof (nptr), ".otherName.type-id"); |
954 | else | 954 | else |
955 | _gnutls_str_cat (nptr, sizeof (nptr), ".otherName.value"); | 955 | mhd_gtls_str_cat (nptr, sizeof (nptr), ".otherName.value"); |
956 | 956 | ||
957 | len = *name_size; | 957 | len = *name_size; |
958 | result = asn1_read_value (src, nptr, name, &len); | 958 | result = asn1_read_value (src, nptr, name, &len); |
@@ -1025,7 +1025,7 @@ parse_general_name (ASN1_TYPE src, | |||
1025 | } | 1025 | } |
1026 | else if (type == GNUTLS_SAN_DN) | 1026 | else if (type == GNUTLS_SAN_DN) |
1027 | { | 1027 | { |
1028 | _gnutls_str_cat (nptr, sizeof (nptr), ".directoryName"); | 1028 | mhd_gtls_str_cat (nptr, sizeof (nptr), ".directoryName"); |
1029 | result = _gnutls_x509_parse_dn (src, nptr, name, name_size); | 1029 | result = _gnutls_x509_parse_dn (src, nptr, name, name_size); |
1030 | if (result < 0) | 1030 | if (result < 0) |
1031 | { | 1031 | { |
@@ -1039,8 +1039,8 @@ parse_general_name (ASN1_TYPE src, | |||
1039 | { | 1039 | { |
1040 | size_t orig_name_size = *name_size; | 1040 | size_t orig_name_size = *name_size; |
1041 | 1041 | ||
1042 | _gnutls_str_cat (nptr, sizeof (nptr), "."); | 1042 | mhd_gtls_str_cat (nptr, sizeof (nptr), "."); |
1043 | _gnutls_str_cat (nptr, sizeof (nptr), choice_type); | 1043 | mhd_gtls_str_cat (nptr, sizeof (nptr), choice_type); |
1044 | 1044 | ||
1045 | len = *name_size; | 1045 | len = *name_size; |
1046 | result = asn1_read_value (src, nptr, name, &len); | 1046 | result = asn1_read_value (src, nptr, name, &len); |
@@ -1980,7 +1980,7 @@ gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert, | |||
1980 | tmp.data = cert_buf; | 1980 | tmp.data = cert_buf; |
1981 | tmp.size = cert_buf_size; | 1981 | tmp.size = cert_buf_size; |
1982 | 1982 | ||
1983 | result = gnutls_fingerprint (algo, &tmp, buf, sizeof_buf); | 1983 | result = MHD_gnutls_fingerprint (algo, &tmp, buf, sizeof_buf); |
1984 | gnutls_afree (cert_buf); | 1984 | gnutls_afree (cert_buf); |
1985 | 1985 | ||
1986 | return result; | 1986 | return result; |
@@ -2053,7 +2053,7 @@ rsadsa_get_key_id (gnutls_x509_crt_t crt, | |||
2053 | else | 2053 | else |
2054 | return GNUTLS_E_INTERNAL_ERROR; | 2054 | return GNUTLS_E_INTERNAL_ERROR; |
2055 | 2055 | ||
2056 | hd = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 2056 | hd = mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
2057 | if (hd == GNUTLS_HASH_FAILED) | 2057 | if (hd == GNUTLS_HASH_FAILED) |
2058 | { | 2058 | { |
2059 | gnutls_assert (); | 2059 | gnutls_assert (); |
@@ -2061,9 +2061,9 @@ rsadsa_get_key_id (gnutls_x509_crt_t crt, | |||
2061 | goto cleanup; | 2061 | goto cleanup; |
2062 | } | 2062 | } |
2063 | 2063 | ||
2064 | _gnutls_hash (hd, der.data, der.size); | 2064 | mhd_gnutls_hash (hd, der.data, der.size); |
2065 | 2065 | ||
2066 | _gnutls_hash_deinit (hd, output_data); | 2066 | mhd_gnutls_hash_deinit (hd, output_data); |
2067 | *output_data_size = 20; | 2067 | *output_data_size = 20; |
2068 | 2068 | ||
2069 | result = 0; | 2069 | result = 0; |
@@ -2076,7 +2076,7 @@ cleanup: | |||
2076 | */ | 2076 | */ |
2077 | for (i = 0; i < params_size; i++) | 2077 | for (i = 0; i < params_size; i++) |
2078 | { | 2078 | { |
2079 | _gnutls_mpi_release (¶ms[i]); | 2079 | mhd_gtls_mpi_release (¶ms[i]); |
2080 | } | 2080 | } |
2081 | return result; | 2081 | return result; |
2082 | } | 2082 | } |
@@ -2165,7 +2165,7 @@ gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt, | |||
2165 | return _gnutls_asn2err (result); | 2165 | return _gnutls_asn2err (result); |
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | result = gnutls_fingerprint (MHD_GNUTLS_DIG_SHA1, &pubkey, output_data, | 2168 | result = MHD_gnutls_fingerprint (MHD_GNUTLS_DIG_SHA1, &pubkey, output_data, |
2169 | output_data_size); | 2169 | output_data_size); |
2170 | 2170 | ||
2171 | gnutls_afree (pubkey.data); | 2171 | gnutls_afree (pubkey.data); |
@@ -2420,7 +2420,7 @@ gnutls_x509_crt_get_crl_dist_points (gnutls_x509_crt_t cert, | |||
2420 | /* Return the different names from the first CRLDistr. point. | 2420 | /* Return the different names from the first CRLDistr. point. |
2421 | * The whole thing is a mess. | 2421 | * The whole thing is a mess. |
2422 | */ | 2422 | */ |
2423 | _gnutls_str_cpy (name, sizeof (name), "?1.distributionPoint.fullName"); | 2423 | mhd_gtls_str_cpy (name, sizeof (name), "?1.distributionPoint.fullName"); |
2424 | 2424 | ||
2425 | result = parse_general_name (c2, name, seq, ret, ret_size, NULL, 0); | 2425 | result = parse_general_name (c2, name, seq, ret, ret_size, NULL, 0); |
2426 | if (result < 0) | 2426 | if (result < 0) |
@@ -2435,7 +2435,7 @@ gnutls_x509_crt_get_crl_dist_points (gnutls_x509_crt_t cert, | |||
2435 | */ | 2435 | */ |
2436 | if (reason_flags) | 2436 | if (reason_flags) |
2437 | { | 2437 | { |
2438 | _gnutls_str_cpy (name, sizeof (name), "?1.reasons"); | 2438 | mhd_gtls_str_cpy (name, sizeof (name), "?1.reasons"); |
2439 | 2439 | ||
2440 | reasons[0] = reasons[1] = 0; | 2440 | reasons[0] = reasons[1] = 0; |
2441 | 2441 | ||
@@ -2594,14 +2594,14 @@ gnutls_x509_crt_get_pk_rsa_raw (gnutls_x509_crt_t crt, | |||
2594 | return ret; | 2594 | return ret; |
2595 | } | 2595 | } |
2596 | 2596 | ||
2597 | ret = _gnutls_mpi_dprint (m, params[0]); | 2597 | ret = mhd_gtls_mpi_dprint (m, params[0]); |
2598 | if (ret < 0) | 2598 | if (ret < 0) |
2599 | { | 2599 | { |
2600 | gnutls_assert (); | 2600 | gnutls_assert (); |
2601 | goto cleanup; | 2601 | goto cleanup; |
2602 | } | 2602 | } |
2603 | 2603 | ||
2604 | ret = _gnutls_mpi_dprint (e, params[1]); | 2604 | ret = mhd_gtls_mpi_dprint (e, params[1]); |
2605 | if (ret < 0) | 2605 | if (ret < 0) |
2606 | { | 2606 | { |
2607 | gnutls_assert (); | 2607 | gnutls_assert (); |
@@ -2613,7 +2613,7 @@ gnutls_x509_crt_get_pk_rsa_raw (gnutls_x509_crt_t crt, | |||
2613 | 2613 | ||
2614 | cleanup:for (i = 0; i < params_size; i++) | 2614 | cleanup:for (i = 0; i < params_size; i++) |
2615 | { | 2615 | { |
2616 | _gnutls_mpi_release (¶ms[i]); | 2616 | mhd_gtls_mpi_release (¶ms[i]); |
2617 | } | 2617 | } |
2618 | return ret; | 2618 | return ret; |
2619 | } | 2619 | } |
@@ -2659,7 +2659,7 @@ gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, | |||
2659 | } | 2659 | } |
2660 | 2660 | ||
2661 | /* P */ | 2661 | /* P */ |
2662 | ret = _gnutls_mpi_dprint (p, params[0]); | 2662 | ret = mhd_gtls_mpi_dprint (p, params[0]); |
2663 | if (ret < 0) | 2663 | if (ret < 0) |
2664 | { | 2664 | { |
2665 | gnutls_assert (); | 2665 | gnutls_assert (); |
@@ -2667,7 +2667,7 @@ gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, | |||
2667 | } | 2667 | } |
2668 | 2668 | ||
2669 | /* Q */ | 2669 | /* Q */ |
2670 | ret = _gnutls_mpi_dprint (q, params[1]); | 2670 | ret = mhd_gtls_mpi_dprint (q, params[1]); |
2671 | if (ret < 0) | 2671 | if (ret < 0) |
2672 | { | 2672 | { |
2673 | gnutls_assert (); | 2673 | gnutls_assert (); |
@@ -2676,7 +2676,7 @@ gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, | |||
2676 | } | 2676 | } |
2677 | 2677 | ||
2678 | /* G */ | 2678 | /* G */ |
2679 | ret = _gnutls_mpi_dprint (g, params[2]); | 2679 | ret = mhd_gtls_mpi_dprint (g, params[2]); |
2680 | if (ret < 0) | 2680 | if (ret < 0) |
2681 | { | 2681 | { |
2682 | gnutls_assert (); | 2682 | gnutls_assert (); |
@@ -2686,7 +2686,7 @@ gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, | |||
2686 | } | 2686 | } |
2687 | 2687 | ||
2688 | /* Y */ | 2688 | /* Y */ |
2689 | ret = _gnutls_mpi_dprint (y, params[3]); | 2689 | ret = mhd_gtls_mpi_dprint (y, params[3]); |
2690 | if (ret < 0) | 2690 | if (ret < 0) |
2691 | { | 2691 | { |
2692 | gnutls_assert (); | 2692 | gnutls_assert (); |
@@ -2700,7 +2700,7 @@ gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, | |||
2700 | 2700 | ||
2701 | cleanup:for (i = 0; i < params_size; i++) | 2701 | cleanup:for (i = 0; i < params_size; i++) |
2702 | { | 2702 | { |
2703 | _gnutls_mpi_release (¶ms[i]); | 2703 | mhd_gtls_mpi_release (¶ms[i]); |
2704 | } | 2704 | } |
2705 | return ret; | 2705 | return ret; |
2706 | 2706 | ||
diff --git a/src/daemon/https/x509/x509.h b/src/daemon/https/x509/x509.h index eaf2c31c..b333b5d0 100644 --- a/src/daemon/https/x509/x509.h +++ b/src/daemon/https/x509/x509.h | |||
@@ -778,7 +778,7 @@ typedef struct gnutls_x509_crt_int | |||
778 | # error INCREASE MAX_PRIV_PARAMS | 778 | # error INCREASE MAX_PRIV_PARAMS |
779 | #endif | 779 | #endif |
780 | 780 | ||
781 | typedef struct gnutls_x509_privkey_int | 781 | typedef struct MHD_gtls_x509_privkey_int |
782 | { | 782 | { |
783 | mpi_t params[MAX_PRIV_PARAMS_SIZE]; /* the size of params depends on the public | 783 | mpi_t params[MAX_PRIV_PARAMS_SIZE]; /* the size of params depends on the public |
784 | * key algorithm | 784 | * key algorithm |
diff --git a/src/daemon/https/x509/x509_privkey.c b/src/daemon/https/x509/x509_privkey.c index 596aedc0..2a690adb 100644 --- a/src/daemon/https/x509/x509_privkey.c +++ b/src/daemon/https/x509/x509_privkey.c | |||
@@ -88,7 +88,7 @@ gnutls_x509_privkey_deinit (gnutls_x509_privkey_t key) | |||
88 | 88 | ||
89 | for (i = 0; i < key->params_size; i++) | 89 | for (i = 0; i < key->params_size; i++) |
90 | { | 90 | { |
91 | _gnutls_mpi_release (&key->params[i]); | 91 | mhd_gtls_mpi_release (&key->params[i]); |
92 | } | 92 | } |
93 | 93 | ||
94 | asn1_delete_structure (&key->key); | 94 | asn1_delete_structure (&key->key); |
@@ -238,12 +238,12 @@ _gnutls_privkey_decode_pkcs1_rsa_key (const gnutls_datum_t * raw_key, | |||
238 | return pkey_asn; | 238 | return pkey_asn; |
239 | 239 | ||
240 | error:asn1_delete_structure (&pkey_asn); | 240 | error:asn1_delete_structure (&pkey_asn); |
241 | _gnutls_mpi_release (&pkey->params[0]); | 241 | mhd_gtls_mpi_release (&pkey->params[0]); |
242 | _gnutls_mpi_release (&pkey->params[1]); | 242 | mhd_gtls_mpi_release (&pkey->params[1]); |
243 | _gnutls_mpi_release (&pkey->params[2]); | 243 | mhd_gtls_mpi_release (&pkey->params[2]); |
244 | _gnutls_mpi_release (&pkey->params[3]); | 244 | mhd_gtls_mpi_release (&pkey->params[3]); |
245 | _gnutls_mpi_release (&pkey->params[4]); | 245 | mhd_gtls_mpi_release (&pkey->params[4]); |
246 | _gnutls_mpi_release (&pkey->params[5]); | 246 | mhd_gtls_mpi_release (&pkey->params[5]); |
247 | return NULL; | 247 | return NULL; |
248 | 248 | ||
249 | } | 249 | } |
@@ -311,11 +311,11 @@ decode_dsa_key (const gnutls_datum_t * raw_key, gnutls_x509_privkey_t pkey) | |||
311 | return dsa_asn; | 311 | return dsa_asn; |
312 | 312 | ||
313 | error:asn1_delete_structure (&dsa_asn); | 313 | error:asn1_delete_structure (&dsa_asn); |
314 | _gnutls_mpi_release (&pkey->params[0]); | 314 | mhd_gtls_mpi_release (&pkey->params[0]); |
315 | _gnutls_mpi_release (&pkey->params[1]); | 315 | mhd_gtls_mpi_release (&pkey->params[1]); |
316 | _gnutls_mpi_release (&pkey->params[2]); | 316 | mhd_gtls_mpi_release (&pkey->params[2]); |
317 | _gnutls_mpi_release (&pkey->params[3]); | 317 | mhd_gtls_mpi_release (&pkey->params[3]); |
318 | _gnutls_mpi_release (&pkey->params[4]); | 318 | mhd_gtls_mpi_release (&pkey->params[4]); |
319 | return NULL; | 319 | return NULL; |
320 | 320 | ||
321 | } | 321 | } |
@@ -430,9 +430,9 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key, | |||
430 | } | 430 | } |
431 | 431 | ||
432 | #define FREE_RSA_PRIVATE_PARAMS for (i=0;i<RSA_PRIVATE_PARAMS;i++) \ | 432 | #define FREE_RSA_PRIVATE_PARAMS for (i=0;i<RSA_PRIVATE_PARAMS;i++) \ |
433 | _gnutls_mpi_release(&key->params[i]) | 433 | mhd_gtls_mpi_release(&key->params[i]) |
434 | #define FREE_DSA_PRIVATE_PARAMS for (i=0;i<DSA_PRIVATE_PARAMS;i++) \ | 434 | #define FREE_DSA_PRIVATE_PARAMS for (i=0;i<DSA_PRIVATE_PARAMS;i++) \ |
435 | _gnutls_mpi_release(&key->params[i]) | 435 | mhd_gtls_mpi_release(&key->params[i]) |
436 | 436 | ||
437 | /** | 437 | /** |
438 | * gnutls_x509_privkey_import_rsa_raw - This function will import a raw RSA key | 438 | * gnutls_x509_privkey_import_rsa_raw - This function will import a raw RSA key |
@@ -467,7 +467,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, | |||
467 | } | 467 | } |
468 | 468 | ||
469 | siz = m->size; | 469 | siz = m->size; |
470 | if (_gnutls_mpi_scan_nz (&key->params[0], m->data, &siz)) | 470 | if (mhd_gtls_mpi_scan_nz (&key->params[0], m->data, &siz)) |
471 | { | 471 | { |
472 | gnutls_assert (); | 472 | gnutls_assert (); |
473 | FREE_RSA_PRIVATE_PARAMS; | 473 | FREE_RSA_PRIVATE_PARAMS; |
@@ -475,7 +475,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, | |||
475 | } | 475 | } |
476 | 476 | ||
477 | siz = e->size; | 477 | siz = e->size; |
478 | if (_gnutls_mpi_scan_nz (&key->params[1], e->data, &siz)) | 478 | if (mhd_gtls_mpi_scan_nz (&key->params[1], e->data, &siz)) |
479 | { | 479 | { |
480 | gnutls_assert (); | 480 | gnutls_assert (); |
481 | FREE_RSA_PRIVATE_PARAMS; | 481 | FREE_RSA_PRIVATE_PARAMS; |
@@ -483,7 +483,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, | |||
483 | } | 483 | } |
484 | 484 | ||
485 | siz = d->size; | 485 | siz = d->size; |
486 | if (_gnutls_mpi_scan_nz (&key->params[2], d->data, &siz)) | 486 | if (mhd_gtls_mpi_scan_nz (&key->params[2], d->data, &siz)) |
487 | { | 487 | { |
488 | gnutls_assert (); | 488 | gnutls_assert (); |
489 | FREE_RSA_PRIVATE_PARAMS; | 489 | FREE_RSA_PRIVATE_PARAMS; |
@@ -491,7 +491,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, | |||
491 | } | 491 | } |
492 | 492 | ||
493 | siz = p->size; | 493 | siz = p->size; |
494 | if (_gnutls_mpi_scan_nz (&key->params[3], p->data, &siz)) | 494 | if (mhd_gtls_mpi_scan_nz (&key->params[3], p->data, &siz)) |
495 | { | 495 | { |
496 | gnutls_assert (); | 496 | gnutls_assert (); |
497 | FREE_RSA_PRIVATE_PARAMS; | 497 | FREE_RSA_PRIVATE_PARAMS; |
@@ -499,7 +499,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, | |||
499 | } | 499 | } |
500 | 500 | ||
501 | siz = q->size; | 501 | siz = q->size; |
502 | if (_gnutls_mpi_scan_nz (&key->params[4], q->data, &siz)) | 502 | if (mhd_gtls_mpi_scan_nz (&key->params[4], q->data, &siz)) |
503 | { | 503 | { |
504 | gnutls_assert (); | 504 | gnutls_assert (); |
505 | FREE_RSA_PRIVATE_PARAMS; | 505 | FREE_RSA_PRIVATE_PARAMS; |
@@ -519,7 +519,7 @@ gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, | |||
519 | _gnutls_mpi_invm (key->params[5], key->params[3], key->params[4]); | 519 | _gnutls_mpi_invm (key->params[5], key->params[3], key->params[4]); |
520 | #else | 520 | #else |
521 | siz = u->size; | 521 | siz = u->size; |
522 | if (_gnutls_mpi_scan_nz (&key->params[5], u->data, &siz)) | 522 | if (mhd_gtls_mpi_scan_nz (&key->params[5], u->data, &siz)) |
523 | { | 523 | { |
524 | gnutls_assert (); | 524 | gnutls_assert (); |
525 | FREE_RSA_PRIVATE_PARAMS; | 525 | FREE_RSA_PRIVATE_PARAMS; |
@@ -668,7 +668,7 @@ gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, | |||
668 | m->data = e->data = d->data = p->data = q->data = u->data = NULL; | 668 | m->data = e->data = d->data = p->data = q->data = u->data = NULL; |
669 | m->size = e->size = d->size = p->size = q->size = u->size = 0; | 669 | m->size = e->size = d->size = p->size = q->size = u->size = 0; |
670 | 670 | ||
671 | ret = _gnutls_mpi_dprint (m, key->params[0]); | 671 | ret = mhd_gtls_mpi_dprint (m, key->params[0]); |
672 | if (ret < 0) | 672 | if (ret < 0) |
673 | { | 673 | { |
674 | gnutls_assert (); | 674 | gnutls_assert (); |
@@ -676,7 +676,7 @@ gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, | |||
676 | } | 676 | } |
677 | 677 | ||
678 | /* E */ | 678 | /* E */ |
679 | ret = _gnutls_mpi_dprint (e, key->params[1]); | 679 | ret = mhd_gtls_mpi_dprint (e, key->params[1]); |
680 | if (ret < 0) | 680 | if (ret < 0) |
681 | { | 681 | { |
682 | gnutls_assert (); | 682 | gnutls_assert (); |
@@ -684,7 +684,7 @@ gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, | |||
684 | } | 684 | } |
685 | 685 | ||
686 | /* D */ | 686 | /* D */ |
687 | ret = _gnutls_mpi_dprint (d, key->params[2]); | 687 | ret = mhd_gtls_mpi_dprint (d, key->params[2]); |
688 | if (ret < 0) | 688 | if (ret < 0) |
689 | { | 689 | { |
690 | gnutls_assert (); | 690 | gnutls_assert (); |
@@ -692,7 +692,7 @@ gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, | |||
692 | } | 692 | } |
693 | 693 | ||
694 | /* P */ | 694 | /* P */ |
695 | ret = _gnutls_mpi_dprint (p, key->params[3]); | 695 | ret = mhd_gtls_mpi_dprint (p, key->params[3]); |
696 | if (ret < 0) | 696 | if (ret < 0) |
697 | { | 697 | { |
698 | gnutls_assert (); | 698 | gnutls_assert (); |
@@ -700,7 +700,7 @@ gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, | |||
700 | } | 700 | } |
701 | 701 | ||
702 | /* Q */ | 702 | /* Q */ |
703 | ret = _gnutls_mpi_dprint (q, key->params[4]); | 703 | ret = mhd_gtls_mpi_dprint (q, key->params[4]); |
704 | if (ret < 0) | 704 | if (ret < 0) |
705 | { | 705 | { |
706 | gnutls_assert (); | 706 | gnutls_assert (); |
@@ -718,17 +718,17 @@ gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, | |||
718 | } | 718 | } |
719 | 719 | ||
720 | _gnutls_mpi_invm (coeff, key->params[4], key->params[3]); | 720 | _gnutls_mpi_invm (coeff, key->params[4], key->params[3]); |
721 | ret = _gnutls_mpi_dprint (u, coeff); | 721 | ret = mhd_gtls_mpi_dprint (u, coeff); |
722 | if (ret < 0) | 722 | if (ret < 0) |
723 | { | 723 | { |
724 | gnutls_assert (); | 724 | gnutls_assert (); |
725 | goto error; | 725 | goto error; |
726 | } | 726 | } |
727 | 727 | ||
728 | _gnutls_mpi_release (&coeff); | 728 | mhd_gtls_mpi_release (&coeff); |
729 | #else | 729 | #else |
730 | /* U */ | 730 | /* U */ |
731 | ret = _gnutls_mpi_dprint (u, key->params[5]); | 731 | ret = mhd_gtls_mpi_dprint (u, key->params[5]); |
732 | if (ret < 0) | 732 | if (ret < 0) |
733 | { | 733 | { |
734 | gnutls_assert (); | 734 | gnutls_assert (); |
@@ -743,7 +743,7 @@ error:_gnutls_free_datum (m); | |||
743 | _gnutls_free_datum (e); | 743 | _gnutls_free_datum (e); |
744 | _gnutls_free_datum (p); | 744 | _gnutls_free_datum (p); |
745 | _gnutls_free_datum (q); | 745 | _gnutls_free_datum (q); |
746 | _gnutls_mpi_release (&coeff); | 746 | mhd_gtls_mpi_release (&coeff); |
747 | 747 | ||
748 | return ret; | 748 | return ret; |
749 | } | 749 | } |
@@ -778,7 +778,7 @@ gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, | |||
778 | } | 778 | } |
779 | 779 | ||
780 | /* P */ | 780 | /* P */ |
781 | ret = _gnutls_mpi_dprint (p, key->params[0]); | 781 | ret = mhd_gtls_mpi_dprint (p, key->params[0]); |
782 | if (ret < 0) | 782 | if (ret < 0) |
783 | { | 783 | { |
784 | gnutls_assert (); | 784 | gnutls_assert (); |
@@ -786,7 +786,7 @@ gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, | |||
786 | } | 786 | } |
787 | 787 | ||
788 | /* Q */ | 788 | /* Q */ |
789 | ret = _gnutls_mpi_dprint (q, key->params[1]); | 789 | ret = mhd_gtls_mpi_dprint (q, key->params[1]); |
790 | if (ret < 0) | 790 | if (ret < 0) |
791 | { | 791 | { |
792 | gnutls_assert (); | 792 | gnutls_assert (); |
@@ -795,7 +795,7 @@ gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, | |||
795 | } | 795 | } |
796 | 796 | ||
797 | /* G */ | 797 | /* G */ |
798 | ret = _gnutls_mpi_dprint (g, key->params[2]); | 798 | ret = mhd_gtls_mpi_dprint (g, key->params[2]); |
799 | if (ret < 0) | 799 | if (ret < 0) |
800 | { | 800 | { |
801 | gnutls_assert (); | 801 | gnutls_assert (); |
@@ -805,7 +805,7 @@ gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, | |||
805 | } | 805 | } |
806 | 806 | ||
807 | /* Y */ | 807 | /* Y */ |
808 | ret = _gnutls_mpi_dprint (y, key->params[3]); | 808 | ret = mhd_gtls_mpi_dprint (y, key->params[3]); |
809 | if (ret < 0) | 809 | if (ret < 0) |
810 | { | 810 | { |
811 | gnutls_assert (); | 811 | gnutls_assert (); |
@@ -816,7 +816,7 @@ gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, | |||
816 | } | 816 | } |
817 | 817 | ||
818 | /* X */ | 818 | /* X */ |
819 | ret = _gnutls_mpi_dprint (x, key->params[4]); | 819 | ret = mhd_gtls_mpi_dprint (x, key->params[4]); |
820 | if (ret < 0) | 820 | if (ret < 0) |
821 | { | 821 | { |
822 | gnutls_assert (); | 822 | gnutls_assert (); |
@@ -847,7 +847,7 @@ _gnutls_asn1_encode_rsa (ASN1_TYPE * c2, mpi_t * params) | |||
847 | total = 0; | 847 | total = 0; |
848 | for (i = 0; i < 5; i++) | 848 | for (i = 0; i < 5; i++) |
849 | { | 849 | { |
850 | _gnutls_mpi_print_lz (NULL, &size[i], params[i]); | 850 | mhd_gtls_mpi_print_lz (NULL, &size[i], params[i]); |
851 | total += size[i]; | 851 | total += size[i]; |
852 | } | 852 | } |
853 | 853 | ||
@@ -895,7 +895,7 @@ _gnutls_asn1_encode_rsa (ASN1_TYPE * c2, mpi_t * params) | |||
895 | 895 | ||
896 | _gnutls_mpi_invm (u, params[4], params[3]); | 896 | _gnutls_mpi_invm (u, params[4], params[3]); |
897 | /* inverse of q mod p */ | 897 | /* inverse of q mod p */ |
898 | _gnutls_mpi_print_lz (NULL, &size[5], u); | 898 | mhd_gtls_mpi_print_lz (NULL, &size[5], u); |
899 | total += size[5]; | 899 | total += size[5]; |
900 | 900 | ||
901 | _gnutls_mpi_sub_ui (p1, params[3], 1); | 901 | _gnutls_mpi_sub_ui (p1, params[3], 1); |
@@ -905,10 +905,10 @@ _gnutls_asn1_encode_rsa (ASN1_TYPE * c2, mpi_t * params) | |||
905 | _gnutls_mpi_mod (exp2, params[2], q1); | 905 | _gnutls_mpi_mod (exp2, params[2], q1); |
906 | 906 | ||
907 | /* calculate exp's size */ | 907 | /* calculate exp's size */ |
908 | _gnutls_mpi_print_lz (NULL, &size[6], exp1); | 908 | mhd_gtls_mpi_print_lz (NULL, &size[6], exp1); |
909 | total += size[6]; | 909 | total += size[6]; |
910 | 910 | ||
911 | _gnutls_mpi_print_lz (NULL, &size[7], exp2); | 911 | mhd_gtls_mpi_print_lz (NULL, &size[7], exp2); |
912 | total += size[7]; | 912 | total += size[7]; |
913 | 913 | ||
914 | /* Encoding phase. | 914 | /* Encoding phase. |
@@ -939,14 +939,14 @@ _gnutls_asn1_encode_rsa (ASN1_TYPE * c2, mpi_t * params) | |||
939 | p += size[6]; | 939 | p += size[6]; |
940 | exp2_data = p; | 940 | exp2_data = p; |
941 | 941 | ||
942 | _gnutls_mpi_print_lz (m_data, &size[0], params[0]); | 942 | mhd_gtls_mpi_print_lz (m_data, &size[0], params[0]); |
943 | _gnutls_mpi_print_lz (pube_data, &size[1], params[1]); | 943 | mhd_gtls_mpi_print_lz (pube_data, &size[1], params[1]); |
944 | _gnutls_mpi_print_lz (prie_data, &size[2], params[2]); | 944 | mhd_gtls_mpi_print_lz (prie_data, &size[2], params[2]); |
945 | _gnutls_mpi_print_lz (p1_data, &size[3], params[3]); | 945 | mhd_gtls_mpi_print_lz (p1_data, &size[3], params[3]); |
946 | _gnutls_mpi_print_lz (p2_data, &size[4], params[4]); | 946 | mhd_gtls_mpi_print_lz (p2_data, &size[4], params[4]); |
947 | _gnutls_mpi_print_lz (u_data, &size[5], u); | 947 | mhd_gtls_mpi_print_lz (u_data, &size[5], u); |
948 | _gnutls_mpi_print_lz (exp1_data, &size[6], exp1); | 948 | mhd_gtls_mpi_print_lz (exp1_data, &size[6], exp1); |
949 | _gnutls_mpi_print_lz (exp2_data, &size[7], exp2); | 949 | mhd_gtls_mpi_print_lz (exp2_data, &size[7], exp2); |
950 | 950 | ||
951 | /* Ok. Now we have the data. Create the asn1 structures | 951 | /* Ok. Now we have the data. Create the asn1 structures |
952 | */ | 952 | */ |
@@ -1026,11 +1026,11 @@ _gnutls_asn1_encode_rsa (ASN1_TYPE * c2, mpi_t * params) | |||
1026 | goto cleanup; | 1026 | goto cleanup; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | _gnutls_mpi_release (&exp1); | 1029 | mhd_gtls_mpi_release (&exp1); |
1030 | _gnutls_mpi_release (&exp2); | 1030 | mhd_gtls_mpi_release (&exp2); |
1031 | _gnutls_mpi_release (&q1); | 1031 | mhd_gtls_mpi_release (&q1); |
1032 | _gnutls_mpi_release (&p1); | 1032 | mhd_gtls_mpi_release (&p1); |
1033 | _gnutls_mpi_release (&u); | 1033 | mhd_gtls_mpi_release (&u); |
1034 | gnutls_free (all_data); | 1034 | gnutls_free (all_data); |
1035 | 1035 | ||
1036 | if ((result = asn1_write_value (*c2, "otherPrimeInfos", | 1036 | if ((result = asn1_write_value (*c2, "otherPrimeInfos", |
@@ -1050,11 +1050,11 @@ _gnutls_asn1_encode_rsa (ASN1_TYPE * c2, mpi_t * params) | |||
1050 | 1050 | ||
1051 | return 0; | 1051 | return 0; |
1052 | 1052 | ||
1053 | cleanup:_gnutls_mpi_release (&u); | 1053 | cleanup:mhd_gtls_mpi_release (&u); |
1054 | _gnutls_mpi_release (&exp1); | 1054 | mhd_gtls_mpi_release (&exp1); |
1055 | _gnutls_mpi_release (&exp2); | 1055 | mhd_gtls_mpi_release (&exp2); |
1056 | _gnutls_mpi_release (&q1); | 1056 | mhd_gtls_mpi_release (&q1); |
1057 | _gnutls_mpi_release (&p1); | 1057 | mhd_gtls_mpi_release (&p1); |
1058 | asn1_delete_structure (c2); | 1058 | asn1_delete_structure (c2); |
1059 | gnutls_free (all_data); | 1059 | gnutls_free (all_data); |
1060 | 1060 | ||
@@ -1076,7 +1076,7 @@ _gnutls_asn1_encode_dsa (ASN1_TYPE * c2, mpi_t * params) | |||
1076 | total = 0; | 1076 | total = 0; |
1077 | for (i = 0; i < DSA_PRIVATE_PARAMS; i++) | 1077 | for (i = 0; i < DSA_PRIVATE_PARAMS; i++) |
1078 | { | 1078 | { |
1079 | _gnutls_mpi_print_lz (NULL, &size[i], params[i]); | 1079 | mhd_gtls_mpi_print_lz (NULL, &size[i], params[i]); |
1080 | total += size[i]; | 1080 | total += size[i]; |
1081 | } | 1081 | } |
1082 | 1082 | ||
@@ -1102,11 +1102,11 @@ _gnutls_asn1_encode_dsa (ASN1_TYPE * c2, mpi_t * params) | |||
1102 | p += size[3]; | 1102 | p += size[3]; |
1103 | x_data = p; | 1103 | x_data = p; |
1104 | 1104 | ||
1105 | _gnutls_mpi_print_lz (p_data, &size[0], params[0]); | 1105 | mhd_gtls_mpi_print_lz (p_data, &size[0], params[0]); |
1106 | _gnutls_mpi_print_lz (q_data, &size[1], params[1]); | 1106 | mhd_gtls_mpi_print_lz (q_data, &size[1], params[1]); |
1107 | _gnutls_mpi_print_lz (g_data, &size[2], params[2]); | 1107 | mhd_gtls_mpi_print_lz (g_data, &size[2], params[2]); |
1108 | _gnutls_mpi_print_lz (y_data, &size[3], params[3]); | 1108 | mhd_gtls_mpi_print_lz (y_data, &size[3], params[3]); |
1109 | _gnutls_mpi_print_lz (x_data, &size[4], params[4]); | 1109 | mhd_gtls_mpi_print_lz (x_data, &size[4], params[4]); |
1110 | 1110 | ||
1111 | /* Ok. Now we have the data. Create the asn1 structures | 1111 | /* Ok. Now we have the data. Create the asn1 structures |
1112 | */ | 1112 | */ |
@@ -1236,7 +1236,7 @@ gnutls_x509_privkey_generate (gnutls_x509_privkey_t key, | |||
1236 | cleanup:key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN; | 1236 | cleanup:key->pk_algorithm = MHD_GNUTLS_PK_UNKNOWN; |
1237 | key->params_size = 0; | 1237 | key->params_size = 0; |
1238 | for (i = 0; i < params_len; i++) | 1238 | for (i = 0; i < params_len; i++) |
1239 | _gnutls_mpi_release (&key->params[i]); | 1239 | mhd_gtls_mpi_release (&key->params[i]); |
1240 | 1240 | ||
1241 | return ret; | 1241 | return ret; |
1242 | } | 1242 | } |
@@ -1300,7 +1300,7 @@ gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key, | |||
1300 | else | 1300 | else |
1301 | return GNUTLS_E_INTERNAL_ERROR; | 1301 | return GNUTLS_E_INTERNAL_ERROR; |
1302 | 1302 | ||
1303 | hd = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 1303 | hd = mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
1304 | if (hd == GNUTLS_HASH_FAILED) | 1304 | if (hd == GNUTLS_HASH_FAILED) |
1305 | { | 1305 | { |
1306 | gnutls_assert (); | 1306 | gnutls_assert (); |
@@ -1308,9 +1308,9 @@ gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key, | |||
1308 | goto cleanup; | 1308 | goto cleanup; |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | _gnutls_hash (hd, der.data, der.size); | 1311 | mhd_gnutls_hash (hd, der.data, der.size); |
1312 | 1312 | ||
1313 | _gnutls_hash_deinit (hd, output_data); | 1313 | mhd_gnutls_hash_deinit (hd, output_data); |
1314 | *output_data_size = 20; | 1314 | *output_data_size = 20; |
1315 | 1315 | ||
1316 | result = 0; | 1316 | result = 0; |
@@ -1408,7 +1408,7 @@ gnutls_x509_privkey_sign_hash (gnutls_x509_privkey_t key, | |||
1408 | return GNUTLS_E_INVALID_REQUEST; | 1408 | return GNUTLS_E_INVALID_REQUEST; |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | result = _gnutls_sign (key->pk_algorithm, key->params, | 1411 | result = mhd_gtls_sign (key->pk_algorithm, key->params, |
1412 | key->params_size, hash, signature); | 1412 | key->params_size, hash, signature); |
1413 | if (result < 0) | 1413 | if (result < 0) |
1414 | { | 1414 | { |
diff --git a/src/daemon/https/x509/x509_verify.c b/src/daemon/https/x509/x509_verify.c index 75cdef04..b0d63727 100644 --- a/src/daemon/https/x509/x509_verify.c +++ b/src/daemon/https/x509/x509_verify.c | |||
@@ -498,7 +498,7 @@ decode_ber_digest_info (const gnutls_datum_t * info, | |||
498 | return _gnutls_asn2err (result); | 498 | return _gnutls_asn2err (result); |
499 | } | 499 | } |
500 | 500 | ||
501 | *hash = _gnutls_x509_oid2mac_algorithm (str); | 501 | *hash = mhd_gtls_x509_oid2mac_algorithm (str); |
502 | 502 | ||
503 | if (*hash == MHD_GNUTLS_MAC_UNKNOWN) | 503 | if (*hash == MHD_GNUTLS_MAC_UNKNOWN) |
504 | { | 504 | { |
@@ -555,7 +555,7 @@ _pkcs1_rsa_verify_sig (const gnutls_datum_t * text, | |||
555 | gnutls_datum_t decrypted; | 555 | gnutls_datum_t decrypted; |
556 | 556 | ||
557 | ret = | 557 | ret = |
558 | _gnutls_pkcs1_rsa_decrypt (&decrypted, signature, params, params_len, 1); | 558 | mhd_gtls_pkcs1_rsa_decrypt (&decrypted, signature, params, params_len, 1); |
559 | if (ret < 0) | 559 | if (ret < 0) |
560 | { | 560 | { |
561 | gnutls_assert (); | 561 | gnutls_assert (); |
@@ -576,21 +576,21 @@ _pkcs1_rsa_verify_sig (const gnutls_datum_t * text, | |||
576 | 576 | ||
577 | _gnutls_free_datum (&decrypted); | 577 | _gnutls_free_datum (&decrypted); |
578 | 578 | ||
579 | if (digest_size != _gnutls_hash_get_algo_len (hash)) | 579 | if (digest_size != mhd_gnutls_hash_get_algo_len (hash)) |
580 | { | 580 | { |
581 | gnutls_assert (); | 581 | gnutls_assert (); |
582 | return GNUTLS_E_ASN1_GENERIC_ERROR; | 582 | return GNUTLS_E_ASN1_GENERIC_ERROR; |
583 | } | 583 | } |
584 | 584 | ||
585 | hd = _gnutls_hash_init (hash); | 585 | hd = mhd_gtls_hash_init (hash); |
586 | if (hd == NULL) | 586 | if (hd == NULL) |
587 | { | 587 | { |
588 | gnutls_assert (); | 588 | gnutls_assert (); |
589 | return GNUTLS_E_HASH_FAILED; | 589 | return GNUTLS_E_HASH_FAILED; |
590 | } | 590 | } |
591 | 591 | ||
592 | _gnutls_hash (hd, text->data, text->size); | 592 | mhd_gnutls_hash (hd, text->data, text->size); |
593 | _gnutls_hash_deinit (hd, md); | 593 | mhd_gnutls_hash_deinit (hd, md); |
594 | 594 | ||
595 | if (memcmp (md, digest, digest_size) != 0) | 595 | if (memcmp (md, digest, digest_size) != 0) |
596 | { | 596 | { |
@@ -613,20 +613,20 @@ dsa_verify_sig (const gnutls_datum_t * text, | |||
613 | gnutls_datum_t digest; | 613 | gnutls_datum_t digest; |
614 | GNUTLS_HASH_HANDLE hd; | 614 | GNUTLS_HASH_HANDLE hd; |
615 | 615 | ||
616 | hd = _gnutls_hash_init (MHD_GNUTLS_MAC_SHA1); | 616 | hd = mhd_gtls_hash_init (MHD_GNUTLS_MAC_SHA1); |
617 | if (hd == NULL) | 617 | if (hd == NULL) |
618 | { | 618 | { |
619 | gnutls_assert (); | 619 | gnutls_assert (); |
620 | return GNUTLS_E_HASH_FAILED; | 620 | return GNUTLS_E_HASH_FAILED; |
621 | } | 621 | } |
622 | 622 | ||
623 | _gnutls_hash (hd, text->data, text->size); | 623 | mhd_gnutls_hash (hd, text->data, text->size); |
624 | _gnutls_hash_deinit (hd, _digest); | 624 | mhd_gnutls_hash_deinit (hd, _digest); |
625 | 625 | ||
626 | digest.data = _digest; | 626 | digest.data = _digest; |
627 | digest.size = 20; | 627 | digest.size = 20; |
628 | 628 | ||
629 | ret = _gnutls_dsa_verify (&digest, signature, params, params_len); | 629 | ret = mhd_gtls_dsa_verify (&digest, signature, params, params_len); |
630 | 630 | ||
631 | return ret; | 631 | return ret; |
632 | } | 632 | } |
@@ -699,7 +699,7 @@ _gnutls_x509_verify_signature (const gnutls_datum_t * tbs, | |||
699 | */ | 699 | */ |
700 | for (i = 0; i < issuer_params_size; i++) | 700 | for (i = 0; i < issuer_params_size; i++) |
701 | { | 701 | { |
702 | _gnutls_mpi_release (&issuer_params[i]); | 702 | mhd_gtls_mpi_release (&issuer_params[i]); |
703 | } | 703 | } |
704 | 704 | ||
705 | return ret; | 705 | return ret; |