mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-10 04:24:32 +00:00
Clean up checks for MokManager entry
Add a helper function and tidy up the calls for getting into MokManager
This commit is contained in:
parent
59f2e0a289
commit
4e3721a0b5
28
shim.c
28
shim.c
@ -1035,32 +1035,30 @@ done:
|
|||||||
return efi_status;
|
return efi_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS check_mok_request(EFI_HANDLE image_handle)
|
static BOOLEAN check_var(CHAR16 *varname)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS efi_status;
|
||||||
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
EFI_GUID shim_lock_guid = SHIM_LOCK_GUID;
|
||||||
EFI_STATUS moknew_status, moksb_status, mokpw_status, efi_status;
|
|
||||||
UINTN size = sizeof(UINT32);
|
UINTN size = sizeof(UINT32);
|
||||||
UINT32 MokVar;
|
UINT32 MokVar;
|
||||||
UINT32 attributes;
|
UINT32 attributes;
|
||||||
|
|
||||||
moknew_status = uefi_call_wrapper(RT->GetVariable, 5, L"MokNew",
|
efi_status = uefi_call_wrapper(RT->GetVariable, 5, varname,
|
||||||
&shim_lock_guid, &attributes,
|
&shim_lock_guid, &attributes,
|
||||||
&size, (void *)&MokVar);
|
&size, (void *)&MokVar);
|
||||||
|
|
||||||
moksb_status = uefi_call_wrapper(RT->GetVariable, 5, L"MokSB",
|
if (efi_status == EFI_SUCCESS || efi_status == EFI_BUFFER_TOO_SMALL)
|
||||||
&shim_lock_guid, &attributes,
|
return TRUE;
|
||||||
&size, (void *)&MokVar);
|
|
||||||
|
|
||||||
mokpw_status = uefi_call_wrapper(RT->GetVariable, 5, L"MokPW",
|
return FALSE;
|
||||||
&shim_lock_guid, &attributes,
|
}
|
||||||
&size, (void *)&MokVar);
|
|
||||||
|
|
||||||
if (moknew_status == EFI_SUCCESS ||
|
EFI_STATUS check_mok_request(EFI_HANDLE image_handle)
|
||||||
moknew_status == EFI_BUFFER_TOO_SMALL ||
|
{
|
||||||
moksb_status == EFI_SUCCESS ||
|
EFI_STATUS efi_status;
|
||||||
moksb_status == EFI_BUFFER_TOO_SMALL ||
|
|
||||||
mokpw_status == EFI_SUCCESS ||
|
if (check_var(L"MokNew") || check_var(L"MokSB") ||
|
||||||
mokpw_status == EFI_BUFFER_TOO_SMALL) {
|
check_var(L"MokPW") || check_var(L"MokAuth")) {
|
||||||
efi_status = start_image(image_handle, MOK_MANAGER);
|
efi_status = start_image(image_handle, MOK_MANAGER);
|
||||||
|
|
||||||
if (efi_status != EFI_SUCCESS) {
|
if (efi_status != EFI_SUCCESS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user