summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r--toxcore/DHT.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 1089e2ff..ad496f7d 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -164,7 +164,7 @@ void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secr
164} 164}
165 165
166/* Copy shared_key to decrypt DHT packet from client_id into shared_key 166/* Copy shared_key to decrypt DHT packet from client_id into shared_key
167 * for packets that we recieve. 167 * for packets that we receive.
168 */ 168 */
169void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id) 169void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id)
170{ 170{
@@ -600,7 +600,7 @@ static int replace_possible_bad( Client_data *list,
600 600
601 sort_list(list, length, comp_client_id); 601 sort_list(list, length, comp_client_id);
602 602
603 /* TODO: decide if the folowing lines should stay commented or not. 603 /* TODO: decide if the following lines should stay commented or not.
604 if (id_closest(comp_client_id, list[0].client_id, client_id) == 1) 604 if (id_closest(comp_client_id, list[0].client_id, client_id) == 1)
605 return 0;*/ 605 return 0;*/
606 606
@@ -861,20 +861,20 @@ static int getnodes(DHT *dht, IP_Port ip_port, uint8_t *public_key, uint8_t *cli
861 861
862 uint64_t temp_time = unix_time(); 862 uint64_t temp_time = unix_time();
863 memcpy(plain_message, &temp_time, sizeof(temp_time)); 863 memcpy(plain_message, &temp_time, sizeof(temp_time));
864 Node_format reciever; 864 Node_format receiver;
865 memcpy(reciever.client_id, public_key, CLIENT_ID_SIZE); 865 memcpy(receiver.client_id, public_key, CLIENT_ID_SIZE);
866 reciever.ip_port = ip_port; 866 receiver.ip_port = ip_port;
867 memcpy(plain_message + sizeof(temp_time), &reciever, sizeof(reciever)); 867 memcpy(plain_message + sizeof(temp_time), &receiver, sizeof(receiver));
868 868
869 if (sendback_node != NULL) 869 if (sendback_node != NULL)
870 memcpy(plain_message + sizeof(temp_time) + sizeof(reciever), sendback_node, sizeof(Node_format)); 870 memcpy(plain_message + sizeof(temp_time) + sizeof(receiver), sendback_node, sizeof(Node_format));
871 else 871 else
872 memset(plain_message + sizeof(temp_time) + sizeof(reciever), 0, sizeof(Node_format)); 872 memset(plain_message + sizeof(temp_time) + sizeof(receiver), 0, sizeof(Node_format));
873 873
874 int len_m = encrypt_data_symmetric(dht->secret_symmetric_key, 874 int len_m = encrypt_data_symmetric(dht->secret_symmetric_key,
875 nonce, 875 nonce,
876 plain_message, 876 plain_message,
877 sizeof(temp_time) + sizeof(reciever) + sizeof(Node_format), 877 sizeof(temp_time) + sizeof(receiver) + sizeof(Node_format),
878 encrypted_message + crypto_secretbox_NONCEBYTES); 878 encrypted_message + crypto_secretbox_NONCEBYTES);
879 879
880 if (len_m != NODES_ENCRYPTED_MESSAGE_LENGTH - crypto_secretbox_NONCEBYTES) 880 if (len_m != NODES_ENCRYPTED_MESSAGE_LENGTH - crypto_secretbox_NONCEBYTES)