Commit bc2cd0ff authored by Nick Mathewson's avatar Nick Mathewson 🐻
Browse files

Use timingsafe_memcmp() where available.

See ticket 17944; patch from "logan".
parent 9a901aaa
o Minor features (portability):
- Use timingsafe_memcmp() where available. Closes ticket 17944;
patch from "logan".
......@@ -381,6 +381,7 @@ AC_CHECK_FUNCS(
backtrace_symbols_fd \
clock_gettime \
eventfd \
timingsafe_memcmp \
flock \
ftime \
getaddrinfo \
......
......@@ -25,6 +25,9 @@
int
tor_memcmp(const void *a, const void *b, size_t len)
{
#ifdef HAVE_TIMINGSAFE_MEMCMP
return timingsafe_memcmp(a, b, len);
#else
const uint8_t *x = a;
const uint8_t *y = b;
size_t i = len;
......@@ -83,6 +86,7 @@ tor_memcmp(const void *a, const void *b, size_t len)
}
return retval;
#endif /* timingsafe_memcmp */
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment