summaryrefslogtreecommitdiff
path: root/toxencryptsave
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-05-26 12:57:14 -0400
committerirungentoo <irungentoo@gmail.com>2015-05-26 12:57:14 -0400
commit51c5810d72cd81c0aaec9c10289185294112f3f5 (patch)
treeb4608b62b219e5b36b16c2b9a862d92a4d56053d /toxencryptsave
parent441e0073625b7ae9c69e977f510a8295e388a198 (diff)
These parameters should have been const.
Diffstat (limited to 'toxencryptsave')
-rw-r--r--toxencryptsave/toxencryptsave.c8
-rw-r--r--toxencryptsave/toxencryptsave.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c
index e2f28a58..162f530c 100644
--- a/toxencryptsave/toxencryptsave.c
+++ b/toxencryptsave/toxencryptsave.c
@@ -82,7 +82,7 @@ bool tox_get_salt(const uint8_t *data, uint8_t *salt)
82 * 82 *
83 * returns true on success 83 * returns true on success
84 */ 84 */
85bool tox_derive_key_from_pass(uint8_t *passphrase, size_t pplength, TOX_PASS_KEY *out_key, 85bool tox_derive_key_from_pass(const uint8_t *passphrase, size_t pplength, TOX_PASS_KEY *out_key,
86 TOX_ERR_KEY_DERIVATION *error) 86 TOX_ERR_KEY_DERIVATION *error)
87{ 87{
88 uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES]; 88 uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES];
@@ -93,7 +93,7 @@ bool tox_derive_key_from_pass(uint8_t *passphrase, size_t pplength, TOX_PASS_KEY
93/* Same as above, except with use the given salt for deterministic key derivation. 93/* Same as above, except with use the given salt for deterministic key derivation.
94 * The salt must be TOX_PASS_SALT_LENGTH bytes in length. 94 * The salt must be TOX_PASS_SALT_LENGTH bytes in length.
95 */ 95 */
96bool tox_derive_key_with_salt(uint8_t *passphrase, size_t pplength, uint8_t *salt, TOX_PASS_KEY *out_key, 96bool 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 (pplength == 0 || !passphrase || !salt || !out_key) {
@@ -180,7 +180,7 @@ bool tox_pass_key_encrypt(const uint8_t *data, size_t data_len, const TOX_PASS_K
180 * 180 *
181 * returns true on success 181 * returns true on success
182 */ 182 */
183bool tox_pass_encrypt(const uint8_t *data, size_t data_len, uint8_t *passphrase, size_t pplength, uint8_t *out, 183bool tox_pass_encrypt(const uint8_t *data, size_t data_len, const uint8_t *passphrase, size_t pplength, uint8_t *out,
184 TOX_ERR_ENCRYPTION *error) 184 TOX_ERR_ENCRYPTION *error)
185{ 185{
186 TOX_PASS_KEY key; 186 TOX_PASS_KEY key;
@@ -252,7 +252,7 @@ bool tox_pass_key_decrypt(const uint8_t *data, size_t length, const TOX_PASS_KEY
252 * 252 *
253 * returns true on success 253 * returns true on success
254 */ 254 */
255bool tox_pass_decrypt(const uint8_t *data, size_t length, uint8_t *passphrase, size_t pplength, uint8_t *out, 255bool 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 || pplength == 0) {
diff --git a/toxencryptsave/toxencryptsave.h b/toxencryptsave/toxencryptsave.h
index c077d899..9e28b48e 100644
--- a/toxencryptsave/toxencryptsave.h
+++ b/toxencryptsave/toxencryptsave.h
@@ -143,7 +143,7 @@ typedef enum TOX_ERR_DECRYPTION {
143 * 143 *
144 * returns true on success 144 * returns true on success
145 */ 145 */
146bool tox_pass_encrypt(const uint8_t *data, size_t data_len, uint8_t *passphrase, size_t pplength, uint8_t *out, 146bool tox_pass_encrypt(const uint8_t *data, size_t data_len, const uint8_t *passphrase, size_t pplength, uint8_t *out,
147 TOX_ERR_ENCRYPTION *error); 147 TOX_ERR_ENCRYPTION *error);
148 148
149 149
@@ -155,7 +155,7 @@ bool tox_pass_encrypt(const uint8_t *data, size_t data_len, uint8_t *passphrase,
155 * 155 *
156 * returns true on success 156 * returns true on success
157 */ 157 */
158bool tox_pass_decrypt(const uint8_t *data, size_t length, uint8_t *passphrase, size_t pplength, uint8_t *out, 158bool tox_pass_decrypt(const uint8_t *data, size_t length, const uint8_t *passphrase, size_t pplength, uint8_t *out,
159 TOX_ERR_DECRYPTION *error); 159 TOX_ERR_DECRYPTION *error);
160 160
161 161
@@ -183,13 +183,13 @@ typedef struct {
183 * 183 *
184 * returns true on success 184 * returns true on success
185 */ 185 */
186bool tox_derive_key_from_pass(uint8_t *passphrase, size_t pplength, TOX_PASS_KEY *out_key, 186bool tox_derive_key_from_pass(const uint8_t *passphrase, size_t pplength, TOX_PASS_KEY *out_key,
187 TOX_ERR_KEY_DERIVATION *error); 187 TOX_ERR_KEY_DERIVATION *error);
188 188
189/* Same as above, except use the given salt for deterministic key derivation. 189/* Same as above, except use the given salt for deterministic key derivation.
190 * The salt must be TOX_PASS_SALT_LENGTH bytes in length. 190 * The salt must be TOX_PASS_SALT_LENGTH bytes in length.
191 */ 191 */
192bool tox_derive_key_with_salt(uint8_t *passphrase, size_t pplength, uint8_t *salt, TOX_PASS_KEY *out_key, 192bool tox_derive_key_with_salt(const uint8_t *passphrase, size_t pplength, const uint8_t *salt, TOX_PASS_KEY *out_key,
193 TOX_ERR_KEY_DERIVATION *error); 193 TOX_ERR_KEY_DERIVATION *error);
194 194
195/* This retrieves the salt used to encrypt the given data, which can then be passed to 195/* This retrieves the salt used to encrypt the given data, which can then be passed to