1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Explicit casts

This commit is contained in:
Frank Denis 2017-09-15 01:00:43 +02:00
parent 15ee95c64c
commit 4aba976d5f

View File

@ -35,7 +35,7 @@ tv_hchacha20(void)
unsigned char *in; unsigned char *in;
unsigned char *out; unsigned char *out;
unsigned char *out2; unsigned char *out2;
int i; size_t i;
constant = (unsigned char *) sodium_malloc(crypto_core_hchacha20_CONSTBYTES); constant = (unsigned char *) sodium_malloc(crypto_core_hchacha20_CONSTBYTES);
key = (unsigned char *) sodium_malloc(crypto_core_hchacha20_KEYBYTES); key = (unsigned char *) sodium_malloc(crypto_core_hchacha20_KEYBYTES);
@ -108,7 +108,7 @@ tv_stream_xchacha20(void)
unsigned char *out; unsigned char *out;
unsigned char *out2; unsigned char *out2;
size_t out_len; size_t out_len;
int i; size_t i;
key = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_KEYBYTES); key = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_KEYBYTES);
nonce = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_NONCEBYTES); nonce = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_NONCEBYTES);
@ -217,7 +217,6 @@ tv_secretbox_xchacha20poly1305(void)
unsigned char *out; unsigned char *out;
unsigned char *out2; unsigned char *out2;
size_t m_len; size_t m_len;
size_t out_len;
size_t n; size_t n;
int i; int i;
@ -386,8 +385,8 @@ tv_box_xchacha20poly1305(void)
seed = (unsigned char *) sodium_malloc seed = (unsigned char *) sodium_malloc
(crypto_box_curve25519xchacha20poly1305_SEEDBYTES); (crypto_box_curve25519xchacha20poly1305_SEEDBYTES);
for (i = 0; i < crypto_box_curve25519xchacha20poly1305_SEEDBYTES; i++) { for (i = 0; i <(int) crypto_box_curve25519xchacha20poly1305_SEEDBYTES; i++) {
seed[i] = i; seed[i] = (unsigned char) i;
} }
crypto_box_curve25519xchacha20poly1305_seed_keypair(pk, sk, seed); crypto_box_curve25519xchacha20poly1305_seed_keypair(pk, sk, seed);
sodium_bin2hex(hex, sizeof hex, pk, crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES); sodium_bin2hex(hex, sizeof hex, pk, crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES);