Commit cfdd8a8e authored by David Howells's avatar David Howells

efi: Handle secure boot from UEFI-2.6

UEFI-2.6 adds a new variable, DeployedMode.  If it exists, this must be 1
if we're to engage lockdown mode.
Reported-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent ebd957d0
...@@ -22,6 +22,9 @@ static const efi_char16_t const efi_SecureBoot_name[] = { ...@@ -22,6 +22,9 @@ static const efi_char16_t const efi_SecureBoot_name[] = {
static const efi_char16_t const efi_SetupMode_name[] = { static const efi_char16_t const efi_SetupMode_name[] = {
'S', 'e', 't', 'u', 'p', 'M', 'o', 'd', 'e', 0 'S', 'e', 't', 'u', 'p', 'M', 'o', 'd', 'e', 0
}; };
static const efi_char16_t const efi_DeployedMode_name[] = {
'D', 'e', 'p', 'l', 'o', 'y', 'e', 'd', 'M', 'o', 'd', 'e', 0
};
/* SHIM variables */ /* SHIM variables */
static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID; static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID;
...@@ -40,7 +43,7 @@ static efi_char16_t const shim_MokSBState_name[] = { ...@@ -40,7 +43,7 @@ static efi_char16_t const shim_MokSBState_name[] = {
enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg) enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg)
{ {
u32 attr; u32 attr;
u8 secboot, setupmode, moksbstate; u8 secboot, setupmode, deployedmode, moksbstate;
unsigned long size; unsigned long size;
efi_status_t status; efi_status_t status;
...@@ -59,6 +62,17 @@ enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg) ...@@ -59,6 +62,17 @@ enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg)
if (secboot == 0 || setupmode == 1) if (secboot == 0 || setupmode == 1)
return efi_secureboot_mode_disabled; return efi_secureboot_mode_disabled;
/* UEFI-2.6 requires DeployedMode to be 1. */
if (sys_table_arg->hdr.revision >= EFI_2_60_SYSTEM_TABLE_REVISION) {
size = sizeof(deployedmode);
status = get_efi_var(efi_DeployedMode_name, &efi_variable_guid,
NULL, &size, &deployedmode);
if (status != EFI_SUCCESS)
goto out_efi_err;
if (deployedmode == 0)
return efi_secureboot_mode_disabled;
}
/* See if a user has put shim into insecure mode. If so, and if the /* See if a user has put shim into insecure mode. If so, and if the
* variable doesn't have the runtime attribute set, we might as well * variable doesn't have the runtime attribute set, we might as well
* honor that. * honor that.
......
...@@ -646,6 +646,10 @@ typedef struct { ...@@ -646,6 +646,10 @@ typedef struct {
#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
#define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60))
#define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50))
#define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))
#define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))
#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30)) #define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
#define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20)) #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))
#define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10)) #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment