|
NAMEtimingsafe_bcmp ,
timingsafe_memcmp —
timing-safe byte sequence comparisons
SYNOPSIS#include <string.h>
int
int
DESCRIPTIONThetimingsafe_bcmp () and
timingsafe_memcmp () functions lexicographically
compare the first len bytes (each interpreted as an
unsigned char) pointed to by b1
and b2.
Additionally, their running times are independent of the byte sequences compared, making them safe to use for comparing secret values such as cryptographic MACs. In contrast, bcmp(3) and memcmp(3) may short-circuit after finding the first differing byte. RETURN VALUESThetimingsafe_bcmp () function returns 0 or not zero if
the byte sequence pointed to by b1 compares equal to or
not equal to (respectively) the byte sequence pointed to by
b2.
The SEE ALSObcmp(3), memcmp(3)STANDARDSThetimingsafe_bcmp () and
timingsafe_memcmp () functions are
FreeBSD extensions.
HISTORYThetimingsafe_bcmp () function first appeared in
OpenBSD 4.9.
The Both functions first appeared in FreeBSD 12.0.
Visit the GSP FreeBSD Man Page Interface. |