public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: derek.lin2@hpe.com
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Lin, Derek (HPS SW)" <derek.lin2@hpe.com>,
	"chao.b.zhang@intel.com" <chao.b.zhang@intel.com>,
	"jiewen.yao@intel.com" <jiewen.yao@intel.com>,
	"jian.j.wang@intel.com" <jian.j.wang@intel.com>
Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode
Date: Thu, 4 Jul 2019 06:29:53 +0000	[thread overview]
Message-ID: <TU4PR8401MB1245AEEF7A4FA8FD420B8B81C2FA0@TU4PR8401MB1245.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <7564.1562045108414671150@groups.io>


[-- Attachment #1.1: Type: text/plain, Size: 1276 bytes --]

Add SecurityPkg maintainers.

Thanks,
Derek

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of derek.lin2@hpe.com
Sent: Tuesday, July 2, 2019 1:25 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode

Patch is attached from group.io.
Since ECR785, which is added UEFI 2.3.1 errata A, enrolling a PK in setup mode doesn't need to verify the PK.
Below is the sentence about it in UEFI spec
```
3. If the firmware is in setup mode and the variable is one of:
- The global PK variable;
- The global KEK variable;
- The "db" variable with GUID EFI_IMAGE_SECURITY_DATABASE_GUID; or
- The "dbx" variable with GUID EFI_IMAGE_SECURITY_DATABASE_GUID,
then the firmware implementation shall consider the checks in the following steps 4 and 5 to
have passed, and proceed with updating the variable value as outlined below.
```
The step 4 is to verify the signature and the step 5 is to verify the cert.

After this change, when system is in Setup mode, setting a PK does not require authenticated variable descriptor.

Signed-off-by: Derek Lin <derek.lin2@hpe.com<mailto:derek.lin2@hpe.com>>
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com<mailto:cinnamon.shia@hpe.com>>



[-- Attachment #1.2: Type: text/html, Size: 5421 bytes --]

[-- Attachment #2: 0001-SecurityPkg-Don-t-Verify-the-enrolled-PK-in-setup-mo.patch --]
[-- Type: application/octet-stream, Size: 2977 bytes --]

From 4333f078f3d06a9332bf7220a1112b482a1671fe Mon Sep 17 00:00:00 2001
From: Derek Lin <derek.lin2@hpe.com>
Date: Tue, 2 Jul 2019 11:00:51 +0800
Subject: [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode

Since ECR785, which is added UEFI 2.3.1 errata A, enrolling a PK
in setup mode doesn't need to verify the PK.
Below is the sentence about it in UEFI spec
```
3. If the firmware is in setup mode and the variable is one of:
- The global PK variable;
- The global KEK variable;
- The "db" variable with GUID EFI_IMAGE_SECURITY_DATABASE_GUID; or
- The "dbx" variable with GUID EFI_IMAGE_SECURITY_DATABASE_GUID,
then the firmware implementation shall consider the checks in the following
steps 4 and 5 to have passed, and proceed with updating the variable value
as outlined below.
```
The step 4 is to verify the signature and the step 5 is to verify the cert.

After this change, when system is in Setup mode, setting a PK does not require
authenticated variable descriptor.

Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
---
 .../Library/AuthVariableLib/AuthService.c      | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 486df55bed..30347e2089 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -19,6 +19,7 @@
   to verify the signature.
 
 Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2019 Hewlett Packard Enterprise Development LP<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -583,7 +584,7 @@ ProcessVarWithPk (
   // Init state of Del. State may change due to secure check
   //
   Del = FALSE;
-  if ((InCustomMode() && UserPhysicalPresent()) || (mPlatformMode == SETUP_MODE && !IsPk)) {
+  if ((InCustomMode() && UserPhysicalPresent()) || (mPlatformMode == SETUP_MODE)) {
     Payload = (UINT8 *) Data + AUTHINFO2_SIZE (Data);
     PayloadSize = DataSize - AUTHINFO2_SIZE (Data);
     if (PayloadSize == 0) {
@@ -610,7 +611,7 @@ ProcessVarWithPk (
     if ((mPlatformMode != SETUP_MODE) || IsPk) {
       Status = VendorKeyIsModified ();
     }
-  } else if (mPlatformMode == USER_MODE) {
+  } else {
     //
     // Verify against X509 Cert in PK database.
     //
@@ -623,19 +624,6 @@ ProcessVarWithPk (
                AuthVarTypePk,
                &Del
                );
-  } else {
-    //
-    // Verify against the certificate in data payload.
-    //
-    Status = VerifyTimeBasedPayloadAndUpdate (
-               VariableName,
-               VendorGuid,
-               Data,
-               DataSize,
-               Attributes,
-               AuthVarTypePayload,
-               &Del
-               );
   }
 
   if (!EFI_ERROR(Status) && IsPk) {
-- 
2.20.1.windows.1


  reply	other threads:[~2019-07-04  6:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02  5:25 [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode derek.lin2
2019-07-04  6:29 ` derek.lin2 [this message]
2019-07-09 15:39 ` [edk2-devel] " Zhang, Chao B
2019-07-10  8:50   ` Wang, Jian J
2019-07-10 17:04     ` Laszlo Ersek
2019-07-11  3:20       ` Zhang, Chao B
2019-07-11 11:47         ` Laszlo Ersek
2019-07-12  1:41           ` Zhang, Chao B
2019-08-23  3:20             ` Lin, Derek (HPS SW)

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=TU4PR8401MB1245AEEF7A4FA8FD420B8B81C2FA0@TU4PR8401MB1245.NAMPRD84.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