From 828d439b5580480583d0e924d0b6b0ec993eb36d Mon Sep 17 00:00:00 2001 From: Narrat Date: Sun, 28 Jul 2024 21:09:24 +0200 Subject: [PATCH] extras/tests: add test for argon2 functionality rename original kdf test accordingly to be pbkdf2 related. --- extras/test/{30_kdf.sh => 30_kdf-pbkdf2.sh} | 8 +++--- extras/test/31_kdf-argon2.sh | 31 +++++++++++++++++++++ extras/test/setup | 1 + 3 files changed, 36 insertions(+), 4 deletions(-) rename extras/test/{30_kdf.sh => 30_kdf-pbkdf2.sh} (72%) create mode 100644 extras/test/31_kdf-argon2.sh diff --git a/extras/test/30_kdf.sh b/extras/test/30_kdf-pbkdf2.sh similarity index 72% rename from extras/test/30_kdf.sh rename to extras/test/30_kdf-pbkdf2.sh index 3008b93f..bf5b4b36 100644 --- a/extras/test/30_kdf.sh +++ b/extras/test/30_kdf-pbkdf2.sh @@ -1,12 +1,12 @@ #!/usr/bin/env zsh -export test_description="Testing tomb with KDF key" +export test_description="Testing tomb with pbkdf2 KDF key" source ./setup if test_have_prereq KDF; then test_export "kdf" - test_expect_success 'Testing KDF: tomb creation' ' + test_expect_success 'Testing pbkdf2 KDF: tomb creation' ' tt_dig -s 20 && tt_forge --tomb-pwd $DUMMYPASS --kdf && print $DUMMYPASS \ @@ -15,14 +15,14 @@ if test_have_prereq KDF; then tt_lock --tomb-pwd $DUMMYPASS ' - test_expect_success 'Testing KDF: tomb passwd' ' + test_expect_success 'Testing pbkdf2 KDF: tomb passwd' ' tt passwd -k $tomb_key --kdf \ --unsafe --tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW && tt passwd -k $tomb_key --kdf \ --unsafe --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS ' - test_expect_success 'Testing KDF: tomb open & close' ' + test_expect_success 'Testing pbkdf2 KDF: tomb open & close' ' tt_open --tomb-pwd $DUMMYPASS && tt_close ' diff --git a/extras/test/31_kdf-argon2.sh b/extras/test/31_kdf-argon2.sh new file mode 100644 index 00000000..9aa71577 --- /dev/null +++ b/extras/test/31_kdf-argon2.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env zsh + +export test_description="Testing tomb with argon2 KDF key" + +source ./setup + +if test_have_prereq ARGON; then + test_export "argon" + test_expect_success 'Testing argon2 KDF: tomb creation' ' + tt_dig -s 20 && + tt_forge --tomb-pwd $DUMMYPASS --kdf argon2 && + print $DUMMYPASS \ + | gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key \ + | xxd && + tt_lock --tomb-pwd $DUMMYPASS + ' + + test_expect_success 'Testing argon2 KDF: tomb passwd' ' + tt passwd -k $tomb_key --kdf argon2 \ + --unsafe --tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW && + tt passwd -k $tomb_key --kdf argon2 \ + --unsafe --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS + ' + + test_expect_success 'Testing argon2 KDF: tomb open & close' ' + tt_open --tomb-pwd $DUMMYPASS && + tt_close + ' +fi + +test_done diff --git a/extras/test/setup b/extras/test/setup index a7ea7ea6..b490936b 100755 --- a/extras/test/setup +++ b/extras/test/setup @@ -50,6 +50,7 @@ MEDIA="/media" command -v steghide > /dev/null && test_set_prereq STEGHIDE command -v e2fsck resize2fs > /dev/null && test_set_prereq RESIZER command -v tomb-kdb-pbkdf2 > /dev/null && test_set_prereq KDF +command -v argon2 > /dev/null && test_set_prereq ARGON command -v qrencode > /dev/null && test_set_prereq QRENCODE command -v lsof > /dev/null && test_set_prereq LSOF command -v python3 > /dev/null && test_set_prereq PYTHON3