diff options
author | Dubslow <bunslow@gmail.com> | 2014-09-09 12:23:09 -0500 |
---|---|---|
committer | Dubslow <bunslow@gmail.com> | 2014-09-09 12:23:09 -0500 |
commit | 7eb7e68805aa795dcb6dbd1a35113ce703e24267 (patch) | |
tree | 4a8753004403e48d42a7924ad1933a7dfe2e9003 /toxencryptsave/toxencryptsave.h | |
parent | 46e03c4c2beaf01ec5a6bc090b80fae7bf1da2a0 (diff) |
compiling against nacl seems to break VANILLA_NACL...
Diffstat (limited to 'toxencryptsave/toxencryptsave.h')
-rw-r--r-- | toxencryptsave/toxencryptsave.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/toxencryptsave/toxencryptsave.h b/toxencryptsave/toxencryptsave.h new file mode 100644 index 00000000..f28ea731 --- /dev/null +++ b/toxencryptsave/toxencryptsave.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* toxencryptsave.h | ||
2 | * | ||
3 | * The Tox encrypted save functions. | ||
4 | * | ||
5 | * Copyright (C) 2013 Tox project All Rights Reserved. | ||
6 | * | ||
7 | * This file is part of Tox. | ||
8 | * | ||
9 | * Tox is free software: you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation, either version 3 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * Tox is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef TOXENCRYPTSAVE_H | ||
25 | #define TOXENCRYPTSAVE_H | ||
26 | |||
27 | #ifdef VANILLA_NACL | ||
28 | #include "crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h" | ||
29 | #include "crypto_pwhash_scryptsalsa208sha256/utils.h" /* sodium_memzero */ | ||
30 | #endif | ||
31 | |||
32 | #include "../toxcore/tox.h" | ||
33 | #include "../toxcore/crypto_core.h" | ||
34 | |||
35 | #ifdef __cplusplus | ||
36 | extern "C" { | ||
37 | #endif | ||
38 | |||
39 | /* This "module" provides functions analogous to tox_load and tox_save in toxcore | ||
40 | * Clients should consider alerting their users that, unlike plain data, if even one bit | ||
41 | * becomes corrupted, the data will be entirely unrecoverable. | ||
42 | * Ditto if they forget their password, there is no way to recover the data. | ||
43 | */ | ||
44 | |||
45 | /* return size of the messenger data (for encrypted saving). */ | ||
46 | uint32_t tox_encrypted_size(const Tox *tox); | ||
47 | |||
48 | /* Save the messenger data encrypted with the given password. | ||
49 | * data must be at least tox_encrypted_size(). | ||
50 | * | ||
51 | * returns 0 on success | ||
52 | * returns -1 on failure | ||
53 | */ | ||
54 | int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint32_t pplength); | ||
55 | |||
56 | /* Load the messenger from encrypted data of size length. | ||
57 | * | ||
58 | * returns 0 on success | ||
59 | * returns -1 on failure | ||
60 | */ | ||
61 | int tox_encrypted_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t *passphrase, uint32_t pplength); | ||
62 | |||
63 | #ifdef __cplusplus | ||
64 | } | ||
65 | #endif | ||
66 | |||
67 | #endif | ||