From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web09.1301.1622655627275073725 for ; Wed, 02 Jun 2021 10:40:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=eB5OsYOi; spf=pass (domain: akeo.ie, ip: 209.85.128.52, mailfrom: pete@akeo.ie) Received: by mail-wm1-f52.google.com with SMTP id h12-20020a05600c350cb029019fae7a26cdso2124021wmq.5 for ; Wed, 02 Jun 2021 10:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0nYZOlyumUkyadTkY3pZO9s0KZcIpp/CZqR0Fo4vQQ8=; b=eB5OsYOin4Pf0l4wZGChLAk4yesbG1WJxnfrJoHdPAtnbBE5k0dpuurRaHv73tgAgl d+Na3ZH2d0drFq6/gYNHIZ+jrmXEEtNhZ83t2IqqyfnHQGCq4nJrOOOHS3dYkEZKYgmp /UlX4rtQl84N7ItV1gWmcSFIU+UpCY90x6zMCMXvFU2uNVS29K5VG1DtVn7gBkySsi5O X37njiCcRmUc5zCltUeeP17COKLMuMdmKIibHHGefkOa+yBDH1F4u0dPLzylZFizlpRx edfXxaKyGOZztaS2hv7UO637sKkAljOohpTS+TO78CuA0RtUitZOGVrbt73db1EMQLgs INTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0nYZOlyumUkyadTkY3pZO9s0KZcIpp/CZqR0Fo4vQQ8=; b=LOdsBprv6ar3wIaF5rN1C7NjFgATe7GpVCdDcv6JgFYZVjV1RjG/siqdlTz+0VFzVi ke9cBBW96L4NYopL328vLB9HvFvmkplfpeoBPrONchHdMUoSDV69lOAjmu+t6RgPk4om 45AfJsXcugAbI8NMldF9Phkin1Uq0Vs/OqyAAhONUxksaRfVSbaaf0AFJ97O4rtUL0Ix YfkqlvjSwzFNpa60p9qdGA2nj0ydWnJjiQ8jkbJ9+QdKZT0Tn/oGfWRP+y2viRYpbiWE jafQuFOS4p4aIUIVqJJNzLnVSrSGBvlxkyQMCWQhakPY1JjV6W/5WMLH8DIiHHasCC/S PSwQ== X-Gm-Message-State: AOAM5330Rm8wZXZ5EyrMt2Y8V6O4N0XEVJVxCH+ef/g3nlSbLJmBReou DtuO70KiuCQ5Kc85lvS4A36I/Q== X-Google-Smtp-Source: ABdhPJygfWSxi4hKX4ptMK0x438HbehpV9EuI+s5JGtLk5JXD0dTGA5SCQLlk/PDfVi0FPUuawTpdQ== X-Received: by 2002:a05:600c:198c:: with SMTP id t12mr32332780wmq.145.1622655625893; Wed, 02 Jun 2021 10:40:25 -0700 (PDT) Return-Path: Received: from [10.0.0.122] ([84.203.86.196]) by smtp.googlemail.com with ESMTPSA id c206sm3467955wmf.12.2021.06.02.10.40.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 10:40:25 -0700 (PDT) Subject: Re: [edk2-devel] [edk2-platforms PATCH v2] Platform/RaspberryPi: Enable default Secure Boot variables initialization To: devel@edk2.groups.io, gjb@semihalf.com Cc: leif@nuviainc.com, ardb+tianocore@kernel.org, Samer.El-Haj-Mahmoud@arm.com, sunny.Wang@arm.com, mw@semihalf.com, upstream@semihalf.com, jiewen.yao@intel.com, jian.j.wang@intel.com, min.m.xu@intel.com, lersek@redhat.com References: <20210601131229.630611-1-gjb@semihalf.com> <20210601131229.630611-2-gjb@semihalf.com> From: "Pete Batard" Message-ID: Date: Wed, 2 Jun 2021 18:40:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210601131229.630611-2-gjb@semihalf.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit This whole patch series looks fine to me. I have tested it on Raspberry Pi 4, and I have some changes lined up to ensure that the next Pi 4 firmware we produce, after this series has been integrated, can use the new feature. For the record, since we are using an automated build system (and the Pi 4 can't exactly be considered as a secure platform anyway), my plan is to discard the PK's private key and include only MS KEK and DBs for the time being. Basically, it should go something like this: openssl req -new -x509 -newkey rsa:2048 -subj "/CN=Raspberry Pi Platform Key/" -keyout /dev/null -outform DER -out keys/pk.cer -days 7300 -nodes -sha256 curl -L https://go.microsoft.com/fwlink/?LinkId=321185 -o keys/ms_kek.cer curl -L https://go.microsoft.com/fwlink/?linkid=321192 -o keys/ms_db1.crt curl -L https://go.microsoft.com/fwlink/?linkid=321194 -o keys/ms_db2.crt curl -L https://uefi.org/sites/default/files/resources/dbxupdate_arm64.bin -o keys/arm64_dbx.bin and then use the files above for the DEFAULT_FILE vars. With this, I was able to get the default keys installed using the new Secure Boot menu, and validated that something like the Windows bootloader would load properly, whereas an unsigned bootloader such as the GRUB one wouldn't. Please find my formal R-b for this patch below: On 2021.06.01 14:12, Grzegorz Bernacki wrote: > This commit allows to initialize Secure Boot default key > and databases from data embedded in firmware binary. > > Signed-off-by: Grzegorz Bernacki > --- > Platform/RaspberryPi/RPi4/RPi4.dsc | 5 ++++- > Platform/RaspberryPi/RPi4/RPi4.fdf | 2 ++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc > index d8c6fdd4bd..1fb4df0b81 100644 > --- a/Platform/RaspberryPi/RPi4/RPi4.dsc > +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc > @@ -164,7 +164,7 @@ > !if $(SECURE_BOOT_ENABLE) == TRUE > TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf > AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf > - > + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf > # re-use the UserPhysicalPresent() dummy implementation from the ovmf tree > PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf > !else > @@ -217,6 +217,7 @@ > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf > HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf > ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf > + ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf > FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf > > [LibraryClasses.common.UEFI_DRIVER] > @@ -612,6 +613,8 @@ > NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf > } > SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf > + SecurityPkg/EnrollFromDefaultKeysApp/EnrollFromDefaultKeysApp.inf > + SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.inf > !else > MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf > !endif > diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4/RPi4.fdf > index 1e13909a57..0e43d24c7a 100644 > --- a/Platform/RaspberryPi/RPi4/RPi4.fdf > +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf > @@ -189,7 +189,9 @@ READ_LOCK_STATUS = TRUE > INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf > INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf > !if $(SECURE_BOOT_ENABLE) == TRUE > +!include SecurityPkg/SecureBootDefaultKeys.fdf.inc > INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf > + INF SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.inf > !endif > INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf > INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf > Reviewed-by: Pete Batard Tested-by: Pete Batard