Amol N Sukerkar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32149
Change subject: src/lib: Disable display init skip when VBOOT Stage Verification is enabled
......................................................................
src/lib: Disable display init skip when VBOOT Stage Verification is enabled
When VBOOT is enabled, by default it native display init is skipped
and custom display init mechanism is utilized. VBOOT Stage
Verification utilizes native display init. This change implements
that feature.
TEST=Create a coreboot.rom image by enabling CONFIG_VBOOT and
CONFIG_VBOOT_STAGE_VERIFICATION. Verify that the image boots
to authenticated payload and graphics is displayed via HDMI
and Display Port.
Change-Id: I65a96ec74f7b494d0c16814d84067e004ceebe70
Signed-off-by: Sukerkar, Amol N <amol.n.sukerkar(a)intel.com>
---
M src/lib/bootmode.c
1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/32149/1
diff --git a/src/lib/bootmode.c b/src/lib/bootmode.c
index e402536..2cf9bd0 100644
--- a/src/lib/bootmode.c
+++ b/src/lib/bootmode.c
@@ -2,6 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,8 +35,12 @@
int display_init_required(void)
{
- /* For Chrome OS always honor vboot_handoff_skip_display_init(). */
- if (CONFIG(CHROMEOS))
+ /* For Chrome OS always honor vboot_handoff_skip_display_init().
+ * A special case is when CONFIG_VBOOT_STAGE_VERIFICATION is
+ * enabled. In that case, vboot_handoff_skip_display_init()
+ * is overridden native display init mechanism. */
+ if (IS_ENABLED(CONFIG_CHROMEOS) &&
+ !IS_ENABLED(CONFIG_VBOOT_STAGE_VERIFICATION))
return !vboot_handoff_skip_display_init();
/* By default always initialize display. */
--
To view, visit https://review.coreboot.org/c/coreboot/+/32149
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I65a96ec74f7b494d0c16814d84067e004ceebe70
Gerrit-Change-Number: 32149
Gerrit-PatchSet: 1
Gerrit-Owner: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-MessageType: newchange
Amol N Sukerkar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32150
Change subject: src/include/cbfs.h: Added prototype for function to verify a stage after it has been loaded into DRAM
......................................................................
src/include/cbfs.h: Added prototype for function to verify a stage after it has been loaded into DRAM
This support enables a user to implement a stage verification mechanism
AFTER the stage has been loaded into DRAM. This feature is currently
used by VBOOT_STAGE_VERIFICATION
TEST=Create a coreboot.rom image which has keyblock and VBLOCK
with VBOOT version 2.1 structures. This is done by enabling
CONFIG_VBOOT_STAGE_VERIFICATION. Verify that the image boots
to authenticated payload.
Change-Id: I8702f00186db568316e04ffb87fd1439a27bdb6e
Signed-off-by: Sukerkar, Amol N <amol.n.sukerkar(a)intel.com>
---
M src/include/cbfs.h
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/32150/1
diff --git a/src/include/cbfs.h b/src/include/cbfs.h
index 85e25b3..d24fe58 100644
--- a/src/include/cbfs.h
+++ b/src/include/cbfs.h
@@ -2,6 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright 2015 Google Inc.
+ * Copyright 2019 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -90,4 +91,9 @@
int (*locate)(struct cbfs_props *props);
};
+/* This function can be used to implement any secure boot mechanism to
+ * verify the stage AFTER it is loaded into DRAM */
+void verify_stage_if_required(const struct region_device *rdev);
+
#endif
+
--
To view, visit https://review.coreboot.org/c/coreboot/+/32150
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I8702f00186db568316e04ffb87fd1439a27bdb6e
Gerrit-Change-Number: 32150
Gerrit-PatchSet: 1
Gerrit-Owner: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-MessageType: newchange
Amol N Sukerkar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32151
Change subject: src/lib: Implemented function calls to verify a stage after it has been loaded into DRAM
......................................................................
src/lib: Implemented function calls to verify a stage after it has been loaded into DRAM
This support enables a user to implement a stage verification mechanism
AFTER the stage has been loaded into DRAM. This feature is currently
used by VBOOT_STAGE_VERIFICATION
TEST=Create a coreboot.rom image which has keyblock and VBLOCK
with VBOOT version 2.1 structures. This is done by enabling
CONFIG_VBOOT_STAGE_VERIFICATION. Verify that the image boots
to authenticated payload.
Change-Id: I649f511bc5375448dd7625b57a680135395d1062
Signed-off-by: Sukerkar, Amol N <amol.n.sukerkar(a)intel.com>
---
M src/lib/Kconfig
M src/lib/cbfs.c
M src/lib/selfboot.c
3 files changed, 59 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/32151/1
diff --git a/src/lib/Kconfig b/src/lib/Kconfig
index 2f10c1c..8111f8d 100644
--- a/src/lib/Kconfig
+++ b/src/lib/Kconfig
@@ -30,6 +30,13 @@
Selected by features that require to parse and manipulate a flattened
devicetree in ramstage.
+config VERIFY_ONLY_PAYLOAD_IN_RAMSTAGE
+ bool "Verify only payload in ramstage"
+ default n
+ help
+ Selected by features that require verified boot but when only payload
+ is verified in ramstage.
+
if RAMSTAGE_LIBHWBASE
config HWBASE_DYNAMIC_MMIO
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 728674f..9da0fae 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2011 secunet Security Networks AG
* Copyright 2015 Google Inc.
+ * Copyright 2019 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +37,28 @@
#define DEBUG(x...)
#endif
+/* This is marked as weak so some verification mechanism can
+ * use it to verify after loading into DRAM. Primarily
+ * overriden by VBOOT mechanism.
+ */
+void __weak verify_stage_if_required(const struct region_device *rdev)
+{
+ /* no op */
+}
+
+/* This function checks if a certain stage/binary meets the criteria
+ * to be verified AFTER it is loaded into DRAM
+ */
+static int cbfs_verification_meets_criteria(void)
+{
+ /* if this is true, it means we are verifying nothing here
+ * that is loaded in RAMSTAGE */
+ if (IS_ENABLED(CONFIG_VERIFY_ONLY_PAYLOAD_IN_RAMSTAGE))
+ return !ENV_RAMSTAGE;
+ else
+ return 0;
+}
+
int cbfs_boot_locate(struct cbfsf *fh, const char *name, uint32_t *type)
{
struct region_device rdev;
@@ -109,6 +132,11 @@
return 0;
if (rdev_readat(rdev, buffer, offset, in_size) != in_size)
return 0;
+
+ /* If the stage/binary loaded in DRAM requires verification
+ * proceed if it meets the required criteria */
+ if (cbfs_verification_meets_criteria())
+ verify_stage_if_required(rdev);
return in_size;
case CBFS_COMPRESS_LZ4:
@@ -127,6 +155,12 @@
timestamp_add_now(TS_START_ULZ4F);
out_size = ulz4fn(compr_start, in_size, buffer, buffer_size);
timestamp_add_now(TS_END_ULZ4F);
+
+ /* If the stage/binary loaded in DRAM requires verification
+ * proceed if it meets the required criteria */
+ if (cbfs_verification_meets_criteria())
+ verify_stage_if_required(rdev);
+
return out_size;
case CBFS_COMPRESS_LZMA:
@@ -149,6 +183,11 @@
rdev_munmap(rdev, map);
+ /* If the stage/binary loaded in DRAM requires verification
+ * proceed if it meets the required criteria */
+ if (cbfs_verification_meets_criteria())
+ verify_stage_if_required(rdev);
+
return out_size;
default:
diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c
index 9aa4741..3d438e8 100644
--- a/src/lib/selfboot.c
+++ b/src/lib/selfboot.c
@@ -4,6 +4,7 @@
* Copyright (C) 2003 Eric W. Biederman <ebiederm(a)xmission.com>
* Copyright (C) 2009 Ron Minnich <rminnich(a)gmail.com>
* Copyright (C) 2016 George Trudeau <george.trudeau(a)usherbrooke.ca>
+ * Copyright (C) 2019 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +33,15 @@
/* The type syntax for C is essentially unparsable. -- Rob Pike */
typedef int (*checker_t)(struct cbfs_payload_segment *cbfssegs, void *args);
+/* This is marked as weak so some verification mechanism can
+ * use it to verify after loading into DRAM. Primarily
+ * overriden by VBOOT mechanism.
+ */
+void __weak verify_stage_if_required(const struct region_device *rdev)
+{
+ /* no op */
+}
+
/* Decode a serialized cbfs payload segment
* from memory into native endianness.
*/
@@ -269,6 +279,9 @@
rdev_munmap(prog_rdev(payload), data);
+ /* verify payload using a secure boot mechanism if required */
+ verify_stage_if_required(prog_rdev(payload));
+
/* Pass cbtables to payload if architecture desires it. */
prog_set_entry(payload, (void *)entry, cbmem_find(CBMEM_ID_CBTABLE));
--
To view, visit https://review.coreboot.org/c/coreboot/+/32151
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I649f511bc5375448dd7625b57a680135395d1062
Gerrit-Change-Number: 32151
Gerrit-PatchSet: 1
Gerrit-Owner: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-MessageType: newchange
Amol N Sukerkar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32152
Change subject: src/security/vboot: Changed the logic to verify a stage after it has been loaded into DRAM
......................................................................
src/security/vboot: Changed the logic to verify a stage after it has been loaded into DRAM
This feature enables VBOOT_STAGE_VERIFICATION logic to make use of
function prototype made available by Coreboot to verify a stage after
it has been loaded into DRAM
TEST=Create a coreboot.rom image which has keyblock and VBLOCK
with VBOOT version 2.1 structures. This is done by enabling
CONFIG_VBOOT_STAGE_VERIFICATION. Verify that the image boots
to authenticated payload.
Change-Id: I0381299f97d0b59969e2d6c6b4df4e4cc3e39f69
Signed-off-by: Sukerkar, Amol N <amol.n.sukerkar(a)intel.com>
---
M src/security/vboot/vboot_loader.c
M src/security/vboot/vboot_logic_ex.c
2 files changed, 25 insertions(+), 55 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/32152/1
diff --git a/src/security/vboot/vboot_loader.c b/src/security/vboot/vboot_loader.c
index e09a314..b71178e 100644
--- a/src/security/vboot/vboot_loader.c
+++ b/src/security/vboot/vboot_loader.c
@@ -61,16 +61,6 @@
return 0;
}
-/* This is the helper function that decides when the stage verification
- * code should be called. */
-static int stage_verification_should_run(void)
-{
- if (IS_ENABLED(CONFIG_VBOOT_STAGE_VERIFICATION))
- return ENV_POSTCAR | ENV_RAMSTAGE;
-
- return 0;
-}
-
static int vboot_executed CAR_GLOBAL;
int vboot_logic_executed(void)
@@ -97,11 +87,9 @@
static void vboot_prepare(void)
{
- if (verification_should_run() ||
- stage_verification_should_run()) {
+ if (verification_should_run()) {
/* Note: this path is not used for VBOOT_RETURN_FROM_VERSTAGE */
verstage_main();
-
car_set_var(vboot_executed, 1);
vboot_save_recovery_reason_vbnv();
} else if (verstage_should_load()) {
diff --git a/src/security/vboot/vboot_logic_ex.c b/src/security/vboot/vboot_logic_ex.c
index 7a735a9..1b526c7 100644
--- a/src/security/vboot/vboot_logic_ex.c
+++ b/src/security/vboot/vboot_logic_ex.c
@@ -238,55 +238,28 @@
}
/* Veify the stage to be executed */
-static void verify_stage(void)
+static void verify_stage(const struct region_device *rdev)
{
struct vb2_context ctx;
struct region_device fw_main;
int rv;
- const struct region_device *fh = NULL;
size_t fsize = 0;
void *map = NULL;
- struct cbfsf file;
const struct vb2_id* id;
- /* For each stage to be verified, extract map and
- * hashing algo */
- if (ENV_POSTCAR) {
- printk(BIOS_INFO, "Verify ramstage\n");
+ /* get region memory map */
+ fsize = region_device_sz(rdev);
+ map = rdev_mmap(rdev, 0, fsize);
+ if (!map) die("ERROR: Stage Mapping failed");
+
+ /* get the hash id */
+ if (ENV_POSTCAR)
id = vb2_hash_id(VB2_HASH_SHA256);
- struct prog stage = PROG_INIT(PROG_RAMSTAGE,
- CONFIG_CBFS_PREFIX "/ramstage");
+ else if (ENV_RAMSTAGE)
+ id = vb2_hash_id(VB2_HASH_SHA512);
+ else
+ die("Invalid hash id");
- /* load stage */
- if (cbfs_boot_locate(&file, prog_name(&stage), NULL))
- die("failed to load stage");
-
- cbfs_file_data(prog_rdev(&stage), &file);
- fh = &stage.rdev;
-
- fsize = region_device_sz(fh);
- map = rdev_mmap(fh, 0, fsize);
- if (!map) printk(BIOS_INFO, "ERROR: Mapping failed\n");
- } else if (ENV_RAMSTAGE) {
- printk(BIOS_INFO, "Verify payload\n");
- id = vb2_hash_id(VB2_HASH_SHA512);
- struct prog stage = PROG_INIT(PROG_PAYLOAD,
- CONFIG_CBFS_PREFIX "/payload");
-
- /* load stage */
- if (cbfs_boot_locate(&file, prog_name(&stage), NULL))
- die("failed to load stage");
-
- cbfs_file_data(prog_rdev(&stage), &file);
- fh = &stage.rdev;
-
- fsize = region_device_sz(fh);
- map = rdev_mmap(fh, 0, fsize);
- if (!map) printk(BIOS_INFO, "ERROR: Mapping failed\n");
- } else
- die("Impossible");
-
- //get_stage_attr(&map, &id);
/* initialize the vb context and read the NV data */
init_ctx(&ctx);
@@ -310,17 +283,26 @@
die("Stage Verification Failed");
}
- rdev_munmap(fh, map);
+ rdev_munmap(rdev, map);
printk(BIOS_INFO, "stage verified successfully, proceed...\n");
}
+/* stage verification if required */
+void verify_stage_if_required(const struct region_device *rdev)
+{
+ if (!rdev) {
+ die("Invalid region device");
+ } else {
+ if (ENV_POSTCAR || ENV_RAMSTAGE)
+ verify_stage(rdev);
+ }
+}
+
/* Main Entry Point for Stage Verification */
void verstage_main(void)
{
if (ENV_VERSTAGE)
init_ctx_verstage();
- else if (ENV_POSTCAR || ENV_RAMSTAGE)
- verify_stage();
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/32152
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0381299f97d0b59969e2d6c6b4df4e4cc3e39f69
Gerrit-Change-Number: 32152
Gerrit-PatchSet: 1
Gerrit-Owner: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-MessageType: newchange
Amol N Sukerkar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32153
Change subject: src/security/vboot: When VBOOT Stage Verification is enabled, boot ROMSTAGE and POSTCAR from Read-Only region.
......................................................................
src/security/vboot: When VBOOT Stage Verification is enabled,
boot ROMSTAGE and POSTCAR from Read-Only region.
When VBOOT Stage Verification is enabled, the root-of-trust is the
Read-Only image. So, move the ROMSTAGE and POSTCAR is Read-Only
region. POSTCAR triggers VBOOT Stage Authentication starting with
RAMSTAGE. RAMSTAGE authenticates PAYLOAD.
TEST=Create a coreboot.rom image by enabling CONFIG_VBOOT and
CONFIG_VBOOT_STAGE_VERIFICATION. Verify that the image boots
to authenticated payload and graphics is displayed via HDMI
and Display Port.
Change-Id: I6d4b7dbea62a92ca75d731c84b7c1402a207634a
Signed-off-by: Sukerkar, Amol N <amol.n.sukerkar(a)intel.com>
---
M src/security/vboot/Makefile.inc
M src/security/vboot/vboot_loader.c
2 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/53/32153/1
diff --git a/src/security/vboot/Makefile.inc b/src/security/vboot/Makefile.inc
index a65b066..1a6ca9f 100644
--- a/src/security/vboot/Makefile.inc
+++ b/src/security/vboot/Makefile.inc
@@ -211,6 +211,10 @@
$(if $(filter \
$(if $(filter y,$(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)),, \
%/romstage) \
+ $(if $(filter y,$(CONFIG_VBOOT_STAGE_VERIFICATION)), \
+ %/romstage, ) \
+ $(if $(filter y,$(CONFIG_VBOOT_STAGE_VERIFICATION)), \
+ %/postcar, ) \
mts \
%/verstage \
locales \
diff --git a/src/security/vboot/vboot_loader.c b/src/security/vboot/vboot_loader.c
index b71178e..36f2a07 100644
--- a/src/security/vboot/vboot_loader.c
+++ b/src/security/vboot/vboot_loader.c
@@ -37,6 +37,16 @@
CONFIG(VBOOT_SEPARATE_VERSTAGE),
"return from verstage only makes sense for separate verstages");
+/* This helper decides if stage verification logic needs to be
+ * initiated or not. */
+static int stage_verification_should_run(void)
+{
+ if (CONFIG(VBOOT_STAGE_VERIFICATION))
+ return ENV_POSTCAR | ENV_RAMSTAGE;
+
+ return 0;
+}
+
/* The stage loading code is compiled and entered from multiple stages. The
* helper functions below attempt to provide more clarity on when certain
* code should be called. */
@@ -141,6 +151,11 @@
if (!vboot_logic_executed())
return -1;
+ /* Do not initiate VBOOT Stage Verification until all the
+ * stages from RO region are loaded */
+ if (!stage_verification_should_run())
+ return -1;
+
if (vboot_get_selected_region(&selected_region))
return -1;
--
To view, visit https://review.coreboot.org/c/coreboot/+/32153
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6d4b7dbea62a92ca75d731c84b7c1402a207634a
Gerrit-Change-Number: 32153
Gerrit-PatchSet: 1
Gerrit-Owner: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
Amol N Sukerkar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32159
Change subject: Documentation/security/vboot: Add logic to verify stage/blob using VBOOT 2.1 library
......................................................................
Documentation/security/vboot: Add logic to verify stage/blob using
VBOOT 2.1 library
Added documentation to explain the logic that makes use of VBOOT 2.1 library to
verify Coreboot stages/blobs.
Signed-off-by: Sukerkar, Amol N <amol.n.sukerkar(a)intel.com>
Change-Id: I1eb174bb4f4d84eb8f6befdce18421b6b85ccc02
---
M Documentation/security/index.md
A Documentation/security/vboot/flash_partition.png
A Documentation/security/vboot/vboot_21_logic.png
A Documentation/security/vboot/vboot_flow_20.png
A Documentation/security/vboot/vboot_flow_21.png
A Documentation/security/vboot/verified_boot_21.md
6 files changed, 115 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/32159/1
diff --git a/Documentation/security/index.md b/Documentation/security/index.md
index 89db42e..aebfc82 100644
--- a/Documentation/security/index.md
+++ b/Documentation/security/index.md
@@ -5,3 +5,4 @@
## Vendor
- [Measured Boot](vboot/measured_boot.md)
+- [Verified Boot with VBOOT 2.1](vboot/verified_boot_21.md)
diff --git a/Documentation/security/vboot/flash_partition.png b/Documentation/security/vboot/flash_partition.png
new file mode 100644
index 0000000..91e459b
--- /dev/null
+++ b/Documentation/security/vboot/flash_partition.png
Binary files differ
diff --git a/Documentation/security/vboot/vboot_21_logic.png b/Documentation/security/vboot/vboot_21_logic.png
new file mode 100644
index 0000000..d32e99e
--- /dev/null
+++ b/Documentation/security/vboot/vboot_21_logic.png
Binary files differ
diff --git a/Documentation/security/vboot/vboot_flow_20.png b/Documentation/security/vboot/vboot_flow_20.png
new file mode 100644
index 0000000..fce4c5d
--- /dev/null
+++ b/Documentation/security/vboot/vboot_flow_20.png
Binary files differ
diff --git a/Documentation/security/vboot/vboot_flow_21.png b/Documentation/security/vboot/vboot_flow_21.png
new file mode 100644
index 0000000..24859fe
--- /dev/null
+++ b/Documentation/security/vboot/vboot_flow_21.png
Binary files differ
diff --git a/Documentation/security/vboot/verified_boot_21.md b/Documentation/security/vboot/verified_boot_21.md
new file mode 100644
index 0000000..15253b3
--- /dev/null
+++ b/Documentation/security/vboot/verified_boot_21.md
@@ -0,0 +1,114 @@
+# Enabling Intel BootGuard Support in Coreboot
+
+## Introduction
+
+One of the primary and key requirement for Intel customers is to enable Secure
+Boot in their platform where root of trust resides in the hardware and is
+immutable. While the obvious choice when it comes to hardware root of trust is
+Intel Bootguard for IA platforms, the mechanism that extends the chain
+of trust from hardware to bootloader, to payload/OS loader and eventually to the
+OS is currently not implemented in Coreboot mainly due to licensing constraints.
+This document describes the mechanism implemented in Coreboot using Google VBOOT
+libraries version 2.1 that makes use of Intel BootGuard technology as Root of
+Trust and extends the chain of trust to Coreboot which in turn extends it to the
+payload. Note: UEFI payload will use secure boot mechanism to verify and launch
+OS but that is beyond the scope of this document and will not be covered here.
+More details about VBOOT support in Coreboot are available at
+https://www.coreboot.org/git-docs/Intel/vboot.html.
+
+
+## Intel BootGuard Technology
+
+Intel BootGuard is a platform boot integrity
+protection technology. It allows initial stage of bootloader to be verified (and
+measured in TPM) by a piece of firmware (ACM) which itself is verified by Intel
+CPU microcode. A high level summary of the steps required to enable Intel
+BootGuard are: 1. Use Intel FSP-T with Coreboot bootloader. It contains the
+logic of correctly handling BtGuard enabled state. 2. Integrate ACM
+(Authenticated Code module) binary in bootloader image. 3. Generate BtGuard Key
+Manifest(BtG KM) and BtGuard Boot PolicyManifest(BtG BPM) and embed them in
+bootloader image. a. BtG KM contains the hash of the key used for signing BtG
+BPM. BtG KM is signed by the key whose hash is embedded in field-programmable
+fuses. b. BtG BPM contains the hash of initial stage of boot loader. It also
+stores other policies related to Intel TXT, BtG DMA protection etc. 4. Add
+entries for CPU microcode patch, ACM, BtG KM and BtG BPM in FIT table. 5.
+Update BootGuard related field-programmable fuses on the test platform.
+
+
+## VBOOT in Coreboot
+
+The current implementation of VBOOT tool support and logic
+in Coreboot is at version 2.0. The architecture, design and usage of this
+feature has been described here,
+https://www.coreboot.org/git-docs/Intel/vboot.html.
+
+### VBOOT 2.0 in Coreboot (Currently available)
+
+As described in the location mentioned above, the VBOOT 2.0 verified boot logic
+flow works as follows. Upon boot, verstage attempts to verify the read-write
+section A. It gets the public root key from GBB area and verifies the VBLOCK
+area in read-write section A. If the verification is successful, then verstage
+instructs Coreboot to boot rest of the firmware in read-write section A
+(romstage, postcar, ramstage and payload). If the verification fails, then,
+VBOOT falls back on read-only area to boot.
+The flow chart below shows this flow:
+
+**VBOOT 2.0 Verification Flow in Coreboot**
+![VBOOT_20_Flow_in_Coreboot][VBOOT_Flow_20]
+
+[VBOOT_Flow_20]: vboot_flow_20.png
+
+While this design implements verified boot to a certain extent, it does not take
+into account a few use-cases and concerns some Intel customers run into. A
+couple of them are as listed below,
+- Some hardware designs cannot support ‘read-only’ flash region as Root of Trust
+ and therefore prefer Intel BootGuard technology as RoT for verified boot
+mechanism.
+- In some use-cases, some of the firmware components may come from different
+ media, for instance, customer could boot payload from USB thumb drive instead
+of SPI flash. In that case, the entire read-write section will not have all the
+firmware components. There needs to be a mechanism to verify payload along with
+other components.
+- In exisiting implementation, all the firmware components in the boot chain are
+ verified in verstage. This may result in a TOCTOU attack where right after the
+verification phase, some firmware stages/components (such as payload, FSP, etc.)
+can be swapped with malware. To extend the vboot security model, the mechanism
+described below is proposed where the root of trust Bootguard begins by
+verifying the IBB and the chain of trust is extended only to the next
+stage/component at every verification pass. For instance, once Bootguard
+verifies IBB which contains verstage, romstage and postcar), postcar then uses
+the VBOOT mechanism to verify ramstage. Once ramstage is loaded into DRAM,
+ramstage in turn will verify FSP and payload.
+
+### Proposed Changes using VBOOT2.1 Libraries
+
+The proposed changes are described as follows. Upon power on of the device,
+Intel Bootguard attempts to verify IBB. IBB in this case, replaces the read-only
+portion of the flash map and contains bootblock, verstage, romstage and postcar
+stage. If the verification is successful, Intel Bootguard launches IBB and the
+system boots until postcar stage. In postcar stage, GBB is extracted and GBB
+verified the VBLOCK. Once VBLOCK is verified, postcar stage extracts the
+ramstage hash from VBLOCK and verifies the ramstage after it has been loaded
+into DRAM. This is done to ensure maximum security. Once ramstage is verified,
+ramstage is launched. At this point, ramstage extracts the hash of FSPS, DSDT
+ACPI table and payload in that order, and verifies and launches them
+sequentially. At any point, if the verification fails, the system boot will
+halt.
+
+**Stage/Blob Verification using VBOOT2.1 Library**
+![VBOOT_Stage_Blob_Verification][VBOOT_Flow_21]
+
+[VBOOT_Flow_21]: vboot_flow_21.png
+
+### Flash Partition and Code Flow in Coreboot
+
+**Flash Partition for Verification using VBOOT 2.1 Library**
+![VBOOT_Verification_2_1_Flash][Flash_Partition]
+
+[Flash_Partition]: flash_partition.png
+
+**Verification Logic using VBOOT 2.1 Library**
+![VBOOT_Verification_2_1_Logic][vboot_21_logic]
+
+[vboot_21_logic]: vboot_21_logic.png
+
--
To view, visit https://review.coreboot.org/c/coreboot/+/32159
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I1eb174bb4f4d84eb8f6befdce18421b6b85ccc02
Gerrit-Change-Number: 32159
Gerrit-PatchSet: 1
Gerrit-Owner: Amol N Sukerkar <amol.n.sukerkar(a)intel.com>
Gerrit-MessageType: newchange