diff options
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r-- | toxcore/ping.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c index 2d0a4545..5fd34972 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * This file is donated to the Tox Project. | 4 | * This file is donated to the Tox Project. |
5 | * Copyright 2013 plutooo | 5 | * Copyright 2013 plutooo |
6 | * | 6 | * |
7 | * Copyright (C) 2013 Tox project All Rights Reserved. | 7 | * Copyright (C) 2013 Tox project All Rights Reserved. |
8 | * | 8 | * |
9 | * This file is part of Tox. | 9 | * This file is part of Tox. |
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
22 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | 22 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifdef HAVE_CONFIG_H | 26 | #ifdef HAVE_CONFIG_H |
@@ -132,7 +132,7 @@ static bool is_pinging(PING *ping, IP_Port ipp, uint64_t ping_id) // O(n) TOD | |||
132 | return false; | 132 | return false; |
133 | } | 133 | } |
134 | 134 | ||
135 | #define DHT_PING_SIZE (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(uint64_t) + ENCRYPTION_PADDING) | 135 | #define DHT_PING_SIZE (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(uint64_t) + crypto_box_MACBYTES) |
136 | 136 | ||
137 | int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id) | 137 | int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id) |
138 | { | 138 | { |
@@ -157,7 +157,7 @@ int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id) | |||
157 | (uint8_t *) &ping_id, sizeof(ping_id), | 157 | (uint8_t *) &ping_id, sizeof(ping_id), |
158 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES); | 158 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES); |
159 | 159 | ||
160 | if (rc != sizeof(ping_id) + ENCRYPTION_PADDING) | 160 | if (rc != sizeof(ping_id) + crypto_box_MACBYTES) |
161 | return 1; | 161 | return 1; |
162 | 162 | ||
163 | return sendpacket(ping->c->lossless_udp->net, ipp, pk, sizeof(pk)); | 163 | return sendpacket(ping->c->lossless_udp->net, ipp, pk, sizeof(pk)); |
@@ -182,7 +182,7 @@ static int send_ping_response(PING *ping, IP_Port ipp, uint8_t *client_id, uint6 | |||
182 | (uint8_t *) &ping_id, sizeof(ping_id), | 182 | (uint8_t *) &ping_id, sizeof(ping_id), |
183 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES); | 183 | pk + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES); |
184 | 184 | ||
185 | if (rc != sizeof(ping_id) + ENCRYPTION_PADDING) | 185 | if (rc != sizeof(ping_id) + crypto_box_MACBYTES) |
186 | return 1; | 186 | return 1; |
187 | 187 | ||
188 | return sendpacket(ping->c->lossless_udp->net, ipp, pk, sizeof(pk)); | 188 | return sendpacket(ping->c->lossless_udp->net, ipp, pk, sizeof(pk)); |
@@ -207,7 +207,7 @@ static int handle_ping_request(void *_dht, IP_Port source, uint8_t *packet, uint | |||
207 | ping->c->self_secret_key, | 207 | ping->c->self_secret_key, |
208 | packet + 1 + CLIENT_ID_SIZE, | 208 | packet + 1 + CLIENT_ID_SIZE, |
209 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, | 209 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, |
210 | sizeof(ping_id) + ENCRYPTION_PADDING, | 210 | sizeof(ping_id) + crypto_box_MACBYTES, |
211 | (uint8_t *) &ping_id); | 211 | (uint8_t *) &ping_id); |
212 | 212 | ||
213 | if (rc != sizeof(ping_id)) | 213 | if (rc != sizeof(ping_id)) |
@@ -239,7 +239,7 @@ static int handle_ping_response(void *_dht, IP_Port source, uint8_t *packet, uin | |||
239 | ping->c->self_secret_key, | 239 | ping->c->self_secret_key, |
240 | packet + 1 + CLIENT_ID_SIZE, | 240 | packet + 1 + CLIENT_ID_SIZE, |
241 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, | 241 | packet + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, |
242 | sizeof(ping_id) + ENCRYPTION_PADDING, | 242 | sizeof(ping_id) + crypto_box_MACBYTES, |
243 | (uint8_t *) &ping_id); | 243 | (uint8_t *) &ping_id); |
244 | 244 | ||
245 | if (rc != sizeof(ping_id)) | 245 | if (rc != sizeof(ping_id)) |