From e6970ad4e6519166e45db81f044153b57cb5c895 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 21 Mar 2017 23:25:40 +0100 Subject: [PATCH] Add explicit casts --- .../poly1305/donna/poly1305_donna32.h | 8 ++++---- .../nosse/pwhash_scryptsalsa208sha256_nosse.c | 2 +- .../curve25519/ref10/x25519_ref10.c | 20 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h index ef57e1f1..e562ac4f 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +++ b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h @@ -225,10 +225,10 @@ poly1305_finish(poly1305_state_internal_t *st, unsigned char mac[16]) f = (unsigned long long) h3 + st->pad[3] + (f >> 32); h3 = (unsigned long) f; - STORE32_LE(mac + 0, h0); - STORE32_LE(mac + 4, h1); - STORE32_LE(mac + 8, h2); - STORE32_LE(mac + 12, h3); + STORE32_LE(mac + 0, (uint32_t) h0); + STORE32_LE(mac + 4, (uint32_t) h1); + STORE32_LE(mac + 8, (uint32_t) h2); + STORE32_LE(mac + 12, (uint32_t) h3); /* zero out the state */ sodium_memzero((void *) st, sizeof *st); diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c index 36e5a80a..9e31352d 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c @@ -334,7 +334,7 @@ escrypt_kdf_nosse(escrypt_local_t *local, const uint8_t *passwd, /* Allocate memory. */ B_size = (size_t) 128 * r * p; - V_size = (size_t) 128 * r * N; + V_size = (size_t) 128 * r * (size_t) N; need = B_size + V_size; if (need < V_size) { errno = ENOMEM; diff --git a/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c b/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c index 7314d737..961ff997 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +++ b/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c @@ -160,16 +160,16 @@ fe_mul121666(fe h, const fe f) h9 += carry8; h8 -= carry8 * ((int64_t)1 << 26); - h[0] = h0; - h[1] = h1; - h[2] = h2; - h[3] = h3; - h[4] = h4; - h[5] = h5; - h[6] = h6; - h[7] = h7; - h[8] = h8; - h[9] = h9; + h[0] = (int32_t) h0; + h[1] = (int32_t) h1; + h[2] = (int32_t) h2; + h[3] = (int32_t) h3; + h[4] = (int32_t) h4; + h[5] = (int32_t) h5; + h[6] = (int32_t) h6; + h[7] = (int32_t) h7; + h[8] = (int32_t) h8; + h[9] = (int32_t) h9; } static int