diff options
author | irungentoo <irungentoo@gmail.com> | 2015-02-14 23:00:12 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-02-14 23:00:12 -0500 |
commit | 3c7888d7523f876740084c7315e31f973920212b (patch) | |
tree | b00246db826e52ae20ba5542fe96b6dd56512a18 /toxencryptsave | |
parent | eac0d435f35db468435fa596a3b00b593d6bf3e9 (diff) |
A bit of new api work done.
Diffstat (limited to 'toxencryptsave')
-rw-r--r-- | toxencryptsave/defines.h | 2 | ||||
-rw-r--r-- | toxencryptsave/toxencryptsave.c | 7 | ||||
-rw-r--r-- | toxencryptsave/toxencryptsave.h | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/toxencryptsave/defines.h b/toxencryptsave/defines.h new file mode 100644 index 00000000..e3fca073 --- /dev/null +++ b/toxencryptsave/defines.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #define TOX_ENC_SAVE_MAGIC_NUMBER "toxEsave" | ||
2 | #define TOX_ENC_SAVE_MAGIC_LENGTH 8 | ||
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c index 9172f512..13a34dea 100644 --- a/toxencryptsave/toxencryptsave.c +++ b/toxencryptsave/toxencryptsave.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "toxencryptsave.h" | 28 | #include "toxencryptsave.h" |
29 | #include "defines.h" | ||
29 | #include "../toxcore/crypto_core.h" | 30 | #include "../toxcore/crypto_core.h" |
30 | #include "../toxcore/tox.h" | 31 | #include "../toxcore/tox.h" |
31 | 32 | ||
@@ -64,7 +65,7 @@ int tox_pass_salt_length() | |||
64 | /* return size of the messenger data (for encrypted saving). */ | 65 | /* return size of the messenger data (for encrypted saving). */ |
65 | uint32_t tox_encrypted_size(const Tox *tox) | 66 | uint32_t tox_encrypted_size(const Tox *tox) |
66 | { | 67 | { |
67 | return tox_size(tox) + TOX_PASS_ENCRYPTION_EXTRA_LENGTH; | 68 | return tox_save_size(tox) + TOX_PASS_ENCRYPTION_EXTRA_LENGTH; |
68 | } | 69 | } |
69 | 70 | ||
70 | /* This retrieves the salt used to encrypt the given data, which can then be passed to | 71 | /* This retrieves the salt used to encrypt the given data, which can then be passed to |
@@ -203,7 +204,7 @@ int tox_pass_encrypt(const uint8_t *data, uint32_t data_len, uint8_t *passphrase | |||
203 | int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint32_t pplength) | 204 | int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint32_t pplength) |
204 | { | 205 | { |
205 | /* first get plain save data */ | 206 | /* first get plain save data */ |
206 | uint32_t temp_size = tox_size(tox); | 207 | uint32_t temp_size = tox_save_size(tox); |
207 | uint8_t temp_data[temp_size]; | 208 | uint8_t temp_data[temp_size]; |
208 | tox_save(tox, temp_data); | 209 | tox_save(tox, temp_data); |
209 | 210 | ||
@@ -220,7 +221,7 @@ int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint3 | |||
220 | int tox_encrypted_key_save(const Tox *tox, uint8_t *data, uint8_t *key) | 221 | int tox_encrypted_key_save(const Tox *tox, uint8_t *data, uint8_t *key) |
221 | { | 222 | { |
222 | /* first get plain save data */ | 223 | /* first get plain save data */ |
223 | uint32_t temp_size = tox_size(tox); | 224 | uint32_t temp_size = tox_save_size(tox); |
224 | uint8_t temp_data[temp_size]; | 225 | uint8_t temp_data[temp_size]; |
225 | tox_save(tox, temp_data); | 226 | tox_save(tox, temp_data); |
226 | 227 | ||
diff --git a/toxencryptsave/toxencryptsave.h b/toxencryptsave/toxencryptsave.h index 169f736c..da13f312 100644 --- a/toxencryptsave/toxencryptsave.h +++ b/toxencryptsave/toxencryptsave.h | |||
@@ -30,8 +30,8 @@ extern "C" { | |||
30 | 30 | ||
31 | #include <stdint.h> | 31 | #include <stdint.h> |
32 | 32 | ||
33 | #ifndef __TOX_DEFINED__ | 33 | #ifndef TOX_DEFINED |
34 | #define __TOX_DEFINED__ | 34 | #define TOX_DEFINED |
35 | typedef struct Tox Tox; | 35 | typedef struct Tox Tox; |
36 | #endif | 36 | #endif |
37 | 37 | ||