diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index e2dd95b3c4..7ec76eeff2 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -355,6 +355,17 @@ UefiMain ( EFI_HANDLE ConInHandle; EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn; SPLIT_LIST *Split; + UINT8 *SecureBoot; + + // If Secure Boot is enabled, do not launch the UEFI shell + SecureBoot = NULL; + GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, (VOID **)&SecureBoot, NULL); + if ((SecureBoot != NULL) && (*SecureBoot == SECURE_BOOT_MODE_ENABLE)) { + FreePool (SecureBoot); + return EFI_SECURITY_VIOLATION; + } else if (SecureBoot != NULL) { + FreePool (SecureBoot); + } if (PcdGet8 (PcdShellSupportLevel) > 3) { return (EFI_UNSUPPORTED); diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h index 3704ae056b..63ab09ce56 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -13,6 +13,8 @@ #include #include +#include +#include #include #include