Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up following revision(s) (requested by roy in ticket...



details:   https://anonhg.NetBSD.org/src/rev/2388ef0ff5ed
branches:  netbsd-8
changeset: 434551:2388ef0ff5ed
user:      snj <snj%NetBSD.org@localhost>
date:      Sat Jan 13 21:35:29 2018 +0000

description:
Pull up following revision(s) (requested by roy in ticket #478):
        doc/3RDPARTY: 1.1472, 1.1474, 1.1489, 1.1492
        external/bsd/dhcpcd/dist/.gitignore: up to 1.4
        external/bsd/dhcpcd/dist/LICENSE: up to 1.1.1.2
        external/bsd/dhcpcd/dist/Makefile.inc: up to 1.1.1.2
        external/bsd/dhcpcd/dist/README.md: up to 1.1.1.3
        external/bsd/dhcpcd/dist/compat/crypt/hmac.c: up to 1.1.1.1
        external/bsd/dhcpcd/dist/compat/crypt/hmac.h: up to 1.1.1.1
        external/bsd/dhcpcd/dist/compat/crypt/md5.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/compat/strlcpy.c: up to 1.1.1.1
        external/bsd/dhcpcd/dist/compat/strlcpy.h: up to 1.1.1.1
        external/bsd/dhcpcd/dist/configure: up to 1.1.1.4
        external/bsd/dhcpcd/dist/hooks/01-test: up to 1.1.1.2
        external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in: up to 1.1.1.3
        external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/Makefile: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/arp.c: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/arp.h: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/auth.c: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/auth.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/bpf.c: up to 1.6
        external/bsd/dhcpcd/dist/src/bpf.h: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/common.c: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/common.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/control.c: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/control.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/crypt/crypt.h: delete
        external/bsd/dhcpcd/dist/src/crypt/hmac_md5.c: delete
        external/bsd/dhcpcd/dist/src/defs.h: up to 1.1.1.8
        external/bsd/dhcpcd/dist/src/dev.c: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/dev.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/dhcp-common.c: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/dhcp-common.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/dhcp.c: up to 1.7
        external/bsd/dhcpcd/dist/src/dhcp.h: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/dhcp6.c: up to 1.1.1.8
        external/bsd/dhcpcd/dist/src/dhcp6.h: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/dhcpcd.8.in: up to 1.1.1.7
        external/bsd/dhcpcd/dist/src/dhcpcd.c: up to 1.7
        external/bsd/dhcpcd/dist/src/dhcpcd.conf: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/dhcpcd.h: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/eloop.c: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/eloop.h: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/if-bsd.c: up to 1.1.1.6
        external/bsd/dhcpcd/dist/src/if-linux-wext.c: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/if-linux.c: up to 1.1.1.7
        external/bsd/dhcpcd/dist/src/if-options.c: up to 1.6
        external/bsd/dhcpcd/dist/src/if-options.h: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/if-sun.c: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/if.c: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/if.h: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/ipv4.c: up to 1.1.1.7
        external/bsd/dhcpcd/dist/src/ipv4.h: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/ipv4ll.c: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/ipv4ll.h: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/ipv6.c: up to 1.1.1.7
        external/bsd/dhcpcd/dist/src/ipv6.h: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/ipv6nd.c: up to 1.1.1.6
        external/bsd/dhcpcd/dist/src/ipv6nd.h: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/logerr.c: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/logerr.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/route.c: up to 1.1.1.5
        external/bsd/dhcpcd/dist/src/route.h: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/sa.c: up to 1.1.1.3
        external/bsd/dhcpcd/dist/src/sa.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/src/script.c: up to 1.1.1.4
        external/bsd/dhcpcd/dist/src/script.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/tests/crypt/Makefile: up to 1.1.1.2
        external/bsd/dhcpcd/dist/tests/crypt/run-test.c: up to 1.1.1.2
        external/bsd/dhcpcd/dist/tests/crypt/test.h: up to 1.1.1.2
        external/bsd/dhcpcd/dist/tests/crypt/test_hmac_md5.c: up to 1.1.1.3
        external/bsd/dhcpcd/dist/tests/eloop-bench/Makefile: up to 1.1.1.2
        external/bsd/dhcpcd/dist/tests/eloop-bench/eloop-bench.c: up to 1.1.1.2
        external/bsd/dhcpcd/include/config.h: up to 1.2
        external/bsd/dhcpcd/sbin/Makefile.inc: up to 1.5
        external/bsd/dhcpcd/sbin/dhcpcd/Makefile: up to 1.42
Update dhcpcd to 7.0.0.

diffstat:

 doc/3RDPARTY                                             |     6 +-
 external/bsd/dhcpcd/dist/.gitignore                      |     3 +
 external/bsd/dhcpcd/dist/LICENSE                         |     2 +-
 external/bsd/dhcpcd/dist/Makefile.inc                    |     1 +
 external/bsd/dhcpcd/dist/README.md                       |    16 +-
 external/bsd/dhcpcd/dist/compat/crypt/hmac.c             |   191 ++
 external/bsd/dhcpcd/dist/compat/crypt/hmac.h             |    40 +
 external/bsd/dhcpcd/dist/compat/crypt/md5.h              |     2 +-
 external/bsd/dhcpcd/dist/compat/strlcpy.c                |    51 +
 external/bsd/dhcpcd/dist/compat/strlcpy.h                |    24 +
 external/bsd/dhcpcd/dist/configure                       |    50 +-
 external/bsd/dhcpcd/dist/hooks/01-test                   |     3 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in     |     6 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in       |    36 +-
 external/bsd/dhcpcd/dist/src/Makefile                    |     3 +
 external/bsd/dhcpcd/dist/src/arp.c                       |   167 +-
 external/bsd/dhcpcd/dist/src/arp.h                       |    18 +-
 external/bsd/dhcpcd/dist/src/auth.c                      |    37 +-
 external/bsd/dhcpcd/dist/src/auth.h                      |     2 +-
 external/bsd/dhcpcd/dist/src/bpf.c                       |    23 +-
 external/bsd/dhcpcd/dist/src/bpf.h                       |     9 +-
 external/bsd/dhcpcd/dist/src/common.c                    |     5 +-
 external/bsd/dhcpcd/dist/src/common.h                    |     2 +-
 external/bsd/dhcpcd/dist/src/control.c                   |     2 +-
 external/bsd/dhcpcd/dist/src/control.h                   |     2 +-
 external/bsd/dhcpcd/dist/src/crypt/crypt.h               |    33 -
 external/bsd/dhcpcd/dist/src/crypt/hmac_md5.c            |    89 -
 external/bsd/dhcpcd/dist/src/defs.h                      |     4 +-
 external/bsd/dhcpcd/dist/src/dev.c                       |     2 +-
 external/bsd/dhcpcd/dist/src/dev.h                       |     2 +-
 external/bsd/dhcpcd/dist/src/dhcp-common.c               |    87 +-
 external/bsd/dhcpcd/dist/src/dhcp-common.h               |     2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c                      |   601 ++++--
 external/bsd/dhcpcd/dist/src/dhcp.h                      |     4 +-
 external/bsd/dhcpcd/dist/src/dhcp6.c                     |  1247 ++++++++-----
 external/bsd/dhcpcd/dist/src/dhcp6.h                     |    67 +-
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in        |     2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in        |     2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.8.in                 |    17 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.c                    |   122 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.conf                 |     4 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in            |     2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.h                    |     2 +-
 external/bsd/dhcpcd/dist/src/eloop.c                     |    24 +-
 external/bsd/dhcpcd/dist/src/eloop.h                     |     6 +-
 external/bsd/dhcpcd/dist/src/if-bsd.c                    |    72 +-
 external/bsd/dhcpcd/dist/src/if-linux-wext.c             |     2 +-
 external/bsd/dhcpcd/dist/src/if-linux.c                  |    44 +-
 external/bsd/dhcpcd/dist/src/if-options.c                |    15 +-
 external/bsd/dhcpcd/dist/src/if-options.h                |     4 +-
 external/bsd/dhcpcd/dist/src/if-sun.c                    |     2 +-
 external/bsd/dhcpcd/dist/src/if.c                        |    58 +-
 external/bsd/dhcpcd/dist/src/if.h                        |     9 +-
 external/bsd/dhcpcd/dist/src/ipv4.c                      |   119 +-
 external/bsd/dhcpcd/dist/src/ipv4.h                      |     4 +-
 external/bsd/dhcpcd/dist/src/ipv4ll.c                    |     3 +-
 external/bsd/dhcpcd/dist/src/ipv4ll.h                    |     2 +-
 external/bsd/dhcpcd/dist/src/ipv6.c                      |   330 +-
 external/bsd/dhcpcd/dist/src/ipv6.h                      |    93 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.c                    |   182 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.h                    |    37 +-
 external/bsd/dhcpcd/dist/src/logerr.c                    |     2 +-
 external/bsd/dhcpcd/dist/src/logerr.h                    |     2 +-
 external/bsd/dhcpcd/dist/src/route.c                     |    32 +-
 external/bsd/dhcpcd/dist/src/route.h                     |    11 +-
 external/bsd/dhcpcd/dist/src/sa.c                        |    10 +-
 external/bsd/dhcpcd/dist/src/sa.h                        |     2 +-
 external/bsd/dhcpcd/dist/src/script.c                    |    77 +-
 external/bsd/dhcpcd/dist/src/script.h                    |     2 +-
 external/bsd/dhcpcd/dist/tests/crypt/Makefile            |    13 +-
 external/bsd/dhcpcd/dist/tests/crypt/run-test.c          |     2 +-
 external/bsd/dhcpcd/dist/tests/crypt/test.h              |     2 +-
 external/bsd/dhcpcd/dist/tests/crypt/test_hmac_md5.c     |    50 +-
 external/bsd/dhcpcd/dist/tests/eloop-bench/Makefile      |    12 +-
 external/bsd/dhcpcd/dist/tests/eloop-bench/eloop-bench.c |     2 +-
 external/bsd/dhcpcd/include/config.h                     |     1 -
 external/bsd/dhcpcd/sbin/Makefile.inc                    |     8 +-
 external/bsd/dhcpcd/sbin/dhcpcd/Makefile                 |     6 +-
 78 files changed, 2532 insertions(+), 1698 deletions(-)

diffs (truncated from 8055 to 300 lines):

diff -r c22dd7585552 -r 2388ef0ff5ed doc/3RDPARTY
--- a/doc/3RDPARTY      Sat Jan 13 21:33:14 2018 +0000
+++ b/doc/3RDPARTY      Sat Jan 13 21:35:29 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: 3RDPARTY,v 1.1444.2.6 2017/12/04 10:55:19 snj Exp $
+#      $NetBSD: 3RDPARTY,v 1.1444.2.7 2018/01/13 21:35:29 snj Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -334,8 +334,8 @@
 Use the dhcp2netbsd script.
 
 Package:       dhcpcd
-Version:       7.0.0-rc1
-Current Vers:  7.0.0-rc1
+Version:       7.0.0
+Current Vers:  7.0.0
 Maintainer:    roy
 Archive Site:  ftp://roy.marples.name/pub/dhcpcd/
 Home Page:     http://roy.marples.name/projects/dhcpcd/
diff -r c22dd7585552 -r 2388ef0ff5ed external/bsd/dhcpcd/dist/.gitignore
--- a/external/bsd/dhcpcd/dist/.gitignore       Sat Jan 13 21:33:14 2018 +0000
+++ b/external/bsd/dhcpcd/dist/.gitignore       Sat Jan 13 21:35:29 2018 +0000
@@ -24,5 +24,8 @@
 # Ignore distribution
 dhcpcd*.xz*
 
+# Ignore swap files
+*.swp
+
 # Ignore Coverity
 cov-int
diff -r c22dd7585552 -r 2388ef0ff5ed external/bsd/dhcpcd/dist/LICENSE
--- a/external/bsd/dhcpcd/dist/LICENSE  Sat Jan 13 21:33:14 2018 +0000
+++ b/external/bsd/dhcpcd/dist/LICENSE  Sat Jan 13 21:35:29 2018 +0000
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2017 Roy Marples <roy%marples.name@localhost>
+Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -r c22dd7585552 -r 2388ef0ff5ed external/bsd/dhcpcd/dist/Makefile.inc
--- a/external/bsd/dhcpcd/dist/Makefile.inc     Sat Jan 13 21:33:14 2018 +0000
+++ b/external/bsd/dhcpcd/dist/Makefile.inc     Sat Jan 13 21:35:29 2018 +0000
@@ -9,6 +9,7 @@
 
 CC?=           cc
 INSTALL?=      install
+LINT?=         lint
 SED?=          sed
 HOST_SH?=      /bin/sh
 
diff -r c22dd7585552 -r 2388ef0ff5ed external/bsd/dhcpcd/dist/README.md
--- a/external/bsd/dhcpcd/dist/README.md        Sat Jan 13 21:33:14 2018 +0000
+++ b/external/bsd/dhcpcd/dist/README.md        Sat Jan 13 21:35:29 2018 +0000
@@ -52,10 +52,18 @@
 # In this case, comment out duid and enable clientid above.
 duid
 
+# Persist interface configuration when dhcpcd exits.
+persistent
+
+# Rapid commit support.
+# Safe to enable by default because it requires the equivalent option set
+# on the server to actually work.
+option rapid_commit
+
 # A list of options to request from the DHCP server.
 option domain_name_servers, domain_name, domain_search, host_name
 option classless_static_routes
-# Respect the network MTU.
+# Respect the network MTU. This is applied to DHCP routes.
 option interface_mtu
 
 # Most distributions have NTP support.
@@ -64,7 +72,9 @@
 # A ServerID is required by RFC2131.
 require dhcp_server_identifier
 
-# Generate Stable Private IPv6 Addresses instead of hardware based ones
+# Generate SLAAC address using the Hardware Address of the interface
+#slaac hwaddr
+# OR generate Stable Private IPv6 Addresses based from the DUID
 slaac private
 ```
 
@@ -88,4 +98,4 @@
 We no longer supply a ChangeLog.
 However, you're more than welcome to read the
 [commit log](http://roy.marples.name/git/dhcpcd.git/log/) and
-[archived release annoucements](http://roy.marples.name/archives/dhcpcd-discuss/).
+[archived release announcements](http://roy.marples.name/archives/dhcpcd-discuss/).
diff -r c22dd7585552 -r 2388ef0ff5ed external/bsd/dhcpcd/dist/compat/crypt/hmac.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/compat/crypt/hmac.c      Sat Jan 13 21:35:29 2018 +0000
@@ -0,0 +1,191 @@
+/*     $NetBSD: hmac.c,v 1.1.1.1.2.2 2018/01/13 21:35:30 snj Exp $     */
+
+/*-
+ * Copyright (c) 2016 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 <string.h>
+#include <stdlib.h>
+
+#include "config.h"
+
+#if defined(HAVE_MD5_H) && !defined(DEPGEN)
+#include <md5.h>
+#endif
+
+#ifdef SHA2_H
+#  include SHA2_H
+#endif
+
+#ifndef __arraycount
+#define        __arraycount(__x)       (sizeof(__x) / sizeof(__x[0]))
+#endif
+
+#if 0
+#include <md2.h>
+#include <md4.h>
+#include <md5.h>
+#include <rmd160.h>
+#include <sha1.h>
+#include <sha2.h>
+#endif
+
+#ifndef MD5_BLOCK_LENGTH
+#define        MD5_BLOCK_LENGTH        64
+#endif
+#ifndef SHA256_BLOCK_LENGTH
+#define        SHA256_BLOCK_LENGTH     64
+#endif
+
+#define HMAC_SIZE      128
+#define HMAC_IPAD      0x36
+#define HMAC_OPAD      0x5C
+
+static const struct hmac {
+       const char *name;
+       size_t ctxsize;
+       size_t digsize;
+       size_t blocksize;
+       void (*init)(void *);
+       void (*update)(void *, const uint8_t *, unsigned int);
+       void (*final)(uint8_t *, void *);
+} hmacs[] = {
+#if 0
+       {
+               "md2", sizeof(MD2_CTX), MD2_DIGEST_LENGTH, MD2_BLOCK_LENGTH,
+               (void *)MD2Init, (void *)MD2Update, (void *)MD2Final,
+       },
+       {
+               "md4", sizeof(MD4_CTX), MD4_DIGEST_LENGTH, MD4_BLOCK_LENGTH,
+               (void *)MD4Init, (void *)MD4Update, (void *)MD4Final,
+       },
+#endif
+       {
+               "md5", sizeof(MD5_CTX), MD5_DIGEST_LENGTH, MD5_BLOCK_LENGTH,
+               (void *)MD5Init, (void *)MD5Update, (void *)MD5Final,
+       },
+#if 0
+       {
+               "rmd160", sizeof(RMD160_CTX), RMD160_DIGEST_LENGTH,
+               RMD160_BLOCK_LENGTH,
+               (void *)RMD160Init, (void *)RMD160Update, (void *)RMD160Final,
+       },
+       {
+               "sha1", sizeof(SHA1_CTX), SHA1_DIGEST_LENGTH, SHA1_BLOCK_LENGTH,
+               (void *)SHA1Init, (void *)SHA1Update, (void *)SHA1Final,
+       },
+       {
+               "sha224", sizeof(SHA224_CTX), SHA224_DIGEST_LENGTH,
+               SHA224_BLOCK_LENGTH,
+               (void *)SHA224_Init, (void *)SHA224_Update,
+               (void *)SHA224_Final,
+       },
+#endif
+       {
+               "sha256", sizeof(SHA256_CTX), SHA256_DIGEST_LENGTH,
+               SHA256_BLOCK_LENGTH,
+               (void *)SHA256_Init, (void *)SHA256_Update,
+               (void *)SHA256_Final,
+       },
+#if 0
+       {
+               "sha384", sizeof(SHA384_CTX), SHA384_DIGEST_LENGTH,
+               SHA384_BLOCK_LENGTH,
+               (void *)SHA384_Init, (void *)SHA384_Update,
+               (void *)SHA384_Final,
+       },
+       {
+               "sha512", sizeof(SHA512_CTX), SHA512_DIGEST_LENGTH,
+               SHA512_BLOCK_LENGTH,
+               (void *)SHA512_Init, (void *)SHA512_Update,
+               (void *)SHA512_Final,
+       },
+#endif
+};
+
+static const struct hmac *
+hmac_find(const char *name)
+{
+       for (size_t i = 0; i < __arraycount(hmacs); i++) {
+               if (strcmp(hmacs[i].name, name) != 0)
+                       continue;
+               return &hmacs[i];
+       }
+       return NULL;
+}
+
+ssize_t
+hmac(const char *name,
+    const void *key, size_t klen,
+    const void *text, size_t tlen,
+    void *digest, size_t dlen)
+{
+       uint8_t ipad[HMAC_SIZE], opad[HMAC_SIZE], d[HMAC_SIZE];
+       const uint8_t *k = key;
+       const struct hmac *h;
+       uint64_t c[32];
+       void *p;
+
+       if ((h = hmac_find(name)) == NULL)
+               return -1;
+
+
+       if (klen > h->blocksize) {
+               (*h->init)(c);
+               (*h->update)(c, k, (unsigned int)klen);
+               (*h->final)(d, c);
+               k = (void *)d;
+               klen = h->digsize;
+       }
+
+       /* Form input and output pads for the digests */
+       for (size_t i = 0; i < sizeof(ipad); i++) {
+               ipad[i] = (i < klen ? k[i] : 0) ^ HMAC_IPAD;
+               opad[i] = (i < klen ? k[i] : 0) ^ HMAC_OPAD;
+       }
+
+       p = dlen >= h->digsize ? digest : d;
+       if (p != digest) {
+               memcpy(p, digest, dlen);
+               memset((char *)p + dlen, 0, h->digsize - dlen);
+       }
+       (*h->init)(c);
+       (*h->update)(c, ipad, (unsigned int)h->blocksize);
+       (*h->update)(c, text, (unsigned int)tlen);
+       (*h->final)(p, c);
+
+       (*h->init)(c);
+       (*h->update)(c, opad, (unsigned int)h->blocksize);
+       (*h->update)(c, digest, (unsigned int)h->digsize);
+       (*h->final)(p, c);
+
+       if (p != digest)
+               memcpy(digest, p, dlen);
+
+       return (ssize_t)h->digsize;
+}
diff -r c22dd7585552 -r 2388ef0ff5ed external/bsd/dhcpcd/dist/compat/crypt/hmac.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/compat/crypt/hmac.h      Sat Jan 13 21:35:29 2018 +0000
@@ -0,0 +1,40 @@
+/*     $NetBSD: hmac.h,v 1.1.1.1.2.2 2018/01/13 21:35:30 snj Exp $     */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *



Home | Main Index | Thread Index | Old Index