summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-05-14 12:33:46 -0700
committerAaron Durbin <adurbin@chromium.org>2021-05-18 15:30:47 +0000
commit3c79777cd62a66ede560b1069565fc42a8e0f008 (patch)
treebaf5c2c663a6cb20371cc5b9b020ee02d5a8ef7e
parent9d54a228092e627ad7f159bb21e45c468c2f9f2c (diff)
downloadcoreboot-3c79777cd62a66ede560b1069565fc42a8e0f008.tar.xz
vboot/secdata_mock: Make v0 kernel secdata context
The new kernel secdata v1 stores the last read EC hash, and reboots the device during EC software sync when that hash didn't match the currently active hash on the EC (this is used with TPM_CR50 to support EC-EFS2 and pretty much a no-op for other devices). Generally, of course the whole point of secdata is always that it persists across reboots, but with MOCK_SECDATA we can't do that. Previously we always happened to somewhat get away with presenting freshly-reinitialized data for MOCK_SECDATA on every boot, but with the EC hash feature in secdata v1, that would cause a reboot loop. The simplest solution is to just pretend we're a secdata v0 device when using MOCK_SECDATA. This was encountered on using a firmware built with MOCK_SECDATA but had EC software sync enabled. BUG=b:187843114 BRANCH=None TEST=`USE=mocktpm cros build-ap -b keeby`; Flash keeby device, verify that DUT does not continuously reboot with EC software sync enabled. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Id8e81afcddadf27d9eec274f7f85ff1520315aaa Reviewed-on: https://review.coreboot.org/c/coreboot/+/54304 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--src/security/vboot/secdata_mock.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/security/vboot/secdata_mock.c b/src/security/vboot/secdata_mock.c
index 78cb3e6063..5792b41633 100644
--- a/src/security/vboot/secdata_mock.c
+++ b/src/security/vboot/secdata_mock.c
@@ -28,7 +28,19 @@ vb2_error_t antirollback_write_space_firmware(struct vb2_context *ctx)
vb2_error_t antirollback_read_space_kernel(struct vb2_context *ctx)
{
- vb2api_secdata_kernel_create(ctx);
+ /*
+ * The new kernel secdata v1 stores the last read EC hash, and reboots the
+ * device during EC software sync when that hash didn't match the currently
+ * active hash on the EC (this is used with TPM_CR50 to support EC-EFS2 and
+ * pretty much a no-op for other devices). Generally, of course the whole
+ * point of secdata is always that it persists across reboots, but with
+ * MOCK_SECDATA we can't do that. Previously we always happened to somewhat
+ * get away with presenting freshly-reinitialized data for MOCK_SECDATA on
+ * every boot, but with the EC hash feature in secdata v1, that would cause
+ * a reboot loop. The simplest solution is to just pretend we're a secdata
+ * v0 device when using MOCK_SECDATA.
+ */
+ vb2api_secdata_kernel_create_v0(ctx);
return VB2_SUCCESS;
}