Imported Upstream version 2.6.1
[platform/upstream/cryptsetup.git] / tests / generators / generate-luks2-invalid-checksum-hdr0.img.sh
1 #!/bin/bash
2
3 . lib.sh
4
5 #
6 # *** Description ***
7 #
8 # generate header with bad checksum in primary binary header
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         write_checksum $CHKS0 $TGT_IMG
18 }
19
20 function check()
21 {
22         lib_hdr0_checksum || exit 2
23 }
24
25 lib_prepare $@
26 generate
27 check
28 lib_cleanup