summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Setje-Eilers <jan.setjeeilers@oracle.com>2023-05-16 14:31:13 -0700
committerPeter Jones <pjones@redhat.com>2023-12-05 13:20:00 -0500
commitb078ef274887a4cc0da64fd6668800d1e24a2871 (patch)
treed0592257d603e4bd4060c418c15ecd9b5e9af00d
parentea0f9dfe8ae49ead3204be4c3166b08cc96fad7e (diff)
downloadefi-boot-shim-b078ef274887a4cc0da64fd6668800d1e24a2871.tar.gz
efi-boot-shim-b078ef274887a4cc0da64fd6668800d1e24a2871.zip
Always clear SbatLevel when Secure Boot is disabled
Unless an explict sbat policy is specified, always delete SbatLevel when secure boot is disabled. Signed-off-by: Jan Setje-Eilers <Jan.SetjeEilers@oracle.com>
-rw-r--r--sbat.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sbat.c b/sbat.c
index aebc6074..60669ba1 100644
--- a/sbat.c
+++ b/sbat.c
@@ -434,7 +434,12 @@ set_sbat_uefi_variable(char *sbat_var_previous, char *sbat_var_latest)
if (EFI_ERROR(efi_status)) {
dprint("Default sbat policy: previous\n");
- sbat_var = sbat_var_previous;
+ if (secure_mode()) {
+ sbat_var = sbat_var_previous;
+ } else {
+ reset_sbat = true;
+ sbat_var = SBAT_VAR_ORIGINAL;
+ }
} else {
switch (sbat_policy) {
case SBAT_POLICY_LATEST:
@@ -458,7 +463,12 @@ set_sbat_uefi_variable(char *sbat_var_previous, char *sbat_var_latest)
default:
console_error(L"SBAT policy state %llu is invalid",
EFI_INVALID_PARAMETER);
- sbat_var = sbat_var_previous;
+ if (secure_mode()) {
+ sbat_var = sbat_var_previous;
+ } else {
+ reset_sbat = true;
+ sbat_var = SBAT_VAR_ORIGINAL;
+ }
break;
}
}