Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssh define recallocarray locally.



details:   https://anonhg.NetBSD.org/src/rev/05efa686d551
branches:  trunk
changeset: 826977:05efa686d551
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 07 21:14:59 2017 +0000

description:
define recallocarray locally.

diffstat:

 crypto/external/bsd/openssh/dist/includes.h      |   4 +-
 crypto/external/bsd/openssh/dist/recallocarray.c |  51 ++++++++++++++++++++++++
 crypto/external/bsd/openssh/lib/Makefile         |   3 +-
 3 files changed, 56 insertions(+), 2 deletions(-)

diffs (88 lines):

diff -r 7568d95b8b0a -r 05efa686d551 crypto/external/bsd/openssh/dist/includes.h
--- a/crypto/external/bsd/openssh/dist/includes.h       Sat Oct 07 20:32:20 2017 +0000
+++ b/crypto/external/bsd/openssh/dist/includes.h       Sat Oct 07 21:14:59 2017 +0000
@@ -1,9 +1,11 @@
-/*     $NetBSD: includes.h,v 1.6 2017/04/18 18:41:46 christos Exp $    */
+/*     $NetBSD: includes.h,v 1.7 2017/10/07 21:14:59 christos Exp $    */
 #include <sys/cdefs.h>
 #ifndef __OpenBSD__
 #define __bounded__(a, b, c)
 #define explicit_bzero(a, b) explicit_memset((a), 0, (b))
 #define timingsafe_bcmp(a, b, c) (!consttime_memequal((a), (b), (c)))
+#include <sys/types.h>
+void   *recallocarray(void *, size_t, size_t, size_t);
 #endif
 
 #include "namespace.h"
diff -r 7568d95b8b0a -r 05efa686d551 crypto/external/bsd/openssh/dist/recallocarray.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/openssh/dist/recallocarray.c  Sat Oct 07 21:14:59 2017 +0000
@@ -0,0 +1,51 @@
+/*     $NetBSD: recallocarray.c,v 1.1 2017/10/07 21:14:59 christos Exp $       */
+/*     $OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $        */
+
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "includes.h"
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: recallocarray.c,v 1.1 2017/10/07 21:14:59 christos Exp $");
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+void *
+recallocarray(void *optr, size_t omemb, size_t nmemb, size_t size)
+{
+       char *nptr = reallocarray(optr, nmemb, size);
+
+       if (nptr == NULL || omemb >= nmemb)
+               return nptr;
+
+       memset(nptr + omemb * size, 0, (nmemb - omemb) * size);
+       return nptr;
+}
diff -r 7568d95b8b0a -r 05efa686d551 crypto/external/bsd/openssh/lib/Makefile
--- a/crypto/external/bsd/openssh/lib/Makefile  Sat Oct 07 20:32:20 2017 +0000
+++ b/crypto/external/bsd/openssh/lib/Makefile  Sat Oct 07 21:14:59 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.22 2017/10/07 19:39:19 christos Exp $
+#      $NetBSD: Makefile,v 1.23 2017/10/07 21:14:59 christos Exp $
 
 .include <bsd.own.mk>
 
@@ -57,6 +57,7 @@
 poly1305.c \
 progressmeter.c \
 readpass.c \
+recallocarray.c \
 sc25519.c \
 smult_curve25519_ref.c \
 sshbuf-getput-basic.c \



Home | Main Index | Thread Index | Old Index