Skip to content

Commit

Permalink
Build time selectable automatic SBATLevel revocations
Browse files Browse the repository at this point in the history
The ability to automatically apply SBATLevel revocations varies
from distro to distro. This allows distros that are able to
automatically apply SBATLevel revocations when shim is updated to
select a level by supplying SBAT_AUTOMATIC_DATE=<datestamp> on the
make command line. Currently the following options are available:

2021030218 no revocations - useful for distros that need to rely on
                            an externally delivered revocations.efi

2022052400 grub,2

2022111500 shim,2
	   grub,3

2023012900 shim,2
           grub,3
           grub.debian,4

If no datestamp is specified the build will default to the
most recent 2023012900.

Signed-off-by: Jan Setje-Eilers <[email protected]>
  • Loading branch information
jsetje authored and vathpela committed Jan 22, 2024
1 parent 30a4f37 commit 6f395c2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Make.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ endif
ifneq ($(origin VENDOR_DBX_FILE), undefined)
DEFINES += -DVENDOR_DBX_FILE=\"$(VENDOR_DBX_FILE)\"
endif
ifneq ($(origin SBAT_AUTOMATIC_DATE), undefined)
DEFINES += -DSBAT_AUTOMATIC_DATE=$(SBAT_AUTOMATIC_DATE)
endif
LDFLAGS = --hash-style=sysv -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(LOCAL_EFI_PATH) -L$(LIBDIR) -LCryptlib -LCryptlib/OpenSSL $(EFI_CRT_OBJS) --build-id=sha1 $(ARCH_LDFLAGS) --no-undefined
Expand Down
33 changes: 28 additions & 5 deletions include/sbat_var_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#ifndef SBAT_VAR_DEFS_H_
#define SBAT_VAR_DEFS_H_

#define QUOTEVAL(s) QUOTE(s)
#define QUOTE(s) #s

/*
* This is the entry for the sbat data format
*/
Expand All @@ -23,14 +26,34 @@
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_LATEST_DATE "\n" \
SBAT_VAR_LATEST_REVOCATIONS
#else /* !ENABLE_SHIM_DEVEL */

/*
* At this point we do not want shim to automatically apply a
* revocation unless it is delivered by a separately installed
* signed revocations binary.
* Some distros may want to apply revocations from 2022052400
* or 2022111500 automatically. They can be selected by setting
* SBAT_AUTOMATIC_DATE=<datestamp> at build time. Otherwise the
* default is to apply the second to most recent revocations
* automatically. Distros that need to manage automatic updates
* externally from shim can choose the epoch 2021030218 emtpy
* revocations.
*/
#define SBAT_VAR_AUTOMATIC_DATE "2021030218"
#ifndef SBAT_AUTOMATIC_DATE
#define SBAT_AUTOMATIC_DATE 2023012900
#endif /* SBAT_AUTOMATIC_DATE */
#if SBAT_AUTOMATIC_DATE == 2021030218
#define SBAT_VAR_AUTOMATIC_REVOCATIONS
#elif SBAT_AUTOMATIC_DATE == 2022052400
#define SBAT_VAR_AUTOMATIC_REVOCATIONS "grub,2\n"
#elif SBAT_AUTOMATIC_DATE == 2022111500
#define SBAT_VAR_AUTOMATIC_REVOCATIONS "shim,2\ngrub,3\n"
#elif SBAT_AUTOMATIC_DATE == 2023012900
#define SBAT_VAR_AUTOMATIC_REVOCATIONS "shim,2\ngrub,3\ngrub.debian,4\n"
#else
#error "Unknown SBAT_AUTOMATIC_DATE"
#endif /* SBAT_AUTOMATIC_DATE == */
#define SBAT_VAR_AUTOMATIC_DATE QUOTEVAL(SBAT_AUTOMATIC_DATE)
#define SBAT_VAR_AUTOMATIC \
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_AUTOMATIC_DATE "\n"
SBAT_VAR_SIG SBAT_VAR_VERSION SBAT_VAR_AUTOMATIC_DATE "\n" \
SBAT_VAR_AUTOMATIC_REVOCATIONS

/*
* Revocations for January 2024 shim CVEs
Expand Down

0 comments on commit 6f395c2

Please sign in to comment.