Skip to content

Commit 6b8e40c

Browse files
jsetjevathpela
authored andcommitted
netboot can try to load shim_certificate_[0..9].efi
Since we can't read the directory, we can try to load shim_certificate_[0..9].efi explicitly and give up after the first one that fails to load. Signed-off-by: Jan Setje-Eilers <[email protected]>
1 parent c66ce2a commit 6b8e40c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

shim.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,8 @@ load_revocations_file(EFI_HANDLE image_handle, CHAR16 *FileName, CHAR16 *PathNam
14881488
}
14891489

14901490
EFI_STATUS
1491-
load_cert_file(EFI_HANDLE image_handle, CHAR16 *filename, CHAR16 *PathName)
1491+
load_cert_file(EFI_HANDLE image_handle, CHAR16 *filename, CHAR16 *PathName,
1492+
int flags)
14921493
{
14931494
EFI_STATUS efi_status;
14941495
PE_COFF_LOADER_IMAGE_CONTEXT context;
@@ -1502,8 +1503,7 @@ load_cert_file(EFI_HANDLE image_handle, CHAR16 *filename, CHAR16 *PathName)
15021503
int i;
15031504

15041505
efi_status = read_image(image_handle, filename, &PathName,
1505-
&data, &datasize,
1506-
SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE);
1506+
&data, &datasize, flags);
15071507
if (EFI_ERROR(efi_status))
15081508
return efi_status;
15091509

@@ -1565,13 +1565,15 @@ load_unbundled_trust(EFI_HANDLE image_handle)
15651565
EFI_STATUS efi_status;
15661566
EFI_LOADED_IMAGE *li = NULL;
15671567
CHAR16 *PathName = NULL;
1568+
static CHAR16 FileName[] = L"shim_certificate_0.efi";
15681569
EFI_FILE *root, *dir;
15691570
EFI_FILE_INFO *info;
15701571
EFI_HANDLE device;
15711572
EFI_FILE_IO_INTERFACE *drive;
15721573
UINTN buffersize = 0;
15731574
void *buffer = NULL;
15741575
BOOLEAN search_revocations = TRUE;
1576+
int i = 0;
15751577

15761578
efi_status = gBS->HandleProtocol(image_handle, &EFI_LOADED_IMAGE_GUID,
15771579
(void **)&li);
@@ -1598,6 +1600,11 @@ load_unbundled_trust(EFI_HANDLE image_handle)
15981600
*/
15991601
load_revocations_file(image_handle, SKUSIREVOCATIONFILE, PathName);
16001602
load_revocations_file(image_handle, SBATREVOCATIONFILE, PathName);
1603+
while (load_cert_file(image_handle, FileName, PathName,
1604+
SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE) == EFI_SUCCESS
1605+
&& i++ < 10) {
1606+
FileName[17]++;
1607+
}
16011608
goto done;
16021609
}
16031610

0 commit comments

Comments
 (0)