public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode
@ 2019-07-02  5:25 derek.lin2
  2019-07-04  6:29 ` [edk2-devel] " derek.lin2
  2019-07-09 15:39 ` Zhang, Chao B
  0 siblings, 2 replies; 9+ messages in thread
From: derek.lin2 @ 2019-07-02  5:25 UTC (permalink / raw)
  To: devel


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

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>
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>

[-- Attachment #1.2: Type: text/html, Size: 1164 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-08-23  3:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02  5:25 [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode derek.lin2
2019-07-04  6:29 ` [edk2-devel] " derek.lin2
2019-07-09 15:39 ` 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)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox