diff options
author | irungentoo <irungentoo@gmail.com> | 2014-04-21 16:51:36 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-04-21 16:51:36 -0400 |
commit | 9c6a8432ce7298766669d1e6a966b5493971afb7 (patch) | |
tree | 8fd98c412610cbcf3fa8b7c28e0a5efbe02bad77 /toxcore/ping.c | |
parent | 1603ca974eae3fe0d94b597103f04acfb96fcab0 (diff) |
Crypto related cleanups.
Moved Bunch of functions from net_crypto to crypto_core.
decrypt_data_fast and decrypt_data_symmetric were the same thing
therefore, removed decrypt_data_fast.
Replaced all the crypto_secretbox_* defines with the equivalent
crypto_box_* one.
New define: crypto_box_KEYBYTES that is equal to
crypto_box_BEFORENMBYTES.
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r-- | toxcore/ping.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c index e43c3b1a..b0928d95 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c | |||
@@ -168,7 +168,7 @@ int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id) | |||
168 | new_nonce(pk + 1 + CLIENT_ID_SIZE); // Generate new nonce | 168 | new_nonce(pk + 1 + CLIENT_ID_SIZE); // Generate new nonce |
169 | 169 | ||
170 | 170 | ||
171 | rc = encrypt_data_fast(shared_key, | 171 | rc = encrypt_data_symmetric(shared_key, |
172 | pk + 1 + CLIENT_ID_SIZE, | 172 | pk + 1 + CLIENT_ID_SIZE, |
173 | (uint8_t *) &ping_id, sizeof(ping_id), | 173 | (uint8_t *) &ping_id, sizeof(ping_id), |
174 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES); | 174 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES); |
@@ -193,7 +193,7 @@ static int send_ping_response(PING *ping, IP_Port ipp, uint8_t *client_id, uint6 | |||
193 | new_nonce(pk + 1 + CLIENT_ID_SIZE); // Generate new nonce | 193 | new_nonce(pk + 1 + CLIENT_ID_SIZE); // Generate new nonce |
194 | 194 | ||
195 | // Encrypt ping_id using recipient privkey | 195 | // Encrypt ping_id using recipient privkey |
196 | rc = encrypt_data_fast(shared_encryption_key, | 196 | rc = encrypt_data_symmetric(shared_encryption_key, |
197 | pk + 1 + CLIENT_ID_SIZE, | 197 | pk + 1 + CLIENT_ID_SIZE, |
198 | (uint8_t *) &ping_id, sizeof(ping_id), | 198 | (uint8_t *) &ping_id, sizeof(ping_id), |
199 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES ); | 199 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES ); |
@@ -222,7 +222,7 @@ static int handle_ping_request(void *_dht, IP_Port source, uint8_t *packet, uint | |||
222 | 222 | ||
223 | // Decrypt ping_id | 223 | // Decrypt ping_id |
224 | DHT_get_shared_key_recv(dht, shared_key, packet + 1); | 224 | DHT_get_shared_key_recv(dht, shared_key, packet + 1); |
225 | rc = decrypt_data_fast(shared_key, | 225 | rc = decrypt_data_symmetric(shared_key, |
226 | packet + 1 + CLIENT_ID_SIZE, | 226 | packet + 1 + CLIENT_ID_SIZE, |
227 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, | 227 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, |
228 | sizeof(ping_id) + crypto_box_MACBYTES, | 228 | sizeof(ping_id) + crypto_box_MACBYTES, |
@@ -259,7 +259,7 @@ static int handle_ping_response(void *_dht, IP_Port source, uint8_t *packet, uin | |||
259 | 259 | ||
260 | --ping_index; | 260 | --ping_index; |
261 | // Decrypt ping_id | 261 | // Decrypt ping_id |
262 | rc = decrypt_data_fast(ping->pings[ping_index].shared_key, | 262 | rc = decrypt_data_symmetric(ping->pings[ping_index].shared_key, |
263 | packet + 1 + CLIENT_ID_SIZE, | 263 | packet + 1 + CLIENT_ID_SIZE, |
264 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, | 264 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, |
265 | sizeof(ping_id) + crypto_box_MACBYTES, | 265 | sizeof(ping_id) + crypto_box_MACBYTES, |