shared/efi-loader: fix compilation with !ENABLE_EFI, improve messages
When compiled without ENABLE_EFI, efi_stub_measured() was not defined, so compilation would fail. But it's not enough to add a stub that returns -EOPNOTSUPP. We call this function in various places and usually print the error at warning or error level, so we'd print a confusing message. We also can't add a stub that always returns 0, because then we'd print a message like "Kernel stub did not measure", which would be confusing too. Adding special handling for -EOPNOTSUPP in every caller is also unattractive. So instead efi_stub_measured() is reworked to log the warning or error internally, and such logging is removed from the callers, and a stub is added that logs a custom message.
This commit is contained in:
committed by
Luca Boccassi
parent
1d62f3a7a1
commit
2f6c52b919
@@ -828,9 +828,9 @@ static int measure_volume_key(
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = efi_stub_measured();
|
||||
r = efi_stub_measured(LOG_WARNING);
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to detect if we are running on a kernel image with TPM measurement enabled: %m");
|
||||
return r;
|
||||
if (r == 0) {
|
||||
log_debug("Kernel stub did not measure kernel image into the expected PCR, skipping userspace measurement, too.");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user