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

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