From: "Min Xu" <min.m.xu@intel.com>
To: Grzegorz Bernacki <gjb@semihalf.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "leif@nuviainc.com" <leif@nuviainc.com>,
"ardb+tianocore@kernel.org" <ardb+tianocore@kernel.org>,
"Samer.El-Haj-Mahmoud@arm.com" <Samer.El-Haj-Mahmoud@arm.com>,
"sunny.Wang@arm.com" <sunny.Wang@arm.com>,
"mw@semihalf.com" <mw@semihalf.com>,
"upstream@semihalf.com" <upstream@semihalf.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Wang, Jian J" <jian.j.wang@intel.com>,
"lersek@redhat.com" <lersek@redhat.com>
Subject: Re: [PATCH v2 3/6] SecurityPkg: Add SecureBootDefaultKeysDxe driver
Date: Fri, 4 Jun 2021 08:02:52 +0000 [thread overview]
Message-ID: <PH0PR11MB5064538F4B53169D7609F321C53B9@PH0PR11MB5064.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210601131229.630611-5-gjb@semihalf.com>
On June 1, 2021 9:12 PM, Grzegorz Bernacki Wrote:
> This driver initializes default Secure Boot keys and databases based on keys
> embedded in flash.
>
> Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
> ---
>
> SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootD
> efaultKeysDxe.inf | 46 +++++++++++++
>
> SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootD
> efaultKeysDxe.c | 69 ++++++++++++++++++++
>
> SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootD
> efaultKeysDxe.uni | 17 +++++
> 3 files changed, 132 insertions(+)
> create mode 100644
> SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootD
> efaultKeysDxe.inf
> create mode 100644
> SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootD
> efaultKeysDxe.c
> create mode 100644
> SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootD
> efaultKeysDxe.uni
>
> diff --git
> a/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBoo
> tDefaultKeysDxe.inf
> b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBoo
> tDefaultKeysDxe.inf
> new file mode 100644
> index 0000000000..27345eab2e
> --- /dev/null
> +++
> b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureB
> +++ ootDefaultKeysDxe.inf
> @@ -0,0 +1,46 @@
> +## @file
> +# Initializes Secure Boot default keys # # Copyright (c) 2021, ARM
> +Ltd. All rights reserved.<BR> # Copyright (c) 2021, Semihalf All
> +rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent #
> +## [Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = SecureBootDefaultKeysDxe
> + FILE_GUID = C937FCB7-25AC-4376-89A2-4EA8B317DE83
> + MODULE_TYPE = DXE_DRIVER
> + ENTRY_POINT = SecureBootDefaultKeysEntryPoint
> +
> +#
> +# VALID_ARCHITECTURES = IA32 X64 AARCH64
> +#
> +[Sources]
> + SecureBootDefaultKeysDxe.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + SecurityPkg/SecurityPkg.dec
> +
> +[LibraryClasses]
> + BaseLib
> + BaseMemoryLib
> + MemoryAllocationLib
> + UefiDriverEntryPoint
> + DebugLib
> + SecureBootVariableLib
> +
> +[Guids]
> + ## SOMETIMES_PRODUCES ## Variable:L"PKDefault"
> + ## SOMETIMES_PRODUCES ## Variable:L"KEKDefault"
> + ## SOMETIMES_PRODUCES ## Variable:L"dbDefault"
> + ## SOMETIMES_PRODUCES ## Variable:L"dbtDefault"
> + ## SOMETIMES_PRODUCES ## Variable:L"dbxDefault"
> + gEfiGlobalVariableGuid
> +
> +[Depex]
> + gEfiVariableArchProtocolGuid AND
> + gEfiVariableWriteArchProtocolGuid
> +
> diff --git
> a/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBoo
> tDefaultKeysDxe.c
> b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBoo
> tDefaultKeysDxe.c
> new file mode 100644
> index 0000000000..0928489e15
> --- /dev/null
> +++
> b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureB
> +++ ootDefaultKeysDxe.c
> @@ -0,0 +1,69 @@
> +/** @file
> + This driver init default Secure Boot variables
> +
> +Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> Copyright (c)
> +2021, Semihalf All rights reserved.<BR>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +#include <Guid/AuthenticatedVariableFormat.h>
> +#include <Guid/ImageAuthentication.h>
> +#include <Library/BaseLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h> #include
> +<Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiRuntimeServicesTableLib.h>
> +#include <Library/SecureBootVariableLib.h>
> +
> +/**
> + The entry point for SecureBootDefaultKeys driver.
> +
> + @param[in] ImageHandle The image handle of the driver.
> + @param[in] SystemTable The system table.
> +
> + @retval EFI_ALREADY_STARTED The driver already exists in system.
> + @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack
> of resources.
> + @retval EFI_SUCCESS All the related protocols are installed on the
> driver.
> + @retval Others Fail to get the SecureBootEnable variable.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +SecureBootDefaultKeysEntryPoint (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = SecureBootInitPKDefault ();
> + if (EFI_ERROR (Status)) {
> + DEBUG((DEBUG_ERROR, "%a: Cannot initialize PKDefault: %r\n",
> __FUNCTION__, Status));
> + return Status;
> + }
> +
> + Status = SecureBootInitKEKDefault (); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Cannot initialize KEKDefault: %r\n",
> __FUNCTION__, Status));
> + return Status;
> + }
> + Status = SecureBootInitdbDefault ();
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Cannot initialize dbDefault: %r\n",
> __FUNCTION__, Status));
> + return Status;
> + }
> +
> + Status = SecureBootInitdbtDefault (); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_INFO, "%a: dbtDefault not initialized\n",
> + __FUNCTION__)); }
> +
> + Status = SecureBootInitdbxDefault (); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_INFO, "%a: dbxDefault not initialized\n",
> + __FUNCTION__)); }
> +
> + return Status;
> +}
> +
> diff --git
> a/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBoo
> tDefaultKeysDxe.uni
> b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBoo
> tDefaultKeysDxe.uni
> new file mode 100644
> index 0000000000..30f03aee5d
> --- /dev/null
> +++
> b/SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureB
> +++ ootDefaultKeysDxe.uni
> @@ -0,0 +1,17 @@
> +// /** @file
> +// Provides the capability to intialize Secure Boot default variables
> +// // Module which initializes Secure boot default variables.
> +//
> +// Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> // Copyright
> +(c) 2021, Semihalf All rights reserved.<BR> // //
> +SPDX-License-Identifier: BSD-2-Clause-Patent // // **/
> +
> +
> +#string STR_MODULE_ABSTRACT #language en-US "Module which
> initializes Secure boot default variables"
> +
> +#string STR_MODULE_DESCRIPTION #language en-US "This module
> reads embedded keys and initializes Secure Boot default variables."
> +
> --
> 2.25.1
It looks good to me.
next prev parent reply other threads:[~2021-06-04 8:03 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 13:12 [PATCH v2 0/6] Secure Boot default keys Grzegorz Bernacki
2021-06-01 13:12 ` [edk2-platforms PATCH v2] Platform/RaspberryPi: Enable default Secure Boot variables initialization Grzegorz Bernacki
2021-06-02 17:40 ` [edk2-devel] " Pete Batard
2021-06-04 8:35 ` Sunny Wang
2021-07-08 18:37 ` Samer El-Haj-Mahmoud
2021-06-01 13:12 ` [PATCH v2 1/6] SecurityPkg: Create library for setting Secure Boot variables Grzegorz Bernacki
2021-06-02 17:39 ` [edk2-devel] " Pete Batard
2021-06-02 19:43 ` [EXTERNAL] " Bret Barkelew
2021-06-03 6:56 ` Min Xu
2021-06-04 7:49 ` Sunny Wang
2021-06-01 13:12 ` [PATCH v2 2/6] SecurityPkg: Create include file for default key content Grzegorz Bernacki
2021-06-02 17:39 ` [edk2-devel] " Pete Batard
2021-06-03 7:06 ` Min Xu
2021-06-04 8:11 ` Sunny Wang
2021-06-01 13:12 ` [PATCH v2 3/6] SecurityPkg: Add SecureBootDefaultKeysDxe driver Grzegorz Bernacki
2021-06-02 17:39 ` [edk2-devel] " Pete Batard
2021-06-04 8:02 ` Min Xu [this message]
2021-06-04 8:15 ` Sunny Wang
2021-06-01 13:12 ` [PATCH v2 4/6] SecurityPkg: Add EnrollFromDefaultKeys application Grzegorz Bernacki
2021-06-02 17:40 ` [edk2-devel] " Pete Batard
2021-06-02 19:38 ` [EXTERNAL] " Bret Barkelew
2021-06-04 8:24 ` Sunny Wang
2021-06-01 13:12 ` [PATCH v2 5/6] SecurityPkg: Add new modules to Security package Grzegorz Bernacki
2021-06-02 17:40 ` [edk2-devel] " Pete Batard
2021-06-04 8:09 ` Min Xu
2021-06-04 8:26 ` Sunny Wang
2021-06-01 13:12 ` [PATCH v2 6/6] SecurityPkg: Add option to reset secure boot keys Grzegorz Bernacki
2021-06-02 17:40 ` [edk2-devel] " Pete Batard
2021-06-04 8:30 ` Sunny Wang
2021-06-04 8:17 ` [PATCH v2 0/6] Secure Boot default keys Min Xu
2021-06-07 7:29 ` Grzegorz Bernacki
2021-06-14 9:47 ` Grzegorz Bernacki
2021-06-17 1:30 ` [edk2-devel] " Min Xu
2021-06-17 12:54 ` Grzegorz Bernacki
2021-06-17 13:37 ` Min Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH0PR11MB5064538F4B53169D7609F321C53B9@PH0PR11MB5064.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox