[tor-commits] [tor/master] Add note about use of tor_memcmp()

nickm at torproject.org nickm at torproject.org
Wed Sep 5 13:12:00 UTC 2018


commit dc7c97945344169ca560a95c73ebc47be582f898
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Sep 5 09:11:53 2018 -0400

    Add note about use of tor_memcmp()
---
 src/lib/ctime/di_ops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/ctime/di_ops.c b/src/lib/ctime/di_ops.c
index 011baf265..73441f84f 100644
--- a/src/lib/ctime/di_ops.c
+++ b/src/lib/ctime/di_ops.c
@@ -23,6 +23,9 @@
  * This implementation differs from memcmp in that its timing behavior is not
  * data-dependent: it should return in the same amount of time regardless of
  * the contents of <b>a</b> and <b>b</b>.
+ *
+ * Note that if all you care about is equality, this implementation is
+ * overkill: it would be better to use tor_memeq() or tor_memneq().
  */
 int
 tor_memcmp(const void *a, const void *b, size_t len)



More information about the tor-commits mailing list