From bf6fe08d0b287369f9cb1107e155d855b851c7e0 Mon Sep 17 00:00:00 2001 From: Luke Drummond Date: Wed, 31 Dec 2014 04:03:40 +0000 Subject: [PATCH] fixes #1210 --- toxcore/crypto_core.c | 6 +++--- toxcore/crypto_core.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index 32d07208..f7f43c10 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c @@ -33,7 +33,7 @@ /* Use this instead of memcmp; not vulnerable to timing attacks. returns 0 if both mem locations of length are equal, return -1 if they are not. */ -int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, uint32_t length) +int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, size_t length) { if (length == 16) { return crypto_verify_16(mem1, mem2); @@ -41,8 +41,8 @@ int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, uint32_t length) return crypto_verify_32(mem1, mem2); } - unsigned int i, check = 0; - + unsigned int check = 0; + size_t i; for (i = 0; i < length; ++i) { check |= mem1[i] ^ mem2[i]; } diff --git a/toxcore/crypto_core.h b/toxcore/crypto_core.h index f19a9790..fb66e724 100644 --- a/toxcore/crypto_core.h +++ b/toxcore/crypto_core.h @@ -43,7 +43,7 @@ /* Use this instead of memcmp; not vulnerable to timing attacks. returns 0 if both mem locations of length are equal, return -1 if they are not. */ -int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, uint32_t length); +int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, size_t length); /* return a random number. *