summaryrefslogtreecommitdiff
path: root/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c')
-rw-r--r--protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c b/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c
index b83d6f1c6c..7c81f72272 100644
--- a/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c
+++ b/protocols/Tox/libtox/src/toxencryptsave/toxencryptsave.c
@@ -29,7 +29,7 @@
#include "../toxcore/crypto_core.h"
#include "defines.h"
#include "toxencryptsave.h"
-#define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}}
+#define SET_ERROR_PARAMETER(param, x) do { if (param) { *param = x; } } while (0)
#ifdef VANILLA_NACL
#include <crypto_box.h>
@@ -40,6 +40,7 @@
#include <sodium.h>
#endif
+#include <stdlib.h>
#include <string.h>
#if TOX_PASS_SALT_LENGTH != crypto_pwhash_scryptsalsa208sha256_SALTBYTES
@@ -123,7 +124,7 @@ Tox_Pass_Key *tox_pass_key_derive(const uint8_t *passphrase, size_t pplength,
TOX_ERR_KEY_DERIVATION *error)
{
uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES];
- randombytes(salt, sizeof salt);
+ random_bytes(salt, sizeof salt);
return tox_pass_key_derive_with_salt(passphrase, pplength, salt, error);
}
@@ -156,7 +157,7 @@ Tox_Pass_Key *tox_pass_key_derive_with_salt(const uint8_t *passphrase, size_t pp
return nullptr;
}
- sodium_memzero(passkey, crypto_hash_sha256_BYTES); /* wipe plaintext pw */
+ crypto_memzero(passkey, crypto_hash_sha256_BYTES); /* wipe plaintext pw */
Tox_Pass_Key *out_key = (Tox_Pass_Key *)malloc(sizeof(Tox_Pass_Key));