From: Michael Kubacki <michael.kuba...@microsoft.com>

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 <ler...@redhat.com>
Cc: Siyuan Fu <siyuan...@intel.com>
Cc: Maciej Rabeda <maciej.rab...@linux.intel.com>
Cc: Jiaxin Wu <jiaxin...@intel.com>
Signed-off-by: Michael Kubacki <michael.kuba...@microsoft.com>
Reviewed-by: Bret Barkelew <bret.barke...@microsoft.com>
Reviewed-by: Laszlo Ersek <ler...@redhat.com>
---
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 27 +-------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

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


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

View/Reply Online (#56515): https://edk2.groups.io/g/devel/message/56515
Mute This Topic: https://groups.io/mt/72598888/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to