Skip to content

Commit 74f5e30

Browse files
esnowbergjarkkojs
authored andcommitted
integrity: Trust MOK keys if MokListTrustedRT found
A new Machine Owner Key (MOK) variable called MokListTrustedRT has been introduced in shim. When this UEFI variable is set, it indicates the end-user has made the decision themselves that they wish to trust MOK keys within the Linux trust boundary. It is not an error if this variable does not exist. If it does not exist, the MOK keys should not be trusted within the kernel. Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
1 parent 847c533 commit 74f5e30

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

security/integrity/platform_certs/machine_keyring.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (c) 2021, Oracle and/or its affiliates.
66
*/
77

8+
#include <linux/efi.h>
89
#include "../integrity.h"
910

1011
static __init int machine_keyring_init(void)
@@ -40,3 +41,21 @@ void __init add_to_machine_keyring(const char *source, const void *data, size_t
4041
if (rc)
4142
pr_info("Error adding keys to machine keyring %s\n", source);
4243
}
44+
45+
/*
46+
* Try to load the MokListTrustedRT MOK variable to see if we should trust
47+
* the MOK keys within the kernel. It is not an error if this variable
48+
* does not exist. If it does not exist, MOK keys should not be trusted
49+
* within the machine keyring.
50+
*/
51+
static __init bool uefi_check_trust_mok_keys(void)
52+
{
53+
struct efi_mokvar_table_entry *mokvar_entry;
54+
55+
mokvar_entry = efi_mokvar_entry_find("MokListTrustedRT");
56+
57+
if (mokvar_entry)
58+
return true;
59+
60+
return false;
61+
}

0 commit comments

Comments
 (0)