Blob Blame History Raw
diff -rupN cryptsetup-2.0.3.old/tests/compat-test2 cryptsetup-2.0.3/tests/compat-test2
--- cryptsetup-2.0.3.old/tests/compat-test2	2019-03-27 17:03:58.788037100 +0100
+++ cryptsetup-2.0.3/tests/compat-test2	2019-03-27 17:14:19.432280547 +0100
@@ -22,6 +22,7 @@ PWD0="compatkey"
 PWD1="93R4P4pIqAH8"
 PWD2="mymJeD8ivEhE"
 PWD3="ocMakf3fAcQO"
+PWD4="Qx3qn46vq0v"
 PWDW="rUkL4RUryBom"
 TEST_KEYRING_NAME="compattest2_keyring"
 TEST_TOKEN0="compattest2_desc0"
@@ -46,7 +47,7 @@ function remove_mapping()
 	[ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove $DEV_NAME2
 	[ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
 	losetup -d $LOOPDEV >/dev/null 2>&1
-	rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG $HEADER_KEYU $VK_FILE >/dev/null 2>&1
+	rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG $HEADER_KEYU $VK_FILE copy_test_image* >/dev/null 2>&1
 
 	# unlink whole test keyring
 	[ -n "$TEST_KEYRING" ] && keyctl unlink $TEST_KEYRING "@u" >/dev/null
@@ -817,5 +818,18 @@ $CRYPTSETUP luksDump $LOOPDEV | grep -q
 $CRYPTSETUP luksKillSlot -q $LOOPDEV 3
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2 (unbound)" && fail
 
+prepare "[39] LUKS2 metadata variants" wipe
+for mda in 16 32 64 128 256 512 1024 2048 4096 ; do
+	cp test_image_$mda copy_test_image_$mda || fail
+	echo -n "[$mda KiB]"
+	echo $PWD4 | $CRYPTSETUP open copy_test_image_$mda $DEV_NAME || fail
+	$CRYPTSETUP close $DEV_NAME || fail
+	echo -e "$PWD4\n$PWD3" | $CRYPTSETUP luksAddKey -S9 $FAST_PBKDF_OPT copy_test_image_$mda || fail
+	echo $PWD4 | $CRYPTSETUP open --test-passphrase copy_test_image_$mda || fail
+	echo $PWD3 | $CRYPTSETUP open -S9 --test-passphrase copy_test_image_$mda || fail
+	echo -n "[OK]"
+done
+echo
+
 remove_mapping
 exit 0