Skip to content

Commit 6602e1d

Browse files
committed
fix(bootloader-interface): use the correct uefi revision and firmware revision format
1 parent 7bd93f5 commit 6602e1d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/integrations/bootloader_interface.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,17 @@ impl BootloaderInterface {
118118
/// Tell the system about the UEFI firmware we are running on.
119119
pub fn set_firmware_info() -> Result<()> {
120120
// Access the firmware revision.
121-
let revision = uefi::system::firmware_revision();
121+
let firmware_revision = uefi::system::firmware_revision();
122+
123+
// Access the UEFI revision.
124+
let uefi_revision = uefi::system::uefi_revision();
122125

123126
// Format the firmware information string into something human-readable.
124127
let firmware_info = format!(
125128
"{} {}.{:02}",
126129
uefi::system::firmware_vendor(),
127-
revision >> 16,
128-
revision & 0xffff,
130+
firmware_revision >> 16,
131+
firmware_revision & 0xffff,
129132
);
130133
Self::VENDOR.set_cstr16(
131134
"LoaderFirmwareInfo",
@@ -134,7 +137,11 @@ impl BootloaderInterface {
134137
)?;
135138

136139
// Format the firmware revision into something human-readable.
137-
let firmware_type = format!("UEFI {}.{:02}", revision >> 16, revision & 0xffff);
140+
let firmware_type = format!(
141+
"UEFI {}.{:02}",
142+
uefi_revision.major(),
143+
uefi_revision.minor()
144+
);
138145
Self::VENDOR.set_cstr16(
139146
"LoaderFirmwareType",
140147
&firmware_type,

src/integrations/shim.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ impl ShimSupport {
198198

199199
// Call the shim verify function.
200200
// SAFETY: The shim verify function is specified by the shim lock protocol.
201-
// Calling this function is considered safe because
201+
// Calling this function is considered safe because the shim verify function is
202+
// guaranteed to be defined by the environment if we are able to acquire the protocol.
202203
let status =
203204
unsafe { (protocol.shim_verify)(buffer.as_ptr() as *mut c_void, buffer.len() as u32) };
204205

0 commit comments

Comments
 (0)