[edk2] Secureboot enable with OVMF

Laszlo Ersek lersek at redhat.com
Thu Dec 13 02:49:06 PST 2018

On 12/13/18 02:25, Park, Kyung Min wrote:
> Hi,
> I'm trying to enable the secureboot with OVMF. I followed the steps as below.
> But When I executed LockDown.efi, it gives me an error which says, "Failed to enroll PK: 26".
> According to UEFI spec, the 26 means EFI_SECURITY_VIOLATION, but I don't understand why I got this error.
> Before I ran the LockDown.efi, the secureboot was disabled by default and the PK key was not enrolled.
> 1. Build OVMF with secureboot enable
> https://wiki.ubuntu.com/UEFI/EDK2

Please know that, if you build OVMF with *just* SECURE_BOOT_ENABLE, but
without SMM_REQUIRE, then a malicious guest OS may modify the pflash
chip with direct hardware access that contains the authenticated UEFI
variables. In other words, a malicious guest OS may circumvent Secure Boot.

If that's OK for your use case (it could be), then it's OK to use just
SECURE_BOOT_ENABLE; but it should be a conscious decision.

Regarding SMM_REQUIRE, please see OvmfPkg/README, section "SMM support".

> 2. Generate/Execute LockDown.efi to enroll PK/KEK/DB keys
> git://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git
> I would appreciate any useful information about this error.

You'll have to dig into LockDown.efi for that. If you are convinced
LockDown.efi does the right thing, then you'll have to add debug
messages to the edk2 stack that handles authenticated variables (the
variable driver, some SecurityPkg / CryptoPkg libraries, etc). This is
usually quite time consuming.

As an alternative, you might be able to use
"/usr/share/edk2/ovmf/EnrollDefaultKeys.efi", from the "edk2-ovmf"
subpackage package, from


(You can find the source code in the SRPM.)


More information about the edk2-devel mailing list