From 0d53abebcdea36adc509ee46e2bfdacea41ac5e4 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sat, 25 Jan 2014 13:33:39 -0500 Subject: Fixed possible anonimity leak with the onion routing. --- toxcore/onion.c | 2 +- toxcore/onion_announce.c | 4 ++-- toxcore/onion_client.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/toxcore/onion.c b/toxcore/onion.c index b4d2a364..961f5bd5 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c @@ -55,7 +55,7 @@ int send_onion_packet(DHT *dht, Node_format *nodes, uint8_t *data, uint32_t leng memcpy(step1 + sizeof(IP_Port), data, length); uint8_t nonce[crypto_box_NONCEBYTES]; - new_nonce(nonce); + random_nonce(nonce); uint8_t random_public_key[crypto_box_PUBLICKEYBYTES]; uint8_t random_secret_key[crypto_box_SECRETKEYBYTES]; crypto_box_keypair(random_public_key, random_secret_key); diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index 8150974b..2ca53896 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c @@ -61,7 +61,7 @@ int send_announce_request(DHT *dht, Node_format *nodes, uint8_t *public_key, uin ONION_ANNOUNCE_SENDBACK_DATA_LENGTH); uint8_t packet[ANNOUNCE_REQUEST_SIZE]; packet[0] = NET_PACKET_ANNOUNCE_REQUEST; - new_nonce(packet + 1); + random_nonce(packet + 1); int len = encrypt_data(nodes[3].client_id, secret_key, packet + 1, plain, sizeof(plain), packet + 1 + crypto_box_NONCEBYTES + crypto_box_PUBLICKEYBYTES); @@ -253,7 +253,7 @@ static int handle_announce_request(void *object, IP_Port source, uint8_t *packet to_net_family(&nodes_list[i].ip_port.ip); uint8_t nonce[crypto_box_NONCEBYTES]; - new_nonce(nonce); + random_nonce(nonce); uint8_t pl[1 + ONION_PING_ID_SIZE + sizeof(nodes_list)]; diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 97ef3b84..a85a07a2 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -50,7 +50,7 @@ static int new_sendback(Onion_Client *onion_c, uint32_t num, uint8_t *public_key { uint8_t plain[sizeof(uint32_t) + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES + sizeof(IP_Port)]; uint64_t time = unix_time(); - new_nonce(sendback); + random_nonce(sendback); memcpy(plain, &num, sizeof(uint32_t)); memcpy(plain + sizeof(uint32_t), &time, sizeof(uint64_t)); memcpy(plain + sizeof(uint32_t) + sizeof(uint64_t), public_key, crypto_box_PUBLICKEYBYTES); @@ -420,7 +420,7 @@ int send_onion_data(Onion_Client *onion_c, int friend_num, uint8_t *data, uint32 return -1; uint8_t nonce[crypto_box_NONCEBYTES]; - new_nonce(nonce); + random_nonce(nonce); uint8_t packet[DATA_IN_RESPONSE_MIN_SIZE + length]; memcpy(packet, onion_c->dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); -- cgit v1.2.3