Revert "TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"
authorMichael Kubacki <michael.kubacki@microsoft.com>
Sat, 28 Mar 2020 05:55:36 +0000 (05:55 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 7 Apr 2020 13:51:24 +0000 (13:51 +0000)
This reverts commit 6896efdec2709e530b23c688cf0f31706709a0c5.

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

GetVariable() now returns attributes when it fails with
EFI_BUFFER_TOO_SMALL. Therefore, commit 6896efdec270 is
reverted since it is no longer relevant.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c

index 715bc3a..2481d10 100644 (file)
@@ -657,7 +657,6 @@ EnrollX509toVariable (
   EFI_SIGNATURE_LIST                *CACert;\r
   EFI_SIGNATURE_DATA                *CACertData;\r
   VOID                              *Data;\r
-  VOID                              *CurrentData;\r
   UINTN                             DataSize;\r
   UINTN                             SigDataSize;\r
   UINT32                            Attr;\r
@@ -669,7 +668,6 @@ EnrollX509toVariable (
   CACert        = NULL;\r
   CACertData    = NULL;\r
   Data          = NULL;\r
-  CurrentData   = NULL;\r
   Attr          = 0;\r
 \r
   Status = ReadFileContent (\r
@@ -712,30 +710,11 @@ EnrollX509toVariable (
   Status = gRT->GetVariable(\r
                   VariableName,\r
                   &gEfiTlsCaCertificateGuid,\r
-                  NULL,\r
+                  &Attr,\r
                   &DataSize,\r
                   NULL\r
                   );\r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
-    //\r
-    // Per spec, we have to fetch the variable's contents, even though we're\r
-    // only interested in the variable's attributes.\r
-    //\r
-    CurrentData = AllocatePool (DataSize);\r
-    if (CurrentData == NULL) {\r
-      Status = EFI_OUT_OF_RESOURCES;\r
-      goto ON_EXIT;\r
-    }\r
-    Status = gRT->GetVariable(\r
-                    VariableName,\r
-                    &gEfiTlsCaCertificateGuid,\r
-                    &Attr,\r
-                    &DataSize,\r
-                    CurrentData\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      goto ON_EXIT;\r
-    }\r
     Attr |= EFI_VARIABLE_APPEND_WRITE;\r
   } else if (Status == EFI_NOT_FOUND) {\r
     Attr = TLS_AUTH_CONFIG_VAR_BASE_ATTR;\r
@@ -766,10 +745,6 @@ ON_EXIT:
     FreePool (Data);\r
   }\r
 \r
-  if (CurrentData != NULL) {\r
-    FreePool (CurrentData);\r
-  }\r
-\r
   if (X509Data != NULL) {\r
     FreePool (X509Data);\r
   }\r