From 4aba976d5f9dc9d64c3e2b908faefa24de48d3f5 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 15 Sep 2017 01:00:43 +0200 Subject: [PATCH] Explicit casts --- test/default/xchacha20.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/default/xchacha20.c b/test/default/xchacha20.c index 15e5b9a1..1f746654 100644 --- a/test/default/xchacha20.c +++ b/test/default/xchacha20.c @@ -35,7 +35,7 @@ tv_hchacha20(void) unsigned char *in; unsigned char *out; unsigned char *out2; - int i; + size_t i; constant = (unsigned char *) sodium_malloc(crypto_core_hchacha20_CONSTBYTES); key = (unsigned char *) sodium_malloc(crypto_core_hchacha20_KEYBYTES); @@ -108,7 +108,7 @@ tv_stream_xchacha20(void) unsigned char *out; unsigned char *out2; size_t out_len; - int i; + size_t i; key = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_KEYBYTES); nonce = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_NONCEBYTES); @@ -217,7 +217,6 @@ tv_secretbox_xchacha20poly1305(void) unsigned char *out; unsigned char *out2; size_t m_len; - size_t out_len; size_t n; int i; @@ -386,8 +385,8 @@ tv_box_xchacha20poly1305(void) seed = (unsigned char *) sodium_malloc (crypto_box_curve25519xchacha20poly1305_SEEDBYTES); - for (i = 0; i < crypto_box_curve25519xchacha20poly1305_SEEDBYTES; i++) { - seed[i] = i; + for (i = 0; i <(int) crypto_box_curve25519xchacha20poly1305_SEEDBYTES; i++) { + seed[i] = (unsigned char) i; } crypto_box_curve25519xchacha20poly1305_seed_keypair(pk, sk, seed); sodium_bin2hex(hex, sizeof hex, pk, crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES);