3 This code enables measured boot and verified boot support.
4 Verified boot is available in coreboot, but based on ChromeOS. This vendorcode security
5 solution is intended to be used for system without ChromeOS support.
7 This solution allows implementing verified boot support for systems that do not contain a TPM.
10 The API functions of `3rdparty/vboot/firmware` are used.
13 Measured boot support requires a TPM2 device.
15 The items specified in `mb_log_list[]` and `*_verify_list[]` will be measured.
17 The `mb_log_list[]` should only contain items that are not contained in one of the verify_lists
18 below (except for the `bootblock_verify_list[]`).
20 The list can contain the following items: `config`, `revision`, `cmos_layout.bin`.
21 `oemmanifest.bin` should be added to the list when Verified boot is enabled.
24 Verified boot support will use the OEM manifest to verify the items.
26 The verification process is controlled using the following verify lists:
27 * `bootblock_verify_list[]` (will not be measured, verified in bootblock)
28 * `romstage_verify_list[]` (verified in early romstage)
29 * `postcar_verify_list[]` (verified in just before postcar loading)
30 * `ramstage_verify_list[]` (verified in just before ramstage loading)
31 * `payload_verify_list[]` (verified in just before payload loading)
32 * `oprom_verify_list[]` (verified before option rom execution)
34 A verify_list entry contains a `related_items` member. This can point to an additional `verify_list`
35 which will be verified before the specified item is verified. As an example the `grub` entry in
36 `payload_verify_list[]` can point to the `grub_additional_list[]` that contains the items used by
37 the grub payload and the `seabios` entry in `payload_verify_list[]` can point to the
38 `seabios_additional_list[]` that contains the items used by the seabios payload. By doing this the
39 entries that are verified (and measured) depend on the payload selected at runtime.
41 ## Creating private and public keys
42 Create private key in RSA2048 format: `openssl genrsa -F4 -out <private_key_file> 2048`
44 Create public key using private key:
45 `futility --vb1 create <private_key_file> <public_key_file_without_extension>`
47 The public key will be included into coreboot and used for verified boot only.
50 To enable measured boot support:
51 * Enabled *VENDORCODE_ELTAN_MBOOT*
52 * Create `mb_log_list` table with list of items to measure
54 To enable verified boot support:
55 * Enable *VENDORCODE_ELTAN_VBOOT*
56 * Create the verify lists `*_verify_list[]`
57 * *VENDORCODE_ELTAN_VBOOT_KEY_FILE* must point to location of the public key file created with `futility`
59 ## Creating signed binary
61 During build of coreboot binary an empty `oemmanifest.bin` is added to the binary.
63 This binary must be replaced by a correct (signed) binary when *VENDORCODE_ELTAN_VBOOT* is enabled
65 The `oemmanifest.bin` file contains the SHA-256 (or SHA-512) hashes of all the different parts
66 contained in verify_lists.
68 When *VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST* is enabled the manifest should be signed and the
69 signature should appended to the manifest.
71 Please make sure the public key is in the RO part of the coreboot image. The `oemmanifest.bin` file
72 should be in the RW part of the coreboot image.
76 The `oemmanifest.bin` file contains the hashes of different binaries parts of the binary e.g.:
77 bootblock, romstage, postcar, ramstage, fsp etc.
79 The total number of items must match `VENDORCODE_ELTAN_OEM_MANIFEST_ITEMS`.
81 For every part the SHA (SHA-256) must be calculated. First extract the binary from the coreboot
82 image using: `cbfstool <coreboot_file_name> extract -n <cbfs_name> -f <item_binary_file_name>`
83 followed by: `openssl dgst -sha256 -binary -out <hash_file_name> <item_binary_file_name>`
85 Replace -sha256 with -sha512 when `VENDORCODE_ELTAN_VBOOT_USE_SHA512` is enabled.
87 All the hashes must be combined to a hash binary. The hashes need to be placed in the same order as
88 defined by the `HASH_IDX_XXX` values.
92 The oemmanifest needs to be signed when `VENDORCODE_ELTAN_VBOOT_SIGNED_MANIFEST` is enabled.
94 This can be done with the following command:
95 `openssl dgst -sign <private_key_file_name> -sha256 -out <signature_binary> <hash_binary>`
97 The signed manifest can be created by adding the signature to the manifest:
98 `cat <hash_binary> <signature_binary> >hash_table.bin`
101 The `oemmanifest.bin` file must be replaced in the coreboot binary by the generated
104 To replace the binary: Remove using:
105 `cbfstool <coreboot_file_name> remove -n oemmanifest.bin`
106 Then add the new image using:
107 `cbfstool coreboot.bin add -f <hash_table_file_name> -n oemmanifest.bin -t raw \`
108 `-b <CONFIG_VENDORCODE_ELTAN_OEM_MANIFEST_LOC>`
112 You can enable verbose console output in *menuconfig*.