Silence/fix some compiler warnings.

Some of these (like the incompatible pointers one) are really annoying for
later refactoring.
This commit is contained in:
iphydf
2016-08-10 13:52:40 +01:00
parent 131522c335
commit fc330c1fa5
5 changed files with 20 additions and 14 deletions
+8 -7
View File
@@ -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
+5 -3
View File
@@ -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.)
@@ -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.
@@ -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);
}
}
+2 -2
View File
@@ -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,
+1 -1
View File
@@ -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.
+4 -1
View File
@@ -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*/