summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/crypto_core.c4
-rw-r--r--toxcore/crypto_core.h2
-rw-r--r--toxcore/network.c5
3 files changed, 7 insertions, 4 deletions
diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c
index a733c38e..3b379ca6 100644
--- a/toxcore/crypto_core.c
+++ b/toxcore/crypto_core.c
@@ -76,9 +76,9 @@ int public_key_valid(const uint8_t *public_key)
76 * encrypt/decrypt operation. 76 * encrypt/decrypt operation.
77 * enc_key has to be crypto_box_BEFORENMBYTES bytes long. 77 * enc_key has to be crypto_box_BEFORENMBYTES bytes long.
78 */ 78 */
79void encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key) 79int encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key)
80{ 80{
81 crypto_box_beforenm(enc_key, public_key, secret_key); 81 return crypto_box_beforenm(enc_key, public_key, secret_key);
82} 82}
83 83
84int encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *plain, uint32_t length, 84int encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *plain, uint32_t length,
diff --git a/toxcore/crypto_core.h b/toxcore/crypto_core.h
index ab509f09..1c9d7f94 100644
--- a/toxcore/crypto_core.h
+++ b/toxcore/crypto_core.h
@@ -87,7 +87,7 @@ int decrypt_data(const uint8_t *public_key, const uint8_t *secret_key, const uin
87/* Fast encrypt/decrypt operations. Use if this is not a one-time communication. 87/* Fast encrypt/decrypt operations. Use if this is not a one-time communication.
88 encrypt_precompute does the shared-key generation once so it does not have 88 encrypt_precompute does the shared-key generation once so it does not have
89 to be preformed on every encrypt/decrypt. */ 89 to be preformed on every encrypt/decrypt. */
90void encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key); 90int encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key);
91 91
92/* Encrypts plain of length length to encrypted of length + 16 using a 92/* Encrypts plain of length length to encrypted of length + 16 using a
93 * secret key crypto_box_KEYBYTES big and a 24 byte nonce. 93 * secret key crypto_box_KEYBYTES big and a 24 byte nonce.
diff --git a/toxcore/network.c b/toxcore/network.c
index c6cf6ed4..244512c0 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -451,7 +451,10 @@ int networking_at_startup(void)
451#ifdef USE_RANDOMBYTES_STIR 451#ifdef USE_RANDOMBYTES_STIR
452 randombytes_stir(); 452 randombytes_stir();
453#else 453#else
454 sodium_init(); 454
455 if (sodium_init() != 0)
456 return -1;
457
455#endif /*USE_RANDOMBYTES_STIR*/ 458#endif /*USE_RANDOMBYTES_STIR*/
456 459
457#endif/*VANILLA_NACL*/ 460#endif/*VANILLA_NACL*/