|
|
4210fa |
From d95b24bd02cf41cca9adebd95f10609d6424d2b3 Mon Sep 17 00:00:00 2001
|
|
|
4210fa |
From: Matthew Garrett <matthew.garrett@nebula.com>
|
|
|
4210fa |
Date: Tue, 19 Nov 2013 10:09:13 -0500
|
|
|
4210fa |
Subject: [PATCH 10/74] Clarify meaning of insecure_mode
|
|
|
4210fa |
|
|
|
4210fa |
insecure_mode was intended to indicate that the user had explicity disabled
|
|
|
4210fa |
checks with mokutil, which means it wasn't the opposite of secure_mode().
|
|
|
4210fa |
Change the names to clarify this and don't show the insecure mode message
|
|
|
4210fa |
unless the user has explicitly enabled that mode.
|
|
|
4210fa |
|
|
|
4210fa |
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
|
|
|
4210fa |
---
|
|
|
4210fa |
replacements.c | 6 ------
|
|
|
4210fa |
shim.c | 12 ++++++------
|
|
|
4210fa |
2 files changed, 6 insertions(+), 12 deletions(-)
|
|
|
4210fa |
|
|
|
4210fa |
diff --git a/replacements.c b/replacements.c
|
|
|
4210fa |
index bac5e5d..5ea5c32 100644
|
|
|
4210fa |
--- a/replacements.c
|
|
|
4210fa |
+++ b/replacements.c
|
|
|
4210fa |
@@ -64,13 +64,9 @@ static typeof(systab->BootServices->StartImage) system_start_image;
|
|
|
4210fa |
static typeof(systab->BootServices->Exit) system_exit;
|
|
|
4210fa |
static typeof(systab->BootServices->ExitBootServices) system_exit_boot_services;
|
|
|
4210fa |
|
|
|
4210fa |
-extern UINT8 insecure_mode;
|
|
|
4210fa |
-
|
|
|
4210fa |
void
|
|
|
4210fa |
unhook_system_services(void)
|
|
|
4210fa |
{
|
|
|
4210fa |
- if (insecure_mode)
|
|
|
4210fa |
- return;
|
|
|
4210fa |
systab->BootServices->Exit = system_exit;
|
|
|
4210fa |
systab->BootServices->StartImage = system_start_image;
|
|
|
4210fa |
systab->BootServices->ExitBootServices = system_exit_boot_services;
|
|
|
4210fa |
@@ -123,8 +119,6 @@ exit(EFI_HANDLE ImageHandle, EFI_STATUS ExitStatus,
|
|
|
4210fa |
void
|
|
|
4210fa |
hook_system_services(EFI_SYSTEM_TABLE *local_systab)
|
|
|
4210fa |
{
|
|
|
4210fa |
- if (insecure_mode)
|
|
|
4210fa |
- return;
|
|
|
4210fa |
systab = local_systab;
|
|
|
4210fa |
|
|
|
4210fa |
/* We need to hook various calls to make this work... */
|
|
|
4210fa |
diff --git a/shim.c b/shim.c
|
|
|
4210fa |
index 9ae1936..524f5fc 100644
|
|
|
4210fa |
--- a/shim.c
|
|
|
4210fa |
+++ b/shim.c
|
|
|
4210fa |
@@ -85,7 +85,7 @@ int loader_is_participating;
|
|
|
4210fa |
|
|
|
4210fa |
#define EFI_IMAGE_SECURITY_DATABASE_GUID { 0xd719b2cb, 0x3d3a, 0x4596, { 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f }}
|
|
|
4210fa |
|
|
|
4210fa |
-UINT8 insecure_mode;
|
|
|
4210fa |
+UINT8 user_insecure_mode;
|
|
|
4210fa |
UINT8 ignore_db;
|
|
|
4210fa |
|
|
|
4210fa |
typedef enum {
|
|
|
4210fa |
@@ -456,7 +456,7 @@ static BOOLEAN secure_mode (void)
|
|
|
4210fa |
UINT8 *Data;
|
|
|
4210fa |
UINT8 sb, setupmode;
|
|
|
4210fa |
|
|
|
4210fa |
- if (insecure_mode)
|
|
|
4210fa |
+ if (user_insecure_mode)
|
|
|
4210fa |
return FALSE;
|
|
|
4210fa |
|
|
|
4210fa |
status = get_variable(L"SecureBoot", &Data, &len, global_var);
|
|
|
4210fa |
@@ -1534,7 +1534,7 @@ static EFI_STATUS check_mok_sb (void)
|
|
|
4210fa |
UINTN MokSBStateSize = 0;
|
|
|
4210fa |
UINT32 attributes;
|
|
|
4210fa |
|
|
|
4210fa |
- insecure_mode = 0;
|
|
|
4210fa |
+ user_insecure_mode = 0;
|
|
|
4210fa |
ignore_db = 0;
|
|
|
4210fa |
|
|
|
4210fa |
status = get_variable_attr(L"MokSBState", &MokSBState, &MokSBStateSize,
|
|
|
4210fa |
@@ -1555,7 +1555,7 @@ static EFI_STATUS check_mok_sb (void)
|
|
|
4210fa |
status = EFI_ACCESS_DENIED;
|
|
|
4210fa |
} else {
|
|
|
4210fa |
if (*(UINT8 *)MokSBState == 1) {
|
|
|
4210fa |
- insecure_mode = 1;
|
|
|
4210fa |
+ user_insecure_mode = 1;
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1753,10 +1753,10 @@ EFI_STATUS efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *passed_systab)
|
|
|
4210fa |
/*
|
|
|
4210fa |
* Tell the user that we're in insecure mode if necessary
|
|
|
4210fa |
*/
|
|
|
4210fa |
- if (!secure_mode()) {
|
|
|
4210fa |
+ if (user_insecure_mode) {
|
|
|
4210fa |
Print(L"Booting in insecure mode\n");
|
|
|
4210fa |
uefi_call_wrapper(BS->Stall, 1, 2000000);
|
|
|
4210fa |
- } else {
|
|
|
4210fa |
+ } else if (secure_mode()) {
|
|
|
4210fa |
/*
|
|
|
4210fa |
* Install our hooks for ExitBootServices() and StartImage()
|
|
|
4210fa |
*/
|
|
|
4210fa |
--
|
|
|
4210fa |
1.9.3
|
|
|
4210fa |
|