mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-09 01:11:32 +00:00
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: Gary Ching-Pang Lin <glin@suse.com> Conflicts: shim.c
This commit is contained in:
parent
eb4cb6a509
commit
e5f161147d
26
shim.c
26
shim.c
@ -1609,16 +1609,15 @@ static EFI_STATUS check_mok_sb (void)
|
|||||||
{
|
{
|
||||||
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
||||||
EFI_STATUS status = EFI_SUCCESS;
|
EFI_STATUS status = EFI_SUCCESS;
|
||||||
UINT8 *MokSBState = NULL;
|
UINT8 MokSBState;
|
||||||
UINTN MokSBStateSize = 0;
|
UINTN MokSBStateSize = sizeof(MokSBState);
|
||||||
UINT32 attributes;
|
UINT32 attributes;
|
||||||
|
|
||||||
user_insecure_mode = 0;
|
user_insecure_mode = 0;
|
||||||
ignore_db = 0;
|
ignore_db = 0;
|
||||||
|
|
||||||
status = get_variable_attr(L"MokSBState", &MokSBState, &MokSBStateSize,
|
status = uefi_call_wrapper(RT->GetVariable, 5, L"MokSBState", &shim_lock_guid,
|
||||||
shim_lock_guid, &attributes);
|
&attributes, &MokSBStateSize, &MokSBState);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
|
|
||||||
@ -1633,13 +1632,11 @@ static EFI_STATUS check_mok_sb (void)
|
|||||||
}
|
}
|
||||||
status = EFI_ACCESS_DENIED;
|
status = EFI_ACCESS_DENIED;
|
||||||
} else {
|
} else {
|
||||||
if (*(UINT8 *)MokSBState == 1) {
|
if (MokSBState == 1) {
|
||||||
user_insecure_mode = 1;
|
user_insecure_mode = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool(MokSBState);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1651,13 +1648,12 @@ static EFI_STATUS check_mok_db (void)
|
|||||||
{
|
{
|
||||||
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
||||||
EFI_STATUS status = EFI_SUCCESS;
|
EFI_STATUS status = EFI_SUCCESS;
|
||||||
UINT8 *MokDBState = NULL;
|
UINT8 MokDBState;
|
||||||
UINTN MokDBStateSize = 0;
|
UINTN MokDBStateSize = sizeof(MokDBStateSize);
|
||||||
UINT32 attributes;
|
UINT32 attributes;
|
||||||
|
|
||||||
status = get_variable_attr(L"MokDBState", &MokDBState, &MokDBStateSize,
|
status = uefi_call_wrapper(RT->GetVariable, 5, L"MokDBState", &shim_lock_guid,
|
||||||
shim_lock_guid, &attributes);
|
&attributes, &MokDBStateSize, &MokDBState);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
|
|
||||||
@ -1674,13 +1670,11 @@ static EFI_STATUS check_mok_db (void)
|
|||||||
}
|
}
|
||||||
status = EFI_ACCESS_DENIED;
|
status = EFI_ACCESS_DENIED;
|
||||||
} else {
|
} else {
|
||||||
if (*(UINT8 *)MokDBState == 1) {
|
if (MokDBState == 1) {
|
||||||
ignore_db = 1;
|
ignore_db = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool(MokDBState);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user