summaryrefslogtreecommitdiff
path: root/toxencryptsave/toxencryptsave.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-03-26 12:39:09 -0400
committerirungentoo <irungentoo@gmail.com>2015-03-26 12:39:09 -0400
commit06b389ea5e4e0ffb1f8e6627d4909c53c23099e1 (patch)
tree6689e3ec5c518f2fbb07ca139cf5a944fe86b020 /toxencryptsave/toxencryptsave.c
parente888b89ac94066ab80bd72dbaa347bdab3856020 (diff)
Making tox_encrypted_new() use the same error codes as tox_new was a bad idea.
They now have their own error codes.
Diffstat (limited to 'toxencryptsave/toxencryptsave.c')
-rw-r--r--toxencryptsave/toxencryptsave.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c
index 587c7048..874f0fd0 100644
--- a/toxencryptsave/toxencryptsave.c
+++ b/toxencryptsave/toxencryptsave.c
@@ -300,14 +300,14 @@ int tox_pass_decrypt(const uint8_t *data, uint32_t length, uint8_t *passphrase,
300 * returns NULL on failure; see the documentation in toxcore/tox.h. 300 * returns NULL on failure; see the documentation in toxcore/tox.h.
301 */ 301 */
302Tox *tox_encrypted_new(const struct Tox_Options *options, const uint8_t *data, size_t length, uint8_t *passphrase, 302Tox *tox_encrypted_new(const struct Tox_Options *options, const uint8_t *data, size_t length, uint8_t *passphrase,
303 size_t pplength, TOX_ERR_NEW *error) 303 size_t pplength, TOX_ERR_ENCRYPTED_NEW *error)
304{ 304{
305 uint32_t decrypt_length = length - TOX_PASS_ENCRYPTION_EXTRA_LENGTH; 305 uint32_t decrypt_length = length - TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
306 uint8_t temp_data[decrypt_length]; 306 uint8_t temp_data[decrypt_length];
307 307
308 if (tox_pass_decrypt(data, length, passphrase, pplength, temp_data) 308 if (tox_pass_decrypt(data, length, passphrase, pplength, temp_data)
309 != decrypt_length) { 309 != decrypt_length) {
310 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_LOAD_DECRYPTION_FAILED); 310 SET_ERROR_PARAMETER(error, TOX_ERR_ENCRYPTED_NEW_LOAD_DECRYPTION_FAILED);
311 return NULL; 311 return NULL;
312 } 312 }
313 313
@@ -320,14 +320,14 @@ Tox *tox_encrypted_new(const struct Tox_Options *options, const uint8_t *data, s
320 * returns NULL on failure; see the documentation in toxcore/tox.h. 320 * returns NULL on failure; see the documentation in toxcore/tox.h.
321 */ 321 */
322Tox *tox_encrypted_key_new(const struct Tox_Options *options, const uint8_t *data, size_t length, uint8_t *key, 322Tox *tox_encrypted_key_new(const struct Tox_Options *options, const uint8_t *data, size_t length, uint8_t *key,
323 TOX_ERR_NEW *error) 323 TOX_ERR_ENCRYPTED_NEW *error)
324{ 324{
325 uint32_t decrypt_length = length - TOX_PASS_ENCRYPTION_EXTRA_LENGTH; 325 uint32_t decrypt_length = length - TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
326 uint8_t temp_data[decrypt_length]; 326 uint8_t temp_data[decrypt_length];
327 327
328 if (tox_pass_key_decrypt(data, length, key, temp_data) 328 if (tox_pass_key_decrypt(data, length, key, temp_data)
329 != decrypt_length) { 329 != decrypt_length) {
330 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_LOAD_DECRYPTION_FAILED); 330 SET_ERROR_PARAMETER(error, TOX_ERR_ENCRYPTED_NEW_LOAD_DECRYPTION_FAILED);
331 return NULL; 331 return NULL;
332 } 332 }
333 333