summaryrefslogtreecommitdiff
path: root/toxencryptsave/toxencryptsave.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxencryptsave/toxencryptsave.c')
-rw-r--r--toxencryptsave/toxencryptsave.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c
index d1926246..6567eb96 100644
--- a/toxencryptsave/toxencryptsave.c
+++ b/toxencryptsave/toxencryptsave.c
@@ -40,9 +40,15 @@
40 40
41#define TOX_PASS_KEY_LENGTH (crypto_box_KEYBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES) 41#define TOX_PASS_KEY_LENGTH (crypto_box_KEYBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
42 42
43int tox_pass_encryption_extra_length() {return TOX_PASS_ENCRYPTION_EXTRA_LENGTH;} 43int tox_pass_encryption_extra_length()
44{
45 return TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
46}
44 47
45int tox_pass_key_length() {return TOX_PASS_KEY_LENGTH;} 48int tox_pass_key_length()
49{
50 return TOX_PASS_KEY_LENGTH;
51}
46 52
47/* This "module" provides functions analogous to tox_load and tox_save in toxcore 53/* This "module" provides functions analogous to tox_load and tox_save in toxcore
48 * Clients should consider alerting their users that, unlike plain data, if even one bit 54 * Clients should consider alerting their users that, unlike plain data, if even one bit
@@ -181,7 +187,7 @@ int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint3
181 * returns 0 on success 187 * returns 0 on success
182 * returns -1 on failure 188 * returns -1 on failure
183 */ 189 */
184int tox_encrypted_key_save(const Tox* tox, uint8_t* data, uint8_t* key) 190int tox_encrypted_key_save(const Tox *tox, uint8_t *data, uint8_t *key)
185{ 191{
186 /* first get plain save data */ 192 /* first get plain save data */
187 uint32_t temp_size = tox_size(tox); 193 uint32_t temp_size = tox_size(tox);
@@ -287,7 +293,7 @@ int tox_encrypted_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t *
287 * returns 0 on success 293 * returns 0 on success
288 * returns -1 on failure 294 * returns -1 on failure
289 */ 295 */
290int tox_encrypted_key_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t* key) 296int tox_encrypted_key_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t *key)
291{ 297{
292 if (memcmp(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH) != 0) 298 if (memcmp(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH) != 0)
293 return -1; 299 return -1;