summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/misc.c')
-rw-r--r--usr.bin/ssh/misc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 46a66126a1e..837bee85700 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.77 2010/07/02 04:32:44 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.78 2010/07/13 11:52:06 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -830,3 +830,15 @@ ms_to_timeval(struct timeval *tv, int ms)
tv->tv_usec = (ms % 1000) * 1000;
}
+int
+timing_safe_cmp(const void *_s1, const void *_s2, size_t n)
+{
+ u_char *s1 = (u_char *)_s1;
+ u_char *s2 = (u_char *)_s2;
+ int ret = 0;
+
+ for (; n > 0; n--, s1++, s2++)
+ ret |= *s1 ^ *s2;
+ return ret;
+}
+