Imported Upstream version 2.6.1
[platform/upstream/cryptsetup.git] / tests / generators / generate-luks2-invalid-checksum-both-hdrs.img.sh
1 #!/bin/bash
2
3 . lib.sh
4
5 #
6 # *** Description ***
7 #
8 # generate header with bad checksum in both binary headerer
9 #
10
11 # $1 full target dir
12 # $2 full source luks2 image
13
14 function generate()
15 {
16         CHKS0=$(echo "Arbitrary chosen string: D'oh!" | calc_sha256_checksum_stdin)
17         CHKS1=$(echo "D'oh!: arbitrary chosen string" | calc_sha256_checksum_stdin)
18         write_checksum $CHKS0 $TGT_IMG
19         write_checksum $CHKS1 $TMPDIR/hdr1
20         write_luks2_bin_hdr1 $TMPDIR/hdr1 $TGT_IMG
21 }
22
23 function check()
24 {
25         lib_hdr0_checksum || exit 2
26         lib_hdr1_checksum || exit 2
27 }
28
29 lib_prepare $@
30 generate
31 check
32 lib_cleanup