CVS commit: src

2019-10-20 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 21 02:36:48 UTC 2019

Modified Files:
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile
src/lib/libcrypt: Makefile crypt.3 crypt.c crypt.h pw_gensalt.c
src/usr.bin/pwhash: Makefile pwhash.1 pwhash.c
Added Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
adding argon2 support to libcrypt. argon2 user authentication now
available via MKARGON2=yes (3 variants supported; argon2id recommended)
before using, please read argon2 paper at
https://github.com/P-H-C/phc-winner-argon2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.25 -r1.26 src/lib/libcrypt/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/libcrypt/crypt-argon2.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcrypt/crypt.3
cvs rdiff -u -r1.35 -r1.36 src/lib/libcrypt/crypt.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/pwhash/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/pwhash/pwhash.1
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/pwhash/pwhash.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/lib/libargon2/Makefile
diff -u src/external/apache2/argon2/lib/libargon2/Makefile:1.1 src/external/apache2/argon2/lib/libargon2/Makefile:1.2
--- src/external/apache2/argon2/lib/libargon2/Makefile:1.1	Wed Oct  9 13:13:09 2019
+++ src/external/apache2/argon2/lib/libargon2/Makefile	Mon Oct 21 02:36:48 2019
@@ -12,15 +12,7 @@ INCSDIR=	/usr/include
 LIB=	argon2	
 SRCS=	argon2.c core.c blake2b.c thread.c encoding.c ref.c
 
-
-CPPFLAGS= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc -shared -fPIC
-
-.ifdef NO_THREADS
-CPPFLAGS += -DARGON2_NO_THREADS
-.else
-CPPFLAGS += -pthread
-LDADD+=-lpthread
-.endif
+CPPFLAGS= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc -fPIC -DARGON2_NO_THREADS
 
 OPTTARGET ?= native
 OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \

Index: src/external/apache2/argon2/usr.bin/argon2/Makefile
diff -u src/external/apache2/argon2/usr.bin/argon2/Makefile:1.1 src/external/apache2/argon2/usr.bin/argon2/Makefile:1.2
--- src/external/apache2/argon2/usr.bin/argon2/Makefile:1.1	Wed Oct  9 13:13:10 2019
+++ src/external/apache2/argon2/usr.bin/argon2/Makefile	Mon Oct 21 02:36:48 2019
@@ -10,16 +10,7 @@ SRCS=
 SRCS=   argon2.c core.c blake2b.c thread.c encoding.c ref.c
 SRCS+=   run.c
 
-.ifdef NO_THREADS 
-CPPFLAGS += -DARGON2_NO_THREADS
-.else
-CPPFLAGS += -pthread
-LDADD+=-lpthread
-.endif
-
-CPPFLAGS+= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc #-shared -fPIC
-#LDADD+= -L${LIBARGON2} -largon2
-#DPADD+= ${LIBARGON2_SD}
+CPPFLAGS+= -DARGON2_NO_THREADS -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc 
 
 MAN=argon2.1
 

Index: src/lib/libcrypt/Makefile
diff -u src/lib/libcrypt/Makefile:1.25 src/lib/libcrypt/Makefile:1.26
--- src/lib/libcrypt/Makefile:1.25	Sat Aug 10 18:42:29 2013
+++ src/lib/libcrypt/Makefile	Mon Oct 21 02:36:48 2019
@@ -1,12 +1,24 @@
-#	$NetBSD: Makefile,v 1.25 2013/08/10 18:42:29 dholland Exp $
+#	$NetBSD: Makefile,v 1.26 2019/10/21 02:36:48 jhigh Exp $
+
+.include 
 
 USE_SHLIBDIR=	yes
 
+.if (defined(MKARGON2) && ${MKARGON2} != "no")
+HAVE_ARGON2=1
+.endif
+
 LIB=	crypt
 
 SRCS=	crypt.c md5crypt.c bcrypt.c crypt-sha1.c util.c pw_gensalt.c
 SRCS+=	hmac_sha1.c
 
+.if defined(HAVE_ARGON2)
+SRCS+=		crypt-argon2.c
+CFLAGS+=	-DHAVE_ARGON2 -I../../external/apache2/argon2/dist/phc-winner-argon2/include/
+LDADD+=		-largon2 
+.endif
+
 WARNS?=	5
 
 MAN=	crypt.3

Index: src/lib/libcrypt/crypt.3
diff -u src/lib/libcrypt/crypt.3:1.27 src/lib/libcrypt/crypt.3:1.28
--- src/lib/libcrypt/crypt.3:1.27	Fri Mar 23 18:08:35 2012
+++ src/lib/libcrypt/crypt.3	Mon Oct 21 02:36:48 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crypt.3,v 1.27 2012/03/23 18:08:35 njoly Exp $
+.\"	$NetBSD: crypt.3,v 1.28 2019/10/21 02:36:48 jhigh Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -241,6 +241,25 @@ A valid password looks like this:
 The entire password string is passed as
 .Fa setting
 for interpretation.
+
+.Ss Argon2 encryption
+
+Argon2 is a memory-hard hashing algorithm. crypt() provides all 
+three variants: argon2i, argon2d, and argon2id. It is recommended 
+to use argon2id, which provides a hybrid combination using argon2i 
+on the first pass, and argon2d on the remaining passes.  We 
+parameterize on three variables.  First, m_cost (m), specifies the 
+memory usage in KB.  Second, t_cost (t), specfies the number of 
+iterations.  Third, parallelism (p) specifies the number of threads.  

CVS commit: src

2019-10-20 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 21 02:36:48 UTC 2019

Modified Files:
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile
src/lib/libcrypt: Makefile crypt.3 crypt.c crypt.h pw_gensalt.c
src/usr.bin/pwhash: Makefile pwhash.1 pwhash.c
Added Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
adding argon2 support to libcrypt. argon2 user authentication now
available via MKARGON2=yes (3 variants supported; argon2id recommended)
before using, please read argon2 paper at
https://github.com/P-H-C/phc-winner-argon2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.25 -r1.26 src/lib/libcrypt/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/libcrypt/crypt-argon2.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcrypt/crypt.3
cvs rdiff -u -r1.35 -r1.36 src/lib/libcrypt/crypt.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/pwhash/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/pwhash/pwhash.1
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/pwhash/pwhash.c

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/argon2

2019-10-14 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 14:48:48 UTC 2019

Modified Files:
src/tests/usr.bin/argon2: t_argon2.sh

Log Message:
added test cases
invalid version specification
salt too short


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/argon2/t_argon2.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/argon2/t_argon2.sh
diff -u src/tests/usr.bin/argon2/t_argon2.sh:1.2 src/tests/usr.bin/argon2/t_argon2.sh:1.3
--- src/tests/usr.bin/argon2/t_argon2.sh:1.2	Mon Oct 14 14:37:31 2019
+++ src/tests/usr.bin/argon2/t_argon2.sh	Mon Oct 14 14:48:48 2019
@@ -112,6 +112,24 @@ argon2_argon2d_k2096_p1_v13_body() {
 		'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 13'
 }
 
+atf_test_case argon2_argon2id_k2096_p1_v19_inver
+argon2_argon2id_k2096_p1_v19_inver_head() {
+	atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1 invalid version specification"
+}
+argon2_argon2id_k2096_p1_v19_inver_body() {
+	atf_check -s exit:1 -e match:"Error: invalid Argon2 version" -x \
+		'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 19'
+}
+
+atf_test_case argon2_argon2id_k2096_p1_sts
+argon2_argon2id_k2096_p1_sts_head() {
+	atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1 salt too short"
+}
+argon2_argon2id_k2096_p1_sts_body() {
+	atf_check -s exit:1 -e match:"Error: Salt is too short" -x \
+		'echo -n 'password' | argon2 tshort -e -d -k 2096 -p 1'
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case argon2_argon2id
@@ -126,4 +144,6 @@ atf_init_test_cases()
 	atf_add_test_case argon2_argon2i_k2096_p1_v13
 	atf_add_test_case argon2_argon2d_k2096_p1_v10
 	atf_add_test_case argon2_argon2d_k2096_p1_v13
+	atf_add_test_case argon2_argon2id_k2096_p1_v19_inver
+	atf_add_test_case argon2_argon2id_k2096_p1_sts
 }



CVS commit: src/tests/usr.bin/argon2

2019-10-14 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 14:48:48 UTC 2019

Modified Files:
src/tests/usr.bin/argon2: t_argon2.sh

Log Message:
added test cases
invalid version specification
salt too short


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/argon2/t_argon2.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/argon2

2019-10-14 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 14:37:31 UTC 2019

Modified Files:
src/tests/usr.bin/argon2: t_argon2.sh

Log Message:
added versioning tests for argon2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/argon2/t_argon2.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/argon2

2019-10-14 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 14:37:31 UTC 2019

Modified Files:
src/tests/usr.bin/argon2: t_argon2.sh

Log Message:
added versioning tests for argon2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/argon2/t_argon2.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/argon2/t_argon2.sh
diff -u src/tests/usr.bin/argon2/t_argon2.sh:1.1 src/tests/usr.bin/argon2/t_argon2.sh:1.2
--- src/tests/usr.bin/argon2/t_argon2.sh:1.1	Mon Oct 14 03:47:20 2019
+++ src/tests/usr.bin/argon2/t_argon2.sh	Mon Oct 14 14:37:31 2019
@@ -58,6 +58,59 @@ argon2_argon2d_k2096_p2_t4_body() {
 		'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 2 -t 4'
 }
 
+atf_test_case argon2_argon2id_k2096_p1_v10
+argon2_argon2id_k2096_p1_v10_head() {
+	atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=1,v=10"
+}
+argon2_argon2id_k2096_p1_v10_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=16\\\$m=2096,t=3,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 1 -v 10'
+}
+
+atf_test_case argon2_argon2id_k2096_p1_v13
+argon2_argon2id_k2096_p1_v13_head() {
+	atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=1,v=13"
+}
+argon2_argon2id_k2096_p1_v13_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=19\\\$m=2096,t=3,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 1 -v 13'
+}
+
+atf_test_case argon2_argon2i_k2096_p1_v10
+argon2_argon2i_k2096_p1_v10_head() {
+	atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,v=10"
+}
+argon2_argon2i_k2096_p1_v10_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=16\\\$m=2096,t=3,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -v 10'
+}
+
+atf_test_case argon2_argon2i_k2096_p1_v13
+argon2_argon2i_k2096_p1_v13_head() {
+	atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,v=13"
+}
+argon2_argon2i_k2096_p1_v13_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=19\\\$m=2096,t=3,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -v 13'
+}
+
+atf_test_case argon2_argon2d_k2096_p1_v10
+argon2_argon2d_k2096_p1_v10_head() {
+	atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1,v=10"
+}
+argon2_argon2d_k2096_p1_v10_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=16\\\$m=2096,t=3,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 10'
+}
+
+atf_test_case argon2_argon2d_k2096_p1_v13
+argon2_argon2d_k2096_p1_v13_head() {
+	atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1,v=13"
+}
+argon2_argon2d_k2096_p1_v13_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=19\\\$m=2096,t=3,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 13'
+}
 
 atf_init_test_cases()
 {
@@ -67,4 +120,10 @@ atf_init_test_cases()
 	atf_add_test_case argon2_argon2id_k2096_p2_t3
 	atf_add_test_case argon2_argon2i_k2096_p1_t4
 	atf_add_test_case argon2_argon2d_k2096_p2_t4
+	atf_add_test_case argon2_argon2id_k2096_p1_v10
+	atf_add_test_case argon2_argon2id_k2096_p1_v13
+	atf_add_test_case argon2_argon2i_k2096_p1_v10
+	atf_add_test_case argon2_argon2i_k2096_p1_v13
+	atf_add_test_case argon2_argon2d_k2096_p1_v10
+	atf_add_test_case argon2_argon2d_k2096_p1_v13
 }



CVS commit: src/tests/usr.bin/argon2

2019-10-14 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 06:40:40 UTC 2019

Removed Files:
src/tests/usr.bin/argon2: Atffile

Log Message:
removed incorrectly added file


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/tests/usr.bin/argon2/Atffile

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/argon2

2019-10-14 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 06:40:40 UTC 2019

Removed Files:
src/tests/usr.bin/argon2: Atffile

Log Message:
removed incorrectly added file


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/tests/usr.bin/argon2/Atffile

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

2019-10-13 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 03:47:20 UTC 2019

Modified Files:
src/tests/usr.bin: Makefile
Added Files:
src/tests/usr.bin/argon2: Atffile Makefile t_argon2.sh

Log Message:
adding argon2 tests


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/argon2/Atffile \
src/tests/usr.bin/argon2/Makefile src/tests/usr.bin/argon2/t_argon2.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/Makefile
diff -u src/tests/usr.bin/Makefile:1.28 src/tests/usr.bin/Makefile:1.29
--- src/tests/usr.bin/Makefile:1.28	Sat Oct  5 18:06:16 2019
+++ src/tests/usr.bin/Makefile	Mon Oct 14 03:47:19 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2019/10/05 18:06:16 jhigh Exp $
+#	$NetBSD: Makefile,v 1.29 2019/10/14 03:47:19 jhigh Exp $
 #
 
 .include 
@@ -15,4 +15,9 @@ TESTS_SUBDIRS=	awk basename bzip2 cc cmp
 TESTS_SUBDIRS+=	c++
 .endif
 
+.if (defined(MKARGON2) && ${MKARGON2} != "no")
+TESTS_SUBDIRS+=	argon2
+.endif
+
+
 .include 

Added files:

Index: src/tests/usr.bin/argon2/Atffile
diff -u /dev/null src/tests/usr.bin/argon2/Atffile:1.1
--- /dev/null	Mon Oct 14 03:47:20 2019
+++ src/tests/usr.bin/argon2/Atffile	Mon Oct 14 03:47:20 2019
@@ -0,0 +1,7 @@
+Content-Type: application/X-atf-atffile; version="1"
+
+# Automatically generated by bsd.test.mk.
+
+prop: test-suite = "NetBSD"
+
+tp: t_argon2
Index: src/tests/usr.bin/argon2/Makefile
diff -u /dev/null src/tests/usr.bin/argon2/Makefile:1.1
--- /dev/null	Mon Oct 14 03:47:20 2019
+++ src/tests/usr.bin/argon2/Makefile	Mon Oct 14 03:47:20 2019
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2019/10/14 03:47:20 jhigh Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/usr.bin/argon2
+TESTS_SH=	t_argon2
+
+.include 
Index: src/tests/usr.bin/argon2/t_argon2.sh
diff -u /dev/null src/tests/usr.bin/argon2/t_argon2.sh:1.1
--- /dev/null	Mon Oct 14 03:47:20 2019
+++ src/tests/usr.bin/argon2/t_argon2.sh	Mon Oct 14 03:47:20 2019
@@ -0,0 +1,70 @@
+atf_test_case argon2_argon2id 
+argon2_argon2id_head() {
+	atf_set "descr" "ATF test for argon2 argon2id variant"
+}
+
+argon2_argon2id_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2id\\\$" -x \
+		'echo -n 'password' | argon2 somesalt -e -id'
+}
+
+atf_test_case argon2_argon2i
+argon2_argon2i_head() {
+	atf_set "descr" "ATF test for argon2 argon2i variant"
+}
+
+argon2_argon2i_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2i\\\$" -x \
+		'echo -n 'password' | argon2 somesalt -e -i'
+}
+
+atf_test_case argon2_argon2d
+argon2_argon2d_head() {
+	atf_set "descr" "ATF test for argon2 argon2d variant"
+}
+
+argon2_argon2d_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2d\\\$" -x \
+		'echo -n 'password' | argon2 somesalt -e -d'
+}
+
+atf_test_case argon2_argon2id_k2096_p2_t3
+argon2_argon2id_k2096_p2_head() {
+	atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=2,t=3 "
+}
+
+argon2_argon2id_k2096_p2_t3_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=19\\\$m=2096,t=3,p=2" -x \
+		'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 2 -t 3'
+}
+
+atf_test_case argon2_argon2i_k2096_p1_t4
+argon2_argon2i_k2096_p1_t4_head() {
+	atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,t=4 "
+}
+
+argon2_argon2i_k2096_p1_t4_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=19\\\$m=2096,t=4,p=1" -x \
+		'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -t 4'
+}
+
+atf_test_case argon2_argon2d_k2096_p2_t4
+argon2_argon2d_k2096_p2_t4_head() {
+	atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=2,t=4"
+}
+
+argon2_argon2d_k2096_p2_t4_body() {
+	atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=19\\\$m=2096,t=4,p=2" -x \
+		'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 2 -t 4'
+}
+
+
+atf_init_test_cases()
+{
+	atf_add_test_case argon2_argon2id
+	atf_add_test_case argon2_argon2i
+	atf_add_test_case argon2_argon2d
+	atf_add_test_case argon2_argon2id_k2096_p2_t3
+	atf_add_test_case argon2_argon2i_k2096_p1_t4
+	atf_add_test_case argon2_argon2d_k2096_p2_t4
+}



CVS commit: src/tests/usr.bin

2019-10-13 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Mon Oct 14 03:47:20 UTC 2019

Modified Files:
src/tests/usr.bin: Makefile
Added Files:
src/tests/usr.bin/argon2: Atffile Makefile t_argon2.sh

Log Message:
adding argon2 tests


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/argon2/Atffile \
src/tests/usr.bin/argon2/Makefile src/tests/usr.bin/argon2/t_argon2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2019-10-09 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Wed Oct  9 13:13:10 UTC 2019

Modified Files:
src/external/apache2: Makefile
src/share/mk: bsd.own.mk
Added Files:
src/external/apache2/argon2: Makefile
src/external/apache2/argon2/dist/phc-winner-argon2: CHANGELOG.md
LICENSE README.md
src/external/apache2/argon2/dist/phc-winner-argon2/include: argon2.h
src/external/apache2/argon2/dist/phc-winner-argon2/kats: argon2d
argon2d.shasum argon2d_v16 argon2d_v16.shasum argon2i
argon2i.shasum argon2i_v16 argon2i_v16.shasum argon2id
argon2id.shasum argon2id_v16 argon2id_v16.shasum check-sums.ps1
check-sums.sh test.ps1 test.sh
src/external/apache2/argon2/dist/phc-winner-argon2/man: argon2.1
src/external/apache2/argon2/dist/phc-winner-argon2/src: argon2.c
bench.c core.c core.h encoding.c encoding.h genkat.c genkat.h opt.c
ref.c run.c test.c thread.c thread.h
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2:
blake2-impl.h blake2.h blake2b.c blamka-round-opt.h
blamka-round-ref.h
src/external/apache2/argon2/lib: Makefile
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile

Log Message:
added backend support for argon2 password scheme


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/CHANGELOG.md \
src/external/apache2/argon2/dist/phc-winner-argon2/LICENSE \
src/external/apache2/argon2/dist/phc-winner-argon2/README.md
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/include/argon2.h
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d_v16 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d_v16.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i_v16 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i_v16.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id_v16 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id_v16.shasum 
\
src/external/apache2/argon2/dist/phc-winner-argon2/kats/check-sums.ps1 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/check-sums.sh \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/test.ps1 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/test.sh
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/man/argon2.1
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/bench.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/core.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/encoding.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/encoding.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/genkat.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/genkat.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/opt.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/ref.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/run.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/test.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/thread.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/thread.h
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blake2-impl.h 
\
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blake2.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blake2b.c \

src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blamka-round-opt.h
 \

src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blamka-round-ref.h
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.1153 

CVS commit: src

2019-10-09 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Wed Oct  9 13:13:10 UTC 2019

Modified Files:
src/external/apache2: Makefile
src/share/mk: bsd.own.mk
Added Files:
src/external/apache2/argon2: Makefile
src/external/apache2/argon2/dist/phc-winner-argon2: CHANGELOG.md
LICENSE README.md
src/external/apache2/argon2/dist/phc-winner-argon2/include: argon2.h
src/external/apache2/argon2/dist/phc-winner-argon2/kats: argon2d
argon2d.shasum argon2d_v16 argon2d_v16.shasum argon2i
argon2i.shasum argon2i_v16 argon2i_v16.shasum argon2id
argon2id.shasum argon2id_v16 argon2id_v16.shasum check-sums.ps1
check-sums.sh test.ps1 test.sh
src/external/apache2/argon2/dist/phc-winner-argon2/man: argon2.1
src/external/apache2/argon2/dist/phc-winner-argon2/src: argon2.c
bench.c core.c core.h encoding.c encoding.h genkat.c genkat.h opt.c
ref.c run.c test.c thread.c thread.h
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2:
blake2-impl.h blake2.h blake2b.c blamka-round-opt.h
blamka-round-ref.h
src/external/apache2/argon2/lib: Makefile
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile

Log Message:
added backend support for argon2 password scheme


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/CHANGELOG.md \
src/external/apache2/argon2/dist/phc-winner-argon2/LICENSE \
src/external/apache2/argon2/dist/phc-winner-argon2/README.md
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/include/argon2.h
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d_v16 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2d_v16.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i_v16 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2i_v16.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id.shasum \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id_v16 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/argon2id_v16.shasum 
\
src/external/apache2/argon2/dist/phc-winner-argon2/kats/check-sums.ps1 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/check-sums.sh \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/test.ps1 \
src/external/apache2/argon2/dist/phc-winner-argon2/kats/test.sh
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/man/argon2.1
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/bench.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/core.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/encoding.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/encoding.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/genkat.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/genkat.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/opt.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/ref.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/run.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/test.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/thread.c \
src/external/apache2/argon2/dist/phc-winner-argon2/src/thread.h
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blake2-impl.h 
\
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blake2.h \
src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blake2b.c \

src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blamka-round-opt.h
 \

src/external/apache2/argon2/dist/phc-winner-argon2/src/blake2/blamka-round-ref.h
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.1153 

CVS commit: src

2019-10-05 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Sat Oct  5 18:06:17 UTC 2019

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/lib/libcrypt: crypt.c
src/tests/usr.bin: Makefile
Added Files:
src/tests/usr.bin/pwhash: Makefile t_pwhash.sh

Log Message:
adding full scheme comparison to libcrypt:crypt and pwhash tests


To generate a diff of this commit:
cvs rdiff -u -r1.821 -r1.822 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.158 -r1.159 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.34 -r1.35 src/lib/libcrypt/crypt.c
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/pwhash/Makefile \
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

2019-10-05 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Sat Oct  5 18:06:17 UTC 2019

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/lib/libcrypt: crypt.c
src/tests/usr.bin: Makefile
Added Files:
src/tests/usr.bin/pwhash: Makefile t_pwhash.sh

Log Message:
adding full scheme comparison to libcrypt:crypt and pwhash tests


To generate a diff of this commit:
cvs rdiff -u -r1.821 -r1.822 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.158 -r1.159 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.34 -r1.35 src/lib/libcrypt/crypt.c
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/pwhash/Makefile \
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/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.821 src/distrib/sets/lists/tests/mi:1.822
--- src/distrib/sets/lists/tests/mi:1.821	Sun Sep 15 16:58:11 2019
+++ src/distrib/sets/lists/tests/mi	Sat Oct  5 18:06:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.821 2019/09/15 16:58:11 christos Exp $
+# $NetBSD: mi,v 1.822 2019/10/05 18:06:16 jhigh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4208,6 +4208,10 @@
 ./usr/tests/usr.bin/pr/d_basic.in		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/pr/d_basic.out		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/pr/t_basic			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/pwhash			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/pwhash/Atffile		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/pwhash/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
+./usr/tests/usr.bin/pwhash/t_pwhash		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/printf			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/printf/Atffile		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/printf/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.158 src/etc/mtree/NetBSD.dist.tests:1.159
--- src/etc/mtree/NetBSD.dist.tests:1.158	Thu Apr  4 19:50:47 2019
+++ src/etc/mtree/NetBSD.dist.tests	Sat Oct  5 18:06:16 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.158 2019/04/04 19:50:47 kamil Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.159 2019/10/05 18:06:16 jhigh Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -416,6 +416,7 @@
 ./usr/tests/usr.bin/pkill
 ./usr/tests/usr.bin/pr
 ./usr/tests/usr.bin/printf
+./usr/tests/usr.bin/pwhash
 ./usr/tests/usr.bin/rump_server
 ./usr/tests/usr.bin/sdiff
 ./usr/tests/usr.bin/sed

Index: src/lib/libcrypt/crypt.c
diff -u src/lib/libcrypt/crypt.c:1.34 src/lib/libcrypt/crypt.c:1.35
--- src/lib/libcrypt/crypt.c:1.34	Wed Jun 17 00:15:26 2015
+++ src/lib/libcrypt/crypt.c	Sat Oct  5 18:06:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypt.c,v 1.34 2015/06/17 00:15:26 christos Exp $	*/
+/*	$NetBSD: crypt.c,v 1.35 2019/10/05 18:06:16 jhigh Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,13 +37,14 @@
 #if 0
 static char sccsid[] = "@(#)crypt.c	8.1.1.1 (Berkeley) 8/18/93";
 #else
-__RCSID("$NetBSD: crypt.c,v 1.34 2015/06/17 00:15:26 christos Exp $");
+__RCSID("$NetBSD: crypt.c,v 1.35 2019/10/05 18:06:16 jhigh Exp $");
 #endif
 #endif /* not lint */
 
 #include 
 #include 
 #include 
+#include  /* for strcmp */
 #include 
 #if defined(DEBUG) || defined(MAIN) || defined(UNIT_TEST)
 #include 
@@ -498,6 +499,48 @@ ascii_is_unsafe(char ch)
 }
 
 /*
+ * We extract the scheme from setting str to allow for 
+ * full scheme name comparison
+ * Updated to reflect alc suggestion(s) 
+ *
+ * retuns boolean 0 on failure, 1 on success, 
+ */
+static int 
+nondes_scheme_substr(const char * setting,char * scheme, unsigned int len)
+{
+	const char * start;
+	const char * sep;
+
+	/* initialize head pointer */
+	start = setting;
+
+	/* clear out scheme buffer regardless of result */
+	memset(scheme, 0, len);
+
+	/* make sure we are working on non-des scheme string */
+	if (*start != _PASSWORD_NONDES) {
+		return 0;
+	}
+
+	/* increment passed initial _PASSWORD_NONDES */
+	start++;
+
+	if ((sep = memchr(start, _PASSWORD_NONDES,len-1)) == NULL) {
+		return 0;
+	}
+
+	/* if empty string, we are done */
+	if (sep == start) {
+		return 1;
+	}
+
+	/* copy scheme substr to buffer */
+	memcpy(scheme, start, (size_t)(sep - start));
+
+	return 1;
+}
+
+/*
  * Return a pointer to static data consisting of the "setting"
  * followed by an encryption produced by the "key" and "setting".
  */
@@ -505,24 +548,39 @@ static char *
 __crypt(const char *key, const char *setting)
 {
 	char *encp;
+	char scheme[12]; 
 	int32_t i;
 	int t;
+	int r;
 	int32_t salt;
 	int num_iter, salt_size;
 	C_block keyblock, rsltblock;
 
 	/* Non-DES encryption schemes hook in