CVS commit: src/doc/roadmaps
Module Name:src Committed By: nia Date: Sun Oct 31 08:11:13 UTC 2021 Modified Files: src/doc/roadmaps: ports Log Message: drm++ To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/doc/roadmaps/ports Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/roadmaps/ports diff -u src/doc/roadmaps/ports:1.8 src/doc/roadmaps/ports:1.9 --- src/doc/roadmaps/ports:1.8 Fri Jul 20 01:52:07 2018 +++ src/doc/roadmaps/ports Sun Oct 31 08:11:13 2021 @@ -1,4 +1,4 @@ -$NetBSD: ports,v 1.8 2018/07/20 01:52:07 maya Exp $ +$NetBSD: ports,v 1.9 2021/10/31 08:11:13 nia Exp $ NetBSD Ports Roadmap @@ -29,7 +29,7 @@ Explanations 0. DRMKMS update -The DRM drivers get old with time. The current drivers are from Linux 3.15, +The DRM drivers get old with time. The current drivers are from Linux 4.4, having a newer version would be nice. - As of July 2018, maya is working on this.
CVS commit: src/doc/roadmaps
Module Name:src Committed By: nia Date: Sun Oct 31 08:11:13 UTC 2021 Modified Files: src/doc/roadmaps: ports Log Message: drm++ To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/doc/roadmaps/ports Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/rpcbind
Module Name:src Committed By: nia Date: Sat Oct 30 11:41:45 UTC 2021 Modified Files: src/usr.sbin/rpcbind: rpcb_svc_com.c Log Message: rpcbind(8): restore previous behaviour. Wait instead of breaking from the loop if svc_fdset_getmax fails. thanks rin. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/rpcbind/rpcb_svc_com.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/rpcbind/rpcb_svc_com.c diff -u src/usr.sbin/rpcbind/rpcb_svc_com.c:1.26 src/usr.sbin/rpcbind/rpcb_svc_com.c:1.27 --- src/usr.sbin/rpcbind/rpcb_svc_com.c:1.26 Sat Oct 30 11:04:48 2021 +++ src/usr.sbin/rpcbind/rpcb_svc_com.c Sat Oct 30 11:41:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rpcb_svc_com.c,v 1.26 2021/10/30 11:04:48 nia Exp $ */ +/* $NetBSD: rpcb_svc_com.c,v 1.27 2021/10/30 11:41:45 nia Exp $ */ /* $FreeBSD: head/usr.sbin/rpcbind/rpcb_svc_com.c 301770 2016-06-09 22:25:00Z pfg $ */ /*- @@ -1122,6 +1122,7 @@ my_svc_run(void) if (newfdcount != npollfds) { if (reallocarr(&pollfds, newfdcount, sizeof(*pollfds)) != 0) { +wait: syslog(LOG_ERR, "Cannot allocate pollfds"); sleep(1); continue; @@ -1130,7 +1131,7 @@ my_svc_run(void) } p = pollfds; if ((m = svc_fdset_getmax()) == NULL) - break; + goto wait; for (n = 0; n <= *m; n++) { if (svc_fdset_isset(n)) { p->fd = n;
CVS commit: src/usr.sbin/rpcbind
Module Name:src Committed By: nia Date: Sat Oct 30 11:41:45 UTC 2021 Modified Files: src/usr.sbin/rpcbind: rpcb_svc_com.c Log Message: rpcbind(8): restore previous behaviour. Wait instead of breaking from the loop if svc_fdset_getmax fails. thanks rin. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/rpcbind/rpcb_svc_com.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/telnet
Module Name:src Committed By: nia Date: Sat Oct 30 11:37:18 UTC 2021 Modified Files: src/usr.bin/telnet: telnet.c Log Message: telnet(1): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/telnet/telnet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/telnet/telnet.c diff -u src/usr.bin/telnet/telnet.c:1.42 src/usr.bin/telnet/telnet.c:1.43 --- src/usr.bin/telnet/telnet.c:1.42 Sat Jan 5 06:47:24 2019 +++ src/usr.bin/telnet/telnet.c Sat Oct 30 11:37:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: telnet.c,v 1.42 2019/01/05 06:47:24 maya Exp $ */ +/* $NetBSD: telnet.c,v 1.43 2021/10/30 11:37:18 nia Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95"; #else -__RCSID("$NetBSD: telnet.c,v 1.42 2019/01/05 06:47:24 maya Exp $"); +__RCSID("$NetBSD: telnet.c,v 1.43 2021/10/30 11:37:18 nia Exp $"); #endif #endif /* not lint */ @@ -578,8 +578,8 @@ mklist(char *buf, char *name) /* * Allocate an array to put the name pointers into */ - argv = (char **)malloc((n+3)*sizeof(char *)); - if (argv == 0) + argv = NULL: + if (reallocarr(&argv, n + 3, sizeof(char *)) != 0) return(unknown); /*
CVS commit: src/usr.bin/telnet
Module Name:src Committed By: nia Date: Sat Oct 30 11:37:18 UTC 2021 Modified Files: src/usr.bin/telnet: telnet.c Log Message: telnet(1): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/telnet/telnet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libpam/modules/pam_exec
Module Name:src Committed By: nia Date: Sat Oct 30 11:34:59 UTC 2021 Modified Files: src/lib/libpam/modules/pam_exec: pam_exec.c Log Message: pam_exec: Convert realloc(x * y) to reallocarr. Eliminate a now-redundant temporary variable. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libpam/modules/pam_exec/pam_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libpam/modules/pam_exec/pam_exec.c diff -u src/lib/libpam/modules/pam_exec/pam_exec.c:1.7 src/lib/libpam/modules/pam_exec/pam_exec.c:1.8 --- src/lib/libpam/modules/pam_exec/pam_exec.c:1.7 Sun Dec 29 22:54:58 2013 +++ src/lib/libpam/modules/pam_exec/pam_exec.c Sat Oct 30 11:34:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pam_exec.c,v 1.7 2013/12/29 22:54:58 christos Exp $ */ +/* $NetBSD: pam_exec.c,v 1.8 2021/10/30 11:34:59 nia Exp $ */ /*- * Copyright (c) 2001,2003 Networks Associates Technology, Inc. @@ -38,7 +38,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_exec/pam_exec.c,v 1.4 2005/02/01 10:37:07 des Exp $"); #else -__RCSID("$NetBSD: pam_exec.c,v 1.7 2013/12/29 22:54:58 christos Exp $"); +__RCSID("$NetBSD: pam_exec.c,v 1.8 2021/10/30 11:34:59 nia Exp $"); #endif #include @@ -72,7 +72,7 @@ _pam_exec(pam_handle_t *pamh __unused, i { size_t envlen, i, nitems; int pam_err, status; - char **envlist, **tmp; + char **envlist; volatile int childerr; pid_t pid; @@ -92,12 +92,10 @@ _pam_exec(pam_handle_t *pamh __unused, i for (envlen = 0; envlist[envlen] != NULL; ++envlen) /* nothing */ ; nitems = sizeof(env_items) / sizeof(*env_items); - tmp = realloc(envlist, (envlen + nitems + 1) * sizeof(*envlist)); - if (tmp == NULL) { + if (reallocarr(&envlist, envlen + nitems + 1, sizeof(*envlist)) != 0) { openpam_free_envlist(envlist); return (PAM_BUF_ERR); } - envlist = tmp; for (i = 0; i < nitems; ++i) { const void *item; char *envstr;
CVS commit: src/lib/libpam/modules/pam_exec
Module Name:src Committed By: nia Date: Sat Oct 30 11:34:59 UTC 2021 Modified Files: src/lib/libpam/modules/pam_exec: pam_exec.c Log Message: pam_exec: Convert realloc(x * y) to reallocarr. Eliminate a now-redundant temporary variable. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libpam/modules/pam_exec/pam_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/systat
Module Name:src Committed By: nia Date: Sat Oct 30 11:31:51 UTC 2021 Modified Files: src/usr.bin/systat: netcmds.c Log Message: netstat(1): use reallocarr instead of realloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/systat/netcmds.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/netcmds.c diff -u src/usr.bin/systat/netcmds.c:1.21 src/usr.bin/systat/netcmds.c:1.22 --- src/usr.bin/systat/netcmds.c:1.21 Sat Feb 26 22:12:33 2005 +++ src/usr.bin/systat/netcmds.c Sat Oct 30 11:31:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: netcmds.c,v 1.21 2005/02/26 22:12:33 dsl Exp $ */ +/* $NetBSD: netcmds.c,v 1.22 2021/10/30 11:31:51 nia Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: netcmds.c,v 1.21 2005/02/26 22:12:33 dsl Exp $"); +__RCSID("$NetBSD: netcmds.c,v 1.22 2021/10/30 11:31:51 nia Exp $"); #endif /* not lint */ /* @@ -223,12 +223,10 @@ selectport(long port, int onoff) p->onoff = onoff; return (0); } - p = (struct pitem *)realloc(ports, (nports+1)*sizeof (*p)); - if (p == NULL) { + if (reallocarr(&ports, nports + 1, sizeof(*p)) != 0) { error("malloc failed"); die(0); } - ports = p; p = &ports[nports++]; p->port = port; p->onoff = onoff; @@ -326,12 +324,10 @@ selecthost(struct sockaddr *sa, int onof } if (sa->sa_len > sizeof(struct sockaddr_storage)) return (-1); /*XXX*/ - p = (struct hitem *)realloc(hosts, (nhosts+1)*sizeof (*p)); - if (p == NULL) { + if (reallocarr(&hosts, nhosts + 1, sizeof(*p)) != 0) { error("malloc failed"); die(0); } - hosts = p; p = &hosts[nhosts++]; memcpy(&p->addr, sa, sa->sa_len); p->onoff = onoff;
CVS commit: src/usr.bin/systat
Module Name:src Committed By: nia Date: Sat Oct 30 11:31:51 UTC 2021 Modified Files: src/usr.bin/systat: netcmds.c Log Message: netstat(1): use reallocarr instead of realloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/systat/netcmds.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/su
Module Name:src Committed By: nia Date: Sat Oct 30 11:25:30 UTC 2021 Modified Files: src/usr.bin/su: su.c Log Message: su(1): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/su/su.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/su
Module Name:src Committed By: nia Date: Sat Oct 30 11:25:30 UTC 2021 Modified Files: src/usr.bin/su: su.c Log Message: su(1): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/su/su.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/su/su.c diff -u src/usr.bin/su/su.c:1.73 src/usr.bin/su/su.c:1.74 --- src/usr.bin/su/su.c:1.73 Sun Oct 17 10:33:57 2021 +++ src/usr.bin/su/su.c Sat Oct 30 11:25:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: su.c,v 1.73 2021/10/17 10:33:57 nia Exp $ */ +/* $NetBSD: su.c,v 1.74 2021/10/30 11:25:30 nia Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988\ #if 0 static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/ #else -__RCSID("$NetBSD: su.c,v 1.73 2021/10/17 10:33:57 nia Exp $"); +__RCSID("$NetBSD: su.c,v 1.74 2021/10/30 11:25:30 nia Exp $"); #endif #endif /* not lint */ @@ -569,7 +569,8 @@ check_ingroup(int gid, const char *gname * each member to see if it is a group, and if so whether user is * in it. */ - gr_mem = emalloc((n + 1) * sizeof (char *)); + gr_mem = NULL; + ereallocarr(&gr_mem, n + 1, sizeof(char *)); for (g = gr->gr_mem, i = 0; *g; ++g) { gr_mem[i] = estrdup(*g); i++;
CVS commit: src/usr.bin/netstat
Module Name:src Committed By: nia Date: Sat Oct 30 11:23:07 UTC 2021 Modified Files: src/usr.bin/netstat: inet.c inet6.c vtw.c Log Message: netstat(1): convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/usr.bin/netstat/inet.c cvs rdiff -u -r1.78 -r1.79 src/usr.bin/netstat/inet6.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/netstat/vtw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/netstat/inet.c diff -u src/usr.bin/netstat/inet.c:1.113 src/usr.bin/netstat/inet.c:1.114 --- src/usr.bin/netstat/inet.c:1.113 Fri Aug 28 07:23:48 2020 +++ src/usr.bin/netstat/inet.c Sat Oct 30 11:23:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: inet.c,v 1.113 2020/08/28 07:23:48 ozaki-r Exp $ */ +/* $NetBSD: inet.c,v 1.114 2021/10/30 11:23:07 nia Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -__RCSID("$NetBSD: inet.c,v 1.113 2020/08/28 07:23:48 ozaki-r Exp $"); +__RCSID("$NetBSD: inet.c,v 1.114 2021/10/30 11:23:07 nia Exp $"); #endif #endif /* not lint */ @@ -293,8 +293,9 @@ getpcblist_kmem(u_long off, const char * next = TAILQ_FIRST(head); prev = TAILQ_END(head); - if ((pcblist = malloc(size * sizeof(*pcblist))) == NULL) - err(1, "malloc"); + pcblist = NULL; + if (reallocarr(&pcblist, size, sizeof(*pcblist)) != 0) + err(1, "reallocarr"); i = 0; while (next != TAILQ_END(head)) { @@ -325,11 +326,8 @@ getpcblist_kmem(u_long off, const char * pcblist[i].ki_pflags = inpcb.inp_flags; if (i++ == size) { size += 100; - struct kinfo_pcb *n = realloc(pcblist, - size * sizeof(*pcblist)); - if (n == NULL) -err(1, "realloc"); - pcblist = n; + if (reallocarr(&pcblist, size, sizeof(*pcblist)) != 0) +err(1, "reallocarr"); } } *len = i; Index: src/usr.bin/netstat/inet6.c diff -u src/usr.bin/netstat/inet6.c:1.78 src/usr.bin/netstat/inet6.c:1.79 --- src/usr.bin/netstat/inet6.c:1.78 Fri Sep 10 21:52:18 2021 +++ src/usr.bin/netstat/inet6.c Sat Oct 30 11:23:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: inet6.c,v 1.78 2021/09/10 21:52:18 rillig Exp $ */ +/* $NetBSD: inet6.c,v 1.79 2021/10/30 11:23:07 nia Exp $ */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* @@ -64,7 +64,7 @@ #if 0 static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -__RCSID("$NetBSD: inet6.c,v 1.78 2021/09/10 21:52:18 rillig Exp $"); +__RCSID("$NetBSD: inet6.c,v 1.79 2021/10/30 11:23:07 nia Exp $"); #endif #endif /* not lint */ @@ -302,8 +302,9 @@ getpcblist_kmem(u_long off, const char * next = TAILQ_FIRST(head); prev = TAILQ_END(head); - if ((pcblist = malloc(size * sizeof(*pcblist))) == NULL) - err(1, "malloc"); + pcblist = NULL; + if (reallocarr(&pcblist, size, sizeof(*pcblist)) != 0) + err(1, "reallocarr"); i = 0; while (next != TAILQ_END(head)) { @@ -338,11 +339,8 @@ getpcblist_kmem(u_long off, const char * pcblist[i].ki_tstate = tcpcb.t_state; if (i++ == size) { size += 100; - struct kinfo_pcb *n = realloc(pcblist, - size * sizeof(*pcblist)); - if (n == NULL) -err(1, "realloc"); - pcblist = n; + if (reallocarr(&pcblist, size, sizeof(*pcblist)) != 0) +err(1, "reallocarr"); } } *len = i; Index: src/usr.bin/netstat/vtw.c diff -u src/usr.bin/netstat/vtw.c:1.11 src/usr.bin/netstat/vtw.c:1.12 --- src/usr.bin/netstat/vtw.c:1.11 Tue Mar 2 01:02:12 2021 +++ src/usr.bin/netstat/vtw.c Sat Oct 30 11:23:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vtw.c,v 1.11 2021/03/02 01:02:12 simonb Exp $ */ +/* $NetBSD: vtw.c,v 1.12 2021/10/30 11:23:07 nia Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -__RCSID("$NetBSD: vtw.c,v 1.11 2021/03/02 01:02:12 simonb Exp $"); +__RCSID("$NetBSD: vtw.c,v 1.12 2021/10/30 11:23:07 nia Exp $"); #endif #endif /* not lint */ @@ -303,8 +303,9 @@ show_vtw_v4(void (*print)(const vtw_t *) n = (klim - kbase + 1); if (!i) { - if ((ubase = malloc(n * sizeof(*kbase))) == NULL) -err(EXIT_FAILURE, NULL); + ubase = NULL; + if (reallocarr(&ubase, n, sizeof(*kbase)) != 0) +err(EXIT_FAILURE, "reallocarr"); snarf(kbase, ubase, n * sizeof(*ubase)); mem += n * sizeof(*ubase); @@ -333,9 +334,9 @@ show_vtw_v4(void (*print)(const vtw_t *) mem += (lim - base + 1) * sizeof(*base); - fat_tcpv4.base = malloc((lim - base + 1) * sizeof(*base)); - if (fat_tcpv4.base == NULL) - err(EXIT_FAILURE, NULL); + fat_tcpv4.base = NULL; + if (reallocarr(&fat_tcpv4.base, lim - base + 1, sizeof(*base)) != 0) + err(EXIT_FAILURE, "reallocarr"); fat_tcpv4.lim = fat_tcpv4.base + (lim - base); snarf(base, fat_tcpv4.base, sizeof(*base) * (lim - base + 1)); @@ -347,10 +348,13 @@ show_vtw_v4(void (*print)(const vtw_t *) hash = fat_
CVS commit: src/usr.bin/netstat
Module Name:src Committed By: nia Date: Sat Oct 30 11:23:07 UTC 2021 Modified Files: src/usr.bin/netstat: inet.c inet6.c vtw.c Log Message: netstat(1): convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/usr.bin/netstat/inet.c cvs rdiff -u -r1.78 -r1.79 src/usr.bin/netstat/inet6.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/netstat/vtw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/rpcbind
Module Name:src Committed By: nia Date: Sat Oct 30 11:04:48 UTC 2021 Modified Files: src/usr.sbin/rpcbind: rpcb_svc_com.c rpcbind.c Log Message: rpcbind(8): Use reallocarr, fix reallocation logic. In my_svc_run(), only update the fd count _after_ the allocation succeeds (which may be after waiting in the loop). This function previously tried to go to a label that doesn't exist. I wonder why GCC didn't catch this before but does now. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/rpcbind/rpcb_svc_com.c cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/rpcbind/rpcbind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/rpcbind/rpcb_svc_com.c diff -u src/usr.sbin/rpcbind/rpcb_svc_com.c:1.25 src/usr.sbin/rpcbind/rpcb_svc_com.c:1.26 --- src/usr.sbin/rpcbind/rpcb_svc_com.c:1.25 Tue Apr 13 05:58:45 2021 +++ src/usr.sbin/rpcbind/rpcb_svc_com.c Sat Oct 30 11:04:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rpcb_svc_com.c,v 1.25 2021/04/13 05:58:45 mrg Exp $ */ +/* $NetBSD: rpcb_svc_com.c,v 1.26 2021/10/30 11:04:48 nia Exp $ */ /* $FreeBSD: head/usr.sbin/rpcbind/rpcb_svc_com.c 301770 2016-06-09 22:25:00Z pfg $ */ /*- @@ -1106,7 +1106,7 @@ my_svc_run(void) { size_t nfds; struct pollfd *pollfds; - int npollfds; + int npollfds, newfdcount; int poll_ret, check_ret; int n, *m; #ifdef SVC_RUN_DEBUG @@ -1118,19 +1118,19 @@ my_svc_run(void) npollfds = 0; for (;;) { - if (svc_fdset_getsize(0) != npollfds) { - npollfds = svc_fdset_getsize(0); - pollfds = realloc(pollfds, npollfds * sizeof(*pollfds)); + newfdcount = svc_fdset_getsize(0); + if (newfdcount != npollfds) { + if (reallocarr(&pollfds, + newfdcount, sizeof(*pollfds)) != 0) { +syslog(LOG_ERR, "Cannot allocate pollfds"); +sleep(1); +continue; + } + npollfds = newfdcount; } p = pollfds; - if (p == NULL) { -out: - syslog(LOG_ERR, "Cannot allocate pollfds"); - sleep(1); - continue; - } if ((m = svc_fdset_getmax()) == NULL) - goto out; + break; for (n = 0; n <= *m; n++) { if (svc_fdset_isset(n)) { p->fd = n; Index: src/usr.sbin/rpcbind/rpcbind.c diff -u src/usr.sbin/rpcbind/rpcbind.c:1.30 src/usr.sbin/rpcbind/rpcbind.c:1.31 --- src/usr.sbin/rpcbind/rpcbind.c:1.30 Sun Mar 7 00:23:06 2021 +++ src/usr.sbin/rpcbind/rpcbind.c Sat Oct 30 11:04:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rpcbind.c,v 1.30 2021/03/07 00:23:06 christos Exp $ */ +/* $NetBSD: rpcbind.c,v 1.31 2021/10/30 11:04:48 nia Exp $ */ /*- * Copyright (c) 2009, Sun Microsystems, Inc. @@ -362,18 +362,15 @@ init_transport(struct netconfig *nconf) } if (strcmp(nconf->nc_netid, "local") != 0) { - char **nhp; /* * If no hosts were specified, just bind to INADDR_ANY. * Otherwise make sure 127.0.0.1 is added to the list. */ nhostsbak = nhosts + 1; - nhp = realloc(hosts, nhostsbak * sizeof(*hosts)); - if (nhp == NULL) { + if (reallocarr(&hosts, nhostsbak, sizeof(*hosts)) != 0) { syslog(LOG_ERR, "Can't grow hosts array"); return 1; } - hosts = nhp; if (nhostsbak == 1) hosts[0] = __UNCONST("*"); else { @@ -903,8 +900,7 @@ parseargs(int argc, char *argv[]) break; case 'h': ++nhosts; - hosts = realloc(hosts, nhosts * sizeof(*hosts)); - if (hosts == NULL) + if (reallocarr(&hosts, nhosts, sizeof(*hosts)) != 0) err(EXIT_FAILURE, "Can't allocate host array"); hosts[nhosts - 1] = strdup(optarg); if (hosts[nhosts - 1] == NULL)
CVS commit: src/usr.sbin/rpcbind
Module Name:src Committed By: nia Date: Sat Oct 30 11:04:48 UTC 2021 Modified Files: src/usr.sbin/rpcbind: rpcb_svc_com.c rpcbind.c Log Message: rpcbind(8): Use reallocarr, fix reallocation logic. In my_svc_run(), only update the fd count _after_ the allocation succeeds (which may be after waiting in the loop). This function previously tried to go to a label that doesn't exist. I wonder why GCC didn't catch this before but does now. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/rpcbind/rpcb_svc_com.c cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/rpcbind/rpcbind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libtelnet
Module Name:src Committed By: nia Date: Sat Oct 30 10:46:57 UTC 2021 Modified Files: src/lib/libtelnet: sra.c Log Message: libtelnet: convert malloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libtelnet/sra.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libtelnet
Module Name:src Committed By: nia Date: Sat Oct 30 10:46:57 UTC 2021 Modified Files: src/lib/libtelnet: sra.c Log Message: libtelnet: convert malloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libtelnet/sra.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libtelnet/sra.c diff -u src/lib/libtelnet/sra.c:1.11 src/lib/libtelnet/sra.c:1.12 --- src/lib/libtelnet/sra.c:1.11 Mon Jan 9 15:25:34 2012 +++ src/lib/libtelnet/sra.c Sat Oct 30 10:46:57 2021 @@ -32,7 +32,7 @@ #ifdef notdef __FBSDID("$FreeBSD: src/contrib/telnet/libtelnet/sra.c,v 1.16 2002/05/06 09:48:02 markm Exp $"); #else -__RCSID("$NetBSD: sra.c,v 1.11 2012/01/09 15:25:34 christos Exp $"); +__RCSID("$NetBSD: sra.c,v 1.12 2021/10/30 10:46:57 nia Exp $"); #endif #ifdef SRA @@ -517,9 +517,9 @@ auth_conv(int num_msg, const struct pam_ { int i; cred_t *cred = appdata; - struct pam_response *reply = malloc(sizeof(*reply) * num_msg); + struct pam_response *reply = NULL; - if (reply == NULL) + if (reallocarr(&reply, num_msg, sizeof(*reply)) != 0) return PAM_BUF_ERR; for (i = 0; i < num_msg; i++) {
CVS commit: src/usr.sbin/ndbootd
Module Name:src Committed By: nia Date: Sat Oct 30 10:44:25 UTC 2021 Modified Files: src/usr.sbin/ndbootd: ndbootd.c Log Message: ndbootd(8): Rework allocation macros to add integer overflow checking. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/ndbootd/ndbootd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ndbootd/ndbootd.c diff -u src/usr.sbin/ndbootd/ndbootd.c:1.12 src/usr.sbin/ndbootd/ndbootd.c:1.13 --- src/usr.sbin/ndbootd/ndbootd.c:1.12 Sun Apr 8 09:43:51 2007 +++ src/usr.sbin/ndbootd/ndbootd.c Sat Oct 30 10:44:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ndbootd.c,v 1.12 2007/04/08 09:43:51 scw Exp $ */ +/* $NetBSD: ndbootd.c,v 1.13 2021/10/30 10:44:25 nia Exp $ */ /* ndbootd.c - the Sun Network Disk (nd) daemon: */ @@ -81,7 +81,7 @@ #if 0 static const char _ndbootd_c_rcsid[] = "<>"; #else -__RCSID("$NetBSD: ndbootd.c,v 1.12 2007/04/08 09:43:51 scw Exp $"); +__RCSID("$NetBSD: ndbootd.c,v 1.13 2021/10/30 10:44:25 nia Exp $"); #endif /* includes: */ @@ -128,8 +128,8 @@ __RCSID("$NetBSD: ndbootd.c,v 1.12 2007/ #endif/* !HAVE_SOCKADDR_SA_LEN */ /* prototypes: */ -void *ndbootd_malloc _NDBOOTD_P((size_t)); -void *ndbootd_malloc0 _NDBOOTD_P((size_t)); +void *ndbootd_malloc _NDBOOTD_P((size_t, size_t)); +void *ndbootd_calloc _NDBOOTD_P((size_t, size_t)); void *ndbootd_memdup _NDBOOTD_P((void *, size_t)); /* globals: */ @@ -140,33 +140,34 @@ int _ndbootd_debug; /* allocators: */ void * -ndbootd_malloc(size_t size) +ndbootd_malloc(size_t number, size_t size) { - void *buffer; - if ((buffer = malloc(size)) == NULL) { + void *buffer = NULL; + if (reallocarr(&buffer, number, size) != 0) { abort(); } return (buffer); } void * -ndbootd_malloc0(size_t size) +ndbootd_calloc(size_t number, size_t size) { void *buffer; - buffer = ndbootd_malloc(size); - memset(buffer, 0, size); + if ((buffer = calloc(number, size)) == NULL) { + abort(); + } return (buffer); } void * ndbootd_memdup(void *buffer0, size_t size) { void *buffer1; - buffer1 = ndbootd_malloc(size); + buffer1 = ndbootd_malloc(1, size); memcpy(buffer1, buffer0, size); return (buffer1); } #define ndbootd_free free -#define ndbootd_new(t, c) ((t *) ndbootd_malloc(sizeof(t) * (c))) -#define ndbootd_new0(t, c) ((t *) ndbootd_malloc0(sizeof(t) * (c))) +#define ndbootd_new(t, c) ((t *) ndbootd_malloc(c, sizeof(t))) +#define ndbootd_new0(t, c) ((t *) ndbootd_calloc(c, sizeof(t))) #define ndbootd_dup(t, b, c) ((t *) ndbootd_memdup(b, c)) /* this calculates an IP packet header checksum: */
CVS commit: src/usr.sbin/ndbootd
Module Name:src Committed By: nia Date: Sat Oct 30 10:44:25 UTC 2021 Modified Files: src/usr.sbin/ndbootd: ndbootd.c Log Message: ndbootd(8): Rework allocation macros to add integer overflow checking. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/ndbootd/ndbootd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libpuffs
Module Name:src Committed By: nia Date: Sat Oct 30 10:34:19 UTC 2021 Modified Files: src/lib/libpuffs: framebuf.c puffs.c Log Message: puffs(3): Replace realloc(x * y) with reallocarr To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/lib/libpuffs/framebuf.c cvs rdiff -u -r1.124 -r1.125 src/lib/libpuffs/puffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libpuffs/framebuf.c diff -u src/lib/libpuffs/framebuf.c:1.35 src/lib/libpuffs/framebuf.c:1.36 --- src/lib/libpuffs/framebuf.c:1.35 Wed Jun 14 16:39:41 2017 +++ src/lib/libpuffs/framebuf.c Sat Oct 30 10:34:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: framebuf.c,v 1.35 2017/06/14 16:39:41 christos Exp $ */ +/* $NetBSD: framebuf.c,v 1.36 2021/10/30 10:34:18 nia Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: framebuf.c,v 1.35 2017/06/14 16:39:41 christos Exp $"); +__RCSID("$NetBSD: framebuf.c,v 1.36 2021/10/30 10:34:18 nia Exp $"); #endif /* !lint */ #include @@ -778,16 +778,15 @@ puffs__framev_addfd_ctrl(struct puffs_us struct puffs_framectrl *pfctrl) { struct puffs_fctrl_io *fio; - struct kevent *newevs; struct kevent kev[2]; size_t nevs; int rv, readenable; nevs = pu->pu_nevs+2; - newevs = realloc(pu->pu_evs, nevs*sizeof(struct kevent)); - if (newevs == NULL) + if (reallocarr(&pu->pu_evs, nevs, sizeof(struct kevent)) != 0) { + errno = ENOMEM; return -1; - pu->pu_evs = newevs; + } fio = malloc(sizeof(struct puffs_fctrl_io)); if (fio == NULL) Index: src/lib/libpuffs/puffs.c diff -u src/lib/libpuffs/puffs.c:1.124 src/lib/libpuffs/puffs.c:1.125 --- src/lib/libpuffs/puffs.c:1.124 Sat Jun 30 16:05:44 2018 +++ src/lib/libpuffs/puffs.c Sat Oct 30 10:34:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs.c,v 1.124 2018/06/30 16:05:44 christos Exp $ */ +/* $NetBSD: puffs.c,v 1.125 2021/10/30 10:34:18 nia Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: puffs.c,v 1.124 2018/06/30 16:05:44 christos Exp $"); +__RCSID("$NetBSD: puffs.c,v 1.125 2021/10/30 10:34:18 nia Exp $"); #endif /* !lint */ #include @@ -962,12 +962,14 @@ puffs_mainloop(struct puffs_usermount *p goto out; nevs = pu->pu_nevs + sigcatch; - curev = realloc(pu->pu_evs, nevs * sizeof(struct kevent)); - if (curev == NULL) + if (reallocarr(&pu->pu_evs, nevs, sizeof(struct kevent)) != 0) { + errno = ENOMEM; goto out; - pu->pu_evs = curev; + } pu->pu_nevs = nevs; + curev = pu->pu_evs; + LIST_FOREACH(fio, &pu->pu_ios, fio_entries) { EV_SET(curev, fio->io_fd, EVFILT_READ, EV_ADD, 0, 0, (intptr_t)fio);
CVS commit: src/lib/libpuffs
Module Name:src Committed By: nia Date: Sat Oct 30 10:34:19 UTC 2021 Modified Files: src/lib/libpuffs: framebuf.c puffs.c Log Message: puffs(3): Replace realloc(x * y) with reallocarr To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/lib/libpuffs/framebuf.c cvs rdiff -u -r1.124 -r1.125 src/lib/libpuffs/puffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/traceroute
Module Name:src Committed By: nia Date: Sat Oct 30 09:26:11 UTC 2021 Modified Files: src/usr.sbin/traceroute: ifaddrlist.c Log Message: traceroute(8): Convert realloc usage to reallocarr. Eliminate a temporary variable. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute/ifaddrlist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute/ifaddrlist.c diff -u src/usr.sbin/traceroute/ifaddrlist.c:1.11 src/usr.sbin/traceroute/ifaddrlist.c:1.12 --- src/usr.sbin/traceroute/ifaddrlist.c:1.11 Sun Aug 18 04:12:07 2019 +++ src/usr.sbin/traceroute/ifaddrlist.c Sat Oct 30 09:26:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ifaddrlist.c,v 1.11 2019/08/18 04:12:07 kamil Exp $ */ +/* $NetBSD: ifaddrlist.c,v 1.12 2021/10/30 09:26:11 nia Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -40,7 +40,7 @@ static const char rcsid[] = "@(#) Header: ifaddrlist.c,v 1.2 97/04/22 13:31:05 leres Exp (LBL)"; "@(#) Id: ifaddrlist.c,v 1.9 2000/11/23 20:01:55 leres Exp (LBL)"; #else -__RCSID("$NetBSD: ifaddrlist.c,v 1.11 2019/08/18 04:12:07 kamil Exp $"); +__RCSID("$NetBSD: ifaddrlist.c,v 1.12 2021/10/30 09:26:11 nia Exp $"); #endif #endif @@ -92,13 +92,13 @@ ifaddrlist(struct ifaddrlist **ipaddrp, { struct sockaddr_in *sin; struct ifaddrs *ifap = NULL, *ifa; - struct ifaddrlist *al = NULL, *nal; + struct ifaddrlist *al = NULL; size_t i = 0, maxal = 10; if (prog_getifaddrs(&ifap) != 0) goto out; - if ((al = malloc(maxal * sizeof(*al))) == NULL) + if (reallocarr(&al, maxal, sizeof(*al)) != 0) goto out; for (ifa = ifap; ifa; ifa = ifa->ifa_next) { @@ -119,9 +119,8 @@ ifaddrlist(struct ifaddrlist **ipaddrp, if (i == maxal) { maxal <<= 1; - if ((nal = realloc(al, maxal * sizeof(*al))) == NULL) + if (reallocarr(&al, maxal, sizeof(*al)) != 0) goto out; - al = nal; } al[i].addr = sin->sin_addr.s_addr; @@ -129,10 +128,10 @@ ifaddrlist(struct ifaddrlist **ipaddrp, goto out; i++; } - if ((nal = realloc(al, i * sizeof(*al))) == NULL) + if (reallocarr(&al, i, sizeof(*al)) != 0) goto out; freeifaddrs(ifap); - *ipaddrp = nal; + *ipaddrp = al; return (ssize_t)i; out: if (ifap)
CVS commit: src/usr.sbin/traceroute
Module Name:src Committed By: nia Date: Sat Oct 30 09:26:11 UTC 2021 Modified Files: src/usr.sbin/traceroute: ifaddrlist.c Log Message: traceroute(8): Convert realloc usage to reallocarr. Eliminate a temporary variable. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute/ifaddrlist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/finger
Module Name:src Committed By: nia Date: Sat Oct 30 09:12:09 UTC 2021 Modified Files: src/usr.bin/finger: finger.c Log Message: finger(1): convert malloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/finger/finger.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/finger/finger.c diff -u src/usr.bin/finger/finger.c:1.30 src/usr.bin/finger/finger.c:1.31 --- src/usr.bin/finger/finger.c:1.30 Mon Sep 5 00:40:28 2016 +++ src/usr.bin/finger/finger.c Sat Oct 30 09:12:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: finger.c,v 1.30 2016/09/05 00:40:28 sevan Exp $ */ +/* $NetBSD: finger.c,v 1.31 2021/10/30 09:12:09 nia Exp $ */ /* * Copyright (c) 1989, 1993 @@ -52,7 +52,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: finger.c,v 1.30 2016/09/05 00:40:28 sevan Exp $"); +__RCSID("$NetBSD: finger.c,v 1.31 2021/10/30 09:12:09 nia Exp $"); #endif #endif /* not lint */ @@ -226,8 +226,10 @@ userlist(int argc, char **argv) char **ap, **nargv, **np, **p; struct utmpentry *ep; - if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL || - (used = calloc(argc, sizeof(int))) == NULL) + nargv = NULL; + if (reallocarr(&nargv, argc + 1, sizeof(char *)) != 0) + err(1, NULL); + if ((used = calloc(argc, sizeof(int))) == NULL) err(1, NULL); /* Pull out all network requests. */
CVS commit: src/usr.bin/finger
Module Name:src Committed By: nia Date: Sat Oct 30 09:12:09 UTC 2021 Modified Files: src/usr.bin/finger: finger.c Log Message: finger(1): convert malloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/finger/finger.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/librefuse
Module Name:src Committed By: nia Date: Sat Oct 30 09:06:34 UTC 2021 Modified Files: src/lib/librefuse: refuse_opt.c Log Message: refuse(3): Simplify reallocation logic with reallocarr. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/librefuse/refuse_opt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librefuse/refuse_opt.c diff -u src/lib/librefuse/refuse_opt.c:1.18 src/lib/librefuse/refuse_opt.c:1.19 --- src/lib/librefuse/refuse_opt.c:1.18 Wed Nov 16 16:11:42 2016 +++ src/lib/librefuse/refuse_opt.c Sat Oct 30 09:06:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: refuse_opt.c,v 1.18 2016/11/16 16:11:42 pho Exp $ */ +/* $NetBSD: refuse_opt.c,v 1.19 2021/10/30 09:06:34 nia Exp $ */ /*- * Copyright (c) 2007 Juan Romero Pardines. @@ -58,13 +58,11 @@ fuse_opt_add_arg(struct fuse_args *args, args->allocated = ap->allocated; (void) free(ap); } else if (args->allocated == args->argc) { - void *a; int na = args->allocated + 10; - if ((a = realloc(args->argv, na * sizeof(*args->argv))) == NULL) + if (reallocarr(&args->argv, na, sizeof(*args->argv)) != 0) return -1; - args->argv = a; args->allocated = na; } DPRINTF(("%s: arguments passed: [arg:%s]\n", __func__, arg)); @@ -119,22 +117,18 @@ fuse_opt_insert_arg(struct fuse_args *ar { int i; int na; - void *a; DPRINTF(("%s: arguments passed: [pos=%d] [arg=%s]\n", __func__, pos, arg)); if (args->argv == NULL) { na = 10; - a = malloc(na * sizeof(*args->argv)); } else { na = args->allocated + 10; - a = realloc(args->argv, na * sizeof(*args->argv)); } - if (a == NULL) { + if (reallocarr(&args->argv, na, sizeof(*args->argv)) != 0) { warn("fuse_opt_insert_arg"); return -1; } - args->argv = a; args->allocated = na; for (i = args->argc++; i > pos; --i) {
CVS commit: src/lib/librefuse
Module Name:src Committed By: nia Date: Sat Oct 30 09:06:34 UTC 2021 Modified Files: src/lib/librefuse: refuse_opt.c Log Message: refuse(3): Simplify reallocation logic with reallocarr. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/librefuse/refuse_opt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/ypcat
Module Name:src Committed By: nia Date: Sat Oct 30 08:56:54 UTC 2021 Modified Files: src/usr.bin/ypcat: ypalias_init.c Log Message: ypcat(1): Convert realloc(x * y) to reallocarr. We can eliminate a temporary variable here too. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/ypcat/ypalias_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/ypcat/ypalias_init.c diff -u src/usr.bin/ypcat/ypalias_init.c:1.1 src/usr.bin/ypcat/ypalias_init.c:1.2 --- src/usr.bin/ypcat/ypalias_init.c:1.1 Sat Jun 20 19:27:26 2009 +++ src/usr.bin/ypcat/ypalias_init.c Sat Oct 30 08:56:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ypalias_init.c,v 1.1 2009/06/20 19:27:26 christos Exp $ */ +/* $NetBSD: ypalias_init.c,v 1.2 2021/10/30 08:56:54 nia Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation @@ -35,7 +35,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ypalias_init.c,v 1.1 2009/06/20 19:27:26 christos Exp $"); +__RCSID("$NetBSD: ypalias_init.c,v 1.2 2021/10/30 08:56:54 nia Exp $"); #endif #include @@ -69,9 +69,9 @@ ypalias_init(void) { FILE *fp; char *cp, *line; - struct ypalias *ypa, *nypa; + struct ypalias *ypa; size_t nypalias = 50; - size_t i, len, lineno; + size_t i = 0, len, lineno; if ((fp = fopen(_PATH_YPNICKNAMES, "r")) == NULL) return &def_ypaliases[0]; @@ -80,7 +80,7 @@ ypalias_init(void) goto out; lineno = 1; - for (i = 0; (line = fparseln(fp, &len, &lineno, NULL, + for (; (line = fparseln(fp, &len, &lineno, NULL, FPARSELN_UNESCALL));) { cp = line; /* Ignore malformed lines */ @@ -94,18 +94,16 @@ ypalias_init(void) i++; if (i == nypalias) { nypalias <<= 1; - nypa = realloc(ypa, sizeof(*ypa) * nypalias); - if (nypa == NULL) + if (reallocarr(&ypa, nypalias, sizeof(*ypa)) != 0) goto out; - ypa = nypa; } } ypa[i].alias = ypa[i].name = NULL; i++; (void)fclose(fp); - if ((nypa = realloc(ypa, sizeof(*ypa) * i)) != NULL) - return nypa; + if (reallocarr(&ypa, i, sizeof(*ypa)) == 0) + return ypa; out: warn("Cannot alllocate alias space, returning default list"); if (ypa) { @@ -116,5 +114,4 @@ out: } (void)fclose(fp); return def_ypaliases; - return ypa; }
CVS commit: src/usr.bin/ypcat
Module Name:src Committed By: nia Date: Sat Oct 30 08:56:54 UTC 2021 Modified Files: src/usr.bin/ypcat: ypalias_init.c Log Message: ypcat(1): Convert realloc(x * y) to reallocarr. We can eliminate a temporary variable here too. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/ypcat/ypalias_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Fri Oct 29 13:22:08 UTC 2021 Modified Files: src/lib/libcrypt: crypt-sha1.c Log Message: libcrypt: Fix a floating point exception when a low number of HMAC-SHA1 iterations are specified. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/crypt-sha1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt-sha1.c diff -u src/lib/libcrypt/crypt-sha1.c:1.9 src/lib/libcrypt/crypt-sha1.c:1.10 --- src/lib/libcrypt/crypt-sha1.c:1.9 Sat Oct 16 10:53:33 2021 +++ src/lib/libcrypt/crypt-sha1.c Fri Oct 29 13:22:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: crypt-sha1.c,v 1.9 2021/10/16 10:53:33 nia Exp $ */ +/* $NetBSD: crypt-sha1.c,v 1.10 2021/10/29 13:22:08 nia Exp $ */ /* * Copyright (c) 2004, Juniper Networks, Inc. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crypt-sha1.c,v 1.9 2021/10/16 10:53:33 nia Exp $"); +__RCSID("$NetBSD: crypt-sha1.c,v 1.10 2021/10/29 13:22:08 nia Exp $"); #endif /* not lint */ #include @@ -71,24 +71,15 @@ __RCSID("$NetBSD: crypt-sha1.c,v 1.9 202 crypt_private unsigned int __crypt_sha1_iterations (unsigned int hint) { -static int once = 1; - /* * We treat CRYPT_SHA1_ITERATIONS as a hint. * Make it harder for someone to pre-compute hashes for a * dictionary attack by not using the same iteration count for * every entry. */ - -if (once) { - int pid = getpid(); - - srandom(time(NULL) ^ (pid * pid)); - once = 0; -} -if (hint == 0) +if (hint < 4) hint = CRYPT_SHA1_ITERATIONS; -return hint - (random() % (hint / 4)); +return hint - arc4random_uniform(hint / 4); } /*
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Fri Oct 29 13:22:08 UTC 2021 Modified Files: src/lib/libcrypt: crypt-sha1.c Log Message: libcrypt: Fix a floating point exception when a low number of HMAC-SHA1 iterations are specified. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/crypt-sha1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/cgram
Module Name:src Committed By: nia Date: Fri Oct 29 11:45:39 UTC 2021 Modified Files: src/games/cgram: cgram.c Log Message: cgram(6): realloc(x * y) -> reallocarr To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/games/cgram/cgram.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/cgram/cgram.c diff -u src/games/cgram/cgram.c:1.25 src/games/cgram/cgram.c:1.26 --- src/games/cgram/cgram.c:1.25 Fri May 28 03:55:45 2021 +++ src/games/cgram/cgram.c Fri Oct 29 11:45:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cgram.c,v 1.25 2021/05/28 03:55:45 dholland Exp $ */ +/* $NetBSD: cgram.c,v 1.26 2021/10/29 11:45:39 nia Exp $ */ /*- * Copyright (c) 2013, 2021 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.c,v 1.25 2021/05/28 03:55:45 dholland Exp $"); +__RCSID("$NetBSD: cgram.c,v 1.26 2021/10/29 11:45:39 nia Exp $"); #endif #include @@ -154,8 +154,7 @@ static void stringarray_add(struct stringarray *a, struct string *s) { size_t num = a->num++; - a->v = realloc(a->v, a->num * sizeof a->v[0]); - if (a->v == NULL) + if (reallocarr(&a->v, a->num, sizeof(a->v[0])) != 0) errx(1, "Out of memory"); a->v[num] = *s; }
CVS commit: src/games/cgram
Module Name:src Committed By: nia Date: Fri Oct 29 11:45:39 UTC 2021 Modified Files: src/games/cgram: cgram.c Log Message: cgram(6): realloc(x * y) -> reallocarr To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/games/cgram/cgram.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/atc
Module Name:src Committed By: nia Date: Fri Oct 29 11:44:22 UTC 2021 Modified Files: src/games/atc: grammar.y Log Message: atc(6): simplify reallocation logic To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/games/atc/grammar.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/atc
Module Name:src Committed By: nia Date: Fri Oct 29 11:44:22 UTC 2021 Modified Files: src/games/atc: grammar.y Log Message: atc(6): simplify reallocation logic To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/games/atc/grammar.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/atc/grammar.y diff -u src/games/atc/grammar.y:1.12 src/games/atc/grammar.y:1.13 --- src/games/atc/grammar.y:1.12 Fri Jun 19 06:02:31 2015 +++ src/games/atc/grammar.y Fri Oct 29 11:44:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: grammar.y,v 1.12 2015/06/19 06:02:31 dholland Exp $ */ +/* $NetBSD: grammar.y,v 1.13 2021/10/29 11:44:22 nia Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -62,7 +62,7 @@ #if 0 static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: grammar.y,v 1.12 2015/06/19 06:02:31 dholland Exp $"); +__RCSID("$NetBSD: grammar.y,v 1.13 2021/10/29 11:44:22 nia Exp $"); #endif #endif /* not lint */ @@ -179,14 +179,8 @@ Bpoint: '(' ConstOp ConstOp ')' { if (sp->num_beacons % REALLOC == 0) { - if (sp->beacon == NULL) -sp->beacon = malloc((sp->num_beacons - + REALLOC) * sizeof (BEACON)); - else -sp->beacon = realloc(sp->beacon, - (sp->num_beacons + REALLOC) * - sizeof (BEACON)); - if (sp->beacon == NULL) + if (reallocarr(&sp->beacon, + sp->num_beacons + REALLOC, sizeof(BEACON)) != 0) return (yyerror("No memory available.")); } sp->beacon[sp->num_beacons].x = $2;
CVS commit: src/games/sail
Module Name:src Committed By: nia Date: Fri Oct 29 11:42:34 UTC 2021 Modified Files: src/games/sail: array.c Log Message: sail(6): convert realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/games/sail/array.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/sail/array.c diff -u src/games/sail/array.c:1.1 src/games/sail/array.c:1.2 --- src/games/sail/array.c:1.1 Sun Mar 15 03:33:56 2009 +++ src/games/sail/array.c Fri Oct 29 11:42:34 2021 @@ -73,18 +73,14 @@ int array_setsize(struct array *a, unsigned num) { unsigned newmax; - void **newptr; if (num > a->max) { newmax = a->max; while (num > newmax) { newmax = newmax ? newmax*2 : 4; } - newptr = realloc(a->v, newmax*sizeof(*a->v)); - if (newptr == NULL) { + if (reallocarr(&a->v, newmax, sizeof(*a->v)) != 0) return -1; - } - a->v = newptr; a->max = newmax; } a->num = num;
CVS commit: src/games/sail
Module Name:src Committed By: nia Date: Fri Oct 29 11:42:34 UTC 2021 Modified Files: src/games/sail: array.c Log Message: sail(6): convert realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/games/sail/array.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/games/hunt/hunt
Module Name:src Committed By: nia Date: Fri Oct 29 11:40:23 UTC 2021 Modified Files: src/games/hunt/hunt: server.c Log Message: huntd(6): convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/hunt/hunt/server.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/hunt/hunt/server.c diff -u src/games/hunt/hunt/server.c:1.8 src/games/hunt/hunt/server.c:1.9 --- src/games/hunt/hunt/server.c:1.8 Sun Mar 30 04:57:37 2014 +++ src/games/hunt/hunt/server.c Fri Oct 29 11:40:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: server.c,v 1.8 2014/03/30 04:57:37 dholland Exp $ */ +/* $NetBSD: server.c,v 1.9 2021/10/29 11:40:23 nia Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: server.c,v 1.8 2014/03/30 04:57:37 dholland Exp $"); +__RCSID("$NetBSD: server.c,v 1.9 2021/10/29 11:40:23 nia Exp $"); #include #include @@ -85,10 +85,9 @@ serverlist_setup(const char *explicit_ho numdaemons = 0; maxdaemons = 20; - daemons = malloc(maxdaemons * sizeof(daemons[0])); - if (daemons == NULL) { + daemons = NULL; + if (reallocarr(&daemons, maxdaemons, sizeof(daemons[0])) != 0) leavex(1, "Out of memory."); - } if (explicit_host_arg) { explicit_host = explicit_host_arg; @@ -111,10 +110,8 @@ add_daemon_addr(const struct sockaddr_st assert(numdaemons <= maxdaemons); if (numdaemons == maxdaemons) { maxdaemons += 20; - daemons = realloc(daemons, maxdaemons * sizeof(daemons[0])); - if (daemons == NULL) { + if (reallocarr(&daemons, maxdaemons, sizeof(daemons[0])) != 0) leave(1, "realloc"); - } } /* @@ -181,10 +178,9 @@ getbroadcastaddrs(void) } } - broadcastaddrs = malloc(num * sizeof(broadcastaddrs[0])); - if (broadcastaddrs == NULL) { + broadcastaddrs = NULL; + if (reallocarr(&broadcastaddrs, num, sizeof(broadcastaddrs[0])) != 0) leavex(1, "Out of memory"); - } i = 0; for (ip = ifp; ip; ip = ip->ifa_next) {
CVS commit: src/games/hunt/hunt
Module Name:src Committed By: nia Date: Fri Oct 29 11:40:23 UTC 2021 Modified Files: src/games/hunt/hunt: server.c Log Message: huntd(6): convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/hunt/hunt/server.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc
Module Name:src Committed By: nia Date: Fri Oct 29 11:03:46 UTC 2021 Modified Files: src/lib/libc/stdlib: radixsort.c src/lib/libc/string: wcsdup.c Log Message: reallocarr does not set errno. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdlib/radixsort.c cvs rdiff -u -r1.4 -r1.5 src/lib/libc/string/wcsdup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/stdlib/radixsort.c diff -u src/lib/libc/stdlib/radixsort.c:1.20 src/lib/libc/stdlib/radixsort.c:1.21 --- src/lib/libc/stdlib/radixsort.c:1.20 Fri Oct 29 10:29:51 2021 +++ src/lib/libc/stdlib/radixsort.c Fri Oct 29 11:03:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: radixsort.c,v 1.20 2021/10/29 10:29:51 nia Exp $ */ +/* $NetBSD: radixsort.c,v 1.21 2021/10/29 11:03:46 nia Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: radixsort.c,v 1.20 2021/10/29 10:29:51 nia Exp $"); +__RCSID("$NetBSD: radixsort.c,v 1.21 2021/10/29 11:03:46 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -130,8 +130,10 @@ sradixsort(const u_char **a, int n, cons simplesort(a, n, 0, tr, endch); else { ta = NULL; - if (reallocarr(&ta, n, sizeof(a)) != 0) + if (reallocarr(&ta, n, sizeof(a)) != 0) { + errno = ENOMEM; return (-1); + } r_sort_b(a, ta, n, 0, tr, endch); free(ta); } Index: src/lib/libc/string/wcsdup.c diff -u src/lib/libc/string/wcsdup.c:1.4 src/lib/libc/string/wcsdup.c:1.5 --- src/lib/libc/string/wcsdup.c:1.4 Fri Oct 29 10:11:57 2021 +++ src/lib/libc/string/wcsdup.c Fri Oct 29 11:03:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wcsdup.c,v 1.4 2021/10/29 10:11:57 nia Exp $ */ +/* $NetBSD: wcsdup.c,v 1.5 2021/10/29 11:03:46 nia Exp $ */ /* * Copyright (C) 2006 Aleksey Cheusov @@ -14,12 +14,13 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcsdup.c,v 1.4 2021/10/29 10:11:57 nia Exp $"); +__RCSID("$NetBSD: wcsdup.c,v 1.5 2021/10/29 11:03:46 nia Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" #include #include +#include #include __weak_alias(wcsdup,_wcsdup) @@ -35,8 +36,10 @@ wcsdup(const wchar_t *str) len = wcslen(str) + 1; copy = NULL; - if (reallocarr(©, len, sizeof(wchar_t)) != 0) + if (reallocarr(©, len, sizeof(wchar_t)) != 0) { + errno = ENOMEM; return NULL; + } return wmemcpy(copy, str, len); }
CVS commit: src/lib/libc
Module Name:src Committed By: nia Date: Fri Oct 29 11:03:46 UTC 2021 Modified Files: src/lib/libc/stdlib: radixsort.c src/lib/libc/string: wcsdup.c Log Message: reallocarr does not set errno. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdlib/radixsort.c cvs rdiff -u -r1.4 -r1.5 src/lib/libc/string/wcsdup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/citrus
Module Name:src Committed By: nia Date: Fri Oct 29 10:54:56 UTC 2021 Modified Files: src/lib/libc/citrus: citrus_db_factory.c Log Message: citrus: Use calloc instead of malloc'ing and clearing the array manually To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/citrus/citrus_db_factory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/citrus
Module Name:src Committed By: nia Date: Fri Oct 29 10:54:56 UTC 2021 Modified Files: src/lib/libc/citrus: citrus_db_factory.c Log Message: citrus: Use calloc instead of malloc'ing and clearing the array manually To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/citrus/citrus_db_factory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/citrus/citrus_db_factory.c diff -u src/lib/libc/citrus/citrus_db_factory.c:1.10 src/lib/libc/citrus/citrus_db_factory.c:1.11 --- src/lib/libc/citrus/citrus_db_factory.c:1.10 Sat Sep 14 13:05:51 2013 +++ src/lib/libc/citrus/citrus_db_factory.c Fri Oct 29 10:54:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: citrus_db_factory.c,v 1.10 2013/09/14 13:05:51 joerg Exp $ */ +/* $NetBSD: citrus_db_factory.c,v 1.11 2021/10/29 10:54:56 nia Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -32,7 +32,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: citrus_db_factory.c,v 1.10 2013/09/14 13:05:51 joerg Exp $"); +__RCSID("$NetBSD: citrus_db_factory.c,v 1.11 2021/10/29 10:54:56 nia Exp $"); #endif /* LIBC_SCCS and not lint */ #include @@ -274,11 +274,9 @@ _citrus_db_factory_serialize(struct _cit return 0; } /* allocate hash table */ - depp = malloc(sizeof(*depp) * df->df_num_entries); + depp = calloc(df->df_num_entries, sizeof(*depp)); if (depp == NULL) return -1; - for (i = 0; i < df->df_num_entries; i++) - depp[i] = NULL; /* step1: store the entries which are not conflicting */ SIMPLEQ_FOREACH(de, &df->df_entries, de_entry) {
CVS commit: src/lib/libc/gen
Module Name:src Committed By: nia Date: Fri Oct 29 10:40:00 UTC 2021 Modified Files: src/lib/libc/gen: scandir.c Log Message: scandir(3): Convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/scandir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/scandir.c diff -u src/lib/libc/gen/scandir.c:1.28 src/lib/libc/gen/scandir.c:1.29 --- src/lib/libc/gen/scandir.c:1.28 Fri Dec 16 04:45:04 2016 +++ src/lib/libc/gen/scandir.c Fri Oct 29 10:40:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: scandir.c,v 1.28 2016/12/16 04:45:04 mrg Exp $ */ +/* $NetBSD: scandir.c,v 1.29 2021/10/29 10:40:00 nia Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)scandir.c 8.3 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: scandir.c,v 1.28 2016/12/16 04:45:04 mrg Exp $"); +__RCSID("$NetBSD: scandir.c,v 1.29 2021/10/29 10:40:00 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -91,7 +91,7 @@ scandir(const char *dirname, struct dire int (*selectfn)(const struct dirent *), int (*dcomp)(const COMPARARG, const COMPARARG)) { - struct dirent *d, *p, **names, **newnames; + struct dirent *d, *p, **names; size_t nitems, arraysz; DIR *dirp; @@ -104,8 +104,8 @@ scandir(const char *dirname, struct dire if ((arraysz = dirsize(dirp->dd_fd, 0)) == 0) goto bad; - names = malloc(arraysz * sizeof(*names)); - if (names == NULL) + names = NULL; + if (reallocarr(&names, arraysz, sizeof(*names)) != 0) goto bad; nitems = 0; @@ -120,10 +120,8 @@ scandir(const char *dirname, struct dire if (nitems >= arraysz) { if ((arraysz = dirsize(dirp->dd_fd, arraysz)) == 0) goto bad2; - newnames = realloc(names, arraysz * sizeof(*names)); - if (newnames == NULL) + if (reallocarr(&names, arraysz, sizeof(*names)) != 0) goto bad2; - names = newnames; } /*
CVS commit: src/lib/libc/gen
Module Name:src Committed By: nia Date: Fri Oct 29 10:40:00 UTC 2021 Modified Files: src/lib/libc/gen: scandir.c Log Message: scandir(3): Convert malloc(x * y) and realloc(x * y) to reallocarr To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/scandir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/stdlib
Module Name:src Committed By: nia Date: Fri Oct 29 10:29:51 UTC 2021 Modified Files: src/lib/libc/stdlib: radixsort.c Log Message: radixsort(3): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libc/stdlib/radixsort.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/stdlib/radixsort.c diff -u src/lib/libc/stdlib/radixsort.c:1.19 src/lib/libc/stdlib/radixsort.c:1.20 --- src/lib/libc/stdlib/radixsort.c:1.19 Sat Sep 5 08:53:06 2009 +++ src/lib/libc/stdlib/radixsort.c Fri Oct 29 10:29:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: radixsort.c,v 1.19 2009/09/05 08:53:06 dsl Exp $ */ +/* $NetBSD: radixsort.c,v 1.20 2021/10/29 10:29:51 nia Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: radixsort.c,v 1.19 2009/09/05 08:53:06 dsl Exp $"); +__RCSID("$NetBSD: radixsort.c,v 1.20 2021/10/29 10:29:51 nia Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -129,7 +129,8 @@ sradixsort(const u_char **a, int n, cons if (n < THRESHOLD) simplesort(a, n, 0, tr, endch); else { - if ((ta = malloc(n * sizeof(a))) == NULL) + ta = NULL; + if (reallocarr(&ta, n, sizeof(a)) != 0) return (-1); r_sort_b(a, ta, n, 0, tr, endch); free(ta);
CVS commit: src/lib/libc/stdlib
Module Name:src Committed By: nia Date: Fri Oct 29 10:29:51 UTC 2021 Modified Files: src/lib/libc/stdlib: radixsort.c Log Message: radixsort(3): use reallocarr instead of malloc(x * y) To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libc/stdlib/radixsort.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: nia Date: Fri Oct 29 10:26:10 UTC 2021 Modified Files: src/share/man/man4: pdcsata.4 Log Message: pdcsata.4: Add HISTORY section, fix stray space. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/pdcsata.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: nia Date: Fri Oct 29 10:26:10 UTC 2021 Modified Files: src/share/man/man4: pdcsata.4 Log Message: pdcsata.4: Add HISTORY section, fix stray space. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/pdcsata.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/pdcsata.4 diff -u src/share/man/man4/pdcsata.4:1.6 src/share/man/man4/pdcsata.4:1.7 --- src/share/man/man4/pdcsata.4:1.6 Mon Oct 19 18:41:09 2009 +++ src/share/man/man4/pdcsata.4 Fri Oct 29 10:26:10 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: pdcsata.4,v 1.6 2009/10/19 18:41:09 bouyer Exp $ +.\" $NetBSD: pdcsata.4,v 1.7 2021/10/29 10:26:10 nia Exp $ .\" .\" Copyright (c) 2003 Manuel Bouyer. .\" @@ -35,7 +35,7 @@ The .Nm driver supports the Promise SATA150 (PDC20571, PDC20575, PDC20579, PDC20318, PDC20319, PDC20371, PDC20375, PDC20376, PDC20377, PDC20378, and PDC20379) and -SATA300 (PDC20775, PDC40518, PDC40519, PDC40718 , PDC40719 and PDC40779) +SATA300 (PDC20775, PDC40518, PDC40519, PDC40718, PDC40719 and PDC40779) families of serial-ATA controllers, and provides the interface with the hardware for the .Xr ata 4 @@ -48,3 +48,8 @@ driver. .Xr pciide 4 , .Xr wd 4 , .Xr wdc 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Nx 2.1 .
CVS commit: src/share/man/man4
Module Name:src Committed By: nia Date: Fri Oct 29 10:21:28 UTC 2021 Modified Files: src/share/man/man4: pci.4 usb.4 Log Message: Add some missing device drivers to the lists. >From bobs at thelibertytree.org, thanks! To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/share/man/man4/pci.4 cvs rdiff -u -r1.118 -r1.119 src/share/man/man4/usb.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/pci.4 diff -u src/share/man/man4/pci.4:1.120 src/share/man/man4/pci.4:1.121 --- src/share/man/man4/pci.4:1.120 Sun Aug 1 21:56:27 2021 +++ src/share/man/man4/pci.4 Fri Oct 29 10:21:28 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: pci.4,v 1.120 2021/08/01 21:56:27 andvar Exp $ +.\" $NetBSD: pci.4,v 1.121 2021/10/29 10:21:28 nia Exp $ .\" .\" Copyright (c) 1997 Jason R. Thorpe. All rights reserved. .\" Copyright (c) 1997 Jonathan Stone @@ -29,7 +29,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 17, 2021 +.Dd October 29, 2021 .Dt PCI 4 .Os .Sh NAME @@ -175,6 +175,8 @@ Mylex DAC960 and DEC SWXCR RAID controll National Semiconductor PC87415 PCI-IDE controllers. .It Xr nvme 4 Non-Volatile Memory (NVM Express) host controllers. +.It Xr pdcsata 4 +Promise Serial-ATA disk controllers. .It Xr pciide 4 IDE disk controllers. .It Xr rtsx 4 Index: src/share/man/man4/usb.4 diff -u src/share/man/man4/usb.4:1.118 src/share/man/man4/usb.4:1.119 --- src/share/man/man4/usb.4:1.118 Tue Jun 29 10:22:37 2021 +++ src/share/man/man4/usb.4 Fri Oct 29 10:21:28 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: usb.4,v 1.118 2021/06/29 10:22:37 nia Exp $ +.\" $NetBSD: usb.4,v 1.119 2021/10/29 10:21:28 nia Exp $ .\" .\" Copyright (c) 1999-2014 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 27, 2021 +.Dd October 29, 2021 .Dt USB 4 .Os .Sh NAME @@ -109,6 +109,8 @@ MosChip MCS7730/7830/7832 10/100 USB Eth Microchip LAN75xx/LAN78xx 10/100/Gigabit USB Ethernet device .It Xr udav 4 Davicom DM9601 10/100 USB Ethernet device +.It Xr ure 4 +Realtek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device .It Xr url 4 Realtek RTL8150L 10/100 USB Ethernet device .It Xr urndis 4
CVS commit: src/share/man/man4
Module Name:src Committed By: nia Date: Fri Oct 29 10:21:28 UTC 2021 Modified Files: src/share/man/man4: pci.4 usb.4 Log Message: Add some missing device drivers to the lists. >From bobs at thelibertytree.org, thanks! To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/share/man/man4/pci.4 cvs rdiff -u -r1.118 -r1.119 src/share/man/man4/usb.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/string
Module Name:src Committed By: nia Date: Fri Oct 29 10:11:57 UTC 2021 Modified Files: src/lib/libc/string: wcsdup.c Log Message: wcsdup(3): use reallocarr to catch integer overflow To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libc/string/wcsdup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/string
Module Name:src Committed By: nia Date: Fri Oct 29 10:11:57 UTC 2021 Modified Files: src/lib/libc/string: wcsdup.c Log Message: wcsdup(3): use reallocarr to catch integer overflow To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libc/string/wcsdup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/string/wcsdup.c diff -u src/lib/libc/string/wcsdup.c:1.3 src/lib/libc/string/wcsdup.c:1.4 --- src/lib/libc/string/wcsdup.c:1.3 Mon May 26 13:17:48 2008 +++ src/lib/libc/string/wcsdup.c Fri Oct 29 10:11:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $ */ +/* $NetBSD: wcsdup.c,v 1.4 2021/10/29 10:11:57 nia Exp $ */ /* * Copyright (C) 2006 Aleksey Cheusov @@ -14,7 +14,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $"); +__RCSID("$NetBSD: wcsdup.c,v 1.4 2021/10/29 10:11:57 nia Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -33,9 +33,9 @@ wcsdup(const wchar_t *str) _DIAGASSERT(str != NULL); len = wcslen(str) + 1; - copy = malloc(len * sizeof (wchar_t)); - if (!copy) + copy = NULL; + if (reallocarr(©, len, sizeof(wchar_t)) != 0) return NULL; return wmemcpy(copy, str, len);
CVS commit: src/lib/libc/net
Module Name:src Committed By: nia Date: Wed Oct 27 19:24:38 UTC 2021 Modified Files: src/lib/libc/net: getaddrinfo.c Log Message: getaddrinfo(3): malloc + memset -> calloc To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/lib/libc/net/getaddrinfo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/net
Module Name:src Committed By: nia Date: Wed Oct 27 19:24:38 UTC 2021 Modified Files: src/lib/libc/net: getaddrinfo.c Log Message: getaddrinfo(3): malloc + memset -> calloc To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/lib/libc/net/getaddrinfo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/net/getaddrinfo.c diff -u src/lib/libc/net/getaddrinfo.c:1.120 src/lib/libc/net/getaddrinfo.c:1.121 --- src/lib/libc/net/getaddrinfo.c:1.120 Wed Nov 18 12:49:52 2020 +++ src/lib/libc/net/getaddrinfo.c Wed Oct 27 19:24:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: getaddrinfo.c,v 1.120 2020/11/18 12:49:52 is Exp $ */ +/* $NetBSD: getaddrinfo.c,v 1.121 2021/10/27 19:24:38 nia Exp $ */ /* $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $ */ /* @@ -55,7 +55,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: getaddrinfo.c,v 1.120 2020/11/18 12:49:52 is Exp $"); +__RCSID("$NetBSD: getaddrinfo.c,v 1.121 2021/10/27 19:24:38 nia Exp $"); #endif /* LIBC_SCCS and not lint */ #ifndef RUMP_ACTION @@ -717,9 +717,8 @@ reorder(struct addrinfo *sentinel, struc return n; /* allocate a temporary array for sort and initialization of it. */ - if ((aio = malloc(sizeof(*aio) * n)) == NULL) + if ((aio = calloc(n, sizeof(*aio))) == NULL) return n; /* give up reordering */ - memset(aio, 0, sizeof(*aio) * n); /* retrieve address selection policy from the kernel */ TAILQ_INIT(&policyhead);
CVS commit: src/tests/usr.bin/pwhash
Module Name:src Committed By: nia Date: Wed Oct 27 06:50:02 UTC 2021 Modified Files: src/tests/usr.bin/pwhash: t_pwhash.sh Log Message: t_pwhash: Don't assume default cipher is SHA1. Add Argon2 tests. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/pwhash/t_pwhash.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/pwhash
Module Name:src Committed By: nia Date: Wed Oct 27 06:50:02 UTC 2021 Modified Files: src/tests/usr.bin/pwhash: t_pwhash.sh Log Message: t_pwhash: Don't assume default cipher is SHA1. Add Argon2 tests. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/pwhash/t_pwhash.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/pwhash/t_pwhash.sh diff -u src/tests/usr.bin/pwhash/t_pwhash.sh:1.1 src/tests/usr.bin/pwhash/t_pwhash.sh:1.2 --- src/tests/usr.bin/pwhash/t_pwhash.sh:1.1 Sat Oct 5 18:06:17 2019 +++ src/tests/usr.bin/pwhash/t_pwhash.sh Wed Oct 27 06:50:02 2021 @@ -25,7 +25,40 @@ pwhash_sha1_head() { pwhash_sha1_body() { atf_check -s exit:0 -o match:"^\\\$sha1\\\$" -x \ - 'echo -n password | pwhash' + 'echo -n password | pwhash -S 24680' +} + +atf_test_case pwhash_argon2i +pwhash_argon2i_head() { + atf_set "descr" "ATF test for pwhash using Argon2i" +} + +pwhash_argon2i_body() { + atf_check -s exit:0 \ + -o match:"^\\\$argon2i\\\$v=19\\\$m=1024,t=1,p=1\\\$" -x \ + 'echo -n password | pwhash -A argon2i,m=1024,t=1' +} + +atf_test_case pwhash_argon2id +pwhash_argon2id_head() { + atf_set "descr" "ATF test for pwhash using Argon2id" +} + +pwhash_argon2id_body() { + atf_check -s exit:0 \ + -o match:"^\\\$argon2id\\\$v=19\\\$m=256,t=3,p=1\\\$" -x \ + 'echo -n password | pwhash -A argon2id,m=256,t=3' +} + +atf_test_case pwhash_argon2d +pwhash_argon2d_head() { + atf_set "descr" "ATF test for pwhash using Argon2d" +} + +pwhash_argon2d_body() { + atf_check -s exit:0 \ + -o match:"^\\\$argon2d\\\$v=19\\\$" -x \ + 'echo -n password | pwhash -A argon2d' } atf_test_case pwhash_des @@ -43,5 +76,8 @@ atf_init_test_cases() atf_add_test_case pwhash_blowfish_r12 atf_add_test_case pwhash_md5 atf_add_test_case pwhash_sha1 + atf_add_test_case pwhash_argon2i + atf_add_test_case pwhash_argon2id + atf_add_test_case pwhash_argon2d atf_add_test_case pwhash_des }
CVS commit: src/doc
Module Name:src Committed By: nia Date: Tue Oct 26 21:18:51 UTC 2021 Modified Files: src/doc: CHANGES Log Message: doc: password hash changes To generate a diff of this commit: cvs rdiff -u -r1.2845 -r1.2846 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2845 src/doc/CHANGES:1.2846 --- src/doc/CHANGES:1.2845 Fri Oct 22 21:03:50 2021 +++ src/doc/CHANGES Tue Oct 26 21:18:51 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2845 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2846 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -447,3 +447,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0: dhcpcd(8): Update to dhcpcd-9.4.1. [roy 20211022] tzcode: Updated to 2021e. [christos 20211022] tzdata: updated to 2021e (still missing trash from 2021b) [kre 20211022] + passwd.conf(5): Make 'argon2id' the default cipher for new + passwords. [nia 20211026]
CVS commit: src/doc
Module Name:src Committed By: nia Date: Tue Oct 26 21:18:51 UTC 2021 Modified Files: src/doc: CHANGES Log Message: doc: password hash changes To generate a diff of this commit: cvs rdiff -u -r1.2845 -r1.2846 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: nia Date: Tue Oct 26 20:44:46 UTC 2021 Modified Files: src/etc: passwd.conf src/share/man/man5: passwd.conf.5 Log Message: passwd.conf(5): switch default cipher for new user accounts to Argon2id As well as offering a dynamic amount of iterations and memory usage, which fits well with NetBSD's goal of running on a diverse range of hardware devices, Argon2id offers improved resistance to GPU-based password cracking and side channel attacks. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/etc/passwd.conf cvs rdiff -u -r1.12 -r1.13 src/share/man/man5/passwd.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/passwd.conf diff -u src/etc/passwd.conf:1.3 src/etc/passwd.conf:1.4 --- src/etc/passwd.conf:1.3 Fri Dec 3 21:40:04 2010 +++ src/etc/passwd.conf Tue Oct 26 20:44:45 2021 @@ -1,9 +1,9 @@ -# $NetBSD: passwd.conf,v 1.3 2010/12/03 21:40:04 jmmv Exp $ +# $NetBSD: passwd.conf,v 1.4 2021/10/26 20:44:45 nia Exp $ # # passwd.conf(5) - # password configuration file # default: - localcipher = sha1 + localcipher = argon2id ypcipher = old Index: src/share/man/man5/passwd.conf.5 diff -u src/share/man/man5/passwd.conf.5:1.12 src/share/man/man5/passwd.conf.5:1.13 --- src/share/man/man5/passwd.conf.5:1.12 Tue Oct 12 11:08:14 2021 +++ src/share/man/man5/passwd.conf.5 Tue Oct 26 20:44:45 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: passwd.conf.5,v 1.12 2021/10/12 11:08:14 nia Exp $ +.\" $NetBSD: passwd.conf.5,v 1.13 2021/10/26 20:44:45 nia Exp $ .\" .\" Copyright 1997 Niels Provos .\" All rights reserved. @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 12, 2021 +.Dd October 26, 2021 .Dt PASSWD.CONF 5 .Os .Sh NAME @@ -139,3 +139,12 @@ in .Pa /etc/passwd.conf starting from .Nx 6.0 . +.Pp +The default value of +.Sy localcipher +was set to +.Dq argon2id +in +.Pa /etc/passwd.conf +starting from +.Nx 10.0 .
CVS commit: src
Module Name:src Committed By: nia Date: Tue Oct 26 20:44:46 UTC 2021 Modified Files: src/etc: passwd.conf src/share/man/man5: passwd.conf.5 Log Message: passwd.conf(5): switch default cipher for new user accounts to Argon2id As well as offering a dynamic amount of iterations and memory usage, which fits well with NetBSD's goal of running on a diverse range of hardware devices, Argon2id offers improved resistance to GPU-based password cracking and side channel attacks. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/etc/passwd.conf cvs rdiff -u -r1.12 -r1.13 src/share/man/man5/passwd.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Tue Oct 26 20:37:18 UTC 2021 Modified Files: src/lib/libcrypt: Makefile Log Message: libcrypt: Make Werror-disables for external Argon2 library per-file. Requested by rin. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/lib/libcrypt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Tue Oct 26 20:37:18 UTC 2021 Modified Files: src/lib/libcrypt: Makefile Log Message: libcrypt: Make Werror-disables for external Argon2 library per-file. Requested by rin. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/lib/libcrypt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/Makefile diff -u src/lib/libcrypt/Makefile:1.30 src/lib/libcrypt/Makefile:1.31 --- src/lib/libcrypt/Makefile:1.30 Tue Oct 26 07:51:23 2021 +++ src/lib/libcrypt/Makefile Tue Oct 26 20:37:18 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.30 2021/10/26 07:51:23 nia Exp $ +# $NetBSD: Makefile,v 1.31 2021/10/26 20:37:18 nia Exp $ .include @@ -24,10 +24,10 @@ SRCS+= crypt-argon2.c # libargon2 sources . for src in argon2.c core.c blake2b.c encoding.c ref.c SRCS+= ${src} -COPTS.${src}+= -Wno-error=cast-qual -COPTS.${src}+= -Wno-error=type-limits COPTS.${src}+= -fvisibility=hidden . endfor +COPTS.argon2.c+= -Wno-error=cast-qual +COPTS.core.c+= -Wno-error=type-limits . if ${MACHINE} == "vax" COPTS.blake2b.c+= -O0 . endif
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Tue Oct 26 07:51:23 UTC 2021 Modified Files: src/lib/libcrypt: Makefile Log Message: libcrypt: fine-grained warnings for argon2, requested by rin To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/lib/libcrypt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/Makefile diff -u src/lib/libcrypt/Makefile:1.29 src/lib/libcrypt/Makefile:1.30 --- src/lib/libcrypt/Makefile:1.29 Wed Oct 13 14:28:32 2021 +++ src/lib/libcrypt/Makefile Tue Oct 26 07:51:23 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.29 2021/10/13 14:28:32 nia Exp $ +# $NetBSD: Makefile,v 1.30 2021/10/26 07:51:23 nia Exp $ .include @@ -24,7 +24,8 @@ SRCS+= crypt-argon2.c # libargon2 sources . for src in argon2.c core.c blake2b.c encoding.c ref.c SRCS+= ${src} -COPTS.${src}+= -Wno-error +COPTS.${src}+= -Wno-error=cast-qual +COPTS.${src}+= -Wno-error=type-limits COPTS.${src}+= -fvisibility=hidden . endfor . if ${MACHINE} == "vax"
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Tue Oct 26 07:51:23 UTC 2021 Modified Files: src/lib/libcrypt: Makefile Log Message: libcrypt: fine-grained warnings for argon2, requested by rin To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/lib/libcrypt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/calendar/calendars
Module Name:src Committed By: nia Date: Thu Oct 21 11:45:24 UTC 2021 Modified Files: src/usr.bin/calendar/calendars: calendar.christian Log Message: update (western) christian calendar for 2022, with a particular focus on public holidays relevant to me To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/calendar/calendars/calendar.christian Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/calendar/calendars/calendar.christian diff -u src/usr.bin/calendar/calendars/calendar.christian:1.8 src/usr.bin/calendar/calendars/calendar.christian:1.9 --- src/usr.bin/calendar/calendars/calendar.christian:1.8 Mon Dec 16 07:18:11 2019 +++ src/usr.bin/calendar/calendars/calendar.christian Thu Oct 21 11:45:24 2021 @@ -1,17 +1,20 @@ -01/06* Epiphany -02/25* Shrove Tuesday / Mardi Gras (day before Ash Wednesday) -02/26* Ash Wednesday (First day of Lent) -04/05* Palm Sunday (7 days before Easter) -04/09* Maundy Thursday (3 days before Easter) -04/10* Good Friday (2 days before Easter) -04/12* Easter Sunday -05/17* Rogation Sunday -05/21* Ascension Day (10 days before Pentecost) -05/31* Pentecost (Whitsunday) -06/01* Whitmonday -06/07* Trinity Sunday (7 days after Pentecost) -06/11* Corpus Christi (11 days after Pentecost) +01/06 Epiphany +03/01* Shrove Tuesday / Mardi Gras (day before Ash Wednesday) +03/02* Ash Wednesday (First day of Lent) +04/10* Palm Sunday (7 days before Easter) +04/14* Maundy Thursday (3 days before Easter) +04/15* Good Friday (2 days before Easter) +04/17* Easter Sunday +04/18* Easter Monday +05/25* Rogation Sunday +05/26* Ascension Day (10 days before Pentecost) +06/05* Pentecost (Whitsunday) +06/06* Whitmonday +06/12* Trinity Sunday (7 days after Pentecost) +06/16* Corpus Christi (11 days after Pentecost) 10/18 Feast Day of St. Luke 11/29* First Sunday of Advent (4th Sunday before Christmas) 12/06 St. Nicholas' Day +12/24 Christmas Eve 12/25 Feast of the Nativity (Christmas) +12/26 Boxing Day
CVS commit: src/usr.bin/calendar/calendars
Module Name:src Committed By: nia Date: Thu Oct 21 11:45:24 UTC 2021 Modified Files: src/usr.bin/calendar/calendars: calendar.christian Log Message: update (western) christian calendar for 2022, with a particular focus on public holidays relevant to me To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/calendar/calendars/calendar.christian Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 20:29:33 UTC 2021 Modified Files: src/lib/libcrypt: crypt.3 Log Message: crypt.3: add a reference for Argon2 To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/lib/libcrypt/crypt.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 20:29:33 UTC 2021 Modified Files: src/lib/libcrypt: crypt.3 Log Message: crypt.3: add a reference for Argon2 To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/lib/libcrypt/crypt.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt.3 diff -u src/lib/libcrypt/crypt.3:1.32 src/lib/libcrypt/crypt.3:1.33 --- src/lib/libcrypt/crypt.3:1.32 Tue Oct 12 21:41:13 2021 +++ src/lib/libcrypt/crypt.3 Wed Oct 20 20:29:33 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: crypt.3,v 1.32 2021/10/12 21:41:13 wiz Exp $ +.\" $NetBSD: crypt.3,v 1.33 2021/10/20 20:29:33 nia Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)crypt.3 8.2 (Berkeley) 12/11/93 .\" -.Dd October 12, 2021 +.Dd October 20, 2021 .Dt CRYPT 3 .Os .Sh NAME @@ -372,6 +372,15 @@ usual political silliness. .Xr passwd 5 , .Xr passwd.conf 5 .Rs +.%T "Argon2: the memory-hard function for password hashing and other applications" +.%A Alex Biryukov +.%A Daniel Dinu +.%A Dmitry Khovratovich +.%D 2017 +.%I University of Luxembourg +.%U https://www.password-hashing.net/ +.Re +.Rs .%T "Mathematical Cryptology for Computer Scientists and Mathematicians" .%A Wayne Patterson .%D 1987
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 20:21:44 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: Be a little bit more eager to let Argon2 use memory. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt-argon2.c diff -u src/lib/libcrypt/crypt-argon2.c:1.13 src/lib/libcrypt/crypt-argon2.c:1.14 --- src/lib/libcrypt/crypt-argon2.c:1.13 Wed Oct 20 16:46:33 2021 +++ src/lib/libcrypt/crypt-argon2.c Wed Oct 20 20:21:44 2021 @@ -179,9 +179,15 @@ estimate_argon2_params(argon2_type atype */ max_mem /= 100; if (max_mem > 3) { - memory = 8192; + memory = 32768; + } else if (max_mem > 15000) { + memory = 16384; } else if (max_mem > 7000) { + memory = 8192; + } else if (max_mem > 3000) { memory = 4096; + } else if (max_mem > 900) { + memory = 1024; } else if (max_mem > 24) { memory = 256; } else {
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 20:21:44 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: Be a little bit more eager to let Argon2 use memory. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/pwhash
Module Name:src Committed By: nia Date: Wed Oct 20 17:30:29 UTC 2021 Modified Files: src/usr.bin/pwhash: pwhash.1 Log Message: Update remarks on default parameters for Argon2. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/pwhash/pwhash.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/pwhash/pwhash.1 diff -u src/usr.bin/pwhash/pwhash.1:1.10 src/usr.bin/pwhash/pwhash.1:1.11 --- src/usr.bin/pwhash/pwhash.1:1.10 Tue Oct 12 17:24:37 2021 +++ src/usr.bin/pwhash/pwhash.1 Wed Oct 20 17:30:28 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: pwhash.1,v 1.10 2021/10/12 17:24:37 nia Exp $ +.\" $NetBSD: pwhash.1,v 1.11 2021/10/20 17:30:28 nia Exp $ .\" $OpenBSD: encrypt.1,v 1.16 2000/11/09 17:52:07 aaron Exp $ .\" .\" Copyright (c) 1996, Jason Downs. All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 24, 2016 +.Dd October 20, 2021 .Dt PWHASH 1 .Os .Sh NAME @@ -80,14 +80,14 @@ Following the required name, three optional comma-delimited parameters may be provided, t=n Specify the number of iterations to n. -The default is 3. m=n Specify the memory usage in KB to n. -The default is 4096. p=n Specify the number of threads to n. This is currently ignored. -The default is 1. + +If unspecified, default parameters are calculated based on system +performance and available resources. .It Fl s Ar salt Encrypt the string using DES, with the specified .Ar salt .
CVS commit: src/usr.bin/pwhash
Module Name:src Committed By: nia Date: Wed Oct 20 17:30:29 UTC 2021 Modified Files: src/usr.bin/pwhash: pwhash.1 Log Message: Update remarks on default parameters for Argon2. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/pwhash/pwhash.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 16:46:34 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: crypt(3): For argon2, default to time=3. Good enough for a 50MHz SPARC, a shark, and the spec. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt-argon2.c diff -u src/lib/libcrypt/crypt-argon2.c:1.12 src/lib/libcrypt/crypt-argon2.c:1.13 --- src/lib/libcrypt/crypt-argon2.c:1.12 Wed Oct 20 15:35:42 2021 +++ src/lib/libcrypt/crypt-argon2.c Wed Oct 20 16:46:33 2021 @@ -156,7 +156,7 @@ estimate_argon2_params(argon2_type atype size_t max_mem_sz = sizeof(max_mem); /* low values from argon2 test suite... */ uint32_t memory = 256; - uint32_t time = 2; + uint32_t time = 3; uint32_t threads = 1; if (*ememory < ARGON2_MIN_MEMORY) { @@ -226,7 +226,7 @@ error: *ethreads = threads; return 0; reset: - time = 2; + time = 3; memory = 256; threads = 1; goto error;
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 16:46:34 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: crypt(3): For argon2, default to time=3. Good enough for a 50MHz SPARC, a shark, and the spec. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 15:35:42 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: crypt(3): return 0 -> return NULL for function returning char * To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt-argon2.c diff -u src/lib/libcrypt/crypt-argon2.c:1.11 src/lib/libcrypt/crypt-argon2.c:1.12 --- src/lib/libcrypt/crypt-argon2.c:1.11 Wed Oct 20 13:03:29 2021 +++ src/lib/libcrypt/crypt-argon2.c Wed Oct 20 15:35:42 2021 @@ -398,7 +398,7 @@ __crypt_argon2(const char *pw, const cha if (rc < 0) { /* unable to parse input params */ - return 0; + return NULL; } rc = argon2_hash(ctx.t_cost, ctx.m_cost, @@ -409,7 +409,7 @@ __crypt_argon2(const char *pw, const cha if (rc != ARGON2_OK) { fprintf(stderr, "argon2: failed: %s\n", argon2_error_message(rc)); - return 0; + return NULL; } memcpy(rbuf, encodebuf, sizeof(encodebuf));
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 15:35:42 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: crypt(3): return 0 -> return NULL for function returning char * To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 13:03:29 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c pw_gensalt.c Log Message: crypt(3): Adapt default Argon2 parameters to system performance If the parameters are unspecified: - Set the default memory consumption based on the amount of memory available to userspace. The algorithm actually slows down incredibly quickly as the "memory" parameter is increased. We want to avoid running out of memory on low memory systems, but increase the difficulty of bruteforcing passwords from systems with a lot of memory. At the same time, we want to avoid problems when concurrent logins are happening. - Run a hashing loop for one second with steadily increasing "time" until we settle on a value for "time". We want to use as much CPU time as reasonable for computing the password hash without making logins inconvenient. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libcrypt/crypt-argon2.c cvs rdiff -u -r1.12 -r1.13 src/lib/libcrypt/pw_gensalt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt-argon2.c diff -u src/lib/libcrypt/crypt-argon2.c:1.10 src/lib/libcrypt/crypt-argon2.c:1.11 --- src/lib/libcrypt/crypt-argon2.c:1.10 Sat Oct 16 10:53:33 2021 +++ src/lib/libcrypt/crypt-argon2.c Wed Oct 20 13:03:29 2021 @@ -24,6 +24,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include +#include +#include +#include + #include #include #include @@ -37,6 +42,10 @@ #include #include "crypt.h" +crypt_private int +estimate_argon2_params(argon2_type, uint32_t *, +uint32_t *, uint32_t *); + /* defaults pulled from run.c */ #define HASHLEN 32 #define T_COST_DEF 3 @@ -57,6 +66,10 @@ #define ARGON2_ARGON2D_STR "argon2d" #define ARGON2_ARGON2ID_STR "argon2id" +/* + * Unpadded Base64 calculations are taken from the Apache2/CC-0 + * licensed libargon2 for compatibility + */ /* * Some macros for constant-time comparisons. These work over values in @@ -123,6 +136,103 @@ from_base64(void *dst, size_t *dst_len, return src; } +/* + * Used to find default parameters that perform well on the host + * machine. Inputs should dereference to either 0 (to estimate), + * or desired value. + */ +crypt_private int +estimate_argon2_params(argon2_type atype, uint32_t *etime, +uint32_t *ememory, uint32_t *ethreads) +{ + const int mib[] = { CTL_HW, HW_USERMEM64 }; + struct timespec tp1, tp2, delta; + char tmp_salt[16]; + char tmp_pwd[16]; + uint32_t tmp_hash[32]; + char tmp_encoded[256]; + struct rlimit rlim; + uint64_t max_mem; + size_t max_mem_sz = sizeof(max_mem); + /* low values from argon2 test suite... */ + uint32_t memory = 256; + uint32_t time = 2; + uint32_t threads = 1; + + if (*ememory < ARGON2_MIN_MEMORY) { + /* + * attempt to find a reasonble bound for memory use + */ + if (sysctl(mib, __arraycount(mib), + &max_mem, &max_mem_sz, NULL, 0) < 0) { + goto error; + } + if (getrlimit(RLIMIT_AS, &rlim) < 0) + goto error; + if (max_mem > rlim.rlim_cur && rlim.rlim_cur != RLIM_INFINITY) + max_mem = rlim.rlim_cur; + + /* + * Note that adding memory also greatly slows the algorithm. + * Do we need to be concerned about memory usage during + * concurrent connections? + */ + max_mem /= 100; + if (max_mem > 3) { + memory = 8192; + } else if (max_mem > 7000) { + memory = 4096; + } else if (max_mem > 24) { + memory = 256; + } else { + memory = ARGON2_MIN_MEMORY; + } + } else { + memory = *ememory; + } + + if (*etime < ARGON2_MIN_TIME) { + /* + * just fill these with random stuff since we'll immediately + * discard them after calculating hashes for 1 second + */ + arc4random_buf(tmp_pwd, sizeof(tmp_pwd)); + arc4random_buf(tmp_salt, sizeof(tmp_salt)); + + if (clock_gettime(CLOCK_MONOTONIC, &tp1) == -1) + goto error; + for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) { + if (argon2_hash(time, memory, threads, + tmp_pwd, sizeof(tmp_pwd), + tmp_salt, sizeof(tmp_salt), + tmp_hash, sizeof(tmp_hash), + tmp_encoded, sizeof(tmp_encoded), + atype, ARGON2_VERSION_NUMBER) != ARGON2_OK) { +goto reset; + } + if (clock_gettime(CLOCK_MONOTONIC, &tp2) == -1) +break; + if (timespeccmp(&tp1, &tp2, >)) +break; /* broken system... */ + timespecsub(&tp2, &tp1, &delta); + } + } else { + time = *etime; + } + +error: + *etime = time; + *ememory = memory; + *ethreads = threads; + return 0; +reset: + time = 2; + memory = 256; + threads = 1; + goto error; +} + + /* process params to argon2 */ /* we don't force param order as input, */ /* but we do provide the expected order to argon2 api */ Index: src/lib/libcrypt/pw_gensalt.c diff -u src/lib/libcrypt/pw_gensalt.c:1.12 src/lib/libcrypt/pw_gensalt.c:1.13 --- src/lib/libcrypt/pw_gensalt.c:1.12 Sat Oct 16 10:53:33 2021 +++ src/lib/libcrypt/pw_
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 20 13:03:29 UTC 2021 Modified Files: src/lib/libcrypt: crypt-argon2.c pw_gensalt.c Log Message: crypt(3): Adapt default Argon2 parameters to system performance If the parameters are unspecified: - Set the default memory consumption based on the amount of memory available to userspace. The algorithm actually slows down incredibly quickly as the "memory" parameter is increased. We want to avoid running out of memory on low memory systems, but increase the difficulty of bruteforcing passwords from systems with a lot of memory. At the same time, we want to avoid problems when concurrent logins are happening. - Run a hashing loop for one second with steadily increasing "time" until we settle on a value for "time". We want to use as much CPU time as reasonable for computing the password hash without making logins inconvenient. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libcrypt/crypt-argon2.c cvs rdiff -u -r1.12 -r1.13 src/lib/libcrypt/pw_gensalt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/apache2/argon2/dist/phc-winner-argon2/src
Module Name:src Committed By: nia Date: Sun Oct 17 10:44:21 UTC 2021 Modified Files: src/external/apache2/argon2/dist/phc-winner-argon2/src: core.c Log Message: Teach argon2 about explicit_memset(3). Should be upstreamed. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c diff -u src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c:1.1 src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c:1.2 --- src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c:1.1 Wed Oct 9 13:13:09 2019 +++ src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c Sun Oct 17 10:44:21 2021 @@ -125,6 +125,8 @@ void free_memory(const argon2_context *c #if defined(__OpenBSD__) #define HAVE_EXPLICIT_BZERO 1 +#elif defined(__NetBSD__) +#define HAVE_EXPLICIT_MEMSET 1 #elif defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2,25) #define HAVE_EXPLICIT_BZERO 1 @@ -138,6 +140,8 @@ void NOT_OPTIMIZED secure_wipe_memory(vo memset_s(v, n, 0, n); #elif defined(HAVE_EXPLICIT_BZERO) explicit_bzero(v, n); +#elif defined(HAVE_EXPLICIT_MEMSET) +explicit_memset(v, 0, n); #else static void *(*const volatile memset_sec)(void *, int, size_t) = &memset; memset_sec(v, 0, n);
CVS commit: src/external/apache2/argon2/dist/phc-winner-argon2/src
Module Name:src Committed By: nia Date: Sun Oct 17 10:44:21 UTC 2021 Modified Files: src/external/apache2/argon2/dist/phc-winner-argon2/src: core.c Log Message: Teach argon2 about explicit_memset(3). Should be upstreamed. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/su
Module Name:src Committed By: nia Date: Sun Oct 17 10:33:57 UTC 2021 Modified Files: src/usr.bin/su: su.c Log Message: su: Use consttime_memequal instead of strcmp. This only affects the non-PAM case. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/usr.bin/su/su.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/su/su.c diff -u src/usr.bin/su/su.c:1.72 src/usr.bin/su/su.c:1.73 --- src/usr.bin/su/su.c:1.72 Tue Jun 16 22:54:11 2015 +++ src/usr.bin/su/su.c Sun Oct 17 10:33:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: su.c,v 1.72 2015/06/16 22:54:11 christos Exp $ */ +/* $NetBSD: su.c,v 1.73 2021/10/17 10:33:57 nia Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988\ #if 0 static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/ #else -__RCSID("$NetBSD: su.c,v 1.72 2015/06/16 22:54:11 christos Exp $"); +__RCSID("$NetBSD: su.c,v 1.73 2021/10/17 10:33:57 nia Exp $"); #endif #endif /* not lint */ @@ -285,7 +285,8 @@ main(int argc, char **argv) } else #endif - if (strcmp(pass, crypt(p, pass)) != 0) { + if (consttime_memequal(pass, + crypt(p, pass), strlen(pass)) == 0) { #ifdef SKEY badlogin: #endif
CVS commit: src/usr.bin/su
Module Name:src Committed By: nia Date: Sun Oct 17 10:33:57 UTC 2021 Modified Files: src/usr.bin/su: su.c Log Message: su: Use consttime_memequal instead of strcmp. This only affects the non-PAM case. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/usr.bin/su/su.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Sat Oct 16 10:53:34 UTC 2021 Modified Files: src/lib/libcrypt: bcrypt.c crypt-argon2.c crypt-sha1.c crypt.h hmac.c md5crypt.c pw_gensalt.c Log Message: libcrypt: Hide more private symbols by default. Fix style. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/libcrypt/bcrypt.c cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/crypt-argon2.c cvs rdiff -u -r1.8 -r1.9 src/lib/libcrypt/crypt-sha1.c cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/crypt.h cvs rdiff -u -r1.3 -r1.4 src/lib/libcrypt/hmac.c cvs rdiff -u -r1.14 -r1.15 src/lib/libcrypt/md5crypt.c cvs rdiff -u -r1.11 -r1.12 src/lib/libcrypt/pw_gensalt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Sat Oct 16 10:53:34 UTC 2021 Modified Files: src/lib/libcrypt: bcrypt.c crypt-argon2.c crypt-sha1.c crypt.h hmac.c md5crypt.c pw_gensalt.c Log Message: libcrypt: Hide more private symbols by default. Fix style. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/libcrypt/bcrypt.c cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/crypt-argon2.c cvs rdiff -u -r1.8 -r1.9 src/lib/libcrypt/crypt-sha1.c cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/crypt.h cvs rdiff -u -r1.3 -r1.4 src/lib/libcrypt/hmac.c cvs rdiff -u -r1.14 -r1.15 src/lib/libcrypt/md5crypt.c cvs rdiff -u -r1.11 -r1.12 src/lib/libcrypt/pw_gensalt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/bcrypt.c diff -u src/lib/libcrypt/bcrypt.c:1.21 src/lib/libcrypt/bcrypt.c:1.22 --- src/lib/libcrypt/bcrypt.c:1.21 Wed Mar 25 21:02:26 2020 +++ src/lib/libcrypt/bcrypt.c Sat Oct 16 10:53:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcrypt.c,v 1.21 2020/03/25 21:02:26 christos Exp $ */ +/* $NetBSD: bcrypt.c,v 1.22 2021/10/16 10:53:33 nia Exp $ */ /* $OpenBSD: bcrypt.c,v 1.16 2002/02/19 19:39:36 millert Exp $ */ /* @@ -46,7 +46,7 @@ * */ #include -__RCSID("$NetBSD: bcrypt.c,v 1.21 2020/03/25 21:02:26 christos Exp $"); +__RCSID("$NetBSD: bcrypt.c,v 1.22 2021/10/16 10:53:33 nia Exp $"); #include #include @@ -74,7 +74,7 @@ static void encode_salt(char *, u_int8_t static void encode_base64(u_int8_t *, u_int8_t *, u_int16_t); static void decode_base64(u_int8_t *, u_int16_t, const u_int8_t *); -char *__bcrypt(const char *, const char *); /* XXX */ +crypt_private char *__bcrypt(const char *, const char *); /* XXX */ static charencrypted[_PASSWORD_LEN]; @@ -149,7 +149,7 @@ encode_salt(char *salt, u_int8_t *csalt, encode_base64((u_int8_t *) salt + 7, csalt, clen); } -int +crypt_private int __gensalt_blowfish(char *salt, size_t saltlen, const char *option) { size_t i; @@ -209,7 +209,7 @@ bcrypt_gensalt(u_int8_t log_rounds) /* We handle $Vers$log2(NumRounds)$salt+passwd$ i.e. $2$04$iwouldntknowwhattosayetKdJ6iFtacBqJdKe6aW7ou */ -char * +crypt_private char * __bcrypt(const char *key, const char *salt) { blf_ctx state; Index: src/lib/libcrypt/crypt-argon2.c diff -u src/lib/libcrypt/crypt-argon2.c:1.9 src/lib/libcrypt/crypt-argon2.c:1.10 --- src/lib/libcrypt/crypt-argon2.c:1.9 Tue Oct 12 15:55:31 2021 +++ src/lib/libcrypt/crypt-argon2.c Sat Oct 16 10:53:33 2021 @@ -243,7 +243,7 @@ decode_option(argon2_context *ctx, argon return error; } -char * +crypt_private char * __crypt_argon2(const char *pw, const char * salt) { /* we use the libargon2 api to generate */ Index: src/lib/libcrypt/crypt-sha1.c diff -u src/lib/libcrypt/crypt-sha1.c:1.8 src/lib/libcrypt/crypt-sha1.c:1.9 --- src/lib/libcrypt/crypt-sha1.c:1.8 Wed Aug 28 17:47:07 2013 +++ src/lib/libcrypt/crypt-sha1.c Sat Oct 16 10:53:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: crypt-sha1.c,v 1.8 2013/08/28 17:47:07 riastradh Exp $ */ +/* $NetBSD: crypt-sha1.c,v 1.9 2021/10/16 10:53:33 nia Exp $ */ /* * Copyright (c) 2004, Juniper Networks, Inc. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crypt-sha1.c,v 1.8 2013/08/28 17:47:07 riastradh Exp $"); +__RCSID("$NetBSD: crypt-sha1.c,v 1.9 2021/10/16 10:53:33 nia Exp $"); #endif /* not lint */ #include @@ -68,7 +68,7 @@ __RCSID("$NetBSD: crypt-sha1.c,v 1.8 201 * The number is varied to frustrate those attempting to generate a * dictionary of pre-computed hashes. */ -unsigned int +crypt_private unsigned int __crypt_sha1_iterations (unsigned int hint) { static int once = 1; @@ -115,7 +115,7 @@ __crypt_sha1_iterations (unsigned int hi * strength, and avoid the need to hash it before using as the * hmac key. */ -char * +crypt_private char * __crypt_sha1 (const char *pw, const char *salt) { static const char *magic = SHA1_MAGIC; Index: src/lib/libcrypt/crypt.h diff -u src/lib/libcrypt/crypt.h:1.7 src/lib/libcrypt/crypt.h:1.8 --- src/lib/libcrypt/crypt.h:1.7 Tue Oct 12 15:25:39 2021 +++ src/lib/libcrypt/crypt.h Sat Oct 16 10:53:33 2021 @@ -1,32 +1,32 @@ /* - * $NetBSD: crypt.h,v 1.7 2021/10/12 15:25:39 nia Exp $ + * $NetBSD: crypt.h,v 1.8 2021/10/16 10:53:33 nia Exp $ */ #define crypt_private __attribute__((__visibility__("hidden"))) -char *__md5crypt(const char *pw, const char *salt); /* XXX */ -char *__bcrypt(const char *, const char *); /* XXX */ -char *__crypt_sha1(const char *pw, const char *salt); -unsigned int __crypt_sha1_iterations (unsigned int hint); -void __hmac_sha1(const unsigned char *, size_t, const unsigned char *, size_t, - unsigned char *); +crypt_private char *__md5crypt(const char *, const char *); /* XXX */ +crypt_private char *__bcrypt(const char *, const char *); /* XXX */ +crypt_private char *__crypt_sha1(const char *, const char *); +cryp
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu Oct 14 11:46:46 UTC 2021 Modified Files: src/share/mk: bsd.own.mk Log Message: mk: Enable MKRELRO on aarch64 to match x86. To generate a diff of this commit: cvs rdiff -u -r1.1264 -r1.1265 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1264 src/share/mk/bsd.own.mk:1.1265 --- src/share/mk/bsd.own.mk:1.1264 Thu Oct 14 11:45:46 2021 +++ src/share/mk/bsd.own.mk Thu Oct 14 11:46:45 2021 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1264 2021/10/14 11:45:46 nia Exp $ +# $NetBSD: bsd.own.mk,v 1.1265 2021/10/14 11:46:45 nia Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1121,10 +1121,12 @@ MKPIE?= no .endif # -# RELRO is enabled on i386 and amd64 by default +# RELRO is enabled on i386, amd64, and aarch64 by default # .if ${MACHINE_ARCH} == "i386" || \ -${MACHINE_ARCH} == "x86_64" +${MACHINE_ARCH} == "x86_64" || \ +${MACHINE_ARCH} == "aarch64" || \ +${MACHINE_ARCH} == "aarch64eb" MKRELRO?= partial .else MKRELRO?= no
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu Oct 14 11:45:46 UTC 2021 Modified Files: src/share/mk: bsd.README bsd.own.mk Log Message: mk: Enable MKARGON2 now that this stuff works. To generate a diff of this commit: cvs rdiff -u -r1.418 -r1.419 src/share/mk/bsd.README cvs rdiff -u -r1.1263 -r1.1264 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.README diff -u src/share/mk/bsd.README:1.418 src/share/mk/bsd.README:1.419 --- src/share/mk/bsd.README:1.418 Sun Sep 26 15:52:40 2021 +++ src/share/mk/bsd.README Thu Oct 14 11:45:46 2021 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.README,v 1.418 2021/09/26 15:52:40 maya Exp $ +# $NetBSD: bsd.README,v 1.419 2021/10/14 11:45:46 nia Exp $ # @(#)bsd.README 8.2 (Berkeley) 4/2/94 This is the README file for the make "include" files for the NetBSD @@ -113,6 +113,9 @@ MAKEVERBOSE Control how "verbose" the st 3 Ignore the effect of the "@" prefix in make commands 4 Trace shell commands using the shell's -x flag +MKARGON2 If "no", don't build support for Argon2 into libcrypt. + Default: yes + MKATF If "no", don't build the Automated Testing Framework (ATF), which includes the libatf-c, libatf-c++ and libatf-sh libraries and the various command line tools. Also, because the build of Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1263 src/share/mk/bsd.own.mk:1.1264 --- src/share/mk/bsd.own.mk:1.1263 Thu Sep 30 20:02:54 2021 +++ src/share/mk/bsd.own.mk Thu Oct 14 11:45:46 2021 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1263 2021/09/30 20:02:54 jmcneill Exp $ +# $NetBSD: bsd.own.mk,v 1.1264 2021/10/14 11:45:46 nia Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1140,6 +1140,7 @@ MKSTATICPIE?= no # MK* options which default to "yes". # _MKVARS.yes= \ + MKARGON2 \ MKATF \ MKBINUTILS \ MKBSDTAR \ @@ -1281,7 +1282,6 @@ MKLLVMRT.aarch64= yes # sorted with at most one letter per line. # _MKVARS.no= \ - MKARGON2 \ MKARZERO \ MKBSDGREP \ MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCTF \
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu Oct 14 11:45:46 UTC 2021 Modified Files: src/share/mk: bsd.README bsd.own.mk Log Message: mk: Enable MKARGON2 now that this stuff works. To generate a diff of this commit: cvs rdiff -u -r1.418 -r1.419 src/share/mk/bsd.README cvs rdiff -u -r1.1263 -r1.1264 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: nia Date: Thu Oct 14 21:18:07 UTC 2021 Modified Files: src/doc: CHANGES Log Message: doc: MKPIE/MKRELRO for aarch64 To generate a diff of this commit: cvs rdiff -u -r1.2840 -r1.2841 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: nia Date: Thu Oct 14 21:18:07 UTC 2021 Modified Files: src/doc: CHANGES Log Message: doc: MKPIE/MKRELRO for aarch64 To generate a diff of this commit: cvs rdiff -u -r1.2840 -r1.2841 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2840 src/doc/CHANGES:1.2841 --- src/doc/CHANGES:1.2840 Thu Oct 14 14:53:41 2021 +++ src/doc/CHANGES Thu Oct 14 21:18:07 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2840 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2841 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -441,3 +441,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: [msaitoh 20211013] sgp40mox(4): Driver for the Sensirion SGP40 MOx gas sensor for air quality [brad 20211014] + aarch64: Enable MKRELRO and MKPIE by default. [nia 20211014]
CVS commit: src/share/man/man4
Module Name:src Committed By: nia Date: Thu Oct 14 20:23:31 UTC 2021 Modified Files: src/share/man/man4: iic.4 Log Message: Add sgp40mox(4) To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/iic.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: nia Date: Thu Oct 14 20:23:31 UTC 2021 Modified Files: src/share/man/man4: iic.4 Log Message: Add sgp40mox(4) To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/iic.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/iic.4 diff -u src/share/man/man4/iic.4:1.29 src/share/man/man4/iic.4:1.30 --- src/share/man/man4/iic.4:1.29 Tue Oct 5 16:36:58 2021 +++ src/share/man/man4/iic.4 Thu Oct 14 20:23:31 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: iic.4,v 1.29 2021/10/05 16:36:58 nia Exp $ +.\" $NetBSD: iic.4,v 1.30 2021/10/14 20:23:31 nia Exp $ .\" $OpenBSD: iic.4,v 1.74 2008/09/10 16:13:43 reyk Exp $ .\" .\" Copyright (c) 2004, 2006 Alexander Yurchenko @@ -16,7 +16,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd October 5, 2021 +.Dd October 14, 2021 .Dt IIC 4 .Os .Sh NAME @@ -213,6 +213,8 @@ Seiko Instruments S-35390 real-time cloc JEDEC JC-42.4 compatible memory module temperature sensors .It Xr seeprom 4 24-series I2C EEPROM driver +.It Xr sgp40mox 4 +Sensirion SGP40 MOx gas sensors .It Xr sgsmix 4 SGS 7433 Basic Audio Processor found in some Apple machines .It Xr sht4xtemp 4
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu Oct 14 12:58:30 UTC 2021 Modified Files: src/share/mk: bsd.own.mk Log Message: mk: Enable MKPIE on aarch64 (it's already enabled on 32-bit arm) To generate a diff of this commit: cvs rdiff -u -r1.1265 -r1.1266 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu Oct 14 12:58:30 UTC 2021 Modified Files: src/share/mk: bsd.own.mk Log Message: mk: Enable MKPIE on aarch64 (it's already enabled on 32-bit arm) To generate a diff of this commit: cvs rdiff -u -r1.1265 -r1.1266 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1265 src/share/mk/bsd.own.mk:1.1266 --- src/share/mk/bsd.own.mk:1.1265 Thu Oct 14 11:46:45 2021 +++ src/share/mk/bsd.own.mk Thu Oct 14 12:58:30 2021 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1265 2021/10/14 11:46:45 nia Exp $ +# $NetBSD: bsd.own.mk,v 1.1266 2021/10/14 12:58:30 nia Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1110,6 +1110,8 @@ MKCTF?= yes .if !defined(COVERITY_TOP_CONFIG) && \ (${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "x86_64" || \ +${MACHINE_ARCH} == "aarch64" || \ +${MACHINE_ARCH} == "aarch64eb" || \ ${MACHINE_CPU} == "arm" || \ ${MACHINE_CPU} == "m68k" || \ ${MACHINE_CPU} == "mips" || \
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu Oct 14 11:46:46 UTC 2021 Modified Files: src/share/mk: bsd.own.mk Log Message: mk: Enable MKRELRO on aarch64 to match x86. To generate a diff of this commit: cvs rdiff -u -r1.1264 -r1.1265 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: nia Date: Wed Oct 13 20:11:54 UTC 2021 Modified Files: src/doc: HACKS Log Message: libcrypt hack for vax To generate a diff of this commit: cvs rdiff -u -r1.224 -r1.225 src/doc/HACKS Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/HACKS diff -u src/doc/HACKS:1.224 src/doc/HACKS:1.225 --- src/doc/HACKS:1.224 Fri Jul 16 10:02:50 2021 +++ src/doc/HACKS Wed Oct 13 20:11:54 2021 @@ -1,4 +1,4 @@ -# $NetBSD: HACKS,v 1.224 2021/07/16 10:02:50 rin Exp $ +# $NetBSD: HACKS,v 1.225 2021/10/13 20:11:54 nia Exp $ # # This file is intended to document workarounds for currently unsolved # (mostly) compiler bugs. @@ -1010,3 +1010,13 @@ descr GCC 9 and 10 miscompile initdecl() The problem has been reported to upstream as GCC Bug 101469: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101469 kcah + +port vax +hack compile blake2b.c with -O0 for vax +cdate Wed Oct 13 14:28:32 UTC 2021 +mdate Wed Oct 13 14:28:32 UTC 2021 +who nia +file src/lib/libcrypt/Makefile: 1.200 +descr GCC 10 fails to build blake2b.c with an internal compiler + error unless optimization is disabled. +kcah
CVS commit: src/doc
Module Name:src Committed By: nia Date: Wed Oct 13 20:11:54 UTC 2021 Modified Files: src/doc: HACKS Log Message: libcrypt hack for vax To generate a diff of this commit: cvs rdiff -u -r1.224 -r1.225 src/doc/HACKS Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 13 14:28:32 UTC 2021 Modified Files: src/lib/libcrypt: Makefile Log Message: libcrypt: work around compiler bugs to get MKARGON2 working on vax To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libcrypt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/Makefile diff -u src/lib/libcrypt/Makefile:1.28 src/lib/libcrypt/Makefile:1.29 --- src/lib/libcrypt/Makefile:1.28 Tue Oct 12 17:24:36 2021 +++ src/lib/libcrypt/Makefile Wed Oct 13 14:28:32 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.28 2021/10/12 17:24:36 nia Exp $ +# $NetBSD: Makefile,v 1.29 2021/10/13 14:28:32 nia Exp $ .include @@ -25,7 +25,11 @@ SRCS+= crypt-argon2.c . for src in argon2.c core.c blake2b.c encoding.c ref.c SRCS+= ${src} COPTS.${src}+= -Wno-error +COPTS.${src}+= -fvisibility=hidden . endfor +. if ${MACHINE} == "vax" +COPTS.blake2b.c+= -O0 +. endif .endif WARNS?= 5
CVS commit: src/lib/libcrypt
Module Name:src Committed By: nia Date: Wed Oct 13 14:28:32 UTC 2021 Modified Files: src/lib/libcrypt: Makefile Log Message: libcrypt: work around compiler bugs to get MKARGON2 working on vax To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libcrypt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.