Debian Codegraph @

tests/align-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 DEV=""
6 DEV_STACKED="luks0xbabe"
7 DEV_NAME="dummyalign"
8 MNT_DIR="./mnt_luks"
9 PWD1="93R4P4pIqAH8"
10 PWD2="mymJeD8ivEhE"
11 FAST_PBKDF="--pbkdf-force-iterations 1000"
12
13 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`.)
14
15 if [scip-shell system . . `[`. -n "$CRYPTSETUP_TESTS_RUN_IN_MESON" ]; then
16 CRYPTSETUP_VALGRIND=$CRYPTSETUP
17 else
18 CRYPTSETUP_VALGRIND=../.libs/cryptsetup
19 CRYPTSETUP_LIB_VALGRIND=../.libs
20 fi
21
22
23 fips_modescip-shell shell shell-project 0.0.0 fips_mode().()
24 {
25 [scip-shell system . . `[`. -n "$FIPS_MODE" ] && [scip-shell system . . `[`. "$FIPS_MODE" -gt 0 ]
26 }
27
28 cleanupscip-shell shell shell-project 0.0.0 cleanup().() {
29 udevadm settle >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
30 if [scip-shell system . . `[`. -d "$MNT_DIR" ] ; then
31 umountscip-shell system . . umount. -f $MNT_DIR 2>/dev/nullscip-shell filesystem . . `/dev/null`.
32 rmdirscip-shell system . . rmdir. $MNT_DIR 2>/dev/nullscip-shell filesystem . . `/dev/null`.
33 fi
34 [scip-shell system . . `[`. -b /dev/mapper/$DEV_STACKED ] && dmsetup remove --retry $DEV_STACKED >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
35 [scip-shell system . . `[`. -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
36 # FIXME scsi_debug sometimes in-use here
37 sleepscip-shell system . . sleep. 1
38 rmmod scsi_debug >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
39 sleepscip-shell system . . sleep. 1
40 }
41
42 failscip-shell shell shell-project 0.0.0 fail().()
43 {
44 if [scip-shell system . . `[`. -n "$1" ] ; then echoscip-shell system . . echo. "FAIL $1" ; fi
45 echoscip-shell system . . echo. "FAILED backtrace:"
46 while caller $frame; do ((frame++)); done
47 cleanupscip-shell shell shell-project 0.0.0 cleanup().
48 exit 100
49 }
50
51 _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"; }
52 trap _sigchld CHLD
53
54 skipscip-shell shell shell-project 0.0.0 skip().()
55 {
56 echoscip-shell system . . echo. "TEST SKIPPED: $1"
57 cleanupscip-shell shell shell-project 0.0.0 cleanup().
58 exit 77
59 }
60
61 valgrind_setupscip-shell shell shell-project 0.0.0 valgrind_setup().()
62 {
63 command -v valgrind >/dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail(). "Cannot find valgrind."
64 [scip-shell system . . `[`. ! -f $CRYPTSETUP_VALGRIND ] && failscip-shell shell shell-project 0.0.0 fail(). "Unable to get location of cryptsetup executable."
65 [scip-shell system . . `[`. ! -f valg.sh ] && failscip-shell shell shell-project 0.0.0 fail(). "Unable to get location of valg runner script."
66 if [scip-shell system . . `[`. -z "$CRYPTSETUP_TESTS_RUN_IN_MESON" ]; then
67 export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
68 fi
69 }
70
71 valgrind_runscip-shell shell shell-project 0.0.0 valgrind_run().()
72 {
73 INFOSTRING="$(basenamescip-shell system . . basename. ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
74 }
75
76 dm_crypt_featuresscip-shell shell shell-project 0.0.0 dm_crypt_features().()
77 {
78 VER_STR=$(dmsetup targets | grepscip-shell system . . grep. crypt | cutscip-shell system . . cut. -f2 -dv)
79 [scip-shell system . . `[`. -z "$VER_STR" ] && failscip-shell shell shell-project 0.0.0 fail(). "Failed to parse dm-crypt version."
80
81 VER_MAJ=$(echoscip-shell system . . echo. $VER_STR | cutscip-shell system . . cut. -f 1 -d.)
82 VER_MIN=$(echoscip-shell system . . echo. $VER_STR | cutscip-shell system . . cut. -f 2 -d.)
83 VER_PTC=$(echoscip-shell system . . echo. $VER_STR | cutscip-shell system . . cut. -f 3 -d.)
84
85 [scip-shell system . . `[`. $VER_MAJ -lt 1 ] && return
86 [scip-shell system . . `[`. $VER_MAJ -gt 1 ] && {
87 DM_PERF_CPU=1
88 DM_SECTOR_SIZE=1
89 return
90 }
91
92 [scip-shell system . . `[`. $VER_MIN -lt 14 ] && return
93 DM_PERF_CPU=1
94 if [scip-shell system . . `[`. $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
95 DM_SECTOR_SIZE=1
96 fi
97 }
98
99 add_devicescip-shell shell shell-project 0.0.0 add_device().() {
100 modprobe scsi_debug $@ delay=0 >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
101 if [scip-shell system . . `[`. $? -ne 0 ] ; then
102 echoscip-shell system . . echo. "This kernel seems to not support proper scsi_debug module, test skipped."
103 exit 77
104 fi
105
106 sleepscip-shell system . . sleep. 1
107 DEV=$(grepscip-shell system . . grep. -l -e scsi_debug /sys/block/*/device/model | cutscip-shell system . . cut. -f4 -d /scip-shell filesystem . . `/`.)
108
109 if [scip-shell system . . `[`. ! -e /sys/block/$DEV/alignment_offset ] ; then
110 echoscip-shell system . . echo. "This kernel seems to not support topology info, test skipped."
111 cleanupscip-shell shell shell-project 0.0.0 cleanup().
112 exit 77
113 fi
114
115 DEV="/dev/$DEV"
116 [scip-shell system . . `[`. -b $DEV ] || failscip-shell shell shell-project 0.0.0 fail(). "Cannot find $DEV."
117 }
118
119 formatscip-shell shell shell-project 0.0.0 format().() # key_bits expected [forced]
120 {
121 if [scip-shell system . . `[`. -z "$3" ] ; then
122 echoscip-shell system . . echo. -n "Formatting using topology info ($1 bits key)..."
123 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -c aes-cbc-essiv:sha256 -s $1 || failscip-shell shell shell-project 0.0.0 fail().
124 else
125 echoscip-shell system . . echo. -n "Formatting using forced sector alignment $3 ($1 bits key)..."
126 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -s $1 -c aes-cbc-essiv:sha256 --align-payload=$3 ||failscip-shell shell shell-project 0.0.0 fail().
127 fi
128
129 # check the device can be activated
130 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksOpen $DEV $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
131 $CRYPTSETUP close $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
132
133 ALIGN=$($CRYPTSETUP luksDump $DEV |grepscip-shell system . . grep. "Payload offset" | sedscip-shell system . . sed. -e s/.*\\t//)
134 #echo "ALIGN = $ALIGN"
135
136 [scip-shell system . . `[`. -z "$ALIGN" ] && failscip-shell shell shell-project 0.0.0 fail().
137 [scip-shell system . . `[`. $ALIGN -ne $2 ] && failscip-shell shell shell-project 0.0.0 fail(). "Expected alignment differs: expected $2 != detected $ALIGN"
138
139 # test some operation, just in case
140 echoscip-shell system . . echo. -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $DEV $FAST_PBKDF --new-key-slot 1
141 [scip-shell system . . `[`. $? -ne 0 ] && failscip-shell shell shell-project 0.0.0 fail(). "Keyslot add failed."
142
143 $CRYPTSETUP -q luksKillSlot $DEV 1
144 [scip-shell system . . `[`. $? -ne 0 ] && failscip-shell shell shell-project 0.0.0 fail(). "Keyslot removal failed."
145
146 echoscip-shell system . . echo. "PASSED"
147 }
148
149 get_offsetsscip-shell shell shell-project 0.0.0 get_offsets().()
150 {
151 $CRYPTSETUP luksDump $DEV | grepscip-shell system . . grep. "$1" | cutscip-shell system . . cut. -s -d ':' -f 2 | sedscip-shell system . . sed. -e 's/\s//g' -e :a -e N -e 's/\n/:/g' -e 's/\s//g' -e ta
152 }
153
154 format_nullscip-shell shell shell-project 0.0.0 format_null().()
155 {
156 if [scip-shell system . . `[`. $3 -eq 0 ] ; then
157 echoscip-shell system . . echo. -n "Formatting using topology info ($1 bits key) [slot 0"
158 echoscip-shell system . . echo. | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -c null -s $1 || failscip-shell shell shell-project 0.0.0 fail().
159 else
160 echoscip-shell system . . echo. -n "Formatting using forced sector alignment $3 ($1 bits key) [slot 0"
161 echoscip-shell system . . echo. | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -c null -s $1 --align-payload=$3 || failscip-shell shell shell-project 0.0.0 fail().
162 fi
163
164 # check the device can be activated
165 echoscip-shell system . . echo. | $CRYPTSETUP luksOpen $DEV $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
166 $CRYPTSETUP close $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
167
168 POFF=$(get_offsetsscip-shell shell shell-project 0.0.0 get_offsets(). "Payload offset")
169 [scip-shell system . . `[`. -z "$POFF" ] && failscip-shell shell shell-project 0.0.0 fail().
170 [scip-shell system . . `[`. $POFF != $2 ] && failscip-shell shell shell-project 0.0.0 fail(). "Expected data offset differs: expected $2 != detected $POFF"
171 if [scip-shell system . . `[`. -n "$4" ] ; then
172 for j in 1 2 3 4 5 6 7 ; do
173 echoscip-shell system . . echo. -e "\n" | $CRYPTSETUP luksAddKey $DEV -q $FAST_PBKDF --new-key-slot $j -c null $PARAMS
174 echoscip-shell system . . echo. -n $j
175 [scip-shell system . . `[`. $? -ne 0 ] && failscip-shell shell shell-project 0.0.0 fail().
176 done
177
178 KOFF=$(get_offsetsscip-shell shell shell-project 0.0.0 get_offsets(). "Key material offset")
179 [scip-shell system . . `[`. -z "$KOFF" ] && failscip-shell shell shell-project 0.0.0 fail().
180 [scip-shell system . . `[`. $KOFF != $4 ] && failscip-shell shell shell-project 0.0.0 fail(). "Expected keyslots offsets differ: expected $4 != detected $KOFF"
181 fi
182
183 echoscip-shell system . . echo. "]...PASSED"
184 }
185
186 format_plainscip-shell shell shell-project 0.0.0 format_plain().() # sector size
187 {
188 echoscip-shell system . . echo. -n "Formatting plain device (sector size $1)..."
189 if [scip-shell system . . `[`. -n "$DM_SECTOR_SIZE" ] ; then
190 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP open --type plain --cipher aes-cbc-essiv:sha256 --key-size 256 --hash sha256 --sector-size $1 $DEV $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
191 $CRYPTSETUP close $DEV_NAME || failscip-shell shell shell-project 0.0.0 fail().
192 echoscip-shell system . . echo. "PASSED"
193 else
194 echoscip-shell system . . echo. "N/A"
195 fi
196 }
197
198 format_plain_failscip-shell shell shell-project 0.0.0 format_plain_fail().() # sector size
199 {
200 echoscip-shell system . . echo. -n "Formatting plain device (sector size $1, must fail)..."
201 if [scip-shell system . . `[`. -n "$DM_SECTOR_SIZE" ] ; then
202 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP open --type plain --hash sha256 --sector-size $1 $DEV $DEV_NAME >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && failscip-shell shell shell-project 0.0.0 fail().
203 echoscip-shell system . . echo. "PASSED"
204 else
205 echoscip-shell system . . echo. "N/A"
206 fi
207 }
208
209 [scip-shell system . . `[`. ! -x "$CRYPTSETUP" ] && skipscip-shell shell shell-project 0.0.0 skip(). "Cannot find $CRYPTSETUP, test skipped."
210 [scip-shell system . . `[`. -n "$VALG" ] && valgrind_setupscip-shell shell shell-project 0.0.0 valgrind_setup(). && CRYPTSETUP=valgrind_run
211 if [scip-shell system . . `[`. $(idscip-shell system . . id. -u) != 0 ]; then
212 echoscip-shell system . . echo. "WARNING: You must be root to run this test, test skipped."
213 exit 77
214 fi
215
216 dm_crypt_featuresscip-shell shell shell-project 0.0.0 dm_crypt_features().
217 modprobe --dry-run scsi_debug >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 || skipscip-shell shell shell-project 0.0.0 skip(). "This kernel seems to not support proper scsi_debug module, test skipped."
218 cleanupscip-shell shell shell-project 0.0.0 cleanup().
219 if [scip-shell system . . `[`. -d /sys/module/scsi_debugscip-shell filesystem . . `/sys/module/scsi_debug`. ] ; then
220 echoscip-shell system . . echo. "Cannot use scsi_debug module (in use or compiled-in), test skipped."
221 exit 77
222 fi
223
224 echoscip-shell system . . echo. "# Create desktop-class 4K drive"
225 echoscip-shell system . . echo. "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0)"
226 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=512 physblk_exp=3 num_tgts=1
227 formatscip-shell shell shell-project 0.0.0 format(). 256 4096
228 formatscip-shell shell shell-project 0.0.0 format(). 256 2056 8
229 formatscip-shell shell shell-project 0.0.0 format(). 128 2048
230 formatscip-shell shell shell-project 0.0.0 format(). 128 1032 8
231 formatscip-shell shell shell-project 0.0.0 format(). 256 8192 8192
232 formatscip-shell shell shell-project 0.0.0 format(). 128 8192 8192
233 cleanupscip-shell shell shell-project 0.0.0 cleanup().
234
235 echoscip-shell system . . echo. "# Create desktop-class 4K drive with misaligned opt-io (some bad USB enclosures)"
236 echoscip-shell system . . echo. "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0, opt-io=1025)"
237 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=512 physblk_exp=3 num_tgts=1 opt_blks=1025
238 formatscip-shell shell shell-project 0.0.0 format(). 256 4096
239 formatscip-shell shell shell-project 0.0.0 format(). 256 2056 8
240 formatscip-shell shell shell-project 0.0.0 format(). 128 2048
241 formatscip-shell shell shell-project 0.0.0 format(). 128 1032 8
242 formatscip-shell shell shell-project 0.0.0 format(). 256 8192 8192
243 formatscip-shell shell shell-project 0.0.0 format(). 128 8192 8192
244 cleanupscip-shell shell shell-project 0.0.0 cleanup().
245
246 echoscip-shell system . . echo. "# Create desktop-class 4K drive w/ 63-sector DOS partition compensation"
247 echoscip-shell system . . echo. "# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584)"
248 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=512 physblk_exp=3 lowest_aligned=7 num_tgts=1
249 formatscip-shell shell shell-project 0.0.0 format(). 256 4103
250 formatscip-shell shell shell-project 0.0.0 format(). 256 2056 8
251 formatscip-shell shell shell-project 0.0.0 format(). 128 2055
252 formatscip-shell shell shell-project 0.0.0 format(). 128 1032 8
253 cleanupscip-shell shell shell-project 0.0.0 cleanup().
254
255 echoscip-shell system . . echo. "# Create enterprise-class 4K drive"
256 echoscip-shell system . . echo. "# (logical_block_size=4096, physical_block_size=4096, alignment_offset=0)"
257 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=4096 num_tgts=1 opt_blks=64
258 formatscip-shell shell shell-project 0.0.0 format(). 256 4096
259 formatscip-shell shell shell-project 0.0.0 format(). 256 2056 8
260 formatscip-shell shell shell-project 0.0.0 format(). 128 2048
261 formatscip-shell shell shell-project 0.0.0 format(). 128 1032 8
262 cleanupscip-shell shell shell-project 0.0.0 cleanup().
263
264 echoscip-shell system . . echo. "# Create classic 512B drive and stack dm-linear"
265 echoscip-shell system . . echo. "# (logical_block_size=512, physical_block_size=512, alignment_offset=0)"
266 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=512 num_tgts=1
267 DEV2=$DEV
268 DEV=/dev/mapper/$DEV_STACKED
269 dmsetup create $DEV_STACKED --table "0 32768 linear $DEV2 0"
270 formatscip-shell shell shell-project 0.0.0 format(). 256 4096
271 formatscip-shell shell shell-project 0.0.0 format(). 256 2056 8
272 formatscip-shell shell shell-project 0.0.0 format(). 128 2048
273 formatscip-shell shell shell-project 0.0.0 format(). 128 1032 8
274 formatscip-shell shell shell-project 0.0.0 format(). 128 8192 8192
275 cleanupscip-shell shell shell-project 0.0.0 cleanup().
276
277 echoscip-shell system . . echo. "# Create classic 512B drive and stack dm-linear (plain mode)"
278 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=512 num_tgts=1
279 DEV2=$DEV
280 DEV=/dev/mapper/$DEV_STACKED
281 dmsetup create $DEV_STACKED --table "0 32768 linear $DEV2 0"
282 format_plainscip-shell shell shell-project 0.0.0 format_plain(). 512
283 format_plainscip-shell shell shell-project 0.0.0 format_plain(). 1024
284 format_plainscip-shell shell shell-project 0.0.0 format_plain(). 2048
285 format_plainscip-shell shell shell-project 0.0.0 format_plain(). 4096
286 format_plain_failscip-shell shell shell-project 0.0.0 format_plain_fail(). 1111
287 format_plain_failscip-shell shell shell-project 0.0.0 format_plain_fail(). 8192
288 echoscip-shell system . . echo. "# Create classic 512B drive, unaligned to 4096 and stack dm-linear (plain mode)"
289 dmsetup remove --retry $DEV_STACKED >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
290 dmsetup create $DEV_STACKED --table "0 32762 linear $DEV2 0"
291 format_plainscip-shell shell shell-project 0.0.0 format_plain(). 512
292 format_plainscip-shell shell shell-project 0.0.0 format_plain(). 1024
293 format_plain_failscip-shell shell shell-project 0.0.0 format_plain_fail(). 2048
294 format_plain_failscip-shell shell shell-project 0.0.0 format_plain_fail(). 4096
295 cleanupscip-shell shell shell-project 0.0.0 cleanup().
296
297 # skip tests using empty passphrase (LUKS1 cipher_null)
298 if ! fips_modescip-shell shell shell-project 0.0.0 fips_mode().; then
299 echoscip-shell system . . echo. "# Offset check: 512B sector drive"
300 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=512 num_tgts=1
301 # |k| expO reqO expected slot offsets
302 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 2048 0 8:136:264:392:520:648:776:904
303 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 1032 1
304 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 1032 8
305 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 1152 128
306 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 2048 2048
307 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 4096 0 8:264:520:776:1032:1288:1544:1800
308 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 2056 1
309 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 2056 8
310 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 2176 128
311 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 4096 2048
312 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4096 0 8:512:1016:1520:2024:2528:3032:3536
313 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4040 1
314 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4040 8
315 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4096 128
316 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4096 2048
317 cleanupscip-shell shell shell-project 0.0.0 cleanup().
318
319 echoscip-shell system . . echo. "# Offset check: 4096B sector drive"
320 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=16 sector_size=4096 num_tgts=1 opt_blks=64
321 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 2048 0 8:136:264:392:520:648:776:904
322 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 1032 1
323 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 1032 8
324 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 1152 128
325 format_nullscip-shell shell shell-project 0.0.0 format_null(). 128 2048 2048
326 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 4096 0 8:264:520:776:1032:1288:1544:1800
327 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 2056 1
328 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 2056 8
329 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 2176 128
330 format_nullscip-shell shell shell-project 0.0.0 format_null(). 256 4096 2048
331 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4096 0 8:512:1016:1520:2024:2528:3032:3536
332 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4040 1
333 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4040 8
334 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4096 128
335 format_nullscip-shell shell shell-project 0.0.0 format_null(). 512 4096 2048
336 cleanupscip-shell shell shell-project 0.0.0 cleanup().
337 fi
338
339 echoscip-shell system . . echo. "# Create enterprise-class 4K drive with fs and LUKS images."
340 # loop device here presents 512 block but images have 4k block
341 # cryptsetup should properly use 4k block on direct-io
342 add_devicescip-shell shell shell-project 0.0.0 add_device(). dev_size_mb=32 sector_size=4096 physblk_exp=0 num_tgts=1 opt_blks=64
343 for file in $(lsscip-shell system . . ls. img_fs_*.img.xz) ; do
344 echoscip-shell system . . echo. -n "Format using fs image $file "
345 xzscip-shell system . . xz. -d -c $file | ddscip-shell system . . dd. of=$DEV bs=1M 2>/dev/nullscip-shell filesystem . . `/dev/null`. || failscip-shell shell shell-project 0.0.0 fail(). "bad image"
346 [scip-shell system . . `[`. ! -d $MNT_DIR ] && mkdirscip-shell system . . mkdir. $MNT_DIR
347 mountscip-shell system . . mount. $DEV $MNT_DIR 2>/dev/nullscip-shell filesystem . . `/dev/null`.
348 if [scip-shell system . . `[`. $? -ne 0 ] ; then
349 echoscip-shell system . . echo. "[N/A]"
350 continue
351 fi
352 echoscip-shell system . . echo. $PWD1 | $CRYPTSETUP luksFormat --type luks1 --key-size 256 $FAST_PBKDF $MNT_DIR/luks.img || failscip-shell shell shell-project 0.0.0 fail().
353 echoscip-shell system . . echo. $PWD2 | $CRYPTSETUP luksFormat --type luks1 --key-size 256 $FAST_PBKDF $MNT_DIR/luks.img --header $MNT_DIR/luks_header.img || failscip-shell shell shell-project 0.0.0 fail().
354 umountscip-shell system . . umount. $MNT_DIR || failscip-shell shell shell-project 0.0.0 fail().
355 echoscip-shell system . . echo. "[OK]"
356 done
357 cleanupscip-shell shell shell-project 0.0.0 cleanup().
358
359 exit 0