public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"
       [not found] <20200325025932.13828-1-michael.kubacki@outlook.com>
@ 2020-03-25  2:59 ` Michael Kubacki
  2020-03-25 19:05   ` [edk2-devel] " Laszlo Ersek
  2020-03-31 11:56   ` Siyuan, Fu
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Kubacki @ 2020-03-25  2:59 UTC (permalink / raw)
  To: devel; +Cc: Laszlo Ersek, Siyuan Fu, Maciej Rabeda, Jiaxin Wu

From: Michael Kubacki <michael.kubacki@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 <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>
---
 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


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

* Re: [edk2-devel] [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"
  2020-03-25  2:59 ` [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval" Michael Kubacki
@ 2020-03-25 19:05   ` Laszlo Ersek
  2020-03-25 20:01     ` [EXTERNAL] " Bret Barkelew
  2020-03-31 11:56   ` Siyuan, Fu
  1 sibling, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2020-03-25 19:05 UTC (permalink / raw)
  To: devel, michael.kubacki; +Cc: Siyuan Fu, Maciej Rabeda, Jiaxin Wu

On 03/25/20 03:59, Michael Kubacki wrote:
> From: Michael Kubacki <michael.kubacki@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 <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>
> ---
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 27 +-------------------
>  1 file changed, 1 insertion(+), 26 deletions(-)

Thank you very much for posting this patch.

I have locally applied your series on top of e24529a5c324
("ArmPlatformPkg/ArmPlatformPkg.dsc: Add missing components",
2020-03-25), and verified that
"NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c" is now identical to
its state directly preceding 6896efdec270:

$ git diff --color 6896efdec270^..HEAD -- \
    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c

modulo the following two commits pushed meanwhile:

- ecf98fbcf858 ("NetworkPkg: Replace BSD License with BSD+Patent
License", 2019-04-09)

- dad13c806788 ("NetworkPkg/Tls: Fix few typos", 2020-02-10)

Therefore, for this patch:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thank you,
Laszlo


> 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);
>    }
> 


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

* Re: [EXTERNAL] Re: [edk2-devel] [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"
  2020-03-25 19:05   ` [edk2-devel] " Laszlo Ersek
@ 2020-03-25 20:01     ` Bret Barkelew
  0 siblings, 0 replies; 4+ messages in thread
From: Bret Barkelew @ 2020-03-25 20:01 UTC (permalink / raw)
  To: devel@edk2.groups.io, lersek@redhat.com,
	michael.kubacki@outlook.com
  Cc: Siyuan Fu, Maciej Rabeda, Jiaxin Wu

[-- Attachment #1: Type: text/plain, Size: 4656 bytes --]

Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Laszlo Ersek via Groups.Io <lersek=redhat.com@groups.io>
Sent: Wednesday, March 25, 2020 12:05:28 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; michael.kubacki@outlook.com <michael.kubacki@outlook.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>; Maciej Rabeda <maciej.rabeda@linux.intel.com>; Jiaxin Wu <jiaxin.wu@intel.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"

On 03/25/20 03:59, Michael Kubacki wrote:
> From: Michael Kubacki <michael.kubacki@microsoft.com>
>
> This reverts commit 6896efdec2709e530b23c688cf0f31706709a0c5.
>
> REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2062&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cef8ede7820da4096b4c208d7d0ef8630%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637207599480072478&amp;sdata=HCNGBJ8zrUEaxJ%2BsF3n77ESZzmusP4VZX8VeshCCxOY%3D&amp;reserved=0
>
> 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>
> ---
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 27 +-------------------
>  1 file changed, 1 insertion(+), 26 deletions(-)

Thank you very much for posting this patch.

I have locally applied your series on top of e24529a5c324
("ArmPlatformPkg/ArmPlatformPkg.dsc: Add missing components",
2020-03-25), and verified that
"NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c" is now identical to
its state directly preceding 6896efdec270:

$ git diff --color 6896efdec270^..HEAD -- \
    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c

modulo the following two commits pushed meanwhile:

- ecf98fbcf858 ("NetworkPkg: Replace BSD License with BSD+Patent
License", 2019-04-09)

- dad13c806788 ("NetworkPkg/Tls: Fix few typos", 2020-02-10)

Therefore, for this patch:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thank you,
Laszlo


> 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);
>    }
>





[-- Attachment #2: Type: text/html, Size: 10075 bytes --]

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

* Re: [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"
  2020-03-25  2:59 ` [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval" Michael Kubacki
  2020-03-25 19:05   ` [edk2-devel] " Laszlo Ersek
@ 2020-03-31 11:56   ` Siyuan, Fu
  1 sibling, 0 replies; 4+ messages in thread
From: Siyuan, Fu @ 2020-03-31 11:56 UTC (permalink / raw)
  To: michael.kubacki@outlook.com, devel@edk2.groups.io
  Cc: Laszlo Ersek, Maciej Rabeda, Wu, Jiaxin

Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>

> -----Original Message-----
> From: michael.kubacki@outlook.com <michael.kubacki@outlook.com>
> Sent: 2020年3月25日 11:00
> To: devel@edk2.groups.io
> Cc: Laszlo Ersek <lersek@redhat.com>; Fu, Siyuan <siyuan.fu@intel.com>;
> Maciej Rabeda <maciej.rabeda@linux.intel.com>; Wu, Jiaxin
> <jiaxin.wu@intel.com>
> Subject: [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix
> TlsCaCertificate attributes retrieval"
> 
> From: Michael Kubacki <michael.kubacki@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 <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>
> ---
>  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


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

end of thread, other threads:[~2020-03-31 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200325025932.13828-1-michael.kubacki@outlook.com>
2020-03-25  2:59 ` [PATCH v2 2/2] Revert "NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval" Michael Kubacki
2020-03-25 19:05   ` [edk2-devel] " Laszlo Ersek
2020-03-25 20:01     ` [EXTERNAL] " Bret Barkelew
2020-03-31 11:56   ` Siyuan, Fu

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