mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-06-29 06:28:13 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3995a0267 | ||
|
|
ba87af540b | ||
|
|
3d0d6c3147 | ||
|
|
2915e197e9 | ||
|
|
9bf8393cdf | ||
|
|
05d10437b0 | ||
|
|
083e5f72ea | ||
|
|
2f66a309e4 | ||
|
|
aa75cdac7d | ||
|
|
ccf4f7234a | ||
|
|
c1cad99584 | ||
|
|
d9cab1cb33 | ||
|
|
18f4c8afcc | ||
|
|
aeb46cd3c8 | ||
|
|
475de1dada | ||
|
|
31648a0d4b |
@@ -37,12 +37,70 @@ else
|
||||
fi
|
||||
|
||||
if [ -e $VTEFI_PATH ]; then
|
||||
|
||||
objdump -h "$VTEFI_PATH"
|
||||
echo ""
|
||||
|
||||
objcopy \
|
||||
--add-section .sbat="MdeModulePkg/Application/VtoyShim/sbat.csv" \
|
||||
--set-section-flags .sbat=alloc,load,readonly,data \
|
||||
"$VTEFI_PATH" "$DST_PATH"
|
||||
|
||||
objcopy --adjust-section-vma .sbat=0x1000 "$DST_PATH"
|
||||
#find the right sbat section VMA
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
cnt1=$(objdump -h "$DST_PATH" | grep -P '^\s*[0-9][0-9]* \.' | wc -l)
|
||||
cnt2=$(objdump -h "$DST_PATH" | grep -P 'ALLOC' | wc -l)
|
||||
|
||||
if [ $cnt1 -ne $cnt2 ]; then
|
||||
echo "Section count mismatch $cnt1 $cnt2"
|
||||
objdump -h "$DST_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
objdump -h "$DST_PATH" | grep -P '^\s*[0-9][0-9]* \.' > $tmpfile
|
||||
sbat_size=$(stat -c '%s' MdeModulePkg/Application/VtoyShim/sbat.csv)
|
||||
sbat_size_hex=$(printf '0x%08x' $sbat_size)
|
||||
|
||||
lmax='0000000000000000'
|
||||
lsize='0000000000000000'
|
||||
while read line; do
|
||||
echo $line
|
||||
lbase=$(echo $line | awk '{print $4}')
|
||||
if expr "$lmax" \< "$lbase" > /dev/null; then
|
||||
lmax=$lbase
|
||||
lsize=$(echo $line | awk '{print $3}')
|
||||
fi
|
||||
echo "max=$lmax size=$lsize"
|
||||
done < $tmpfile
|
||||
rm -f $tmpfile
|
||||
|
||||
|
||||
lvma=$((0x${lsize}+0x${lmax}))
|
||||
lvma_align=`printf '0x%08x' $(( (lvma + 4095) / 4096 * 4096 ))`
|
||||
echo "sbat section lvma_align=$lvma_align"
|
||||
|
||||
objcopy --adjust-section-vma .sbat=$lvma_align "$DST_PATH"
|
||||
|
||||
img_base=$(objdump -p "$DST_PATH" | grep ImageBase | awk '{print $2}')
|
||||
size_img=0x$(objdump -p "$DST_PATH" | grep SizeOfImage | awk '{print $2}')
|
||||
sbat_end=`printf '0x%08x' $(($lvma_align+$sbat_size_hex))`
|
||||
|
||||
if [ "$img_base" != "0000000000000000" ]; then
|
||||
echo "#### ImageBase is not 0 $img_base"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "size_img=$size_img sbat_size=$sbat_size_hex sbat_range $lvma_align - $sbat_end"
|
||||
|
||||
if expr "$size_img" \< "$sbat_end" > /dev/null; then
|
||||
echo "SizeOfImage $size_img less than sbat section addr $sbat_end"
|
||||
exit 1
|
||||
else
|
||||
echo "SizeOfImage $size_img >= $sbat_end is OK"
|
||||
fi
|
||||
|
||||
objdump -h "$DST_PATH"
|
||||
|
||||
echo -e '\n\n====================== SUCCESS ========================\n\n'
|
||||
|
||||
|
||||
@@ -1231,32 +1231,6 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined (MDE_CPU_X64)
|
||||
STATIC BOOLEAN EFIAPI CheckVtoyShim(VOID)
|
||||
{
|
||||
UINT8 SecureBoot = 0;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID Guid = VTOY_SHIM_POLICY_GUID;
|
||||
VOID *Prot = NULL;
|
||||
|
||||
DataSize = sizeof(SecureBoot);
|
||||
Status = gST->RuntimeServices->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL,
|
||||
&DataSize, &SecureBoot);
|
||||
if (!EFI_ERROR(Status) && SecureBoot)
|
||||
{
|
||||
Status = gBS->LocateProtocol(&Guid, NULL, (VOID**)&Prot);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
VtoyDebug("Failed to locate Vtoy Shim Protocol %lx\r\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
EFI_STATUS EFIAPI VentoyEfiMain
|
||||
(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
@@ -1266,15 +1240,6 @@ EFI_STATUS EFIAPI VentoyEfiMain
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *Protocol;
|
||||
|
||||
#if defined (MDE_CPU_X64)
|
||||
/* check that Ventoy Shim must exist */
|
||||
if (!CheckVtoyShim())
|
||||
{
|
||||
sleep(5);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_sector_flag_num = 512; /* initial value */
|
||||
|
||||
g_sector_flag = AllocatePool(g_sector_flag_num * sizeof(ventoy_sector_flag));
|
||||
|
||||
@@ -34,15 +34,28 @@
|
||||
|
||||
#define CUR_SBAT_VER 1
|
||||
|
||||
STATIC EFI_GUID gVtoySbatGUID = { 0xf755068a, 0xe04f, 0x452b, { 0x9d, 0x6d, 0x7c, 0x55, 0x96, 0xb3, 0xc0, 0x7d }};
|
||||
STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDpToText = NULL;
|
||||
STATIC EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *gTextToDp = NULL;
|
||||
STATIC UINT8 gVtoyGrubSha256Hash[32] __attribute__((aligned(32))) = {
|
||||
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
|
||||
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
|
||||
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
|
||||
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26
|
||||
};
|
||||
|
||||
STATIC BOOLEAN gGrubLaunched = FALSE;
|
||||
STATIC EFI_GUID gShimLockGUID = SHIM_LOCK_GUID;
|
||||
STATIC EFI_SECURITY_FILE_AUTHENTICATION_STATE gSysSecFileAuth = NULL;
|
||||
STATIC EFI_SECURITY2_FILE_AUTHENTICATION gSysSec2FileAuth = NULL;
|
||||
STATIC BOOLEAN gVtoyByPassSB = FALSE; /* must be FALSE by default for revoke */
|
||||
STATIC VTOY_SHIM gVtoyShimProtocol;
|
||||
STATIC EFI_HANDLE gVtoyShimProtHandle;
|
||||
STATIC SHIM_LOCK *gShimLock = NULL;
|
||||
STATIC SHIM_LOCK gShimLock;
|
||||
|
||||
STATIC EFI_EXIT_BOOT_SERVICES gSysExitBootServices = NULL;
|
||||
STATIC EFI_GET_VARIABLE gSysGetVariable = NULL;
|
||||
|
||||
STATIC VOID EFIAPI HookSystemService(VOID);
|
||||
STATIC VOID EFIAPI UnHookSystemService(VOID);
|
||||
|
||||
|
||||
STATIC VOID EFIAPI VtoyLog(CONST CHAR16 *Format, ...)
|
||||
{
|
||||
@@ -66,11 +79,15 @@ STATIC VOID EFIAPI DumpDevicePath(const EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
||||
{
|
||||
CHAR16 *DPStr = NULL;
|
||||
|
||||
DPStr = gDpToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);
|
||||
if (DevicePath)
|
||||
{
|
||||
DPStr = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (DPStr)
|
||||
{
|
||||
vLog(L"%s", DPStr);
|
||||
gBS->FreePool(DPStr);
|
||||
FreePool(DPStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,31 +95,19 @@ STATIC VOID EFIAPI DumpDevicePath(const EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID EFIAPI ShowSBWarning(BOOLEAN Reboot, const EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
||||
STATIC VOID EFIAPI ShowSBWarning(const EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
||||
{
|
||||
UINTN Index = 0;
|
||||
|
||||
vLog(L"\r\n=======================================================");
|
||||
vLog(L"=======================================================\r\n");
|
||||
|
||||
DumpDevicePath(DevicePath);
|
||||
|
||||
vLog(L"\r\n####### Security Boot Violation ##########\r\n");
|
||||
vLog(L"\r\n####### Ventoy Security Boot Violation ##########\r\n");
|
||||
|
||||
vLog(L"=======================================================");
|
||||
vLog(L"=======================================================");
|
||||
|
||||
if (Reboot)
|
||||
{
|
||||
vLog(L"\r\n###### Press Enter to reboot... ######");
|
||||
gST->ConIn->Reset(gST->ConIn, FALSE);
|
||||
gBS->WaitForEvent(1, &gST->ConIn->WaitForKey, &Index);
|
||||
gRT->ResetSystem(EfiResetWarm, EFI_SECURITY_VIOLATION, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
VtoySleep(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +134,6 @@ STATIC VOID * EFIAPI FindShimFuncAddr(UINT64 FuncOffset)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS EFIAPI LaunchRealGrub(EFI_HANDLE ImageHandle, CONST CHAR16 *FileName)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -156,7 +160,7 @@ EFI_STATUS EFIAPI LaunchRealGrub(EFI_HANDLE ImageHandle, CONST CHAR16 *FileName)
|
||||
goto END;
|
||||
}
|
||||
|
||||
DevDpStr = gDpToText->ConvertDevicePathToText(DeviceDP, FALSE, TRUE);
|
||||
DevDpStr = ConvertDevicePathToText(DeviceDP, FALSE, TRUE);
|
||||
if (!DevDpStr)
|
||||
{
|
||||
vLog(L"Failed to convert device path to text");
|
||||
@@ -175,7 +179,7 @@ EFI_STATUS EFIAPI LaunchRealGrub(EFI_HANDLE ImageHandle, CONST CHAR16 *FileName)
|
||||
|
||||
UnicodeSPrint(NewDpStr, BufferSize, L"%s/EFI/BOOT/%s", DevDpStr, FileName);
|
||||
|
||||
TargetDp = gTextToDp->ConvertTextToDevicePath(NewDpStr);
|
||||
TargetDp = ConvertTextToDevicePath(NewDpStr);
|
||||
if (!TargetDp)
|
||||
{
|
||||
vLog(L"Failed to convert new text <%s> to device path", NewDpStr);
|
||||
@@ -200,152 +204,39 @@ EFI_STATUS EFIAPI LaunchRealGrub(EFI_HANDLE ImageHandle, CONST CHAR16 *FileName)
|
||||
|
||||
END:
|
||||
|
||||
CheckBSFreePool(DevDpStr);
|
||||
CheckFreePool(DevDpStr);
|
||||
CheckFreePool(NewDpStr);
|
||||
CheckBSFreePool(TargetDp);
|
||||
CheckFreePool(TargetDp);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
STATIC EFI_STATUS EFIAPI ReadAuthFile
|
||||
STATIC EFI_STATUS EFIAPI CheckVtoyGrub
|
||||
(
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePathConst,
|
||||
VOID **Buffer,
|
||||
UINT32 *Size
|
||||
VOID *FileBuffer,
|
||||
UINTN FileSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN TmpSize = 0;
|
||||
CHAR16 *DpStr = NULL;
|
||||
EFI_HANDLE Handle = NULL;
|
||||
EFI_DEVICE_PATH *DevPath = NULL;
|
||||
EFI_DEVICE_PATH *TmpPath = NULL;
|
||||
EFI_FILE_IO_INTERFACE *FileIO = NULL;
|
||||
EFI_FILE *File = NULL;
|
||||
EFI_FILE *Root = NULL;
|
||||
UINT8 *FileData = NULL;
|
||||
EFI_FILE_INFO *FInfo = NULL;
|
||||
UINT8 Buf[1024];
|
||||
UINT8 Sha256Hash[64];
|
||||
|
||||
DevPath = TmpPath = DuplicateDevicePath(DevicePathConst);
|
||||
if (!DevPath)
|
||||
if (!FileBuffer || FileSize < sizeof(EFI_IMAGE_DOS_HEADER))
|
||||
{
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto END;
|
||||
vErr(L"Invalid FileBuffer:%p or size:%ld", FileBuffer, FileSize);
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
|
||||
Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevPath, &Handle);
|
||||
if (EFI_ERROR(Status))
|
||||
ZeroMem(Sha256Hash, sizeof(Sha256Hash));
|
||||
calc_sha256(FileBuffer, (UINT64)FileSize, Sha256Hash);
|
||||
|
||||
if (CompareMem(Sha256Hash, gVtoyGrubSha256Hash, 32) != 0)
|
||||
{
|
||||
vLog(L"Failed to locate simple file protocol %lx", Status);
|
||||
goto END;
|
||||
vErr(L"Ventoy hash check failed.");
|
||||
gRT->ResetSystem(EfiResetWarm, EFI_SECURITY_VIOLATION, 0, NULL);
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
|
||||
DpStr = gDpToText->ConvertDevicePathToText(DevPath, FALSE, TRUE);
|
||||
if (!DpStr)
|
||||
{
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto END;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol(Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FileIO);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vLog(L"Failed to handle simple file protocol %lx", Status);
|
||||
goto END;
|
||||
}
|
||||
|
||||
Status = FileIO->OpenVolume(Handle, &Root);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vLog(L"Failed to open drive volume (%lx)\n", Status);
|
||||
goto END;
|
||||
}
|
||||
|
||||
Status = Root->Open(Root, &File, DpStr, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vLog(L"Failed to open file (%s) (%lx)\n", DpStr, Status);
|
||||
goto END;
|
||||
}
|
||||
|
||||
FInfo = (EFI_FILE_INFO *)Buf;
|
||||
TmpSize = sizeof(Buf);
|
||||
ZeroMem(FInfo, sizeof(EFI_FILE_INFO));
|
||||
|
||||
Status = File->GetInfo(File, &gEfiFileInfoGuid, &TmpSize, FInfo);
|
||||
if (EFI_ERROR(Status) || FInfo->FileSize == 0 || FInfo->FileSize >= 0xFFFFFFFFUL)
|
||||
{
|
||||
vLog(L"Failed to open file (%s) (%lx) Size(%ld)\n", DpStr, Status, (UINTN)FInfo->FileSize);
|
||||
goto END;
|
||||
}
|
||||
|
||||
FileData = AllocatePool(FInfo->FileSize);
|
||||
if (!FileData)
|
||||
{
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto END;
|
||||
}
|
||||
|
||||
TmpSize = FInfo->FileSize;
|
||||
Status = File->Read(File, &TmpSize, FileData);
|
||||
if (EFI_ERROR(Status) || TmpSize != (UINTN)FInfo->FileSize)
|
||||
{
|
||||
vLog(L"Failed to read file (%lx) Read:%ld Size:%ld\n", Status, TmpSize, (UINTN)FInfo->FileSize);
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
||||
END:
|
||||
|
||||
if (File)
|
||||
{
|
||||
File->Close(File);
|
||||
}
|
||||
|
||||
if (Root)
|
||||
{
|
||||
Root->Close(Root);
|
||||
}
|
||||
|
||||
CheckFreePool(TmpPath);
|
||||
CheckBSFreePool(DpStr);
|
||||
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
CheckFreePool(FileData);
|
||||
}
|
||||
else
|
||||
{
|
||||
*Buffer = FileData;
|
||||
*Size = (UINT32)FInfo->FileSize;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
STATIC BOOLEAN VtoyCheckRevoke(VOID *Buffer, UINTN Size)
|
||||
{
|
||||
UINT32 uiVer = 0;
|
||||
EFI_IMAGE_DOS_HEADER *DosHead = (EFI_IMAGE_DOS_HEADER *)Buffer;
|
||||
|
||||
if (Size > sizeof(EFI_IMAGE_DOS_HEADER))
|
||||
{
|
||||
if (CompareMem(DosHead->e_res2, &gVtoySbatGUID, 16) == 0)
|
||||
{
|
||||
CopyMem(&uiVer, DosHead->e_res2 + 8, 4);
|
||||
if (uiVer < CUR_SBAT_VER)
|
||||
{
|
||||
vLog(L"Ventoy EFI file revoke (%u < %u)", uiVer, CUR_SBAT_VER);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS EFIAPI SecurityPolicyAuth
|
||||
@@ -355,59 +246,17 @@ STATIC EFI_STATUS EFIAPI SecurityPolicyAuth
|
||||
const EFI_DEVICE_PATH_PROTOCOL *DevicePathConst
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN bRevokeChkOK = TRUE;
|
||||
UINT32 Size = 0;
|
||||
VOID *Buffer = NULL;
|
||||
|
||||
/* Just return OK if the user choose to bypass SB */
|
||||
if (gVtoyByPassSB)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 1:
|
||||
* Use original UEFI firmware auth API.
|
||||
* If it's OK, it may be signed with Microsoft UEFI CA. (e.g. bootmgr/shim/...)
|
||||
* Some old UEFI firmware (without Security2 protocol) will hang when run OpenVolume.
|
||||
* So finally I decide not to support such UEFI firmware.
|
||||
* It means that for UEFI firmware before 2.5 (about 2015) Ventoy only supports Bypass policy.
|
||||
*
|
||||
*/
|
||||
if (gSysSecFileAuth)
|
||||
{
|
||||
Status = gSysSecFileAuth(This, AuthenticationStatus, DevicePathConst);
|
||||
if (!EFI_ERROR(Status))
|
||||
{
|
||||
|
||||
(VOID)This;
|
||||
(VOID)AuthenticationStatus;
|
||||
(VOID)DevicePathConst;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Step 2:
|
||||
* Use shim verify API.
|
||||
* If it's OK, it may be signed with a MOK key. (e.g. Ventoy EFI files)
|
||||
*/
|
||||
if (gShimLock && gShimLock->Verify)
|
||||
{
|
||||
Status = ReadAuthFile(DevicePathConst, &Buffer, &Size);
|
||||
if (!EFI_ERROR(Status))
|
||||
{
|
||||
Status = gShimLock->Verify(Buffer, Size);
|
||||
if (!EFI_ERROR(Status))
|
||||
{
|
||||
bRevokeChkOK = VtoyCheckRevoke(Buffer, Size);
|
||||
if (bRevokeChkOK)
|
||||
{
|
||||
FreePool(Buffer);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
FreePool(Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
ShowSBWarning(!bRevokeChkOK, DevicePathConst);
|
||||
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS EFIAPI Security2PolicyAuth
|
||||
@@ -420,7 +269,6 @@ STATIC EFI_STATUS EFIAPI Security2PolicyAuth
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN bRevokeChkOK = TRUE;
|
||||
|
||||
/* Just return OK if the user choose to bypass SB */
|
||||
if (gVtoyByPassSB)
|
||||
@@ -428,6 +276,11 @@ STATIC EFI_STATUS EFIAPI Security2PolicyAuth
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (!gGrubLaunched)
|
||||
{
|
||||
return CheckVtoyGrub(FileBuffer, FileSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 1:
|
||||
* Use original UEFI firmware auth API.
|
||||
@@ -448,23 +301,19 @@ STATIC EFI_STATUS EFIAPI Security2PolicyAuth
|
||||
* Use shim verify API.
|
||||
* If it's OK, it may be signed with a MOK key. (e.g. Ventoy EFI files)
|
||||
*/
|
||||
if (gShimLock && gShimLock->Verify)
|
||||
if (gShimLock.Verify)
|
||||
{
|
||||
if (FileBuffer && FileSize > 0 && FileSize < 0xFFFFFFFFUL)
|
||||
{
|
||||
Status = gShimLock->Verify(FileBuffer, (UINT32)FileSize);
|
||||
Status = gShimLock.Verify(FileBuffer, (UINT32)FileSize);
|
||||
if (!EFI_ERROR(Status))
|
||||
{
|
||||
bRevokeChkOK = VtoyCheckRevoke(FileBuffer, FileSize);
|
||||
if (bRevokeChkOK)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShowSBWarning(!bRevokeChkOK, DevicePath);
|
||||
ShowSBWarning(DevicePath);
|
||||
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
@@ -522,13 +371,13 @@ STATIC VOID EFIAPI UnHookSecurityPolicy(VOID)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Security2 && gSysSec2FileAuth)
|
||||
if (Security2 && gSysSec2FileAuth && Security2->FileAuthentication == Security2PolicyAuth)
|
||||
{
|
||||
Security2->FileAuthentication = gSysSec2FileAuth;
|
||||
gSysSec2FileAuth = NULL;
|
||||
}
|
||||
|
||||
if (Security && gSysSecFileAuth)
|
||||
if (Security && gSysSecFileAuth && Security->FileAuthenticationState == SecurityPolicyAuth)
|
||||
{
|
||||
Security->FileAuthenticationState = gSysSecFileAuth;
|
||||
gSysSecFileAuth = NULL;
|
||||
@@ -545,6 +394,11 @@ STATIC VOID EFIAPI VtoyCheckSB(VOID)
|
||||
gVtoyByPassSB = FALSE;
|
||||
}
|
||||
|
||||
STATIC VOID EFIAPI VtoyLaunched(VOID)
|
||||
{
|
||||
gGrubLaunched = TRUE;
|
||||
}
|
||||
|
||||
STATIC VOID EFIAPI UnInstallVtoyShimProtocol(VOID)
|
||||
{
|
||||
EFI_GUID Guid = VTOY_SHIM_POLICY_GUID;
|
||||
@@ -564,6 +418,7 @@ STATIC EFI_STATUS EFIAPI InstallVtoyShimProtocol(VOID)
|
||||
|
||||
gVtoyShimProtocol.ByPassSB = VtoyByPassSB;
|
||||
gVtoyShimProtocol.CheckSB = VtoyCheckSB;
|
||||
gVtoyShimProtocol.Launched = VtoyLaunched;
|
||||
|
||||
Status = gBS->LocateProtocol(&Guid, NULL, (VOID**)&Prot);
|
||||
if (!EFI_ERROR(Status))
|
||||
@@ -599,63 +454,46 @@ STATIC BOOLEAN EFIAPI IsSecureBootEnabled(VOID)
|
||||
return SecureBoot ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS EFIAPI EnvInit(VOID)
|
||||
STATIC BOOLEAN EFIAPI IsSetupMode(VOID)
|
||||
{
|
||||
UINT8 SetupMode = 0;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID**)&gDpToText);
|
||||
if (EFI_ERROR(Status) || !gDpToText || !gDpToText->ConvertDevicePathToText)
|
||||
DataSize = sizeof(SetupMode);
|
||||
Status = gST->RuntimeServices->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL,
|
||||
&DataSize, &SetupMode);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vLog(L"Failed to locate PathToText Protocol %lx", Status);
|
||||
return Status;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID**)&gTextToDp);
|
||||
if (EFI_ERROR(Status) || !gTextToDp || !gTextToDp->ConvertTextToDevicePath)
|
||||
{
|
||||
vLog(L"Failed to locate PathFromText Protocol %lx", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
return SetupMode ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS EFIAPI VtoyShimEfiMain
|
||||
STATIC EFI_STATUS EFIAPI ShimEfiMain
|
||||
(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID Guid = SHIM_LOCK_GUID;
|
||||
unhook_system_services_pf Func = NULL;
|
||||
SHIM_LOCK *ShimLock = NULL;
|
||||
shim_void_func_pf Func1 = NULL;
|
||||
shim_void_func_pf Func2 = NULL;
|
||||
|
||||
Status = EnvInit();
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vErr(L"Failed to prepare env");
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* If secure boot is not enabled, nothing needed, just launch Ventoy grub */
|
||||
if (!IsSecureBootEnabled())
|
||||
{
|
||||
Status = LaunchRealGrub(ImageHandle, REAL_GRUB_FILE);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vErr(L"Failed to launch %s", REAL_GRUB_FILE);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol(&Guid, NULL, (VOID**)&gShimLock);
|
||||
if (EFI_ERROR(Status) || !gShimLock)
|
||||
/* We must be launched by shim */
|
||||
Status = gBS->LocateProtocol(&gShimLockGUID, NULL, (VOID**)&ShimLock);
|
||||
if (EFI_ERROR(Status) || !ShimLock)
|
||||
{
|
||||
vErr(L"Failed to locate SHIM LOCK Protocol %lx", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Backup shim Lock because we will remove it later */
|
||||
gShimLock.Verify = ShimLock->Verify;
|
||||
gShimLock.Hash = ShimLock->Hash;
|
||||
gShimLock.Context = ShimLock->Context;
|
||||
|
||||
Status = InstallVtoyShimProtocol();
|
||||
if (EFI_ERROR(Status))
|
||||
@@ -679,16 +517,19 @@ EFI_STATUS EFIAPI VtoyShimEfiMain
|
||||
* It may break in future versions of shim, and a better approach may exist.
|
||||
*
|
||||
*/
|
||||
Func = FindShimFuncAddr(NM_UNHOOK_SYSTEM_SERVICES_OFFSET);
|
||||
if (!Func)
|
||||
Func1 = FindShimFuncAddr(NM_UNHOOK_SYSTEM_SERVICES_OFFSET);
|
||||
Func2 = FindShimFuncAddr(NM_UNINSTALL_SHIM_PROTOCOLS_OFFSET);
|
||||
if (!Func1 || !Func2)
|
||||
{
|
||||
vErr(L"Can not find shim unhook_system_services");
|
||||
vErr(L"Can not find shim func %p %p", Func1, Func2);
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto END;
|
||||
}
|
||||
|
||||
Func(); /* call shim unhook_system_services() */
|
||||
Func1(); /* call shim unhook_system_services() */
|
||||
Func2(); /* call shim uninstall_shim_protocols() */
|
||||
|
||||
HookSystemService();
|
||||
|
||||
/* Hook the system security policy */
|
||||
Status = HookSecurityPolicy();
|
||||
@@ -698,6 +539,7 @@ EFI_STATUS EFIAPI VtoyShimEfiMain
|
||||
goto END;
|
||||
}
|
||||
|
||||
|
||||
/* Finally launch Ventoy grub */
|
||||
Status = LaunchRealGrub(ImageHandle, REAL_GRUB_FILE);
|
||||
if (EFI_ERROR(Status))
|
||||
@@ -713,6 +555,111 @@ END:
|
||||
|
||||
UnInstallVtoyShimProtocol();
|
||||
|
||||
UnHookSystemService();
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI VtoyGetVariable
|
||||
(
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes, OPTIONAL
|
||||
IN OUT UINTN *DataSize,
|
||||
OUT VOID *Data OPTIONAL
|
||||
)
|
||||
{
|
||||
BOOLEAN bChk = FALSE;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (gVtoyByPassSB && VariableName && VendorGuid && DataSize && Data && (*DataSize) > 0)
|
||||
{
|
||||
bChk = TRUE;
|
||||
}
|
||||
|
||||
Status = gSysGetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||
if (bChk && (!EFI_ERROR(Status)))
|
||||
{
|
||||
if (CompareMem(&gShimLockGUID, VendorGuid, 16) == 0 &&
|
||||
StrCmp(VariableName, L"MokSBState") == 0)
|
||||
{
|
||||
*(UINT8 *)Data = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC VOID EFIAPI UnHookSystemService(VOID)
|
||||
{
|
||||
if (gSysExitBootServices)
|
||||
{
|
||||
gBS->ExitBootServices = gSysExitBootServices;
|
||||
gSysExitBootServices = NULL;
|
||||
}
|
||||
|
||||
if (gSysGetVariable)
|
||||
{
|
||||
gST->RuntimeServices->GetVariable = gSysGetVariable;
|
||||
gSysGetVariable = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
STATIC EFI_STATUS EFIAPI VtoyExitBootServices
|
||||
(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN UINTN MapKey
|
||||
)
|
||||
{
|
||||
EFI_EXIT_BOOT_SERVICES SysExitBS;
|
||||
|
||||
/* UnHookSystemService will set gSysExitBootServices NULL */
|
||||
SysExitBS = gSysExitBootServices;
|
||||
|
||||
UnHookSecurityPolicy();
|
||||
UnInstallVtoyShimProtocol();
|
||||
UnHookSystemService();
|
||||
|
||||
return SysExitBS(ImageHandle, MapKey);
|
||||
}
|
||||
|
||||
STATIC VOID EFIAPI HookSystemService(VOID)
|
||||
{
|
||||
gSysExitBootServices = gBS->ExitBootServices;
|
||||
gBS->ExitBootServices = VtoyExitBootServices;
|
||||
|
||||
gSysGetVariable = gST->RuntimeServices->GetVariable;
|
||||
gST->RuntimeServices->GetVariable = VtoyGetVariable;
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI VtoyShimEfiMain
|
||||
(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
BOOLEAN IsSetup = FALSE;
|
||||
BOOLEAN IsSecureBoot = FALSE;
|
||||
EFI_STATUS Status;
|
||||
|
||||
IsSetup = IsSetupMode();
|
||||
IsSecureBoot = IsSecureBootEnabled();
|
||||
|
||||
if (!IsSecureBoot || IsSetup)
|
||||
{
|
||||
/* If secure boot is not enabled or in SetupMode, nothing needed, just launch Ventoy grub */
|
||||
Status = LaunchRealGrub(ImageHandle, REAL_GRUB_FILE);
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
vErr(L"Failed to launch %s", REAL_GRUB_FILE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = ShimEfiMain(ImageHandle, SystemTable);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,19 +66,21 @@ typedef struct _SHIM_IMAGE_LOADER {
|
||||
EFI_IMAGE_UNLOAD UnloadImage;
|
||||
} SHIM_IMAGE_LOADER;
|
||||
|
||||
typedef VOID (*unhook_system_services_pf)(VOID);
|
||||
typedef VOID (*shim_void_func_pf)(VOID);
|
||||
|
||||
|
||||
/*
|
||||
* The two offset here are extract from the shim file which used in Ventoy.
|
||||
* nm BOOTX64.EFI | grep shim_load_image
|
||||
* nm BOOTX64.EFI | grep unhook_system_services
|
||||
* nm BOOTX64.EFI | grep uninstall_shim_protocols
|
||||
*
|
||||
* It means that they must be updated every time Ventoy update the shim file.
|
||||
*
|
||||
*/
|
||||
#define NM_SHIM_LOAD_IMAGE_OFFSET 0x2dc12
|
||||
#define NM_UNHOOK_SYSTEM_SERVICES_OFFSET 0x2e278
|
||||
#define NM_UNINSTALL_SHIM_PROTOCOLS_OFFSET 0x26264
|
||||
|
||||
|
||||
|
||||
@@ -86,6 +88,7 @@ typedef VOID (*unhook_system_services_pf)(VOID);
|
||||
#define VtoySleep(sec) gBS->Stall(1000000 * (sec))
|
||||
#define vLog(fmt, ...) VtoyLog(fmt "\r\n", ##__VA_ARGS__)
|
||||
#define vErr(fmt, ...) VtoyLog(fmt "\r\n", ##__VA_ARGS__); VtoySleep(5)
|
||||
#define vDbg(fmt, ...) VtoyLog(fmt "\r\n", ##__VA_ARGS__); VtoySleep(2)
|
||||
|
||||
#define CheckFreePool(p) \
|
||||
do { \
|
||||
@@ -95,27 +98,19 @@ do { \
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
#define CheckBSFreePool(p) \
|
||||
do { \
|
||||
if (p) { \
|
||||
gBS->FreePool(p); \
|
||||
(p) = NULL; \
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
#define VTOY_SHIM_POLICY_GUID {0x90a29d14, 0x3968, 0x48fe, { 0x85, 0x81, 0x6b, 0x7f, 0x7d, 0xc4, 0x70, 0x55 }};
|
||||
|
||||
|
||||
typedef VOID (EFIAPI *VTOY_BYPASS_SB)(VOID);
|
||||
typedef VOID (EFIAPI *VTOY_CHECK_SB)(VOID);
|
||||
typedef VOID (EFIAPI *VTOY_LAUNCHED)(VOID);
|
||||
typedef struct _VTOY_SHIM{
|
||||
VTOY_BYPASS_SB ByPassSB;
|
||||
VTOY_BYPASS_SB CheckSB;
|
||||
VTOY_LAUNCHED Launched;
|
||||
} VTOY_SHIM;
|
||||
|
||||
CONST UINT8 * ventoy_get_der_data(UINT32 *Len);
|
||||
void calc_sha256(const void *data, UINT64 len, void *output);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
[Sources]
|
||||
VtoyShim.h
|
||||
VtoyShim.c
|
||||
sha256.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/******************************************************************************
|
||||
* VtoyShim.c
|
||||
*
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
||||
|
||||
static const UINT32 sha256_initial_h[8]
|
||||
= { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
||||
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 };
|
||||
|
||||
static const UINT32 sha256_round_k[64]
|
||||
= { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
||||
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
||||
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
||||
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
||||
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
||||
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 };
|
||||
|
||||
static void sha256_endian_reverse64(UINT64 input, UINT8 *output) {
|
||||
output[7] = (input >> 0) & 0xff;
|
||||
output[6] = (input >> 8) & 0xff;
|
||||
output[5] = (input >> 16) & 0xff;
|
||||
output[4] = (input >> 24) & 0xff;
|
||||
output[3] = (input >> 32) & 0xff;
|
||||
output[2] = (input >> 40) & 0xff;
|
||||
output[1] = (input >> 48) & 0xff;
|
||||
output[0] = (input >> 56) & 0xff;
|
||||
}
|
||||
|
||||
static UINT32 sha256_endian_read32(UINT8 *input) {
|
||||
UINT32 output = 0;
|
||||
output |= (input[0] << 24);
|
||||
output |= (input[1] << 16);
|
||||
output |= (input[2] << 8);
|
||||
output |= (input[3] << 0);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static void sha256_endian_reverse32(UINT32 input, UINT8 *output) {
|
||||
output[3] = (input >> 0) & 0xff;
|
||||
output[2] = (input >> 8) & 0xff;
|
||||
output[1] = (input >> 16) & 0xff;
|
||||
output[0] = (input >> 24) & 0xff;
|
||||
}
|
||||
|
||||
static UINT32 sha256_ror(UINT32 input, UINT32 by) {
|
||||
return (input >> by) | (((input & ((1 << by) - 1))) << (32 - by));
|
||||
}
|
||||
|
||||
void calc_sha256(const void *data, UINT64 len, void *output)
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
UINT8 padding[80];
|
||||
UINT64 current = (len + 1) % 64;
|
||||
// want to be == 56 % 64.
|
||||
UINT64 needed = (64 + 56 - current) % 64;
|
||||
UINT64 extra = needed + 9;
|
||||
UINT64 total = len + extra;
|
||||
UINT32 v[8];
|
||||
UINT64 cursor = 0;
|
||||
|
||||
for(i = 1; i < 80; i++)
|
||||
{
|
||||
padding[i] = 0;
|
||||
}
|
||||
padding[0] = 0x80;
|
||||
|
||||
sha256_endian_reverse64(len * 8, padding + total - len - 8);
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
v[i] = sha256_initial_h[i];
|
||||
}
|
||||
|
||||
for(cursor = 0; cursor * 64 < total; cursor++)
|
||||
{
|
||||
UINT32 t[8];
|
||||
UINT32 w[64];
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
t[i] = v[i];
|
||||
}
|
||||
|
||||
|
||||
if(cursor * 64 + 64 <= len)
|
||||
{
|
||||
for(j = 0; j < 16; j++)
|
||||
{
|
||||
w[j] = sha256_endian_read32((UINT8 *)data + cursor * 64 + j * 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cursor * 64 < len)
|
||||
{
|
||||
UINT64 size = len - cursor * 64;
|
||||
if(size > 0)
|
||||
{
|
||||
CopyMem(w, (UINT8 *)data + cursor * 64, size);
|
||||
}
|
||||
CopyMem((UINT8 *)w + size, padding, 64 - size);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT64 off = (cursor * 64 - len) % 64;
|
||||
CopyMem((UINT8 *)w, padding + off, 64);
|
||||
}
|
||||
|
||||
for(j = 0; j < 16; j++)
|
||||
{
|
||||
w[j] = sha256_endian_read32((UINT8 *)&w[j]);
|
||||
}
|
||||
}
|
||||
|
||||
for(j = 16; j < 64; j++)
|
||||
{
|
||||
UINT32 s1 = sha256_ror(w[j - 2], 17) ^ sha256_ror(w[j - 2], 19) ^ (w[j - 2] >> 10);
|
||||
UINT32 s0 = sha256_ror(w[j - 15], 7) ^ sha256_ror(w[j - 15], 18) ^ (w[j - 15] >> 3);
|
||||
w[j] = s1 + w[j - 7] + s0 + w[j - 16];
|
||||
}
|
||||
|
||||
for(j = 0; j < 64; j++)
|
||||
{
|
||||
UINT32 ch = (t[4] & t[5]) ^ (~t[4] & t[6]);
|
||||
UINT32 maj = (t[0] & t[1]) ^ (t[0] & t[2]) ^ (t[1] & t[2]);
|
||||
UINT32 S0 = sha256_ror(t[0], 2) ^ sha256_ror(t[0], 13) ^ sha256_ror(t[0], 22);
|
||||
UINT32 S1 = sha256_ror(t[4], 6) ^ sha256_ror(t[4], 11) ^ sha256_ror(t[4], 25);
|
||||
UINT32 t1 = t[7] + S1 + ch + sha256_round_k[j] + w[j];
|
||||
UINT32 t2 = S0 + maj;
|
||||
|
||||
t[7] = t[6];
|
||||
t[6] = t[5];
|
||||
t[5] = t[4];
|
||||
t[4] = t[3] + t1;
|
||||
t[3] = t[2];
|
||||
t[2] = t[1];
|
||||
t[1] = t[0];
|
||||
t[0] = t1 + t2;
|
||||
}
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
v[i] += t[i];
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
sha256_endian_reverse32(v[i], (UINT8 *)output + i * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,32 +145,6 @@ STATIC EFI_STATUS ParseCmdline(IN EFI_HANDLE ImageHandle)
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined (MDE_CPU_X64)
|
||||
STATIC BOOLEAN EFIAPI CheckVtoyShim(VOID)
|
||||
{
|
||||
UINT8 SecureBoot = 0;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID Guid = VTOY_SHIM_POLICY_GUID;
|
||||
VOID *Prot = NULL;
|
||||
|
||||
DataSize = sizeof(SecureBoot);
|
||||
Status = gST->RuntimeServices->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL,
|
||||
&DataSize, &SecureBoot);
|
||||
if (!EFI_ERROR(Status) && SecureBoot)
|
||||
{
|
||||
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,
|
||||
@@ -180,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++)
|
||||
|
||||
@@ -314,6 +314,25 @@ static void ventoy_get_uefi_version(char *str, grub_size_t len)
|
||||
grub_snprintf(str, len, "%s.%d", str, uefi_minor_2);
|
||||
}
|
||||
|
||||
static void ventoy_get_pi_version(char *str, grub_size_t len)
|
||||
{
|
||||
grub_uint32_t data = 0;
|
||||
grub_efi_uintn_t i = 0;
|
||||
grub_efi_guid_t dxest =
|
||||
{ 0x05ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9 } };
|
||||
|
||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
||||
{
|
||||
if (grub_memcmp(&dxest, &grub_efi_system_table->configuration_table[i].vendor_guid, 16) == 0)
|
||||
{
|
||||
grub_memcpy(&data, (char *)grub_efi_system_table->configuration_table[i].vendor_table + 8, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grub_snprintf(str, len, "%d.%d", (data >> 16) & 0xFFFF, (data & 0xFFFF) / 10);
|
||||
}
|
||||
|
||||
int ventoy_set_sb_policy(void)
|
||||
{
|
||||
const char *env = NULL;
|
||||
@@ -359,12 +378,27 @@ int ventoy_set_sb_policy(void)
|
||||
|
||||
static void ventoy_get_uefi_sb(void)
|
||||
{
|
||||
grub_uint8_t secure_boot = 0;
|
||||
grub_uint8_t setup_mode = 0;
|
||||
grub_uint8_t *var = NULL;
|
||||
grub_size_t size = 0;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
|
||||
var = grub_efi_get_variable("SecureBoot", &global, &size);
|
||||
if (var && size == 1 && *var == 1)
|
||||
{
|
||||
secure_boot = 1;
|
||||
}
|
||||
grub_check_free(var);
|
||||
|
||||
size = 0;
|
||||
var = grub_efi_get_variable("SetupMode", &global, &size);
|
||||
if (var && size == 1 && *var == 1)
|
||||
{
|
||||
setup_mode = 1;
|
||||
}
|
||||
|
||||
if (secure_boot == 1 && setup_mode == 0)
|
||||
{
|
||||
g_sys_sb = 1;
|
||||
}
|
||||
@@ -384,24 +418,23 @@ static int ventoy_secure_boot_init(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* When SecureBoot enabled, Ventoy grub must be launched by Ventoy Shim.
|
||||
* Currently only x86_64 support this feature.
|
||||
*/
|
||||
if (g_ventoy_plat_data == VTOY_PLAT_X86_64_UEFI)
|
||||
{
|
||||
g_vtoy_shim = grub_efi_locate_protocol(&ProtGuid, NULL);
|
||||
if (g_vtoy_shim == NULL || g_vtoy_shim->ByPassSB == NULL || g_vtoy_shim->CheckSB == NULL)
|
||||
if (g_vtoy_shim == NULL || g_vtoy_shim->ByPassSB == NULL ||
|
||||
g_vtoy_shim->CheckSB == NULL || g_vtoy_shim->Launched == NULL)
|
||||
{
|
||||
grub_cls();
|
||||
grub_printf(VTOY_WARNING"\n");
|
||||
grub_printf(VTOY_WARNING"\n");
|
||||
grub_printf(VTOY_WARNING"\n\n\n");
|
||||
|
||||
grub_printf("Ventoy grub is not launched by Ventoy shim.\n\n");
|
||||
grub_refresh();
|
||||
|
||||
ventoy_prompt_end();
|
||||
/*
|
||||
* Generally when SecureBoot enabled, Ventoy grub must be launched by Ventoy Shim.
|
||||
* But there are some exceptions:
|
||||
* 1. Ventoy key was enrolled directly to the UEFI DB
|
||||
* 2. Some UEFI firmware (MSI) has Image Execution Policy as Always Execute which
|
||||
* means Secure Boot is effectively disabled.
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
g_vtoy_shim->Launched();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,8 +501,12 @@ static int ventoy_hwinfo_init(void)
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
ventoy_get_uefi_version(str, sizeof(str));
|
||||
ventoy_env_export("grub_uefi_version", str);
|
||||
|
||||
ventoy_get_pi_version(str, sizeof(str));
|
||||
ventoy_env_export("grub_pi_version", str);
|
||||
#else
|
||||
ventoy_env_export("grub_uefi_version", "NA");
|
||||
ventoy_env_export("grub_pi_version", "NA");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -896,6 +896,36 @@ static grub_err_t ventoy_cmd_strstr(grub_extcmd_context_t ctxt, int argc, char *
|
||||
return (grub_strstr(args[0], args[1])) ? 0 : 1;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_istrstr(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
grub_err_t ret = 1;
|
||||
char *s1 = NULL;
|
||||
char *s2 = NULL;
|
||||
|
||||
(void)ctxt;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
s1 = grub_strdup(args[0]);
|
||||
s2 = grub_strdup(args[1]);
|
||||
if (s1 == NULL || s2 == NULL)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
ventoy_str_toupper(s1);
|
||||
ventoy_str_toupper(s2);
|
||||
ret = (grub_strstr(s1, s2)) ? 0 : 1;
|
||||
|
||||
end:
|
||||
grub_check_free(s1);
|
||||
grub_check_free(s2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_strbegin(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
char *c0, *c1;
|
||||
@@ -4722,23 +4752,10 @@ static grub_err_t ventoy_cmd_img_unhook_root(grub_extcmd_context_t ctxt, int arg
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int ret = 1;
|
||||
grub_uint8_t *var = NULL;
|
||||
grub_size_t size;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
var = grub_efi_get_variable("SecureBoot", &global, &size);
|
||||
if (var && *var == 1)
|
||||
{
|
||||
grub_free(var);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return g_sys_sb ? 0 : 1;
|
||||
}
|
||||
#else
|
||||
static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
@@ -6434,6 +6451,10 @@ static grub_err_t ventoy_cmd_sb_info(grub_extcmd_context_t ctxt, int argc, char
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
const char *policy = NULL;
|
||||
grub_efi_guid_t security =
|
||||
{ 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } };
|
||||
grub_efi_guid_t security2 =
|
||||
{ 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } };
|
||||
|
||||
if (g_sb_policy == VTOY_SB_POLICY_BYPASS)
|
||||
{
|
||||
@@ -6448,8 +6469,10 @@ static grub_err_t ventoy_cmd_sb_info(grub_extcmd_context_t ctxt, int argc, char
|
||||
policy = "XXX";
|
||||
}
|
||||
|
||||
grub_printf("UEFI Firmware Secure Boot: %s\n", g_sys_sb ? "Enable" : "Disable");
|
||||
grub_printf("Ventoy Secure Boot Policy: %s\n", policy);
|
||||
grub_printf("UEFI Security %s\n", grub_efi_locate_protocol(&security, NULL) ? "Yes" : "No");
|
||||
grub_printf("UEFI Security2 %s\n", grub_efi_locate_protocol(&security2, NULL) ? "Yes" : "No");
|
||||
grub_printf("Ventoy Secure Policy %s\n", policy);
|
||||
|
||||
#else
|
||||
grub_printf("Non EFI mode!\n");
|
||||
#endif
|
||||
@@ -6944,6 +6967,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_incr", ventoy_cmd_incr, 0, NULL, "{Var} {INT}", "Increase integer variable", NULL },
|
||||
{ "vt_mod", ventoy_cmd_mod, 0, NULL, "{Int} {Int} {Var}", "mod integer variable", NULL },
|
||||
{ "vt_strstr", ventoy_cmd_strstr, 0, NULL, "", "", NULL },
|
||||
{ "vt_istrstr", ventoy_cmd_istrstr, 0, NULL, "", "", NULL },
|
||||
{ "vt_str_begin", ventoy_cmd_strbegin, 0, NULL, "", "", NULL },
|
||||
{ "vt_str_casebegin", ventoy_cmd_strcasebegin, 0, NULL, "", "", NULL },
|
||||
{ "vt_debug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
|
||||
@@ -199,9 +199,11 @@ typedef struct cpio_newc_header
|
||||
|
||||
typedef void (*VTOY_BYPASS_SB)(void);
|
||||
typedef void (*VTOY_CHECK_SB)(void);
|
||||
typedef void (*VTOY_LAUNCHED)(void);
|
||||
typedef struct _VTOY_SHIM{
|
||||
VTOY_BYPASS_SB ByPassSB;
|
||||
VTOY_CHECK_SB CheckSB;
|
||||
VTOY_LAUNCHED Launched;
|
||||
} VTOY_SHIM;
|
||||
|
||||
|
||||
|
||||
@@ -34,20 +34,6 @@ function ventoy_debug_pause {
|
||||
}
|
||||
|
||||
|
||||
function ventoy_max_resolution {
|
||||
#Skip this for VirtualBox
|
||||
smbios -t 1 -s 0x05 --set=system_product;
|
||||
if vt_str_casebegin "$system_product" "VirtualBox"; then
|
||||
return
|
||||
fi
|
||||
|
||||
vt_enum_video_mode
|
||||
vt_get_video_mode 0 vtCurMode
|
||||
terminal_output console
|
||||
set gfxmode=$vtCurMode
|
||||
terminal_output gfxterm
|
||||
}
|
||||
|
||||
function ventoy_cli_console {
|
||||
if [ -z "$vtoy_display_mode" ]; then
|
||||
terminal_output console
|
||||
@@ -662,7 +648,6 @@ function uefi_windows_menu_func {
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_max_resolution
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} iso_${ventoy_fs_probe} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
else
|
||||
@@ -1457,7 +1442,10 @@ function ventoy_iso_busybox_ver {
|
||||
set ventoy_busybox_ver=64
|
||||
elif vt_strstr "$vt_volume_id" "x86_64"; then
|
||||
set ventoy_busybox_ver=64
|
||||
|
||||
elif vt_istrstr "${vt_chosen_path}" "x86_64"; then
|
||||
set ventoy_busybox_ver=64
|
||||
elif vt_istrstr "${vt_chosen_path}" "amd64"; then
|
||||
set ventoy_busybox_ver=64
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -2449,7 +2437,7 @@ function mimg_common_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.1.15"
|
||||
set VENTOY_VERSION="1.1.16"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
L - Seleccionar lenguaje
|
||||
L - Seleccionar idioma
|
||||
F1 - Mostrar información de ayuda
|
||||
F2 - Navegar y arranca archivos en el disco local
|
||||
F3 - Cambiar modo de menú entre vista de árbol <-> vista de lista
|
||||
F4 - arrancar Windows/Linux en el disco local
|
||||
F2 - Navegar y arrancar archivos en el disco local
|
||||
F3 - Cambiar modo de menú entre Vista de árbol <-> Vista de lista
|
||||
F4 - Arrancar Windows/Linux en el disco local
|
||||
F5 - Utilidades
|
||||
F6 - Cargar menú de Grub2 personalizado
|
||||
F7 - Cambiar entre modo grafico <-> modo texto
|
||||
F7 - Cambiar entre Modo GUI <-> Modo texto
|
||||
|
||||
m/Ctrl+m - Suma de comprobación de archivos de imagen (md5/sha1/sha256/sha512)
|
||||
d/Ctrl+d - Modo Memdisk (solo para WinPE/LiveCD ISO/IMG pequeños)
|
||||
w/Ctrl+w - Modo WIMBOOT (Solo para archivos Windows/WinPE ISO)
|
||||
r/Ctrl+r - Modo Grub2 (Solo para algunas distribuciones de Linux)
|
||||
i/Ctrl+i - Modo compatible (Solo para depuración)
|
||||
u/Ctrl+u - Cargar controlador ISO EFI (Solo para depuración, no se puede usar oficialmente)
|
||||
d/Ctrl+d - Modo Memdisk (Sólo para WinPE/LiveCD ISO/IMG pequeños)
|
||||
w/Ctrl+w - Modo WIMBOOT (Sólo para archivos Windows/WinPE ISO)
|
||||
r/Ctrl+r - Modo Grub2 (Sólo para algunas distros de Linux)
|
||||
i/Ctrl+i - Modo compatible (Sólo para depuración)
|
||||
u/Ctrl+u - Cargar controlador ISO EFI (Sólo para depuración, uso no oficial)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,14 @@ menuentry "$VTLANG_HWINFO" --class=debug_hwinfo --class=F5tool {
|
||||
echo "Platform $grub_cpu-$grub_platform"
|
||||
if [ "$grub_platform" != "pc" ]; then
|
||||
echo "UEFI Version $grub_uefi_version"
|
||||
echo "PI Version $grub_pi_version"
|
||||
if vt_check_secureboot_var; then
|
||||
echo "Secure Boot Enabled"
|
||||
else
|
||||
echo "Secure Boot Disabled"
|
||||
fi
|
||||
|
||||
vt_sbinfo
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"VTLANG_LANGUAGE_NAME": "Spanish (Español)",
|
||||
|
||||
"VTLANG_STR_HOTKEY_LIST": "L:Lenguaje F1:Ayuda F2:Navegar F3:Vista de lista F4:Arranque local F5:Herramientas F6:Extensión de menú",
|
||||
"VTLANG_STR_HOTKEY_TREE": "L:Lenguaje F1:Ayuda F2:Navegar F3:Vista de árbol F4:Arranque local F5:Herramientas F6:Extensión de menú",
|
||||
"VTLANG_RETURN_PREVIOUS": "Regresar al menú previo [Esc]",
|
||||
"VTLANG_RETURN_PRV_NOESC": "Regresar al menú previo",
|
||||
"VTLANG_STR_HOTKEY_LIST": "L:Idioma F1:Ayuda F2:Navegar F3:Vista de lista F4:Arranque local F5:Herramientas F6:Menú ext.",
|
||||
"VTLANG_STR_HOTKEY_TREE": "L:Idioma F1:Ayuda F2:Navegar F3:Vista de árbol F4:Arranque local F5:Herramientas F6:Menú ext.",
|
||||
"VTLANG_RETURN_PREVIOUS": "Regresar al menú anterior [Esc]",
|
||||
"VTLANG_RETURN_PRV_NOESC": "Regresar al menú anterior",
|
||||
|
||||
"VTLANG_MENU_LANG": "Selección de idioma del menú",
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
"VTLANG_CHKSUM_SHA256_CALC_CHK": "Calcular y comprobar sha256sum",
|
||||
"VTLANG_CHKSUM_SHA512_CALC_CHK": "Calcular y comprobar sha512sum",
|
||||
|
||||
"VTLANG_POWER": "Poder",
|
||||
"VTLANG_POWER": "Energía",
|
||||
"VTLANG_POWER_REBOOT": "Reiniciar",
|
||||
"VTLANG_POWER_HALT": "Detener",
|
||||
"VTLANG_POWER_BOOT_EFIFW": "Reiniciar a configuración EFI",
|
||||
"VTLANG_POWER_HALT": "Apagar",
|
||||
"VTLANG_POWER_BOOT_EFIFW": "Reiniciar a la configuración EFI",
|
||||
|
||||
"VTLANG_KEYBRD_LAYOUT": "Distribuciones de teclado",
|
||||
"VTLANG_HWINFO": "Información de Hardware",
|
||||
"VTLANG_HWINFO": "Información de hardware",
|
||||
|
||||
"VTLANG_RESOLUTION_CFG": "Configuración de resolución",
|
||||
"VTLANG_SCREEN_MODE": "Modo de visualización de pantalla",
|
||||
@@ -45,23 +45,23 @@
|
||||
|
||||
"VTLANG_UEFI_UTIL": "Utilidades UEFI de Ventoy",
|
||||
"VTLANG_UTIL_SHOW_EFI_DRV": "Mostrar controladores EFI",
|
||||
"VTLANG_UTIL_FIX_BLINIT_FAIL": "Reparar la falla de BinitializeLibrary de Windows",
|
||||
"VTLANG_UTIL_FIX_BLINIT_FAIL": "Reparar error BlinitializeLibrary de Windows",
|
||||
|
||||
"VTLANG_JSON_CHK_JSON": "Comprobar configuración de complemento de json (ventoy.json)",
|
||||
"VTLANG_JSON_CHK_CONTROL": "Comprobar configuración de complemento de control global",
|
||||
"VTLANG_JSON_CHK_THEME": "Comprobar configuración de complemento de tema",
|
||||
"VTLANG_JSON_CHK_AUTOINS": "Comprobar configuración de complemento de auto instalación",
|
||||
"VTLANG_JSON_CHK_PERSIST": "Comprobar configuración de complemento de persistencia",
|
||||
"VTLANG_JSON_CHK_MENU_ALIAS": "Comprobar configuración de complemento de alias de menú",
|
||||
"VTLANG_JSON_CHK_MENU_TIP": "Comprobar configuración de complemento de consejo de menú",
|
||||
"VTLANG_JSON_CHK_MENU_CLASS": "Comprobar configuración de complemento de clase de menú",
|
||||
"VTLANG_JSON_CHK_INJECTION": "Comprobar configuración de complemento de inyección",
|
||||
"VTLANG_JSON_CHK_AUTO_MEMDISK": "Comprobar configuración de complemento de auto memdisk",
|
||||
"VTLANG_JSON_CHK_IMG_LIST": "Comprobar configuración de complemento de lista de imágenes",
|
||||
"VTLANG_JSON_CHK_IMG_BLIST": "Comprobar configuración de complemento de lista negra de imágenes",
|
||||
"VTLANG_JSON_CHK_CONF_REPLACE": "Comprobar configuración de complemento de reemplazo de configuración de arranque",
|
||||
"VTLANG_JSON_CHK_DUD": "Comprobar configuración de complemento de dud",
|
||||
"VTLANG_JSON_CHK_PASSWORD": "Comprobar configuración de complemento de contraseñas",
|
||||
"VTLANG_JSON_CHK_JSON": "Comprobar configuración del complemento de json (ventoy.json)",
|
||||
"VTLANG_JSON_CHK_CONTROL": "Comprobar configuración del complemento de control global",
|
||||
"VTLANG_JSON_CHK_THEME": "Comprobar configuración del complemento de tema",
|
||||
"VTLANG_JSON_CHK_AUTOINS": "Comprobar configuración del complemento de autoinstalación",
|
||||
"VTLANG_JSON_CHK_PERSIST": "Comprobar configuración del complemento de persistencia",
|
||||
"VTLANG_JSON_CHK_MENU_ALIAS": "Comprobar configuración del complemento de alias de menú",
|
||||
"VTLANG_JSON_CHK_MENU_TIP": "Comprobar configuración del complemento de consejo de menú",
|
||||
"VTLANG_JSON_CHK_MENU_CLASS": "Comprobar configuración del complemento de clases de menú",
|
||||
"VTLANG_JSON_CHK_INJECTION": "Comprobar configuración del complemento de inyección",
|
||||
"VTLANG_JSON_CHK_AUTO_MEMDISK": "Comprobar configuración del complemento auto memdisk",
|
||||
"VTLANG_JSON_CHK_IMG_LIST": "Comprobar configuración del complemento de lista de imágenes",
|
||||
"VTLANG_JSON_CHK_IMG_BLIST": "Comprobar configuración del complemento de lista negra de imágenes",
|
||||
"VTLANG_JSON_CHK_CONF_REPLACE": "Comprobar configuración del complemento de reemplazo de configuración de arranque",
|
||||
"VTLANG_JSON_CHK_DUD": "Comprobar configuración del complemento dud",
|
||||
"VTLANG_JSON_CHK_PASSWORD": "Comprobar configuración del complemento de contraseñas",
|
||||
|
||||
"VTLANG_NORMAL_MODE": "Arrancar en modo normal",
|
||||
"VTLANG_WIMBOOT_MODE": "Arrancar en modo wimboot",
|
||||
@@ -71,7 +71,7 @@
|
||||
"VTLANG_RET_TO_LISTVIEW": "Regresar a vista de lista",
|
||||
"VTLANG_RET_TO_TREEVIEW": "regresar a vista de árbol",
|
||||
|
||||
"VTLANG_NO_AUTOINS_SCRIPT": "Arrancar sin plantilla de auto instalación",
|
||||
"VTLANG_NO_AUTOINS_SCRIPT": "Arrancar sin plantilla de autoinstalación",
|
||||
"VTLANG_AUTOINS_USE": "Arrancar con",
|
||||
|
||||
"VTLANG_NO_PERSIST": "Arrancar sin persistencia",
|
||||
@@ -79,20 +79,20 @@
|
||||
|
||||
"VTLANG_BROWER_RETURN": "Regresar",
|
||||
|
||||
"VTLANG_ENTER_EXIT": "presiona tecla Entrar para salir",
|
||||
"VTLANG_ENTER_REBOOT": "presiona tecla Entrar para reiniciar",
|
||||
"VTLANG_ENTER_CONTINUE": "presiona tecla Entrar para continuar",
|
||||
"VTLANG_ENTER_EXIT": "Presiona la tecla Entrar para salir",
|
||||
"VTLANG_ENTER_REBOOT": "Presiona la tecla Entrar para reiniciar",
|
||||
"VTLANG_ENTER_CONTINUE": "Presiona la tecla Entrar para continuar",
|
||||
|
||||
"VTLANG_CTRL_TEMP_SET": "Ajustes de control temporales",
|
||||
"VTLANG_WIN11_BYPASS_CHECK": "Saltar comprobación de CPU/TPM/Arranque Seguro al instalar Windows 11",
|
||||
"VTLANG_WIN11_BYPASS_NRO": "Saltar requerimiento de cuenta en linea al instalar Windows 11",
|
||||
"VTLANG_WIN11_BYPASS_CHECK": "Omitir comprobación de CPU/TPM/SecureBoot al instalar Windows 11",
|
||||
"VTLANG_WIN11_BYPASS_NRO": "Omitir requisito de cuenta en línea al instalar Windows 11",
|
||||
"VTLANG_LINUX_REMOUNT": "Montar partición de Ventoy después de arrancar Linux",
|
||||
"VTLANG_SECONDARY_BOOT_MENU": "Mostrar menú de arranque secundario",
|
||||
"VTLANG_WIN_UEFI_RES_LOCK": "Lock the resolution when UEFI boot Windows/WinPE",
|
||||
"VTLANG_UEFI_RES_LOCK_NONE": "None",
|
||||
"VTLANG_UEFI_RES_LOCK_MAX": "Highest",
|
||||
"VTLANG_UEFI_RES_LOCK_1024_768": "Fixed 1024 x 768",
|
||||
"VTLANG_UEFI_RES_LOCK_BE1024_768": "At least 1024 x 768",
|
||||
"VTLANG_WIN_UEFI_RES_LOCK": "Bloquear la resolución al arrancar Windows/WinPE en modo UEFI",
|
||||
"VTLANG_UEFI_RES_LOCK_NONE": "Ninguno",
|
||||
"VTLANG_UEFI_RES_LOCK_MAX": "La más alta",
|
||||
"VTLANG_UEFI_RES_LOCK_1024_768": "Fija 1024 x 768",
|
||||
"VTLANG_UEFI_RES_LOCK_BE1024_768": "Al menos 1024 x 768",
|
||||
|
||||
|
||||
"MENU_STR_XXX": ""
|
||||
|
||||
@@ -88,11 +88,11 @@
|
||||
"VTLANG_WIN11_BYPASS_NRO": "Windows 11 설치 시 온라인 계정 요구 사항 무시",
|
||||
"VTLANG_LINUX_REMOUNT": "Linux 부팅 후 Ventoy 파티션 마운트",
|
||||
"VTLANG_SECONDARY_BOOT_MENU": "보조 부팅 메뉴 표시",
|
||||
"VTLANG_WIN_UEFI_RES_LOCK": "Lock the resolution when UEFI boot Windows/WinPE",
|
||||
"VTLANG_UEFI_RES_LOCK_NONE": "None",
|
||||
"VTLANG_UEFI_RES_LOCK_MAX": "Highest",
|
||||
"VTLANG_UEFI_RES_LOCK_1024_768": "Fixed 1024 x 768",
|
||||
"VTLANG_UEFI_RES_LOCK_BE1024_768": "At least 1024 x 768",
|
||||
"VTLANG_WIN_UEFI_RES_LOCK": "UEFI 부팅 시 Windows/WinPE 해상도 고정",
|
||||
"VTLANG_UEFI_RES_LOCK_NONE": "고정 안 함",
|
||||
"VTLANG_UEFI_RES_LOCK_MAX": "최고 해상도로 고정",
|
||||
"VTLANG_UEFI_RES_LOCK_1024_768": "1024 x 768로 고정",
|
||||
"VTLANG_UEFI_RES_LOCK_BE1024_768": "1024 x 768 이상으로 고정",
|
||||
|
||||
|
||||
"MENU_STR_XXX": ""
|
||||
|
||||
@@ -12,7 +12,6 @@ if [ "$VENTOY_CERT_PASS" = "YES" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
SBAT_VER=1
|
||||
sign_efi() {
|
||||
efi=$1
|
||||
|
||||
@@ -32,10 +31,6 @@ sign_efi() {
|
||||
mv ${efi}.unxz ${efi}
|
||||
fi
|
||||
|
||||
sbstr=$(printf "%08x" $SBAT_VER)
|
||||
echo -en "\x8a\x06\x55\xf7\x4f\xe0\x2b\x45\x9d\x6d\x7c\x55\x96\xb3\xc0\x7d\x${sbstr:6:2}\x${sbstr:4:2}\x${sbstr:2:2}\x${sbstr:0:2}" | \
|
||||
dd bs=1 count=20 of=${efi} seek=40 conv=notrunc status=none
|
||||
|
||||
rm -f "${efi}.signed"
|
||||
if [ "$VENTOY_CERT_PASS" = "YES" ]; then
|
||||
expect -f ./sign_with_pass.exp "$KEY_PASS" "$VENTOY_CERT_KEY" "$VENTOY_CERT_PEM" "${efi}" "${efi}.signed" >/dev/null 2>&1
|
||||
@@ -52,7 +47,7 @@ sign_efi() {
|
||||
mv "${efi}.signed" "$efi"
|
||||
fi
|
||||
else
|
||||
echo "### %-64s failed\n" "$efi"
|
||||
printf "### %-64s failed\n" "$efi"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -191,7 +186,6 @@ cp -a ./tool/create_ventoy_iso_part_dm.sh $tmpmnt/tool/
|
||||
rm -f $tmpmnt/grub/i386-pc/*.img
|
||||
|
||||
|
||||
sign_efi $tmpmnt/EFI/BOOT/fbx64.efi
|
||||
sign_efi $tmpmnt/EFI/BOOT/fbia32.efi
|
||||
sign_efi $tmpmnt/EFI/BOOT/fbaa64.efi
|
||||
sign_efi $tmpmnt/EFI/BOOT/grubx64_real.efi
|
||||
@@ -211,6 +205,23 @@ sign_efi $tmpmnt/ventoy/vtoyutil_aa64.efi
|
||||
sign_efi $tmpmnt/ventoy/wimboot.i386.efi.xz
|
||||
sign_efi $tmpmnt/ventoy/wimboot.x86_64.xz
|
||||
|
||||
#inject Ventoy Grub sign sha256 value into VtoyShim
|
||||
grub_sha256=$(sha256sum $tmpmnt/EFI/BOOT/grubx64_real.efi | awk '{print $1}')
|
||||
magic_cnt=$(hexdump -C $tmpmnt/EFI/BOOT/fbx64.efi | grep '26 26 26 26 26 26 26 26' | wc -l)
|
||||
if [ $magic_cnt -ne 1 ]; then
|
||||
echo "hash magic duplicate"
|
||||
exit 1
|
||||
fi
|
||||
magic_off_hex=$(hexdump -C $tmpmnt/EFI/BOOT/fbx64.efi | grep '26 26 26 26 26 26 26 26' | awk '{print $1}')
|
||||
magic_off=$(printf '%u' "0x${magic_off_hex}")
|
||||
|
||||
echo_cmd=$(echo $grub_sha256 | sed 's/\(..\)/\\x\1/g')
|
||||
|
||||
echo Ventoy Grub hash $grub_sha256
|
||||
echo -en "$echo_cmd" | dd bs=1 count=32 of=$tmpmnt/EFI/BOOT/fbx64.efi seek=$magic_off conv=notrunc status=none
|
||||
|
||||
sign_efi $tmpmnt/EFI/BOOT/fbx64.efi
|
||||
|
||||
|
||||
umount $tmpmnt && rm -rf $tmpmnt
|
||||
|
||||
|
||||
@@ -1172,13 +1172,13 @@
|
||||
"name":"Spanish (Latinoamérica)",
|
||||
"FontFamily":"Courier New",
|
||||
"FontSize":16,
|
||||
"Author":"MELERIX",
|
||||
"Author":"MELERIX, independent-arg",
|
||||
|
||||
"STR_ERROR":"Error",
|
||||
"STR_WARNING":"Advertencia",
|
||||
"STR_INFO":"Información",
|
||||
"STR_INCORRECT_DIR":"¡Por favor, ejecuta bajo el directorio correcto!",
|
||||
"STR_INCORRECT_TREE_DIR":"No me ejecutes aquí, por favor descarga el paquete de instalación lanzado, y ejecútalo allí.",
|
||||
"STR_INCORRECT_DIR":"¡Por favor, ejecuta el programa bajo el directorio correcto!",
|
||||
"STR_INCORRECT_TREE_DIR":"No me ejecutes aquí. Por favor descarga el paquete de instalación oficial y ejecútalo desde allí.",
|
||||
"STR_DEVICE":"Dispositivo",
|
||||
"STR_LOCAL_VER":"Ventoy En Paquete",
|
||||
"STR_DISK_VER":"Ventoy En Dispositivo",
|
||||
@@ -1189,47 +1189,47 @@
|
||||
"STR_INSTALL_TIP":"El dispositivo será formateado y todos los datos se perderán.#@¿Continuar?",
|
||||
"STR_INSTALL_TIP2":"El dispositivo será formateado y todos los datos se perderán.#@¿Continuar? (Doble Comprobación)",
|
||||
"STR_INSTALL_SUCCESS":"¡Felicitaciones!#@Ventoy ha sido instalado exitosamente en el dispositivo.",
|
||||
"STR_INSTALL_FAILED":"Ocurrió un error durante la instalación. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para detalles. Si siempre falla, consulta las PF en el sitio web oficial.",
|
||||
"STR_INSTALL_FAILED":"Ocurrió un error durante la instalación. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para más detalles. Si siempre falla, consulta las preguntas frecuentes (FAQ) en el sitio web oficial.",
|
||||
"STR_UPDATE_SUCCESS":"¡Felicitaciones!#@Ventoy ha sido actualizado exitosamente en el dispositivo.",
|
||||
"STR_UPDATE_FAILED":"Ocurrió un error durante la actualización. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para detalles. Si siempre falla, consulta las PF en el sitio web oficial.",
|
||||
"STR_WAIT_PROCESS":"Un hilo está ejecutándose, por favor espera...",
|
||||
"STR_UPDATE_FAILED":"Ocurrió un error durante la actualización. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para más detalles. Si siempre falla, consulta las preguntas frecuentes (FAQ) en el sitio web oficial.",
|
||||
"STR_WAIT_PROCESS":"Un hilo del sistema está ejecutándose, por favor espera...",
|
||||
"STR_MENU_OPTION":"Opción",
|
||||
"STR_MENU_SECURE_BOOT":"Soporte De Arranque Seguro",
|
||||
"STR_MENU_PART_CFG":"Configuración De Partición",
|
||||
"STR_MENU_SECURE_BOOT":"Soporte de arranque seguro",
|
||||
"STR_MENU_PART_CFG":"Configuración de partición",
|
||||
"STR_BTN_OK":"Aceptar",
|
||||
"STR_BTN_CANCEL":"Cancelar",
|
||||
"STR_PRESERVE_SPACE":"Preservar algo de espacio al final del dispositivo",
|
||||
"STR_SPACE_VAL_INVALID":"Valor inválido para espacio reservado",
|
||||
"STR_SPACE_VAL_INVALID":"Valor inválido para el espacio reservado",
|
||||
"STR_MENU_CLEAR":"Limpiar Ventoy",
|
||||
"STR_CLEAR_SUCCESS":"Ventoy ha sido removido exitosamente desde el dispositivo.",
|
||||
"STR_CLEAR_FAILED":"Ocurrió un error al remover Ventoy del dispositivo. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para detalles.",
|
||||
"STR_MENU_PART_STYLE":"Estilo De Partición",
|
||||
"STR_DISK_2TB_MBR_ERROR":"Por favor selecciona GPT para dispositivos sobre 2TB",
|
||||
"STR_SHOW_ALL_DEV":"Mostrar Todos Los Dispositivos",
|
||||
"STR_PART_ALIGN_4KB":"Alinear particiones con 4KB",
|
||||
"STR_CLEAR_SUCCESS":"Ventoy ha sido eliminado exitosamente del dispositivo.",
|
||||
"STR_CLEAR_FAILED":"Ocurrió un error al eliminar Ventoy del dispositivo. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para más detalles.",
|
||||
"STR_MENU_PART_STYLE":"Estilo de partición",
|
||||
"STR_DISK_2TB_MBR_ERROR":"Por favor selecciona GPT para dispositivos de más de 2TB",
|
||||
"STR_SHOW_ALL_DEV":"Mostrar todos los dispositivos",
|
||||
"STR_PART_ALIGN_4KB":"Alinear particiones a 4KB",
|
||||
"STR_WEB_COMMUNICATION_ERR":"Error de comunicación:",
|
||||
"STR_WEB_REMOTE_ABNORMAL":"Error de comunicación: anormal remoto",
|
||||
"STR_WEB_REQUEST_TIMEOUT":"Error de comunicación: Tiempo de espera agotado",
|
||||
"STR_WEB_SERVICE_UNAVAILABLE":"Error de comunicación: Servicio No Disponible",
|
||||
"STR_WEB_REMOTE_ABNORMAL":"Error de comunicación: anomalía remoto",
|
||||
"STR_WEB_REQUEST_TIMEOUT":"Error de comunicación: tiempo de espera agotado",
|
||||
"STR_WEB_SERVICE_UNAVAILABLE":"Error de comunicación: servicio no disponible",
|
||||
"STR_WEB_TOKEN_MISMATCH":" Estado del daemon actualizado, por favor reintenta más tarde.",
|
||||
"STR_WEB_SERVICE_BUSY":" El servicio está ocupado, por favor reintenta más tarde.",
|
||||
"STR_MENU_VTSI_CREATE":"Generar Archivo VTSI",
|
||||
"STR_VTSI_CREATE_TIP":"Esta vez no se escribirá al dispositivo, pero solo generará un archivo VTSI#@¿Continuar?",
|
||||
"STR_MENU_VTSI_CREATE":"Generar archivo VTSI",
|
||||
"STR_VTSI_CREATE_TIP":"Esta acción no escribirá en el dispositivo, sólo generará un archivo VTSI.#@¿Continuar?",
|
||||
"STR_VTSI_CREATE_SUCCESS":"¡Archivo VTSI creado exitosamente!#@Puedes usar Rufus(3.15+) para escribirlo al dispositivo a fin de completar la instalación de Ventoy.",
|
||||
"STR_VTSI_CREATE_FAILED":"Fallo en el archivo VTSI creado.",
|
||||
"STR_VTSI_CREATE_FAILED":"Error al crear el archivo VTSI.",
|
||||
"STR_MENU_PART_RESIZE":"Instalación no destructiva",
|
||||
"STR_PART_RESIZE_TIP":"Ventoy intentará una instalación no destructiva si es posible. #@¿Continuar?",
|
||||
"STR_PART_RESIZE_SUCCESS":"¡Felicitaciones!#@La instalación no destructiva de Ventoy a finalizado exitosamente.",
|
||||
"STR_PART_RESIZE_FAILED":"Instalación no destructiva fallida, Comprueba log.txt para detalles.",
|
||||
"STR_PART_RESIZE_UNSUPPORTED":"Instalación no destructiva de Ventoy detenida porque algunas condiciones no se pueden cumplir. Comprueba log.txt para detalles.",
|
||||
"STR_PART_RESIZE_UNSUPPORTED":"Instalación no destructiva de Ventoy detenida porque algunas condiciones no se pueden cumplir. Comprueba log.txt para más detalles.",
|
||||
"STR_INSTALL_YES_TIP1":"Advertencia: ¡Los datos se perderán!",
|
||||
"STR_INSTALL_YES_TIP2":"Por favor ingresa YES en el cuadro de texto a continuación para confirmar que realmente quieres realizar una instalación nueva en vez de actualizar.",
|
||||
"STR_PART_VENTOY_FS":"Sistema de archivos para partición de Ventoy",
|
||||
"STR_PART_FS":"Sistema de archivos",
|
||||
"STR_PART_CLUSTER":"Tamaño de cluster",
|
||||
"STR_PART_CLUSTER":"Tamaño del clúster",
|
||||
"STR_PART_CLUSTER_DEFAULT":"Valor predeterminado del sistema",
|
||||
"STR_DONATE":"Donar",
|
||||
"STR_4KN_UNSUPPORTED":"Actualmente Ventoy no soporta dispositivos nativos 4K.",
|
||||
"STR_4KN_UNSUPPORTED":"Actualmente Ventoy no es compatible con dispositivos nativos 4K.",
|
||||
|
||||
"STRXXX":""
|
||||
},
|
||||
@@ -3043,14 +3043,14 @@
|
||||
"STR_PART_RESIZE_SUCCESS":"Onnittelut!#@Ventoyn ei-tuhoisa asennus saapui päätökseen onnistuneesti.",
|
||||
"STR_PART_RESIZE_FAILED":"Ei-tuhoisa asennusmuoto epäonnistui, tarkista log.txt nähdäksesi yksityiskohtaiset tiedot.",
|
||||
"STR_PART_RESIZE_UNSUPPORTED":"Ventoyn ei-tuhoisa asennus pysähtyi koska jotkut ehdot eivät täyttyneet. Tarkista log.txt nähdäksesi yksityiskohdat.",
|
||||
"STR_INSTALL_YES_TIP1":"Warning: Data will be lost!",
|
||||
"STR_INSTALL_YES_TIP2":"Please enter YES in the text box below to confirm that you indeed want to do a fresh install instead of upgrade.",
|
||||
"STR_PART_VENTOY_FS":"File System For Ventoy Partition",
|
||||
"STR_PART_FS":"File System",
|
||||
"STR_PART_CLUSTER":"Cluster Size",
|
||||
"STR_PART_CLUSTER_DEFAULT":"System Default Value",
|
||||
"STR_INSTALL_YES_TIP1":"Varoitus: Data menetetään!",
|
||||
"STR_INSTALL_YES_TIP2":"Kirjoita YES alla olevaan tekstikenttään vahvistaaksesi että haluat tehdä uuden asennuksen päivityksen sijaan.",
|
||||
"STR_PART_VENTOY_FS":"Ventoy -osion tiedostojärjestelmä",
|
||||
"STR_PART_FS":"Tiedostojärjestelmä",
|
||||
"STR_PART_CLUSTER":"Klusterin koko",
|
||||
"STR_PART_CLUSTER_DEFAULT":"Järjestelmän oletusarvo",
|
||||
"STR_DONATE":"Lahjoittaa",
|
||||
"STR_4KN_UNSUPPORTED":"Currently Ventoy does not support 4K native devices.",
|
||||
"STR_4KN_UNSUPPORTED":"Tällä hetkellä Ventoy ei tue 4K laitteita.",
|
||||
|
||||
"STRXXX":""
|
||||
},
|
||||
|
||||
@@ -414,7 +414,7 @@ else\
|
||||
if (node->unData.pcStrVal[0] == '0') val = 0
|
||||
|
||||
#define CONTROL_PARSE_INT_DEF_3(node, val) \
|
||||
if (node->unData.pcStrVal[0] == '3') val = 3
|
||||
if (node->unData.pcStrVal[0] >= '0' && node->unData.pcStrVal[0] < '3') val = node->unData.pcStrVal[0] - '0'
|
||||
|
||||
#define VTOY_JSON_INT(key, val) vtoy_json_get_int(json, key, &val)
|
||||
#define VTOY_JSON_STR(key, buf) vtoy_json_get_string(json, key, sizeof(buf), buf)
|
||||
|
||||
@@ -1 +1 @@
|
||||
20260624 16:39:09
|
||||
20260625 19:36:29
|
||||
@@ -760,7 +760,7 @@
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs">
|
||||
<b id="plugson_build_date">20260624 16:39:09</b>
|
||||
<b id="plugson_build_date">20260625 19:36:29</b>
|
||||
</div>
|
||||
<strong><a href="https://www.ventoy.net" target="_blank">https://www.ventoy.net</a></strong>
|
||||
</footer>
|
||||
@@ -780,10 +780,10 @@
|
||||
<script src="/static/js/jQuery-2.1.4.min.js"></script>
|
||||
<!-- jquery validate -->
|
||||
<script src="/static/js/jquery.validate.min.js"></script>
|
||||
<script src="/static/js/jquery.validate.vtoymethods.js?v=317"></script>
|
||||
<script src="/static/js/jquery.validate.vtoymethods.js?v=331"></script>
|
||||
|
||||
<script src="/static/js/jquery.vtoy.alert.js?v=317"></script>
|
||||
<script src="/static/js/vtoy.js?v=317"></script>
|
||||
<script src="/static/js/jquery.vtoy.alert.js?v=331"></script>
|
||||
<script src="/static/js/vtoy.js?v=331"></script>
|
||||
<script src="/static/js/md5.min.js"></script>
|
||||
|
||||
<!-- Bootstrap 3.3.5 -->
|
||||
|
||||
Reference in New Issue
Block a user