summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-12-31 18:04:46 -0500
committerirungentoo <irungentoo@gmail.com>2014-12-31 18:04:46 -0500
commit3328127f186377018c5ccadc8b33a66661f423dd (patch)
tree3896d3327245ddfd5c3adf6ed6e6a90bc9f690f1 /toxcore
parent473915cced9deca093cd3d42ab5d3b7ccb646cba (diff)
parentbf6fe08d0b287369f9cb1107e155d855b851c7e0 (diff)
Merge branch '1210' of https://github.com/ldrumm/toxcore
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/crypto_core.c6
-rw-r--r--toxcore/crypto_core.h2
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 @@
33/* Use this instead of memcmp; not vulnerable to timing attacks. 33/* Use this instead of memcmp; not vulnerable to timing attacks.
34 returns 0 if both mem locations of length are equal, 34 returns 0 if both mem locations of length are equal,
35 return -1 if they are not. */ 35 return -1 if they are not. */
36int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, uint32_t length) 36int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, size_t length)
37{ 37{
38 if (length == 16) { 38 if (length == 16) {
39 return crypto_verify_16(mem1, mem2); 39 return crypto_verify_16(mem1, mem2);
@@ -41,8 +41,8 @@ int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, uint32_t length)
41 return crypto_verify_32(mem1, mem2); 41 return crypto_verify_32(mem1, mem2);
42 } 42 }
43 43
44 unsigned int i, check = 0; 44 unsigned int check = 0;
45 45 size_t i;
46 for (i = 0; i < length; ++i) { 46 for (i = 0; i < length; ++i) {
47 check |= mem1[i] ^ mem2[i]; 47 check |= mem1[i] ^ mem2[i];
48 } 48 }
diff --git a/toxcore/crypto_core.h b/toxcore/crypto_core.h
index af73638b..58bdc2f3 100644
--- a/toxcore/crypto_core.h
+++ b/toxcore/crypto_core.h
@@ -43,7 +43,7 @@
43/* Use this instead of memcmp; not vulnerable to timing attacks. 43/* Use this instead of memcmp; not vulnerable to timing attacks.
44 returns 0 if both mem locations of length are equal, 44 returns 0 if both mem locations of length are equal,
45 return -1 if they are not. */ 45 return -1 if they are not. */
46int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, uint32_t length); 46int crypto_cmp(const uint8_t *mem1, const uint8_t *mem2, size_t length);
47 47
48/* return a random number. 48/* return a random number.
49 * 49 *