Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 =============
0004 TPM Event Log
0005 =============
0006 
0007 This document briefly describes what TPM log is and how it is handed
0008 over from the preboot firmware to the operating system.
0009 
0010 Introduction
0011 ============
0012 
0013 The preboot firmware maintains an event log that gets new entries every
0014 time something gets hashed by it to any of the PCR registers. The events
0015 are segregated by their type and contain the value of the hashed PCR
0016 register. Typically, the preboot firmware will hash the components to
0017 who execution is to be handed over or actions relevant to the boot
0018 process.
0019 
0020 The main application for this is remote attestation and the reason why
0021 it is useful is nicely put in the very first section of [1]:
0022 
0023 "Attestation is used to provide information about the platform’s state
0024 to a challenger. However, PCR contents are difficult to interpret;
0025 therefore, attestation is typically more useful when the PCR contents
0026 are accompanied by a measurement log. While not trusted on their own,
0027 the measurement log contains a richer set of information than do the PCR
0028 contents. The PCR contents are used to provide the validation of the
0029 measurement log."
0030 
0031 UEFI event log
0032 ==============
0033 
0034 UEFI provided event log has a few somewhat weird quirks.
0035 
0036 Before calling ExitBootServices() Linux EFI stub copies the event log to
0037 a custom configuration table defined by the stub itself. Unfortunately,
0038 the events generated by ExitBootServices() don't end up in the table.
0039 
0040 The firmware provides so called final events configuration table to sort
0041 out this issue. Events gets mirrored to this table after the first time
0042 EFI_TCG2_PROTOCOL.GetEventLog() gets called.
0043 
0044 This introduces another problem: nothing guarantees that it is not called
0045 before the Linux EFI stub gets to run. Thus, it needs to calculate and save the
0046 final events table size while the stub is still running to the custom
0047 configuration table so that the TPM driver can later on skip these events when
0048 concatenating two halves of the event log from the custom configuration table
0049 and the final events table.
0050 
0051 References
0052 ==========
0053 
0054 - [1] https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/
0055 - [2] The final concatenation is done in drivers/char/tpm/eventlog/efi.c