Skip to content

Commit 726bd89

Browse files
LennySzubowiczardbiesheuvel
authored andcommitted
integrity: Load certs from the EFI MOK config table
Because of system-specific EFI firmware limitations, EFI volatile variables may not be capable of holding the required contents of the Machine Owner Key (MOK) certificate store when the certificate list grows above some size. Therefore, an EFI boot loader may pass the MOK certs via a EFI configuration table created specifically for this purpose to avoid this firmware limitation. An EFI configuration table is a much more primitive mechanism compared to EFI variables and is well suited for one-way passage of static information from a pre-OS environment to the kernel. This patch adds the support to load certs from the MokListRT entry in the MOK variable configuration table, if it's present. The pre-existing support to load certs from the MokListRT EFI variable remains and is used if the EFI MOK configuration table isn't present or can't be successfully used. Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com> Link: https://lore.kernel.org/r/20200905013107.10457-4-lszubowi@redhat.com Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 38a1f03 commit 726bd89

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

security/integrity/platform_certs/load_uefi.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,38 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
7171
* Load the certs contained in the UEFI MokListRT database into the
7272
* platform trusted keyring.
7373
*
74+
* This routine checks the EFI MOK config table first. If and only if
75+
* that fails, this routine uses the MokListRT ordinary UEFI variable.
76+
*
7477
* Return: Status
7578
*/
7679
static int __init load_moklist_certs(void)
7780
{
81+
struct efi_mokvar_table_entry *mokvar_entry;
7882
efi_guid_t mok_var = EFI_SHIM_LOCK_GUID;
7983
void *mok;
8084
unsigned long moksize;
8185
efi_status_t status;
8286
int rc;
8387

88+
/* First try to load certs from the EFI MOKvar config table.
89+
* It's not an error if the MOKvar config table doesn't exist
90+
* or the MokListRT entry is not found in it.
91+
*/
92+
mokvar_entry = efi_mokvar_entry_find("MokListRT");
93+
if (mokvar_entry) {
94+
rc = parse_efi_signature_list("UEFI:MokListRT (MOKvar table)",
95+
mokvar_entry->data,
96+
mokvar_entry->data_size,
97+
get_handler_for_db);
98+
/* All done if that worked. */
99+
if (!rc)
100+
return rc;
101+
102+
pr_err("Couldn't parse MokListRT signatures from EFI MOKvar config table: %d\n",
103+
rc);
104+
}
105+
84106
/* Get MokListRT. It might not exist, so it isn't an error
85107
* if we can't get it.
86108
*/

0 commit comments

Comments
 (0)