aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2024-03-05 14:00:51 +0100
committerOndrej Kozina <okozina@redhat.com>2024-03-05 14:58:02 +0100
commit201a4b7d8b2856adbe39b0aa245eb94b437fb41d (patch)
tree2226218947196b3e1118ac93626586bdf72f5935
parent33b9a51fa8a1a168446f1caeb8099e198bed963a (diff)
downloadcryptsetup-201a4b7d8b2856adbe39b0aa245eb94b437fb41d.tar.gz
Add regression test for resuming LUKS1 decryption.
-rw-r--r--tests/LUKS-d238e48a-0ed3-4169-b841-f26b44693134.tar.xzbin0 -> 1056 bytes
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/meson.build1
-rwxr-xr-xtests/reencryption-compat-test14
4 files changed, 16 insertions, 2 deletions
diff --git a/tests/LUKS-d238e48a-0ed3-4169-b841-f26b44693134.tar.xz b/tests/LUKS-d238e48a-0ed3-4169-b841-f26b44693134.tar.xz
new file mode 100644
index 00000000..4a37d421
--- /dev/null
+++ b/tests/LUKS-d238e48a-0ed3-4169-b841-f26b44693134.tar.xz
Binary files differ
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 75c1d3d8..93f05c7c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -100,7 +100,8 @@ EXTRA_DIST = compatimage.img.xz compatv10image.img.xz \
run-all-symbols \
fake_systemd_tpm_path.c \
unit-wipe-test \
- systemd-test-plugin
+ systemd-test-plugin \
+ LUKS-d238e48a-0ed3-4169-b841-f26b44693134.tar.xz
CLEANFILES = cryptsetup-tst* valglog* *-fail-*.log test-symbols-list.h fake_systemd_tpm_path.so
clean-local:
diff --git a/tests/meson.build b/tests/meson.build
index 43fff9a4..e43f3a54 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -27,6 +27,7 @@ test_files_to_copy = [
'xfs_512_block_size.img.xz',
'valg.sh',
'cryptsetup-valg-supps',
+ 'LUKS-d238e48a-0ed3-4169-b841-f26b44693134.tar.xz'
]
foreach file : test_files_to_copy
diff --git a/tests/reencryption-compat-test b/tests/reencryption-compat-test
index 68a8c1f2..b23c360f 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=""
@@ -492,5 +495,14 @@ if [ "$HAVE_BLKID" -gt 0 ]; then
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
+
remove_mapping
exit 0