blob: 05c439e9ac6a39b1a5e903e2a841baa1e11ef379 [file] [log] [blame]
Eddie Jamesfb1c10e2023-10-24 10:43:52 -05001.. SPDX-License-Identifier: GPL-2.0+
2
3Measured Boot
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +02004=============
Eddie Jamesfb1c10e2023-10-24 10:43:52 -05005
6U-Boot can perform a measured boot, the process of hashing various components
7of the boot process, extending the results in the TPM and logging the
8component's measurement in memory for the operating system to consume.
9
Ilias Apalodimasd29e89f2024-06-14 15:14:03 +030010The functionality is available when booting via the EFI subsystem or 'bootm'
11command.
12
13UEFI measured boot
14------------------
15
16The EFI subsystem implements the `EFI TCG protocol
17<https://trustedcomputinggroup.org/resource/tcg-efi-protocol-specification/>`_
18and the `TCG PC Client Specific Platform Firmware Profile Specification
19<https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/>`_
20which defines the binaries to be measured and the corresponding PCRs to be used.
21
22Requirements
23~~~~~~~~~~~~
24
25* A hardware TPM 2.0 supported by an enabled U-Boot driver
26* CONFIG_EFI_TCG2_PROTOCOL=y
27* CONFIG_EFI_TCG2_PROTOCOL_EVENTLOG_SIZE=y
28* optional CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB=y will measure the loaded DTB
29 in PCR 1
30
31Legacy measured boot
32--------------------
33
34The commands booti, bootm, and bootz can be used for measured boot
35using the legacy entry point of the Linux kernel.
36
Eddie Jamesfb1c10e2023-10-24 10:43:52 -050037By default, U-Boot will measure the operating system (linux) image, the
38initrd image, and the "bootargs" environment variable. By enabling
Ilias Apalodimasd29e89f2024-06-14 15:14:03 +030039CONFIG_MEASURE_DEVICETREE, U-Boot will also measure the devicetree image in PCR1.
Eddie Jamesfb1c10e2023-10-24 10:43:52 -050040
41The operating system typically would verify that the hashes found in the
42TPM PCRs match the contents of the event log. This can further be checked
43against the hash results of previous boots.
44
45Requirements
Ilias Apalodimasd29e89f2024-06-14 15:14:03 +030046~~~~~~~~~~~~
Eddie Jamesfb1c10e2023-10-24 10:43:52 -050047
Ilias Apalodimasd29e89f2024-06-14 15:14:03 +030048* A hardware TPM 2.0 supported by an enabled U-Boot driver
49* CONFIG_TPMv2=y
Eddie Jamesfb1c10e2023-10-24 10:43:52 -050050* CONFIG_MEASURED_BOOT=y
51* Device-tree configuration of the TPM device to specify the memory area
52 for event logging. The TPM device node must either contain a phandle to
53 a reserved memory region or "linux,sml-base" and "linux,sml-size"
54 indicating the address and size of the memory region. An example can be
55 found in arch/sandbox/dts/test.dts
56* The operating system must also be configured to use the memory regions
57 specified in the U-Boot device-tree in order to make use of the event
58 log.