|
|
4210fa |
From 4bfb13d803f4d8efe544e0f2aa9cd712b8cb84b1 Mon Sep 17 00:00:00 2001
|
|
|
4210fa |
From: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
4210fa |
Date: Tue, 1 Oct 2013 11:58:52 +0800
|
|
|
4210fa |
Subject: [PATCH 37/74] Silence the functions of shim protocol
|
|
|
4210fa |
|
|
|
4210fa |
When grub2 invokes the functions of shim protocol in gfx mode,
|
|
|
4210fa |
OutputString in shim could distort the screen.
|
|
|
4210fa |
|
|
|
4210fa |
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
4210fa |
|
|
|
4210fa |
Conflicts:
|
|
|
4210fa |
shim.c
|
|
|
4210fa |
|
|
|
4210fa |
(modified by pjones to include some newer Prints that weren't there when
|
|
|
4210fa |
Gary did the initial work here.)
|
|
|
4210fa |
---
|
|
|
4210fa |
shim.c | 192 ++++++++++++++++++++++++++++++++++++++---------------------------
|
|
|
4210fa |
1 file changed, 114 insertions(+), 78 deletions(-)
|
|
|
4210fa |
|
|
|
4210fa |
diff --git a/shim.c b/shim.c
|
|
|
4210fa |
index f9fa606..69af766 100644
|
|
|
4210fa |
--- a/shim.c
|
|
|
4210fa |
+++ b/shim.c
|
|
|
4210fa |
@@ -59,6 +59,14 @@ static EFI_STATUS (EFIAPI *entry_point) (EFI_HANDLE image_handle, EFI_SYSTEM_TAB
|
|
|
4210fa |
static CHAR16 *second_stage;
|
|
|
4210fa |
static void *load_options;
|
|
|
4210fa |
static UINT32 load_options_size;
|
|
|
4210fa |
+static UINT8 in_protocol;
|
|
|
4210fa |
+
|
|
|
4210fa |
+#define perror(fmt, ...) ({ \
|
|
|
4210fa |
+ UINTN __perror_ret = 0; \
|
|
|
4210fa |
+ if (in_protocol) \
|
|
|
4210fa |
+ __perror_ret = Print((fmt), ##__VA_ARGS__); \
|
|
|
4210fa |
+ __perror_ret; \
|
|
|
4210fa |
+ })
|
|
|
4210fa |
|
|
|
4210fa |
EFI_GUID SHIM_LOCK_GUID = { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} };
|
|
|
4210fa |
|
|
|
4210fa |
@@ -133,7 +141,7 @@ static EFI_STATUS relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context,
|
|
|
4210fa |
#endif
|
|
|
4210fa |
|
|
|
4210fa |
if (context->NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
|
|
|
4210fa |
- Print(L"Image has no relocation entry\n");
|
|
|
4210fa |
+ perror(L"Image has no relocation entry\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -141,7 +149,7 @@ static EFI_STATUS relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context,
|
|
|
4210fa |
RelocBaseEnd = ImageAddress(data, size, context->RelocDir->VirtualAddress + context->RelocDir->Size - 1);
|
|
|
4210fa |
|
|
|
4210fa |
if (!RelocBase || !RelocBaseEnd) {
|
|
|
4210fa |
- Print(L"Reloc table overflows binary\n");
|
|
|
4210fa |
+ perror(L"Reloc table overflows binary\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -154,19 +162,19 @@ static EFI_STATUS relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context,
|
|
|
4210fa |
Reloc = (UINT16 *) ((char *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
|
|
|
4210fa |
|
|
|
4210fa |
if ((RelocBase->SizeOfBlock == 0) || (RelocBase->SizeOfBlock > context->RelocDir->Size)) {
|
|
|
4210fa |
- Print(L"Reloc block size is invalid\n");
|
|
|
4210fa |
+ perror(L"Reloc block size is invalid\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
RelocEnd = (UINT16 *) ((char *) RelocBase + RelocBase->SizeOfBlock);
|
|
|
4210fa |
if ((void *)RelocEnd < data || (void *)RelocEnd > ImageEnd) {
|
|
|
4210fa |
- Print(L"Reloc entry overflows binary\n");
|
|
|
4210fa |
+ perror(L"Reloc entry overflows binary\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
FixupBase = ImageAddress(data, size, RelocBase->VirtualAddress);
|
|
|
4210fa |
if (!FixupBase) {
|
|
|
4210fa |
- Print(L"Invalid fixupbase\n");
|
|
|
4210fa |
+ perror(L"Invalid fixupbase\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -215,7 +223,7 @@ static EFI_STATUS relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context,
|
|
|
4210fa |
break;
|
|
|
4210fa |
|
|
|
4210fa |
default:
|
|
|
4210fa |
- Print(L"Unknown relocation\n");
|
|
|
4210fa |
+ perror(L"Unknown relocation\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
Reloc += 1;
|
|
|
4210fa |
@@ -478,7 +486,7 @@ static BOOLEAN secure_mode (void)
|
|
|
4210fa |
|
|
|
4210fa |
status = get_variable(L"SecureBoot", &Data, &len, global_var);
|
|
|
4210fa |
if (status != EFI_SUCCESS) {
|
|
|
4210fa |
- if (verbose)
|
|
|
4210fa |
+ if (verbose && !in_protocol)
|
|
|
4210fa |
console_notify(L"Secure boot not enabled");
|
|
|
4210fa |
return FALSE;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -486,7 +494,7 @@ static BOOLEAN secure_mode (void)
|
|
|
4210fa |
FreePool(Data);
|
|
|
4210fa |
|
|
|
4210fa |
if (sb != 1) {
|
|
|
4210fa |
- if (verbose)
|
|
|
4210fa |
+ if (verbose && !in_protocol)
|
|
|
4210fa |
console_notify(L"Secure boot not enabled");
|
|
|
4210fa |
return FALSE;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -499,7 +507,7 @@ static BOOLEAN secure_mode (void)
|
|
|
4210fa |
FreePool(Data);
|
|
|
4210fa |
|
|
|
4210fa |
if (setupmode == 1) {
|
|
|
4210fa |
- if (verbose)
|
|
|
4210fa |
+ if (verbose && !in_protocol)
|
|
|
4210fa |
console_notify(L"Platform is in setup mode");
|
|
|
4210fa |
return FALSE;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -531,14 +539,14 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
unsigned int PEHdr_offset = 0;
|
|
|
4210fa |
|
|
|
4210fa |
if (datasize_in < 0) {
|
|
|
4210fa |
- Print(L"Invalid data size\n");
|
|
|
4210fa |
+ perror(L"Invalid data size\n");
|
|
|
4210fa |
return EFI_INVALID_PARAMETER;
|
|
|
4210fa |
}
|
|
|
4210fa |
size = datasize = (unsigned int)datasize_in;
|
|
|
4210fa |
|
|
|
4210fa |
if (datasize <= sizeof (*DosHdr) ||
|
|
|
4210fa |
DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
|
|
|
4210fa |
- Print(L"Invalid signature\n");
|
|
|
4210fa |
+ perror(L"Invalid signature\n");
|
|
|
4210fa |
return EFI_INVALID_PARAMETER;
|
|
|
4210fa |
}
|
|
|
4210fa |
PEHdr_offset = DosHdr->e_lfanew;
|
|
|
4210fa |
@@ -550,12 +558,12 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
sha1ctx = AllocatePool(sha1ctxsize);
|
|
|
4210fa |
|
|
|
4210fa |
if (!sha256ctx || !sha1ctx) {
|
|
|
4210fa |
- Print(L"Unable to allocate memory for hash context\n");
|
|
|
4210fa |
+ perror(L"Unable to allocate memory for hash context\n");
|
|
|
4210fa |
return EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (!Sha256Init(sha256ctx) || !Sha1Init(sha1ctx)) {
|
|
|
4210fa |
- Print(L"Unable to initialise hash\n");
|
|
|
4210fa |
+ perror(L"Unable to initialise hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -567,7 +575,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
if (!(Sha256Update(sha256ctx, hashbase, hashsize)) ||
|
|
|
4210fa |
!(Sha1Update(sha1ctx, hashbase, hashsize))) {
|
|
|
4210fa |
- Print(L"Unable to generate hash\n");
|
|
|
4210fa |
+ perror(L"Unable to generate hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -579,7 +587,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
if (!(Sha256Update(sha256ctx, hashbase, hashsize)) ||
|
|
|
4210fa |
!(Sha1Update(sha1ctx, hashbase, hashsize))) {
|
|
|
4210fa |
- Print(L"Unable to generate hash\n");
|
|
|
4210fa |
+ perror(L"Unable to generate hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -597,7 +605,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
if (!(Sha256Update(sha256ctx, hashbase, hashsize)) ||
|
|
|
4210fa |
!(Sha1Update(sha1ctx, hashbase, hashsize))) {
|
|
|
4210fa |
- Print(L"Unable to generate hash\n");
|
|
|
4210fa |
+ perror(L"Unable to generate hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -621,14 +629,14 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
context->PEHdr->Pe32.FileHeader.SizeOfOptionalHeader +
|
|
|
4210fa |
(index * sizeof(*SectionPtr)));
|
|
|
4210fa |
if (!SectionPtr) {
|
|
|
4210fa |
- Print(L"Malformed section %d\n", index);
|
|
|
4210fa |
+ perror(L"Malformed section %d\n", index);
|
|
|
4210fa |
status = EFI_INVALID_PARAMETER;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
/* Validate section size is within image. */
|
|
|
4210fa |
if (SectionPtr->SizeOfRawData >
|
|
|
4210fa |
datasize - SumOfBytesHashed - SumOfSectionBytes) {
|
|
|
4210fa |
- Print(L"Malformed section %d size\n", index);
|
|
|
4210fa |
+ perror(L"Malformed section %d size\n", index);
|
|
|
4210fa |
status = EFI_INVALID_PARAMETER;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -637,7 +645,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) AllocateZeroPool (sizeof (EFI_IMAGE_SECTION_HEADER) * context->PEHdr->Pe32.FileHeader.NumberOfSections);
|
|
|
4210fa |
if (SectionHeader == NULL) {
|
|
|
4210fa |
- Print(L"Unable to allocate section header\n");
|
|
|
4210fa |
+ perror(L"Unable to allocate section header\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -669,7 +677,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
hashbase = ImageAddress(data, size, Section->PointerToRawData);
|
|
|
4210fa |
|
|
|
4210fa |
if (!hashbase) {
|
|
|
4210fa |
- Print(L"Malformed section header\n");
|
|
|
4210fa |
+ perror(L"Malformed section header\n");
|
|
|
4210fa |
status = EFI_INVALID_PARAMETER;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -677,7 +685,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
/* Verify hashsize within image. */
|
|
|
4210fa |
if (Section->SizeOfRawData >
|
|
|
4210fa |
datasize - Section->PointerToRawData) {
|
|
|
4210fa |
- Print(L"Malformed section raw size %d\n", index);
|
|
|
4210fa |
+ perror(L"Malformed section raw size %d\n", index);
|
|
|
4210fa |
status = EFI_INVALID_PARAMETER;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -685,7 +693,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
if (!(Sha256Update(sha256ctx, hashbase, hashsize)) ||
|
|
|
4210fa |
!(Sha1Update(sha1ctx, hashbase, hashsize))) {
|
|
|
4210fa |
- Print(L"Unable to generate hash\n");
|
|
|
4210fa |
+ perror(L"Unable to generate hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -706,7 +714,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
if (!(Sha256Update(sha256ctx, hashbase, hashsize)) ||
|
|
|
4210fa |
!(Sha1Update(sha1ctx, hashbase, hashsize))) {
|
|
|
4210fa |
- Print(L"Unable to generate hash\n");
|
|
|
4210fa |
+ perror(L"Unable to generate hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -714,7 +722,7 @@ static EFI_STATUS generate_hash (char *data, int datasize_in,
|
|
|
4210fa |
|
|
|
4210fa |
if (!(Sha256Final(sha256ctx, sha256hash)) ||
|
|
|
4210fa |
!(Sha1Final(sha1ctx, sha1hash))) {
|
|
|
4210fa |
- Print(L"Unable to finalise hash\n");
|
|
|
4210fa |
+ perror(L"Unable to finalise hash\n");
|
|
|
4210fa |
status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -744,9 +752,9 @@ static EFI_STATUS verify_mok (void) {
|
|
|
4210fa |
shim_lock_guid, &attributes);
|
|
|
4210fa |
|
|
|
4210fa |
if (!EFI_ERROR(status) && attributes & EFI_VARIABLE_RUNTIME_ACCESS) {
|
|
|
4210fa |
- Print(L"MokList is compromised!\nErase all keys in MokList!\n");
|
|
|
4210fa |
+ perror(L"MokList is compromised!\nErase all keys in MokList!\n");
|
|
|
4210fa |
if (LibDeleteVariable(L"MokList", &shim_lock_guid) != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to erase MokList\n");
|
|
|
4210fa |
+ perror(L"Failed to erase MokList\n");
|
|
|
4210fa |
return EFI_ACCESS_DENIED;
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -774,13 +782,13 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
|
|
|
4210fa |
context->SecDir->VirtualAddress);
|
|
|
4210fa |
|
|
|
4210fa |
if (!cert) {
|
|
|
4210fa |
- Print(L"Certificate located outside the image\n");
|
|
|
4210fa |
+ perror(L"Certificate located outside the image\n");
|
|
|
4210fa |
return EFI_INVALID_PARAMETER;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (cert->Hdr.wCertificateType !=
|
|
|
4210fa |
WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
|
|
|
4210fa |
- Print(L"Unsupported certificate type %x\n",
|
|
|
4210fa |
+ perror(L"Unsupported certificate type %x\n",
|
|
|
4210fa |
cert->Hdr.wCertificateType);
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -804,7 +812,7 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
|
|
|
4210fa |
status = check_blacklist(cert, sha256hash, sha1hash);
|
|
|
4210fa |
|
|
|
4210fa |
if (status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Binary is blacklisted\n");
|
|
|
4210fa |
+ perror(L"Binary is blacklisted\n");
|
|
|
4210fa |
return status;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -857,7 +865,7 @@ static EFI_STATUS read_header(void *data, unsigned int datasize,
|
|
|
4210fa |
unsigned long HeaderWithoutDataDir, SectionHeaderOffset, OptHeaderSize;
|
|
|
4210fa |
|
|
|
4210fa |
if (datasize < sizeof(EFI_IMAGE_DOS_HEADER)) {
|
|
|
4210fa |
- Print(L"Invalid image\n");
|
|
|
4210fa |
+ perror(L"Invalid image\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -877,7 +885,7 @@ static EFI_STATUS read_header(void *data, unsigned int datasize,
|
|
|
4210fa |
context->NumberOfSections = PEHdr->Pe32.FileHeader.NumberOfSections;
|
|
|
4210fa |
|
|
|
4210fa |
if (EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES < context->NumberOfRvaAndSizes) {
|
|
|
4210fa |
- Print(L"Image header too small\n");
|
|
|
4210fa |
+ perror(L"Image header too small\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -885,7 +893,7 @@ static EFI_STATUS read_header(void *data, unsigned int datasize,
|
|
|
4210fa |
- sizeof (EFI_IMAGE_DATA_DIRECTORY) * EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
|
|
|
4210fa |
if (((UINT32)PEHdr->Pe32.FileHeader.SizeOfOptionalHeader - HeaderWithoutDataDir) !=
|
|
|
4210fa |
context->NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY)) {
|
|
|
4210fa |
- Print(L"Image header overflows data directory\n");
|
|
|
4210fa |
+ perror(L"Image header overflows data directory\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -895,28 +903,28 @@ static EFI_STATUS read_header(void *data, unsigned int datasize,
|
|
|
4210fa |
+ PEHdr->Pe32.FileHeader.SizeOfOptionalHeader;
|
|
|
4210fa |
if (((UINT32)context->ImageSize - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER
|
|
|
4210fa |
<= context->NumberOfSections) {
|
|
|
4210fa |
- Print(L"Image sections overflow image size\n");
|
|
|
4210fa |
+ perror(L"Image sections overflow image size\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if ((context->SizeOfHeaders - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER
|
|
|
4210fa |
< (UINT32)context->NumberOfSections) {
|
|
|
4210fa |
- Print(L"Image sections overflow section headers\n");
|
|
|
4210fa |
+ perror(L"Image sections overflow section headers\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if ((((UINT8 *)PEHdr - (UINT8 *)data) + sizeof(EFI_IMAGE_OPTIONAL_HEADER_UNION)) > datasize) {
|
|
|
4210fa |
- Print(L"Invalid image\n");
|
|
|
4210fa |
+ perror(L"Invalid image\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (PEHdr->Te.Signature != EFI_IMAGE_NT_SIGNATURE) {
|
|
|
4210fa |
- Print(L"Unsupported image type\n");
|
|
|
4210fa |
+ perror(L"Unsupported image type\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (PEHdr->Pe32.FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) {
|
|
|
4210fa |
- Print(L"Unsupported image - Relocations have been stripped\n");
|
|
|
4210fa |
+ perror(L"Unsupported image - Relocations have been stripped\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -935,23 +943,24 @@ static EFI_STATUS read_header(void *data, unsigned int datasize,
|
|
|
4210fa |
context->FirstSection = (EFI_IMAGE_SECTION_HEADER *)((char *)PEHdr + PEHdr->Pe32.FileHeader.SizeOfOptionalHeader + sizeof(UINT32) + sizeof(EFI_IMAGE_FILE_HEADER));
|
|
|
4210fa |
|
|
|
4210fa |
if (context->ImageSize < context->SizeOfHeaders) {
|
|
|
4210fa |
- Print(L"Invalid image\n");
|
|
|
4210fa |
+ perror(L"Invalid image\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if ((unsigned long)((UINT8 *)context->SecDir - (UINT8 *)data) >
|
|
|
4210fa |
(datasize - sizeof(EFI_IMAGE_DATA_DIRECTORY))) {
|
|
|
4210fa |
- Print(L"Invalid image\n");
|
|
|
4210fa |
+ perror(L"Invalid image\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (context->SecDir->VirtualAddress >= datasize) {
|
|
|
4210fa |
- Print(L"Malformed security header\n");
|
|
|
4210fa |
+ perror(L"Malformed security header\n");
|
|
|
4210fa |
return EFI_INVALID_PARAMETER;
|
|
|
4210fa |
}
|
|
|
4210fa |
return EFI_SUCCESS;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
+
|
|
|
4210fa |
/*
|
|
|
4210fa |
* Once the image has been loaded it needs to be validated and relocated
|
|
|
4210fa |
*/
|
|
|
4210fa |
@@ -971,7 +980,7 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
4210fa |
*/
|
|
|
4210fa |
efi_status = read_header(data, datasize, &context);
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to read header: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to read header: %r\n", efi_status);
|
|
|
4210fa |
return efi_status;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -993,7 +1002,7 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
4210fa |
buffer = AllocatePool(context.ImageSize);
|
|
|
4210fa |
|
|
|
4210fa |
if (!buffer) {
|
|
|
4210fa |
- Print(L"Failed to allocate image buffer\n");
|
|
|
4210fa |
+ perror(L"Failed to allocate image buffer\n");
|
|
|
4210fa |
return EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1013,13 +1022,13 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
4210fa |
end = ImageAddress (buffer, context.ImageSize, Section->VirtualAddress + size - 1);
|
|
|
4210fa |
|
|
|
4210fa |
if (!base || !end) {
|
|
|
4210fa |
- Print(L"Invalid section size\n");
|
|
|
4210fa |
+ perror(L"Invalid section size\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (Section->VirtualAddress < context.SizeOfHeaders ||
|
|
|
4210fa |
Section->PointerToRawData < context.SizeOfHeaders) {
|
|
|
4210fa |
- Print(L"Section is inside image headers\n");
|
|
|
4210fa |
+ perror(L"Section is inside image headers\n");
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1038,7 +1047,7 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
4210fa |
efi_status = relocate_coff(&context, buffer);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Relocation failed: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Relocation failed: %r\n", efi_status);
|
|
|
4210fa |
FreePool(buffer);
|
|
|
4210fa |
return efi_status;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1056,7 +1065,7 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
4210fa |
li->LoadOptionsSize = load_options_size;
|
|
|
4210fa |
|
|
|
4210fa |
if (!entry_point) {
|
|
|
4210fa |
- Print(L"Invalid entry point\n");
|
|
|
4210fa |
+ perror(L"Invalid entry point\n");
|
|
|
4210fa |
FreePool(buffer);
|
|
|
4210fa |
return EFI_UNSUPPORTED;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1079,7 +1088,7 @@ should_use_fallback(EFI_HANDLE image_handle)
|
|
|
4210fa |
rc = uefi_call_wrapper(BS->HandleProtocol, 3, image_handle,
|
|
|
4210fa |
&loaded_image_protocol, (void **)&li;;
|
|
|
4210fa |
if (EFI_ERROR(rc)) {
|
|
|
4210fa |
- Print(L"Could not get image for bootx64.efi: %r\n", rc);
|
|
|
4210fa |
+ perror(L"Could not get image for bootx64.efi: %r\n", rc);
|
|
|
4210fa |
return 0;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1101,13 +1110,13 @@ should_use_fallback(EFI_HANDLE image_handle)
|
|
|
4210fa |
rc = uefi_call_wrapper(BS->HandleProtocol, 3, li->DeviceHandle,
|
|
|
4210fa |
&FileSystemProtocol, (void **)&fio;;
|
|
|
4210fa |
if (EFI_ERROR(rc)) {
|
|
|
4210fa |
- Print(L"Could not get fio for li->DeviceHandle: %r\n", rc);
|
|
|
4210fa |
+ perror(L"Could not get fio for li->DeviceHandle: %r\n", rc);
|
|
|
4210fa |
return 0;
|
|
|
4210fa |
}
|
|
|
4210fa |
-
|
|
|
4210fa |
+
|
|
|
4210fa |
rc = uefi_call_wrapper(fio->OpenVolume, 2, fio, &vh;;
|
|
|
4210fa |
if (EFI_ERROR(rc)) {
|
|
|
4210fa |
- Print(L"Could not open fio volume: %r\n", rc);
|
|
|
4210fa |
+ perror(L"Could not open fio volume: %r\n", rc);
|
|
|
4210fa |
return 0;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1185,7 +1194,7 @@ static EFI_STATUS generate_path(EFI_LOADED_IMAGE *li, CHAR16 *ImagePath,
|
|
|
4210fa |
*PathName = AllocatePool(StrSize(bootpath) + StrSize(ImagePath));
|
|
|
4210fa |
|
|
|
4210fa |
if (!*PathName) {
|
|
|
4210fa |
- Print(L"Failed to allocate path buffer\n");
|
|
|
4210fa |
+ perror(L"Failed to allocate path buffer\n");
|
|
|
4210fa |
efi_status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1226,14 +1235,14 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
4210fa |
(void **)&drive);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to find fs: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to find fs: %r\n", efi_status);
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
efi_status = uefi_call_wrapper(drive->OpenVolume, 2, drive, &root);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to open fs: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to open fs: %r\n", efi_status);
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1244,14 +1253,14 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
4210fa |
EFI_FILE_MODE_READ, 0);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to open %s - %r\n", PathName, efi_status);
|
|
|
4210fa |
+ perror(L"Failed to open %s - %r\n", PathName, efi_status);
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
fileinfo = AllocatePool(buffersize);
|
|
|
4210fa |
|
|
|
4210fa |
if (!fileinfo) {
|
|
|
4210fa |
- Print(L"Unable to allocate file info buffer\n");
|
|
|
4210fa |
+ perror(L"Unable to allocate file info buffer\n");
|
|
|
4210fa |
efi_status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1267,7 +1276,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
4210fa |
FreePool(fileinfo);
|
|
|
4210fa |
fileinfo = AllocatePool(buffersize);
|
|
|
4210fa |
if (!fileinfo) {
|
|
|
4210fa |
- Print(L"Unable to allocate file info buffer\n");
|
|
|
4210fa |
+ perror(L"Unable to allocate file info buffer\n");
|
|
|
4210fa |
efi_status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1277,7 +1286,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Unable to get file info: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Unable to get file info: %r\n", efi_status);
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1286,7 +1295,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
4210fa |
*data = AllocatePool(buffersize);
|
|
|
4210fa |
|
|
|
4210fa |
if (!*data) {
|
|
|
4210fa |
- Print(L"Unable to allocate file buffer\n");
|
|
|
4210fa |
+ perror(L"Unable to allocate file buffer\n");
|
|
|
4210fa |
efi_status = EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1305,7 +1314,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Unexpected return from initial read: %r, buffersize %x\n", efi_status, buffersize);
|
|
|
4210fa |
+ perror(L"Unexpected return from initial read: %r, buffersize %x\n", efi_status, buffersize);
|
|
|
4210fa |
goto error;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1335,6 +1344,7 @@ EFI_STATUS shim_verify (void *buffer, UINT32 size)
|
|
|
4210fa |
PE_COFF_LOADER_IMAGE_CONTEXT context;
|
|
|
4210fa |
|
|
|
4210fa |
loader_is_participating = 1;
|
|
|
4210fa |
+ in_protocol = 1;
|
|
|
4210fa |
|
|
|
4210fa |
if (!secure_mode())
|
|
|
4210fa |
return EFI_SUCCESS;
|
|
|
4210fa |
@@ -1342,9 +1352,35 @@ EFI_STATUS shim_verify (void *buffer, UINT32 size)
|
|
|
4210fa |
status = read_header(buffer, size, &context);
|
|
|
4210fa |
|
|
|
4210fa |
if (status != EFI_SUCCESS)
|
|
|
4210fa |
- return status;
|
|
|
4210fa |
+ goto done;
|
|
|
4210fa |
|
|
|
4210fa |
status = verify_buffer(buffer, size, &context);
|
|
|
4210fa |
+done:
|
|
|
4210fa |
+ in_protocol = 0;
|
|
|
4210fa |
+ return status;
|
|
|
4210fa |
+}
|
|
|
4210fa |
+
|
|
|
4210fa |
+static EFI_STATUS shim_hash (char *data, int datasize,
|
|
|
4210fa |
+ PE_COFF_LOADER_IMAGE_CONTEXT *context,
|
|
|
4210fa |
+ UINT8 *sha256hash, UINT8 *sha1hash)
|
|
|
4210fa |
+{
|
|
|
4210fa |
+ EFI_STATUS status;
|
|
|
4210fa |
+
|
|
|
4210fa |
+ in_protocol = 1;
|
|
|
4210fa |
+ status = generate_hash(data, datasize, context, sha256hash, sha1hash);
|
|
|
4210fa |
+ in_protocol = 0;
|
|
|
4210fa |
+
|
|
|
4210fa |
+ return status;
|
|
|
4210fa |
+}
|
|
|
4210fa |
+
|
|
|
4210fa |
+static EFI_STATUS shim_read_header(void *data, unsigned int datasize,
|
|
|
4210fa |
+ PE_COFF_LOADER_IMAGE_CONTEXT *context)
|
|
|
4210fa |
+{
|
|
|
4210fa |
+ EFI_STATUS status;
|
|
|
4210fa |
+
|
|
|
4210fa |
+ in_protocol = 1;
|
|
|
4210fa |
+ status = read_header(data, datasize, context);
|
|
|
4210fa |
+ in_protocol = 0;
|
|
|
4210fa |
|
|
|
4210fa |
return status;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1371,7 +1407,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
4210fa |
&loaded_image_protocol, (void **)&li;;
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Unable to init protocol\n");
|
|
|
4210fa |
+ perror(L"Unable to init protocol\n");
|
|
|
4210fa |
return efi_status;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1381,20 +1417,20 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
4210fa |
efi_status = generate_path(li, ImagePath, &PathName);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Unable to generate path %s: %r\n", ImagePath, efi_status);
|
|
|
4210fa |
+ perror(L"Unable to generate path %s: %r\n", ImagePath, efi_status);
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
if (findNetboot(li->DeviceHandle)) {
|
|
|
4210fa |
efi_status = parseNetbootinfo(image_handle);
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Netboot parsing failed: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Netboot parsing failed: %r\n", efi_status);
|
|
|
4210fa |
return EFI_PROTOCOL_ERROR;
|
|
|
4210fa |
}
|
|
|
4210fa |
efi_status = FetchNetbootimage(image_handle, &sourcebuffer,
|
|
|
4210fa |
&sourcesize);
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Unable to fetch TFTP image: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Unable to fetch TFTP image: %r\n", efi_status);
|
|
|
4210fa |
return efi_status;
|
|
|
4210fa |
}
|
|
|
4210fa |
data = sourcebuffer;
|
|
|
4210fa |
@@ -1406,7 +1442,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
4210fa |
efi_status = load_image(li, &data, &datasize, PathName);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to load image %s: %r\n", PathName, efi_status);
|
|
|
4210fa |
+ perror(L"Failed to load image %s: %r\n", PathName, efi_status);
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1423,7 +1459,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
4210fa |
efi_status = handle_image(data, datasize, li);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to load image: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to load image: %r\n", efi_status);
|
|
|
4210fa |
CopyMem(li, &li_bak, sizeof(li_bak));
|
|
|
4210fa |
goto done;
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1495,7 +1531,7 @@ EFI_STATUS mirror_mok_list()
|
|
|
4210fa |
;
|
|
|
4210fa |
FullData = AllocatePool(FullDataSize);
|
|
|
4210fa |
if (!FullData) {
|
|
|
4210fa |
- Print(L"Failed to allocate space for MokListRT\n");
|
|
|
4210fa |
+ perror(L"Failed to allocate space for MokListRT\n");
|
|
|
4210fa |
return EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
}
|
|
|
4210fa |
p = FullData;
|
|
|
4210fa |
@@ -1526,7 +1562,7 @@ EFI_STATUS mirror_mok_list()
|
|
|
4210fa |
| EFI_VARIABLE_RUNTIME_ACCESS,
|
|
|
4210fa |
FullDataSize, FullData);
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to set MokListRT: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to set MokListRT: %r\n", efi_status);
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
return efi_status;
|
|
|
4210fa |
@@ -1567,7 +1603,7 @@ EFI_STATUS check_mok_request(EFI_HANDLE image_handle)
|
|
|
4210fa |
efi_status = start_image(image_handle, MOK_MANAGER);
|
|
|
4210fa |
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to start MokManager: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to start MokManager: %r\n", efi_status);
|
|
|
4210fa |
return efi_status;
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
@@ -1601,9 +1637,9 @@ static EFI_STATUS check_mok_sb (void)
|
|
|
4210fa |
* modified by the OS
|
|
|
4210fa |
*/
|
|
|
4210fa |
if (attributes & EFI_VARIABLE_RUNTIME_ACCESS) {
|
|
|
4210fa |
- Print(L"MokSBState is compromised! Clearing it\n");
|
|
|
4210fa |
+ perror(L"MokSBState is compromised! Clearing it\n");
|
|
|
4210fa |
if (LibDeleteVariable(L"MokSBState", &shim_lock_guid) != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to erase MokSBState\n");
|
|
|
4210fa |
+ perror(L"Failed to erase MokSBState\n");
|
|
|
4210fa |
}
|
|
|
4210fa |
status = EFI_ACCESS_DENIED;
|
|
|
4210fa |
} else {
|
|
|
4210fa |
@@ -1642,9 +1678,9 @@ static EFI_STATUS check_mok_db (void)
|
|
|
4210fa |
* modified by the OS
|
|
|
4210fa |
*/
|
|
|
4210fa |
if (attributes & EFI_VARIABLE_RUNTIME_ACCESS) {
|
|
|
4210fa |
- Print(L"MokDBState is compromised! Clearing it\n");
|
|
|
4210fa |
+ perror(L"MokDBState is compromised! Clearing it\n");
|
|
|
4210fa |
if (LibDeleteVariable(L"MokDBState", &shim_lock_guid) != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to erase MokDBState\n");
|
|
|
4210fa |
+ perror(L"Failed to erase MokDBState\n");
|
|
|
4210fa |
}
|
|
|
4210fa |
status = EFI_ACCESS_DENIED;
|
|
|
4210fa |
} else {
|
|
|
4210fa |
@@ -1674,7 +1710,7 @@ static EFI_STATUS mok_ignore_db()
|
|
|
4210fa |
| EFI_VARIABLE_RUNTIME_ACCESS,
|
|
|
4210fa |
DataSize, (void *)&Data);
|
|
|
4210fa |
if (efi_status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print(L"Failed to set MokIgnoreDB: %r\n", efi_status);
|
|
|
4210fa |
+ perror(L"Failed to set MokIgnoreDB: %r\n", efi_status);
|
|
|
4210fa |
}
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1702,7 +1738,7 @@ EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
|
|
|
4210fa |
status = uefi_call_wrapper(BS->HandleProtocol, 3, image_handle,
|
|
|
4210fa |
&LoadedImageProtocol, (void **) &li;;
|
|
|
4210fa |
if (status != EFI_SUCCESS) {
|
|
|
4210fa |
- Print (L"Failed to get load options: %r\n", status);
|
|
|
4210fa |
+ perror (L"Failed to get load options: %r\n", status);
|
|
|
4210fa |
return status;
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
@@ -1746,7 +1782,7 @@ EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
|
|
|
4210fa |
if (loader_len > 0) {
|
|
|
4210fa |
loader_str = AllocatePool((loader_len + 1) * sizeof(CHAR16));
|
|
|
4210fa |
if (!loader_str) {
|
|
|
4210fa |
- Print(L"Failed to allocate loader string\n");
|
|
|
4210fa |
+ perror(L"Failed to allocate loader string\n");
|
|
|
4210fa |
return EFI_OUT_OF_RESOURCES;
|
|
|
4210fa |
}
|
|
|
4210fa |
for (i = 0; i < loader_len; i++)
|
|
|
4210fa |
@@ -1825,8 +1861,8 @@ EFI_STATUS efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *passed_systab)
|
|
|
4210fa |
* call back in and use shim functions
|
|
|
4210fa |
*/
|
|
|
4210fa |
shim_lock_interface.Verify = shim_verify;
|
|
|
4210fa |
- shim_lock_interface.Hash = generate_hash;
|
|
|
4210fa |
- shim_lock_interface.Context = read_header;
|
|
|
4210fa |
+ shim_lock_interface.Hash = shim_hash;
|
|
|
4210fa |
+ shim_lock_interface.Context = shim_read_header;
|
|
|
4210fa |
|
|
|
4210fa |
systab = passed_systab;
|
|
|
4210fa |
|
|
|
4210fa |
--
|
|
|
4210fa |
1.9.3
|
|
|
4210fa |
|