diff options
author | irungentoo <irungentoo@gmail.com> | 2014-03-04 15:36:29 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-03-04 15:36:29 -0500 |
commit | b6fe49e59a39cb12334cbcad82b07a6247eb22d5 (patch) | |
tree | 76c0f3a954569bfac756a1767e5912d71c8f46ec /toxcore/ping.c | |
parent | a251e71a97d40342bada58d88c2234f3ba25c700 (diff) |
CPU usage improvements.
Shared keys for recieved DHT packets are now stored in a special array
so that they don't need to be recomputed for nodes that send us lots of
packets.
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r-- | toxcore/ping.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c index 2bc1f07d..ff410f39 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c | |||
@@ -218,7 +218,7 @@ static int handle_ping_request(void *_dht, IP_Port source, uint8_t *packet, uint | |||
218 | uint8_t shared_key[crypto_box_BEFORENMBYTES]; | 218 | uint8_t shared_key[crypto_box_BEFORENMBYTES]; |
219 | 219 | ||
220 | // Decrypt ping_id | 220 | // Decrypt ping_id |
221 | encrypt_precompute(packet + 1, ping->dht->self_secret_key, shared_key); | 221 | DHT_get_shared_key(dht, shared_key, packet + 1); |
222 | rc = decrypt_data_fast(shared_key, | 222 | rc = decrypt_data_fast(shared_key, |
223 | packet + 1 + CLIENT_ID_SIZE, | 223 | packet + 1 + CLIENT_ID_SIZE, |
224 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, | 224 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, |