summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-11-06 15:14:02 +0000
committeriphydf <iphydf@users.noreply.github.com>2016-11-09 22:30:49 +0000
commitaed24408db9cd8afe632a1d3f056669ae34f49be (patch)
tree77cb037490b3f97af949eb39dfdf2e1e513b61d1 /toxcore/DHT.c
parent42dfdf73c1dfd899a4f5a44ea1584aaf3a4ed3d2 (diff)
Remove new_nonce function in favour of random_nonce.
`new_nonce` has been an alias for `random_nonce` for a while now. Having two names for the same operation is confusing. `random_nonce` better expresses the intent. The documentation for `new_nonce` talks about guaranteeing that the nonce is different from previous ones, which is incorrect, it's just quite likely to be different.
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r--toxcore/DHT.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index ca9c17ea..3753c387 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -196,7 +196,7 @@ int create_request(const uint8_t *send_public_key, const uint8_t *send_secret_ke
196 } 196 }
197 197
198 uint8_t *nonce = packet + 1 + crypto_box_PUBLICKEYBYTES * 2; 198 uint8_t *nonce = packet + 1 + crypto_box_PUBLICKEYBYTES * 2;
199 new_nonce(nonce); 199 random_nonce(nonce);
200 uint8_t temp[MAX_CRYPTO_REQUEST_SIZE]; // TODO(irungentoo): sodium_memzero before exit function 200 uint8_t temp[MAX_CRYPTO_REQUEST_SIZE]; // TODO(irungentoo): sodium_memzero before exit function
201 memcpy(temp + 1, data, length); 201 memcpy(temp + 1, data, length);
202 temp[0] = request_id; 202 temp[0] = request_id;
@@ -1200,7 +1200,7 @@ static int getnodes(DHT *dht, IP_Port ip_port, const uint8_t *public_key, const
1200 DHT_get_shared_key_sent(dht, shared_key, public_key); 1200 DHT_get_shared_key_sent(dht, shared_key, public_key);
1201 1201
1202 uint8_t nonce[crypto_box_NONCEBYTES]; 1202 uint8_t nonce[crypto_box_NONCEBYTES];
1203 new_nonce(nonce); 1203 random_nonce(nonce);
1204 1204
1205 int len = encrypt_data_symmetric(shared_key, 1205 int len = encrypt_data_symmetric(shared_key,
1206 nonce, 1206 nonce,
@@ -1243,7 +1243,7 @@ static int sendnodes_ipv6(const DHT *dht, IP_Port ip_port, const uint8_t *public
1243 uint8_t plain[1 + Node_format_size * MAX_SENT_NODES + length]; 1243 uint8_t plain[1 + Node_format_size * MAX_SENT_NODES + length];
1244 uint8_t encrypt[sizeof(plain) + crypto_box_MACBYTES]; 1244 uint8_t encrypt[sizeof(plain) + crypto_box_MACBYTES];
1245 uint8_t nonce[crypto_box_NONCEBYTES]; 1245 uint8_t nonce[crypto_box_NONCEBYTES];
1246 new_nonce(nonce); 1246 random_nonce(nonce);
1247 1247
1248 int nodes_length = 0; 1248 int nodes_length = 0;
1249 1249