Blame SOURCES/cryptsetup-2.5.0-Add-more-tests-for-test-passphrase-parameter.patch

0f7e16
From f671febe64d8f40cdcb1677a08436a8907ccbb7e Mon Sep 17 00:00:00 2001
0f7e16
From: Ondrej Kozina <okozina@redhat.com>
0f7e16
Date: Wed, 23 Feb 2022 12:27:57 +0100
0f7e16
Subject: [PATCH 2/3] Add more tests for --test-passphrase parameter.
0f7e16
0f7e16
---
0f7e16
 tests/compat-test-args        |  4 ++++
0f7e16
 tests/luks2-reencryption-test | 18 ++++++++++++++++++
0f7e16
 2 files changed, 22 insertions(+)
0f7e16
0f7e16
diff --git a/tests/compat-test-args b/tests/compat-test-args
0f7e16
index faeddd00..8bbe5563 100755
0f7e16
--- a/tests/compat-test-args
0f7e16
+++ b/tests/compat-test-args
0f7e16
@@ -258,6 +258,10 @@ exp_fail luksAddKey DEV --unbound --key-size 0
0f7e16
 exp_pass luksAddKey DEV --unbound --key-size 8
0f7e16
 exp_pass luksDump DEV --unbound -S5
0f7e16
 exp_fail luksDump DEV --unbound
0f7e16
+exp_pass open DEV --unbound --test-passphrase
0f7e16
+exp_pass open DEV --unbound --test-passphrase -S5
0f7e16
+exp_fail open DEV --unbound NAME
0f7e16
+exp_fail open DEV --unbound -S5 NAME
0f7e16
 
0f7e16
 exp_fail resize NAME --refresh
0f7e16
 exp_fail open DEV NAME --test-passphrase --refresh
0f7e16
diff --git a/tests/luks2-reencryption-test b/tests/luks2-reencryption-test
0f7e16
index 6f156016..73818b5d 100755
0f7e16
--- a/tests/luks2-reencryption-test
0f7e16
+++ b/tests/luks2-reencryption-test
0f7e16
@@ -1606,5 +1606,23 @@ if [ -n "$DM_SECTOR_SIZE" ]; then
0f7e16
 	reencrypt_recover_online 4096 journal $HASH1
0f7e16
 fi
0f7e16
 
0f7e16
+echo "[27] Verify test passphrase mode works with reencryption metadata"
0f7e16
+echo $PWD1 | $CRYPTSETUP -S5 -q luksFormat --type luks2 $FAST_PBKDF_ARGON $DEV || fail
0f7e16
+echo -e "$PWD1\n$PWD1" | $CRYPTSETUP luksAddKey --unbound -s80 -S0 $FAST_PBKDF_ARGON $DEV || fail
0f7e16
+echo $PWD1 | $CRYPTSETUP reencrypt --init-only $DEV || fail
0f7e16
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $DEV || fail
0f7e16
+
0f7e16
+echo $PWD1 | $CRYPTSETUP -q luksFormat -S5 --header $IMG_HDR --type luks2 $FAST_PBKDF_ARGON $DEV || fail
0f7e16
+echo -e "$PWD1\n$PWD1" | $CRYPTSETUP luksAddKey --unbound -s80 -S0 $FAST_PBKDF_ARGON $IMG_HDR || fail
0f7e16
+echo $PWD1 | $CRYPTSETUP reencrypt --decrypt --init-only --header $IMG_HDR $DEV || fail
0f7e16
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $IMG_HDR || fail
0f7e16
+
0f7e16
+echo $PWD1 | $CRYPTSETUP reencrypt -q --encrypt --init-only --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
0f7e16
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $IMG_HDR || fail
0f7e16
+
0f7e16
+wipe_dev_head $DEV 1
0f7e16
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt --init-only --reduce-device-size 8M $FAST_PBKDF_ARGON $DEV || fail
0f7e16
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $DEV || fail
0f7e16
+
0f7e16
 remove_mapping
0f7e16
 exit 0
0f7e16
-- 
0f7e16
2.27.0
0f7e16