Skip to content

Commit

Permalink
extras/tests: add test for argon2 functionality
Browse files Browse the repository at this point in the history
rename original kdf test accordingly to be pbkdf2 related.
  • Loading branch information
Narrat committed Jul 28, 2024
1 parent 6665faf commit 828d439
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extras/test/30_kdf.sh → extras/test/30_kdf-pbkdf2.sh
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
'
Expand Down
31 changes: 31 additions & 0 deletions extras/test/31_kdf-argon2.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions extras/test/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 828d439

Please sign in to comment.