diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-15 20:56:22 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-15 20:56:22 -0400 |
commit | b15230583c31799d650584b05f4cfce8cd726aea (patch) | |
tree | c9d56f3fd9bad409374302e6eb92e9343cb859c1 /core/net_crypto.c | |
parent | 36cb9b003d2f9e8162c39ffa3ab1afa3743b13a4 (diff) |
Fixed loading and a small problem with the length of crypto requests.
Diffstat (limited to 'core/net_crypto.c')
-rw-r--r-- | core/net_crypto.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/net_crypto.c b/core/net_crypto.c index 376708ab..a05208ef 100644 --- a/core/net_crypto.c +++ b/core/net_crypto.c | |||
@@ -228,7 +228,7 @@ int create_request(uint8_t *packet, uint8_t *public_key, uint8_t *data, uint32_t | |||
228 | memcpy(temp + 1, data, length); | 228 | memcpy(temp + 1, data, length); |
229 | temp[0] = request_id; | 229 | temp[0] = request_id; |
230 | random_nonce(nonce); | 230 | random_nonce(nonce); |
231 | int len = encrypt_data(public_key, self_secret_key, nonce, temp, length, | 231 | int len = encrypt_data(public_key, self_secret_key, nonce, temp, length + 1, |
232 | 1 + crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + packet); | 232 | 1 + crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + packet); |
233 | if (len == -1) | 233 | if (len == -1) |
234 | return -1; | 234 | return -1; |
@@ -287,7 +287,7 @@ static int cryptopacket_handle(IP_Port source, uint8_t * packet, uint32_t length | |||
287 | if (len == -1 || len == 0) | 287 | if (len == -1 || len == 0) |
288 | return 1; | 288 | return 1; |
289 | if (!cryptopackethandlers[number]) return 1; | 289 | if (!cryptopackethandlers[number]) return 1; |
290 | cryptopackethandlers[number](source, public_key, data, len - 1); | 290 | cryptopackethandlers[number](source, public_key, data, len); |
291 | 291 | ||
292 | } else { /* if request is not for us, try routing it. */ | 292 | } else { /* if request is not for us, try routing it. */ |
293 | if(route_packet(packet + 1, packet, length) == length) | 293 | if(route_packet(packet + 1, packet, length) == length) |