mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed possible anonimity leak with the onion routing.
This commit is contained in:
parent
7b252be299
commit
0d53abebcd
|
@ -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);
|
||||
|
|
|
@ -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)];
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user