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
 }

Reply via email to