[SLOF] [PATCH 0/3] vTPM: Measure the bootloader

Stefan Berger stefanb at linux.vnet.ibm.com
Fri Mar 27 07:20:51 AEDT 2020


This series of patches adds support for measuring the booloader read from
a GPT partition. Since the boot loader is read into a buffer much bigger
(0x700000 bytes) than the original file, we need a way to determine the
original file size of the boot loader, which is assumed to be an ELF file.
We do this by extending libelf with a function that allows us to determine
the ELF file's original file size by walking the ELF headers and looking
for the farthest offset. In the normal case this will result in the same
hash calcualted as if one does for example 'sha256sum grub'. However, it
could lead to a different measurement if the user intentionately appended
bytes to the file, which are not referenced by any ELF section.

Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>

Stefan Berger (3):
  elf: Implement elf_get_file_size to determine size of an ELF image
  tcgbios: Implement tpm_hash_log_extend_event_file
  tcgbios: Measure the bootloader file read from disk

 include/byteorder.h            | 14 +++++++
 include/helpers.h              |  2 +
 include/libelf.h               |  4 ++
 lib/libelf/elf.c               | 28 +++++++++++++
 lib/libelf/elf32.c             | 75 ++++++++++++++++++++++++++++++++++
 lib/libelf/elf64.c             | 63 ++++++++++++++++++++++++++++
 lib/libtpm/tcgbios.c           | 35 ++++++++++++++++
 lib/libtpm/tcgbios.h           |  4 ++
 lib/libtpm/tpm.code            | 19 +++++++++
 lib/libtpm/tpm.in              |  1 +
 slof/fs/packages/disk-label.fs | 19 ++++++++-
 11 files changed, 263 insertions(+), 1 deletion(-)

-- 
2.24.1



More information about the SLOF mailing list