From 1508ece179267943bad5851010eba8c00570c0ed Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 17 Jan 2025 14:13:46 -0500 Subject: Move is_removable_media_path() to a shared location. We need to use is_removable_media_path(), and potentially other helpers, from Mok as well as shim. This moves it to a file just for Device Path utility functions to make that simpler. Signed-off-by: Peter Jones --- shim.c | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'shim.c') diff --git a/shim.c b/shim.c index bb54993f..c447c3d3 100644 --- a/shim.c +++ b/shim.c @@ -778,39 +778,6 @@ verify_buffer (char *data, int datasize, return verify_buffer_sbat(data, datasize, context); } -static int -is_removable_media_path(EFI_LOADED_IMAGE *li) -{ - unsigned int pathlen = 0; - CHAR16 *bootpath = NULL; - int ret = 0; - - bootpath = DevicePathToStr(li->FilePath); - - /* Check the beginning of the string and the end, to avoid - * caring about which arch this is. */ - /* I really don't know why, but sometimes bootpath gives us - * L"\\EFI\\BOOT\\/BOOTX64.EFI". So just handle that here... - */ - if (StrnCaseCmp(bootpath, L"\\EFI\\BOOT\\BOOT", 14) && - StrnCaseCmp(bootpath, L"\\EFI\\BOOT\\/BOOT", 15) && - StrnCaseCmp(bootpath, L"EFI\\BOOT\\BOOT", 13) && - StrnCaseCmp(bootpath, L"EFI\\BOOT\\/BOOT", 14)) - goto error; - - pathlen = StrLen(bootpath); - if (pathlen < 5 || StrCaseCmp(bootpath + pathlen - 4, L".EFI")) - goto error; - - ret = 1; - -error: - if (bootpath) - FreePool(bootpath); - - return ret; -} - static int should_use_fallback(EFI_HANDLE image_handle) { -- cgit v1.2.3