aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-12-29 09:43:01 -0500
committerNick Mathewson <nickm@torproject.org>2015-12-29 09:43:01 -0500
commitbc2cd0ff2bfc70916efe6b6a7fe0a4aae481df3b (patch)
tree487541c12f604a0d485d1c5f8d6d2f634258af2c /src/common
parent9a901aaa01eb3c362cc84836b54307b32f44295b (diff)
downloadtor-bc2cd0ff2bfc70916efe6b6a7fe0a4aae481df3b.tar.gz
tor-bc2cd0ff2bfc70916efe6b6a7fe0a4aae481df3b.zip
Use timingsafe_memcmp() where available.
See ticket 17944; patch from "logan".
Diffstat (limited to 'src/common')
-rw-r--r--src/common/di_ops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/di_ops.c b/src/common/di_ops.c
index c9d1350880..70f2da7377 100644
--- a/src/common/di_ops.c
+++ b/src/common/di_ops.c
@@ -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 */
}
/**