summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-10-07 21:25:27 +1100
committerDamien Miller <djm@mindrot.org>2010-10-07 21:25:27 +1100
commitaa18063baf35e303832d9ec58204ffaab221de85 (patch)
tree0b3b3e436ca70f27734c99f6ace5503418b99001
parent2beb32f290390c4f7c2a86dd5d096475e3b76c5b (diff)
- 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--ChangeLog10
-rw-r--r--configure.ac5
-rw-r--r--misc.c13
-rw-r--r--misc.h3
-rw-r--r--openbsd-compat/openbsd-compat.h6
-rw-r--r--openbsd-compat/timingsafe_bcmp.c34
6 files changed, 54 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b0f5c045..f29bfd731 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
120101007
2 - (djm) OpenBSD CVS Sync
3 - matthew@cvs.openbsd.org 2010/09/24 13:33:00
4 [misc.c misc.h configure.ac openbsd-compat/openbsd-compat.h]
5 [openbsd-compat/timingsafe_bcmp.c]
6 Add timingsafe_bcmp(3) to libc, mention that it's already in the
7 kernel in kern(9), and remove it from OpenSSH.
8 ok deraadt@, djm@
9 NB. re-added under openbsd-compat/ for portable OpenSSH
10
120100924 1120100924
2 - (djm) OpenBSD CVS Sync 12 - (djm) OpenBSD CVS Sync
3 - naddy@cvs.openbsd.org 2010/09/10 15:19:29 13 - naddy@cvs.openbsd.org 2010/09/10 15:19:29
diff --git a/configure.ac b/configure.ac
index d267ba2b1..9b67e3d47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.452 2010/09/10 01:39:27 djm Exp $ 1# $Id: configure.ac,v 1.453 2010/10/07 10:25:28 djm Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -15,7 +15,7 @@
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16
17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) 17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18AC_REVISION($Revision: 1.452 $) 18AC_REVISION($Revision: 1.453 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20 20
21AC_CONFIG_HEADER(config.h) 21AC_CONFIG_HEADER(config.h)
@@ -1434,6 +1434,7 @@ AC_CHECK_FUNCS( \
1434 swap32 \ 1434 swap32 \
1435 sysconf \ 1435 sysconf \
1436 tcgetpgrp \ 1436 tcgetpgrp \
1437 timingsafe_bcmp \
1437 truncate \ 1438 truncate \
1438 unsetenv \ 1439 unsetenv \
1439 updwtmpx \ 1440 updwtmpx \
diff --git a/misc.c b/misc.c
index 41c92a82b..ff09becf9 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.81 2010/09/22 22:58:51 djm Exp $ */ 1/* $OpenBSD: misc.c,v 1.82 2010/09/24 13:33:00 matthew 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.
@@ -850,17 +850,6 @@ ms_to_timeval(struct timeval *tv, int ms)
850 tv->tv_usec = (ms % 1000) * 1000; 850 tv->tv_usec = (ms % 1000) * 1000;
851} 851}
852 852
853int
854timingsafe_bcmp(const void *b1, const void *b2, size_t n)
855{
856 const unsigned char *p1 = b1, *p2 = b2;
857 int ret = 0;
858
859 for (; n > 0; n--)
860 ret |= *p1++ ^ *p2++;
861 return (ret != 0);
862}
863
864void 853void
865bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen) 854bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen)
866{ 855{
diff --git a/misc.h b/misc.h
index f5aab029b..1368931a0 100644
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.h,v 1.44 2010/09/22 22:58:51 djm Exp $ */ 1/* $OpenBSD: misc.h,v 1.45 2010/09/24 13:33:00 matthew Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -36,7 +36,6 @@ void sanitise_stdfd(void);
36void ms_subtract_diff(struct timeval *, int *); 36void ms_subtract_diff(struct timeval *, int *);
37void ms_to_timeval(struct timeval *, int); 37void ms_to_timeval(struct timeval *, int);
38void sock_set_v6only(int); 38void sock_set_v6only(int);
39int timingsafe_bcmp(const void *, const void *, size_t);
40 39
41struct passwd *pwcopy(struct passwd *); 40struct passwd *pwcopy(struct passwd *);
42const char *ssh_gai_strerror(int); 41const char *ssh_gai_strerror(int);
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index e15d2bd96..77c5ed2b1 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -1,4 +1,4 @@
1/* $Id: openbsd-compat.h,v 1.50 2010/08/16 03:15:23 dtucker Exp $ */ 1/* $Id: openbsd-compat.h,v 1.51 2010/10/07 10:25:29 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@@ -213,6 +213,10 @@ char *user_from_uid(uid_t, int);
213char *group_from_gid(gid_t, int); 213char *group_from_gid(gid_t, int);
214#endif 214#endif
215 215
216#ifndef HAVE_TIMINGSAFE_BCMP
217int timingsafe_bcmp(const void *, const void *, size_t);
218#endif
219
216void *xmmap(size_t size); 220void *xmmap(size_t size);
217char *xcrypt(const char *password, const char *salt); 221char *xcrypt(const char *password, const char *salt);
218char *shadow_pw(struct passwd *pw); 222char *shadow_pw(struct passwd *pw);
diff --git a/openbsd-compat/timingsafe_bcmp.c b/openbsd-compat/timingsafe_bcmp.c
new file mode 100644
index 000000000..7e28c0e2a
--- /dev/null
+++ b/openbsd-compat/timingsafe_bcmp.c
@@ -0,0 +1,34 @@
1/* $OpenBSD: timingsafe_bcmp.c,v 1.1 2010/09/24 13:33:00 matthew Exp $ */
2/*
3 * Copyright (c) 2010 Damien Miller. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/* OPENBSD ORIGINAL: lib/libc/string/timingsafe_bcmp.c */
19
20#include "includes.h"
21#ifndef HAVE_TIMINGSAFE_BCMP
22
23int
24timingsafe_bcmp(const void *b1, const void *b2, size_t n)
25{
26 const unsigned char *p1 = b1, *p2 = b2;
27 int ret = 0;
28
29 for (; n > 0; n--)
30 ret |= *p1++ ^ *p2++;
31 return (ret != 0);
32}
33
34#endif /* TIMINGSAFE_BCMP */