From 6b9f781bed990148fba5a66a4a071c754c9acf68 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Thu, 29 Nov 2018 22:32:39 +0100 Subject: [PATCH] Convert int indices to size_t Fixes #111 (MSVC warnings) All indices in Monocypher are size_t. We might as well be consistent. --- src/monocypher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index 6ea9832..0ccd181 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1288,7 +1288,7 @@ static void trim_scalar(u8 s[32]) s[31] |= 64; } -static int scalar_bit(const u8 s[32], int i) { return (s[i>>3] >> (i&7)) & 1; } +static int scalar_bit(const u8 s[32], size_t i) {return (s[i>>3] >> (i&7)) & 1;} int crypto_x25519(u8 raw_shared_secret[32], const u8 your_secret_key [32], @@ -1600,7 +1600,7 @@ static void slide(i8 adds[258], const u8 scalar[32]) if (adds[i] > 16) { // go back to [-15, 15], propagate carry. adds[i] -= 32; - int j = i + 5; + size_t j = i + 5; while (adds[j] != 0) { adds[j] = 0; j++; -- 2.47.3