f14fb60209
* Updating common/lib * Updating lib/csu * Updating lib/libc * Updating libexec/ld.elf_so * Corrected test on __minix in featuretest to actually follow the meaning of the comment. * Cleaned up _REENTRANT-related defintions. * Disabled -D_REENTRANT for libfetch * Removing some unneeded __NBSD_LIBC defines and tests Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
19 lines
395 B
C
19 lines
395 B
C
/* $NetBSD: consttime_bcmp.c,v 1.1 2012/08/30 12:16:49 drochner Exp $ */
|
|
|
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
|
#include <string.h>
|
|
#define consttime_bcmp __consttime_bcmp
|
|
#else
|
|
#include <lib/libkern/libkern.h>
|
|
#endif
|
|
|
|
int
|
|
consttime_bcmp(const void *b1, const void *b2, size_t len)
|
|
{
|
|
const char *c1 = b1, *c2 = b2;
|
|
int res = 0;
|
|
|
|
while (len --)
|
|
res |= *c1++ ^ *c2++;
|
|
return res;
|
|
}
|