Blame SOURCES/cryptsetup-2.0.6-test-cryptsetup-can-handle-all-LUKS2-metadata-varian.patch

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