Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence/fix some compiler warnings. #24

Merged
merged 1 commit into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions auto_tests/encryptsave_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *dat
START_TEST(test_known_kdf)
{
unsigned char out[crypto_box_BEFORENMBYTES];
crypto_pwhash_scryptsalsa208sha256(out,
crypto_box_BEFORENMBYTES,
pw,
pwlen,
salt,
crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE * 8,
crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE);
int res = crypto_pwhash_scryptsalsa208sha256(out,
crypto_box_BEFORENMBYTES,
pw,
pwlen,
salt,
crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE * 8,
crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE);
ck_assert_msg(res != -1, "crypto function failed");
ck_assert_msg(memcmp(out, known_key, crypto_box_BEFORENMBYTES) == 0, "derived key is wrong");
}
END_TEST
Expand Down
8 changes: 5 additions & 3 deletions toxav/toxav_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ int toxav_add_av_groupchat(struct Tox *tox, void (*audio_callback)(void *, int,
uint8_t, unsigned int, void *), void *userdata)
{
Messenger *m = (Messenger *)tox;
return add_av_groupchat(m->group_chat_object, audio_callback, userdata);
return add_av_groupchat(m->group_chat_object, (void (*)(Messenger *, int, int, const int16_t *, unsigned int,
uint8_t, unsigned int, void *))audio_callback, userdata);
}

/* Join a AV group (you need to have been invited first.)
Expand All @@ -57,7 +58,8 @@ int toxav_join_av_groupchat(struct Tox *tox, int32_t friendnumber, const uint8_t
void *userdata)
{
Messenger *m = (Messenger *)tox;
return join_av_groupchat(m->group_chat_object, friendnumber, data, length, audio_callback, userdata);
return join_av_groupchat(m->group_chat_object, friendnumber, data, length, (void (*)(Messenger *, int, int,
const int16_t *, unsigned int, uint8_t, unsigned int, void *))audio_callback, userdata);
}

/* Send audio to the group chat.
Expand All @@ -78,4 +80,4 @@ int toxav_group_send_audio(struct Tox *tox, int groupnumber, const int16_t *pcm,
{
Messenger *m = (Messenger *)tox;
return group_send_audio(m->group_chat_object, groupnumber, pcm, samples, channels, sample_rate);
}
}
4 changes: 2 additions & 2 deletions toxcore/crypto_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ int public_key_valid(const uint8_t *public_key)
* encrypt/decrypt operation.
* enc_key has to be crypto_box_BEFORENMBYTES bytes long.
*/
void encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key)
int encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key)
{
crypto_box_beforenm(enc_key, public_key, secret_key);
return crypto_box_beforenm(enc_key, public_key, secret_key);
}

int encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, const uint8_t *plain, uint32_t length,
Expand Down
2 changes: 1 addition & 1 deletion toxcore/crypto_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int decrypt_data(const uint8_t *public_key, const uint8_t *secret_key, const uin
/* Fast encrypt/decrypt operations. Use if this is not a one-time communication.
encrypt_precompute does the shared-key generation once so it does not have
to be preformed on every encrypt/decrypt. */
void encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key);
int encrypt_precompute(const uint8_t *public_key, const uint8_t *secret_key, uint8_t *enc_key);

/* Encrypts plain of length length to encrypted of length + 16 using a
* secret key crypto_box_KEYBYTES big and a 24 byte nonce.
Expand Down
5 changes: 4 additions & 1 deletion toxcore/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,10 @@ int networking_at_startup(void)
#ifdef USE_RANDOMBYTES_STIR
randombytes_stir();
#else
sodium_init();

if (sodium_init() != 0)
return -1;

#endif /*USE_RANDOMBYTES_STIR*/

#endif/*VANILLA_NACL*/
Expand Down