aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/tls/gnutls_state.c
diff options
context:
space:
mode:
authorlv-426 <oxcafebaby@yahoo.com>2008-08-11 03:40:22 +0000
committerlv-426 <oxcafebaby@yahoo.com>2008-08-11 03:40:22 +0000
commit1c893a971fa8d04ada6c66aa9ebf525b03ed4426 (patch)
tree7a4b22d2bd11a55aa2bd2bc01495572dd260e7d6 /src/daemon/https/tls/gnutls_state.c
parent41886bcf92e8e6b943c9f0697a75f4a380952f52 (diff)
downloadlibmicrohttpd-1c893a971fa8d04ada6c66aa9ebf525b03ed4426.tar.gz
libmicrohttpd-1c893a971fa8d04ada6c66aa9ebf525b03ed4426.zip
gnutls code cleanup
symbol refactoring
Diffstat (limited to 'src/daemon/https/tls/gnutls_state.c')
-rw-r--r--src/daemon/https/tls/gnutls_state.c340
1 files changed, 161 insertions, 179 deletions
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
45void 45void
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 **/
58gnutls_cipher_algorithm_t 58gnutls_cipher_algorithm_t
59gnutls_cipher_get (gnutls_session_t session) 59gnutls_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 **/
74gnutls_certificate_type_t 74gnutls_certificate_type_t
75gnutls_certificate_type_get (gnutls_session_t session) 75gnutls_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 **/
86gnutls_kx_algorithm_t 86gnutls_kx_algorithm_t
87gnutls_kx_get (gnutls_session_t session) 87gnutls_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 **/
98gnutls_mac_algorithm_t 98gnutls_mac_algorithm_t
99gnutls_mac_get (gnutls_session_t session) 99gnutls_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 **/
110gnutls_compression_method_t 110gnutls_compression_method_t
111gnutls_compression_get (gnutls_session_t session) 111gnutls_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 */
120int 120int
121_gnutls_session_cert_type_supported (gnutls_session_t session, 121mhd_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 */
174inline static void 174inline static void
175deinit_internal_params (gnutls_session_t session) 175deinit_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 */
190void 190void
191_gnutls_handshake_internal_state_clear (gnutls_session_t session) 191mhd_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 */
236int 236int
237gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end) 237MHD_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 */
326int 326int
327_gnutls_session_is_resumable (gnutls_session_t session) 327mhd_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 **/
340void 340void
341gnutls_deinit (gnutls_session_t session) 341MHD_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 */
423int 423int
424_gnutls_dh_get_allowed_prime_bits (gnutls_session_t session) 424mhd_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
429int 429int
430_gnutls_dh_set_peer_public (gnutls_session_t session, mpi_t public) 430mhd_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
473int 473int
474_gnutls_dh_set_secret_bits (gnutls_session_t session, unsigned bits) 474mhd_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 */
509int 509int
510_gnutls_rsa_export_set_pubkey (gnutls_session_t session, 510mhd_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 */
540int 540int
541_gnutls_dh_set_group (gnutls_session_t session, mpi_t gen, mpi_t prime) 541mhd_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 **/
606void 606void
607gnutls_openpgp_send_cert (gnutls_session_t session, 607MHD_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 **/
627void 627void
628gnutls_certificate_send_x509_rdn_sequence (gnutls_session_t session, 628MHD_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
634int 634int
635_gnutls_openpgp_send_fingerprint (gnutls_session_t session) 635mhd_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 -*/
651void 651void
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 **/
675void 675void
676gnutls_handshake_set_private_extensions (gnutls_session_t session, int allow) 676MHD_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 */
802int 802int
803_gnutls_PRF (gnutls_session_t session, 803mhd_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 **/
913int 913int
914gnutls_prf_raw (gnutls_session_t session, 914MHD_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 **/
957int 957int
958gnutls_prf (gnutls_session_t session, 958MHD_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 **/
1006const void * 1006const void *
1007gnutls_session_get_client_random (gnutls_session_t session) 1007MHD_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 **/
1025const void * 1025const void *
1026gnutls_session_get_server_random (gnutls_session_t session) 1026MHD_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 **/
1047const void * 1047const void *
1048gnutls_session_get_master_secret (gnutls_session_t session) 1048MHD_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 **/
1060int 1060int
1061gnutls_session_is_resumed (gnutls_session_t session) 1061MHD_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 -*/
1090int 1090int
1091_gnutls_session_is_export (gnutls_session_t session) 1091mhd_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 **/
1112void * 1112void *
1113gnutls_session_get_ptr (gnutls_session_t session) 1113MHD_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 **/
1127void 1127void
1128gnutls_session_set_ptr (gnutls_session_t session, void *ptr) 1128MHD_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 **/
1150int 1150int
1151gnutls_record_get_direction (gnutls_session_t session) 1151MHD_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 -*/
1167void 1167void
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 **/
1197void 1197void
1198gnutls_handshake_set_post_client_hello_function (gnutls_session_t session, 1198MHD_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 **/
1217void
1218gnutls_session_enable_compatibility_mode (gnutls_session_t session)
1219{
1220 gnutls_record_disable_padding (session);
1221}