-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make SBAT variable payload introspectable
Given a set of EFI variables and boot assets, it should be possible to compute what the value of PCR 7 will be on the next boot. As shim manages the contents of the SbatLevel variable and this is measured to PCR 7, export the payloads that shim contains in a new COFF section (.sbatlevel) so that it can be introspected by code outside of shim. The new section works a bit like .vendor_cert - it contains a header and then the payload. In this case, the header contains no size fields because the strings are NULL terminated. Shim uses this new section internally in set_sbat_uefi_variable. The .sbatlevel section starts with a 4 byte version field which is not used by shim but may be useful for external auditors if the format of the section contents change in the future. Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
- Loading branch information
1 parent
505cdb6
commit 0eb07e1
Showing
11 changed files
with
96 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
#ifndef SBAT_VAR_DEFS_H_ | ||
#define SBAT_VAR_DEFS_H_ | ||
|
||
#define SBAT_VAR_SIG "sbat," | ||
#define SBAT_VAR_VERSION "1," | ||
#define SBAT_VAR_ORIGINAL_DATE "2021030218" | ||
#define SBAT_VAR_ORIGINAL \ | ||
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_ORIGINAL_DATE "\n" | ||
|
||
#if defined(ENABLE_SHIM_DEVEL) | ||
#define SBAT_VAR_PREVIOUS_DATE "2022020101" | ||
#define SBAT_VAR_PREVIOUS_REVOCATIONS "component,2\n" | ||
#define SBAT_VAR_PREVIOUS \ | ||
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_PREVIOUS_DATE "\n" \ | ||
SBAT_VAR_PREVIOUS_REVOCATIONS | ||
|
||
#define SBAT_VAR_LATEST_DATE "2022050100" | ||
#define SBAT_VAR_LATEST_REVOCATIONS "component,2\nothercomponent,2\n" | ||
#define SBAT_VAR_LATEST \ | ||
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_LATEST_DATE "\n" \ | ||
SBAT_VAR_LATEST_REVOCATIONS | ||
#else /* !ENABLE_SHIM_DEVEL */ | ||
#define SBAT_VAR_PREVIOUS_DATE SBAT_VAR_ORIGINAL_DATE | ||
#define SBAT_VAR_PREVIOUS_REVOCATIONS | ||
#define SBAT_VAR_PREVIOUS \ | ||
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_PREVIOUS_DATE "\n" \ | ||
SBAT_VAR_PREVIOUS_REVOCATIONS | ||
|
||
#define SBAT_VAR_LATEST_DATE "2022052400" | ||
#define SBAT_VAR_LATEST_REVOCATIONS "shim,2\ngrub,2\n" | ||
#define SBAT_VAR_LATEST \ | ||
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_LATEST_DATE "\n" \ | ||
SBAT_VAR_LATEST_REVOCATIONS | ||
#endif /* ENABLE_SHIM_DEVEL */ | ||
|
||
#endif /* !SBAT_VAR_DEFS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
#include "include/sbat_var_defs.h" | ||
|
||
.section .sbatlevel, "a", %progbits | ||
.balignl 4, 0 | ||
.4byte 0 /* format version for external parsers */ | ||
.globl sbat_var_payload_header | ||
.type sbat_var_payload_header, %object | ||
.size sbat_var_payload_header, .Lsbat_var_payload_header_end - sbat_var_payload_header | ||
sbat_var_payload_header: | ||
.4byte .Lsbat_var_previous - sbat_var_payload_header | ||
.4byte .Lsbat_var_latest - sbat_var_payload_header | ||
.Lsbat_var_payload_header_end: | ||
.balign 1, 0 | ||
.Lsbat_var_previous: | ||
.asciz SBAT_VAR_PREVIOUS | ||
.balign 1, 0 | ||
.Lsbat_var_latest: | ||
.asciz SBAT_VAR_LATEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters