Source-Changes-HG archive

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

[src/bouyer-socketcan]: src/external/bsd/dhcpcd/dist 2552809



details:   https://anonhg.NetBSD.org/src/rev/3e679d91855e
branches:  bouyer-socketcan
changeset: 820854:3e679d91855e
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Mar 31 20:51:16 2017 +0000

description:
2552809

diffstat:

 external/bsd/dhcpcd/dist/compat/_strtoi.h                  |    93 +
 external/bsd/dhcpcd/dist/compat/arc4random.c               |   158 +
 external/bsd/dhcpcd/dist/compat/arc4random.h               |    16 +
 external/bsd/dhcpcd/dist/compat/arc4random_uniform.c       |    56 +
 external/bsd/dhcpcd/dist/compat/arc4random_uniform.h       |    23 +
 external/bsd/dhcpcd/dist/compat/bitops.h                   |   188 +
 external/bsd/dhcpcd/dist/compat/crypt/md5.c                |   242 ++
 external/bsd/dhcpcd/dist/compat/crypt/md5.h                |    33 +
 external/bsd/dhcpcd/dist/compat/crypt/sha256.c             |   303 ++
 external/bsd/dhcpcd/dist/compat/crypt/sha256.h             |    46 +
 external/bsd/dhcpcd/dist/compat/endian.h                   |    71 +
 external/bsd/dhcpcd/dist/compat/pidfile.c                  |   269 ++
 external/bsd/dhcpcd/dist/compat/pidfile.h                  |    39 +
 external/bsd/dhcpcd/dist/compat/queue.h                    |   175 +
 external/bsd/dhcpcd/dist/compat/reallocarray.c             |    60 +
 external/bsd/dhcpcd/dist/compat/reallocarray.h             |    37 +
 external/bsd/dhcpcd/dist/compat/strtoi.c                   |    68 +
 external/bsd/dhcpcd/dist/compat/strtoi.h                   |    45 +
 external/bsd/dhcpcd/dist/compat/strtou.c                   |    68 +
 external/bsd/dhcpcd/dist/hooks/01-test                     |     8 +
 external/bsd/dhcpcd/dist/hooks/02-dump                     |     8 +
 external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant           |   119 +
 external/bsd/dhcpcd/dist/hooks/15-timezone                 |    48 +
 external/bsd/dhcpcd/dist/hooks/20-resolv.conf              |   204 +
 external/bsd/dhcpcd/dist/hooks/29-lookup-hostname          |    40 +
 external/bsd/dhcpcd/dist/hooks/30-hostname                 |   165 +
 external/bsd/dhcpcd/dist/hooks/50-dhcpcd-compat            |    41 +
 external/bsd/dhcpcd/dist/hooks/50-ntp.conf                 |   141 +
 external/bsd/dhcpcd/dist/hooks/50-yp.conf                  |    56 +
 external/bsd/dhcpcd/dist/hooks/50-ypbind.in                |    86 +
 external/bsd/dhcpcd/dist/hooks/Makefile                    |    64 +
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in       |   217 +
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in         |   387 +++
 external/bsd/dhcpcd/dist/src/GNUmakefile                   |    12 +
 external/bsd/dhcpcd/dist/src/arp.h                         |   109 +
 external/bsd/dhcpcd/dist/src/auth.c                        |   669 +++++
 external/bsd/dhcpcd/dist/src/auth.h                        |    93 +
 external/bsd/dhcpcd/dist/src/common.h                      |   187 +
 external/bsd/dhcpcd/dist/src/control.h                     |    64 +
 external/bsd/dhcpcd/dist/src/crypt/crypt.h                 |    33 +
 external/bsd/dhcpcd/dist/src/crypt/hmac_md5.c              |    89 +
 external/bsd/dhcpcd/dist/src/dev.h                         |    60 +
 external/bsd/dhcpcd/dist/src/dev/Makefile                  |    45 +
 external/bsd/dhcpcd/dist/src/dev/udev.c                    |   179 +
 external/bsd/dhcpcd/dist/src/dhcp-common.h                 |   123 +
 external/bsd/dhcpcd/dist/src/dhcp.h                        |   279 ++
 external/bsd/dhcpcd/dist/src/dhcp6.h                       |   241 ++
 external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf |   125 +
 external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf       |   595 +++++
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in          |    36 +
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in          |    32 +
 external/bsd/dhcpcd/dist/src/dhcpcd.conf                   |    39 +
 external/bsd/dhcpcd/dist/src/duid.h                        |    35 +
 external/bsd/dhcpcd/dist/src/eloop.h                       |   111 +
 external/bsd/dhcpcd/dist/src/genembedc                     |    18 +
 external/bsd/dhcpcd/dist/src/genembedh                     |    17 +
 external/bsd/dhcpcd/dist/src/if-linux-wext.c               |    89 +
 external/bsd/dhcpcd/dist/src/if-sun.c                      |  1417 ++++++++++++
 external/bsd/dhcpcd/dist/src/if.h                          |   204 +
 external/bsd/dhcpcd/dist/src/ipv4.h                        |   146 +
 external/bsd/dhcpcd/dist/src/ipv6.h                        |   298 ++
 external/bsd/dhcpcd/dist/src/ipv6nd.h                      |   115 +
 external/bsd/dhcpcd/dist/src/route.h                       |    92 +
 external/bsd/dhcpcd/dist/src/sa.c                          |   458 +++
 external/bsd/dhcpcd/dist/src/sa.h                          |    68 +
 external/bsd/dhcpcd/dist/src/script.h                      |    37 +
 66 files changed, 9689 insertions(+), 0 deletions(-)

diffs (truncated from 9953 to 300 lines):

diff -r 2581a9215833 -r 3e679d91855e external/bsd/dhcpcd/dist/compat/_strtoi.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/compat/_strtoi.h Fri Mar 31 20:51:16 2017 +0000
@@ -0,0 +1,93 @@
+/*     $NetBSD: _strtoi.h,v 1.1.1.1.2.2 2017/03/31 20:51:16 roy Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * Original version ID:
+ * NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp
+ *
+ * Created by Kamil Rytarowski, based on ID:
+ * NetBSD: src/common/lib/libc/stdlib/_strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp
+ */
+
+/*
+ * function template for strtoi and strtou
+ *
+ * parameters:
+ *     _FUNCNAME    : function name
+ *      __TYPE       : return and range limits type
+ *      __WRAPPED    : wrapped function, strtoimax or strtoumax
+ */
+
+__TYPE
+_FUNCNAME(const char * __restrict nptr, char ** __restrict endptr, int base,
+          __TYPE lo, __TYPE hi, int * rstatus)
+{
+       int serrno;
+       __TYPE im;
+       char *ep;
+       int rep;
+
+       /* endptr may be NULL */
+
+       if (endptr == NULL)
+               endptr = &ep;
+
+       if (rstatus == NULL)
+               rstatus = &rep;
+
+       serrno = errno;
+       errno = 0;
+
+       im = __WRAPPED(nptr, endptr, base);
+
+       *rstatus = errno;
+       errno = serrno;
+
+       if (*rstatus == 0) {
+               /* No digits were found */
+               if (nptr == *endptr)
+                       *rstatus = ECANCELED;
+               /* There are further characters after number */
+               else if (**endptr != '\0')
+                       *rstatus = ENOTSUP;
+       }
+
+       if (im < lo) {
+               if (*rstatus == 0)
+                       *rstatus = ERANGE;
+               return lo;
+       }
+       if (im > hi) {
+               if (*rstatus == 0)
+                       *rstatus = ERANGE;
+               return hi;
+       }
+
+       return im;
+}
diff -r 2581a9215833 -r 3e679d91855e external/bsd/dhcpcd/dist/compat/arc4random.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/compat/arc4random.c      Fri Mar 31 20:51:16 2017 +0000
@@ -0,0 +1,158 @@
+/*
+ * Arc4 random number generator for OpenBSD.
+ * Copyright 1996 David Mazieres <dm%lcs.mit.edu@localhost>.
+ *
+ * Modification and redistribution in source and binary forms is
+ * permitted provided that due credit is given to the author and the
+ * OpenBSD project by leaving this copyright notice intact.
+ */
+
+/*
+ * This code is derived from section 17.1 of Applied Cryptography,
+ * second edition, which describes a stream cipher allegedly
+ * compatible with RSA Labs "RC4" cipher (the actual description of
+ * which is a trade secret).  The same algorithm is used as a stream
+ * cipher called "arcfour" in Tatu Ylonen's ssh package.
+ *
+ * Here the stream cipher has been modified always to include the time
+ * when initializing the state.  That makes it impossible to
+ * regenerate the same random sequence twice, so this can't be used
+ * for encryption, but will generate good random numbers.
+ *
+ * RC4 is a registered trademark of RSA Laboratories.
+ */
+
+#include <sys/time.h>
+
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "arc4random.h"
+
+struct arc4_stream {
+       uint8_t i;
+       uint8_t j;
+       uint8_t s[256];
+       size_t count;
+       pid_t stir_pid;
+};
+
+#define S(n) (n)
+#define S4(n) S(n), S(n + 1), S(n + 2), S(n + 3)
+#define S16(n) S4(n), S4(n + 4), S4(n + 8), S4(n + 12)
+#define S64(n) S16(n), S16(n + 16), S16(n + 32), S16(n + 48)
+#define S256 S64(0), S64(64), S64(128), S64(192)
+
+static struct arc4_stream rs = { .i = 0xff, .j = 0, .s = { S256 },
+                    .count = 0, .stir_pid = 0 };
+
+#undef S
+#undef S4
+#undef S16
+#undef S64
+#undef S256
+
+static void
+arc4_addrandom(struct arc4_stream *as, unsigned char *dat, int datlen)
+{
+       int n;
+       uint8_t si;
+
+       as->i--;
+       for (n = 0; n < 256; n++) {
+               as->i = (uint8_t)(as->i + 1);
+               si = as->s[as->i];
+               as->j = (uint8_t)(as->j + si + dat[n % datlen]);
+               as->s[as->i] = as->s[as->j];
+               as->s[as->j] = si;
+       }
+       as->j = as->i;
+}
+
+static uint8_t
+arc4_getbyte(struct arc4_stream *as)
+{
+       uint8_t si, sj;
+
+       as->i = (uint8_t)(as->i + 1);
+       si = as->s[as->i];
+       as->j = (uint8_t)(as->j + si);
+       sj = as->s[as->j];
+       as->s[as->i] = sj;
+       as->s[as->j] = si;
+       return (as->s[(si + sj) & 0xff]);
+}
+
+static uint32_t
+arc4_getword(struct arc4_stream *as)
+{
+       int val;
+
+       val = arc4_getbyte(as) << 24;
+       val |= arc4_getbyte(as) << 16;
+       val |= arc4_getbyte(as) << 8;
+       val |= arc4_getbyte(as);
+       return (uint32_t)val;
+}
+
+/* We don't care about any error on read, just use what we have
+ * on the stack. So mask off this GCC warning. */
+#pragma GCC diagnostic ignored "-Wunused-result"
+static void
+arc4_stir(struct arc4_stream *as)
+{
+       int fd;
+       struct {
+               struct timeval tv;
+               unsigned int rnd[(128 - sizeof(struct timeval)) /
+                       sizeof(unsigned int)];
+       }       rdat;
+       size_t n;
+
+       gettimeofday(&rdat.tv, NULL);
+       fd = open("/dev/urandom", O_RDONLY);
+       if (fd != -1) {
+               /* If there is an error reading, just use what is
+                * on the stack. */
+               /* coverity[check_return] */
+               (void)read(fd, rdat.rnd, sizeof(rdat.rnd));
+               close(fd);
+       }
+
+       /* fd < 0?  Ah, what the heck. We'll just take
+        * whatever was on the stack... */
+       /* coverity[uninit_use_in_call] */
+       arc4_addrandom(as, (void *) &rdat, sizeof(rdat));
+
+       /*
+        * Throw away the first N words of output, as suggested in the
+        * paper "Weaknesses in the Key Scheduling Algorithm of RC4"
+        * by Fluher, Mantin, and Shamir.  (N = 256 in our case.)
+        */
+       for (n = 0; n < 256 * sizeof(uint32_t); n++)
+               arc4_getbyte(as);
+       as->count = 1600000;
+}
+
+static void
+arc4_stir_if_needed(struct arc4_stream *as)
+{
+       pid_t pid;
+
+       pid = getpid();
+       if (as->count <= sizeof(uint32_t) || as->stir_pid != pid) {
+               as->stir_pid = pid;
+               arc4_stir(as);
+       } else
+               as->count -= sizeof(uint32_t);
+}
+
+uint32_t
+arc4random()
+{
+
+       arc4_stir_if_needed(&rs);
+       return arc4_getword(&rs);
+}
diff -r 2581a9215833 -r 3e679d91855e external/bsd/dhcpcd/dist/compat/arc4random.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/compat/arc4random.h      Fri Mar 31 20:51:16 2017 +0000
@@ -0,0 +1,16 @@
+/*
+ * Arc4 random number generator for OpenBSD.
+ * Copyright 1996 David Mazieres <dm%lcs.mit.edu@localhost>.
+ *
+ * Modification and redistribution in source and binary forms is
+ * permitted provided that due credit is given to the author and the
+ * OpenBSD project by leaving this copyright notice intact.
+ */
+
+#ifndef ARC4RANDOM_H
+#define ARC4RANDOM_H
+
+#include <stdint.h>
+
+uint32_t arc4random(void);
+#endif
diff -r 2581a9215833 -r 3e679d91855e external/bsd/dhcpcd/dist/compat/arc4random_uniform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/compat/arc4random_uniform.c      Fri Mar 31 20:51:16 2017 +0000
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2008, Damien Miller <djm%openbsd.org@localhost>
+ *
+ * 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.
+ */
+
+#include <stdint.h>



Home | Main Index | Thread Index | Old Index