mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
fixes #1210
This commit is contained in:
parent
ffa7a726b2
commit
bf6fe08d0b
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user