mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-20 04:56:21 +02:00
Use timingsafe_memcmp() where available.
See ticket 17944; patch from "logan".
This commit is contained in:
parent
9a901aaa01
commit
bc2cd0ff2b
3
changes/17944
Normal file
3
changes/17944
Normal file
@ -0,0 +1,3 @@
|
||||
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 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user