diff options
author | notsecure <notsecure@marek.ca> | 2014-05-19 14:18:26 -0400 |
---|---|---|
committer | notsecure <notsecure@marek.ca> | 2014-05-19 14:18:26 -0400 |
commit | d27a83820c6af2f0d6d813b9916d324e9ae3d137 (patch) | |
tree | 246aca3894df395def2316bae0787549495b285a /toxcore/onion.c | |
parent | ede8455a5a3a6f3b68a676ecbdda6f5561e7d464 (diff) |
added missing ipport_pack
Diffstat (limited to 'toxcore/onion.c')
-rw-r--r-- | toxcore/onion.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/toxcore/onion.c b/toxcore/onion.c index 067b3907..479c6209 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c | |||
@@ -195,6 +195,9 @@ int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, uin | |||
195 | ipport_unpack(&send_to, plain); | 195 | ipport_unpack(&send_to, plain); |
196 | to_host_family(&send_to.ip); | 196 | to_host_family(&send_to.ip); |
197 | 197 | ||
198 | uint8_t ip_port[SIZE_IPPORT]; | ||
199 | ipport_pack(ip_port, &source); | ||
200 | |||
198 | uint8_t data[ONION_MAX_PACKET_SIZE]; | 201 | uint8_t data[ONION_MAX_PACKET_SIZE]; |
199 | data[0] = NET_PACKET_ONION_SEND_1; | 202 | data[0] = NET_PACKET_ONION_SEND_1; |
200 | memcpy(data + 1, nonce, crypto_box_NONCEBYTES); | 203 | memcpy(data + 1, nonce, crypto_box_NONCEBYTES); |
@@ -202,7 +205,7 @@ int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, uin | |||
202 | uint32_t data_len = 1 + crypto_box_NONCEBYTES + (len - SIZE_IPPORT); | 205 | uint32_t data_len = 1 + crypto_box_NONCEBYTES + (len - SIZE_IPPORT); |
203 | uint8_t *ret_part = data + data_len; | 206 | uint8_t *ret_part = data + data_len; |
204 | new_nonce(ret_part); | 207 | new_nonce(ret_part); |
205 | len = encrypt_data_symmetric(onion->secret_symmetric_key, ret_part, (uint8_t *)&source, SIZE_IPPORT, | 208 | len = encrypt_data_symmetric(onion->secret_symmetric_key, ret_part, ip_port, SIZE_IPPORT, |
206 | ret_part + crypto_box_NONCEBYTES); | 209 | ret_part + crypto_box_NONCEBYTES); |
207 | 210 | ||
208 | if (len != SIZE_IPPORT + crypto_box_MACBYTES) | 211 | if (len != SIZE_IPPORT + crypto_box_MACBYTES) |