coreboot-kgpe-d16/src/security
Julius Werner 23a82e87ee security/tpm: Fix compile-time elimination for SEPARATE_VERSTAGE
CB:35077 pulled TPM measurement code into the bootblock, with the catch
that we'll only cache PCR extensions and not actually write them to the
TPM until it gets initialized in a later stage. The goal of this was to
keep the heavy TPM driver code out of the size-constrained bootblock.

Unfortunately, a small mistake in the tspi_tpm_is_setup() function
prevents the compiler from eliminating references to the TPM driver
code in the bootblock on platforms with CONFIG_VBOOT and
CONFIG_SEPARATE_VERSTAGE. In those cases vboot_logic_executed() is known
at compile-time to be 0, but that still makes the final expression
`return 0 || tpm_is_setup;`. We know that tpm_is_setup can never be set
to 1 in the bootblock, but the compiler doesn't.

This patch rewrites the logic slightly to achieve the same effect in a
way that the compiler can follow (because we only really need to check
tpm_is_setup in the stage that actually runs the vboot code).

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Idc25acf1e6c02d929639e83d529cc14af80e0870
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39993
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Bill XIE <persmule@hardenedlinux.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-04-01 21:25:47 +00:00
..
intel src (minus soc and mainboard): Remove copyright notices 2020-03-17 18:26:34 +00:00
memory src (minus soc and mainboard): Remove copyright notices 2020-03-17 18:26:34 +00:00
tpm security/tpm: Fix compile-time elimination for SEPARATE_VERSTAGE 2020-04-01 21:25:47 +00:00
vboot security/vboot: relocate and rename vboot_platform_is_resuming() 2020-03-31 10:38:07 +00:00
Kconfig src (minus soc and mainboard): Remove copyright notices 2020-03-17 18:26:34 +00:00
Makefile.inc security/intel: Add TXT infrastructure 2019-09-02 04:52:04 +00:00