Skip to content

Precomputation

Daniel Neus edited this page Jul 8, 2015 · 3 revisions

General

Replace 'sdX' in the following commands with the device where you have installed TrustedGRUB2

PCR 8 (First sector of TrustedGRUB2 kernel, i.e. diskboot.img)

First compute SHA1 hash of the diskboot.img. It's the first sector after the MBR, i.e. sector 2:

dd if=/dev/sdX bs=512 skip=1 count=1 | sha1sum

PCR8 is then:

PCR8 = sha1sum( 0000000000000000000000000000000000000000 || SHA1 from command above )

For example this command chain could be used to calculate this:

echo -n 000000000000000000000000000000000000000076cd3a3f9d64bdf528054aae025b36b9235d99be | xxd -r -p | sha1sum -b | awk '{print $1}'

PCR 9 (TrustedGRUB2 kernel, i.e. core.img)

First you should determine the size of your core.img. This size is contained in the diskboot.img.

dd if=/dev/sdX bs=1 skip=1020 count=2 | hexdump -d

After this, replace the number of sectors of the core.img in the following command and measure the core.img:

dd if=/dev/sdX bs=512 skip=2 count=NumberOfSectorsCoreIMG | sha1sum

Finally compute PCR9. As explained above for PCR 8.