mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-06-29 06:28:13 +00:00
Optimization for secure boot process.
This commit is contained in:
@@ -145,66 +145,6 @@ STATIC EFI_STATUS ParseCmdline(IN EFI_HANDLE ImageHandle)
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined (MDE_CPU_X64)
|
||||
|
||||
STATIC BOOLEAN EFIAPI IsSecureBootEnabled(VOID)
|
||||
{
|
||||
UINT8 SecureBoot = 0;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DataSize = sizeof(SecureBoot);
|
||||
Status = gST->RuntimeServices->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL,
|
||||
&DataSize, &SecureBoot);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return SecureBoot ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
STATIC BOOLEAN EFIAPI IsSetupMode(VOID)
|
||||
{
|
||||
UINT8 SetupMode = 0;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DataSize = sizeof(SetupMode);
|
||||
Status = gST->RuntimeServices->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL,
|
||||
&DataSize, &SetupMode);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return SetupMode ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
||||
STATIC BOOLEAN EFIAPI CheckVtoyShim(VOID)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID Guid = VTOY_SHIM_POLICY_GUID;
|
||||
VOID *Prot = NULL;
|
||||
|
||||
/* If secure boot is not enabled or in SetupMode, nothing needed */
|
||||
if (!IsSecureBootEnabled() || IsSetupMode())
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol(&Guid, NULL, (VOID**)&Prot);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
gST->ConOut->OutputString(gST->ConOut, L"Can not locate Vtoy Shim\r\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
EFI_STATUS EFIAPI VtoyUtilEfiMain
|
||||
(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
@@ -214,15 +154,6 @@ EFI_STATUS EFIAPI VtoyUtilEfiMain
|
||||
UINTN i;
|
||||
UINTN Len;
|
||||
|
||||
#if defined (MDE_CPU_X64)
|
||||
/* check that Ventoy Shim must exist */
|
||||
if (!CheckVtoyShim())
|
||||
{
|
||||
gBS->Stall(5 * 1000000);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
#endif
|
||||
|
||||
ParseCmdline(ImageHandle);
|
||||
|
||||
for (i = 0; gCurFeature && i < ARRAY_SIZE(gFeatureList); i++)
|
||||
|
||||
Reference in New Issue
Block a user