summaryrefslogtreecommitdiff
path: root/toxcore/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r--toxcore/ping.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c
index b0928d95..35aab86f 100644
--- a/toxcore/ping.c
+++ b/toxcore/ping.c
@@ -169,9 +169,9 @@ int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id)
169 169
170 170
171 rc = encrypt_data_symmetric(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);
175 175
176 if (rc != sizeof(ping_id) + crypto_box_MACBYTES) 176 if (rc != sizeof(ping_id) + crypto_box_MACBYTES)
177 return 1; 177 return 1;
@@ -194,9 +194,9 @@ static int send_ping_response(PING *ping, IP_Port ipp, uint8_t *client_id, uint6
194 194
195 // Encrypt ping_id using recipient privkey 195 // Encrypt ping_id using recipient privkey
196 rc = encrypt_data_symmetric(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 );
200 200
201 if (rc != sizeof(ping_id) + crypto_box_MACBYTES) 201 if (rc != sizeof(ping_id) + crypto_box_MACBYTES)
202 return 1; 202 return 1;
@@ -223,10 +223,10 @@ static int handle_ping_request(void *_dht, IP_Port source, uint8_t *packet, uint
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_symmetric(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,
229 (uint8_t *) &ping_id ); 229 (uint8_t *) &ping_id );
230 230
231 if (rc != sizeof(ping_id)) 231 if (rc != sizeof(ping_id))
232 return 1; 232 return 1;
@@ -260,10 +260,10 @@ static int handle_ping_response(void *_dht, IP_Port source, uint8_t *packet, uin
260 --ping_index; 260 --ping_index;
261 // Decrypt ping_id 261 // Decrypt ping_id
262 rc = decrypt_data_symmetric(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,
266 (uint8_t *) &ping_id); 266 (uint8_t *) &ping_id);
267 267
268 if (rc != sizeof(ping_id)) 268 if (rc != sizeof(ping_id))
269 return 1; 269 return 1;