mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
tests: use crypto check tool in tests
This commit is contained in:
@@ -6,6 +6,8 @@ TST_DIR=luks1-images
|
||||
MAP=luks1tst
|
||||
KEYFILE=keyfile1
|
||||
|
||||
CRYPTOCHECK=./crypto-check
|
||||
|
||||
if [ -n "$CRYPTSETUP_TESTS_RUN_IN_MESON" ]; then
|
||||
CRYPTSETUP_VALGRIND=$CRYPTSETUP
|
||||
else
|
||||
@@ -61,26 +63,25 @@ function remove_imgs()
|
||||
|
||||
function test_one()
|
||||
{
|
||||
$CRYPTSETUP benchmark -c "$1" -s "$2" | grep -v "#" || remove_imgs $1
|
||||
$CRYPTOCHECK cipher $1 $2 $3 || remove_imgs "$1-$2"
|
||||
}
|
||||
|
||||
function test_required()
|
||||
{
|
||||
echo "REQUIRED KDF TEST"
|
||||
$CRYPTSETUP benchmark -h whirlpool | grep "N/A" && remove_imgs whirlpool
|
||||
$CRYPTOCHECK hash whirlpool || remove_imgs whirlpool
|
||||
|
||||
echo "REQUIRED CIPHERS TEST"
|
||||
echo "# Algorithm | Key | Encryption | Decryption"
|
||||
|
||||
test_one aes-xts 256
|
||||
test_one twofish-xts 256
|
||||
test_one serpent-xts 256
|
||||
test_one aes-cbc 256
|
||||
test_one aes-lrw 256
|
||||
test_one aes xts 256
|
||||
test_one twofish xts 256
|
||||
test_one serpent xts 256
|
||||
test_one aes cbc 256
|
||||
test_one aes lrw 256
|
||||
}
|
||||
|
||||
export LANG=C
|
||||
[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
|
||||
[ ! -x "$CRYPTOCHECK" ] && skip "Cannot find $CRYPTOCHECK, test skipped."
|
||||
command -v blkid >/dev/null || skip "blkid tool required, test skipped."
|
||||
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
|
||||
[ ! -d $TST_DIR ] && tar xJf $srcdir/luks1-images.tar.xz --no-same-owner
|
||||
|
||||
@@ -365,6 +365,7 @@ if get_option('cryptsetup')
|
||||
is_parallel: false,
|
||||
depends: [
|
||||
cryptsetup,
|
||||
crypto_check,
|
||||
])
|
||||
test('luks1-compat-test',
|
||||
find_program('./luks1-compat-test'),
|
||||
@@ -373,6 +374,7 @@ if get_option('cryptsetup')
|
||||
is_parallel: false,
|
||||
depends: [
|
||||
cryptsetup,
|
||||
crypto_check,
|
||||
])
|
||||
test('device-test',
|
||||
find_program('./device-test'),
|
||||
|
||||
@@ -13,6 +13,8 @@ PIM=1234
|
||||
LOOP_SYS=""
|
||||
PART_IMG=tctst-part-img
|
||||
|
||||
CRYPTOCHECK=./crypto-check
|
||||
|
||||
if [ -n "$CRYPTSETUP_TESTS_RUN_IN_MESON" ]; then
|
||||
CRYPTSETUP_VALGRIND=$CRYPTSETUP
|
||||
else
|
||||
@@ -50,7 +52,7 @@ function skip()
|
||||
|
||||
function test_one() # cipher mode keysize rm_pattern
|
||||
{
|
||||
$CRYPTSETUP benchmark -c "$1-$2" -s "$3" >/dev/null 2>&1
|
||||
$CRYPTOCHECK cipher $1 $2 $3
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "$1-$2 [N/A]"
|
||||
IMGS=$(ls $TST_DIR/[tv]c* | grep "$4")
|
||||
@@ -62,7 +64,7 @@ function test_one() # cipher mode keysize rm_pattern
|
||||
|
||||
function test_kdf() # hash img_hash
|
||||
{
|
||||
$CRYPTSETUP benchmark -h "$1" >/dev/null 2>&1
|
||||
$CRYPTOCHECK hash $1
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "pbkdf2-$1 [N/A]"
|
||||
IMGS=$(ls $TST_DIR/[tv]c* | grep "$2")
|
||||
@@ -82,6 +84,7 @@ function get_HASH_CIPHER() # filename
|
||||
function test_required()
|
||||
{
|
||||
command -v blkid >/dev/null || skip "blkid tool required, test skipped."
|
||||
[ ! -x "$CRYPTOCHECK" ] && skip "Cannot find $CRYPTOCHECK, test skipped."
|
||||
|
||||
echo "REQUIRED KDF TEST"
|
||||
test_kdf sha256 sha256
|
||||
|
||||
Reference in New Issue
Block a user