tpm_event_log.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =============
  3. TPM Event Log
  4. =============
  5. This document briefly describes what TPM log is and how it is handed
  6. over from the preboot firmware to the operating system.
  7. Introduction
  8. ============
  9. The preboot firmware maintains an event log that gets new entries every
  10. time something gets hashed by it to any of the PCR registers. The events
  11. are segregated by their type and contain the value of the hashed PCR
  12. register. Typically, the preboot firmware will hash the components to
  13. who execution is to be handed over or actions relevant to the boot
  14. process.
  15. The main application for this is remote attestation and the reason why
  16. it is useful is nicely put in the very first section of [1]:
  17. "Attestation is used to provide information about the platform’s state
  18. to a challenger. However, PCR contents are difficult to interpret;
  19. therefore, attestation is typically more useful when the PCR contents
  20. are accompanied by a measurement log. While not trusted on their own,
  21. the measurement log contains a richer set of information than do the PCR
  22. contents. The PCR contents are used to provide the validation of the
  23. measurement log."
  24. UEFI event log
  25. ==============
  26. UEFI provided event log has a few somewhat weird quirks.
  27. Before calling ExitBootServices() Linux EFI stub copies the event log to
  28. a custom configuration table defined by the stub itself. Unfortunately,
  29. the events generated by ExitBootServices() don't end up in the table.
  30. The firmware provides so called final events configuration table to sort
  31. out this issue. Events gets mirrored to this table after the first time
  32. EFI_TCG2_PROTOCOL.GetEventLog() gets called.
  33. This introduces another problem: nothing guarantees that it is not called
  34. before the Linux EFI stub gets to run. Thus, it needs to calculate and save the
  35. final events table size while the stub is still running to the custom
  36. configuration table so that the TPM driver can later on skip these events when
  37. concatenating two halves of the event log from the custom configuration table
  38. and the final events table.
  39. References
  40. ==========
  41. - [1] https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/
  42. - [2] The final concatenation is done in drivers/char/tpm/eventlog/efi.c