Commit 875eb1b9 authored by Gary Ching-Pang Lin's avatar Gary Ching-Pang Lin Committed by Peter Jones

Simplify the checking of SB and DB states

MokSBState and MokDBState are just 1 byte variables, so a UINT8
local variable is sufficient to include the content.
Signed-off-by: default avatarGary Ching-Pang Lin <glin@suse.com>

Conflicts:
	shim.c
parent 9ea3d9b4
......@@ -1609,16 +1609,15 @@ static EFI_STATUS check_mok_sb (void)
{
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
EFI_STATUS status = EFI_SUCCESS;
UINT8 *MokSBState = NULL;
UINTN MokSBStateSize = 0;
UINT8 MokSBState;
UINTN MokSBStateSize = sizeof(MokSBState);
UINT32 attributes;
user_insecure_mode = 0;
ignore_db = 0;
status = get_variable_attr(L"MokSBState", &MokSBState, &MokSBStateSize,
shim_lock_guid, &attributes);
status = uefi_call_wrapper(RT->GetVariable, 5, L"MokSBState", &shim_lock_guid,
&attributes, &MokSBStateSize, &MokSBState);
if (status != EFI_SUCCESS)
return EFI_ACCESS_DENIED;
......@@ -1633,13 +1632,11 @@ static EFI_STATUS check_mok_sb (void)
}
status = EFI_ACCESS_DENIED;
} else {
if (*(UINT8 *)MokSBState == 1) {
if (MokSBState == 1) {
user_insecure_mode = 1;
}
}
FreePool(MokSBState);
return status;
}
......@@ -1651,13 +1648,12 @@ static EFI_STATUS check_mok_db (void)
{
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
EFI_STATUS status = EFI_SUCCESS;
UINT8 *MokDBState = NULL;
UINTN MokDBStateSize = 0;
UINT8 MokDBState;
UINTN MokDBStateSize = sizeof(MokDBStateSize);
UINT32 attributes;
status = get_variable_attr(L"MokDBState", &MokDBState, &MokDBStateSize,
shim_lock_guid, &attributes);
status = uefi_call_wrapper(RT->GetVariable, 5, L"MokDBState", &shim_lock_guid,
&attributes, &MokDBStateSize, &MokDBState);
if (status != EFI_SUCCESS)
return EFI_ACCESS_DENIED;
......@@ -1674,13 +1670,11 @@ static EFI_STATUS check_mok_db (void)
}
status = EFI_ACCESS_DENIED;
} else {
if (*(UINT8 *)MokDBState == 1) {
if (MokDBState == 1) {
ignore_db = 1;
}
}
FreePool(MokDBState);
return status;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment