1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 02:25:14 -07:00

size -> len, for consistency

This commit is contained in:
Frank Denis 2014-04-15 00:42:05 -07:00 committed by evoskuil
parent c6f1a2670a
commit 87ebd75469
2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ SODIUM_EXPORT
void sodium_memzero(void * const pnt, const size_t len);
SODIUM_EXPORT
int sodium_memcmp(const void * const b1_, const void * const b2_, size_t size);
int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len);
SODIUM_EXPORT
char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,

View File

@ -36,14 +36,14 @@ sodium_memzero(void * const pnt, const size_t len)
}
int
sodium_memcmp(const void * const b1_, const void * const b2_, size_t size)
sodium_memcmp(const void * const b1_, const void * const b2_, size_t len)
{
const unsigned char *b1 = (const unsigned char *) b1_;
const unsigned char *b2 = (const unsigned char *) b2_;
size_t i;
unsigned char d = (unsigned char) 0U;
for (i = 0U; i < size; i++) {
for (i = 0U; i < len; i++) {
d |= b1[i] ^ b2[i];
}
return (int) ((1 & ((d - 1) >> 8)) - 1);