[edk2-devel] [PATCH] SecurityPkg/AuthSeriableLib: Always delete variable in certdb

Gao, Zhichao posted 1 patch 4 years, 11 months ago
Failed in applying to current master (apply log)
SecurityPkg/Library/AuthVariableLib/AuthService.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH] SecurityPkg/AuthSeriableLib: Always delete variable in certdb
Posted by Gao, Zhichao 4 years, 11 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1783

While cleaning the certdb, always delete the variable data in
the certdb regardless of its attribute.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
 SecurityPkg/Library/AuthVariableLib/AuthService.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 7493a2ed9c..2340d47e77 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -1735,10 +1735,13 @@ CleanCertsFromDb (
                                        );
 
       if (EFI_ERROR(Status) || (AuthVariableInfo.Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) {
+        //
+        // While cleaning certdb, always delete the variable in certdb regardless of it attributes.
+        //
         Status      = DeleteCertsFromDb(
                         VariableName,
                         &AuthVarGuid,
-                        AuthVariableInfo.Attributes
+                        AuthVariableInfo.Attributes | EFI_VARIABLE_NON_VOLATILE
                         );
         CertCleaned = TRUE;
         DEBUG((EFI_D_INFO, "Recovery!! Cert for Auth Variable %s Guid %g is removed for consistency\n", VariableName, &AuthVarGuid));
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40486): https://edk2.groups.io/g/devel/message/40486
Mute This Topic: https://groups.io/mt/31603232/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] SecurityPkg/AuthSeriableLib: Always delete variable in certdb
Posted by Zhang, Chao B 4 years, 11 months ago
Reviewed-by : Chao Zhang <chao.b.zhang@intel.com>

-----Original Message-----
From: Gao, Zhichao 
Sent: Monday, May 13, 2019 10:55 AM
To: devel@edk2.groups.io
Cc: Zhang, Chao B <chao.b.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH] SecurityPkg/AuthSeriableLib: Always delete variable in certdb

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1783

While cleaning the certdb, always delete the variable data in the certdb regardless of its attribute.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
 SecurityPkg/Library/AuthVariableLib/AuthService.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 7493a2ed9c..2340d47e77 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -1735,10 +1735,13 @@ CleanCertsFromDb (
                                        );
 
       if (EFI_ERROR(Status) || (AuthVariableInfo.Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) {
+        //
+        // While cleaning certdb, always delete the variable in certdb regardless of it attributes.
+        //
         Status      = DeleteCertsFromDb(
                         VariableName,
                         &AuthVarGuid,
-                        AuthVariableInfo.Attributes
+                        AuthVariableInfo.Attributes | 
+ EFI_VARIABLE_NON_VOLATILE
                         );
         CertCleaned = TRUE;
         DEBUG((EFI_D_INFO, "Recovery!! Cert for Auth Variable %s Guid %g is removed for consistency\n", VariableName, &AuthVarGuid));
--
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40510): https://edk2.groups.io/g/devel/message/40510
Mute This Topic: https://groups.io/mt/31603232/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-