aboutsummaryrefslogtreecommitdiff
path: root/src/security/vboot/vboot_common.c
diff options
context:
space:
mode:
authorSridhar Siricilla <sridhar.siricilla@intel.com>2020-04-20 18:45:22 +0530
committerPatrick Georgi <pgeorgi@google.com>2020-05-04 09:46:58 +0000
commit89ac87a976e2ace9a3637c99209adec492566d30 (patch)
treed408a6635a828e5c4cc2c787265c54cfa2651ba7 /src/security/vboot/vboot_common.c
parent7f9c064263811700329812e16828b5b97cf916e5 (diff)
security/vboot: Limit vboot verification code access to only verstage
Make vboot verification code accessible in only verstage. Vboot verification code in vboot_logic.c is being used in verstage. Due to support function vboot_save_data(), so core functionality in vboot_logic.c is made available in romstage. The patch decouples the support function frm vboot_logic.c to limit itself to verstage. BUG=b:155544643 TEST=Verified on hatch Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.com> Change-Id: Id1ede45c4dffe90afcef210eabaa657cf92a9335 Reviewed-on: https://review.coreboot.org/c/coreboot/+/40562 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Diffstat (limited to 'src/security/vboot/vboot_common.c')
-rw-r--r--src/security/vboot/vboot_common.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/security/vboot/vboot_common.c b/src/security/vboot/vboot_common.c
index 36cd1ade4e..049b4a9558 100644
--- a/src/security/vboot/vboot_common.c
+++ b/src/security/vboot/vboot_common.c
@@ -12,6 +12,31 @@
#include <security/vboot/vbnv.h>
#include <vb2_api.h>
+#include "antirollback.h"
+
+void vboot_save_data(struct vb2_context *ctx)
+{
+ if (ctx->flags & VB2_CONTEXT_SECDATA_FIRMWARE_CHANGED &&
+ (CONFIG(VBOOT_MOCK_SECDATA) || tlcl_lib_init() == VB2_SUCCESS)) {
+ printk(BIOS_INFO, "Saving secdata firmware\n");
+ antirollback_write_space_firmware(ctx);
+ ctx->flags &= ~VB2_CONTEXT_SECDATA_FIRMWARE_CHANGED;
+ }
+
+ if (ctx->flags & VB2_CONTEXT_SECDATA_KERNEL_CHANGED &&
+ (CONFIG(VBOOT_MOCK_SECDATA) || tlcl_lib_init() == VB2_SUCCESS)) {
+ printk(BIOS_INFO, "Saving secdata kernel\n");
+ antirollback_write_space_kernel(ctx);
+ ctx->flags &= ~VB2_CONTEXT_SECDATA_KERNEL_CHANGED;
+ }
+
+ if (ctx->flags & VB2_CONTEXT_NVDATA_CHANGED) {
+ printk(BIOS_INFO, "Saving nvdata\n");
+ save_vbnv(ctx->nvdata);
+ ctx->flags &= ~VB2_CONTEXT_NVDATA_CHANGED;
+ }
+}
+
/* Check if it is okay to enable USB Device Controller (UDC). */
int vboot_can_enable_udc(void)
{