diff mbox series

[v6,02/20] libstb/secureboot: OS Secure Boot is enabled only if FW secureboot is enabled

Message ID 20200916162131.22478-3-erichte@linux.ibm.com
State Accepted
Headers show
Series Add initial secure variable storage and backend drivers | expand


Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d362ae4f4c521a7faffb1befe2fbba467f2c4d18)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Eric Richter Sept. 16, 2020, 4:21 p.m. UTC
From: Nayna Jain <nayna@linux.ibm.com>

OS Secure Boot establishes a chain of trust from firmware to the OS.
However, OS Secure Boot can only be secure if the chain of trust
beneath it - from hardware to firmware - has been established by
Firmware Secure Boot. This patch ensures that OS Secure Boot is enabled
only if Firmware Secure Boot is enabled.

Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Signed-off-by: Eric Richter <erichte@linux.ibm.com>
 core/init.c         | 2 +-
 libstb/secureboot.c | 5 +++++
 libstb/secureboot.h | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/core/init.c b/core/init.c
index bff4e968..7ad563e0 100644
--- a/core/init.c
+++ b/core/init.c
@@ -1260,7 +1260,7 @@  void __noreturn __nomcount main_cpu_entry(const void *fdt)
 	/* Secure variables init, handled by platform */
-	if (platform.secvar_init)
+	if (platform.secvar_init && is_fw_secureboot())
diff --git a/libstb/secureboot.c b/libstb/secureboot.c
index 60324809..f8cce285 100644
--- a/libstb/secureboot.c
+++ b/libstb/secureboot.c
@@ -62,6 +62,11 @@  bool secureboot_is_compatible(struct dt_node *node, int *version, const char **c
 	return false;
+bool is_fw_secureboot(void)
+	return secure_mode;
 void secureboot_init(void)
 	struct dt_node *node;
diff --git a/libstb/secureboot.h b/libstb/secureboot.h
index 721b28de..74e93c84 100644
--- a/libstb/secureboot.h
+++ b/libstb/secureboot.h
@@ -18,6 +18,7 @@  enum secureboot_version {
 void secureboot_enforce(void);
 bool secureboot_is_compatible(struct dt_node *node, int *version, const char **compat);
 void secureboot_init(void);
+bool is_fw_secureboot(void);
  * secureboot_verify - verify a PNOR partition content