diff options
Diffstat (limited to 'tests/reencryption-compat-test')
-rwxr-xr-x | tests/reencryption-compat-test | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/reencryption-compat-test b/tests/reencryption-compat-test index 68a8c1f..7a6301e 100755 --- a/tests/reencryption-compat-test +++ b/tests/reencryption-compat-test @@ -25,6 +25,9 @@ PWD1="93R4P4pIqAH8" PWD2="1cND4319812f" PWD3="1-9Qu5Ejfnqv" +LUKS1_DECRYPT_UUID=d238e48a-0ed3-4169-b841-f26b44693134 +LUKS1_DECRYPT="LUKS-$LUKS1_DECRYPT_UUID" + MNT_DIR=./mnt_luks START_DIR=$(pwd) FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/null) @@ -45,7 +48,7 @@ function remove_mapping() [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2 [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME [ ! -z "$LOOPDEV1" ] && losetup -d $LOOPDEV1 >/dev/null 2>&1 - rm -f $IMG $IMG_HDR $ORIG_IMG $KEY1 $HEADER_LUKS2_PV $DEV_LINK >/dev/null 2>&1 + rm -f $IMG $IMG_HDR $ORIG_IMG $KEY1 $HEADER_LUKS2_PV $DEV_LINK $LUKS1_DECRYPT.{org\|new\|log} >/dev/null 2>&1 umount $MNT_DIR > /dev/null 2>&1 rmdir $MNT_DIR > /dev/null 2>&1 LOOPDEV1="" @@ -211,7 +214,7 @@ function simple_scsi_reenc() function mount_and_test() { test -d $MNT_DIR || mkdir -p $MNT_DIR mount $@ $MNT_DIR 2>/dev/null || { - echo -n "failed to mount [SKIP]" + echo -n "[N/A]" return 0 } rm $MNT_DIR/* 2>/dev/null @@ -239,7 +242,7 @@ function test_logging() { echo -n "$1:" for img in $(ls img_fs*img.xz) ; do wipefs -a $SCSI_DEV > /dev/null - echo -n "[${img%.img.xz}]" + echo -n " [${img%.img.xz}]" xz -d -c $img | dd of=$SCSI_DEV bs=4k >/dev/null 2>&1 mount_and_test $SCSI_DEV || return 1 done @@ -325,7 +328,7 @@ ln -s $IMG $DEV_LINK || fail echo $PWD1 | $REENC $IMG --type luks1 --new --header $DEV_LINK -q $FAST_PBKDF_ARGON 2>/dev/null && fail $CRYPTSETUP isLUKS $IMG 2>/dev/null && fail -if [ ! fips_mode ]; then +if ! fips_mode; then # well, movin' zeroes :-) OFFSET=2048 SIZE=$(blockdev --getsz $LOOPDEV1) @@ -425,7 +428,7 @@ add_scsi_device sector_size=512 dev_size_mb=32 physblk_exp=3 test_logging "[4096/512 sector]" || fail test_logging_tmpfs || fail -if [ ! fips_mode ]; then +if ! fips_mode; then echo "[10] Removal of encryption" prepare 8192 echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fail @@ -490,7 +493,16 @@ if [ "$HAVE_BLKID" -gt 0 ]; then echo $PWD1 | $REENC --header $IMG_HDR $HEADER_LUKS2_PV -q $FAST_PBKDF --new --type luks1 2>/dev/null && fail test -f $IMG_HDR && fail fi -fi # if [ ! fips_mode ] + +# Only test if the LUKS1 decryption can be resumed with provided --uuid +echo "[14] Resume LUKS1 decryption" +prepare 8192 +tar xJf $LUKS1_DECRYPT.tar.xz || fail +echo $PWD1 | $REENC $LOOPDEV1 -q --decrypt --uuid $LUKS1_DECRYPT_UUID >/dev/null || fail +test -f $LUKS1_DECRYPT.org && fail +test -f $LUKS1_DECRYPT.new && fail +test -f $LUKS1_DECRYPT.log && fail +fi # if ! fips_mode remove_mapping exit 0 |