This commit is contained in:
irungentoo 2014-12-31 18:04:46 -05:00
commit 3328127f18
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 4 additions and 4 deletions

View File

@ -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];
}

View File

@ -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.
*