Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/pwhash t_pwhash: Don't assume default cipher i...



details:   https://anonhg.NetBSD.org/src/rev/f3992cddeaa4
branches:  trunk
changeset: 990443:f3992cddeaa4
user:      nia <nia%NetBSD.org@localhost>
date:      Wed Oct 27 06:50:02 2021 +0000

description:
t_pwhash: Don't assume default cipher is SHA1. Add Argon2 tests.

diffstat:

 tests/usr.bin/pwhash/t_pwhash.sh |  38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diffs (54 lines):

diff -r ad60872db127 -r f3992cddeaa4 tests/usr.bin/pwhash/t_pwhash.sh
--- a/tests/usr.bin/pwhash/t_pwhash.sh  Wed Oct 27 05:33:59 2021 +0000
+++ b/tests/usr.bin/pwhash/t_pwhash.sh  Wed Oct 27 06:50:02 2021 +0000
@@ -25,7 +25,40 @@
 
 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_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
 }



Home | Main Index | Thread Index | Old Index