diff options
author | djm <djm> | 2010-10-07 10:25:27 +0000 |
---|---|---|
committer | djm <djm> | 2010-10-07 10:25:27 +0000 |
commit | b10f76ce9dc3721243651021be3f258f96712b16 (patch) | |
tree | 35a9b1e391ad8eaca44fe3eca4c5b04828efff3f | |
parent | 1cc670c844884f7ef8b76144f21cc383e9e8e3c4 (diff) | |
download | openssh-b10f76ce9dc3721243651021be3f258f96712b16.tar.gz |
- 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
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | misc.c | 13 | ||||
-rw-r--r-- | misc.h | 3 | ||||
-rw-r--r-- | openbsd-compat/openbsd-compat.h | 6 | ||||
-rw-r--r-- | openbsd-compat/timingsafe_bcmp.c | 34 |
6 files changed, 54 insertions, 17 deletions
@@ -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 diff --git a/configure.ac b/configure.ac index d267ba2b..9b67e3d4 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ @@ -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) { @@ -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); diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index e15d2bd9..77c5ed2b 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h @@ -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 index 00000000..7e28c0e2 --- /dev/null +++ b/openbsd-compat/timingsafe_bcmp.c @@ -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 */ |