From 6602e1d69e2d2aeb6d8165ea868cfca4ad855984 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 30 Oct 2025 23:58:07 -0400 Subject: [PATCH] fix(bootloader-interface): use the correct uefi revision and firmware revision format --- src/integrations/bootloader_interface.rs | 15 +++++++++++---- src/integrations/shim.rs | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/integrations/bootloader_interface.rs b/src/integrations/bootloader_interface.rs index 31cfa5a..3e5b375 100644 --- a/src/integrations/bootloader_interface.rs +++ b/src/integrations/bootloader_interface.rs @@ -118,14 +118,17 @@ impl BootloaderInterface { /// Tell the system about the UEFI firmware we are running on. pub fn set_firmware_info() -> Result<()> { // Access the firmware revision. - let revision = uefi::system::firmware_revision(); + let firmware_revision = uefi::system::firmware_revision(); + + // Access the UEFI revision. + let uefi_revision = uefi::system::uefi_revision(); // Format the firmware information string into something human-readable. let firmware_info = format!( "{} {}.{:02}", uefi::system::firmware_vendor(), - revision >> 16, - revision & 0xffff, + firmware_revision >> 16, + firmware_revision & 0xffff, ); Self::VENDOR.set_cstr16( "LoaderFirmwareInfo", @@ -134,7 +137,11 @@ impl BootloaderInterface { )?; // Format the firmware revision into something human-readable. - let firmware_type = format!("UEFI {}.{:02}", revision >> 16, revision & 0xffff); + let firmware_type = format!( + "UEFI {}.{:02}", + uefi_revision.major(), + uefi_revision.minor() + ); Self::VENDOR.set_cstr16( "LoaderFirmwareType", &firmware_type, diff --git a/src/integrations/shim.rs b/src/integrations/shim.rs index e869d04..1bf3f2b 100644 --- a/src/integrations/shim.rs +++ b/src/integrations/shim.rs @@ -198,7 +198,8 @@ impl ShimSupport { // Call the shim verify function. // SAFETY: The shim verify function is specified by the shim lock protocol. - // Calling this function is considered safe because + // Calling this function is considered safe because the shim verify function is + // guaranteed to be defined by the environment if we are able to acquire the protocol. let status = unsafe { (protocol.shim_verify)(buffer.as_ptr() as *mut c_void, buffer.len() as u32) };