summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-08-03 16:05:05 +1000
committerDamien Miller <djm@mindrot.org>2010-08-03 16:05:05 +1000
commit8c1eb113efb7e78c239acce90b19b12234352906 (patch)
tree5f82e5fb0e04136f2e3a627ccad5eecb41497b49 /misc.c
parente11e1ea5d475ee8be0038d64aa3e47c776295ac2 (diff)
downloadopenssh-git-8c1eb113efb7e78c239acce90b19b12234352906.tar.gz
- djm@cvs.openbsd.org 2010/07/21 02:10:58
[misc.c] sync timingsafe_bcmp() with the one dempsky@ committed to sys/lib/libkern
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/misc.c b/misc.c
index 52f814fa..a82e7936 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.79 2010/07/13 23:13:16 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.80 2010/07/21 02:10:58 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -851,17 +851,15 @@ ms_to_timeval(struct timeval *tv, int ms)
}
int
-timingsafe_bcmp(const void *_s1, const void *_s2, size_t n)
+timingsafe_bcmp(const void *b1, const void *b2, size_t n)
{
- u_char *s1 = (u_char *)_s1;
- u_char *s2 = (u_char *)_s2;
+ const unsigned char *p1 = b1, *p2 = b2;
int ret = 0;
- for (; n > 0; n--, s1++, s2++)
- ret |= *s1 ^ *s2;
- return ret;
+ for (; n > 0; n--)
+ ret |= *p1++ ^ *p2++;
+ return (ret != 0);
}
-
void
sock_set_v6only(int s)
{