diff options
author | irungentoo <irungentoo@gmail.com> | 2015-05-27 19:54:04 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-05-27 19:54:04 -0400 |
commit | 3f6a8f10bb519c887d077e79f19700691c5124a9 (patch) | |
tree | 76b9318b8fb10ff8789d31b7474a6ba1c21ff027 /toxencryptsave | |
parent | ce077eeeb3fc418d24176c17bbb07bf47b966021 (diff) |
Allow empty keys in toxencryptsave.
Diffstat (limited to 'toxencryptsave')
-rw-r--r-- | toxencryptsave/toxencryptsave.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c index 162f530c..e6150ce2 100644 --- a/toxencryptsave/toxencryptsave.c +++ b/toxencryptsave/toxencryptsave.c | |||
@@ -96,7 +96,7 @@ bool tox_derive_key_from_pass(const uint8_t *passphrase, size_t pplength, TOX_PA | |||
96 | bool tox_derive_key_with_salt(const uint8_t *passphrase, size_t pplength, const uint8_t *salt, TOX_PASS_KEY *out_key, | 96 | bool tox_derive_key_with_salt(const uint8_t *passphrase, size_t pplength, const uint8_t *salt, TOX_PASS_KEY *out_key, |
97 | TOX_ERR_KEY_DERIVATION *error) | 97 | TOX_ERR_KEY_DERIVATION *error) |
98 | { | 98 | { |
99 | if (pplength == 0 || !passphrase || !salt || !out_key) { | 99 | if (!salt || !out_key || (!passphrase && pplength != 0)) { |
100 | SET_ERROR_PARAMETER(error, TOX_ERR_KEY_DERIVATION_NULL); | 100 | SET_ERROR_PARAMETER(error, TOX_ERR_KEY_DERIVATION_NULL); |
101 | return 0; | 101 | return 0; |
102 | } | 102 | } |
@@ -255,7 +255,7 @@ bool tox_pass_key_decrypt(const uint8_t *data, size_t length, const TOX_PASS_KEY | |||
255 | bool tox_pass_decrypt(const uint8_t *data, size_t length, const uint8_t *passphrase, size_t pplength, uint8_t *out, | 255 | bool tox_pass_decrypt(const uint8_t *data, size_t length, const uint8_t *passphrase, size_t pplength, uint8_t *out, |
256 | TOX_ERR_DECRYPTION *error) | 256 | TOX_ERR_DECRYPTION *error) |
257 | { | 257 | { |
258 | if (length <= TOX_PASS_ENCRYPTION_EXTRA_LENGTH || pplength == 0) { | 258 | if (length <= TOX_PASS_ENCRYPTION_EXTRA_LENGTH) { |
259 | SET_ERROR_PARAMETER(error, TOX_ERR_DECRYPTION_INVALID_LENGTH); | 259 | SET_ERROR_PARAMETER(error, TOX_ERR_DECRYPTION_INVALID_LENGTH); |
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |