summaryrefslogtreecommitdiffstats
path: root/tests/generators/generate-luks2-invalid-checksum-both-hdrs.img.sh
blob: 925763e7a4bcd6b41d245f8ae8abb34f7829329b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

. lib.sh

#
# *** Description ***
#
# generate header with bad checksum in both binary headerer
#

# $1 full target dir
# $2 full source luks2 image

function generate()
{
	CHKS0=$(echo "Arbitrary chosen string: D'oh!" | calc_sha256_checksum_stdin)
	CHKS1=$(echo "D'oh!: arbitrary chosen string" | calc_sha256_checksum_stdin)
	write_checksum $CHKS0 $TGT_IMG
	write_checksum $CHKS1 $TMPDIR/hdr1
	write_luks2_bin_hdr1 $TMPDIR/hdr1 $TGT_IMG
}

function check()
{
	lib_hdr0_checksum || exit 2
	lib_hdr1_checksum || exit 2
}

lib_prepare $@
generate
check
lib_cleanup