return TRUE;
} // secure_mode()
+// Returns TRUE if the shim program is available to verify binaries,
+// FALSE if not
+BOOLEAN ShimLoaded(void) {
+ SHIM_LOCK *shim_lock;
+ EFI_GUID ShimLockGuid = SHIM_LOCK_GUID;
+
+ return (BS->LocateProtocol(&ShimLockGuid, NULL, (VOID**) &shim_lock) == EFI_SUCCESS);
+} // ShimLoaded()
+
/*
* Currently, shim/MOK only works on x86-64 (X64) systems, and some of this code
* generates warnings on x86 (IA32) builds, so don't bother compiling it at all
// Returns TRUE if the specified data is validated by Shim's MOK, FALSE otherwise
static BOOLEAN ShimValidate (VOID *data, UINT32 size)
{
- EFI_GUID ShimLockGuid = SHIM_LOCK_GUID;
SHIM_LOCK *shim_lock;
+ EFI_GUID ShimLockGuid = SHIM_LOCK_GUID;
if (BS->LocateProtocol(&ShimLockGuid, NULL, (VOID**) &shim_lock) == EFI_SUCCESS) {
if (!shim_lock)
* Once the image has been loaded it needs to be validated and relocated
*/
static EFI_STATUS handle_image (void *data, unsigned int datasize, EFI_LOADED_IMAGE *li,
- CHAR16 *Options, REFIT_VOLUME *DeviceVolume, IN EFI_DEVICE_PATH *DevicePath)
+ CHAR16 *Options, REFIT_VOLUME *DeviceVolume, IN CHAR16 *FileName)
{
EFI_STATUS efi_status;
char *buffer;
EFI_IMAGE_SECTION_HEADER *Section;
char *base, *end;
GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT context;
+ EFI_DEVICE_PATH *DevicePath;
/*
* The binary header contains relevant context and section pointers
* grub needs to know its location and size in memory, its location on
* disk, and its load options, so fix up the loaded image protocol values
*/
+ DevicePath = FileDevicePath(NULL, FileName);
+// DevicePath = FileDevicePath(DeviceVolume->DeviceHandle, FileName);
li->DeviceHandle = DeviceVolume->DeviceHandle;
li->FilePath = DevicePath;
li->LoadOptionsSize = ((UINT32)StrLen(Options) + 1) * sizeof(CHAR16);
/*
* Verify and, if appropriate, relocate and execute the executable
*/
- efi_status = handle_image(data, datasize, li, Options, DeviceVolume, DevicePath);
+ efi_status = handle_image(data, datasize, li, Options, DeviceVolume, ImagePath);
if (efi_status != EFI_SUCCESS) {
Print(L"Failed to load image\n");