aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/tls/gnutls_cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/tls/gnutls_cipher.c')
-rw-r--r--src/daemon/https/tls/gnutls_cipher.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/daemon/https/tls/gnutls_cipher.c b/src/daemon/https/tls/gnutls_cipher.c
index 9ff19759..757fd06d 100644
--- a/src/daemon/https/tls/gnutls_cipher.c
+++ b/src/daemon/https/tls/gnutls_cipher.c
@@ -244,7 +244,7 @@ calc_enc_length (MHD_gtls_session_t session, int data_size,
244 244
245 break; 245 break;
246 case CIPHER_BLOCK: 246 case CIPHER_BLOCK:
247 if (MHD_gc_nonce ((char*) &rnd, 1) != GC_OK) 247 if (MHD_gc_nonce ((char *) &rnd, 1) != GC_OK)
248 { 248 {
249 MHD_gnutls_assert (); 249 MHD_gnutls_assert ();
250 return GNUTLS_E_RANDOM_FAILED; 250 return GNUTLS_E_RANDOM_FAILED;
@@ -302,15 +302,15 @@ MHD_gtls_compressed2ciphertext (MHD_gtls_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 MHD_gnutls_hash_get_algo_len (session->security_parameters. 305 MHD_gnutls_hash_get_algo_len (session->
306 write_mac_algorithm); 306 security_parameters.write_mac_algorithm);
307 enum MHD_GNUTLS_Protocol ver; 307 enum MHD_GNUTLS_Protocol ver;
308 int blocksize = 308 int blocksize =
309 MHD_gtls_cipher_get_block_size (session->security_parameters. 309 MHD_gtls_cipher_get_block_size (session->
310 write_bulk_cipher_algorithm); 310 security_parameters.write_bulk_cipher_algorithm);
311 cipher_type_t block_algo = 311 cipher_type_t block_algo =
312 MHD_gtls_cipher_is_block (session->security_parameters. 312 MHD_gtls_cipher_is_block (session->
313 write_bulk_cipher_algorithm); 313 security_parameters.write_bulk_cipher_algorithm);
314 opaque *data_ptr; 314 opaque *data_ptr;
315 315
316 316
@@ -337,8 +337,9 @@ MHD_gtls_compressed2ciphertext (MHD_gtls_session_t session,
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 MHD_gnutls_hash (td, 339 MHD_gnutls_hash (td,
340 UINT64DATA (session->connection_state. 340 UINT64DATA (session->
341 write_sequence_number), 8); 341 connection_state.write_sequence_number),
342 8);
342 343
343 MHD_gnutls_hash (td, &type, 1); 344 MHD_gnutls_hash (td, &type, 1);
344 if (ver >= MHD_GNUTLS_PROTOCOL_TLS1_0) 345 if (ver >= MHD_GNUTLS_PROTOCOL_TLS1_0)
@@ -377,7 +378,7 @@ MHD_gtls_compressed2ciphertext (MHD_gtls_session_t session,
377 { 378 {
378 /* copy the random IV. 379 /* copy the random IV.
379 */ 380 */
380 if (MHD_gc_nonce ((char*) data_ptr, blocksize) != GC_OK) 381 if (MHD_gc_nonce ((char *) data_ptr, blocksize) != GC_OK)
381 { 382 {
382 MHD_gnutls_assert (); 383 MHD_gnutls_assert ();
383 return GNUTLS_E_RANDOM_FAILED; 384 return GNUTLS_E_RANDOM_FAILED;
@@ -432,16 +433,16 @@ MHD_gtls_ciphertext2compressed (MHD_gtls_session_t session,
432 uint8_t major, minor; 433 uint8_t major, minor;
433 enum MHD_GNUTLS_Protocol ver; 434 enum MHD_GNUTLS_Protocol ver;
434 int hash_size = 435 int hash_size =
435 MHD_gnutls_hash_get_algo_len (session->security_parameters. 436 MHD_gnutls_hash_get_algo_len (session->
436 read_mac_algorithm); 437 security_parameters.read_mac_algorithm);
437 438
438 ver = MHD__gnutls_protocol_get_version (session); 439 ver = MHD__gnutls_protocol_get_version (session);
439 minor = MHD_gtls_version_get_minor (ver); 440 minor = MHD_gtls_version_get_minor (ver);
440 major = MHD_gtls_version_get_major (ver); 441 major = MHD_gtls_version_get_major (ver);
441 442
442 blocksize = 443 blocksize =
443 MHD_gtls_cipher_get_block_size (session->security_parameters. 444 MHD_gtls_cipher_get_block_size (session->
444 read_bulk_cipher_algorithm); 445 security_parameters.read_bulk_cipher_algorithm);
445 446
446 /* initialize MAC 447 /* initialize MAC
447 */ 448 */
@@ -465,9 +466,9 @@ MHD_gtls_ciphertext2compressed (MHD_gtls_session_t session,
465 { 466 {
466 case CIPHER_STREAM: 467 case CIPHER_STREAM:
467 if ((ret = 468 if ((ret =
468 MHD_gtls_cipher_decrypt (session->connection_state. 469 MHD_gtls_cipher_decrypt (session->
469 read_cipher_state, ciphertext.data, 470 connection_state.read_cipher_state,
470 ciphertext.size)) < 0) 471 ciphertext.data, ciphertext.size)) < 0)
471 { 472 {
472 MHD_gnutls_assert (); 473 MHD_gnutls_assert ();
473 return ret; 474 return ret;
@@ -484,9 +485,9 @@ MHD_gtls_ciphertext2compressed (MHD_gtls_session_t session,
484 } 485 }
485 486
486 if ((ret = 487 if ((ret =
487 MHD_gtls_cipher_decrypt (session->connection_state. 488 MHD_gtls_cipher_decrypt (session->
488 read_cipher_state, ciphertext.data, 489 connection_state.read_cipher_state,
489 ciphertext.size)) < 0) 490 ciphertext.data, ciphertext.size)) < 0)
490 { 491 {
491 MHD_gnutls_assert (); 492 MHD_gnutls_assert ();
492 return ret; 493 return ret;
@@ -544,8 +545,8 @@ MHD_gtls_ciphertext2compressed (MHD_gtls_session_t session,
544 if (td != GNUTLS_MAC_FAILED) 545 if (td != GNUTLS_MAC_FAILED)
545 { 546 {
546 MHD_gnutls_hash (td, 547 MHD_gnutls_hash (td,
547 UINT64DATA (session->connection_state. 548 UINT64DATA (session->
548 read_sequence_number), 8); 549 connection_state.read_sequence_number), 8);
549 550
550 MHD_gnutls_hash (td, &type, 1); 551 MHD_gnutls_hash (td, &type, 1);
551 if (ver >= MHD_GNUTLS_PROTOCOL_TLS1_0) 552 if (ver >= MHD_GNUTLS_PROTOCOL_TLS1_0)