summaryrefslogtreecommitdiff
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
parente11e1ea5d475ee8be0038d64aa3e47c776295ac2 (diff)
- djm@cvs.openbsd.org 2010/07/21 02:10:58
[misc.c] sync timingsafe_bcmp() with the one dempsky@ committed to sys/lib/libkern
-rw-r--r--ChangeLog3
-rw-r--r--misc.c14
2 files changed, 9 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index b43074ec9..9a9d0db91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,9 @@
24 duration of inactivity. bz#1330 - patch by dwmw2 AT infradead.org, but 24 duration of inactivity. bz#1330 - patch by dwmw2 AT infradead.org, but
25 further hacked on by wmertens AT cisco.com, apb AT cequrux.com, 25 further hacked on by wmertens AT cisco.com, apb AT cequrux.com,
26 martin-mindrot-bugzilla AT earth.li and myself; "looks ok" markus@ 26 martin-mindrot-bugzilla AT earth.li and myself; "looks ok" markus@
27 - djm@cvs.openbsd.org 2010/07/21 02:10:58
28 [misc.c]
29 sync timingsafe_bcmp() with the one dempsky@ committed to sys/lib/libkern
27 30
2820100819 3120100819
29 - (dtucker) [contrib/ssh-copy-ud.1] Bug #1786: update ssh-copy-id.1 with more 32 - (dtucker) [contrib/ssh-copy-ud.1] Bug #1786: update ssh-copy-id.1 with more
diff --git a/misc.c b/misc.c
index 52f814fa2..a82e7936e 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.79 2010/07/13 23:13:16 djm Exp $ */ 1/* $OpenBSD: misc.c,v 1.80 2010/07/21 02:10:58 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -851,17 +851,15 @@ ms_to_timeval(struct timeval *tv, int ms)
851} 851}
852 852
853int 853int
854timingsafe_bcmp(const void *_s1, const void *_s2, size_t n) 854timingsafe_bcmp(const void *b1, const void *b2, size_t n)
855{ 855{
856 u_char *s1 = (u_char *)_s1; 856 const unsigned char *p1 = b1, *p2 = b2;
857 u_char *s2 = (u_char *)_s2;
858 int ret = 0; 857 int ret = 0;
859 858
860 for (; n > 0; n--, s1++, s2++) 859 for (; n > 0; n--)
861 ret |= *s1 ^ *s2; 860 ret |= *p1++ ^ *p2++;
862 return ret; 861 return (ret != 0);
863} 862}
864
865void 863void
866sock_set_v6only(int s) 864sock_set_v6only(int s)
867{ 865{