diff options
Diffstat (limited to 'toxcore/crypto_core.c')
-rw-r--r-- | toxcore/crypto_core.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index 50b217a0..6c753007 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c | |||
@@ -76,7 +76,8 @@ void encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, ui | |||
76 | crypto_box_beforenm(enc_key, public_key, secret_key); | 76 | crypto_box_beforenm(enc_key, public_key, secret_key); |
77 | } | 77 | } |
78 | 78 | ||
79 | int encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *plain, uint32_t length, uint8_t *encrypted) | 79 | int encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *plain, uint32_t length, |
80 | uint8_t *encrypted) | ||
80 | { | 81 | { |
81 | if (length == 0) | 82 | if (length == 0) |
82 | return -1; | 83 | return -1; |
@@ -95,7 +96,8 @@ int encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, cons | |||
95 | return length + crypto_box_MACBYTES; | 96 | return length + crypto_box_MACBYTES; |
96 | } | 97 | } |
97 | 98 | ||
98 | int decrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *encrypted, uint32_t length, uint8_t *plain) | 99 | int decrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *encrypted, uint32_t length, |
100 | uint8_t *plain) | ||
99 | { | 101 | { |
100 | if (length <= crypto_box_BOXZEROBYTES) | 102 | if (length <= crypto_box_BOXZEROBYTES) |
101 | return -1; | 103 | return -1; |
@@ -202,8 +204,8 @@ void new_nonce(uint8_t *nonce) | |||
202 | * return -1 on failure. | 204 | * return -1 on failure. |
203 | * return the length of the created packet on success. | 205 | * return the length of the created packet on success. |
204 | */ | 206 | */ |
205 | int create_request(const uint8_t *send_public_key, const uint8_t *send_secret_key, uint8_t *packet, const uint8_t *recv_public_key, | 207 | int create_request(const uint8_t *send_public_key, const uint8_t *send_secret_key, uint8_t *packet, |
206 | const uint8_t *data, uint32_t length, uint8_t request_id) | 208 | const uint8_t *recv_public_key, const uint8_t *data, uint32_t length, uint8_t request_id) |
207 | { | 209 | { |
208 | if (MAX_CRYPTO_REQUEST_SIZE < length + 1 + crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + 1 + | 210 | if (MAX_CRYPTO_REQUEST_SIZE < length + 1 + crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + 1 + |
209 | crypto_box_MACBYTES) | 211 | crypto_box_MACBYTES) |