extras/tests: add test for argon2 functionality

rename original kdf test accordingly to be pbkdf2 related.
This commit is contained in:
Narrat 2024-07-28 21:09:24 +02:00
parent 27707714d4
commit 651681a9fb
4 changed files with 63 additions and 58 deletions

View File

@ -0,0 +1,31 @@
#!/usr/bin/env zsh
export test_description="Testing tomb with pbkdf2 KDF key"
source ./setup
if test_have_prereq KDF; then
test_export "kdf"
test_expect_success 'Testing pbkdf2 KDF: tomb creation' '
tt_dig -s 20 &&
tt_forge --tomb-pwd $DUMMYPASS --kdf &&
print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key \
| xxd &&
tt_lock --tomb-pwd $DUMMYPASS
'
test_expect_success 'Testing pbkdf2 KDF: tomb passwd' '
tt passwd -k $tomb_key \
--unsafe --tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW &&
tt passwd -k $tomb_key \
--unsafe --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS
'
test_expect_success 'Testing pbkdf2 KDF: tomb open & close' '
tt_open --tomb-pwd $DUMMYPASS &&
tt_close
'
fi
test_done

View File

@ -1,58 +0,0 @@
#!/usr/bin/env zsh
export test_description="Testing tomb with KDF keys"
source ./setup
if test_have_prereq KDF; then
test_export "kdf"
test_expect_success 'Testing KDF: tomb creation' '
tt_dig -s 20 &&
tt_forge --tomb-pwd $DUMMYPASS --kdf &&
print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key \
| xxd &&
tt_lock --tomb-pwd $DUMMYPASS
'
test_expect_success 'Testing KDF: tomb passwd' '
tt passwd -k $tomb_key \
--unsafe --tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW &&
tt passwd -k $tomb_key \
--unsafe --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS
'
test_expect_success 'Testing KDF: tomb open & close' '
tt_open --tomb-pwd $DUMMYPASS &&
tt_close
'
fi
# clean to avoid overwrite errors
# rm -f "$tomb_key" "$tomb"
if test_have_prereq ARGON2; then
test_export "argon2"
test_expect_success 'Testing KDF ARGON2: tomb creation' '
tt_dig -s 20 &&
tt_forge --tomb-pwd $DUMMYPASS --kdftype argon2 --kdfmem 18 --kdf 1 &&
print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key \
| xxd &&
tt_lock --tomb-pwd $DUMMYPASS
'
test_expect_success 'Testing KDF ARGON2: tomb passwd' '
tt passwd -k $tomb_key \
--unsafe --tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW &&
tt passwd -k $tomb_key \
--unsafe --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS
'
test_expect_success 'Testing KDF ARGON2: tomb open & close' '
tt_open --tomb-pwd $DUMMYPASS &&
tt_close
'
fi
test_done

View File

@ -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

View File

@ -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