mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01: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 \
|
backtrace_symbols_fd \
|
||||||
clock_gettime \
|
clock_gettime \
|
||||||
eventfd \
|
eventfd \
|
||||||
|
timingsafe_memcmp \
|
||||||
flock \
|
flock \
|
||||||
ftime \
|
ftime \
|
||||||
getaddrinfo \
|
getaddrinfo \
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
int
|
int
|
||||||
tor_memcmp(const void *a, const void *b, size_t len)
|
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 *x = a;
|
||||||
const uint8_t *y = b;
|
const uint8_t *y = b;
|
||||||
size_t i = len;
|
size_t i = len;
|
||||||
@ -83,6 +86,7 @@ tor_memcmp(const void *a, const void *b, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
#endif /* timingsafe_memcmp */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user