diff options
-rw-r--r-- | toxcore/onion.c | 2 | ||||
-rw-r--r-- | toxcore/onion_announce.c | 4 | ||||
-rw-r--r-- | 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 | |||
55 | memcpy(step1 + sizeof(IP_Port), data, length); | 55 | memcpy(step1 + sizeof(IP_Port), data, length); |
56 | 56 | ||
57 | uint8_t nonce[crypto_box_NONCEBYTES]; | 57 | uint8_t nonce[crypto_box_NONCEBYTES]; |
58 | new_nonce(nonce); | 58 | random_nonce(nonce); |
59 | uint8_t random_public_key[crypto_box_PUBLICKEYBYTES]; | 59 | uint8_t random_public_key[crypto_box_PUBLICKEYBYTES]; |
60 | uint8_t random_secret_key[crypto_box_SECRETKEYBYTES]; | 60 | uint8_t random_secret_key[crypto_box_SECRETKEYBYTES]; |
61 | crypto_box_keypair(random_public_key, random_secret_key); | 61 | 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 | |||
61 | ONION_ANNOUNCE_SENDBACK_DATA_LENGTH); | 61 | ONION_ANNOUNCE_SENDBACK_DATA_LENGTH); |
62 | uint8_t packet[ANNOUNCE_REQUEST_SIZE]; | 62 | uint8_t packet[ANNOUNCE_REQUEST_SIZE]; |
63 | packet[0] = NET_PACKET_ANNOUNCE_REQUEST; | 63 | packet[0] = NET_PACKET_ANNOUNCE_REQUEST; |
64 | new_nonce(packet + 1); | 64 | random_nonce(packet + 1); |
65 | 65 | ||
66 | int len = encrypt_data(nodes[3].client_id, secret_key, packet + 1, plain, sizeof(plain), | 66 | int len = encrypt_data(nodes[3].client_id, secret_key, packet + 1, plain, sizeof(plain), |
67 | packet + 1 + crypto_box_NONCEBYTES + crypto_box_PUBLICKEYBYTES); | 67 | 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 | |||
253 | to_net_family(&nodes_list[i].ip_port.ip); | 253 | to_net_family(&nodes_list[i].ip_port.ip); |
254 | 254 | ||
255 | uint8_t nonce[crypto_box_NONCEBYTES]; | 255 | uint8_t nonce[crypto_box_NONCEBYTES]; |
256 | new_nonce(nonce); | 256 | random_nonce(nonce); |
257 | 257 | ||
258 | uint8_t pl[1 + ONION_PING_ID_SIZE + sizeof(nodes_list)]; | 258 | uint8_t pl[1 + ONION_PING_ID_SIZE + sizeof(nodes_list)]; |
259 | 259 | ||
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 | |||
50 | { | 50 | { |
51 | uint8_t plain[sizeof(uint32_t) + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES + sizeof(IP_Port)]; | 51 | uint8_t plain[sizeof(uint32_t) + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES + sizeof(IP_Port)]; |
52 | uint64_t time = unix_time(); | 52 | uint64_t time = unix_time(); |
53 | new_nonce(sendback); | 53 | random_nonce(sendback); |
54 | memcpy(plain, &num, sizeof(uint32_t)); | 54 | memcpy(plain, &num, sizeof(uint32_t)); |
55 | memcpy(plain + sizeof(uint32_t), &time, sizeof(uint64_t)); | 55 | memcpy(plain + sizeof(uint32_t), &time, sizeof(uint64_t)); |
56 | memcpy(plain + sizeof(uint32_t) + sizeof(uint64_t), public_key, crypto_box_PUBLICKEYBYTES); | 56 | 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 | |||
420 | return -1; | 420 | return -1; |
421 | 421 | ||
422 | uint8_t nonce[crypto_box_NONCEBYTES]; | 422 | uint8_t nonce[crypto_box_NONCEBYTES]; |
423 | new_nonce(nonce); | 423 | random_nonce(nonce); |
424 | 424 | ||
425 | uint8_t packet[DATA_IN_RESPONSE_MIN_SIZE + length]; | 425 | uint8_t packet[DATA_IN_RESPONSE_MIN_SIZE + length]; |
426 | memcpy(packet, onion_c->dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); | 426 | memcpy(packet, onion_c->dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); |