aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-communicator-tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-communicator-tcp.c')
-rw-r--r--src/transport/gnunet-communicator-tcp.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 045a57d0f..2786ba184 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -880,7 +880,7 @@ do_rekey (struct Queue *queue, const struct TCPRekey *rekey)
880 /* FIXME: check monotonic time is monotonic... */ 880 /* FIXME: check monotonic time is monotonic... */
881 if (GNUNET_OK != 881 if (GNUNET_OK !=
882 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY, 882 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY,
883 &thp.purpose, 883 &thp,
884 &rekey->sender_sig, 884 &rekey->sender_sig,
885 &queue->target.public_key)) 885 &queue->target.public_key))
886 { 886 {
@@ -1063,8 +1063,7 @@ queue_read (void *cls)
1063 However, we have to take into account that the plaintext buffer may have 1063 However, we have to take into account that the plaintext buffer may have
1064 already contained data and not jumpt too far ahead in the ciphertext. 1064 already contained data and not jumpt too far ahead in the ciphertext.
1065 If there is no rekey and the last message is incomplete (max > total), 1065 If there is no rekey and the last message is incomplete (max > total),
1066 it is safe to keep the decryption so we shift by 'max' */ 1066 it is safe to keep the decryption so we shift by 'max' */if (GNUNET_YES == queue->rekeyed)
1067 if (GNUNET_YES == queue->rekeyed)
1068 { 1067 {
1069 max = total - old_pread_off; 1068 max = total - old_pread_off;
1070 queue->rekeyed = GNUNET_NO; 1069 queue->rekeyed = GNUNET_NO;
@@ -1284,9 +1283,9 @@ inject_rekey (struct Queue *queue)
1284 thp.receiver = queue->target; 1283 thp.receiver = queue->target;
1285 thp.ephemeral = rekey.ephemeral; 1284 thp.ephemeral = rekey.ephemeral;
1286 thp.monotonic_time = rekey.monotonic_time; 1285 thp.monotonic_time = rekey.monotonic_time;
1287 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 1286 GNUNET_CRYPTO_eddsa_sign (my_private_key,
1288 &thp.purpose, 1287 &thp,
1289 &rekey.sender_sig)); 1288 &rekey.sender_sig);
1290 calculate_hmac (&queue->out_hmac, &rekey, sizeof(rekey), &rekey.hmac); 1289 calculate_hmac (&queue->out_hmac, &rekey, sizeof(rekey), &rekey.hmac);
1291 /* Encrypt rekey message with 'old' cipher */ 1290 /* Encrypt rekey message with 'old' cipher */
1292 GNUNET_assert (0 == 1291 GNUNET_assert (0 ==
@@ -1586,9 +1585,9 @@ transmit_kx (struct Queue *queue,
1586 ths.receiver = queue->target; 1585 ths.receiver = queue->target;
1587 ths.ephemeral = *epub; 1586 ths.ephemeral = *epub;
1588 ths.monotonic_time = tc.monotonic_time; 1587 ths.monotonic_time = tc.monotonic_time;
1589 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (my_private_key, 1588 GNUNET_CRYPTO_eddsa_sign (my_private_key,
1590 &ths.purpose, 1589 &ths,
1591 &tc.sender_sig)); 1590 &tc.sender_sig);
1592 GNUNET_assert (0 == 1591 GNUNET_assert (0 ==
1593 gcry_cipher_encrypt (queue->out_cipher, 1592 gcry_cipher_encrypt (queue->out_cipher,
1594 &queue->cwrite_buf[queue->cwrite_off], 1593 &queue->cwrite_buf[queue->cwrite_off],
@@ -1654,7 +1653,7 @@ decrypt_and_check_tc (struct Queue *queue,
1654 from this sender! */ 1653 from this sender! */
1655 return GNUNET_CRYPTO_eddsa_verify ( 1654 return GNUNET_CRYPTO_eddsa_verify (
1656 GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE, 1655 GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE,
1657 &ths.purpose, 1656 &ths,
1658 &tc->sender_sig, 1657 &tc->sender_sig,
1659 &tc->sender.public_key); 1658 &tc->sender.public_key);
1660} 1659}
@@ -1953,7 +1952,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
1953 queue->address_len = in_len; 1952 queue->address_len = in_len;
1954 queue->sock = sock; 1953 queue->sock = sock;
1955 boot_queue (queue, GNUNET_TRANSPORT_CS_OUTBOUND); 1954 boot_queue (queue, GNUNET_TRANSPORT_CS_OUTBOUND);
1956 //queue->mq_awaits_continue = GNUNET_YES; 1955 // queue->mq_awaits_continue = GNUNET_YES;
1957 queue->read_task = 1956 queue->read_task =
1958 GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 1957 GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1959 queue->sock, 1958 queue->sock,
@@ -2155,9 +2154,9 @@ run (void *cls,
2155 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH; 2154 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
2156 if (GNUNET_OK != 2155 if (GNUNET_OK !=
2157 GNUNET_CONFIGURATION_get_value_time (cfg, 2156 GNUNET_CONFIGURATION_get_value_time (cfg,
2158 COMMUNICATOR_CONFIG_SECTION, 2157 COMMUNICATOR_CONFIG_SECTION,
2159 "REKEY_INTERVAL", 2158 "REKEY_INTERVAL",
2160 &rekey_interval)) 2159 &rekey_interval))
2161 rekey_interval = DEFAULT_REKEY_INTERVAL; 2160 rekey_interval = DEFAULT_REKEY_INTERVAL;
2162 2161
2163 in = tcp_address_to_sockaddr (bindto, &in_len); 2162 in = tcp_address_to_sockaddr (bindto, &in_len);
@@ -2286,8 +2285,8 @@ main (int argc, char *const *argv)
2286 options, 2285 options,
2287 &run, 2286 &run,
2288 NULL)) 2287 NULL))
2289 ? 0 2288 ? 0
2290 : 1; 2289 : 1;
2291 GNUNET_free ((void *) argv); 2290 GNUNET_free ((void *) argv);
2292 return ret; 2291 return ret;
2293} 2292}