Debian Codegraph @

tests/reencryption-compat-test

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 [scip-shell system . . `[`. -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
4 CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
5 REENC_BIN=$CRYPTSETUP
6 REENC="$REENC_BIN reencrypt"
7 FAST_PBKDF="--pbkdf-force-iterations 1000 --pbkdf pbkdf2"
8
9 if [scip-shell system . . `[`. -n "$CRYPTSETUP_TESTS_RUN_IN_MESON" ]; then
10 CRYPTSETUP_VALGRIND=$CRYPTSETUP
11 else
12 CRYPTSETUP_VALGRIND=../.libs/cryptsetup
13 CRYPTSETUP_LIB_VALGRIND=../.libs
14 fi
15
16 DEV_NAME=reenc9768
17 DEV_NAME2=reenc1273
18 IMG=reenc-data
19 IMG_HDR=$IMG.hdr
20 HEADER_LUKS2_PV=blkid-luks2-pv.img
21 ORIG_IMG=reenc-data-orig
22 DEV_LINK="reenc-test-link"
23 KEY1=key1
24 PWD1="93R4P4pIqAH8"
25 PWD2="1cND4319812f"
26 PWD3="1-9Qu5Ejfnqv"
27
28 LUKS1_DECRYPT_UUID=d238e48a-0ed3-4169-b841-f26b44693134
29 LUKS1_DECRYPT="LUKS-$LUKS1_DECRYPT_UUID"
30
31 MNT_DIR=./mnt_luks
32 START_DIR=$(pwdscip-shell system . . pwd.)
33 FIPS_MODE=$(catscip-shell system . . cat. /proc/sys/crypto/fips_enabledscip-shell filesystem . . `/proc/sys/crypto/fips_enabled`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
34
35 fips_modescip-shell shell shell-project 0.0.0 fips_mode().()
36 {
37 [scip-shell system . . `[`. -n "$FIPS_MODE" ] && [scip-shell system . . `[`. "$FIPS_MODE" -gt 0 ]
38 }
39
40 # $1 path to scsi debug bdev
41 scsi_debug_teardownscip-shell shell shell-project 0.0.0 scsi_debug_teardown().() {
42 local _tries=15;
43
44 while [scip-shell system . . `[`. -b "$1" -a $_tries -gt 0 ]; do
45 rmmod scsi_debug >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
46 if [scip-shell system . . `[`. -b "$1" ]; then
47 sleepscip-shell system . . sleep. .1
48 _tries=$((_tries-1))
49 fi
50 done
51
52 testscip-shell system . . test. ! -b "$1" || rmmod scsi_debug >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
53 }
54
55 remove_mappingscip-shell shell shell-project 0.0.0 remove_mapping().()
56 {
57 [scip-shell system . . `[`. -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2
58 [scip-shell system . . `[`. -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
59 [scip-shell system . . `[`. ! -z "$LOOPDEV1" ] && losetupscip-shell system . . losetup. -d $LOOPDEV1 >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
60 rmscip-shell system . . rm. -f $IMG $IMG_HDR $ORIG_IMG $KEY1 $HEADER_LUKS2_PV $DEV_LINK $LUKS1_DECRYPT.{org\|new\|log} >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
61 umountscip-shell system . . umount. $MNT_DIR > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
62 rmdirscip-shell system . . rmdir. $MNT_DIR > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
63 LOOPDEV1=""
64 testscip-shell system . . test. -b "$SCSI_DEV" && scsi_debug_teardownscip-shell shell shell-project 0.0.0 scsi_debug_teardown(). $SCSI_DEV
65 }
66
67 failscip-shell shell shell-project 0.0.0 fail().()
68 {
69 [scip-shell system . . `[`. -n "$1" ] && echoscip-shell system . . echo. "$1"
70 echoscip-shell system . . echo. "FAILED backtrace:"
71 while caller $frame; do ((frame++)); done
72 cd $START_DIR
73 remove_mappingscip-shell shell shell-project 0.0.0 remove_mapping().
74 exit 2
75 }
76
77 _sigchldscip-shell shell shell-project 0.0.0 _sigchld().() { local c=$?; [scip-shell system . . `[`. $c -eq 139 ] && failscip-shell shell shell-project 0.0.0 fail(). "Segfault"; [scip-shell system . . `[`. $c -eq 134 ] && failscip-shell shell shell-project 0.0.0 fail(). "Aborted"; }
78 trap _sigchld CHLD
79
80 skipscip-shell shell shell-project 0.0.0 skip().()
81 {
82 [scip-shell system . . `[`. -n "$1" ] && echoscip-shell system . . echo. "$1"
83 exit 77
84 }
85
86 valgrind_setupscip-shell shell shell-project 0.0.0 valgrind_setup().()
87 {
88 command -v valgrind >/dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail(). "Cannot find valgrind."
89 [scip-shell system . . `[`. ! -f $CRYPTSETUP_VALGRIND ] && failscip-shell shell shell-project 0.0.0 fail(). "Unable to get location of cryptsetup executable."
90 [scip-shell system . . `[`. ! -f valg.sh ] && failscip-shell shell shell-project 0.0.0 fail(). "Unable to get location of valg runner script."
91 if [scip-shell system . . `[`. -z "$CRYPTSETUP_TESTS_RUN_IN_MESON" ]; then
92 export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
93 fi
94 }
95
96 valgrind_runscip-shell shell shell-project 0.0.0 valgrind_run().()
97 {
98 INFOSTRING="$(basenamescip-shell system . . basename. ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
99 }
100
101 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device().() {
102 testscip-shell system . . test. -b "$SCSI_DEV" && scsi_debug_teardownscip-shell shell shell-project 0.0.0 scsi_debug_teardown(). $SCSI_DEV
103 if [scip-shell system . . `[`. -d /sys/module/scsi_debugscip-shell filesystem . . `/sys/module/scsi_debug`. ] ; then
104 echoscip-shell system . . echo. "Cannot use scsi_debug module (in use or compiled-in), test skipped."
105 exit 77
106 fi
107 modprobe scsi_debug $@ delay=0 >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
108 if [scip-shell system . . `[`. $? -ne 0 ] ; then
109 echoscip-shell system . . echo. "This kernel seems to not support proper scsi_debug module, test skipped."
110 exit 77
111 fi
112
113 sleepscip-shell system . . sleep. 1
114 SCSI_DEV="/dev/"$(grepscip-shell system . . grep. -l -e scsi_debug /sys/block/*/device/model | cutscip-shell system . . cut. -f4 -d /scip-shell filesystem . . `/`.)
115 [scip-shell system . . `[`. -b $SCSI_DEV ] || failscip-shell shell shell-project 0.0.0 fail(). "Cannot find $SCSI_DEV."
116 }
117
118 open_cryptscip-shell shell shell-project 0.0.0 open_crypt().() # $1 pwd, $2 hdr
119 {
120 if [scip-shell system . . `[`. -n "$2" ] ; then
121 echoscip-shell system . . echo. "$1" | $CRYPTSETUP luksOpen $LOOPDEV1 $DEV_NAME --header $2 || failscip-shell shell shell-project 0.0.0 fail().
122 elif [scip-shell system . . `[`. -n "$1" ] ; then
123 echoscip-shell system . . echo. "$1" | $CRYPTSETUP luksOpen $LOOPDEV1 $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
124 else
125 $CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV1 $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
126 fi
127 }
128
129 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev().() # $1 dev
130 {
131 ddscip-shell system . . dd. if=/dev/zeroscip-shell filesystem . . `/dev/zero`. of=$1 bs=256k >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
132 }
133
134 wipescip-shell shell shell-project 0.0.0 wipe().() # $1 pass
135 {
136 open_cryptscip-shell shell shell-project 0.0.0 open_crypt(). $1
137 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev(). /dev/mapper/$DEV_NAME
138 udevadm settle >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
139 $CRYPTSETUP luksClose $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
140 }
141
142 preparescip-shell shell shell-project 0.0.0 prepare().() # $1 dev1_siz
143 {
144 remove_mappingscip-shell shell shell-project 0.0.0 remove_mapping().
145
146 ddscip-shell system . . dd. if=/dev/zeroscip-shell filesystem . . `/dev/zero`. of=$IMG bs=1k count=$1 >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
147 LOOPDEV1=$(losetupscip-shell system . . losetup. -f 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
148 [scip-shell system . . `[`. -z "$LOOPDEV1" ] && failscip-shell shell shell-project 0.0.0 fail(). "No free loop device"
149 losetupscip-shell system . . losetup. $LOOPDEV1 $IMG || failscip-shell shell shell-project 0.0.0 fail().
150
151 if [scip-shell system . . `[`. ! -e $KEY1 ]; then
152 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=$KEY1 count=1 bs=32 >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
153 fi
154 }
155
156 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev().() # $1 dev, $2 hash
157 {
158 HASH=$(sha256sumscip-shell system . . sha256sum. $1 | cutscip-shell system . . cut. -d' ' -f 1)
159 [scip-shell system . . `[`. $HASH != "$2" ] && failscip-shell shell shell-project 0.0.0 fail(). "HASH differs ($HASH)"
160 }
161
162 check_hashscip-shell shell shell-project 0.0.0 check_hash().() # $1 pwd, $2 hash, $3 hdr
163 {
164 open_cryptscip-shell shell shell-project 0.0.0 open_crypt(). $1 $3
165 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). /dev/mapper/$DEV_NAME $2
166 $CRYPTSETUP remove $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
167 }
168
169 backup_origscip-shell shell shell-project 0.0.0 backup_orig().()
170 {
171 syncscip-shell system . . sync.
172 losetupscip-shell system . . losetup. -d $LOOPDEV1
173 udevadm settle >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
174 cpscip-shell system . . cp. $IMG $ORIG_IMG
175 losetupscip-shell system . . losetup. $LOOPDEV1 $IMG || failscip-shell shell shell-project 0.0.0 fail().
176 }
177
178 rollbackscip-shell shell shell-project 0.0.0 rollback().()
179 {
180 syncscip-shell system . . sync.
181 losetupscip-shell system . . losetup. -d $LOOPDEV1
182 udevadm settle >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
183 cpscip-shell system . . cp. $ORIG_IMG $IMG
184 losetupscip-shell system . . losetup. $LOOPDEV1 $IMG || failscip-shell shell shell-project 0.0.0 fail().
185 }
186
187 check_slotscip-shell shell shell-project 0.0.0 check_slot().() #space separated list of ENABLED key slots
188 {
189 local _KS0=DISABLED
190 local _KS1=$_KS0 _KS2=$_KS0 _KS3=$_KS0 _KS4=$_KS0 _KS5=$_KS0 _KS6=$_KS0 _KS7=$_KS0
191 local _tmp
192
193 for _tmp in $*; do
194 eval _KS$_tmp=ENABLED
195 done
196
197 local _out=$($CRYPTSETUP luksDump $LOOPDEV1 | grepscip-shell system . . grep. -e "Key Slot" | cutscip-shell system . . cut. -d ' ' -f 4)
198
199 local _i=0
200 for _tmp in $_out; do
201 eval local _orig="\${_KS${_i}}"
202 if [scip-shell system . . `[`. "$_tmp" != "$_orig" ]; then
203 echoscip-shell system . . echo. "Keyslot $_i is $_tmp, expected result: $_orig"
204 return 1
205 fi
206 _i=$[_i+1]
207 done
208
209 return 0
210 }
211
212 simple_scsi_reencscip-shell shell shell-project 0.0.0 simple_scsi_reenc().()
213 {
214 echoscip-shell system . . echo. -n "$1"
215 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF $SCSI_DEV || failscip-shell shell shell-project 0.0.0 fail().
216
217 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksOpen $SCSI_DEV $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
218 HASH=$(sha256sumscip-shell system . . sha256sum. /dev/mapper/$DEV_NAME | cutscip-shell system . . cut. -d' ' -f 1)
219 $CRYPTSETUP luksClose $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
220
221 echoscip-shell system . . echo. $PWD1 | $REENC -q $FAST_PBKDF $SCSI_DEV || failscip-shell shell shell-project 0.0.0 fail().
222
223 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksOpen $SCSI_DEV $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
224 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). /dev/mapper/$DEV_NAME $HASH
225 $CRYPTSETUP luksClose $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
226 }
227
228 mount_and_testscip-shell shell shell-project 0.0.0 mount_and_test().() {
229 testscip-shell system . . test. -d $MNT_DIR || mkdirscip-shell system . . mkdir. -p $MNT_DIR
230 mountscip-shell system . . mount. $@ $MNT_DIR 2>/dev/nullscip-shell filesystem . . `/dev/null`. || {
231 echoscip-shell system . . echo. -n "[N/A]"
232 return 0
233 }
234 rmscip-shell system . . rm. $MNT_DIR/* 2>/dev/nullscip-shell filesystem . . `/dev/null`.
235 cd $MNT_DIR
236
237 if [scip-shell system . . `[`. "${REENC:0:1}" != "/scip-shell filesystem . . `/`." ] ; then
238 MNT_REENC=$START_DIR/$REENC
239 else
240 MNT_REENC=$REENC
241 fi
242
243 echoscip-shell system . . echo. $PWD2 | $MNT_REENC $LOOPDEV1 -q --use-fsync --use-directio --write-log $FAST_PBKDF || return 1
244 cd $START_DIR
245 umountscip-shell system . . umount. $MNT_DIR
246 echoscip-shell system . . echo. -n [OK]
247 }
248
249 test_logging_tmpfsscip-shell shell shell-project 0.0.0 test_logging_tmpfs().() {
250 echoscip-shell system . . echo. -n "[tmpfs]"
251 mount_and_testscip-shell shell shell-project 0.0.0 mount_and_test(). -t tmpfs none -o size=$[25*1024*1024] || return 1
252 echoscip-shell system . . echo.
253 }
254
255 test_loggingscip-shell shell shell-project 0.0.0 test_logging().() {
256 echoscip-shell system . . echo. -n "$1:"
257 for img in $(lsscip-shell system . . ls. img_fs*img.xz) ; do
258 wipefsscip-shell system . . wipefs. -a $SCSI_DEV > /dev/nullscip-shell filesystem . . `/dev/null`.
259 echoscip-shell system . . echo. -n " [${img%.img.xz}]"
260 xzscip-shell system . . xz. -d -c $img | ddscip-shell system . . dd. of=$SCSI_DEV bs=4k >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
261 mount_and_testscip-shell shell shell-project 0.0.0 mount_and_test(). $SCSI_DEV || return 1
262 done
263 echoscip-shell system . . echo.
264 }
265
266 check_blkidscip-shell shell shell-project 0.0.0 check_blkid().() {
267 xzscip-shell system . . xz. -dkf $HEADER_LUKS2_PV.xz
268 if ! $($CRYPTSETUP --version | grepscip-shell system . . grep. -q "BLKID"); then
269 HAVE_BLKID=0
270 elif $(blkidscip-shell system . . blkid. -p -n crypto_LUKS $HEADER_LUKS2_PV >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1); then
271 HAVE_BLKID=1
272 else
273 HAVE_BLKID=0
274 fi
275 }
276
277 [scip-shell system . . `[`. $(idscip-shell system . . id. -u) != 0 ] && skipscip-shell shell shell-project 0.0.0 skip(). "WARNING: You must be root to run this test, test skipped."
278 [scip-shell system . . `[`. ! -x "$REENC_BIN" ] && skipscip-shell shell shell-project 0.0.0 skip(). "Cannot find $REENC_BIN, test skipped."
279 [scip-shell system . . `[`. -n "$VALG" ] && valgrind_setupscip-shell shell shell-project 0.0.0 valgrind_setup(). && CRYPTSETUP=valgrind_run
280 command -v wipefs >/dev/nullscip-shell filesystem . . `/dev/null`. || skipscip-shell shell shell-project 0.0.0 skip(). "Cannot find wipefs, test skipped."
281
282 # REENCRYPTION tests
283
284 HASH1=b69dae56a14d1a8314ed40664c4033ea0a550eea2673e04df42a66ac6b9faf2c
285 HASH2=d85ef2a08aeac2812a648deb875485a6e3848fc3d43ce4aa380937f08199f86b
286 HASH3=e4e5749032a5163c45125eccf3e8598ba5ed840df442c97e1d5ad4ad84359605
287 HASH4=2daeb1f36095b44b318410b3f4e8b5d989dcc7bb023d1426c492dab0a3053e74
288 HASH5=5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
289
290 echoscip-shell system . . echo. "[1] Reencryption"
291 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
292 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -s 128 -c aes-cbc-plain $FAST_PBKDF --align-payload 4096 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
293 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD1
294 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
295 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
296 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
297 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q -s 256 $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
298 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
299 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q -s 256 -c aes-xts-plain64 -h sha256 $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
300 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
301 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --use-directio $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
302 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
303 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --volume-key-file /dev/urandomscip-shell filesystem . . `/dev/urandom`. $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
304 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
305 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q -s 512 --volume-key-file /dev/urandomscip-shell filesystem . . `/dev/urandom`. $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
306 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
307 $CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
308
309 echoscip-shell system . . echo. "[2] Reencryption with data shift"
310 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -c aes-cbc-essiv:sha256 -s 128 $FAST_PBKDF --align-payload 2048 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
311 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD1
312 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q -s 256 --reduce-device-size 1024S $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
313 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH2
314 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
315 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH2
316 $CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
317
318 echoscip-shell system . . echo. "[3] Reencryption with keyfile"
319 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -d $KEY1 -c aes-cbc-essiv:sha256 -s 128 $FAST_PBKDF --align-payload 4096 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
320 wipescip-shell shell shell-project 0.0.0 wipe().
321 check_hashscip-shell shell shell-project 0.0.0 check_hash(). "" $HASH1
322 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksAddKey -d $KEY1 $LOOPDEV1 $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
323 $REENC $LOOPDEV1 -d $KEY1 $FAST_PBKDF -q 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
324 $REENC $LOOPDEV1 -d $KEY1 -S 0 $FAST_PBKDF -q || failscip-shell shell shell-project 0.0.0 fail().
325 check_hashscip-shell shell shell-project 0.0.0 check_hash(). "" $HASH1
326 check_slotscip-shell shell shell-project 0.0.0 check_slot(). 0 || failscip-shell shell shell-project 0.0.0 fail(). "Only keyslot 0 expected to be enabled"
327 $REENC $LOOPDEV1 -d $KEY1 $FAST_PBKDF -q || failscip-shell shell shell-project 0.0.0 fail().
328 # FIXME echo $PWD1 | $REENC ...
329
330 echoscip-shell system . . echo. "[4] Encryption of not yet encrypted device"
331 # Encrypt without size reduction must not allow header device same as data device
332 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev(). $LOOPDEV1
333 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 --type luks1 --new --header $LOOPDEV1 -q $FAST_PBKDF_ARGON 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
334 $CRYPTSETUP isLUKS $LOOPDEV1 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
335 lnscip-shell system . . ln. -s $LOOPDEV1 $DEV_LINK || failscip-shell shell shell-project 0.0.0 fail().
336 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 --type luks1 --new --header $DEV_LINK -q $FAST_PBKDF_ARGON 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
337 $CRYPTSETUP isLUKS $LOOPDEV1 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
338 rmscip-shell system . . rm. -f $DEV_LINK || failscip-shell shell shell-project 0.0.0 fail().
339 echoscip-shell system . . echo. $PWD1 | $REENC $IMG --type luks1 --new --header $IMG -q $FAST_PBKDF_ARGON 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
340 $CRYPTSETUP isLUKS $IMG 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
341 lnscip-shell system . . ln. -s $IMG $DEV_LINK || failscip-shell shell shell-project 0.0.0 fail().
342 echoscip-shell system . . echo. $PWD1 | $REENC $IMG --type luks1 --new --header $DEV_LINK -q $FAST_PBKDF_ARGON 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
343 $CRYPTSETUP isLUKS $IMG 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
344
345 if ! fips_modescip-shell shell shell-project 0.0.0 fips_mode().; then
346 # well, movin' zeroes :-)
347 OFFSET=2048
348 SIZE=$(blockdevscip-shell system . . blockdev. --getsz $LOOPDEV1)
349 dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" || failscip-shell shell shell-project 0.0.0 fail().
350 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). /dev/mapper/$DEV_NAME2 $HASH3
351 dmsetup remove --retry $DEV_NAME2 || failscip-shell shell shell-project 0.0.0 fail().
352 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
353 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH3
354 $CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
355 # 64MiB + 1 KiB
356 preparescip-shell shell shell-project 0.0.0 prepare(). 65537
357 OFFSET=131072
358 SIZE=$(blockdevscip-shell system . . blockdev. --getsz $LOOPDEV1)
359 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev(). $LOOPDEV1
360 dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" || failscip-shell shell shell-project 0.0.0 fail().
361 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). /dev/mapper/$DEV_NAME2 $HASH5
362 dmsetup remove --retry $DEV_NAME2 || failscip-shell shell shell-project 0.0.0 fail().
363 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
364 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH5
365 $CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
366 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
367 OFFSET=4096
368 echoscip-shell system . . echo. fake | $REENC $LOOPDEV1 -d $KEY1 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
369 $CRYPTSETUP open --test-passphrase $LOOPDEV1 -d $KEY1 || failscip-shell shell shell-project 0.0.0 fail().
370 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev(). $LOOPDEV1
371 fi
372
373 echoscip-shell system . . echo. "[5] Reencryption using specific keyslot"
374 echoscip-shell system . . echo. $PWD2 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
375 echoscip-shell system . . echo. -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 1 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
376 echoscip-shell system . . echo. -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 2 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
377 echoscip-shell system . . echo. -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 3 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
378 echoscip-shell system . . echo. -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 4 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
379 echoscip-shell system . . echo. -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 5 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
380 echoscip-shell system . . echo. -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 6 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
381 echoscip-shell system . . echo. -e "$PWD2\n$PWD3" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 7 $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
382 backup_origscip-shell shell shell-project 0.0.0 backup_orig().
383 echoscip-shell system . . echo. $PWD2 | $REENC $FAST_PBKDF -S 0 -q $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
384 check_slotscip-shell shell shell-project 0.0.0 check_slot(). 0 || failscip-shell shell shell-project 0.0.0 fail(). "Only keyslot 0 expected to be enabled"
385 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD2
386 rollbackscip-shell shell shell-project 0.0.0 rollback().
387 echoscip-shell system . . echo. $PWD1 | $REENC $FAST_PBKDF -S 1 -q $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
388 check_slotscip-shell shell shell-project 0.0.0 check_slot(). 1 || failscip-shell shell shell-project 0.0.0 fail(). "Only keyslot 1 expected to be enabled"
389 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD1
390 rollbackscip-shell shell shell-project 0.0.0 rollback().
391 echoscip-shell system . . echo. $PWD2 | $REENC $FAST_PBKDF -S 6 -q $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
392 check_slotscip-shell shell shell-project 0.0.0 check_slot(). 6 || failscip-shell shell shell-project 0.0.0 fail(). "Only keyslot 6 expected to be enabled"
393 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD2
394 rollbackscip-shell shell shell-project 0.0.0 rollback().
395 echoscip-shell system . . echo. $PWD3 | $REENC $FAST_PBKDF -S 7 -q $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
396 check_slotscip-shell shell shell-project 0.0.0 check_slot(). 7 || failscip-shell shell shell-project 0.0.0 fail(). "Only keyslot 7 expected to be enabled"
397 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD3
398 rollbackscip-shell shell shell-project 0.0.0 rollback().
399 echoscip-shell system . . echo. $PWD3 | $REENC $FAST_PBKDF -S 8 -q $LOOPDEV1 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
400 $CRYPTSETUP luksDump $LOOPDEV1 > /dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
401
402 echoscip-shell system . . echo. "[6] Reencryption using all active keyslots"
403 echoscip-shell system . . echo. -e "$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD3" | $REENC -q $LOOPDEV1 $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
404 check_slotscip-shell shell shell-project 0.0.0 check_slot(). 0 1 2 3 4 5 6 7 || failscip-shell shell shell-project 0.0.0 fail(). "All keyslots expected to be enabled"
405
406 echoscip-shell system . . echo. "[7] Reencryption of block devices with different block size"
407 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device(). sector_size=512 dev_size_mb=8
408 simple_scsi_reencscip-shell shell shell-project 0.0.0 simple_scsi_reenc(). "[512 sector]"
409 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device(). sector_size=4096 dev_size_mb=8
410 simple_scsi_reencscip-shell shell shell-project 0.0.0 simple_scsi_reenc(). "[4096 sector]"
411 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device(). sector_size=512 physblk_exp=3 dev_size_mb=8
412 simple_scsi_reencscip-shell shell shell-project 0.0.0 simple_scsi_reenc(). "[4096/512 sector]"
413 echoscip-shell system . . echo. "[OK]"
414
415 echoscip-shell system . . echo. "[8] Header only reencryption (hash and iteration time)"
416 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 --hash sha512 $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
417 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD1
418 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
419 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --keep-key || failscip-shell shell shell-project 0.0.0 fail().
420 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
421 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --keep-key --pbkdf-force-iterations 999 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
422 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
423 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --keep-key --hash sha256 --pbkdf-force-iterations 1001 || failscip-shell shell shell-project 0.0.0 fail().
424 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
425 [scip-shell system . . `[`. "$($CRYPTSETUP luksDump $LOOPDEV1 | grepscip-shell system . . grep. -A1 -m1 "Key Slot 0" | grepscip-shell system . . grep. Iterations: | sedscip-shell system . . sed. -e 's/[[:space:]]\+Iterations:\ \+//g')" -eq 1001 ] || failscip-shell shell shell-project 0.0.0 fail().
426 [scip-shell system . . `[`. "$($CRYPTSETUP luksDump $LOOPDEV1 | grepscip-shell system . . grep. -m1 "Hash spec:" | cutscip-shell system . . cut. -f2)" = "sha256" ] || failscip-shell shell shell-project 0.0.0 fail().
427 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --keep-key --hash sha512 $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
428 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
429 [scip-shell system . . `[`. "$($CRYPTSETUP luksDump $LOOPDEV1 | grepscip-shell system . . grep. -A1 -m1 "Key Slot 0" | grepscip-shell system . . grep. Iterations: | sedscip-shell system . . sed. -e 's/[[:space:]]\+Iterations:\ \+//g')" -eq 1000 ] || failscip-shell shell shell-project 0.0.0 fail().
430 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --keep-key $FAST_PBKDF || failscip-shell shell shell-project 0.0.0 fail().
431 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
432 $CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
433
434 echoscip-shell system . . echo. "[9] Test log I/Os on various underlying block devices"
435 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
436 echoscip-shell system . . echo. $PWD2 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
437 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device(). sector_size=512 dev_size_mb=32
438 test_loggingscip-shell shell shell-project 0.0.0 test_logging(). "[512 sector]" || failscip-shell shell shell-project 0.0.0 fail().
439 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device(). sector_size=4096 dev_size_mb=32
440 test_loggingscip-shell shell shell-project 0.0.0 test_logging(). "[4096 sector]" || failscip-shell shell shell-project 0.0.0 fail().
441 add_scsi_devicescip-shell shell shell-project 0.0.0 add_scsi_device(). sector_size=512 dev_size_mb=32 physblk_exp=3
442 test_loggingscip-shell shell shell-project 0.0.0 test_logging(). "[4096/512 sector]" || failscip-shell shell shell-project 0.0.0 fail().
443 test_logging_tmpfsscip-shell shell shell-project 0.0.0 test_logging_tmpfs(). || failscip-shell shell shell-project 0.0.0 fail().
444
445 if ! fips_modescip-shell shell shell-project 0.0.0 fips_mode().; then
446 echoscip-shell system . . echo. "[10] Removal of encryption"
447 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
448 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
449 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD1
450 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
451 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --decrypt || failscip-shell shell shell-project 0.0.0 fail().
452 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). $LOOPDEV1 $HASH4
453
454 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -S5 $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
455 wipescip-shell shell shell-project 0.0.0 wipe(). $PWD1
456 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH1
457 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --decrypt || failscip-shell shell shell-project 0.0.0 fail().
458 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). $LOOPDEV1 $HASH4
459
460 echoscip-shell system . . echo. "[11] Detached header - adding encryption/reencryption/decryption"
461 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
462 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). $IMG $HASH4
463 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --header $IMG_HDR --new --type luks1
464 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH4 $IMG_HDR
465 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --header $IMG_HDR || failscip-shell shell shell-project 0.0.0 fail().
466 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH4 $IMG_HDR
467 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --header $IMG_HDR --decrypt || failscip-shell shell shell-project 0.0.0 fail().
468 check_hash_devscip-shell shell shell-project 0.0.0 check_hash_dev(). $IMG $HASH4
469 # existing header of zero size
470 catscip-shell system . . cat. /dev/nullscip-shell filesystem . . `/dev/null`. >$IMG_HDR
471 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --header $IMG_HDR --new --type luks1
472 check_hashscip-shell shell shell-project 0.0.0 check_hash(). $PWD1 $HASH4 $IMG_HDR
473 $CRYPTSETUP isLuks $LOOPDEV1 && failscip-shell shell shell-project 0.0.0 fail().
474 $CRYPTSETUP isLuks $IMG_HDR || failscip-shell shell shell-project 0.0.0 fail().
475
476 echoscip-shell system . . echo. "[12] Prevent nested encryption"
477 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
478 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
479
480 #data device is already LUKS device (prevent nested encryption)
481 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --new --type luks1 --reduce-device-size 1024S 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
482 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --new --type luks1 --header $IMG_HDR 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
483 testscip-shell system . . test. -f $IMG_HDR && failscip-shell shell shell-project 0.0.0 fail().
484 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --new --type luks2 --reduce-device-size 2048S 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
485 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --new --type luks2 --header $IMG_HDR 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
486 testscip-shell system . . test. -f $IMG_HDR && failscip-shell shell shell-project 0.0.0 fail().
487
488 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev(). $LOOPDEV1
489 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 --header $IMG_HDR $FAST_PBKDF $LOOPDEV1 || failscip-shell shell shell-project 0.0.0 fail().
490
491 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --new --type luks1 --header $IMG_HDR 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
492 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --new --type luks2 --header $IMG_HDR 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
493
494 check_blkidscip-shell shell shell-project 0.0.0 check_blkid().
495 if [scip-shell system . . `[`. "$HAVE_BLKID" -gt 0 ]; then
496 echoscip-shell system . . echo. "[13] Prevent nested encryption of broken LUKS device"
497 rmscip-shell system . . rm. -f $IMG_HDR
498 wipe_devscip-shell shell shell-project 0.0.0 wipe_dev(). $LOOPDEV1
499 xzscip-shell system . . xz. -dkf $HEADER_LUKS2_PV.xz
500 # broken header
501 echoscip-shell system . . echo. $PWD1 | $REENC --header $HEADER_LUKS2_PV $LOOPDEV1 -q $FAST_PBKDF --new --type luks1 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
502 $CRYPTSETUP isLuks $HEADER_LUKS2_PV && failscip-shell shell shell-project 0.0.0 fail().
503 # broken device
504 echoscip-shell system . . echo. $PWD1 | $REENC $HEADER_LUKS2_PV -q $FAST_PBKDF --new --type luks1 --reduce-device-size 1024S 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
505 $CRYPTSETUP isLuks $HEADER_LUKS2_PV && failscip-shell shell shell-project 0.0.0 fail().
506 # broken data device only
507 echoscip-shell system . . echo. $PWD1 | $REENC --header $IMG_HDR $HEADER_LUKS2_PV -q $FAST_PBKDF --new --type luks1 2>/dev/nullscip-shell filesystem . . `/dev/null`. && failscip-shell shell shell-project 0.0.0 fail().
508 testscip-shell system . . test. -f $IMG_HDR && failscip-shell shell shell-project 0.0.0 fail().
509 fi
510
511 # Only test if the LUKS1 decryption can be resumed with provided --uuid
512 echoscip-shell system . . echo. "[14] Resume LUKS1 decryption"
513 preparescip-shell shell shell-project 0.0.0 prepare(). 8192
514 tarscip-shell system . . tar. xJf $LUKS1_DECRYPT.tar.xz || failscip-shell shell shell-project 0.0.0 fail().
515 echoscip-shell system . . echo. $PWD1 | $REENC $LOOPDEV1 -q --decrypt --uuid $LUKS1_DECRYPT_UUID >/dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail().
516 testscip-shell system . . test. -f $LUKS1_DECRYPT.org && failscip-shell shell shell-project 0.0.0 fail().
517 testscip-shell system . . test. -f $LUKS1_DECRYPT.new && failscip-shell shell shell-project 0.0.0 fail().
518 testscip-shell system . . test. -f $LUKS1_DECRYPT.log && failscip-shell shell shell-project 0.0.0 fail().
519 fi # if ! fips_mode
520
521 remove_mappingscip-shell shell shell-project 0.0.0 remove_mapping().
522 exit 0