]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- matthew@cvs.openbsd.org 2010/09/24 13:33:00
authorDamien Miller <djm@mindrot.org>
Thu, 7 Oct 2010 10:25:27 +0000 (21:25 +1100)
committerDamien Miller <djm@mindrot.org>
Thu, 7 Oct 2010 10:25:27 +0000 (21:25 +1100)
     [misc.c misc.h configure.ac openbsd-compat/openbsd-compat.h]
     [openbsd-compat/timingsafe_bcmp.c]
     Add timingsafe_bcmp(3) to libc, mention that it's already in the
     kernel in kern(9), and remove it from OpenSSH.
     ok deraadt@, djm@
     NB. re-added under openbsd-compat/ for portable OpenSSH

ChangeLog
configure.ac
misc.c
misc.h
openbsd-compat/openbsd-compat.h
openbsd-compat/timingsafe_bcmp.c [new file with mode: 0644]

index 2b0f5c04539350b8b2cdde38b399d27717c678b7..f29bfd7311dddffbb1712e7b4429c93cb43d3113 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+20101007
+ - (djm) OpenBSD CVS Sync
+   - matthew@cvs.openbsd.org 2010/09/24 13:33:00
+     [misc.c misc.h configure.ac openbsd-compat/openbsd-compat.h]
+     [openbsd-compat/timingsafe_bcmp.c]
+     Add timingsafe_bcmp(3) to libc, mention that it's already in the
+     kernel in kern(9), and remove it from OpenSSH.
+     ok deraadt@, djm@
+     NB. re-added under openbsd-compat/ for portable OpenSSH
+
 20100924
  - (djm) OpenBSD CVS Sync
    - naddy@cvs.openbsd.org 2010/09/10 15:19:29
index d267ba2b165d5ba15c8bfa5860363f445a31f906..9b67e3d475d9ec0f3a91c9ca63d2d95f80f6521f 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.452 2010/09/10 01:39:27 djm Exp $
+# $Id: configure.ac,v 1.453 2010/10/07 10:25:28 djm Exp $
 #
 # Copyright (c) 1999-2004 Damien Miller
 #
@@ -15,7 +15,7 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
-AC_REVISION($Revision: 1.452 $)
+AC_REVISION($Revision: 1.453 $)
 AC_CONFIG_SRCDIR([ssh.c])
 
 AC_CONFIG_HEADER(config.h)
@@ -1434,6 +1434,7 @@ AC_CHECK_FUNCS( \
        swap32 \
        sysconf \
        tcgetpgrp \
+       timingsafe_bcmp \
        truncate \
        unsetenv \
        updwtmpx \
diff --git a/misc.c b/misc.c
index 41c92a82b63f38337324ec463dfaed51a35588b2..ff09becf9a30948a965c0388adb15792ed2de77b 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.81 2010/09/22 22:58:51 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.82 2010/09/24 13:33:00 matthew Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2005,2006 Damien Miller.  All rights reserved.
@@ -850,17 +850,6 @@ ms_to_timeval(struct timeval *tv, int ms)
        tv->tv_usec = (ms % 1000) * 1000;
 }
 
-int
-timingsafe_bcmp(const void *b1, const void *b2, size_t n)
-{
-       const unsigned char *p1 = b1, *p2 = b2;
-       int ret = 0;
-
-       for (; n > 0; n--)
-               ret |= *p1++ ^ *p2++;
-       return (ret != 0);
-}
-
 void
 bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen)
 {
diff --git a/misc.h b/misc.h
index f5aab029bd39b291ca6c42c87a3db4750e5106e2..1368931a0d3436aafb4fcfd7b6842a2cb211fb82 100644 (file)
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.44 2010/09/22 22:58:51 djm Exp $ */
+/* $OpenBSD: misc.h,v 1.45 2010/09/24 13:33:00 matthew Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -36,7 +36,6 @@ void   sanitise_stdfd(void);
 void    ms_subtract_diff(struct timeval *, int *);
 void    ms_to_timeval(struct timeval *, int);
 void    sock_set_v6only(int);
-int     timingsafe_bcmp(const void *, const void *, size_t);
 
 struct passwd *pwcopy(struct passwd *);
 const char *ssh_gai_strerror(int);
index e15d2bd969000558a05118f67a8e6814c422912f..77c5ed2b1ee5a552b571cadd71f9536e3a61579e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: openbsd-compat.h,v 1.50 2010/08/16 03:15:23 dtucker Exp $ */
+/* $Id: openbsd-compat.h,v 1.51 2010/10/07 10:25:29 djm Exp $ */
 
 /*
  * Copyright (c) 1999-2003 Damien Miller.  All rights reserved.
@@ -213,6 +213,10 @@ char *user_from_uid(uid_t, int);
 char *group_from_gid(gid_t, int);
 #endif
 
+#ifndef HAVE_TIMINGSAFE_BCMP
+int timingsafe_bcmp(const void *, const void *, size_t);
+#endif
+
 void *xmmap(size_t size);
 char *xcrypt(const char *password, const char *salt);
 char *shadow_pw(struct passwd *pw);
diff --git a/openbsd-compat/timingsafe_bcmp.c b/openbsd-compat/timingsafe_bcmp.c
new file mode 100644 (file)
index 0000000..7e28c0e
--- /dev/null
@@ -0,0 +1,34 @@
+/*     $OpenBSD: timingsafe_bcmp.c,v 1.1 2010/09/24 13:33:00 matthew Exp $     */
+/*
+ * Copyright (c) 2010 Damien Miller.  All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* OPENBSD ORIGINAL: lib/libc/string/timingsafe_bcmp.c */
+
+#include "includes.h"
+#ifndef HAVE_TIMINGSAFE_BCMP
+
+int
+timingsafe_bcmp(const void *b1, const void *b2, size_t n)
+{
+       const unsigned char *p1 = b1, *p2 = b2;
+       int ret = 0;
+
+       for (; n > 0; n--)
+               ret |= *p1++ ^ *p2++;
+       return (ret != 0);
+}
+
+#endif /* TIMINGSAFE_BCMP */