|
|
4210fa |
From e5f161147de6bea68e09f33bc294c6ab644d9a78 Mon Sep 17 00:00:00 2001
|
|
|
4210fa |
From: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
4210fa |
Date: Thu, 31 Oct 2013 17:32:13 +0800
|
|
|
4210fa |
Subject: [PATCH 42/74] Simplify the checking of SB and DB states
|
|
|
4210fa |
|
|
|
4210fa |
MokSBState and MokDBState are just 1 byte variables, so a UINT8
|
|
|
4210fa |
local variable is sufficient to include the content.
|
|
|
4210fa |
|
|
|
4210fa |
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
4210fa |
|
|
|
4210fa |
Conflicts:
|
|
|
4210fa |
shim.c
|
|
|
4210fa |
---
|
|
|
4210fa |
shim.c | 26 ++++++++++----------------
|
|
|
4210fa |
1 file changed, 10 insertions(+), 16 deletions(-)
|
|
|
4210fa |
|
|
|
4210fa |
diff --git a/shim.c b/shim.c
|
|
|
4210fa |
index fe73ec1..ea8eba8 100644
|
|
|
4210fa |
--- a/shim.c
|
|
|
4210fa |
+++ b/shim.c
|
|
|
4210fa |
@@ -1609,16 +1609,15 @@ static EFI_STATUS check_mok_sb (void)
|
|
|
4210fa |
{
|
|
|
4210fa |
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
|
|
4210fa |
EFI_STATUS status = EFI_SUCCESS;
|
|
|
4210fa |
- UINT8 *MokSBState = NULL;
|
|
|
4210fa |
- UINTN MokSBStateSize = 0;
|
|
|
4210fa |
+ UINT8 MokSBState;
|
|
|
4210fa |
+ UINTN MokSBStateSize = sizeof(MokSBState);
|
|
|
4210fa |
UINT32 attributes;
|
|
|
4210fa |
|
|
|
4210fa |
user_insecure_mode = 0;
|
|
|
4210fa |
ignore_db = 0;
|
|
|
4210fa |
|
|
|
4210fa |
- status = get_variable_attr(L"MokSBState", &MokSBState, &MokSBStateSize,
|
|
|
4210fa |
- shim_lock_guid, &attributes);
|
|
|
4210fa |
-
|
|
|
4210fa |
+ status = uefi_call_wrapper(RT->GetVariable, 5, L"MokSBState", &shim_lock_guid,
|
|
|
4210fa |
+ &attributes, &MokSBStateSize, &MokSBState);
|
|
|
4210fa |
if (status != EFI_SUCCESS)
|
|
|
4210fa |
return EFI_ACCESS_DENIED;
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1633,13 +1632,11 @@ static EFI_STATUS check_mok_sb (void)
|
|
|
4210fa |
}
|
|
|
4210fa |
status = EFI_ACCESS_DENIED;
|
|
|
4210fa |
} else {
|
|
|
4210fa |
- if (*(UINT8 *)MokSBState == 1) {
|
|
|
4210fa |
+ if (MokSBState == 1) {
|
|
|
4210fa |
user_insecure_mode = 1;
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
- FreePool(MokSBState);
|
|
|
4210fa |
-
|
|
|
4210fa |
return status;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1651,13 +1648,12 @@ static EFI_STATUS check_mok_db (void)
|
|
|
4210fa |
{
|
|
|
4210fa |
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
|
|
4210fa |
EFI_STATUS status = EFI_SUCCESS;
|
|
|
4210fa |
- UINT8 *MokDBState = NULL;
|
|
|
4210fa |
- UINTN MokDBStateSize = 0;
|
|
|
4210fa |
+ UINT8 MokDBState;
|
|
|
4210fa |
+ UINTN MokDBStateSize = sizeof(MokDBStateSize);
|
|
|
4210fa |
UINT32 attributes;
|
|
|
4210fa |
|
|
|
4210fa |
- status = get_variable_attr(L"MokDBState", &MokDBState, &MokDBStateSize,
|
|
|
4210fa |
- shim_lock_guid, &attributes);
|
|
|
4210fa |
-
|
|
|
4210fa |
+ status = uefi_call_wrapper(RT->GetVariable, 5, L"MokDBState", &shim_lock_guid,
|
|
|
4210fa |
+ &attributes, &MokDBStateSize, &MokDBState);
|
|
|
4210fa |
if (status != EFI_SUCCESS)
|
|
|
4210fa |
return EFI_ACCESS_DENIED;
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1674,13 +1670,11 @@ static EFI_STATUS check_mok_db (void)
|
|
|
4210fa |
}
|
|
|
4210fa |
status = EFI_ACCESS_DENIED;
|
|
|
4210fa |
} else {
|
|
|
4210fa |
- if (*(UINT8 *)MokDBState == 1) {
|
|
|
4210fa |
+ if (MokDBState == 1) {
|
|
|
4210fa |
ignore_db = 1;
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
- FreePool(MokDBState);
|
|
|
4210fa |
-
|
|
|
4210fa |
return status;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
--
|
|
|
4210fa |
1.9.3
|
|
|
4210fa |
|