diff options
Diffstat (limited to 'toxcore/onion.c')
-rw-r--r-- | toxcore/onion.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/onion.c b/toxcore/onion.c index 5705c14f..06ff719b 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c | |||
@@ -375,7 +375,7 @@ int onion_send_1(const Onion *onion, const uint8_t *plain, uint16_t len, IP_Port | |||
375 | memcpy(data + 1 + crypto_box_NONCEBYTES, plain + SIZE_IPPORT, len - SIZE_IPPORT); | 375 | memcpy(data + 1 + crypto_box_NONCEBYTES, plain + SIZE_IPPORT, len - SIZE_IPPORT); |
376 | uint16_t data_len = 1 + crypto_box_NONCEBYTES + (len - SIZE_IPPORT); | 376 | uint16_t data_len = 1 + crypto_box_NONCEBYTES + (len - SIZE_IPPORT); |
377 | uint8_t *ret_part = data + data_len; | 377 | uint8_t *ret_part = data + data_len; |
378 | new_nonce(ret_part); | 378 | random_nonce(ret_part); |
379 | len = encrypt_data_symmetric(onion->secret_symmetric_key, ret_part, ip_port, SIZE_IPPORT, | 379 | len = encrypt_data_symmetric(onion->secret_symmetric_key, ret_part, ip_port, SIZE_IPPORT, |
380 | ret_part + crypto_box_NONCEBYTES); | 380 | ret_part + crypto_box_NONCEBYTES); |
381 | 381 | ||
@@ -428,7 +428,7 @@ static int handle_send_1(void *object, IP_Port source, const uint8_t *packet, ui | |||
428 | memcpy(data + 1 + crypto_box_NONCEBYTES, plain + SIZE_IPPORT, len - SIZE_IPPORT); | 428 | memcpy(data + 1 + crypto_box_NONCEBYTES, plain + SIZE_IPPORT, len - SIZE_IPPORT); |
429 | uint16_t data_len = 1 + crypto_box_NONCEBYTES + (len - SIZE_IPPORT); | 429 | uint16_t data_len = 1 + crypto_box_NONCEBYTES + (len - SIZE_IPPORT); |
430 | uint8_t *ret_part = data + data_len; | 430 | uint8_t *ret_part = data + data_len; |
431 | new_nonce(ret_part); | 431 | random_nonce(ret_part); |
432 | uint8_t ret_data[RETURN_1 + SIZE_IPPORT]; | 432 | uint8_t ret_data[RETURN_1 + SIZE_IPPORT]; |
433 | ipport_pack(ret_data, &source); | 433 | ipport_pack(ret_data, &source); |
434 | memcpy(ret_data + SIZE_IPPORT, packet + (length - RETURN_1), RETURN_1); | 434 | memcpy(ret_data + SIZE_IPPORT, packet + (length - RETURN_1), RETURN_1); |
@@ -482,7 +482,7 @@ static int handle_send_2(void *object, IP_Port source, const uint8_t *packet, ui | |||
482 | memcpy(data, plain + SIZE_IPPORT, len - SIZE_IPPORT); | 482 | memcpy(data, plain + SIZE_IPPORT, len - SIZE_IPPORT); |
483 | uint16_t data_len = (len - SIZE_IPPORT); | 483 | uint16_t data_len = (len - SIZE_IPPORT); |
484 | uint8_t *ret_part = data + (len - SIZE_IPPORT); | 484 | uint8_t *ret_part = data + (len - SIZE_IPPORT); |
485 | new_nonce(ret_part); | 485 | random_nonce(ret_part); |
486 | uint8_t ret_data[RETURN_2 + SIZE_IPPORT]; | 486 | uint8_t ret_data[RETURN_2 + SIZE_IPPORT]; |
487 | ipport_pack(ret_data, &source); | 487 | ipport_pack(ret_data, &source); |
488 | memcpy(ret_data + SIZE_IPPORT, packet + (length - RETURN_2), RETURN_2); | 488 | memcpy(ret_data + SIZE_IPPORT, packet + (length - RETURN_2), RETURN_2); |