[edk2] [PATCH v1] NetworkPkg/DnsDxe: Check the received packet size before parsing the message.

2019-02-26 Thread Jiaxin Wu
Fix CVE-2018-12178
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=809

The DNS driver only checks the received packet size against the
minimum DNS header size in DnsOnPacketReceived(), later it accesses
the QueryName and QuerySection beyond the header scope, which might
cause the pointer within DNS driver points to an invalid entry or
modifies the memory content beyond the header scope.

This patch is to fix above problem.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsImpl.c | 77 -
 NetworkPkg/DnsDxe/DnsImpl.h |  2 +
 2 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c
index 89ea755cb2..26a718987c 100644
--- a/NetworkPkg/DnsDxe/DnsImpl.c
+++ b/NetworkPkg/DnsDxe/DnsImpl.c
@@ -1112,26 +1112,29 @@ IsValidDnsResponse (
 /**
   Parse Dns Response.
 
   @param  Instance  The DNS instance
   @param  RxString  Received buffer.
+  @param  LengthReceived buffer length.
   @param  Completed Flag to indicate that Dns response is valid.
 
   @retval EFI_SUCCESS   Parse Dns Response successfully.
   @retval OthersFailed to parse Dns Response.
 
 **/
 EFI_STATUS
 ParseDnsResponse (
   IN OUT DNS_INSTANCE  *Instance,
   IN UINT8 *RxString,
+  IN UINT32Length,
  OUT BOOLEAN   *Completed
   )
 {
   DNS_HEADER*DnsHeader;
 
   CHAR8 *QueryName;
+  UINT32QueryNameLen;
   DNS_QUERY_SECTION *QuerySection;
 
   CHAR8 *AnswerName;
   DNS_ANSWER_SECTION*AnswerSection;
   UINT8 *AnswerData;
@@ -1153,10 +1156,11 @@ ParseDnsResponse (
 
   DNS_RESOURCE_RECORD   *Dns4RR;
   DNS6_RESOURCE_RECORD  *Dns6RR;
 
   EFI_STATUSStatus;
+  UINT32RemainingLength;
 
   EFI_TPL   OldTpl;
 
   Item = NULL;
   Dns4TokenEntry   = NULL;
@@ -1176,10 +1180,21 @@ ParseDnsResponse (
   Dns4RR   = NULL;
   Dns6RR   = NULL;
 
   *Completed   = TRUE;
   Status   = EFI_SUCCESS;
+  RemainingLength  = Length;
+
+  //
+  // Check whether the remaining packet length is avaiable or not.
+  //
+  if (RemainingLength <= sizeof (DNS_HEADER)) {
+*Completed = FALSE;
+return EFI_ABORTED;
+  } else {
+RemainingLength -= sizeof (DNS_HEADER);
+  }
 
   //
   // Get header
   //
   DnsHeader = (DNS_HEADER *) RxString;
@@ -1189,26 +1204,42 @@ ParseDnsResponse (
   DnsHeader->QuestionsNum = NTOHS (DnsHeader->QuestionsNum);
   DnsHeader->AnswersNum = NTOHS (DnsHeader->AnswersNum);
   DnsHeader->AuthorityNum = NTOHS (DnsHeader->AuthorityNum);
   DnsHeader->AditionalNum = NTOHS (DnsHeader->AditionalNum);
 
+  //
+  // There is always one QuestionsNum in DNS message. The capability to handle 
more
+  // than one requires to redesign the message format. Currently, it's not 
supported.
+  //
+  if (DnsHeader->QuestionsNum > 1) {
+*Completed = FALSE;
+return EFI_UNSUPPORTED;
+  }
+
   //
   // Get Query name
   //
   QueryName = (CHAR8 *) (RxString + sizeof (*DnsHeader));
 
+  QueryNameLen = (UINT32) AsciiStrLen (QueryName) + 1;
+
   //
-  // Get query section
+  // Check whether the remaining packet length is avaiable or not.
   //
-  QuerySection = (DNS_QUERY_SECTION *) (QueryName + AsciiStrLen (QueryName) + 
1);
-  QuerySection->Type = NTOHS (QuerySection->Type);
-  QuerySection->Class = NTOHS (QuerySection->Class);
+  if (RemainingLength <= QueryNameLen + sizeof (DNS_QUERY_SECTION)) {
+*Completed = FALSE;
+return EFI_ABORTED;
+  } else {
+RemainingLength -= (QueryNameLen + sizeof (DNS_QUERY_SECTION));
+  }
 
   //
-  // Get Answer name
+  // Get query section
   //
-  AnswerName = (CHAR8 *) QuerySection + sizeof (*QuerySection);
+  QuerySection = (DNS_QUERY_SECTION *) (QueryName + QueryNameLen);
+  QuerySection->Type = NTOHS (QuerySection->Type);
+  QuerySection->Class = NTOHS (QuerySection->Class);
 
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
 
   //
   // Check DnsResponse Validity, if so, also get a valid NET_MAP_ITEM.
@@ -1339,14 +1370,30 @@ ParseDnsResponse (
 }
   }
 
   Status = EFI_NOT_FOUND;
 
+  //
+  // Get Answer name
+  //
+  AnswerName = (CHAR8 *) QuerySection + sizeof (*QuerySection);
+
   //
   // Processing AnswerSection.
   //
   while (AnswerSectionNum < DnsHeader->AnswersNum) {
+//
+// Check whether the remaining packet length is avaiable or not.
+//
+if (RemainingLength <= sizeof (UINT16) + sizeof (DNS_ANSWER_SECTION)) {
+  *Completed = FALSE;
+  Status = EFI_ABORTED;
+  goto ON_EXIT;
+} else {
+  RemainingLength -= (sizeof (UINT16) + sizeof (DNS_ANSWER_SECTION));
+}
+
 //
 // Answer name should be PTR, else EFI_UNSUPPORTED returned.
 //
 if 

[edk2] [PATCH v3] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration during driver start.

2019-02-17 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1448

*v3: Change the if condition check to only clean the invalid configuration.

*v2: Add the warning debug message.

This patch is to clean the invalid data and continue to start IP6 driver.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 4c607125a6..7a96315ccf 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -585,12 +585,21 @@ Ip6DriverBindingStart (
Ip6Cfg,
Ip6ConfigDataTypeManualAddress,
DataItem->DataSize,
DataItem->Data.Ptr
);
-if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
-  goto UNINSTALL_PROTOCOL;
+if (Status == EFI_INVALID_PARAMETER || Status == EFI_BAD_BUFFER_SIZE) {
+  //
+  // Clean the invalid ManualAddress configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeManualAddress,
+ 0,
+ NULL
+ );
+  DEBUG ((EFI_D_WARN, "Ip6DriverBindingStart: Clean the invalid 
ManualAddress configuration.\n"));
 }
   }
 
   //
   // If there is any default gateway address, set it.
@@ -601,12 +610,21 @@ Ip6DriverBindingStart (
Ip6Cfg,
Ip6ConfigDataTypeGateway,
DataItem->DataSize,
DataItem->Data.Ptr
);
-if (EFI_ERROR(Status)) {
-  goto UNINSTALL_PROTOCOL;
+if (Status == EFI_INVALID_PARAMETER || Status == EFI_BAD_BUFFER_SIZE) {
+  //
+  // Clean the invalid Gateway configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeGateway,
+ 0,
+ NULL
+ );
+  DEBUG ((EFI_D_WARN, "Ip6DriverBindingStart: Clean the invalid Gateway 
configuration.\n"));
 }
   }
 
   //
   // ready to go: start the receiving and timer
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration during driver start.

2019-02-11 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1448

*v2: Add the warning debug message.

This patch is to clean the invalid data and continue to start IP6 driver.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 4c607125a6..7ec74f6ebc 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -586,11 +586,20 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeManualAddress,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
-  goto UNINSTALL_PROTOCOL;
+  //
+  // Clean the invalid ManualAddress configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeManualAddress,
+ 0,
+ NULL
+ );
+  DEBUG ((EFI_D_WARN, "Ip6DriverBindingStart: Clean the invalid 
ManualAddress configuration.\n"));
 }
   }
 
   //
   // If there is any default gateway address, set it.
@@ -602,11 +611,20 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeGateway,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status)) {
-  goto UNINSTALL_PROTOCOL;
+  //
+  // Clean the invalid Gateway configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeGateway,
+ 0,
+ NULL
+ );
+  DEBUG ((EFI_D_WARN, "Ip6DriverBindingStart: Clean the invalid Gateway 
configuration.\n"));
 }
   }
 
   //
   // ready to go: start the receiving and timer
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration during driver start.

2019-02-02 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1448

This patch is to clean the invalid data and continue to start IP6 driver.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Signed-off-by: Michael Turner 
---
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 4c607125a6..1bd1c61da8 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -586,11 +586,19 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeManualAddress,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
-  goto UNINSTALL_PROTOCOL;
+  //
+  // Clean the invalid ManualAddress configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeManualAddress,
+ 0,
+ NULL
+ );
 }
   }
 
   //
   // If there is any default gateway address, set it.
@@ -602,11 +610,19 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeGateway,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status)) {
-  goto UNINSTALL_PROTOCOL;
+  //
+  // Clean the invalid Gateway configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeGateway,
+ 0,
+ NULL
+ );
 }
   }
 
   //
   // ready to go: start the receiving and timer
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 1/2] MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in Driver Binding Start.

2019-02-02 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447

This patch is to uninstall Ip4ServiceBindingProtocol and Ip4Config2Protocol when
error happen in Driver Binding Start.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Signed-off-by: Michael Turner 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 0f25581414..87ec968e7b 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -1,9 +1,9 @@
 /** @file
   The driver binding and service binding protocol for IP4 driver.
 
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -662,14 +662,17 @@ Ip4DriverBindingStart (
   mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
 
   return Status;
 
 UNINSTALL_PROTOCOL:
-  gBS->UninstallProtocolInterface (
+  gBS->UninstallMultipleProtocolInterfaces (
  ControllerHandle,
  ,
- >ServiceBinding
+ >ServiceBinding,
+ ,
+ Ip4Cfg2,
+ NULL
  );
 
 FREE_SERVICE:
   Ip4CleanService (IpSb);
   FreePool (IpSb);
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding Start.

2019-02-02 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447

This patch is to uninstall Ip6ServiceBindingProtocol and Ip6ConfigProtocol when
error happen in Driver Binding Start.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Signed-off-by: Michael Turner 

Jiaxin Wu (2):
  MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in DriverBinding 
Start.
  NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in DriverBinding 
Start.

 MdeModulePkg//Universal/Network/Ip4Dxe/Ip4Driver.c  |  9 --
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 28 +--
 2 files changed, 25 insertions(+), 12 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 2/2] NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in Driver Binding Start.

2019-02-02 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447

This patch is to uninstall Ip6ServiceBindingProtocol and Ip6ConfigProtocol when
error happen in Driver Binding Start.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Signed-off-by: Michael Turner 
---
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 0bda1687f0..4c607125a6 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -1,9 +1,9 @@
 /** @file
   The driver binding and service binding protocol for IP6 driver.
 
-  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -562,20 +562,20 @@ Ip6DriverBindingStart (
   ,
   Ip6Cfg,
   NULL
   );
   if (EFI_ERROR (Status)) {
-goto ON_ERROR;
+goto FREE_SERVICE;
   }
 
   //
   // Read the config data from NV variable again.
   // The default data can be changed by other drivers.
   //
   Status = Ip6ConfigReadConfigData (IpSb->MacString, >Ip6ConfigInstance);
   if (EFI_ERROR (Status)) {
-goto ON_ERROR;
+goto UNINSTALL_PROTOCOL;
   }
 
   //
   // If there is any default manual address, set it.
   //
@@ -586,11 +586,11 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeManualAddress,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
-  goto ON_ERROR;
+  goto UNINSTALL_PROTOCOL;
 }
   }
 
   //
   // If there is any default gateway address, set it.
@@ -602,20 +602,20 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeGateway,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status)) {
-  goto ON_ERROR;
+  goto UNINSTALL_PROTOCOL;
 }
   }
 
   //
   // ready to go: start the receiving and timer
   //
   Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
   if (EFI_ERROR (Status)) {
-goto ON_ERROR;
+goto UNINSTALL_PROTOCOL;
   }
 
   //
   // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.
   //
@@ -623,11 +623,11 @@ Ip6DriverBindingStart (
   IpSb->FasterTimer,
   TimerPeriodic,
   TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
   );
   if (EFI_ERROR (Status)) {
-goto ON_ERROR;
+goto UNINSTALL_PROTOCOL;
   }
 
   //
   // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.
   //
@@ -635,21 +635,31 @@ Ip6DriverBindingStart (
   IpSb->Timer,
   TimerPeriodic,
   TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
   );
   if (EFI_ERROR (Status)) {
-goto ON_ERROR;
+goto UNINSTALL_PROTOCOL;
   }
 
   //
   // Initialize the IP6 ID
   //
   mIp6Id = NET_RANDOM (NetRandomInitSeed ());
 
   return EFI_SUCCESS;
 
-ON_ERROR:
+UNINSTALL_PROTOCOL:
+  gBS->UninstallMultipleProtocolInterfaces (
+ ControllerHandle,
+ ,
+ >ServiceBinding,
+ ,
+ Ip6Cfg,
+ NULL
+ );
+
+FREE_SERVICE:
   Ip6CleanService (IpSb);
   FreePool (IpSb);
   return Status;
 }
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [staging/UEFI_Redfish][PATCH v2] Announce to create "UEFI_Redfish" branch in edk2-staging.

2019-01-20 Thread Jiaxin Wu
v2: Resend the patch as diff adding instead of modifying.

UEFI_Redfish branch is to develop the UEFI Redfish feature. The code base
of development is based on the release of edk2-stable201811 tag. Please
refer to the patch of Readme.md to get the detailed feature introduction.

Note: The branch will be created by the end of Jan 28th if no objection.

Cc: Leif Lindholm 
Cc: Rothman Michael A 
Cc: Kinney Michael D 
Cc: Li Ruth 
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 Readme.md | 85 +++
 1 file changed, 85 insertions(+)
 create mode 100644 Readme.md

diff --git a/Readme.md b/Readme.md
new file mode 100644
index 00..b9b5ab38e2
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,85 @@
+This branch is used to develop the **UEFI Redfish Feature**. The code base of 
development is based on the release of **edk2-stable201811** tag.
+
+The branch owner:
+Fu Siyuan , Ye Ting , Wang Fan 
, Wu Jiaxin 
+
+## Introduction
+UEFI Redfish is an efficient and secure solution for end users to remote 
control and configure UEFI pre-OS environment by leveraging the RESTful API.  
It's simple for end users to access the data from UEFI firmware defined in JSON 
format.
+
+One of the design goals for UEFI Redfish solution is to provide a scalable 
implementation which allow users to easily add/remove/modify each independent 
Redfish configure features (RedfishBiosDxe & RedfishBootInfoDxe). This is done 
by extracting the generic logic to a single UEFI driver model driver 
(RedfishConfigDxe), and several library instances (DxeRedfishLib & BaseJsonLib).
+
+ Supported Features
+  * Protocols
+* EFI RestEx Service Binding Protocol
+* EFI RestEx Protocol
+* Redfish ConfigHandler Protocol
+* Redfish Credential Protocol
+
+  * Configuration Items via UEFI Redfish
+* [ISCSI Boot Keywords](http://www.uefi.org/confignamespace).
+* HII Opcodes/Questions marked with REST_SYTLE flag or in REST_SYTLE 
formset.
+* BootOrder/BootNext variables.
+
+  * Redfish Schemas
+* 
[AttributeRegistry](https://redfish.dmtf.org/schemas/v1/AttributeRegistry.v1_1_0.json)
+* 
[ComputerSystemCollection](https://redfish.dmtf.org/schemas/ComputerSystemCollection.json)
+* 
[ComputerSystem](https://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_5_0.json)
+* [Bios](https://redfish.dmtf.org/schemas/v1/Bios.v1_0_2.json)
+* 
[BootOptionCollection](https://redfish.dmtf.org/schemas/BootOptionCollection.json)
+* [BootOption](https://redfish.dmtf.org/schemas/BootOption.v1_0_0.json)
+
+If any additional Redfish Schema or a new version of above Schemas are 
required to be supported, please send the email to edk2-devel mailing list by 
following [edk2-satging process](https://github.com/tianocore/edk2-staging).
+
+ Related Modules
+  The following modules are related to UEFI Redfish solution, **RedfishPkg** 
is the new package to support UEFI Redfish solution:
+  * **RedfishPkg\RestExDxe\RestExDxe.inf** - UEFI driver to enable 
standardized RESTful access to resources from UEFI environment.
+
+  * **RedfishPkg\Library\DxeRedfishLib** - Library to 
Create/Read/Update/Delete (CRUD) resources and provide basic query abilities by 
using [URI/RedPath](https://github.com/DMTF/libredfish).
+
+  * **RedfishPkg\Library\BaseJsonLib** - Library to encode/decode JSON data.
+
+  * **RedfishPkg\RedfishConfigDxe\RedfishConfigDxe.inf** - UEFI driver to 
execute registered Redfish Configuration Handlers:
+
+* **RedfishPkg\Features\RedfishBiosDxe\RedfishBiosDxe.inf** - DXE driver 
to register Redfish configuration handler to process "Bios" schema and 
"AttributeRegistry" schema.
+
+* 
**RedfishPkg\Features\Features\RedfishBootInfoDxe\RedfishBootInfoDxe.inf** - 
DXE driver to register Redfish configuration handler to process Boot property 
defined in "ComputerSystem" schema.
+
+  * Platform Components for NT32:
+* **Nt32Pkg\RedfishPlatformDxe\RedfishPlatformDxe.inf** - UEFI sample 
platform driver for NT32 to fill the SMBIOS table 42 and publish Redfish 
Credential info.
+
+* **Nt32Pkg\Application\RedfishPlatformConfig\RedfishPlatformConfig.inf** 
- UEFI application for NT32 to publish Redfish Host Interface Record.
+
+  * Misc
+   * BaseTools - VfrCompile changes to support Rest Style Formset/Flag.
+
+   * MdePkg - Headers related to Rest Style Formset/Flag.
+
+   * MdeModulePkg - Extract more general APIs in UefiHiiLib & DxeHttpLib & 
DxeNetLib.
+
+   * NetworkPkg -  1) UefiPxeBcDxe & HttpBootDxe: Consume new APIs defined in 
DxeHttpLib & DxeNetLib. 2) HttpDxe: Cross-Subnet support. 3) IScsiDxe: REST 
Style FORMSET support.
+
+   * Nt32Pkg - 1) Enable UEFI Redfish feature in NT32 platform. 2) Fix TLS 
build error with CryptoPkg from edk2-stable201811 tag.
+
+
+## Promote to edk2 Trunk
+If a subset feature or a bug fix in this staging branch could meet below 
requirement, it could 

[edk2] [staging/UEFI_Redfish][PATCH v1] Announce to create "UEFI_Redfish" branch in edk2-staging.

2019-01-18 Thread Jiaxin Wu
UEFI_Redfish branch is to develop the UEFI Redfish feature. The code base
of development is based on the release of edk2-stable201811 tag. Please
refer to the patch of Readme.md to get the detailed feature introduction.

Note: The branch will be created by the end of Jan 28th if no objection.

Cc: Rothman Michael A 
Cc: Kinney Michael D 
Cc: Li Ruth 
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 Readme.md | 114 --
 1 file changed, 85 insertions(+), 29 deletions(-)

diff --git a/Readme.md b/Readme.md
index 1ef0780ee0..b9b5ab38e2 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,29 +1,85 @@
-# EDK II Project
-
-A modern, feature-rich, cross-platform firmware development environment
-for the UEFI and PI specifications from www.uefi.org.
-
-Contributions to the EDK II open source project are covered by the
-[TianoCore Contribution Agreement 1.1](Contributions.txt)
-
-The majority of the content in the EDK II open source project uses a
-[BSD 2-Clause License](License.txt).  The EDK II open source project contains
-the following components that are covered by additional licenses:
-* 
[AppPkg/Applications/Python/Python-2.7.2/Tools/pybench](AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/LICENSE)
-* 
[AppPkg/Applications/Python/Python-2.7.2](AppPkg/Applications/Python/Python-2.7.2/LICENSE)
-* 
[AppPkg/Applications/Python/Python-2.7.10](AppPkg/Applications/Python/Python-2.7.10/LICENSE)
-* 
[BaseTools/Source/C/BrotliCompress](BaseTools/Source/C/BrotliCompress/LICENSE)
-* 
[MdeModulePkg/Library/BrotliCustomDecompressLib](MdeModulePkg/Library/BrotliCustomDecompressLib/LICENSE)
-* [OvmfPkg](OvmfPkg/License.txt)
-* 
[CryptoPkg/Library/OpensslLib/openssl](CryptoPkg/Library/OpensslLib/openssl/LICENSE)
-
-The EDK II Project is composed of packages.  The maintainers for each package
-are listed in [Maintainers.txt](Maintainers.txt).
-
-# Resources
-* [TianoCore](http://www.tianocore.org)
-* [EDK II](https://github.com/tianocore/tianocore.github.io/wiki/EDK-II)
-* [Getting Started with EDK 
II](https://github.com/tianocore/tianocore.github.io/wiki/Getting-Started-with-EDK-II)
-* [Mailing 
Lists](https://github.com/tianocore/tianocore.github.io/wiki/Mailing-Lists)
-* [TianoCore Bugzilla](https://bugzilla.tianocore.org)
-* [How To 
Contribute](https://github.com/tianocore/tianocore.github.io/wiki/How-To-Contribute)
+This branch is used to develop the **UEFI Redfish Feature**. The code base of 
development is based on the release of **edk2-stable201811** tag.
+
+The branch owner:
+Fu Siyuan , Ye Ting , Wang Fan 
, Wu Jiaxin 
+
+## Introduction
+UEFI Redfish is an efficient and secure solution for end users to remote 
control and configure UEFI pre-OS environment by leveraging the RESTful API.  
It's simple for end users to access the data from UEFI firmware defined in JSON 
format.
+
+One of the design goals for UEFI Redfish solution is to provide a scalable 
implementation which allow users to easily add/remove/modify each independent 
Redfish configure features (RedfishBiosDxe & RedfishBootInfoDxe). This is done 
by extracting the generic logic to a single UEFI driver model driver 
(RedfishConfigDxe), and several library instances (DxeRedfishLib & BaseJsonLib).
+
+ Supported Features
+  * Protocols
+* EFI RestEx Service Binding Protocol
+* EFI RestEx Protocol
+* Redfish ConfigHandler Protocol
+* Redfish Credential Protocol
+
+  * Configuration Items via UEFI Redfish
+* [ISCSI Boot Keywords](http://www.uefi.org/confignamespace).
+* HII Opcodes/Questions marked with REST_SYTLE flag or in REST_SYTLE 
formset.
+* BootOrder/BootNext variables.
+
+  * Redfish Schemas
+* 
[AttributeRegistry](https://redfish.dmtf.org/schemas/v1/AttributeRegistry.v1_1_0.json)
+* 
[ComputerSystemCollection](https://redfish.dmtf.org/schemas/ComputerSystemCollection.json)
+* 
[ComputerSystem](https://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_5_0.json)
+* [Bios](https://redfish.dmtf.org/schemas/v1/Bios.v1_0_2.json)
+* 
[BootOptionCollection](https://redfish.dmtf.org/schemas/BootOptionCollection.json)
+* [BootOption](https://redfish.dmtf.org/schemas/BootOption.v1_0_0.json)
+
+If any additional Redfish Schema or a new version of above Schemas are 
required to be supported, please send the email to edk2-devel mailing list by 
following [edk2-satging process](https://github.com/tianocore/edk2-staging).
+
+ Related Modules
+  The following modules are related to UEFI Redfish solution, **RedfishPkg** 
is the new package to support UEFI Redfish solution:
+  * **RedfishPkg\RestExDxe\RestExDxe.inf** - UEFI driver to enable 
standardized RESTful access to resources from UEFI environment.
+
+  * **RedfishPkg\Library\DxeRedfishLib** - Library to 
Create/Read/Update/Delete (CRUD) resources and provide basic query abilities by 
using 

[edk2] [PATCH v3 0/3] Remove unnecessary NULL pointer check.

2019-01-17 Thread Jiaxin Wu
v3: Updated the first patch to check the instance token.

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

Since the value retrieved from the list Entry can't be the NULL
pointer, the unnecessary check can be removed.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 3/3] NetworkPkg/DnsDxe: Remove unnecessary NULL pointer check.

2019-01-17 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of ItemCache4/ItemCache6 is retrieved from the list
Entry, it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsDriver.c | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriver.c
index b74f5ba18e..6a4214caea 100644
--- a/NetworkPkg/DnsDxe/DnsDriver.c
+++ b/NetworkPkg/DnsDxe/DnsDriver.c
@@ -1,9 +1,9 @@
 /** @file
 The driver binding and service binding protocol for DnsDxe driver.
 
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -374,40 +374,36 @@ DnsUnload (
   gBS->CloseEvent (mDriverData->Timer);
 }
 
 while (!IsListEmpty (>Dns4CacheList)) {
   Entry = NetListRemoveHead (>Dns4CacheList);
+  ASSERT (Entry != NULL);
   ItemCache4 = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
-  if (ItemCache4->DnsCache.HostName != NULL) {
-FreePool (ItemCache4->DnsCache.HostName);
-  }
-  if (ItemCache4->DnsCache.IpAddress != NULL) {
-FreePool (ItemCache4->DnsCache.IpAddress);
-  }
+  FreePool (ItemCache4->DnsCache.HostName);
+  FreePool (ItemCache4->DnsCache.IpAddress);
   FreePool (ItemCache4);
 }
 
 while (!IsListEmpty (>Dns4ServerList)) {
   Entry = NetListRemoveHead (>Dns4ServerList);
+  ASSERT (Entry != NULL);
   ItemServerIp4 = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, 
AllServerLink);
   FreePool (ItemServerIp4);
 }
 
 while (!IsListEmpty (>Dns6CacheList)) {
   Entry = NetListRemoveHead (>Dns6CacheList);
+  ASSERT (Entry != NULL);
   ItemCache6 = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
-  if (ItemCache6->DnsCache.HostName != NULL) {
-FreePool (ItemCache6->DnsCache.HostName);
-  }
-  if (ItemCache6->DnsCache.IpAddress != NULL) {
-FreePool (ItemCache6->DnsCache.IpAddress);
-  }
+  FreePool (ItemCache6->DnsCache.HostName);
+  FreePool (ItemCache6->DnsCache.IpAddress);
   FreePool (ItemCache6);
 }
 
 while (!IsListEmpty (>Dns6ServerList)) {
   Entry = NetListRemoveHead (>Dns6ServerList);
+  ASSERT (Entry != NULL);
   ItemServerIp6 = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, 
AllServerLink);
   FreePool (ItemServerIp6);
 }
 
 FreePool (mDriverData);
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.

2019-01-17 Thread Jiaxin Wu
v3: Add the instance token check.

v2: The DHCP Instance might be destroyed in PxeDhcpDone. So,
we need safe-delete.

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

Since the value of Instance is retrieved from the list Entry,
it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 98a22a77b4..360365ecc3 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -1,9 +1,9 @@
 /** @file
   EFI DHCP protocol implementation.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -1646,16 +1646,13 @@ ON_EXIT:
   //
   // Iterate through all the DhcpSb Children.
   //
   NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
 Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
-
-if ((Instance != NULL) && (Instance->Token != NULL)) {
-  Instance->Timeout--;
-  if (Instance->Timeout == 0) {
-PxeDhcpDone (Instance);
-  }
+Instance->Timeout--;
+if (Instance->Timeout == 0 && Instance->Token != NULL) {
+  PxeDhcpDone (Instance);
 }
   }
 
   return ;
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 2/3] NetworkPkg/IScsiDxe: Remove unnecessary NULL pointer check.

2019-01-17 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of AttemptConfigData is retrieved from the list
Entry, it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 83644f51d8..78135b411c 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -1,9 +1,9 @@
 /** @file
   Helper functions for configuring or getting the parameters relating to iSCSI.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -2290,14 +2290,10 @@ IScsiConfigDeleteAttempts (
 //
 // Delete the attempt.
 //
 
 AttemptConfigData = NET_LIST_USER_STRUCT (Entry, 
ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
-if (AttemptConfigData == NULL) {
-  Status = EFI_NOT_FOUND;
-  goto Error;
-}
 
 //
 // Remove this attempt from UI configured attempt list.
 //
 RemoveEntryList (>Link);
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.

2019-01-17 Thread Jiaxin Wu
v2: The DHCP Instance might be destroyed in PxeDhcpDone. So,
we need safe-delete.

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

Since the value of Instance is retrieved from the list Entry,
it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 98a22a77b4..780f8b4224 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -1,9 +1,9 @@
 /** @file
   EFI DHCP protocol implementation.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -1646,16 +1646,13 @@ ON_EXIT:
   //
   // Iterate through all the DhcpSb Children.
   //
   NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
 Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
-
-if ((Instance != NULL) && (Instance->Token != NULL)) {
-  Instance->Timeout--;
-  if (Instance->Timeout == 0) {
-PxeDhcpDone (Instance);
-  }
+Instance->Timeout--;
+if (Instance->Timeout == 0) {
+  PxeDhcpDone (Instance);
 }
   }
 
   return ;
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 2/3] NetworkPkg/IScsiDxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of AttemptConfigData is retrieved from the list
Entry, it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 83644f51d8..78135b411c 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -1,9 +1,9 @@
 /** @file
   Helper functions for configuring or getting the parameters relating to iSCSI.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -2290,14 +2290,10 @@ IScsiConfigDeleteAttempts (
 //
 // Delete the attempt.
 //
 
 AttemptConfigData = NET_LIST_USER_STRUCT (Entry, 
ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
-if (AttemptConfigData == NULL) {
-  Status = EFI_NOT_FOUND;
-  goto Error;
-}
 
 //
 // Remove this attempt from UI configured attempt list.
 //
 RemoveEntryList (>Link);
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 3/3] NetworkPkg/DnsDxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of ItemCache4/ItemCache6 is retrieved from the list
Entry, it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsDriver.c | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriver.c
index b74f5ba18e..6a4214caea 100644
--- a/NetworkPkg/DnsDxe/DnsDriver.c
+++ b/NetworkPkg/DnsDxe/DnsDriver.c
@@ -1,9 +1,9 @@
 /** @file
 The driver binding and service binding protocol for DnsDxe driver.
 
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -374,40 +374,36 @@ DnsUnload (
   gBS->CloseEvent (mDriverData->Timer);
 }
 
 while (!IsListEmpty (>Dns4CacheList)) {
   Entry = NetListRemoveHead (>Dns4CacheList);
+  ASSERT (Entry != NULL);
   ItemCache4 = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
-  if (ItemCache4->DnsCache.HostName != NULL) {
-FreePool (ItemCache4->DnsCache.HostName);
-  }
-  if (ItemCache4->DnsCache.IpAddress != NULL) {
-FreePool (ItemCache4->DnsCache.IpAddress);
-  }
+  FreePool (ItemCache4->DnsCache.HostName);
+  FreePool (ItemCache4->DnsCache.IpAddress);
   FreePool (ItemCache4);
 }
 
 while (!IsListEmpty (>Dns4ServerList)) {
   Entry = NetListRemoveHead (>Dns4ServerList);
+  ASSERT (Entry != NULL);
   ItemServerIp4 = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, 
AllServerLink);
   FreePool (ItemServerIp4);
 }
 
 while (!IsListEmpty (>Dns6CacheList)) {
   Entry = NetListRemoveHead (>Dns6CacheList);
+  ASSERT (Entry != NULL);
   ItemCache6 = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
-  if (ItemCache6->DnsCache.HostName != NULL) {
-FreePool (ItemCache6->DnsCache.HostName);
-  }
-  if (ItemCache6->DnsCache.IpAddress != NULL) {
-FreePool (ItemCache6->DnsCache.IpAddress);
-  }
+  FreePool (ItemCache6->DnsCache.HostName);
+  FreePool (ItemCache6->DnsCache.IpAddress);
   FreePool (ItemCache6);
 }
 
 while (!IsListEmpty (>Dns6ServerList)) {
   Entry = NetListRemoveHead (>Dns6ServerList);
+  ASSERT (Entry != NULL);
   ItemServerIp6 = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, 
AllServerLink);
   FreePool (ItemServerIp6);
 }
 
 FreePool (mDriverData);
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 0/3] Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value retrieved from the list Entry can't be the NULL
pointer, the unnecessary check can be removed.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of Instance is retrieved from the list Entry,
it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 98a22a77b4..04d47e0759 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -1,9 +1,9 @@
 /** @file
   EFI DHCP protocol implementation.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -1493,15 +1493,15 @@ DhcpOnTimerTick (
   IN EFI_EVENT  Event,
   IN VOID   *Context
   )
 {
   LIST_ENTRY*Entry;
-  LIST_ENTRY*Next;
   DHCP_SERVICE  *DhcpSb;
   DHCP_PROTOCOL *Instance;
   EFI_STATUSStatus;
 
+  Entry= NULL;
   DhcpSb   = (DHCP_SERVICE *) Context;
   Instance = DhcpSb->ActiveChild;
 
   //
   // 0x is the maximum supported value for elapsed time according to RFC.
@@ -1644,18 +1644,15 @@ DhcpOnTimerTick (
 
 ON_EXIT:
   //
   // Iterate through all the DhcpSb Children.
   //
-  NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
+  NET_LIST_FOR_EACH (Entry, >Children) {
 Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
-
-if ((Instance != NULL) && (Instance->Token != NULL)) {
-  Instance->Timeout--;
-  if (Instance->Timeout == 0) {
-PxeDhcpDone (Instance);
-  }
+Instance->Timeout--;
+if (Instance->Timeout == 0) {
+  PxeDhcpDone (Instance);
 }
   }
 
   return ;
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 1/2] MdeModulePkg/NetLib.h: Fix the possible NULL pointer dereference issue.

2019-01-15 Thread Jiaxin Wu
v2: Fix the wrong condition in for cycle.

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

For the NET_LIST_FOR_EACH & NET_LIST_FOR_EACH_SAFE, "Entry" should be
checked whether it's NULL or not instead of using the pointer directly.

Cc: Wu Hao A 
Cc: Gao Liming 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Include/Library/NetLib.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index 0977973921..c9a86733ec 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -616,21 +616,21 @@ NetRandomInitSeed (
 
 //
 // Iterate through the double linked list. It is NOT delete safe
 //
 #define NET_LIST_FOR_EACH(Entry, ListHead) \
-  for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = 
Entry->ForwardLink)
+  for(Entry = (ListHead)->ForwardLink; Entry != (ListHead) && Entry != NULL; 
Entry = Entry->ForwardLink)
 
 //
 // Iterate through the double linked list. This is delete-safe.
 // Don't touch NextEntry. Also, don't use this macro if list
 // entries other than the Entry may be deleted when processing
 // the current Entry.
 //
 #define NET_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
-  for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink; \
-  Entry != (ListHead); \
+  for(Entry = (ListHead)->ForwardLink, (Entry != NULL) ? (NextEntry = 
Entry->ForwardLink) : (Entry = NULL); \
+  Entry != (ListHead) && Entry != NULL; \
   Entry = NextEntry, NextEntry = Entry->ForwardLink \
  )
 
 //
 // Make sure the list isn't empty before getting the first/last record.
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 0/2] Fix the possible NULL pointer dereference issue.

2019-01-14 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1456

For the NET_LIST_FOR_EACH & NET_LIST_FOR_EACH_SAFE, "Entry" should be
checked whether it's NULL or not instead of using the pointer directly.

Besides, NET_LIST_FOR_EACH_SAFE is defined to iterate through the double
linked list in delete-safe way. It's unnecessary to use this macro if
list entries won't be deleted.

Cc: Wu Hao A 
Cc: Gao Liming 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Jiaxin Wu (2):
  MdeModulePkg/NetLib.h: Fix the possible NULL pointer dereference issue.
  MdeModulePkg/Dhcp4Dxe: Use NET_LIST_FOR_EACH instead of 
NET_LIST_FOR_EACH_SAFE.

 MdeModulePkg/Include/Library/NetLib.h | 6 +++---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 2/2] MdeModulePkg/Dhcp4Dxe: Use NET_LIST_FOR_EACH instead of NET_LIST_FOR_EACH_SAFE.

2019-01-14 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1456

NET_LIST_FOR_EACH_SAFE is defined to iterate through the double linked list
in delete-safe way. It's unnecessary to use this macro if list entries won't
be deleted.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 98a22a77b4..47a9db6489 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -1493,15 +1493,15 @@ DhcpOnTimerTick (
   IN EFI_EVENT  Event,
   IN VOID   *Context
   )
 {
   LIST_ENTRY*Entry;
-  LIST_ENTRY*Next;
   DHCP_SERVICE  *DhcpSb;
   DHCP_PROTOCOL *Instance;
   EFI_STATUSStatus;
 
+  Entry= NULL;
   DhcpSb   = (DHCP_SERVICE *) Context;
   Instance = DhcpSb->ActiveChild;
 
   //
   // 0x is the maximum supported value for elapsed time according to RFC.
@@ -1644,11 +1644,11 @@ DhcpOnTimerTick (
 
 ON_EXIT:
   //
   // Iterate through all the DhcpSb Children.
   //
-  NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
+  NET_LIST_FOR_EACH (Entry, >Children) {
 Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
 
 if ((Instance != NULL) && (Instance->Token != NULL)) {
   Instance->Timeout--;
   if (Instance->Timeout == 0) {
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 1/2] MdeModulePkg/NetLib.h: Fix the possible NULL pointer dereference issue.

2019-01-14 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1456

For the NET_LIST_FOR_EACH & NET_LIST_FOR_EACH_SAFE, "Entry" should be
checked whether it's NULL or not instead of using the pointer directly.

Cc: Wu Hao A 
Cc: Gao Liming 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Include/Library/NetLib.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index 0977973921..5b1307553a 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -616,21 +616,21 @@ NetRandomInitSeed (
 
 //
 // Iterate through the double linked list. It is NOT delete safe
 //
 #define NET_LIST_FOR_EACH(Entry, ListHead) \
-  for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = 
Entry->ForwardLink)
+  for(Entry = (ListHead)->ForwardLink; Entry != (ListHead), Entry != NULL; 
Entry = Entry->ForwardLink)
 
 //
 // Iterate through the double linked list. This is delete-safe.
 // Don't touch NextEntry. Also, don't use this macro if list
 // entries other than the Entry may be deleted when processing
 // the current Entry.
 //
 #define NET_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
-  for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink; \
-  Entry != (ListHead); \
+  for(Entry = (ListHead)->ForwardLink, (Entry != NULL) ? (NextEntry = 
Entry->ForwardLink) : (Entry = NULL); \
+  Entry != (ListHead), Entry != NULL; \
   Entry = NextEntry, NextEntry = Entry->ForwardLink \
  )
 
 //
 // Make sure the list isn't empty before getting the first/last record.
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1] ShellPkg/TftpDynamicCommand: Clarify the retry count option in command.

2018-11-04 Thread Jiaxin Wu
[-c ] is to define the number of times to transmit request
packets and wait for a response. The default value is 6. But it doesn't
specify the behavior of zero value. Here, The patch is to clear that:
Set to zero also means to use the default value.

Cc: Carsey Jaben 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c   | 6 +-
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index ac2813efc3..028686e1ff 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -216,11 +216,11 @@ EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = {
   { { 0, 0, 0, 0 } },   // SubnetMask- Not relevant as 
UseDefaultSetting=TRUE
   0,// LocalPort - Automatically 
assigned port number.
   { { 0, 0, 0, 0 } },   // GatewayIp - Not relevant as 
UseDefaultSetting=TRUE
   { { 0, 0, 0, 0 } },   // ServerIp  - Not known yet
   69,   // InitialServerPort - Standard TFTP 
server port
-  6,// TryCount  - Max number of 
retransmissions.
+  6,// TryCount  - The number of times 
to transmit request packets and wait for a response.
   4 // TimeoutValue  - Retransmission 
timeout in seconds.
 };
 
 STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {L"-i", TypeValue},
@@ -419,10 +419,14 @@ RunTftp (
   ValueStr = ShellCommandLineGetValue (CheckPackage, L"-c");
   if (ValueStr != NULL) {
 if (!StringToUint16 (ValueStr, )) {
   goto Error;
 }
+
+if (Mtftp4ConfigData.TryCount == 0) {
+  Mtftp4ConfigData.TryCount = 6;
+}
   }
 
   ValueStr = ShellCommandLineGetValue (CheckPackage, L"-t");
   if (ValueStr != NULL) {
 if (!StringToUint16 (ValueStr, )) {
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
index 654e42ad23..ff64912564 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni
@@ -56,11 +56,12 @@
 "  -i interface - Specifies an adapter name, i.e., eth0.\r\n"
 "  -l port  - Specifies the local port number. Default value is 0\r\n"
 " and the port number is automatically assigned.\r\n"
 "  -r port  - Specifies the remote port number. Default value is 
69.\r\n"
 "  -c  - The number of times to transmit request packets and\r\n"
-" wait for a response. The default value is 6.\r\n"
+" wait for a response. The default value is 6. Set to 
zero\r\n"
+" also means to use the default value.\r\n"
 "  -t  - The number of seconds to wait for a response after\r\n"
 " sending a request packet. Default value is 4s.\r\n"
 "  -s   - Specifies the TFTP blksize option as defined in RFC 
2348.\r\n"
 " Valid range is between 8 and 65464, default value is 
512.\r\n"
 "  -w  - Specifies the TFTP windowsize option as defined in RFC 
7440.\r\n"
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1] MdeModulePkg/Mtftp4Dxe: Fix invalid configuration of MTFTP local port.

2018-11-04 Thread Jiaxin Wu
This patch is to fix the invalid setting of MTFTP local port. The
issue can be reproduced by tftp shell command by using [-l port]
option.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index f442e6d7ac..793ad77b1e 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -309,11 +309,11 @@ Mtftp4ConfigUnicastPort (
   UdpConfig.ReceiveTimeout = 0;
   UdpConfig.TransmitTimeout= 0;
   UdpConfig.UseDefaultAddress  = Config->UseDefaultSetting;
   IP4_COPY_ADDRESS (, >StationIp);
   IP4_COPY_ADDRESS (, >SubnetMask);
-  UdpConfig.StationPort= 0;
+  UdpConfig.StationPort= Config->LocalPort;
   UdpConfig.RemotePort = 0;
 
   Ip = HTONL (Instance->ServerIp);
   IP4_COPY_ADDRESS (, );
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1] NetworkPkg/Mtftp6Dxe: Remove the trailing white spaces.

2018-10-31 Thread Jiaxin Wu
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h 
b/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
index 57f4cb6f5d..f0279daca3 100644
--- a/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
+++ b/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
@@ -84,11 +84,11 @@ struct _MTFTP6_INSTANCE {
 
   //
   // Record the total received and saved block number.
   //
   UINT64TotalBlock;
-  
+
   //
   // Record the acked block number.
   //
   UINT64AckedBlock;
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1] NetworkPkg/TlsDxe: Fix failure to process multiple TLS records.

2018-10-30 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1290.

Current implementation failed to parse the multiple TLS record
messages due to the incorrect pointer of TLS record header. This
patch is to resolve that problem.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/TlsDxe/TlsImpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/TlsDxe/TlsImpl.c b/NetworkPkg/TlsDxe/TlsImpl.c
index ea83dbd04f..2d4169b0a5 100644
--- a/NetworkPkg/TlsDxe/TlsImpl.c
+++ b/NetworkPkg/TlsDxe/TlsImpl.c
@@ -142,11 +142,11 @@ TlsEncryptPacket (
 }
 
 BufferOutSize += ThisMessageSize;
 
 BufferInPtr += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize;
-TempRecordHeader += ThisMessageSize;
+TempRecordHeader = (TLS_RECORD_HEADER *)((UINT8 *)TempRecordHeader + 
ThisMessageSize);
   }
 
   FreePool (BufferIn);
   BufferIn = NULL;
 
@@ -315,11 +315,11 @@ TlsDecryptPacket (
 CopyMem (TempRecordHeader, RecordHeaderIn, TLS_RECORD_HEADER_LENGTH);
 TempRecordHeader->Length = ThisPlainMessageSize;
 BufferOutSize += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize;
 
 BufferInPtr += TLS_RECORD_HEADER_LENGTH + ThisCipherMessageSize;
-TempRecordHeader += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize;
+TempRecordHeader = (TLS_RECORD_HEADER *)((UINT8 *)TempRecordHeader + 
TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize);
   }
 
   FreePool (BufferIn);
   BufferIn = NULL;
 
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] MdeModulePke/Mtftp4Dxe: Correct the total received and saved block number.

2018-10-25 Thread Jiaxin Wu
The block returned from Mtftp4RemoveBlockNum is not the total received and
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h |  6 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c  | 16 +++-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.c  | 10 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.h  |  6 +++---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c  |  6 +++---
 5 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
index de304f4e70..be2f8af6e4 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
@@ -124,13 +124,17 @@ struct _MTFTP4_PROTOCOL {
   LIST_ENTRYBlocks;
 
   UINT16WindowSize;
 
   //
-  // Record the total received block number and the already acked block number.
+  // Record the total received and saved block number.
   //
   UINT64TotalBlock;
+  
+  //
+  // Record the acked block number.
+  //
   UINT64AckedBlock;
 
   //
   // The server's communication end point: IP and two ports. one for
   // initial request, one for its selected port.
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
index fedf1cde46..6960e322a5 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
@@ -152,10 +152,11 @@ Mtftp4RrqSaveBlock (
   EFI_MTFTP4_TOKEN  *Token;
   EFI_STATUSStatus;
   UINT16Block;
   UINT64Start;
   UINT32DataLen;
+  UINT64BlockCounter;
   BOOLEAN   Completed;
 
   Completed = FALSE;
   Token = Instance->Token;
   Block = NTOHS (Packet->Data.Block);
@@ -172,14 +173,14 @@ Mtftp4RrqSaveBlock (
 
   //
   // Remove this block number from the file hole. If Mtftp4RemoveBlockNum
   // returns EFI_NOT_FOUND, the block has been saved, don't save it again.
   // Note that : For bigger files, allowing the block counter to roll over
-  // to accept transfers of unlimited size. So TotalBlock is memorised as
+  // to accept transfers of unlimited size. So BlockCounter is memorised as
   // continuous block counter.
   //
-  Status = Mtftp4RemoveBlockNum (>Blocks, Block, Completed, 
>TotalBlock);
+  Status = Mtftp4RemoveBlockNum (>Blocks, Block, Completed, 
);
 
   if (Status == EFI_NOT_FOUND) {
 return EFI_SUCCESS;
   } else if (EFI_ERROR (Status)) {
 return Status;
@@ -198,11 +199,11 @@ Mtftp4RrqSaveBlock (
   return EFI_ABORTED;
 }
   }
 
   if (Token->Buffer != NULL) {
- Start = MultU64x32 (Instance->TotalBlock - 1, Instance->BlkSize);
+ Start = MultU64x32 (BlockCounter - 1, Instance->BlkSize);
 
 if (Start + DataLen <= Token->BufferSize) {
   CopyMem ((UINT8 *) Token->Buffer + Start, Packet->Data.Data, DataLen);
 
   //
@@ -269,13 +270,13 @@ Mtftp4RrqHandleData (
   Expected= Mtftp4GetNextBlockNum (>Blocks);
 
   ASSERT (Expected >= 0);
 
   //
-  // If we are active and received an unexpected packet, transmit
+  // If we are active (Master) and received an unexpected packet, transmit
   // the ACK for the block we received, then restart receiving the
-  // expected one. If we are passive, save the block.
+  // expected one. If we are passive (Slave), save the block.
   //
   if (Instance->Master && (Expected != BlockNum)) {
 //
 // If Expected is 0, (UINT16) (Expected - 1) is also the expected Ack 
number (65535).
 //
@@ -286,10 +287,15 @@ Mtftp4RrqHandleData (
 
   if (EFI_ERROR (Status)) {
 return Status;
   }
 
+  //
+  // Record the total received and saved block number.
+  //
+  Instance->TotalBlock ++;
+
   //
   // Reset the passive client's timer whenever it received a
   // valid data packet.
   //
   if (!Instance->Master) {
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
index 71fd979b3a..5e282e9c4b 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
@@ -156,12 +156,12 @@ Mtftp4SetLastBlockNum (
 /**
   Remove the block number from the block range list.
 
   @param  Head  The block range list to remove from
   @param  Num   The block number to remove
-  @param  Completed Whether Num is the last block number
-  @param  TotalBlockThe continuous block number in all
+  @param  Completed Whether Num is the last block number.
+  

[edk2] [Patch 2/2] NetworkPkg/Mtftp6Dxe: Correct the total received and saved block number.

2018-10-25 Thread Jiaxin Wu
The block returned from Mtftp6RemoveBlockNum is not the total received and
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h|  6 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c | 16 +++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c | 10 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.h |  8 
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c |  6 +++---
 5 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h 
b/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
index cf1b6abacc..57f4cb6f5d 100644
--- a/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
+++ b/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
@@ -81,13 +81,17 @@ struct _MTFTP6_INSTANCE {
   UINT16Operation;
 
   UINT16WindowSize;
 
   //
-  // Record the total received block number and the already acked block number.
+  // Record the total received and saved block number.
   //
   UINT64TotalBlock;
+  
+  //
+  // Record the acked block number.
+  //
   UINT64AckedBlock;
 
   EFI_IPv6_ADDRESS  ServerIp;
   UINT16ServerCmdPort;
   UINT16ServerDataPort;
diff --git a/NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c b/NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c
index 1f685b2bfe..d60b26f652 100644
--- a/NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c
+++ b/NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c
@@ -100,10 +100,11 @@ Mtftp6RrqSaveBlock (
   EFI_MTFTP6_TOKEN  *Token;
   EFI_STATUSStatus;
   UINT16Block;
   UINT64Start;
   UINT32DataLen;
+  UINT64BlockCounter;
   BOOLEAN   Completed;
 
   Completed = FALSE;
   Token = Instance->Token;
   Block = NTOHS (Packet->Data.Block);
@@ -120,14 +121,14 @@ Mtftp6RrqSaveBlock (
 
   //
   // Remove this block number from the file hole. If Mtftp6RemoveBlockNum
   // returns EFI_NOT_FOUND, the block has been saved, don't save it again.
   // Note that : For bigger files, allowing the block counter to roll over
-  // to accept transfers of unlimited size. So TotalBlock is memorised as
+  // to accept transfers of unlimited size. So BlockCounter is memorised as
   // continuous block counter.
   //
-  Status = Mtftp6RemoveBlockNum (>BlkList, Block, Completed, 
>TotalBlock);
+  Status = Mtftp6RemoveBlockNum (>BlkList, Block, Completed, 
);
 
   if (Status == EFI_NOT_FOUND) {
 return EFI_SUCCESS;
   } else if (EFI_ERROR (Status)) {
 return Status;
@@ -159,11 +160,11 @@ Mtftp6RrqSaveBlock (
 }
   }
 
   if (Token->Buffer != NULL) {
 
-Start = MultU64x32 (Instance->TotalBlock - 1, Instance->BlkSize);
+Start = MultU64x32 (BlockCounter - 1, Instance->BlkSize);
 if (Start + DataLen <= Token->BufferSize) {
   CopyMem ((UINT8 *) Token->Buffer + Start, Packet->Data.Data, DataLen);
   //
   // Update the file size when received the last block
   //
@@ -236,13 +237,13 @@ Mtftp6RrqHandleData (
   Expected = Mtftp6GetNextBlockNum (>BlkList);
 
   ASSERT (Expected >= 0);
 
   //
-  // If we are active and received an unexpected packet, transmit
+  // If we are active (Master) and received an unexpected packet, transmit
   // the ACK for the block we received, then restart receiving the
-  // expected one. If we are passive, save the block.
+  // expected one. If we are passive (Slave), save the block.
   //
   if (Instance->IsMaster && (Expected != BlockNum)) {
 //
 // Free the received packet before send new packet in ReceiveNotify,
 // since the udpio might need to be reconfigured.
@@ -260,10 +261,15 @@ Mtftp6RrqHandleData (
 
   if (EFI_ERROR (Status)) {
 return Status;
   }
 
+  //
+  // Record the total received and saved block number.
+  //
+  Instance->TotalBlock ++;
+
   //
   // Reset the passive client's timer whenever it received a valid data packet.
   //
   if (!Instance->IsMaster) {
 Instance->PacketToLive = Instance->Timeout * 2;
diff --git a/NetworkPkg/Mtftp6Dxe/Mtftp6Support.c 
b/NetworkPkg/Mtftp6Dxe/Mtftp6Support.c
index 275272b89e..f03216afb7 100644
--- a/NetworkPkg/Mtftp6Dxe/Mtftp6Support.c
+++ b/NetworkPkg/Mtftp6Dxe/Mtftp6Support.c
@@ -156,12 +156,12 @@ Mtftp6SetLastBlockNum (
 /**
   Remove the block number from the block range list.
 
   @param[in]  Head   The block range list to remove from.
   @param[in]  NumThe block number to remove.
-  @param[in]  Completed  Whether Num is the last block number
-  @param[out] TotalBlock The continuous block number in all
+  @param[in]  Completed  Whether Num is the last block number.
+  @param[out] BlockCounter   The continuous block counter instead of 
the value after roll-over.
 
   @retval EFI_NOT_FOUND 

[edk2] [Patch 0/2] Mtftp: Correct the total received and saved block number.

2018-10-25 Thread Jiaxin Wu
The block returned from Mtftp4RemoveBlockNum is not the total received and
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (2):
  MdeModulePke/Mtftp4Dxe: Correct the total received and saved block
number.
  NetworkPkg/Mtftp6Dxe: Correct the total received and saved block
number.

 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h |  6 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c  | 16 +++-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.c  | 10 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.h  |  6 +++---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c  |  6 +++---
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h|  6 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c | 16 +++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c | 10 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.h |  8 
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c |  6 +++---
 10 files changed, 55 insertions(+), 35 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.

2018-10-18 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1251

*v2: Correct the type of parameters in Ikev2ParseProposalData(), and refined
the corresponding description.

IpSecDxe failed to create the Child SA during parsing SA Payload, the issue
was caused by the below commit:

SHA-1: 1e0db7b11987d0ec93be7dfe26102a327860fdbd
* MdeModulePkg/NetworkPkg: Checking for NULL pointer before use.

In above commit, it changed the value of IsMatch in Ikev2ChildSaParseSaPayload()
to FALSE. That's correct but it exposed the potential bug in to match the 
correct
proposal Data, which will cause the issue happen.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IpSecDxe/Ikev2/Utility.c | 64 ++---
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c 
b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index 0c9c929705..63de56f09e 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -1993,34 +1993,51 @@ Ikev2IsSupportAlg (
 }
 
 /**
   Get the preferred algorithm types from ProposalData.
 
-  @param[in]  ProposalData  Pointer to related IKEV2_PROPOSAL_DATA.
-  @param[out] PreferEncryptAlgorithmOutput of preferred encrypt algorithm.
-  @param[out] PreferIntegrityAlgorithm  Output of preferred integrity 
algorithm.
-  @param[out] PreferPrfAlgorithmOutput of preferred PRF algorithm. Only
-for IKE SA.
-  @param[out] PreferDhGroup Output of preferred DH group. Only for
-IKE SA.
-  @param[out] PreferEncryptKeylengthOutput of preferred encrypt key length
-in bytes.
-  @param[out] IsSupportEsn  Output of value about the Extented 
Sequence
-Number is support or not. Only for 
Child SA.
-  @param[in]  IsChildSa If it is ture, the ProposalData is for 
IKE
-SA. Otherwise the proposalData is for 
Child SA.
+  @param[in]  ProposalData  Pointer to related 
IKEV2_PROPOSAL_DATA.
+  @param[in, out] PreferEncryptAlgorithmPointer to buffer which is used to 
store the
+preferred encrypt algorithm.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred encrypt 
algorithm.
+  @param[in, out] PreferIntegrityAlgorithm  Pointer to buffer which is used to 
store the
+preferred integrity algorithm.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred integrity 
algorithm.
+  @param[in, out] PreferPrfAlgorithmPointer to buffer which is used to 
store the
+preferred PRF algorithm.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred PRF algorithm. 
Only
+for IKE SA.
+  @param[in, out] PreferDhGroup Pointer to buffer which is used to 
store the
+preferred DH group.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred DH group. Only 
for
+IKE SA.
+  @param[in, out] PreferEncryptKeylengthPointer to buffer which is used to 
store the
+preferred encrypt key length in 
bytes.
+  @param[in, out] IsSupportEsn  Pointer to buffer which is used to 
store the
+value about the Extented Sequence 
Number is
+support or not. Only for Child SA.
+  @param[in]  IsChildSa If it is ture, the ProposalData is 
for IKE
+SA. Otherwise the proposalData is 
for Child SA.
 
 **/
 VOID
 Ikev2ParseProposalData (
   IN IKEV2_PROPOSAL_DATA  *ProposalData,
- OUT UINT16   *PreferEncryptAlgorithm,
- OUT UINT16   *PreferIntegrityAlgorithm,
- OUT UINT16   *PreferPrfAlgorithm,
- OUT UINT16   *PreferDhGroup,
- OUT UINTN 

[edk2] [Patch] NetworkPkg: Correct the time stamp and fix the integer overflow issue.

2018-10-15 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=883.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 18 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 16 
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c 
b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
index 10a99a00d4..9c7459c332 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
@@ -121,11 +121,11 @@ Dhcp6GenerateClientId (
 // Generate a time stamp of the seconds from 2000/1/1, assume 30day/month.
 //
 gRT->GetTime (, NULL);
 Stamp = (UINT32)
   (
-(Time.Year - 2000) * 360 + (Time.Month - 1)) * 30 + (Time.Day - 
1)) * 24 + Time.Hour) * 60 + Time.Minute) *
+UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + 
(Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *
 60 +
 Time.Second
   );
 
 //
@@ -879,18 +879,18 @@ SetElapsedTime (
 
   //
   // Generate a time stamp of the centiseconds from 2000/1/1, assume 
30day/month.
   //
   gRT->GetTime (, NULL);
-  CurrentStamp = (UINT64)
-(
-  ((Time.Year - 2000) * 360 +
-   (Time.Month - 1)) * 30 +
-   (Time.Day - 1)) * 24 + Time.Hour) * 60 +
-   Time.Minute) * 60 + Time.Second) * 100
-   + DivU64x32(Time.Nanosecond, 1000)
-);
+  CurrentStamp = MultU64x32 (
+   UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 
+ (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,
+   100
+   ) +
+ DivU64x32(
+   Time.Nanosecond,
+   1000
+   );
 
   //
   // Sentinel value of 0 means that this is the first DHCP packet that we are
   // sending and that we need to initialize the value.  First DHCP message
   // gets 0 elapsed-time.  Otherwise, calculate based on StartTime.
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index 60509fc9e6..7ab09e0367 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1508,18 +1508,18 @@ CalcElapsedTime (
   //
   // Generate a time stamp of the centiseconds from 1900/1/1, assume 
30day/month.
   //
   ZeroMem (, sizeof (EFI_TIME));
   gRT->GetTime (, NULL);
-  CurrentStamp = (UINT64)
-(
-  ((Time.Year - 1900) * 360 +
-   (Time.Month - 1)) * 30 +
-   (Time.Day - 1)) * 24 + Time.Hour) * 60 +
-   Time.Minute) * 60 + Time.Second) * 100
-   + DivU64x32(Time.Nanosecond, 1000)
-);
+  CurrentStamp = MultU64x32 (
+   UINT32)(Time.Year - 1900) * 360 + (Time.Month - 1) * 30 
+ (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,
+   100
+   ) +
+ DivU64x32 (
+   Time.Nanosecond,
+   1000
+   );
 
   //
   // Sentinel value of 0 means that this is the first DHCP packet that we are
   // sending and that we need to initialize the value.  First DHCP Solicit
   // gets 0 elapsed-time.  Otherwise, calculate based on StartTime.
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/TlsDxe: Remove the redundant library class.

2018-10-15 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1018.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/TlsDxe/TlsDxe.inf | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/NetworkPkg/TlsDxe/TlsDxe.inf b/NetworkPkg/TlsDxe/TlsDxe.inf
index 907feb735b..aaea0fc2ff 100644
--- a/NetworkPkg/TlsDxe/TlsDxe.inf
+++ b/NetworkPkg/TlsDxe/TlsDxe.inf
@@ -3,11 +3,11 @@
 #  EFI TLS Configuration Protocol.
 #
 #  This module produces EFI TLS (Transport Layer Security) Protocol and EFI TLS
 #  Service Binding Protocol, to provide TLS services.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution. The full text of the license may be 
found at
 #  http://opensource.org/licenses/bsd-license.php.
@@ -50,11 +50,10 @@
   MemoryAllocationLib
   BaseMemoryLib
   BaseLib
   UefiLib
   DebugLib
-  NetLib
   BaseCryptLib
   TlsLib
 
 [Protocols]
   gEfiTlsServiceBindingProtocolGuid  ## PRODUCES
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.

2018-10-15 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1251

IpSecDxe failed to create the Child SA during parsing SA Payload, the issue
was caused by the below commit:

SHA-1: 1e0db7b11987d0ec93be7dfe26102a327860fdbd
* MdeModulePkg/NetworkPkg: Checking for NULL pointer before use.

In above commit, it changed the value of IsMatch in Ikev2ChildSaParseSaPayload()
to FALSE. That's correct but it exposed the potential bug in to match the 
correct
proposal Data, which will cause the issue happen.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IpSecDxe/Ikev2/Utility.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c 
b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index 0c9c929705..d61bae8c9d 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -2502,15 +2502,16 @@ Ikev2ChildSaParseSaPayload (
   IntegrityAlgorithm == PreferIntegrityAlgorithm &&
   IsSupportEsn == PreferIsSupportEsn
   ) {
 IsMatch = TRUE;
   } else {
-PreferEncryptAlgorithm   = 0;
-PreferIntegrityAlgorithm = 0;
-IsSupportEsn = TRUE;
+IntegrityAlgorithm = 0;
+EncryptAlgorithm   = 0;
+EncryptKeylength   = 0;
+IsSupportEsn   = FALSE;
   }
-   ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) +
+  ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) +
  ProposalData->NumTransforms * sizeof 
(IKEV2_TRANSFORM_DATA));
 }
 
 ProposalData  = (IKEV2_PROPOSAL_DATA *)((IKEV2_SA_DATA 
*)SaPayload->PayloadBuf + 1);
 if (IsMatch) {
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Tcp4Dxe: Remove the trailing white space in one line.

2018-10-07 Thread Jiaxin Wu
Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Bi Dandan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
index fb7f4f8502..7c0504770b 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
@@ -1,17 +1,17 @@
 ## @file
 #  This module produces EFI TCPv4 Protocol and EFI TCPv4 Service Binding 
Protocol.
 #
 #  This module produces EFI TCPv4(Transmission Control Protocol version 4) 
Protocol
-#  upon EFI IPv4 Protocol, to provide basic TCPv4 I/O services. This driver 
only 
+#  upon EFI IPv4 Protocol, to provide basic TCPv4 I/O services. This driver 
only
 #  supports IPv4 network stack.
 #
 #  Notes:
 #  1) This driver can't co-work with the TcpDxe driver in NetworkPkg.
-#  2) This driver might have some issues that have been fixed in the TcpDxe 
driver 
+#  2) This driver might have some issues that have been fixed in the TcpDxe 
driver
 # in NetworkPkg.
-#  3) This driver supports fewer features than the TcpDxe driver in NetworkPkg 
(e.g. IPv6, 
+#  3) This driver supports fewer features than the TcpDxe driver in NetworkPkg 
(e.g. IPv6,
 # TCP Cancel function).
 #  4) TcpDxe driver in NetworkPkg is recommended for use instead of this one 
even though
 # both of them can be used.
 #
 #  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] NetworkPkg/UefiPxeBcDxe: Correct comments to align with the input parameter.

2018-10-07 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1230

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Bi Dandan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c | 11 ++-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h |  5 -
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
index 9725fb40dd..61d2d59675 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
@@ -1,9 +1,9 @@
 /** @file
   Functions implementation related with Mtftp for UefiPxeBc Driver.
 
-  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -107,10 +107,11 @@ PxeBcMtftp6CheckPacket (
 
   @param[in]  PrivatePointer to PxeBc private data.
   @param[in]  Config Pointer to EFI_MTFTP6_CONFIG_DATA.
   @param[in]  Filename   Pointer to boot file name.
   @param[in]  BlockSize  Pointer to required block size.
+  @param[in]  WindowSize Pointer to required window size.
   @param[in, out] BufferSize Pointer to buffer size.
 
   @retval EFI_SUCCESSSucessfully obtained the size of file.
   @retval EFI_NOT_FOUND  Parse the tftp ptions failed.
   @retval EFI_DEVICE_ERROR   The network device encountered an error during 
this operation.
@@ -246,10 +247,11 @@ ON_ERROR:
 
   @param[in]  PrivatePointer to PxeBc private data.
   @param[in]  Config Pointer to EFI_MTFTP6_CONFIG_DATA.
   @param[in]  Filename   Pointer to boot file name.
   @param[in]  BlockSize  Pointer to required block size.
+  @param[in]  WindowSize Pointer to required window size.
   @param[in]  BufferPtr  Pointer to buffer.
   @param[in, out] BufferSize Pointer to buffer size.
   @param[in]  DontUseBuffer  Indicates whether with a receive buffer.
 
   @retval EFI_SUCCESSSuccessfully read the data from the special file.
@@ -414,10 +416,11 @@ PxeBcMtftp6WriteFile (
 
   @param[in]   PrivatePointer to PxeBc private data.
   @param[in]   Config Pointer to EFI_MTFTP6_CONFIG_DATA.
   @param[in]   Filename   Pointer to boot file name.
   @param[in]   BlockSize  Pointer to required block size.
+  @param[in]   WindowSize Pointer to required window size.
   @param[in]   BufferPtr  Pointer to buffer.
   @param[in, out]  BufferSize Pointer to buffer size.
   @param[in]   DontUseBuffer  Indicates whether to use a receive buffer.
 
   @retval EFI_SUCCESSSuccessfully obtained the data from the file 
included in directory.
@@ -584,10 +587,11 @@ PxeBcMtftp4CheckPacket (
 
   @param[in]  PrivatePointer to PxeBc private data.
   @param[in]  Config Pointer to EFI_MTFTP4_CONFIG_DATA.
   @param[in]  Filename   Pointer to boot file name.
   @param[in]  BlockSize  Pointer to required block size.
+  @param[in]  WindowSize Pointer to required window size.
   @param[in, out] BufferSize Pointer to buffer size.
 
   @retval EFI_SUCCESSSuccessfully obtained the size of file.
   @retval EFI_NOT_FOUND  Parse the tftp options failed.
   @retval EFI_DEVICE_ERROR   The network device encountered an error during 
this operation.
@@ -723,10 +727,11 @@ ON_ERROR:
 
   @param[in]  PrivatePointer to PxeBc private data.
   @param[in]  Config Pointer to EFI_MTFTP4_CONFIG_DATA.
   @param[in]  Filename   Pointer to boot file name.
   @param[in]  BlockSize  Pointer to required block size.
+  @param[in]  WindowSize Pointer to required window size.
   @param[in]  BufferPtr  Pointer to buffer.
   @param[in, out] BufferSize Pointer to buffer size.
   @param[in]  DontUseBuffer  Indicates whether to use a receive buffer.
 
   @retval EFI_SUCCESSSuccessfully read the data from the special file.
@@ -890,10 +895,11 @@ PxeBcMtftp4WriteFile (
 
   @param[in]   PrivatePointer to PxeBc private data.
   @param[in]   Config Pointer to EFI_MTFTP4_CONFIG_DATA.
   @param[in]   Filename   Pointer to boot file name.
   @param[in]   BlockSize  Pointer to required block size.
+  @param[in]   WindowSize Pointer to required window size.
   @param[in]   BufferPtr  Pointer to buffer.
   @param[in, out]  BufferSize Pointer to buffer size.
   @param[in]   DontUseBuffer  Indicates whether to use a receive buffer.
 
   @retval EFI_SUCCES Successfully obtained the data from the file 
included in the directory.

[edk2] [Patch 2/2] ShellPkg/TftpDynamicCommand: Correct comments to align with the input parameter.

2018-10-07 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1230

Cc: Carsey Jaben 
Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Bi Dandan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index d4391b9f33..ccf7abde42 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -163,10 +163,11 @@ GetFileSize (
   @param[in]   Mtftp4 MTFTP4 protocol interface
   @param[in]   FilePath   Path of the file, Unicode encoded
   @param[in]   AsciiFilePath  Path of the file, ASCII encoded
   @param[in]   FileSize   Size of the file in number of bytes
   @param[in]   BlockSize  Value of the TFTP blksize option
+  @param[in]   WindowSize Value of the TFTP window size option
   @param[out]  Data   Address where to store the address of the buffer
   where the data of the file were downloaded in
   case of success.
 
   @retval  EFI_SUCCESS   The file was downloaded.
@@ -904,10 +905,11 @@ Error :
   @param[in]   Mtftp4 MTFTP4 protocol interface
   @param[in]   FilePath   Path of the file, Unicode encoded
   @param[in]   AsciiFilePath  Path of the file, ASCII encoded
   @param[in]   FileSize   Size of the file in number of bytes
   @param[in]   BlockSize  Value of the TFTP blksize option
+  @param[in]   WindowSize Value of the TFTP window size option
   @param[out]  Data   Address where to store the address of the buffer
   where the data of the file were downloaded in
   case of success.
 
   @retval  EFI_SUCCESS   The file was downloaded.
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] Correct comments to align with the input parameter.

2018-10-07 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1230

Cc: Carsey Jaben 
Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Bi Dandan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (2):
  NetworkPkg/UefiPxeBcDxe: Correct comments to align with the input
parameter.
  ShellPkg/TftpDynamicCommand: Correct comments to align with the input
parameter.

 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c  | 11 ++-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h  |  5 -
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used.

2018-09-27 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1217

Local variable 'Mtftp4Token' might be uninitialized when error happen. This 
patch is to
resolve the issue.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Carsey Jaben 
Cc: Zeng Star 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index c66be6b9d9..d4391b9f33 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -934,10 +934,12 @@ DownloadFile (
   DOWNLOAD_CONTEXT  *TftpContext;
   EFI_MTFTP4_TOKEN  Mtftp4Token;
   UINT8 BlksizeBuf[10];
   UINT8 WindowsizeBuf[10];
 
+  ZeroMem (, sizeof (EFI_MTFTP4_TOKEN));
+
   // Downloaded file can be large. BS.AllocatePages() is more faster
   // than AllocatePool() and avoid fragmentation.
   // The downloaded file could be an EFI application. Marking the
   // allocated page as EfiBootServicesCode would allow to execute a
   // potential downloaded EFI application.
@@ -959,11 +961,10 @@ DownloadFile (
   }
   TftpContext->FileSize = FileSize;
   TftpContext->DownloadedNbOfBytes   = 0;
   TftpContext->LastReportedNbOfBytes = 0;
 
-  ZeroMem (, sizeof (EFI_MTFTP4_TOKEN));
   Mtftp4Token.Filename= (UINT8*)AsciiFilePath;
   Mtftp4Token.BufferSize  = FileSize;
   Mtftp4Token.Buffer  = Buffer;
   Mtftp4Token.CheckPacket = CheckPacket;
   Mtftp4Token.Context = (VOID*)TftpContext;
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/6] NetworkPkg/TcpDxe: Add the clarification compared to Tcp4Dxe in MdeModulePkg.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

This patch is to add the driver usage/difference clarification
compared to Tcp4Dxe in MdeModulePkg.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/TcpDxe/TcpDxe.inf | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/TcpDxe/TcpDxe.inf b/NetworkPkg/TcpDxe/TcpDxe.inf
index eb693a147f..56cfd16b98 100644
--- a/NetworkPkg/TcpDxe/TcpDxe.inf
+++ b/NetworkPkg/TcpDxe/TcpDxe.inf
@@ -1,12 +1,17 @@
 ## @file
 #  TCPv4 I/O and TCPv6 I/O services.
 #
 #  This module provides EFI TCPv4 Protocol and EFI TCPv6 Protocol to send and 
receive data stream.
-#  It might provide TCPv4 Protocol or TCPv6 Protocol or both of them that 
depends on
-#  which network stack has been loaded in system.
+#  It might provide TCPv4 Protocol or TCPv6 Protocol or both of them that 
depends on which network 
+#  stack has been loaded in system. This driver supports both IPv4 and IPv6 
network stack.
 #
+#  Notes: 
+#  1) This driver can't co-work with the Tcp4Dxe driver in MdeModulePkg. 
+#  2) This driver includes more bugs fix and supports more features (e.g. 
IPv6, TCP Cancel 
+# function) than the Tcp4Dxe driver in MdeModulePkg. So, we recommand to 
use this driver 
+# even both of them can be used.
 #
 #  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 5/6] NetworkPkg/IScsiDxe: Add the clarification compared to IScsiDxe in MdeModulePkg.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

This patch is to add the driver usage/difference clarification
compared to IScsiDxe in MdeModulePkg.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IScsiDxe/IScsiDxe.inf | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDxe.inf b/NetworkPkg/IScsiDxe/IScsiDxe.inf
index 61a0693a07..007418fd9c 100644
--- a/NetworkPkg/IScsiDxe/IScsiDxe.inf
+++ b/NetworkPkg/IScsiDxe/IScsiDxe.inf
@@ -1,10 +1,20 @@
 ## @file
 #  Client-side iSCSI service.
 #
 #  The iSCSI driver provides iSCSI service in the preboot environment and 
supports
-#  booting over iSCSI.
+#  booting over iSCSI. This driver supports both IPv4 and IPv6 network stack.
+#
+#  Notes: 
+#  1) This driver can't co-work with the IScsiDxe driver in MdeModulePkg. 
+#  2) This driver includes more bugs fix and supports more features (e.g. 
IPv6, Dns 
+# support for target URL configuration, iSCSI keyword support) than the 
IscsiDxe 
+# driver in MdeModulePkg. So, we recommand to use this driver even both of 
them 
+# can be used.
+#  3) This driver depends on the OpenSSL building. To use this driver, please 
follow 
+# the instructions found in the file "Patch-HOWTO.txt" located in 
+# CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
 #
 # Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 6/6] NetworkPkg/UefiPxeBcDxe: Add the clarification compared to UefiPxeBcDxe in MdeModulePkg.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

This patch is to add the driver usage/difference clarification
compared to UefiPxeBcDxe in MdeModulePkg.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf 
b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
index e2a0eb44b1..f2ec34df93 100644
--- a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+++ b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
@@ -1,12 +1,17 @@
 ## @file
 #  Access PXE-compatible devices for network access and network booting.
 #
 #  This driver provides PXE Base Code Protocol which is used to accessing
-#  PXE-compatible device for network access or booting. It could work together
-#  with an IPv4 stack, an IPv6 stack or both.
+#  PXE-compatible device for network access or booting. This driver supports 
+#  both IPv4 and IPv6 network stack.
 #
+#  Notes: 
+#  1) This driver can't co-work with the UefiPxeBcDxe driver in MdeModulePkg. 
+#  2) This driver includes more bugs fix and supports more features (e.g. 
IPv6, 
+# MTFTP windowsize) than the UefiPxeBcDxe driver in MdeModulePkg. So, we 
+# recommand to use this driver even both of them can be used.
 #
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/6] MdeModulePkg/UefiPxeBcDxe: Add the clarification compared to UefiPxeBcDxe in NetworkPkg.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

This patch is to add the driver usage/difference clarification
compared to UefiPxeBcDxe in NetworkPkg.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 .../Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf   | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
index b5b9e80710..0fef0058bd 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
@@ -2,11 +2,20 @@
 #  This module produces EFI Preboot Execution Environment (PXE) Base Code 
Protocol.
 #
 #  This module produces EFI PXE Base Code Protocol upon EFI MMP Protocl and 
IPv4
 #  network stack, used to control PXE-compatible devices. It produces EFI Load 
File
 #  Protocol to provide one clean way to otain control from the boot manager if 
the
-#  boot patch is from the remote device.
+#  boot patch is from the remote device. This driver only supports IPv4 
network stack.
+#
+#  Notes: 
+#  1) This driver can't co-work with the UefiPxeBcDxe driver in NetworkPkg. 
+#  2) This driver might have some issues that have been fixed in the 
UefiPxeBcDxe 
+# driver in NetworkPkg. 
+#  3) This driver supports less feature than the UefiPxeBcDxe driver in 
NetworkPkg 
+# (e.g. IPv6, MTFTP windowsize).
+#  4) UefiPxeBcDxe driver in NetworkPkg is recommanded to use instead of this 
one even 
+# both of them can be used.
 #
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution. The full text of the license may be 
found at
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/6] MdeModulePkg/Tcp4Dxe: Add the clarification compared to TcpDxe in NetworkPkg.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

This patch is to add the driver usage/difference clarification
compared to TcpDxe in NetworkPkg.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
index b54321caaa..0561eb7421 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
@@ -1,10 +1,20 @@
 ## @file
 #  This module produces EFI TCPv4 Protocol and EFI TCPv4 Service Binding 
Protocol.
 #
 #  This module produces EFI TCPv4(Transmission Control Protocol version 4) 
Protocol
-#  upon EFI IPv4 Protocol, to provide basic TCPv4 I/O services.
+#  upon EFI IPv4 Protocol, to provide basic TCPv4 I/O services. This driver 
only 
+#  supports IPv4 network stack.
+#
+#  Notes: 
+#  1) This driver can't co-work with the TcpDxe driver in NetworkPkg. 
+#  2) This driver might have some issues that have been fixed in the TcpDxe 
driver 
+# in NetworkPkg. 
+#  3) This driver supports less feature than the TcpDxe driver in NetworkPkg 
(e.g. IPv6, 
+# TCP Cancel function). 
+#  4) TcpDxe driver in NetworkPkg is recommanded to use instead of this one 
even both 
+# of them can be used.
 #
 #  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution. The full text of the license may be 
found at
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/6] MdeModulePkg/IScsiDxe: Add the clarification compared to IScsiDxe in NetworkPkg.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

This patch is to add the driver usage/difference clarification
compared to IScsiDxe in NetworkPkg.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf 
b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
index c3b8c7d15a..cd6a2ef843 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
@@ -2,11 +2,21 @@
 #  This module produces EFI iSCSI Initiator Name Protocol.
 #
 #  This module produces EFI iSCSI Initiator Name Protocol upon EFI TCPv4 
Protocol
 #  and EFI DHCPv4 Protocol, to provide the capability to do the transport for 
SCSI
 #  data over TCP/IP. It installs EFI HII Configuration Access Protocol to 
provide
-#  one way to configurate the iSCSI setting.
+#  one way to configurate the iSCSI setting. This driver only supports IPv4 
network 
+#  stack.
+#
+#  Notes: 
+#  1) This driver can't co-work with the IScsiDxe driver in NetworkPkg. 
+#  2) This driver might have some issues that have been fixed in the IScsiDxe 
driver 
+# in NetworkPkg.
+#  3) This driver supports less feature than the IScsiDxe driver in NetworkPkg 
+# (e.g. IPv6, Dns support for target URL configuration, iSCSI keyword 
support).
+#  4) IScsiDxe driver in NetworkPkg is recommanded to use instead of this one 
even 
+# both of them can be used.
 #
 #  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/6] Add the clarification for TCP/ISCSI/PXE drivers.

2018-09-24 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205

The series patches describe the difference against the overlapped network 
drivers between NetworkPkg and MdeModulePkg (ISCSI/TCP/PXE drivers - 
Tcp4Dxe VS TcpDxe, IScsiDxe VS IScsiDxe,  UefiPxeBcDxe VS UefiPxeBcDxe).

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (6):
  MdeModulePkg/Tcp4Dxe: Add the clarification compared to TcpDxe in
NetworkPkg.
  MdeModulePkg/IScsiDxe: Add the clarification compared to IScsiDxe in
NetworkPkg.
  MdeModulePkg/UefiPxeBcDxe: Add the clarification compared to
UefiPxeBcDxe in NetworkPkg.
  NetworkPkg/TcpDxe: Add the clarification compared to Tcp4Dxe in
MdeModulePkg.
  NetworkPkg/IScsiDxe: Add the clarification compared to IScsiDxe in
MdeModulePkg.
  NetworkPkg/UefiPxeBcDxe: Add the clarification compared to
UefiPxeBcDxe in MdeModulePkg.

 MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf | 12 +++-
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf   | 12 +++-
 .../Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf  | 11 ++-
 NetworkPkg/IScsiDxe/IScsiDxe.inf | 12 +++-
 NetworkPkg/TcpDxe/TcpDxe.inf |  9 +++--
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf |  9 +++--
 6 files changed, 57 insertions(+), 8 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 5/5] NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

2018-09-24 Thread Jiaxin Wu
*v2: Since the new PCD (PcdPxeTftpWindowSize) was renamed/defined in
NetworkPkg instead of MdeModulePkg, this new version is to update the
consuming PXE driver.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to use the specified MTFTP windowsize to benefit the PXE
download performance.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Shao Ming 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c  |  10 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c | 137 +--
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h |   6 +-
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf |   3 +
 4 files changed, 121 insertions(+), 35 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 13396903f5..468b38d887 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -847,11 +847,11 @@ EfiPxeBcMtftp (
   EFI_MTFTP4_CONFIG_DATA  Mtftp4Config;
   EFI_MTFTP6_CONFIG_DATA  Mtftp6Config;
   VOID*Config;
   EFI_STATUS  Status;
   EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
-
+  UINTN   WindowSize;
 
   if ((This == NULL) ||
   (Filename == NULL) ||
   (BufferSize == NULL) ||
   (ServerIp == NULL) ||
@@ -871,10 +871,15 @@ EfiPxeBcMtftp (
   Config= NULL;
   Status= EFI_DEVICE_ERROR;
   Private   = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);
   Mode  = Private->PxeBc.Mode;
 
+  //
+  // Get PcdPxeTftpWindowSize.
+  //
+  WindowSize = (UINTN) PcdGet64 (PcdPxeTftpWindowSize);
+
   if (Mode->UsingIpv6) {
 if (!NetIp6IsValidUnicast (>v6)) {
   return EFI_INVALID_PARAMETER;
 }
   } else {
@@ -928,10 +933,11 @@ EfiPxeBcMtftp (
 Status = PxeBcTftpGetFileSize (
Private,
Config,
Filename,
BlockSize,
+   (WindowSize > 1) ?  : NULL,
BufferSize
);
 
 break;
 
@@ -942,10 +948,11 @@ EfiPxeBcMtftp (
 Status = PxeBcTftpReadFile (
Private,
Config,
Filename,
BlockSize,
+   (WindowSize > 1) ?  : NULL,
BufferPtr,
BufferSize,
DontUseBuffer
);
 
@@ -974,10 +981,11 @@ EfiPxeBcMtftp (
 Status = PxeBcTftpReadDirectory (
Private,
Config,
Filename,
BlockSize,
+   (WindowSize > 1) ?  : NULL,
BufferPtr,
BufferSize,
DontUseBuffer
);
 
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
index 270190d42e..9725fb40dd 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
@@ -17,11 +17,12 @@
 
 CHAR8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
   "blksize",
   "timeout",
   "tsize",
-  "multicast"
+  "multicast",
+  "windowsize"
 };
 
 
 /**
   This is a callback function when packets are received or transmitted in 
Mtftp driver.
@@ -120,28 +121,31 @@ EFI_STATUS
 PxeBcMtftp6GetFileSize (
   IN PXEBC_PRIVATE_DATA   *Private,
   IN EFI_MTFTP6_CONFIG_DATA   *Config,
   IN UINT8*Filename,
   IN UINTN*BlockSize,
+  IN UINTN*WindowSize,
   IN OUT UINT64   *BufferSize
   )
 {
   EFI_MTFTP6_PROTOCOL *Mtftp6;
-  EFI_MTFTP6_OPTION   ReqOpt[2];
+  EFI_MTFTP6_OPTION   ReqOpt[3];
   EFI_MTFTP6_PACKET   *Packet;
   EFI_MTFTP6_OPTION   *Option;
   UINT32  PktLen;
-  UINT8   OptBuf[128];
+  UINT8   OptBuf[PXE_MTFTP_OPTBUF_MAXNUM_INDEX];
+  UINTN   OptBufSize;
   UINT32  OptCnt;
   EFI_STATUS  Status;
 
   *BufferSize   = 0;
   Status= EFI_DEVICE_ERROR;
   Mtftp6= Private->Mtftp6;
   Packet= NULL;
   Option= NULL;
   PktLen= 0;
+  OptBufSize= PXE_MTFTP_OPTBUF_MAXNUM_INDEX;
   OptCnt= 1;
   Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
 
   Status = Mtftp6->Configure (Mtftp6, Config);
   if (EFI_ERROR (Status)) {
@@ -150,17 +154,26 @@ PxeBcMtftp6GetFileSize (
 
   //
   // Build the required options for get info.
   //
   ReqOpt[0].OptionStr = (UINT8 *) mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];
-  PxeBcUintnToAscDec (0, OptBuf, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);
+  PxeBcUintnToAscDec (0, OptBuf, OptBufSize);
   ReqOpt[0].ValueStr  = OptBuf;
 
   if (BlockSize != NULL) {
-ReqOpt[1].OptionStr 

[edk2] [PATCH v2 0/5] Support windowsize to benefit tftp/pxe download performance.

2018-09-24 Thread Jiaxin Wu
*v2: The first three patches(1/2/3) are the same with version 1, just update 
the last two
patches (4/5):
I) 
This patch has been discarded since we rename and redefine the PCD in 
NetworkPkg instead 
of MdeModulePkg. The replacement is: 
[PATCH v2 4/5] NetworkPkg: Define one PCD for PXE to specify MTFTP windowsize.
II) 
Since the new PCD (PcdPxeTftpWindowSize) was renamed/defined in NetworkPkg 
instead of 
MdeModulePkg, we udpate the consuming PXE driver. The new version patch is:
[PATCH v2 5/5] NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

The series patches are to support the TFTP windowsize option described in RFC 
7440.
TFTP shell command and UEFI PXE driver will use the feature to benefit the 
download 
performance.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Carsey Jaben 
Cc: Shao Ming 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (5):
  MdeModulePke/Mtftp4Dxe: Support windowsize in read request operation.
  NetworkPkg/Mtftp6Dxe: Support windowsize in read request operation.
  ShellPkg/TftpDynamicCommand: Add one option for tftp command to
specify windowsize.
  NetworkPkg: Define one PCD for PXE to specify MTFTP windowsize.
  NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   5 +
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h  |  10 ++
 .../Network/Mtftp4Dxe/Mtftp4Option.c  |  25 +++-
 .../Network/Mtftp4Dxe/Mtftp4Option.h  |   8 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c   |  55 +--
 .../Network/Mtftp4Dxe/Mtftp4Support.c |   8 +-
 .../Network/Mtftp4Dxe/Mtftp4Support.h |  13 --
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c   |   2 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h |  13 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.c   |  22 ++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.h   |  14 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c  |  53 +--
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c  |  10 ++
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c  |   2 +-
 NetworkPkg/NetworkPkg.dec |   6 +
 NetworkPkg/NetworkPkg.uni |   6 +
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   |  10 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c  | 137 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h  |   6 +-
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf  |   3 +
 .../DynamicCommand/TftpDynamicCommand/Tftp.c  |  65 +++--
 .../TftpDynamicCommand/Tftp.uni   |   6 +-
 22 files changed, 371 insertions(+), 108 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 4/5] NetworkPkg: Define one PCD for PXE to specify MTFTP windowsize.

2018-09-24 Thread Jiaxin Wu
*v2: Rename and redefine the PCD in NetworkPkg instead of MdeModulePkg.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to define one new PCD for PXE driver to specify MTFTP windowsize 
so as
to improve the PXE download performance. The default value is set to 4.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Shao Ming 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/NetworkPkg.dec | 6 ++
 NetworkPkg/NetworkPkg.uni | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
index aae36226d5..aa721d8315 100644
--- a/NetworkPkg/NetworkPkg.dec
+++ b/NetworkPkg/NetworkPkg.dec
@@ -90,10 +90,16 @@
   # TRUE  - HTTP connections are allowed. Both the "https://; and "http://; 
URI schemes are permitted.
   # FALSE - HTTP connections are denied. Only the "https://; URI scheme is 
permitted.
   # @Prompt Indicates whether HTTP connections are permitted or not.
   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|FALSE|BOOLEAN|0x0008
 
+  ## This setting is to specify the MTFTP windowsize used by UEFI PXE driver. 
+  # A value of 0 indicates the default value of windowsize(1). 
+  # A non-zero value will be used as windowsize.
+  # @Prompt PXE TFTP windowsize.
+  gEfiNetworkPkgTokenSpaceGuid.PcdPxeTftpWindowSize|0x4|UINT64|0x1008  
+
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   ## IPv6 DHCP Unique Identifier (DUID) Type configuration (From RFCs 3315 and 
6355).
   # 01 = DUID Based on Link-layer Address Plus Time [DUID-LLT]
   # 04 = UUID-Based DHCPv6 Unique Identifier (DUID-UUID)
   # 02 = DUID Assigned by Vendor Based on Enterprise Number [DUID-EN] (not 
supported)
diff --git a/NetworkPkg/NetworkPkg.uni b/NetworkPkg/NetworkPkg.uni
index 5604b1bf32..07585680e3 100644
--- a/NetworkPkg/NetworkPkg.uni
+++ b/NetworkPkg/NetworkPkg.uni
@@ -53,10 +53,16 @@
 
 #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdAllowHttpConnections_HELP  
#language en-US "Indicates whether HTTP connections are permitted or not.\n"

"TRUE  - HTTP connections are allowed.\n"

"FALSE - HTTP connections are denied."
 
+#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdPxeTftpWindowSize_PROMPT  
#language en-US "This setting is to specify the MTFTP windowsize used by UEFI 
PXE driver."
+
+#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdPxeTftpWindowSize_HELP  #language 
en-US "Specify MTFTP windowsize used by UEFI PXE driver.\n"
+   
 "A value of 0 indicates the default value of windowsize(1).\n"
+   
 "A non-zero value will be used as windowsize." 
  
+
 #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdIpsecCertificateEnabled_PROMPT  
#language en-US "Enable IPsec IKEv2 Certificate Authentication."
 
 #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdIpsecCertificateEnabled_HELP  
#language en-US "Indicates if the IPsec IKEv2 Certificate Authentication 
feature is enabled or not.\n"

   "TRUE  - Certificate Authentication feature is enabled.\n"

   "FALSE - Does not support Certificate Authentication."
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 5/5] NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to use the specified MTFTP windowsize to benefit the PXE
download performance.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Shao Ming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c  |  10 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c | 137 +--
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h |   6 +-
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf |   2 +
 4 files changed, 120 insertions(+), 35 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 13396903f5..db463d1b11 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -847,11 +847,11 @@ EfiPxeBcMtftp (
   EFI_MTFTP4_CONFIG_DATA  Mtftp4Config;
   EFI_MTFTP6_CONFIG_DATA  Mtftp6Config;
   VOID*Config;
   EFI_STATUS  Status;
   EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
-
+  UINTN   WindowSize;
 
   if ((This == NULL) ||
   (Filename == NULL) ||
   (BufferSize == NULL) ||
   (ServerIp == NULL) ||
@@ -871,10 +871,15 @@ EfiPxeBcMtftp (
   Config= NULL;
   Status= EFI_DEVICE_ERROR;
   Private   = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);
   Mode  = Private->PxeBc.Mode;
 
+  //
+  // Get PcdTftpWindowSize.
+  //
+  WindowSize   = (UINTN) PcdGet64 (PcdTftpWindowSize);
+
   if (Mode->UsingIpv6) {
 if (!NetIp6IsValidUnicast (>v6)) {
   return EFI_INVALID_PARAMETER;
 }
   } else {
@@ -928,10 +933,11 @@ EfiPxeBcMtftp (
 Status = PxeBcTftpGetFileSize (
Private,
Config,
Filename,
BlockSize,
+   (WindowSize > 1) ?  : NULL,
BufferSize
);
 
 break;
 
@@ -942,10 +948,11 @@ EfiPxeBcMtftp (
 Status = PxeBcTftpReadFile (
Private,
Config,
Filename,
BlockSize,
+   (WindowSize > 1) ?  : NULL,
BufferPtr,
BufferSize,
DontUseBuffer
);
 
@@ -974,10 +981,11 @@ EfiPxeBcMtftp (
 Status = PxeBcTftpReadDirectory (
Private,
Config,
Filename,
BlockSize,
+   (WindowSize > 1) ?  : NULL,
BufferPtr,
BufferSize,
DontUseBuffer
);
 
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
index 270190d42e..9725fb40dd 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
@@ -17,11 +17,12 @@
 
 CHAR8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
   "blksize",
   "timeout",
   "tsize",
-  "multicast"
+  "multicast",
+  "windowsize"
 };
 
 
 /**
   This is a callback function when packets are received or transmitted in 
Mtftp driver.
@@ -120,28 +121,31 @@ EFI_STATUS
 PxeBcMtftp6GetFileSize (
   IN PXEBC_PRIVATE_DATA   *Private,
   IN EFI_MTFTP6_CONFIG_DATA   *Config,
   IN UINT8*Filename,
   IN UINTN*BlockSize,
+  IN UINTN*WindowSize,
   IN OUT UINT64   *BufferSize
   )
 {
   EFI_MTFTP6_PROTOCOL *Mtftp6;
-  EFI_MTFTP6_OPTION   ReqOpt[2];
+  EFI_MTFTP6_OPTION   ReqOpt[3];
   EFI_MTFTP6_PACKET   *Packet;
   EFI_MTFTP6_OPTION   *Option;
   UINT32  PktLen;
-  UINT8   OptBuf[128];
+  UINT8   OptBuf[PXE_MTFTP_OPTBUF_MAXNUM_INDEX];
+  UINTN   OptBufSize;
   UINT32  OptCnt;
   EFI_STATUS  Status;
 
   *BufferSize   = 0;
   Status= EFI_DEVICE_ERROR;
   Mtftp6= Private->Mtftp6;
   Packet= NULL;
   Option= NULL;
   PktLen= 0;
+  OptBufSize= PXE_MTFTP_OPTBUF_MAXNUM_INDEX;
   OptCnt= 1;
   Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
 
   Status = Mtftp6->Configure (Mtftp6, Config);
   if (EFI_ERROR (Status)) {
@@ -150,17 +154,26 @@ PxeBcMtftp6GetFileSize (
 
   //
   // Build the required options for get info.
   //
   ReqOpt[0].OptionStr = (UINT8 *) mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];
-  PxeBcUintnToAscDec (0, OptBuf, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);
+  PxeBcUintnToAscDec (0, OptBuf, OptBufSize);
   ReqOpt[0].ValueStr  = OptBuf;
 
   if (BlockSize != NULL) {
-ReqOpt[1].OptionStr = (UINT8 *) 
mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
-ReqOpt[1].ValueStr  = (UINT8 *) (ReqOpt[0].ValueStr + AsciiStrLen ((CHAR8 
*) ReqOpt[0].ValueStr) + 1);
-

[edk2] [Patch 0/5] Support windowsize to benefit tftp/pxe download performance.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

The series patches are to support the TFTP windowsize option described in RFC 
7440.
TFTP shell command and UEFI PXE driver will use the feature to benefit the 
download 
performance.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Carsey Jaben 
Cc: Shao Ming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (5):
  MdeModulePke/Mtftp4Dxe: Support windowsize in read request operation.
  NetworkPkg/Mtftp6Dxe: Support windowsize in read request operation.
  ShellPkg/TftpDynamicCommand: Add one option for tftp command to
specify windowsize.
  MdeModulePkg/MdeModulePkg.dec: Define one PCD for PXE to specify MTFTP
windowsize.
  NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

 MdeModulePkg/MdeModulePkg.dec |   1 +
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   5 +
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h  |  10 ++
 .../Network/Mtftp4Dxe/Mtftp4Option.c  |  25 +++-
 .../Network/Mtftp4Dxe/Mtftp4Option.h  |   8 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c   |  55 +--
 .../Network/Mtftp4Dxe/Mtftp4Support.c |   8 +-
 .../Network/Mtftp4Dxe/Mtftp4Support.h |  13 --
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c   |   2 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h |  13 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.c   |  22 ++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.h   |  14 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c  |  53 +--
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c  |  10 ++
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c  |   2 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   |  10 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c  | 137 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h  |   6 +-
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf  |   2 +
 .../DynamicCommand/TftpDynamicCommand/Tftp.c  |  65 +++--
 .../TftpDynamicCommand/Tftp.uni   |   6 +-
 21 files changed, 359 insertions(+), 108 deletions(-)

-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/5] MdeModulePkg/MdeModulePkg.dec: Define one PCD for PXE to specify MTFTP windowsize.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to define one new PCD for PXE driver to specify MTFTP windowsize 
so as
to improve the PXE download performance. The default value is set to 4.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Shao Ming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/MdeModulePkg.dec | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 74a699cbb7..bfc63e5fcb 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1203,10 +1203,11 @@
   ## This setting can override the default TFTP block size. A value of 0 
computes
   # the default from MTU information. A non-zero value will be used as block 
size
   # in bytes.
   # @Prompt TFTP block size.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize|0x0|UINT64|0x30001026
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTftpWindowSize|0x4|UINT64|0x3000102A
 
   ## Maximum address that the DXE Core will allocate the 
EFI_SYSTEM_TABLE_POINTER
   #  structure. The default value for this PCD is 0, which means that the DXE 
Core
   #  will allocate the buffer from the EFI_SYSTEM_TABLE_POINTER structure on a 
4MB
   #  boundary as close to the top of memory as feasible.  If this PCD is set 
to a
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/5] MdeModulePke/Mtftp4Dxe: Support windowsize in read request operation.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to support the TFTP windowsize option described in RFC 7440.
The feature allows the client and server to negotiate a window size of
consecutive blocks to send as an alternative for replacing the single-block
lockstep schema.

Currently, the windowsize for write request operation is not supported since
there is no real use cases.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Shao Ming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |  5 ++
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h  | 10 
 .../Network/Mtftp4Dxe/Mtftp4Option.c  | 25 -
 .../Network/Mtftp4Dxe/Mtftp4Option.h  |  8 ++-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c   | 55 +--
 .../Network/Mtftp4Dxe/Mtftp4Support.c |  8 +--
 .../Network/Mtftp4Dxe/Mtftp4Support.h | 13 -
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c   |  2 +-
 8 files changed, 89 insertions(+), 37 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index 03903640b8..f442e6d7ac 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -78,10 +78,13 @@ Mtftp4CleanOperation (
   ZeroMem (>RequestOption, sizeof (MTFTP4_OPTION));
 
   Instance->Operation = 0;
 
   Instance->BlkSize   = MTFTP4_DEFAULT_BLKSIZE;
+  Instance->WindowSize= 1;
+  Instance->TotalBlock= 0;
+  Instance->AckedBlock= 0;
   Instance->LastBlock = 0;
   Instance->ServerIp  = 0;
   Instance->ListeningPort = 0;
   Instance->ConnectedPort = 0;
   Instance->Gateway   = 0;
@@ -426,10 +429,11 @@ Mtftp4Start (
   if (Token->OptionCount != 0) {
 Status = Mtftp4ParseOption (
Token->OptionList,
Token->OptionCount,
TRUE,
+   Instance->Operation,
>RequestOption
);
 
 if (EFI_ERROR (Status)) {
   TokenStatus = EFI_DEVICE_ERROR;
@@ -441,10 +445,11 @@ Mtftp4Start (
   // Set the operation parameters from the configuration or override data.
   //
   Config  = >Config;
   Instance->Token = Token;
   Instance->BlkSize   = MTFTP4_DEFAULT_BLKSIZE;
+  Instance->WindowSize= MTFTP4_DEFAULT_WINDOWSIZE;
 
   CopyMem (>ServerIp, >ServerIp, sizeof (IP4_ADDR));
   Instance->ServerIp  = NTOHL (Instance->ServerIp);
 
   Instance->ListeningPort = Config->InitialServerPort;
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
index e24890cce8..de304f4e70 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
@@ -6,10 +6,11 @@
   RFC1350 - THE TFTP PROTOCOL (REVISION 2)
   RFC2090 - TFTP Multicast Option
   RFC2347 - TFTP Option Extension
   RFC2348 - TFTP Blocksize Option
   RFC2349 - TFTP Timeout Interval and Transfer Size Options
+  RFC7440 - TFTP Windowsize Option
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -54,10 +55,11 @@ typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL;
 
 #define MTFTP4_DEFAULT_SERVER_PORT  69
 #define MTFTP4_DEFAULT_TIMEOUT  3
 #define MTFTP4_DEFAULT_RETRY5
 #define MTFTP4_DEFAULT_BLKSIZE  512
+#define MTFTP4_DEFAULT_WINDOWSIZE   1
 #define MTFTP4_TIME_TO_GETMAP   5
 
 #define MTFTP4_STATE_UNCONFIGED 0
 #define MTFTP4_STATE_CONFIGED   1
 #define MTFTP4_STATE_DESTROY2
@@ -119,10 +121,18 @@ struct _MTFTP4_PROTOCOL {
   //
   UINT16BlkSize;
   UINT16LastBlock;
   LIST_ENTRYBlocks;
 
+  UINT16WindowSize;
+
+  //
+  // Record the total received block number and the already acked block number.
+  //
+  UINT64TotalBlock;
+  UINT64AckedBlock;
+
   //
   // The server's communication end point: IP and two ports. one for
   // initial request, one for its selected port.
   //
   IP4_ADDR  ServerIp;
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c
index e40561a96b..2f77635268 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c
@@ -1,9 +1,9 @@
 /** @file
   Routines to process MTFTP4 options.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are 

[edk2] [Patch 3/5] ShellPkg/TftpDynamicCommand: Add one option for tftp command to specify windowsize.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to define one new option for TFTP shell command to specify the
windowsize option as defined in RFC 7440. Valid range is between 1 and 64,
default value is 1.

Note that: RFC 7440 does not mention max window size value, but for the
stability reason, the value is limited to 64.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Carsey Jaben 
Cc: Shao Ming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 .../DynamicCommand/TftpDynamicCommand/Tftp.c  | 65 ---
 .../TftpDynamicCommand/Tftp.uni   |  6 +-
 2 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index 44be6d4e76..c66be6b9d9 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -181,10 +181,11 @@ DownloadFile (
   IN   EFI_MTFTP4_PROTOCOL  *Mtftp4,
   IN   CONST CHAR16 *FilePath,
   IN   CONST CHAR8  *AsciiFilePath,
   IN   UINTNFileSize,
   IN   UINT16   BlockSize,
+  IN   UINT16   WindowSize,
   OUT  VOID **Data
   );
 
 /**
   Update the progress of a file download
@@ -225,10 +226,11 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {L"-l", TypeValue},
   {L"-r", TypeValue},
   {L"-c", TypeValue},
   {L"-t", TypeValue},
   {L"-s", TypeValue},
+  {L"-w", TypeValue},
   {NULL , TypeMax}
   };
 
 ///
 /// The default block size (512) of tftp is defined in the RFC1350.
@@ -237,11 +239,21 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
 ///
 /// The valid range of block size option is defined in the RFC2348.
 ///
 #define MTFTP_MIN_BLKSIZE  8
 #define MTFTP_MAX_BLKSIZE  65464
-
+///
+/// The default windowsize (1) of tftp.
+///
+#define MTFTP_DEFAULT_WINDOWSIZE   1
+///
+/// The valid range of window size option.
+/// Note that: RFC 7440 does not mention max window size value, but for the
+/// stability reason, the value is limited to 64.
+///
+#define MTFTP_MIN_WINDOWSIZE   1
+#define MTFTP_MAX_WINDOWSIZE   64
 
 /**
   Function for 'tftp' command.
 
   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
@@ -286,19 +298,21 @@ RunTftp (
   UINTN   FileSize;
   UINTN   DataSize;
   VOID*Data;
   SHELL_FILE_HANDLE   FileHandle;
   UINT16  BlockSize;
+  UINT16  WindowSize;
 
   ShellStatus = SHELL_INVALID_PARAMETER;
   ProblemParam= NULL;
   NicFound= FALSE;
   AsciiRemoteFilePath = NULL;
   Handles = NULL;
   FileSize= 0;
   DataSize= 0;
   BlockSize   = MTFTP_DEFAULT_BLKSIZE;
+  WindowSize  = MTFTP_DEFAULT_WINDOWSIZE;
 
   //
   // Initialize the Shell library (we must be in non-auto-init...)
   //
   Status = ShellInitialize ();
@@ -434,10 +448,24 @@ RunTftp (
   );
   goto Error;
 }
   }
 
+  ValueStr = ShellCommandLineGetValue (CheckPackage, L"-w");
+  if (ValueStr != NULL) {
+if (!StringToUint16 (ValueStr, )) {
+  goto Error;
+}
+if (WindowSize < MTFTP_MIN_WINDOWSIZE || WindowSize > 
MTFTP_MAX_WINDOWSIZE) {
+  ShellPrintHiiEx (
+-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
+mTftpHiiHandle, L"tftp", ValueStr
+  );
+  goto Error;
+}
+  }
+
   //
   // Locate all MTFTP4 Service Binding protocols
   //
   ShellStatus = SHELL_NOT_FOUND;
   Status = gBS->LocateHandleBuffer (
@@ -508,11 +536,11 @@ RunTftp (
 mTftpHiiHandle, RemoteFilePath, NicName, Status
   );
   goto NextHandle;
 }
 
-Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, 
FileSize, BlockSize, );
+Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, 
FileSize, BlockSize, WindowSize, );
 if (EFI_ERROR (Status)) {
   ShellPrintHiiEx (
 -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
 mTftpHiiHandle, RemoteFilePath, NicName, Status
   );
@@ -894,20 +922,21 @@ DownloadFile (
   IN   EFI_MTFTP4_PROTOCOL  *Mtftp4,
   IN   CONST CHAR16 *FilePath,
   IN   CONST CHAR8  *AsciiFilePath,
   IN   UINTNFileSize,
   IN   UINT16   BlockSize,
+  IN   UINT16   WindowSize,
   OUT  VOID **Data
   )
 {
   EFI_STATUSStatus;
   EFI_PHYSICAL_ADDRESS  PagesAddress;
   VOID  *Buffer;
   DOWNLOAD_CONTEXT  *TftpContext;
   EFI_MTFTP4_TOKEN  Mtftp4Token;
-  EFI_MTFTP4_OPTION ReqOpt;
-  UINT8 OptBuf[10];
+  UINT8 BlksizeBuf[10];
+  UINT8 WindowsizeBuf[10];
 
   // Downloaded file can be large. BS.AllocatePages() is more faster
   // than AllocatePool() and avoid fragmentation.
   // The downloaded file could be an EFI application. Marking the

[edk2] [Patch 2/5] NetworkPkg/Mtftp6Dxe: Support windowsize in read request operation.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

This patch is to support the TFTP windowsize option described in RFC 7440.
The feature allows the client and server to negotiate a window size of
consecutive blocks to send as an alternative for replacing the single-block
lockstep schema.

Currently, the windowsize for write request operation is not supported since
there is no real use cases.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Shao Ming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h| 13 ++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.c  | 22 +++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.h  | 14 +---
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c | 53 +++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c | 10 ++
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c |  2 +-
 6 files changed, 90 insertions(+), 24 deletions(-)

diff --git a/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h 
b/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
index 6b1ce7f853..cf1b6abacc 100644
--- a/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
+++ b/NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h
@@ -1,9 +1,9 @@
 /** @file
   Mtftp6 internal data structure and definition declaration.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved. 
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. 
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -44,10 +44,11 @@ typedef struct _MTFTP6_INSTANCE MTFTP6_INSTANCE;
 #define MTFTP6_DEFAULT_SERVER_CMD_PORT 69
 #define MTFTP6_DEFAULT_TIMEOUT 3
 #define MTFTP6_GET_MAPPING_TIMEOUT 3
 #define MTFTP6_DEFAULT_MAX_RETRY   5
 #define MTFTP6_DEFAULT_BLK_SIZE512
+#define MTFTP6_DEFAULT_WINDOWSIZE  1
 #define MTFTP6_TICK_PER_SECOND 1000U
 
 #define MTFTP6_SERVICE_FROM_THIS(a)CR (a, MTFTP6_SERVICE, ServiceBinding, 
MTFTP6_SERVICE_SIGNATURE)
 #define MTFTP6_INSTANCE_FROM_THIS(a)   CR (a, MTFTP6_INSTANCE, Mtftp6, 
MTFTP6_INSTANCE_SIGNATURE)
 
@@ -75,10 +76,20 @@ struct _MTFTP6_INSTANCE {
 
   UINT16BlkSize;
   UINT16LastBlk;
   LIST_ENTRYBlkList;
 
+  UINT16Operation;
+
+  UINT16WindowSize;
+
+  //
+  // Record the total received block number and the already acked block number.
+  //
+  UINT64TotalBlock;
+  UINT64AckedBlock;
+
   EFI_IPv6_ADDRESS  ServerIp;
   UINT16ServerCmdPort;
   UINT16ServerDataPort;
   UDP_IO*UdpIo;
 
diff --git a/NetworkPkg/Mtftp6Dxe/Mtftp6Option.c 
b/NetworkPkg/Mtftp6Dxe/Mtftp6Option.c
index 0dcf546fa8..94790e3ad6 100644
--- a/NetworkPkg/Mtftp6Dxe/Mtftp6Option.c
+++ b/NetworkPkg/Mtftp6Dxe/Mtftp6Option.c
@@ -1,9 +1,9 @@
 /** @file
   Mtftp6 option parse functions implementation.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -15,10 +15,11 @@
 
 #include "Mtftp6Impl.h"
 
 CHAR8 *mMtftp6SupportedOptions[MTFTP6_SUPPORTED_OPTIONS_NUM] = {
   "blksize",
+  "windowsize",
   "timeout",
   "tsize",
   "multicast"
 };
 
@@ -144,10 +145,11 @@ Mtftp6ParseMcastOption (
 
   @param[in]  Options   The pointer to the extension options list.
   @param[in]  Count The num of the extension options.
   @param[in]  IsRequest If FALSE, the extension options is included
 by a request packet.
+  @param[in]  Operation The current performed operation.
   @param[in]  ExtInfo   The pointer to the option information to be filled.
 
   @retval EFI_SUCCESSParse the multicast option successfully.
   @retval EFI_INVALID_PARAMETER  There is one option is malformatted at least.
   @retval EFI_UNSUPPORTEDThere is one option is not supported at least.
@@ -156,10 +158,11 @@ Mtftp6ParseMcastOption (
 EFI_STATUS
 Mtftp6ParseExtensionOption (
   IN EFI_MTFTP6_OPTION*Options,
   IN UINT32   Count,
   IN BOOLEAN  IsRequest,
+  IN UINT16   Operation,
   IN MTFTP6_EXT_OPTION_INFO   *ExtInfo
   )
 {
   EFI_STATUS  Status;
   EFI_MTFTP6_OPTION   *Opt;
@@ -226,10 +229,27 @@ Mtftp6ParseExtensionOption (
 return EFI_INVALID_PARAMETER;
   }
 
   ExtInfo->BitMap |= MTFTP6_OPT_MCAST_BIT;
 
+} else if (AsciiStriCmp ((CHAR8 *) 

[edk2] [Patch] MdeModulePkg/Ip4Dxe: Refine the coding style.

2018-09-16 Thread Jiaxin Wu
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1180
Remove the trailing white spaces.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Bi Dandan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index b1af5294fb..4cb3b32688 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -673,13 +673,13 @@ Ip4ConfigProtocol (
 
 //
 // Add a route to this connected network in the instance route table.
 //
 Ip4AddRoute (
-  IpInstance->RouteTable, 
-  Ip & Netmask, 
-  Netmask, 
+  IpInstance->RouteTable,
+  Ip & Netmask,
+  Netmask,
   IP4_ALLZERO_ADDRESS
   );
   } else {
 //
 // Use the default address. Check the state.
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v2] MdeModulePkg/Ip4Dxe: Sync the direct route entry setting.

2018-09-04 Thread Jiaxin Wu
v2: use "IP & Netmask" directly instead of defining an additional variable.

This patch is to sync the direct route entry setting in both the default
and Instance route table {Subnet, Mask, NextHope} (
https://bugzilla.tianocore.org/show_bug.cgi?id=1143).

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Reviewed-by: Ye Ting 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c |  7 ---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c| 10 +++---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index c19a72730e..b52542cd84 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -557,17 +557,10 @@ Ip4Config2SetDefaultAddr (
 return Status;
   }
 }
   }
 
-  Ip4AddRoute (
-IpSb->DefaultRouteTable,
-StationAddress,
-SubnetMask,
-IP4_ALLZERO_ADDRESS
-);
-
   //
   // Add a route for the connected network.
   //
   Subnet = StationAddress & SubnetMask;
 
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 6a26143e30..13ebeab1be 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -670,14 +670,18 @@ Ip4ConfigProtocol (
 
   InsertTailList (>Interfaces, >Link);
 }
 
 //
-// Add a route to this connected network in the route table
+// Add a route to this connected network in the instance route table.
 //
-Ip4AddRoute (IpInstance->RouteTable, Ip, Netmask, IP4_ALLZERO_ADDRESS);
-
+Ip4AddRoute (
+  IpInstance->RouteTable, 
+  Ip & Netmask, 
+  Netmask, 
+  IP4_ALLZERO_ADDRESS
+  );
   } else {
 //
 // Use the default address. Check the state.
 //
 if (IpSb->State == IP4_SERVICE_UNSTARTED) {
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Library/DxeHttpLib: Handle the blank value in HTTP header.

2018-09-04 Thread Jiaxin Wu
This patch is to resolve the lock-up issue if the value of HTTP header
is blank.  The issue is recorded @
https://bugzilla.tianocore.org/show_bug.cgi?id=1102.

Cc: Stephen Benjamin 
Cc: Laszlo Ersek 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 57 +++-
 1 file changed, 44 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c 
b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 5fbb50d03a..2fc3da8a2d 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -1595,63 +1595,94 @@ HttpGetFieldNameAndValue (
 return NULL;
   }
 
   //
   // Each header field consists of a name followed by a colon (":") and the 
field value.
+  // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
+  //
+  // message-header = field-name ":" [ field-value ]
+  // field-name = token
+  // field-value = *( field-content | LWS )
+  //
+  // Note: "*(element)" allows any number element, including zero; 
"1*(element)" requires at least one element.
+  //   [element] means element is optional.
+  //   LWS  = [CRLF] 1*(SP|HT), it can be ' ' or '\t' or '\r\n ' or 
'\r\n\t'.
+  //   CRLF = '\r\n'.
+  //   SP   = ' '.
+  //   HT   = '\t' (Tab).
   //
   FieldNameStr = String;
   FieldValueStr = AsciiStrGetNextToken (FieldNameStr, ':');
   if (FieldValueStr == NULL) {
 return NULL;
   }
 
   //
-  // Replace ':' with 0
+  // Replace ':' with 0, then FieldName has been retrived from String.
   //
   *(FieldValueStr - 1) = 0;
 
   //
-  // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
-  // Note: LWS  = [CRLF] 1*(SP|HT), it can be '\r\n ' or '\r\n\t' or ' ' or 
'\t'.
-  //   CRLF = '\r\n'.
-  //   SP   = ' '.
-  //   HT   = '\t' (Tab).
+  // Handle FieldValueStr, skip all the preceded LWS.
   //
   while (TRUE) {
 if (*FieldValueStr == ' ' || *FieldValueStr == '\t') {
   //
   // Boundary condition check.
   //
   if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 1) {
+//
+// Wrong String format!
+//
 return NULL;
   }
 
   FieldValueStr ++;
 } else if (*FieldValueStr == '\r') {
   //
   // Boundary condition check.
   //
   if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 3) {
-return NULL;
+//
+// No more preceded LWS, so break here.
+//
+break;
   }
 
-  if (*(FieldValueStr + 1) == '\n' && (*(FieldValueStr + 2) == ' ' || 
*(FieldValueStr + 2) == '\t')) {
-FieldValueStr = FieldValueStr + 3;
+  if (*(FieldValueStr + 1) == '\n' ) {
+if (*(FieldValueStr + 2) == ' ' || *(FieldValueStr + 2) == '\t') {
+  FieldValueStr = FieldValueStr + 3;
+} else {
+  //
+  // No more preceded LWS, so break here.
+  //
+  break;
+}
+  } else {
+//
+// Wrong String format!
+//
+return NULL;
   }
 } else {
+  //
+  // No more preceded LWS, so break here.
+  //
   break;
 }
   }
 
-  //
-  // Header fields can be extended over multiple lines by preceding each extra
-  // line with at least one SP or HT.
-  //
   StrPtr = FieldValueStr;
   do {
+//
+// Handle the LWS within the field value.
+//
 StrPtr = AsciiStrGetNextToken (StrPtr, '\r');
 if (StrPtr == NULL || *StrPtr != '\n') {
+  //
+  // Wrong String format!
+  //
   return NULL;
 }
 
 StrPtr++;
   } while (*StrPtr == ' ' || *StrPtr == '\t');
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Ip4Dxe: Sync the direct route entry setting.

2018-08-30 Thread Jiaxin Wu
This patch is to sync the direct route entry setting in both the default
and Instance route table {Subnet, Mask, NextHope}.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c   |  7 ---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 13 ++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index c19a72730e..b52542cd84 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -557,17 +557,10 @@ Ip4Config2SetDefaultAddr (
 return Status;
   }
 }
   }
 
-  Ip4AddRoute (
-IpSb->DefaultRouteTable,
-StationAddress,
-SubnetMask,
-IP4_ALLZERO_ADDRESS
-);
-
   //
   // Add a route for the connected network.
   //
   Subnet = StationAddress & SubnetMask;
 
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 6a26143e30..c68dad7a3c 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -593,10 +593,11 @@ Ip4ConfigProtocol (
   IP4_SERVICE   *IpSb;
   IP4_INTERFACE *IpIf;
   EFI_STATUSStatus;
   IP4_ADDR  Ip;
   IP4_ADDR  Netmask;
+  IP4_ADDR  Subnet;
   EFI_ARP_PROTOCOL  *Arp;
   EFI_IP4_CONFIG2_PROTOCOL  *Ip4Config2;
   EFI_IP4_CONFIG2_POLICYPolicy;
 
   IpSb = IpInstance->Service;
@@ -670,14 +671,20 @@ Ip4ConfigProtocol (
 
   InsertTailList (>Interfaces, >Link);
 }
 
 //
-// Add a route to this connected network in the route table
+// Add a route to this connected network in the instance route table.
 //
-Ip4AddRoute (IpInstance->RouteTable, Ip, Netmask, IP4_ALLZERO_ADDRESS);
-
+Subnet = Ip & Netmask;
+
+Ip4AddRoute (
+  IpInstance->RouteTable, 
+  Subnet, 
+  Netmask, 
+  IP4_ALLZERO_ADDRESS
+  );
   } else {
 //
 // Use the default address. Check the state.
 //
 if (IpSb->State == IP4_SERVICE_UNSTARTED) {
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] NetworkPkg/HttpDxe: Strip square brackets in IPv6 expressed HostName.

2018-08-01 Thread Jiaxin Wu
*v2: Optimize the patch by calculating AsciiStrSize() only once.

In URI, the colon (:) is used to terminate the HostName path before
a port number. However, if HostName is expressed as IPv6 format, colon
characters in IPv6 addresses will conflict with the colon before port
number. To alleviate this conflict in URI, the IPv6 expressed HostName
are enclosed in square brackets ([]). To record the real IPv6 HostName,
square brackets should be stripped.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
Reviewed-by: Fu Siyuan 
Reviewed-by: Laszlo Ersek 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 17deceb395..de48243982 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -403,14 +403,26 @@ EfiHttpRequest (
 Status = HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, );
 if (EFI_ERROR (Status)) {
   goto Error1;
 }
 
-HostName   = NULL;
-Status = HttpUrlGetHostName (Url, UrlParser, );
+Status = HttpUrlGetHostName (Url, UrlParser, );
 if (EFI_ERROR (Status)) {
- goto Error1;
+  goto Error1;
+}
+
+if (HttpInstance->LocalAddressIsIPv6) {
+  HostNameSize = AsciiStrSize (HostName);
+
+  if (HostNameSize > 2 && HostName[0] == '[' && HostName[HostNameSize - 2] 
== ']') {
+//
+// HostName format is expressed as IPv6, so, remove '[' and ']'.
+//
+HostNameSize -= 2;
+CopyMem (HostName, HostName + 1, HostNameSize - 1);
+HostName[HostNameSize - 1] = '\0';
+  }
 }
 
 Status = HttpUrlGetPort (Url, UrlParser, );
 if (EFI_ERROR (Status)) {
   if (HttpInstance->UseHttps) {
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/HttpDxe: Stripped square brackets in IPv6 expressed HostName.

2018-07-31 Thread Jiaxin Wu
In URI, the colon (:) is used to terminate the HostName path before
a port number. However, if HostName is expressed as IPv6 format, colon
characters in IPv6 addresses will conflict with the colon before port
number. To alleviate this conflict in URI, the IPv6 expressed HostName
are enclosed in square brackets ([]). To record the real IPv6 HostName,
square brackets should be stripped.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 17deceb395..e05ee9344b 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -403,14 +403,25 @@ EfiHttpRequest (
 Status = HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, );
 if (EFI_ERROR (Status)) {
   goto Error1;
 }
 
-HostName   = NULL;
-Status = HttpUrlGetHostName (Url, UrlParser, );
+Status = HttpUrlGetHostName (Url, UrlParser, );
 if (EFI_ERROR (Status)) {
- goto Error1;
+  goto Error1;
+}
+
+if (HttpInstance->LocalAddressIsIPv6 && AsciiStrSize (HostName) > 2 &&
+HostName[0] == '[' && *(HostName + (AsciiStrSize (HostName) - 2)) == 
']') {
+  //
+  // HostName format is expressed as IPv6, so, remove '[' and ']'.
+  //
+  HostNameSize = AsciiStrSize (HostName) - 2;
+
+  CopyMem (HostName, HostName + 1, HostNameSize - 1);
+
+  *(HostName + HostNameSize - 1) = '\0';
 }
 
 Status = HttpUrlGetPort (Url, UrlParser, );
 if (EFI_ERROR (Status)) {
   if (HttpInstance->UseHttps) {
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] ShellPkg/TftpDynamicCommand: Fix the potential assertion and memory leak issue.

2018-07-11 Thread Jiaxin Wu
From: Jiaxin Wu 

This patch is to fix the issue reported from
https://bugzilla.tianocore.org/show_bug.cgi?id=925.

DataSize variable was not assigned the value if ShellOpenFileByName returns 
error.
In the such a case, it should not be used to FreePages. Instead, DataSize can be
used to record the file size once DownloadFile successfully.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Jaben Carsey 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index e2491cd54c..44be6d4e76 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -517,10 +517,12 @@ RunTftp (
 mTftpHiiHandle, RemoteFilePath, NicName, Status
   );
   goto NextHandle;
 }
 
+DataSize = FileSize;
+
 if (!EFI_ERROR (ShellFileExists (LocalFilePath))) {
   ShellDeleteFileByName (LocalFilePath);
 }
 
 Status = ShellOpenFileByName (
@@ -537,11 +539,10 @@ RunTftp (
 mTftpHiiHandle, L"tftp", LocalFilePath
   );
   goto NextHandle;
 }
 
-DataSize = FileSize;
 Status = ShellWriteFile (FileHandle, , Data);
 if (!EFI_ERROR (Status)) {
   ShellStatus = SHELL_SUCCESS;
 } else {
   ShellPrintHiiEx (
-- 
2.17.1.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v3] NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.

2018-07-03 Thread Jiaxin Wu
*v2: Resolve the conflict commit.

*v3: Fixed the failure if BodyLength in HTTP token is less than the received
size of HTTPS message.

HttpBodyParserCallback function is to parse the HTTP(S) message body so as to
confirm whether there is the next message header. But it doesn't record the
parsing message data/length correctly.

This patch is refine the parsing logic so as to fix the potential failure.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Gary Lin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
Tested-by: Gary Lin 
---
 NetworkPkg/HttpDxe/HttpImpl.c  | 112 +
 NetworkPkg/HttpDxe/HttpProto.c |  10 +++
 NetworkPkg/HttpDxe/HttpProto.h |  10 +++
 3 files changed, 78 insertions(+), 54 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index f70e116f38..17deceb395 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -914,10 +914,11 @@ HttpBodyParserCallback (
   IN CHAR8  *Data,
   IN UINTN  Length,
   IN VOID   *Context
   )
 {
+  HTTP_CALLBACK_DATA*CallbackData;
   HTTP_TOKEN_WRAP   *Wrap;
   UINTN BodyLength;
   CHAR8 *Body;
 
   if (EventType != BodyParseEventOnComplete) {
@@ -926,25 +927,22 @@ HttpBodyParserCallback (
 
   if (Data == NULL || Length != 0 || Context == NULL) {
 return EFI_SUCCESS;
   }
 
-  Wrap = (HTTP_TOKEN_WRAP *) Context;
-  Body = Wrap->HttpToken->Message->Body;
-  BodyLength = Wrap->HttpToken->Message->BodyLength;
+  CallbackData = (HTTP_CALLBACK_DATA *) Context;
+
+  Wrap   = (HTTP_TOKEN_WRAP *) (CallbackData->Wrap);
+  Body   = CallbackData->ParseData;
+  BodyLength = CallbackData->ParseDataLength;
+
   if (Data < Body + BodyLength) {
 Wrap->HttpInstance->NextMsg = Data;
   } else {
 Wrap->HttpInstance->NextMsg = NULL;
   }
 
-
-  //
-  // Free Tx4Token or Tx6Token since already received corrsponding HTTP 
response.
-  //
-  FreePool (Wrap);
-
   return EFI_SUCCESS;
 }
 
 /**
   The work function of EfiHttpResponse().
@@ -1189,33 +1187,43 @@ HttpResponseWorker (
  HttpInstance->Method,
  HttpMsg->Data.Response->StatusCode,
  HttpMsg->HeaderCount,
  HttpMsg->Headers,
  HttpBodyParserCallback,
- (VOID *) ValueInItem,
+ (VOID *) (>CallbackData),
  >MsgParser
  );
   if (EFI_ERROR (Status)) {
 goto Error2;
   }
 
   //
   // Check whether we received a complete HTTP message.
   //
   if (HttpInstance->CacheBody != NULL) {
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = (VOID *) 
HttpInstance->CacheBody;
+HttpInstance->CallbackData.ParseDataLength = HttpInstance->CacheLen;
+
+//
+// Parse message with CallbackData data.
+//
 Status = HttpParseMessageBody (HttpInstance->MsgParser, 
HttpInstance->CacheLen, HttpInstance->CacheBody);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
+  }
 
-if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
-  //
-  // Free the MsgParse since we already have a full HTTP message.
-  //
-  HttpFreeMsgParser (HttpInstance->MsgParser);
-  HttpInstance->MsgParser = NULL;
-}
+  if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
+//
+// Free the MsgParse since we already have a full HTTP message.
+//
+HttpFreeMsgParser (HttpInstance->MsgParser);
+HttpInstance->MsgParser = NULL;
   }
 }
 
 if ((HttpMsg->Body == NULL) || (HttpMsg->BodyLength == 0)) {
   Status = EFI_SUCCESS;
@@ -1330,16 +1338,30 @@ HttpResponseWorker (
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
 //
-// Check whether we receive a complete HTTP message.
+// Process the received the body packet.
+//
+HttpMsg->BodyLength = MIN (Fragment.Len, (UINT32) HttpMsg->BodyLength);
+
+CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);
+
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = HttpMsg->Body;
+HttpInstance->CallbackData.ParseDataLength = HttpMsg->BodyLength;
+
+//
+// Parse Body with CallbackData data.
 //
 Status = HttpParseMessageBody (
HttpInstance->MsgParser,
-   (UINTN) Fragment.Len,
-   (CHAR8 *) Fragment.Bulk
+   HttpMsg->BodyLength,
+   HttpMsg->Body
);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
@@ -1350,50 +1372,32 @@ HttpResponseWorker (
   HttpFreeMsgParser 

[edk2] [Patch v2] NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.

2018-07-01 Thread Jiaxin Wu
*v2: Resolve the conflict commit.

HttpBodyParserCallback function is to parse the HTTP(S) message body so as to
confirm whether there is the next message header. But it doesn't record the
parsing message data/length correctly.

This patch is refine the parsing logic so as to fix the potential failure.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
Reviewed-by: Fu Siyuan 
---
 NetworkPkg/HttpDxe/HttpImpl.c  | 112 +
 NetworkPkg/HttpDxe/HttpProto.c |  10 +++
 NetworkPkg/HttpDxe/HttpProto.h |  10 +++
 3 files changed, 77 insertions(+), 55 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index f70e116f38..57a3712c23 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -914,10 +914,11 @@ HttpBodyParserCallback (
   IN CHAR8  *Data,
   IN UINTN  Length,
   IN VOID   *Context
   )
 {
+  HTTP_CALLBACK_DATA*CallbackData;
   HTTP_TOKEN_WRAP   *Wrap;
   UINTN BodyLength;
   CHAR8 *Body;
 
   if (EventType != BodyParseEventOnComplete) {
@@ -926,25 +927,22 @@ HttpBodyParserCallback (
 
   if (Data == NULL || Length != 0 || Context == NULL) {
 return EFI_SUCCESS;
   }
 
-  Wrap = (HTTP_TOKEN_WRAP *) Context;
-  Body = Wrap->HttpToken->Message->Body;
-  BodyLength = Wrap->HttpToken->Message->BodyLength;
+  CallbackData = (HTTP_CALLBACK_DATA *) Context;
+
+  Wrap   = (HTTP_TOKEN_WRAP *) (CallbackData->Wrap);
+  Body   = CallbackData->ParseData;
+  BodyLength = CallbackData->ParseDataLength;
+
   if (Data < Body + BodyLength) {
 Wrap->HttpInstance->NextMsg = Data;
   } else {
 Wrap->HttpInstance->NextMsg = NULL;
   }
 
-
-  //
-  // Free Tx4Token or Tx6Token since already received corrsponding HTTP 
response.
-  //
-  FreePool (Wrap);
-
   return EFI_SUCCESS;
 }
 
 /**
   The work function of EfiHttpResponse().
@@ -1189,33 +1187,43 @@ HttpResponseWorker (
  HttpInstance->Method,
  HttpMsg->Data.Response->StatusCode,
  HttpMsg->HeaderCount,
  HttpMsg->Headers,
  HttpBodyParserCallback,
- (VOID *) ValueInItem,
+ (VOID *) (>CallbackData),
  >MsgParser
  );
   if (EFI_ERROR (Status)) {
 goto Error2;
   }
 
   //
   // Check whether we received a complete HTTP message.
   //
   if (HttpInstance->CacheBody != NULL) {
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = (VOID *) 
HttpInstance->CacheBody;
+HttpInstance->CallbackData.ParseDataLength = HttpInstance->CacheLen;
+
+//
+// Parse message with CallbackData data.
+//
 Status = HttpParseMessageBody (HttpInstance->MsgParser, 
HttpInstance->CacheLen, HttpInstance->CacheBody);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
+  }
 
-if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
-  //
-  // Free the MsgParse since we already have a full HTTP message.
-  //
-  HttpFreeMsgParser (HttpInstance->MsgParser);
-  HttpInstance->MsgParser = NULL;
-}
+  if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
+//
+// Free the MsgParse since we already have a full HTTP message.
+//
+HttpFreeMsgParser (HttpInstance->MsgParser);
+HttpInstance->MsgParser = NULL;
   }
 }
 
 if ((HttpMsg->Body == NULL) || (HttpMsg->BodyLength == 0)) {
   Status = EFI_SUCCESS;
@@ -1330,16 +1338,30 @@ HttpResponseWorker (
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
 //
-// Check whether we receive a complete HTTP message.
+// Process the received the body packet.
+//
+HttpMsg->BodyLength = MIN (Fragment.Len, (UINT32) HttpMsg->BodyLength);
+
+CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);
+
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = HttpMsg->Body;
+HttpInstance->CallbackData.ParseDataLength = HttpMsg->BodyLength;
+
+//
+// Parse Body with CallbackData data.
 //
 Status = HttpParseMessageBody (
HttpInstance->MsgParser,
-   (UINTN) Fragment.Len,
-   (CHAR8 *) Fragment.Bulk
+   HttpMsg->BodyLength,
+   HttpMsg->Body
);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
@@ -1350,51 +1372,31 @@ HttpResponseWorker (
   HttpFreeMsgParser (HttpInstance->MsgParser);
   HttpInstance->MsgParser = NULL;
 }
 
 //
-// We receive part of header of next 

[edk2] [Patch] NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.

2018-06-27 Thread Jiaxin Wu
HttpBodyParserCallback function is to parse the HTTP(S) message body so as to
confirm whether there is the next message header. But it doesn't record the
parsing message data/length correctly.

This patch is refine the parsing logic so as to fix the potential failure.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpImpl.c  | 114 +
 NetworkPkg/HttpDxe/HttpProto.c |  10 +++
 NetworkPkg/HttpDxe/HttpProto.h |  12 +++-
 3 files changed, 79 insertions(+), 57 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index a2af59674a..7f601db5c6 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -914,10 +914,11 @@ HttpBodyParserCallback (
   IN CHAR8  *Data,
   IN UINTN  Length,
   IN VOID   *Context
   )
 {
+  HTTP_CALLBACK_DATA*CallbackData;
   HTTP_TOKEN_WRAP   *Wrap;
   UINTN BodyLength;
   CHAR8 *Body;
 
   if (EventType != BodyParseEventOnComplete) {
@@ -926,24 +927,21 @@ HttpBodyParserCallback (
 
   if (Data == NULL || Length != 0 || Context == NULL) {
 return EFI_SUCCESS;
   }
 
-  Wrap = (HTTP_TOKEN_WRAP *) Context;
-  Body = Wrap->HttpToken->Message->Body;
-  BodyLength = Wrap->HttpToken->Message->BodyLength;
+  CallbackData = (HTTP_CALLBACK_DATA *) Context;
+  
+  Wrap   = (HTTP_TOKEN_WRAP *) (CallbackData->Wrap);
+  Body   = CallbackData->ParseData;
+  BodyLength = CallbackData->ParseDataLength;
+  
   if (Data < Body + BodyLength) {
 Wrap->HttpInstance->NextMsg = Data;
   } else {
 Wrap->HttpInstance->NextMsg = NULL;
   }
-  
-
-  //
-  // Free Tx4Token or Tx6Token since already received corrsponding HTTP 
response.
-  //
-  FreePool (Wrap);
 
   return EFI_SUCCESS;
 }
 
 /**
@@ -1189,33 +1187,43 @@ HttpResponseWorker (
  HttpInstance->Method,
  HttpMsg->Data.Response->StatusCode,
  HttpMsg->HeaderCount,
  HttpMsg->Headers,
  HttpBodyParserCallback,
- (VOID *) ValueInItem,
+ (VOID *) (>CallbackData),
  >MsgParser
  );
   if (EFI_ERROR (Status)) {
 goto Error2;
   }
 
   //
   // Check whether we received a complete HTTP message.
   //
   if (HttpInstance->CacheBody != NULL) {
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = (VOID *) 
HttpInstance->CacheBody;
+HttpInstance->CallbackData.ParseDataLength = HttpInstance->CacheLen;
+
+//
+// Parse message with CallbackData data.
+//
 Status = HttpParseMessageBody (HttpInstance->MsgParser, 
HttpInstance->CacheLen, HttpInstance->CacheBody);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
+  }
 
-if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
-  //
-  // Free the MsgParse since we already have a full HTTP message.
-  //
-  HttpFreeMsgParser (HttpInstance->MsgParser);
-  HttpInstance->MsgParser = NULL;
-}
+  if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
+//
+// Free the MsgParse since we already have a full HTTP message.
+//
+HttpFreeMsgParser (HttpInstance->MsgParser);
+HttpInstance->MsgParser = NULL;
   }
 }
 
 if ((HttpMsg->Body == NULL) || (HttpMsg->BodyLength == 0)) {
   Status = EFI_SUCCESS;
@@ -1330,16 +1338,30 @@ HttpResponseWorker (
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
 //
-// Check whether we receive a complete HTTP message.
+// Process the received the body packet.
+//
+HttpMsg->BodyLength = MIN (Fragment.Len, (UINT32) HttpMsg->BodyLength);
+
+CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);
+
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = HttpMsg->Body;
+HttpInstance->CallbackData.ParseDataLength = HttpMsg->BodyLength;
+
+//
+// Parse Body with CallbackData data.
 //
 Status = HttpParseMessageBody (
HttpInstance->MsgParser,
-   (UINTN) Fragment.Len,
-   (CHAR8 *) Fragment.Bulk
+   HttpMsg->BodyLength,
+   HttpMsg->Body
);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
@@ -1350,51 +1372,31 @@ HttpResponseWorker (
   HttpFreeMsgParser (HttpInstance->MsgParser);
   HttpInstance->MsgParser = NULL;
 }
 
 //
-// We receive part of header of next HTTP msg.
+// Check whether there is the next message header in the 

[edk2] [Patch] NetworkPkg/NetworkPkg.dsc: Add the instance of library class [SafeIntLib].

2018-05-03 Thread Jiaxin Wu
This patch is to add the instance of library class [SafeIntLib] to fix the
NetworkPkg build error, which is caused by the commit of 2167c7f7 that the
TlsLib will always consume SafeIntLib.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Long Qin 
Cc: Bi Dandan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/NetworkPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index 471361ce86..dcca5f9fba 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -43,10 +43,11 @@
   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] ShellPkg/TftpDynamicCommand: Fix the potential assertion and memory leak issue.

2018-04-26 Thread Jiaxin Wu
This patch is to fix the issue reported from
https://bugzilla.tianocore.org/show_bug.cgi?id=925.

DataSize variable was not assigned the value if ShellOpenFileByName returns 
error.
In the such a case, it should not be used to FreePages. Instead, DataSize can be
used to record the file size once DownloadFile successfully.

Cc: Vladimir Olovyannikov 
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Jaben Carsey 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index 8569c966dd..0620aec1a7 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -1,10 +1,10 @@
 /** @file
   The implementation for the 'tftp' Shell command.
 
   Copyright (c) 2015, ARM Ltd. All rights reserved.
-  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved. 
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved. 
   (C) Copyright 2015 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -517,10 +517,12 @@ RunTftp (
 mTftpHiiHandle, RemoteFilePath, NicName, Status
   );
   goto NextHandle;
 }
 
+DataSize = FileSize;
+
 if (!EFI_ERROR (ShellFileExists (LocalFilePath))) {
   ShellDeleteFileByName (LocalFilePath);
 }
 
 Status = ShellOpenFileByName (
@@ -537,11 +539,10 @@ RunTftp (
 mTftpHiiHandle, L"tftp", LocalFilePath
   );
   goto NextHandle;
 }
 
-DataSize = FileSize;
 Status = ShellWriteFile (FileHandle, , Data);
 if (!EFI_ERROR (Status)) {
   ShellStatus = SHELL_SUCCESS;
 } else {
   ShellPrintHiiEx (
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/UefiPxeBcDxe: Configure the ARP Instance/RouteTable with new address

2018-03-19 Thread Jiaxin Wu
After completed a DHCP D.O.R.A process and got the new address, the ARP Instance
and RouteTable should be configured so as to avoid the later Pxe.Arp failure.

Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c| 26 +++---
 NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 66 --
 2 files changed, 52 insertions(+), 40 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index d3146c3a7e..b828d24288 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -2001,11 +2001,10 @@ EfiPxeBcSetStationIP (
   )
 {
   EFI_STATUS  Status;
   PXEBC_PRIVATE_DATA  *Private;
   EFI_PXE_BASE_CODE_MODE  *Mode;
-  EFI_ARP_CONFIG_DATA ArpConfigData;
 
   if (This == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -2041,31 +2040,10 @@ EfiPxeBcSetStationIP (
 //
 Status = PxeBcRegisterIp6Address (Private, >v6);
 if (EFI_ERROR (Status)) {
   goto ON_EXIT;
 }
-  } else if (!Mode->UsingIpv6 && NewStationIp != NULL) {
-//
-// Configure the corresponding ARP with the IPv4 address.
-//
-ZeroMem (, sizeof (EFI_ARP_CONFIG_DATA));
-
-ArpConfigData.SwAddressType   = 0x0800;
-ArpConfigData.SwAddressLength = (UINT8) sizeof (EFI_IPv4_ADDRESS);
-ArpConfigData.StationAddress  = >v4;
-
-Private->Arp->Configure (Private->Arp, NULL);
-Private->Arp->Configure (Private->Arp, );
-
-if (NewSubnetMask != NULL) {
-  Mode->RouteTableEntries= 1;
-  Mode->RouteTable[0].IpAddr.Addr[0] = NewStationIp->Addr[0] & 
NewSubnetMask->Addr[0];
-  Mode->RouteTable[0].SubnetMask.Addr[0] = NewSubnetMask->Addr[0];
-  Mode->RouteTable[0].GwAddr.Addr[0] = 0;
-}
-
-Private->IsAddressOk = TRUE;
   }
 
   if (NewStationIp != NULL) {
 CopyMem (>StationIp, NewStationIp, sizeof (EFI_IP_ADDRESS));
 CopyMem (>StationIp, NewStationIp, sizeof (EFI_IP_ADDRESS));
@@ -2075,10 +2053,14 @@ EfiPxeBcSetStationIP (
 CopyMem (>SubnetMask, NewSubnetMask, sizeof (EFI_IP_ADDRESS));
 CopyMem (>SubnetMask ,NewSubnetMask, sizeof (EFI_IP_ADDRESS));
   }
 
   Status = PxeBcFlushStationIp (Private, NewStationIp, NewSubnetMask);
+  if (!EFI_ERROR (Status)) {
+Private->IsAddressOk = TRUE;
+  }
+  
 ON_EXIT:
   return Status;
 }
 
 
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index 47bb7c5dbb..4b6f8c9c7f 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support functions implementation for UefiPxeBc Driver.
 
-  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -34,21 +34,23 @@ PxeBcFlushStationIp (
   EFI_IP_ADDRESS   *SubnetMask OPTIONAL
   )
 {
   EFI_PXE_BASE_CODE_MODE   *Mode;
   EFI_STATUS   Status;
+  EFI_ARP_CONFIG_DATA  ArpConfigData;
 
   Mode   = Private->PxeBc.Mode;
   Status = EFI_SUCCESS;
+  ZeroMem (, sizeof (EFI_ARP_CONFIG_DATA));
 
-  if (Mode->UsingIpv6) {
-
-if (StationIp != NULL) {
-  CopyMem (>Udp6CfgData.StationAddress, StationIp, sizeof 
(EFI_IPv6_ADDRESS));
-  CopyMem (>Ip6CfgData.StationAddress, StationIp, sizeof 
(EFI_IPv6_ADDRESS));
-}
-
+  if (Mode->UsingIpv6 && StationIp != NULL) {
+//
+// Overwrite Udp6CfgData/Ip6CfgData StationAddress.
+//
+CopyMem (>Udp6CfgData.StationAddress, StationIp, sizeof 
(EFI_IPv6_ADDRESS));
+CopyMem (>Ip6CfgData.StationAddress, StationIp, sizeof 
(EFI_IPv6_ADDRESS));
+
 //
 // Reconfigure the Ip6 instance to capture background ICMP6 packets with 
new station Ip address.
 //
 Private->Ip6->Cancel (Private->Ip6, >Icmp6Token);
 Private->Ip6->Configure (Private->Ip6, NULL);
@@ -59,31 +61,59 @@ PxeBcFlushStationIp (
 }
 
 Status = Private->Ip6->Receive (Private->Ip6, >Icmp6Token);
   } else {
 if (StationIp != NULL) {
+  //
+  // Reconfigure the ARP instance with station Ip address.
+  //
+  ArpConfigData.SwAddressType   = 0x0800;
+  ArpConfigData.SwAddressLength = (UINT8) sizeof (EFI_IPv4_ADDRESS);
+  ArpConfigData.StationAddress = StationIp;
+
+  Private->Arp->Configure (Private->Arp, NULL);
+  Private->Arp->Configure (Privat

[edk2] [Patch 3/3] NetworkPkg/HttpDxe: Handle the large data request via HTTPS channel.

2018-03-19 Thread Jiaxin Wu
Cc: Karunakar P <karunak...@amiindia.co.in>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 NetworkPkg/HttpDxe/HttpProto.c| 121 +++---
 NetworkPkg/HttpDxe/HttpsSupport.c |  17 +-
 NetworkPkg/HttpDxe/HttpsSupport.h |  12 +++-
 3 files changed, 111 insertions(+), 39 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index d7fe271168..35c4a166c4 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines for HttpDxe driver.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
@@ -1474,64 +1474,101 @@ HttpTransmitTcp (
   EFI_STATUSStatus;
   EFI_TCP4_IO_TOKEN *Tx4Token;
   EFI_TCP4_PROTOCOL *Tcp4;
   EFI_TCP6_IO_TOKEN *Tx6Token;
   EFI_TCP6_PROTOCOL *Tcp6;
-  UINT8 *Buffer;  
-  UINTN BufferSize;
+  UINT8 *TlsRecord;  
+  UINT16PayloadSize;
   NET_FRAGMENT  TempFragment;
+  NET_FRAGMENT  Fragment;
+  UINTN RecordCount;
+  UINTN RemainingLen;
 
   Status= EFI_SUCCESS;
-  Buffer= NULL;
+  TlsRecord = NULL;
+  PayloadSize   = 0;
   TempFragment.Len  = 0;
   TempFragment.Bulk = NULL;
+  Fragment.Len  = 0;
+  Fragment.Bulk = NULL;
+  RecordCount   = 0;
+  RemainingLen  = 0;
 
   //
   // Need to encrypt data.
   //
   if (HttpInstance->UseHttps) {
 //
-// Build BufferOut data
+// Allocate enough buffer for each TLS plaintext records.
 //
-BufferSize = sizeof (TLS_RECORD_HEADER) + TxStringLen;
-Buffer = AllocateZeroPool (BufferSize);
-if (Buffer == NULL) {
+TlsRecord = AllocateZeroPool (TLS_RECORD_HEADER_LENGTH + 
TLS_PLAINTEXT_RECORD_MAX_PAYLOAD_LENGTH);
+if (TlsRecord == NULL) {
   Status = EFI_OUT_OF_RESOURCES;
   return Status;
 }
-((TLS_RECORD_HEADER *) Buffer)->ContentType = 
TlsContentTypeApplicationData;
-((TLS_RECORD_HEADER *) Buffer)->Version.Major = 
HttpInstance->TlsConfigData.Version.Major;
-((TLS_RECORD_HEADER *) Buffer)->Version.Minor = 
HttpInstance->TlsConfigData.Version.Minor;
-((TLS_RECORD_HEADER *) Buffer)->Length = (UINT16) (TxStringLen);
-CopyMem (Buffer + sizeof (TLS_RECORD_HEADER), TxString, TxStringLen);
-
+
 //
-// Encrypt Packet.
+// Allocate enough buffer for all TLS ciphertext records.
 //
-Status = TlsProcessMessage (
-   HttpInstance, 
-   Buffer, 
-   BufferSize, 
-   EfiTlsEncrypt, 
-   
-   );
-
-FreePool (Buffer);
+RecordCount = TxStringLen / TLS_PLAINTEXT_RECORD_MAX_PAYLOAD_LENGTH + 1;
+Fragment.Bulk = AllocateZeroPool (RecordCount * (TLS_RECORD_HEADER_LENGTH 
+ TLS_CIPHERTEXT_RECORD_MAX_PAYLOAD_LENGTH));
+if (Fragment.Bulk == NULL) {
+  Status = EFI_OUT_OF_RESOURCES;
+  goto ON_ERROR;
+}
 
-if (EFI_ERROR (Status)) {
-  return Status;
+//
+// Encrypt each TLS plaintext records.
+//
+RemainingLen = TxStringLen;
+while (RemainingLen != 0) {
+  PayloadSize = (UINT16) MIN (TLS_PLAINTEXT_RECORD_MAX_PAYLOAD_LENGTH, 
RemainingLen);
+  
+  ((TLS_RECORD_HEADER *) TlsRecord)->ContentType = 
TlsContentTypeApplicationData;
+  ((TLS_RECORD_HEADER *) TlsRecord)->Version.Major = 
HttpInstance->TlsConfigData.Version.Major;
+  ((TLS_RECORD_HEADER *) TlsRecord)->Version.Minor = 
HttpInstance->TlsConfigData.Version.Minor;
+  ((TLS_RECORD_HEADER *) TlsRecord)->Length = PayloadSize;
+
+  CopyMem (TlsRecord + TLS_RECORD_HEADER_LENGTH, TxString + (TxStringLen - 
RemainingLen), PayloadSize);
+  
+  Status = TlsProcessMessage (
+ HttpInstance, 
+ TlsRecord, 
+ TLS_RECORD_HEADER_LENGTH + PayloadSize, 
+ EfiTlsEncrypt, 
+ 
+ );
+  if (EFI_ERROR (Status)) {
+goto ON_ERROR;
+  }
+
+  //
+  // Record the processed/encrypted Packet. 
+  //
+  CopyMem (Fragment.Bulk + Fragment.Len, TempFragment.Bulk, 
TempFragment.Len);
+  Fragmen

[edk2] [Patch 1/3] MdePkg/Tls1.h: Add TLS record header length and max payload length.

2018-03-19 Thread Jiaxin Wu
Cc: Karunakar P <karunak...@amiindia.co.in>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 MdePkg/Include/IndustryStandard/Tls1.h | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/IndustryStandard/Tls1.h 
b/MdePkg/Include/IndustryStandard/Tls1.h
index 9009291ee3..cccb6db7fb 100644
--- a/MdePkg/Include/IndustryStandard/Tls1.h
+++ b/MdePkg/Include/IndustryStandard/Tls1.h
@@ -1,11 +1,11 @@
 /** @file
   Transport Layer Security  -- TLS 1.0/1.1/1.2 Standard definitions, from RFC 
2246/4346/5246
 
   This file contains common TLS 1.0/1.1/1.2 definitions from RFC 2246/4346/5246
 
-  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php
 
@@ -85,9 +85,23 @@ typedef struct {
   UINT8   ContentType;
   EFI_TLS_VERSION Version;
   UINT16  Length;
 } TLS_RECORD_HEADER;
 
+#define TLS_RECORD_HEADER_LENGTH   5
+
+//
+// The length (in bytes) of the TLSPlaintext records payload MUST NOT exceed 
2^14.
+// Refers to section 6.2 of RFC5246. 
+//
+#define TLS_PLAINTEXT_RECORD_MAX_PAYLOAD_LENGTH   16384
+
+//
+// The length (in bytes) of the TLSCiphertext records payload MUST NOT exceed 
2^14 + 2048.
+// Refers to section 6.2 of RFC5246. 
+//
+#define TLS_CIPHERTEXT_RECORD_MAX_PAYLOAD_LENGTH   18432
+
 #pragma pack()
 
 #endif
 
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/3] NetworkPkg/TlsDxe: Handle the multiple TLS record messages encryption/decryption.

2018-03-19 Thread Jiaxin Wu
Cc: Karunakar P <karunak...@amiindia.co.in>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 NetworkPkg/TlsDxe/TlsImpl.c | 74 +++--
 NetworkPkg/TlsDxe/TlsImpl.h |  6 +---
 2 files changed, 52 insertions(+), 28 deletions(-)

diff --git a/NetworkPkg/TlsDxe/TlsImpl.c b/NetworkPkg/TlsDxe/TlsImpl.c
index 8e1238216b..a026075f36 100644
--- a/NetworkPkg/TlsDxe/TlsImpl.c
+++ b/NetworkPkg/TlsDxe/TlsImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The Miscellaneous Routines for TlsDxe driver.
 
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
@@ -48,10 +48,11 @@ TlsEncryptPacket (
   UINT16  ThisPlainMessageSize;
   TLS_RECORD_HEADER   *TempRecordHeader;
   UINT16  ThisMessageSize;
   UINT32  BufferOutSize;
   UINT8   *BufferOut;
+  UINT32  RecordCount;
   INTNRet;
 
   Status   = EFI_SUCCESS;
   BytesCopied  = 0;
   BufferInSize = 0;
@@ -59,10 +60,11 @@ TlsEncryptPacket (
   BufferInPtr  = NULL;
   RecordHeaderIn   = NULL;
   TempRecordHeader = NULL;
   BufferOutSize= 0;
   BufferOut= NULL;
+  RecordCount  = 0;
   Ret  = 0;
 
   //
   // Calculate the size according to the fragment table.
   //
@@ -89,34 +91,46 @@ TlsEncryptPacket (
   (*FragmentTable)[Index].FragmentLength
   );
 BytesCopied += (*FragmentTable)[Index].FragmentLength;
   }
 
-  BufferOut = AllocateZeroPool (MAX_BUFFER_SIZE);
+  //
+  // Count TLS record number.
+  //
+  BufferInPtr = BufferIn;
+  while ((UINTN) BufferInPtr < (UINTN) BufferIn + BufferInSize) {
+RecordHeaderIn = (TLS_RECORD_HEADER *) BufferInPtr;
+if (RecordHeaderIn->ContentType != TlsContentTypeApplicationData || 
RecordHeaderIn->Length > TLS_PLAINTEXT_RECORD_MAX_PAYLOAD_LENGTH) {
+  Status = EFI_INVALID_PARAMETER;
+  goto ERROR;
+}
+BufferInPtr += TLS_RECORD_HEADER_LENGTH + RecordHeaderIn->Length;
+RecordCount ++;
+  }
+  
+  //
+  // Allocate enough buffer to hold TLS Ciphertext.
+  //
+  BufferOut = AllocateZeroPool (RecordCount * (TLS_RECORD_HEADER_LENGTH + 
TLS_CIPHERTEXT_RECORD_MAX_PAYLOAD_LENGTH));
   if (BufferOut == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto ERROR;
   }
 
   //
-  // Parsing buffer.
+  // Parsing buffer. Received packet may have multiple TLS record messages.
   //
   BufferInPtr = BufferIn;
   TempRecordHeader = (TLS_RECORD_HEADER *) BufferOut;
   while ((UINTN) BufferInPtr < (UINTN) BufferIn + BufferInSize) {
 RecordHeaderIn = (TLS_RECORD_HEADER *) BufferInPtr;
 
-if (RecordHeaderIn->ContentType != TlsContentTypeApplicationData) {
-  Status = EFI_INVALID_PARAMETER;
-  goto ERROR;
-}
-
 ThisPlainMessageSize = RecordHeaderIn->Length;
 
 TlsWrite (TlsInstance->TlsConn, (UINT8 *) (RecordHeaderIn + 1), 
ThisPlainMessageSize);
 
-Ret = TlsCtrlTrafficOut (TlsInstance->TlsConn, (UINT8 
*)(TempRecordHeader), MAX_BUFFER_SIZE - BufferOutSize);
+Ret = TlsCtrlTrafficOut (TlsInstance->TlsConn, (UINT8 
*)(TempRecordHeader), TLS_RECORD_HEADER_LENGTH + 
TLS_CIPHERTEXT_RECORD_MAX_PAYLOAD_LENGTH);
 
 if (Ret > 0) {
   ThisMessageSize = (UINT16) Ret;
 } else {
   //
@@ -127,11 +141,11 @@ TlsEncryptPacket (
   ThisMessageSize = 0;
 }
 
 BufferOutSize += ThisMessageSize;
 
-BufferInPtr += RECORD_HEADER_LEN + ThisPlainMessageSize;
+BufferInPtr += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize;
 TempRecordHeader += ThisMessageSize;
   }
 
   FreePool (BufferIn);
   BufferIn = NULL;
@@ -199,10 +213,11 @@ TlsDecryptPacket (
   UINT16  ThisCipherMessageSize;
   TLS_RECORD_HEADER   *TempRecordHeader;
   UINT16  ThisPlainMessageSize;
   UINT8   *BufferOut;
   UINT32  BufferOutSize;
+  UINT32  RecordCount;
   INTNRet;
 
   Status   = EFI_SUCCESS;
   BytesCopied  = 0;
   BufferIn = NULL;
@@ -210,10 +225,11 @@ TlsDecryptPacket (
   BufferInPtr  = NULL;
   RecordHeaderIn   = NULL;
   TempRecordHeader = NULL;
   BufferOut= NULL;
   BufferOutSize= 0;
+  RecordCount  = 0;
   Ret  = 0;
 
   //
   // Calculate the size according to the fragment table.
   //
@@ -240,11 +256,28 @@ TlsDecryptPacket (
   (*FragmentTable)[Index].FragmentLength
   );
 BytesCopied += (*FragmentTable)[Index].FragmentLength;
   }
 
-  BufferOut = AllocateZeroPool (MAX_BUFFER_SIZE

[edk2] [Patch 0/3] Support HTTP large data request via TLS channel.

2018-03-19 Thread Jiaxin Wu
Cc: Karunakar P <karunak...@amiindia.co.in>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>

Jiaxin Wu (3):
  MdePkg/Tls1.h: Add TLS record header length and max payload length.
  NetworkPkg/TlsDxe: Handle the multiple TLS record messages
encryption/decryption.
  NetworkPkg/HttpDxe: Handle the large data request via HTTPS channel.

 MdePkg/Include/IndustryStandard/Tls1.h |  16 -
 NetworkPkg/HttpDxe/HttpProto.c | 121 -
 NetworkPkg/HttpDxe/HttpsSupport.c  |  17 -
 NetworkPkg/HttpDxe/HttpsSupport.h  |  12 +++-
 NetworkPkg/TlsDxe/TlsImpl.c|  74 +---
 NetworkPkg/TlsDxe/TlsImpl.h|   6 +-
 6 files changed, 178 insertions(+), 68 deletions(-)

-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] NetworkPkg/IScsiDxe: Fix the ISCSI connection failure in certain case.

2018-03-12 Thread Jiaxin Wu
The ISCSI connection will fail for the first time if the target info is
retrieved from DHCP and expressed as URI format. The issue is caused by
the missing DNS protocol dependency check during the driver support
function.

This patch is to fix the above issue.

Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 94f3725866..745b7ac07b 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1982,11 +1982,11 @@ IScsiDnsIsConfigured (
 if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED || StrCmp 
(MacString, AttemptMacString)) {
   FreePool (AttemptTmp);
   continue;
 }
 
-if (AttemptTmp->SessionConfigData.DnsMode) {
+if (AttemptTmp->SessionConfigData.DnsMode || 
AttemptTmp->SessionConfigData.TargetInfoFromDhcp) {
   FreePool (AttemptTmp);
   FreePool (AttemptConfigOrder);
   return TRUE;
 } else {
   FreePool (AttemptTmp);
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Mtftp4Dxe: Fix the incorrect return status.

2018-03-11 Thread Jiaxin Wu
The incorrect return status was caused by the commit of 39b0867d, which
was to resolve the token status error that does not compliance with spec
definition, but it results the protocol status not compliance with spec
definition.

This patch is to resolve above issue.

Cc: Wang Fan <fan.w...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c   | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index d8c48ec8b2..065528c937 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -364,10 +364,11 @@ Mtftp4Start (
   MTFTP4_PROTOCOL   *Instance;
   EFI_MTFTP4_OVERRIDE_DATA  *Override;
   EFI_MTFTP4_CONFIG_DATA*Config;
   EFI_TPL   OldTpl;
   EFI_STATUSStatus;
+  EFI_STATUSTokenStatus;
 
   //
   // Validate the parameters
   //
   if ((This == NULL) || (Token == NULL) || (Token->Filename == NULL) ||
@@ -391,28 +392,28 @@ Mtftp4Start (
 return EFI_INVALID_PARAMETER;
   }
 
   Instance = MTFTP4_PROTOCOL_FROM_THIS (This);
 
-  Status = EFI_SUCCESS;
+  Status  = EFI_SUCCESS;
+  TokenStatus = EFI_SUCCESS;
+  
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
 
   if (Instance->State != MTFTP4_STATE_CONFIGED) {
 Status = EFI_NOT_STARTED;
   }
 
   if (Instance->Operation != 0) {
 Status = EFI_ACCESS_DENIED;
   }
 
-  if (EFI_ERROR (Status)) {
-gBS->RestoreTPL (OldTpl);
-return Status;
-  }
-
   if ((Token->OverrideData != NULL) && !Mtftp4OverrideValid (Instance, 
Token->OverrideData)) {
 Status = EFI_INVALID_PARAMETER;
+  }
+
+  if (EFI_ERROR (Status)) {
 gBS->RestoreTPL (OldTpl);
 return Status;
   }
 
   //
@@ -429,11 +430,11 @@ Mtftp4Start (
TRUE,
>RequestOption
);
 
 if (EFI_ERROR (Status)) {
-  Status = EFI_DEVICE_ERROR;
+  TokenStatus = EFI_DEVICE_ERROR;
   goto ON_ERROR;
 }
   }
 
   //
@@ -482,13 +483,12 @@ Mtftp4Start (
 
   //
   // Config the unicast UDP child to send initial request
   //
   Status = Mtftp4ConfigUnicastPort (Instance->UnicastPort, Instance);
-
   if (EFI_ERROR (Status)) {
-Status = EFI_DEVICE_ERROR;
+TokenStatus = EFI_DEVICE_ERROR;
 goto ON_ERROR;
   }
 
   //
   // Set initial status.
@@ -503,11 +503,11 @@ Mtftp4Start (
   } else {
 Status = Mtftp4RrqStart (Instance, Operation);
   }
 
   if (EFI_ERROR (Status)) {
-Status = EFI_DEVICE_ERROR;
+TokenStatus = EFI_DEVICE_ERROR;
 goto ON_ERROR;
   }
 
   if (Token->Event != NULL) {
 gBS->RestoreTPL (OldTpl);
@@ -524,11 +524,11 @@ Mtftp4Start (
 
   gBS->RestoreTPL (OldTpl);
   return Token->Status;
 
 ON_ERROR:
-  Mtftp4CleanOperation (Instance, Status);
+  Mtftp4CleanOperation (Instance, TokenStatus);
   gBS->RestoreTPL (OldTpl);
 
   return Status;
 }
 
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Mtftp4Dxe: Separate the timer ticking to calculate the packet live time.

2018-03-01 Thread Jiaxin Wu
From: Fu Siyuan <siyuan...@intel.com>

TPL deadlock issue was enrolled by the commit of 39b0867d. To resolve the issue,
this patch separated the timer ticking for all the MTFTP clients to calculate 
the
packet live time in TPL_NOTIFY level.

Cc: Wang Fan <fan.w...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Driver.c | 34 ++---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c   |  5 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h   |  6 ++-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.c| 57 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.h| 16 +-
 5 files changed, 97 insertions(+), 21 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
index a23d405baa..713cc66dd1 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of Mtftp drivers.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -160,15 +160,16 @@ Mtftp4CreateService (
   MtftpSb->Signature  = MTFTP4_SERVICE_SIGNATURE;
   MtftpSb->ServiceBinding = gMtftp4ServiceBindingTemplete;
   MtftpSb->ChildrenNum= 0;
   InitializeListHead (>Children);
 
-  MtftpSb->Timer  = NULL;
-  MtftpSb->TimerToGetMap  = NULL;
-  MtftpSb->Controller = Controller;
-  MtftpSb->Image  = Image;
-  MtftpSb->ConnectUdp = NULL;
+  MtftpSb->Timer= NULL;
+  MtftpSb->TimerNotifyLevel = NULL;
+  MtftpSb->TimerToGetMap= NULL;
+  MtftpSb->Controller   = Controller;
+  MtftpSb->Image= Image;
+  MtftpSb->ConnectUdp   = NULL;
 
   //
   // Create the timer and a udp to be notified when UDP is uninstalled
   //
   Status = gBS->CreateEvent (
@@ -176,12 +177,24 @@ Mtftp4CreateService (
   TPL_CALLBACK,
   Mtftp4OnTimerTick,
   MtftpSb,
   >Timer
   );
+  if (EFI_ERROR (Status)) {
+FreePool (MtftpSb);
+return Status;
+  }
 
+  Status = gBS->CreateEvent (
+  EVT_NOTIFY_SIGNAL | EVT_TIMER,
+  TPL_NOTIFY,
+  Mtftp4OnTimerTickNotifyLevel,
+  MtftpSb,
+  >TimerNotifyLevel
+  );
   if (EFI_ERROR (Status)) {
+gBS->CloseEvent (MtftpSb->Timer);
 FreePool (MtftpSb);
 return Status;
   }
 
   //
@@ -194,10 +207,11 @@ Mtftp4CreateService (
   NULL,
   NULL,
   >TimerToGetMap
   );
   if (EFI_ERROR (Status)) {
+gBS->CloseEvent (MtftpSb->TimerNotifyLevel);
 gBS->CloseEvent (MtftpSb->Timer);
 FreePool (MtftpSb);
 return Status;
   }
 
@@ -209,10 +223,11 @@ Mtftp4CreateService (
   NULL
   );
 
   if (MtftpSb->ConnectUdp == NULL) {
 gBS->CloseEvent (MtftpSb->TimerToGetMap);
+gBS->CloseEvent (MtftpSb->TimerNotifyLevel);
 gBS->CloseEvent (MtftpSb->Timer);
 FreePool (MtftpSb);
 return EFI_DEVICE_ERROR;
   }
 
@@ -232,10 +247,11 @@ Mtftp4CleanService (
   IN MTFTP4_SERVICE *MtftpSb
   )
 {
   UdpIoFreeIo (MtftpSb->ConnectUdp);
   gBS->CloseEvent (MtftpSb->TimerToGetMap);
+  gBS->CloseEvent (MtftpSb->TimerNotifyLevel);
   gBS->CloseEvent (MtftpSb->Timer);
 }
 
 
 /**
@@ -292,10 +308,16 @@ Mtftp4DriverBindingStart (
 
   if (EFI_ERROR (Status)) {
 goto ON_ERROR;
   }
 
+  Status = gBS->SetTimer (MtftpSb->TimerNotifyLevel, TimerPeriodic, 
TICKS_PER_SECOND);
+
+  if (EFI_ERROR (Status)) {
+goto ON_ERROR;
+  }
+  
   //
   // Install the Mtftp4ServiceBinding Protocol onto Controller
   //
   Status = gBS->InstallMultipleProtocolInterfaces (
   ,
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index f5f9e6d8f7..d8c48ec8b2 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -1080,10 +1080,11 @@ EfiMtftp4Poll (
   IN EFI_MTFTP4_PROTOCOL*This
   )
 {
   MTFTP4_PROTOCOL   *Instance;
   EFI_UDP4_PROTOCOL *Udp;
+  EFI_S

[edk2] [Patch] NetworkPkg/Udp6Dxe: Fix the failure to leave one multicast group address.

2018-03-01 Thread Jiaxin Wu
The issue was enrolled by the commit of ceec3638. One of the change in the 
commit
was to return the status from NetMapIterate in Udp6Groups function. But it 
should
not return EFI_ABORTED directly in case McastIp is not NULL, which means to 
terminate
the iteration and leave the McastIp successfully.

Cc: Wang Fan <fan.w...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 NetworkPkg/Udp6Dxe/Udp6Main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index 1d7f0acbc7..e9d94dd00c 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -380,10 +380,13 @@ Udp6Groups (
 
 Status = NetMapInsertTail (>McastIps, (VOID *) McastIp, NULL);
   } else {
 
 Status = NetMapIterate (>McastIps, Udp6LeaveGroup, 
MulticastAddress);
+if ((MulticastAddress != NULL) && (Status == EFI_ABORTED)) {
+  Status = EFI_SUCCESS;
+} 
   }
 
 ON_EXIT:
 
   gBS->RestoreTPL (OldTpl);
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before the poll function.

2018-03-01 Thread Jiaxin Wu
This patch is to fix the hang issue, which was enrolled by the commit of 
39b0867d.
The TPL should be restored before calling poll function at TPL_CALLBACK.

Cc: Wang Fan <fan.w...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index f5f9e6d8f7..64e0463dd9 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -507,24 +507,27 @@ Mtftp4Start (
   if (EFI_ERROR (Status)) {
 Status = EFI_DEVICE_ERROR;
 goto ON_ERROR;
   }
 
+  //
+  // Restore the TPL now, don't call poll function at TPL_CALLBACK.
+  //
+  gBS->RestoreTPL (OldTpl);
+
   if (Token->Event != NULL) {
-gBS->RestoreTPL (OldTpl);
 return EFI_SUCCESS;
   }
 
   //
   // Return immediately for asynchronous operation or poll the
   // instance for synchronous operation.
   //
   while (Token->Status == EFI_NOT_READY) {
 This->Poll (This);
   }
-
-  gBS->RestoreTPL (OldTpl);
+  
   return Token->Status;
 
 ON_ERROR:
   Mtftp4CleanOperation (Instance, Status);
   gBS->RestoreTPL (OldTpl);
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/HttpBootDxe: Correct the parameter check for the usage of HttpBootGetFileFromCache.

2018-02-28 Thread Jiaxin Wu
The patch is to fix the incorrect parameter check for the 
HttpBootGetFileFromCache().

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index 15e0ab9d69..b93e63bb2f 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of the boot file download function.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
  
@@ -434,11 +434,11 @@ HttpBootDhcp6ExtractUriInfo (
   goto Error;
 }
   }
   
   //
-  // Extract the HTTP server Ip frome URL. This is used to Check route table 
+  // Extract the HTTP server Ip from URL. This is used to Check route table 
   // whether can send message to HTTP Server Ip through the GateWay.
   //
   Status = HttpUrlGetIp6 (
  Private->BootFileUri,
  Private->BootFileUriParser,
@@ -744,23 +744,22 @@ HttpBootGetFileFromCache (
   LIST_ENTRY  *Entry2;
   HTTP_BOOT_CACHE_CONTENT *Cache;
   HTTP_BOOT_ENTITY_DATA   *EntityData;
   UINTN   CopyedSize;
   
-  if (Uri == NULL || BufferSize == 0 || Buffer == NULL || ImageType == NULL) {
+  if (Uri == NULL || BufferSize == NULL || Buffer == NULL || ImageType == 
NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
   NET_LIST_FOR_EACH (Entry, >CacheList) {
 Cache = NET_LIST_USER_STRUCT (Entry, HTTP_BOOT_CACHE_CONTENT, Link);
 //
 // Compare the URI to see whether we already have a cache for this file.
 //
 if ((Cache->RequestData != NULL) &&
 (Cache->RequestData->Url != NULL) &&
-(StrCmp (Uri, Cache->RequestData->Url) == 0)) 
-{
+(StrCmp (Uri, Cache->RequestData->Url) == 0)) {
   //
   // Hit in cache, record image type.
   //
   *ImageType  = Cache->ImageType;
 
@@ -945,11 +944,11 @@ HttpBootGetBootFile (
   Url = AllocatePool (UrlSize * sizeof (CHAR16));
   if (Url == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
   AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);
-  if (!HeaderOnly) {
+  if (!HeaderOnly && Buffer != NULL) {
 Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, 
ImageType);
 if (Status != EFI_NOT_FOUND) {
   FreePool (Url);
   return Status;
 }
@@ -1127,11 +1126,11 @@ HttpBootGetBootFile (
   Context.Buffer = Buffer;
   Context.BufferSize = *BufferSize;
   Context.Cache  = Cache;
   Context.Private= Private;
   Status = HttpInitMsgParser (
- HeaderOnly? HttpMethodHead : HttpMethodGet,
+ HeaderOnly ? HttpMethodHead : HttpMethodGet,
  ResponseData->Response.StatusCode,
  ResponseData->HeaderCount,
  ResponseData->Headers,
  HttpBootGetBootFileCallback,
  (VOID*) ,
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/HttpBootDxe: Fix the incorrect error message output.

2018-02-28 Thread Jiaxin Wu
For IPv6 case, if one invalid URL returned from DHCP server, HttpBootDxe
driver could not retrieve the URL host address from DNS server. In such a
case, the error message should be printed as:
  Error: Could not retrieve the host address from DNS server.
Instead of:
  Error: Could not discover the boot information for DHCP server.
Then, we can still output as following:
  Error: Could not retrieve NBP file size from HTTP server.

Besides, currently implementation in HttpBootLoadFile will always output
error message even the HTTP process is correct.

This patch is to fix above issue.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c |  1 +
 NetworkPkg/HttpBootDxe/HttpBootImpl.c   | 37 ++---
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index b93e63bb2f..1d1e47008d 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -472,10 +472,11 @@ HttpBootDhcp6ExtractUriInfo (
 }
 
 Status = HttpBootDns (Private, HostNameStr, );
 FreePool (HostNameStr);
 if (EFI_ERROR (Status)) {
+  AsciiPrint ("\n  Error: Could not retrieve the host address from DNS 
server.\n");
   goto Error;
 }  
   } 
   
   CopyMem (>ServerIp.v6, , sizeof (EFI_IPv6_ADDRESS));
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 16c1207bf8..a0fd934ec4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
  
@@ -329,11 +329,11 @@ HttpBootLoadFile (
 //
 // Parse the cached offer to get the boot file URL first.
 //
 Status = HttpBootDiscoverBootInfo (Private);
 if (EFI_ERROR (Status)) {
-  AsciiPrint ("\n  Error: Could not discover the boot information for DHCP 
server.\n");
+  AsciiPrint ("\n  Error: Could not retrieve NBP file size from HTTP 
server.\n");
   goto ON_EXIT;
 }
   }
 
   if (!Private->HttpCreated) {
@@ -398,26 +398,29 @@ HttpBootLoadFile (
  ImageType
  );
   
 ON_EXIT:
   HttpBootUninstallCallback (Private);
-
-  if (Status == EFI_ACCESS_DENIED) {
-AsciiPrint ("\n  Error: Could not establish connection with HTTP 
server.\n");
-  } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
-AsciiPrint ("\n  Error: Buffer size is smaller than the requested 
file.\n");
-  } else if (Status == EFI_OUT_OF_RESOURCES) {
-AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");
-  } else if (Status == EFI_DEVICE_ERROR) {
-AsciiPrint ("\n  Error: Network device error.\n");
-  } else if (Status == EFI_TIMEOUT) {
-AsciiPrint ("\n  Error: Server response timeout.\n");
-  } else if (Status == EFI_ABORTED) {
-AsciiPrint ("\n  Error: Remote boot cancelled.\n");
-  } else if (Status != EFI_BUFFER_TOO_SMALL) {
-AsciiPrint ("\n  Error: Unexpected network error.\n");
+  
+  if (EFI_ERROR (Status)) {
+if (Status == EFI_ACCESS_DENIED) {
+  AsciiPrint ("\n  Error: Could not establish connection with HTTP 
server.\n");
+} else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
+  AsciiPrint ("\n  Error: Buffer size is smaller than the requested 
file.\n");
+} else if (Status == EFI_OUT_OF_RESOURCES) {
+  AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");
+} else if (Status == EFI_DEVICE_ERROR) {
+  AsciiPrint ("\n  Error: Network device error.\n");
+} else if (Status == EFI_TIMEOUT) {
+  AsciiPrint ("\n  Error: Server response timeout.\n");
+} else if (Status == EFI_ABORTED) {
+  AsciiPrint ("\n  Error: Remote boot cancelled.\n");
+} else if (Status != EFI_BUFFER_TOO_SMALL) {
+  AsciiPrint ("\n  Error: Unexpected network error.\n");
+}
   }
+  
   return Status;
 }
 
 /**
   Disable the use of UEFI HTTP boot function.
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] NetworkPkg/HttpDxe: Support HTTP Delete Method.

2018-02-26 Thread Jiaxin Wu
Per the request to support HttpMethodDelete:
https://bugzilla.tianocore.org/show_bug.cgi?id=879,
This patch is to enable the HTTP Delete Method.

Cc: Karunakar P 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index b3a64cf516..a2af59674a 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
 
-  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -279,15 +279,16 @@ EfiHttpRequest (
   }
 
   Request = HttpMsg->Data.Request;
 
   //
-  // Only support GET, HEAD, PATCH, PUT and POST method in current 
implementation.
+  // Only support GET, HEAD, DELETE, PATCH, PUT and POST method in current 
implementation.
   //
   if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
-  (Request->Method != HttpMethodHead) && (Request->Method != 
HttpMethodPut) && 
-  (Request->Method != HttpMethodPost) && (Request->Method != 
HttpMethodPatch)) {
+  (Request->Method != HttpMethodHead) && (Request->Method != 
HttpMethodDelete) && 
+  (Request->Method != HttpMethodPut) && (Request->Method != 
HttpMethodPost) && 
+  (Request->Method != HttpMethodPatch)) {
 return EFI_UNSUPPORTED;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
 
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 1/2] NetworkPkg: Define one private variable for HTTPS to set Tls CipherList.

2018-02-10 Thread Jiaxin Wu
v2:
* Rename the file/variable name.

This variable (HttpTlsCipherList) can be set by any platform that want to
control its own preferred Tls CipherList for the later HTTPS session.

The valid contents of variable must follow the TLS CipherList format defined
in RFC 5246. The valid length of variable must be an integral multiple of 2.
For example, if below cipher suites are preferred:
CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256 = {0x00,0x3C}
CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA256 = {0x00,0x3D}
Then, the contents of variable should be:
{0x00,0x3C,0x00,0x3D}

Cc: Laszlo Ersek 
Cc: Kinney Michael D 
Cc: Zimmer Vincent 
Cc: Yao Jiewen 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Include/Guid/HttpTlsCipherList.h | 38 +
 NetworkPkg/NetworkPkg.dec   |  3 +++
 2 files changed, 41 insertions(+)
 create mode 100644 NetworkPkg/Include/Guid/HttpTlsCipherList.h

diff --git a/NetworkPkg/Include/Guid/HttpTlsCipherList.h 
b/NetworkPkg/Include/Guid/HttpTlsCipherList.h
new file mode 100644
index 000..c2e3e65
--- /dev/null
+++ b/NetworkPkg/Include/Guid/HttpTlsCipherList.h
@@ -0,0 +1,38 @@
+/** @file
+  This file defines the HttpTlsCipherList variable for HTTPS to configure Tls 
Cipher List.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __HTTP_TLS_CIPHER_LIST_H__
+#define __HTTP_TLS_CIPHER_LIST_H__
+
+//
+// Private Variable for HTTPS to configure Tls Cipher List.
+// The valid contents of variable must follow the TLS CipherList format 
defined in RFC 5246. 
+// The valid length of variable must be an integral multiple of 2.
+// For example, if below cipher suites are preferred:
+//  CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256 = {0x00,0x3C}
+//   CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA256 = {0x00,0x3D}
+// Then, the contents of variable should be:
+//   {0x00,0x3C,0x00,0x3D}
+//
+#define EDKII_HTTP_TLS_CIPHER_LIST_GUID \
+  { \
+0x46ddb415, 0x5244, 0x49c7, { 0x93, 0x74, 0xf0, 0xe2, 0x98, 0xe7, 0xd3, 
0x86 } \
+  }
+  
+#define EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE   L"HttpTlsCipherList"
+
+extern EFI_GUID gHttpTlsCipherListGuid;
+
+#endif
+
diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
index 902df37..9742ad5 100644
--- a/NetworkPkg/NetworkPkg.dec
+++ b/NetworkPkg/NetworkPkg.dec
@@ -44,10 +44,13 @@
   gTlsAuthConfigGuid= { 0xb0eae4f8, 0x9a04, 0x4c6d, { 0xa7, 0x48, 
0x79, 0x3d, 0xaa, 0xf, 0x65, 0xdf }}
   
   # Include/Guid/TlsAuthentication.h
   gEfiTlsCaCertificateGuid  = { 0xfd2340D0, 0x3dab, 0x4349, { 0xa6, 0xc7, 
0x3b, 0x4f, 0x12, 0xb4, 0x8e, 0xae }}
 
+  # Include/Guid/HttpTlsCipherList.h
+  gHttpTlsCipherListGuid= { 0x46ddb415, 0x5244, 0x49c7, { 0x93, 0x74, 
0xf0, 0xe2, 0x98, 0xe7, 0xd3, 0x86 }}
+
 [PcdsFixedAtBuild]
   ## The max attempt number will be created by iSCSI driver.
   # @Prompt Max attempt number.
   gEfiNetworkPkgTokenSpaceGuid.PcdMaxIScsiAttemptNumber|0x08|UINT8|0x000D
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 0/2] NetworkPkg: Support the platform to configure HTTPS CipherList.

2018-02-10 Thread Jiaxin Wu
V2:
* Rename the file/variable name.
* Refine the error handling returned from GetVariable.

Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Kinney Michael D <michael.d.kin...@intel.com>
Cc: Zimmer Vincent <vincent.zim...@intel.com>
Cc: Yao Jiewen <jiewen@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (2):
  NetworkPkg: Define one private variable for HTTPS to set Tls
CipherList.
  NetworkPkg: Read HttpTlsCipherList variable and configure it for HTTPS
session.

 NetworkPkg/HttpDxe/HttpDriver.h |  3 +-
 NetworkPkg/HttpDxe/HttpDxe.inf  |  3 +-
 NetworkPkg/HttpDxe/HttpsSupport.c   | 92 -
 NetworkPkg/Include/Guid/HttpTlsCipherList.h | 38 
 NetworkPkg/NetworkPkg.dec   |  3 +
 5 files changed, 136 insertions(+), 3 deletions(-)
 create mode 100644 NetworkPkg/Include/Guid/HttpTlsCipherList.h

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 2/2] NetworkPkg: Read HttpTlsCipherList variable and configure it for HTTPS session.

2018-02-10 Thread Jiaxin Wu
v2:
* Refine the error handling returned from GetVariable.

This patch is to read the HttpTlsCipherList variable and configure it for the
later HTTPS session.

If the variable is not set by any platform, EFI_NOT_FOUND will be returned
from GetVariable service. In such a case, the default CipherList created in
TlsDxe driver will be used.

Cc: Laszlo Ersek 
Cc: Kinney Michael D 
Cc: Zimmer Vincent 
Cc: Yao Jiewen 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpDriver.h   |  3 +-
 NetworkPkg/HttpDxe/HttpDxe.inf|  3 +-
 NetworkPkg/HttpDxe/HttpsSupport.c | 92 ++-
 3 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpDriver.h b/NetworkPkg/HttpDxe/HttpDriver.h
index 93a412a..3b7a7a2 100644
--- a/NetworkPkg/HttpDxe/HttpDriver.h
+++ b/NetworkPkg/HttpDxe/HttpDriver.h
@@ -1,9 +1,9 @@
 /** @file
   The header files of the driver binding and service binding protocol for 
HttpDxe driver.
 
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -59,10 +59,11 @@
 // Produced Protocols
 //
 #include 
 
 #include 
+#include 
 
 #include 
 
 //
 // Driver Version
diff --git a/NetworkPkg/HttpDxe/HttpDxe.inf b/NetworkPkg/HttpDxe/HttpDxe.inf
index 20075f5..56a2472 100644
--- a/NetworkPkg/HttpDxe/HttpDxe.inf
+++ b/NetworkPkg/HttpDxe/HttpDxe.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Implementation of EFI HTTP protocol interfaces.
 #
-#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution. The full text of the license may be 
found at
 #  http://opensource.org/licenses/bsd-license.php.
@@ -72,10 +72,11 @@
   gEfiTlsProtocolGuid  ## SOMETIMES_CONSUMES
   gEfiTlsConfigurationProtocolGuid ## SOMETIMES_CONSUMES
 
 [Guids]
   gEfiTlsCaCertificateGuid ## SOMETIMES_CONSUMES  ## 
Variable:L"TlsCaCertificate"
+  gHttpTlsCipherListGuid   ## SOMETIMES_CONSUMES  ## 
Variable:L"HttpTlsCipherList"
 
 [Pcd]
   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections   ## CONSUMES
   gEfiNetworkPkgTokenSpaceGuid.PcdHttpsAuthenticationMode## 
SOMETIMES_CONSUMES
   gEfiNetworkPkgTokenSpaceGuid.PcdHttpsHostPublicCert## 
SOMETIMES_CONSUMES
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c 
b/NetworkPkg/HttpDxe/HttpsSupport.c
index 288082a..fbe4087 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.c
+++ b/NetworkPkg/HttpDxe/HttpsSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines specific to Https for HttpDxe driver.
 
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
@@ -492,10 +492,91 @@ TlsConfigCertificate (
   
   return Status;
 }
 
 /**
+  Read the HttpTlsCipherList variable and configure it for HTTPS session.
+
+  @param[in, out]  HttpInstance  The HTTP instance private data.
+
+  @retval EFI_SUCCESSThe prefered HTTP TLS CipherList is 
configured.
+  @retval EFI_NOT_FOUND  Fail to get 'HttpTlsCipherList' variable.
+  @retval EFI_INVALID_PARAMETER  The contents of variable are invalid.
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
+
+  @retval Others Other error as indicated.
+
+**/
+EFI_STATUS
+TlsConfigCipherList (
+  IN OUT HTTP_PROTOCOL  *HttpInstance
+  )
+{
+  EFI_STATUS  Status;
+  UINT8   *CipherList;
+  UINTN   CipherListSize;
+
+  CipherList = NULL;
+  CipherListSize = 0;
+
+  //
+  // Try to read the HttpTlsCipherList variable.
+  //
+  Status  = gRT->GetVariable (
+   EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE,
+   ,
+   NULL,
+   ,
+   NULL
+   );
+  ASSERT (EFI_ERROR (Status));
+  if (Status != 

[edk2] [Patch 2/2] NetworkPkg: Read TlsCipherList variable and configure it for HTTPS session.

2018-02-08 Thread Jiaxin Wu
This patch is to read the TlsCipherList variable and configure it for the
later HTTPS session.

If the variable is not set by any platform, EFI_NOT_FOUND will be returned
from GetVariable service. In such a case, the default CipherList created in
TlsDxe driver will be used.

Cc: Laszlo Ersek 
Cc: Kinney Michael D 
Cc: Zimmer Vincent 
Cc: Yao Jiewen 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpDriver.h   |  3 +-
 NetworkPkg/HttpDxe/HttpDxe.inf|  3 +-
 NetworkPkg/HttpDxe/HttpsSupport.c | 92 ++-
 3 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpDriver.h b/NetworkPkg/HttpDxe/HttpDriver.h
index 93a412a..eba7d32 100644
--- a/NetworkPkg/HttpDxe/HttpDriver.h
+++ b/NetworkPkg/HttpDxe/HttpDriver.h
@@ -1,9 +1,9 @@
 /** @file
   The header files of the driver binding and service binding protocol for 
HttpDxe driver.
 
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -59,10 +59,11 @@
 // Produced Protocols
 //
 #include 
 
 #include 
+#include 
 
 #include 
 
 //
 // Driver Version
diff --git a/NetworkPkg/HttpDxe/HttpDxe.inf b/NetworkPkg/HttpDxe/HttpDxe.inf
index 20075f5..b1d7bd2 100644
--- a/NetworkPkg/HttpDxe/HttpDxe.inf
+++ b/NetworkPkg/HttpDxe/HttpDxe.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Implementation of EFI HTTP protocol interfaces.
 #
-#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution. The full text of the license may be 
found at
 #  http://opensource.org/licenses/bsd-license.php.
@@ -72,10 +72,11 @@
   gEfiTlsProtocolGuid  ## SOMETIMES_CONSUMES
   gEfiTlsConfigurationProtocolGuid ## SOMETIMES_CONSUMES
 
 [Guids]
   gEfiTlsCaCertificateGuid ## SOMETIMES_CONSUMES  ## 
Variable:L"TlsCaCertificate"
+  gTlsCipherListGuid   ## SOMETIMES_CONSUMES  ## 
Variable:L"TlsCipherList"
 
 [Pcd]
   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections   ## CONSUMES
   gEfiNetworkPkgTokenSpaceGuid.PcdHttpsAuthenticationMode## 
SOMETIMES_CONSUMES
   gEfiNetworkPkgTokenSpaceGuid.PcdHttpsHostPublicCert## 
SOMETIMES_CONSUMES
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c 
b/NetworkPkg/HttpDxe/HttpsSupport.c
index 288082a..62cb867 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.c
+++ b/NetworkPkg/HttpDxe/HttpsSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines specific to Https for HttpDxe driver.
 
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
@@ -492,10 +492,91 @@ TlsConfigCertificate (
   
   return Status;
 }
 
 /**
+  Read the TlsCipherList variable and configure it for HTTPS session.
+
+  @param[in, out]  HttpInstance   The HTTP instance private data.
+
+  @retval EFI_SUCCESSThe prefered TLS CipherList is configured.
+  @retval EFI_NOT_FOUND  Fail to get 'TlsCipherList' variable.
+  @retval EFI_INVALID_PARAMETER  The contents of variable are invalid.
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
+
+  @retval Others Other error as indicated.
+
+**/
+EFI_STATUS
+TlsConfigCipherList (
+  IN OUT HTTP_PROTOCOL  *HttpInstance
+  )
+{
+  EFI_STATUS  Status;
+  UINT8   *CipherList;
+  UINTN   CipherListSize;
+
+  CipherList = NULL;
+  CipherListSize = 0;
+
+  //
+  // Try to read the TlsCipherList variable.
+  //
+  Status  = gRT->GetVariable (
+   EDKII_TLS_CIPHER_LIST_VARIABLE,
+   ,
+   NULL,
+   ,
+   NULL
+   );
+
+  if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
+return Status;
+  }
+
+  if (CipherListSize % sizeof (EFI_TLS_CIPHER) != 0) {

[edk2] [Patch 0/2] NetworkPkg: Support the platform to configure TLS CipherList.

2018-02-08 Thread Jiaxin Wu
Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Kinney Michael D <michael.d.kin...@intel.com>
Cc: Zimmer Vincent <vincent.zim...@intel.com>
Cc: Yao Jiewen <jiewen@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (2):
  NetworkPkg: Define one private variable for TLS CipherList
configuration.
  NetworkPkg: Read TlsCipherList variable and configure it for HTTPS
session.

 NetworkPkg/HttpDxe/HttpDriver.h |  3 +-
 NetworkPkg/HttpDxe/HttpDxe.inf  |  3 +-
 NetworkPkg/HttpDxe/HttpsSupport.c   | 92 -
 NetworkPkg/Include/Guid/TlsCipherList.h | 38 ++
 NetworkPkg/NetworkPkg.dec   |  3 ++
 5 files changed, 136 insertions(+), 3 deletions(-)
 create mode 100644 NetworkPkg/Include/Guid/TlsCipherList.h

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] NetworkPkg: Define one private variable for TLS CipherList configuration.

2018-02-08 Thread Jiaxin Wu
This variable can be set by any platform that want to control its own preferred
TlsCipherList for the later HTTPS session.

The valid contents of variable must follow the TLS CipherList format defined
in RFC 5246. The valid length of variable must be an integral multiple of 2.
For example, if below cipher suites are preferred:
CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256 = {0x00,0x3C}
CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA256 = {0x00,0x3D}
Then, the contents of variable should be:
{0x00,0x3C,0x00,0x3D}

Cc: Laszlo Ersek 
Cc: Kinney Michael D 
Cc: Zimmer Vincent 
Cc: Yao Jiewen 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Include/Guid/TlsCipherList.h | 38 +
 NetworkPkg/NetworkPkg.dec   |  3 +++
 2 files changed, 41 insertions(+)
 create mode 100644 NetworkPkg/Include/Guid/TlsCipherList.h

diff --git a/NetworkPkg/Include/Guid/TlsCipherList.h 
b/NetworkPkg/Include/Guid/TlsCipherList.h
new file mode 100644
index 000..e31b7bf
--- /dev/null
+++ b/NetworkPkg/Include/Guid/TlsCipherList.h
@@ -0,0 +1,38 @@
+/** @file
+  This file defines the TlsCipherList variable for HTTPS to configure Tls 
Cipher List.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __TLS_CIPHER_LIST_H__
+#define __TLS_CIPHER_LIST_H__
+
+//
+// Private Variable for HTTPS to configure Tls Cipher List.
+// The valid contents of variable must follow the TLS CipherList format 
defined in RFC 5246. 
+// The valid length of variable must be an integral multiple of 2.
+// For example, if below cipher suites are preferred:
+//  CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256 = {0x00,0x3C}
+//   CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA256 = {0x00,0x3D}
+// Then, the contents of variable should be:
+//   {0x00,0x3C,0x00,0x3D}
+//
+#define EDKII_TLS_CIPHER_LIST_GUID \
+  { \
+0x46ddb415, 0x5244, 0x49c7, { 0x93, 0x74, 0xf0, 0xe2, 0x98, 0xe7, 0xd3, 
0x86 } \
+  }
+  
+#define EDKII_TLS_CIPHER_LIST_VARIABLE   L"TlsCipherList"
+
+extern EFI_GUID gTlsCipherListGuid;
+
+#endif
+
diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
index 902df37..bdf8361 100644
--- a/NetworkPkg/NetworkPkg.dec
+++ b/NetworkPkg/NetworkPkg.dec
@@ -44,10 +44,13 @@
   gTlsAuthConfigGuid= { 0xb0eae4f8, 0x9a04, 0x4c6d, { 0xa7, 0x48, 
0x79, 0x3d, 0xaa, 0xf, 0x65, 0xdf }}
   
   # Include/Guid/TlsAuthentication.h
   gEfiTlsCaCertificateGuid  = { 0xfd2340D0, 0x3dab, 0x4349, { 0xa6, 0xc7, 
0x3b, 0x4f, 0x12, 0xb4, 0x8e, 0xae }}
 
+  # Include/Guid/TlsCipherList.h
+  gTlsCipherListGuid   = { 0x46ddb415, 0x5244, 0x49c7, { 0x93, 0x74, 0xf0, 
0xe2, 0x98, 0xe7, 0xd3, 0x86 }}
+
 [PcdsFixedAtBuild]
   ## The max attempt number will be created by iSCSI driver.
   # @Prompt Max attempt number.
   gEfiNetworkPkgTokenSpaceGuid.PcdMaxIScsiAttemptNumber|0x08|UINT8|0x000D
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] Nt32Pkg/Nt32Pkg.fdf: Increase the size of FLASH Device.

2018-01-29 Thread Jiaxin Wu
Currently, the FV image size is not enough for the modules after
we enable some flags defined in Nt32Pkg.dsc, e.g:
 DEFINE SECURE_BOOT_ENABLE  = TRUE
 DEFINE TLS_ENABLE  = TRUE
 DEFINE NETWORK_IP6_ENABLE  = TRUE

This patch is to increase the size of FLASH Device to meet the requirement.

Cc: Ruiyu Ni 
Cc: Hao Wu 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 Nt32Pkg/Nt32Pkg.fdf | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf
index d104cb7..db2719f 100644
--- a/Nt32Pkg/Nt32Pkg.fdf
+++ b/Nt32Pkg/Nt32Pkg.fdf
@@ -26,14 +26,14 @@
 # existing system flash.
 #
 

 [FD.Nt32]
 BaseAddress   = 0x0|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFdBaseAddress  
#The base address of the FLASH Device.
-Size  = 0x0038|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize  
#The size in bytes of the FLASH Device
+Size  = 0x0048|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize  
#The size in bytes of the FLASH Device
 ErasePolarity = 1
 BlockSize = 0x1
-NumBlocks = 0x38
+NumBlocks = 0x48
 
 

 #
 # Following are lists of FD Region layout which correspond to the locations of 
different
 # images within the flash device.
@@ -46,15 +46,15 @@ NumBlocks = 0x38
 # Offset|Size
 # PcdOffsetCName|PcdSizeCName
 # RegionType 
 #
 

-0x|0x0036
+0x|0x0046
 
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoveryBase|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoverySize
 FV = FvRecovery
 
-0x0036|0xc000
+0x0046|0xc000
 
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
 #NV_VARIABLE_STORE
 DATA = {
   ## This is the EFI_FIRMWARE_VOLUME_HEADER
   # ZeroVector []
@@ -91,15 +91,15 @@ DATA = {
   0xB8, 0xBF, 0x00, 0x00,
   #FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
   0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 }
 
-0x0036c000|0x2000
+0x0046c000|0x2000
 #NV_EVENT_LOG
 
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogBase|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogSize
 
-0x0036e000|0x2000
+0x0046e000|0x2000
 
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
 #NV_FTW_WORKING
 DATA = {
   # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = 
gEdkiiWorkingBlockSignatureGuid =
   #  { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65,  0x0, 0xfd, 0x9f, 0x1b, 
0x95 }}
@@ -109,11 +109,11 @@ DATA = {
   0xE2, 0x33, 0xF2, 0x03, 0xFE, 0xFF, 0xFF, 0xFF,
   # WriteQueueSize: UINT64
   0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 }
 
-0x0037|0x0001
+0x0047|0x0001
 #NV_FTW_SPARE
 
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
 
 

 #
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg/UefiBootManagerLib: Skip the DNS device path node check.

2018-01-22 Thread Jiaxin Wu
After HTTP boot successfully in home mode, the HTTP device path will be
updated accordingly. So, the new device path may be appended with a DNS
device path node. When executing home mode boot again, the original HTTP
device path will mismatch with the new updated one, which will cause the
HTTP boot failure. So, we need update the current match algorithm to match
the correct FilePath. Since the DNS device path is an optional, we can skip
it check.

This patch is to fix above issue.

Cc: Ruiyu Ni 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index d684482..6404233 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1,9 +1,9 @@
 /** @file
   Library functions which relates with booting.
 
-Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
@@ -1117,10 +1117,18 @@ BmMatchHttpBootDevicePath (
 if (CompareMem (Left, Right, DevicePathNodeLength (Left)) != 0) {
   if ((DevicePathType (Left) != MESSAGING_DEVICE_PATH) || (DevicePathType 
(Right) != MESSAGING_DEVICE_PATH)) {
 return FALSE;
   }
 
+  if (DevicePathSubType (Left) == MSG_DNS_DP) {
+Left = NextDevicePathNode (Left);
+  }
+
+  if (DevicePathSubType (Right) == MSG_DNS_DP) {
+Right = NextDevicePathNode (Right);
+  }
+
   if (((DevicePathSubType (Left) != MSG_IPv4_DP) || (DevicePathSubType 
(Right) != MSG_IPv4_DP)) &&
   ((DevicePathSubType (Left) != MSG_IPv6_DP) || (DevicePathSubType 
(Right) != MSG_IPv6_DP)) &&
   ((DevicePathSubType (Left) != MSG_URI_DP)  || (DevicePathSubType 
(Right) != MSG_URI_DP))
   ) {
 return FALSE;
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] IScsiDxe: Set ExitBootServiceEvent to NULL after close it.

2018-01-08 Thread Jiaxin Wu
There are two place to close the ISCSI ExitBootServiceEvent:
One is IScsiOnExitBootService callback function.
Another is ISCSI driver stop() function.

When OS loader triggers ExitBootServiceEvent, firstly, the exit boot service
callback function will close and free the ExitBootServiceEvent, then secondly
the system will call ISCSI driver stop() function, the ExitBootServiceEvent
will be closed and freed again, the use-after-free memory access happens.

This issue is recorded at https://bugzilla.tianocore.org/show_bug.cgi?id=742.
This patch is to resolve the issue.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

*** BLURB HERE ***

Jiaxin Wu (2):
  MdeModulePkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close
it.
  NetworkPkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.

 MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 12 
 NetworkPkg/IScsiDxe/IScsiMisc.c | 12 
 2 files changed, 16 insertions(+), 8 deletions(-)

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] MdeModulePkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.

2018-01-08 Thread Jiaxin Wu
There are two place to close the ISCSI ExitBootServiceEvent:
One is IScsiOnExitBootService callback function.
Another is ISCSI driver stop() function.

When OS loader triggers ExitBootServiceEvent, firstly, the exit boot service
callback function will close and free the ExitBootServiceEvent, then secondly
the system will call ISCSI driver stop() function, the ExitBootServiceEvent
will be closed and freed again, the use-after-free memory access happens.

This issue is recorded at https://bugzilla.tianocore.org/show_bug.cgi?id=742.
This patch is to resolve the issue.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c 
b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
index ae202c3..29dfe94 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines for iSCSI driver.
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -622,13 +622,14 @@ IScsiCleanDriverData (
 >IScsiExtScsiPassThru
 );
   }
 
 EXIT:
-
-  gBS->CloseEvent (Private->ExitBootServiceEvent);
-
+  if (Private->ExitBootServiceEvent != NULL) {
+gBS->CloseEvent (Private->ExitBootServiceEvent);
+  }
+  
   FreePool (Private);
   return Status;
 }
 
 /**
@@ -870,12 +871,15 @@ IScsiOnExitBootService (
   )
 {
   ISCSI_DRIVER_DATA *Private;
 
   Private = (ISCSI_DRIVER_DATA *) Context;
+  
   gBS->CloseEvent (Private->ExitBootServiceEvent);
 
+  Private->ExitBootServiceEvent = NULL;
+
   IScsiSessionAbort (>Session);
 }
 
 /**
   Tests whether a controller handle is being managed by IScsi driver.
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] NetworkPkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.

2018-01-08 Thread Jiaxin Wu
There are two place to close the ISCSI ExitBootServiceEvent:
One is IScsiOnExitBootService callback function.
Another is ISCSI driver stop() function.

When OS loader triggers ExitBootServiceEvent, firstly, the exit boot service
callback function will close and free the ExitBootServiceEvent, then secondly
the system will call ISCSI driver stop() function, the ExitBootServiceEvent
will be closed and freed again, the use-after-free memory access happens.

This issue is recorded at https://bugzilla.tianocore.org/show_bug.cgi?id=742.
This patch is to resolve the issue.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 9e4164c..9b26147 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines for iSCSI driver.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -1796,12 +1796,13 @@ IScsiCleanDriverData (
   mPrivate->OneSessionEstablished = FALSE;
 }
   }
 
 EXIT:
-
-  gBS->CloseEvent (Private->ExitBootServiceEvent);
+  if (Private->ExitBootServiceEvent != NULL) {
+gBS->CloseEvent (Private->ExitBootServiceEvent); 
+  }
 
   mCallbackInfo->Current = NULL;
 
   FreePool (Private);
   return Status;
@@ -2483,12 +2484,15 @@ IScsiOnExitBootService (
   )
 {
   ISCSI_DRIVER_DATA *Private;
 
   Private = (ISCSI_DRIVER_DATA *) Context;
+  
   gBS->CloseEvent (Private->ExitBootServiceEvent);
-
+  
+  Private->ExitBootServiceEvent = NULL;
+  
   if (Private->Session != NULL) {
 IScsiSessionAbort (Private->Session);
   }
 }
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] MdeModulePkg/IScsiDxe: Remove unnecessary close for ExitBootServiceEvent.

2018-01-01 Thread Jiaxin Wu
The close for ExitBootServiceEvent in IScsiOnExitBootService callback
function is unnecessary since it will be closed in ISCSI driver stop()
function, which is invoked when the transition from BS to RT.

This issue is recorded at
https://bugzilla.tianocore.org/show_bug.cgi?id=742.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c 
b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
index ae202c3..166fb4d 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines for iSCSI driver.
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -870,11 +870,10 @@ IScsiOnExitBootService (
   )
 {
   ISCSI_DRIVER_DATA *Private;
 
   Private = (ISCSI_DRIVER_DATA *) Context;
-  gBS->CloseEvent (Private->ExitBootServiceEvent);
 
   IScsiSessionAbort (>Session);
 }
 
 /**
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] NetworkPkg/IScsiDxe: Remove unnecessary close for ExitBootServiceEvent.

2018-01-01 Thread Jiaxin Wu
The close for ExitBootServiceEvent in IScsiOnExitBootService callback
function is unnecessary since it will be closed in ISCSI driver stop()
function, which is invoked when the transition from BS to RT.

This issue is recorded at
https://bugzilla.tianocore.org/show_bug.cgi?id=742.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 9e4164c..cfa8b29 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines for iSCSI driver.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -2483,12 +2483,11 @@ IScsiOnExitBootService (
   )
 {
   ISCSI_DRIVER_DATA *Private;
 
   Private = (ISCSI_DRIVER_DATA *) Context;
-  gBS->CloseEvent (Private->ExitBootServiceEvent);
-
+  
   if (Private->Session != NULL) {
 IScsiSessionAbort (Private->Session);
   }
 }
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] IScsiDxe: Remove unnecessary close for ExitBootServiceEvent.

2018-01-01 Thread Jiaxin Wu
The close for ExitBootServiceEvent in IScsiOnExitBootService callback
function is unnecessary since it will be closed in ISCSI driver stop()
function, which is invoked when the transition from BS to RT.

This issue is recorded at
https://bugzilla.tianocore.org/show_bug.cgi?id=742.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (2):
  MdeModulePkg/IScsiDxe: Remove unnecessary close for
ExitBootServiceEvent.
  NetworkPkg/IScsiDxe: Remove unnecessary close for
ExitBootServiceEvent.

 MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 3 +--
 NetworkPkg/IScsiDxe/IScsiMisc.c | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] NetworkPkg/TcpDxe: Check TCP payload for release version.

2017-12-25 Thread Jiaxin Wu
TCP payload check is implemented by TcpVerifySegment(), but all the function
calls of TcpVerifySegment() are placed in ASSERT(), which is only valid for
debug version:
  ASSERT (TcpVerifySegment (Nbuf) != 0);

This patch is to enable the check for release version.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/TcpDxe/TcpInput.c  | 125 +-
 NetworkPkg/TcpDxe/TcpOutput.c |  29 +++---
 2 files changed, 122 insertions(+), 32 deletions(-)

diff --git a/NetworkPkg/TcpDxe/TcpInput.c b/NetworkPkg/TcpDxe/TcpInput.c
index f8845dc..92a0ab8 100644
--- a/NetworkPkg/TcpDxe/TcpInput.c
+++ b/NetworkPkg/TcpDxe/TcpInput.c
@@ -279,12 +279,15 @@ TcpComputeRtt (
 
   @param[in]  Nbuf The buffer that contains a received TCP segment without 
an IP header.
   @param[in]  Left The sequence number of the window's left edge.
   @param[in]  RightThe sequence number of the window's right edge.
 
+  @retval 0The segment is broken.
+  @retval 1The segment is in good shape.
+
 **/
-VOID
+INTN
 TcpTrimSegment (
   IN NET_BUF   *Nbuf,
   IN TCP_SEQNO Left,
   IN TCP_SEQNO Right
   )
@@ -304,11 +307,11 @@ TcpTrimSegment (
 TCP_CLEAR_FLG (Seg->Flag, TCP_FLG_SYN);
 TCP_CLEAR_FLG (Seg->Flag, TCP_FLG_FIN);
 
 Seg->Seq = Seg->End;
 NetbufTrim (Nbuf, Nbuf->TotalSize, NET_BUF_HEAD);
-return;
+return 1;
   }
 
   //
   // Adjust the buffer header
   //
@@ -357,27 +360,30 @@ TcpTrimSegment (
 if (Drop != 0) {
   NetbufTrim (Nbuf, Drop, NET_BUF_TAIL);
 }
   }
 
-  ASSERT (TcpVerifySegment (Nbuf) != 0);
+  return TcpVerifySegment (Nbuf);
 }
 
 /**
   Trim off the data outside the tcb's receive window.
 
   @param[in]  Tcb  Pointer to the TCP_CB of this TCP instance.
   @param[in]  Nbuf Pointer to the NET_BUF containing the received tcp 
segment.
 
+  @retval 0The segment is broken.
+  @retval 1The segment is in good shape.
+
 **/
-VOID
+INTN
 TcpTrimInWnd (
   IN TCP_CB  *Tcb,
   IN NET_BUF *Nbuf
   )
 {
-  TcpTrimSegment (Nbuf, Tcb->RcvNxt, Tcb->RcvWl2 + Tcb->RcvWnd);
+  return TcpTrimSegment (Nbuf, Tcb->RcvNxt, Tcb->RcvWl2 + Tcb->RcvWnd);
 }
 
 /**
   Process the data and FIN flag, and check whether to deliver
   data to the socket layer.
@@ -419,11 +425,20 @@ TcpDeliverData (
 
   while (Entry != >RcvQue) {
 Nbuf  = NET_LIST_USER_STRUCT (Entry, NET_BUF, List);
 Seg   = TCPSEG_NETBUF (Nbuf);
 
-ASSERT (TcpVerifySegment (Nbuf) != 0);
+if (TcpVerifySegment (Nbuf) == 0) {
+  DEBUG (
+(EFI_D_ERROR,
+"TcpToSendData: discard a broken segment for TCB %p\n",
+Tcb)
+);
+  NetbufFree (Nbuf);
+  return -1;
+}
+
 ASSERT (Nbuf->Tcp == NULL);
 
 if (TCP_SEQ_GT (Seg->Seq, Seq)) {
   break;
 }
@@ -559,12 +574,15 @@ TcpDeliverData (
   Store the data into the reassemble queue.
 
   @param[in, out]  Tcb   Pointer to the TCP_CB of this TCP instance.
   @param[in]   Nbuf  Pointer to the buffer containing the data to be 
queued.
 
+  @retval  0 An error condition occurred.
+  @retval  1 No error occurred to queue data.
+
 **/
-VOID
+INTN
 TcpQueueData (
   IN OUT TCP_CB  *Tcb,
   IN NET_BUF *Nbuf
   )
 {
@@ -586,11 +604,11 @@ TcpQueueData (
   // no out-of-order segments are received.
   //
   if (IsListEmpty (Head)) {
 
 InsertTailList (Head, >List);
-return;
+return 1;
   }
 
   //
   // Find the point to insert the buffer
   //
@@ -613,16 +631,16 @@ TcpQueueData (
 Node = NET_LIST_USER_STRUCT (Prev, NET_BUF, List);
 
 if (TCP_SEQ_LT (Seg->Seq, TCPSEG_NETBUF (Node)->End)) {
 
   if (TCP_SEQ_LEQ (Seg->End, TCPSEG_NETBUF (Node)->End)) {
-
-NetbufFree (Nbuf);
-return;
+return 1;
   }
 
-  TcpTrimSegment (Nbuf, TCPSEG_NETBUF (Node)->End, Seg->End);
+  if (TcpTrimSegment (Nbuf, TCPSEG_NETBUF (Node)->End, Seg->End) == 0) {
+return 0;
+  }
 }
   }
 
   InsertHeadList (Prev, >List);
 
@@ -646,31 +664,38 @@ TcpQueueData (
 if (TCP_SEQ_LT (TCPSEG_NETBUF (Node)->Seq, Seg->End)) {
 
   if (TCP_SEQ_LEQ (TCPSEG_NETBUF (Node)->Seq, Seg->Seq)) {
 
 RemoveEntryList (>List);
-NetbufFree (Nbuf);
-return;
+return 1;
   }
 
-  TcpTrimSegment (Nbuf, Seg->Seq, TCPSEG_NETBUF (Node)->Seq);
+  if (TcpTrimSegment (Nbuf, Seg->Seq, TCPSEG_NETBUF (Node)->Seq) == 0) {
+RemoveEntryList (>List);
+return 0;
+  }
   break;
 }
 
 Cur = Cur->ForwardLink;
   }
+
+  return 1;
 }
 
 
 /**
   Adjust the send queue or the retransmit queue.
 
   @param[in]  Tcb  Pointer to the TCP_CB of this TCP instance.
   @param[in]  Ack  The acknowledge seuqence number of the received segment.
 
+  @retval  0 An 

[edk2] [Patch 1/2] NetworkPkg/HttpDxe: Fix the memory leak issue in HttpRequest().

2017-12-25 Thread Jiaxin Wu
Cc: Wang Fan 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 57fa39f..fe1c3b7 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -470,10 +470,12 @@ EfiHttpRequest (
 
   Wrap->TcpWrap.Method = Request->Method;
 
   FreePool (HostName);
 
+  HttpUrlFreeParser (UrlParser);
+
   //
   // Queue the HTTP token and return.
   //
   return EFI_SUCCESS;
 } else {
@@ -654,10 +656,14 @@ EfiHttpRequest (
   DispatchDpc ();
   
   if (HostName != NULL) {
 FreePool (HostName);
   }
+
+  if (UrlParser != NULL) {
+HttpUrlFreeParser (UrlParser);
+  }
   
   return EFI_SUCCESS;
 
 Error5:
   //
@@ -697,11 +703,11 @@ Error1:
 FreePool (HostName);
   }
   if (Wrap != NULL) {
 FreePool (Wrap);
   }
-  if (UrlParser!= NULL) {
+  if (UrlParser != NULL) {
 HttpUrlFreeParser (UrlParser);
   }
 
   return Status;
   
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] NetworkPkg/HttpDxe: Fix some issues in HttpDxe

2017-12-25 Thread Jiaxin Wu
Cc: Wang Fan <fan.w...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (2):
  NetworkPkg/HttpDxe: Fix the memory leak issue in HttpRequest().
  NetworkPkg/HttpDxe: Remove the unnecessary ASSERT.

 NetworkPkg/HttpDxe/HttpImpl.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] NetworkPkg/HttpDxe: Remove the unnecessary ASSERT.

2017-12-25 Thread Jiaxin Wu
Cc: Wang Fan 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index fe1c3b7..b3a64cf 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -63,11 +63,10 @@ EfiHttpGetModeData (
   if ((This == NULL) || (HttpConfigData == NULL)) {
 return EFI_INVALID_PARAMETER;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
-  ASSERT (HttpInstance != NULL);
 
   if ((HttpConfigData->AccessPoint.IPv6Node == NULL) ||
   (HttpConfigData->AccessPoint.IPv4Node == NULL)) {
 return EFI_INVALID_PARAMETER;
   }
@@ -147,11 +146,11 @@ EfiHttpConfigure (
 (!HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv4Node == NULL {
 return EFI_INVALID_PARAMETER;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
-  ASSERT (HttpInstance != NULL && HttpInstance->Service != NULL);
+  ASSERT (HttpInstance->Service != NULL);
 
   if (HttpConfigData != NULL) {
 
 if (HttpConfigData->HttpVersion >= HttpVersionUnsupported) {
   return EFI_UNSUPPORTED;
@@ -289,11 +288,10 @@ EfiHttpRequest (
   (Request->Method != HttpMethodPost) && (Request->Method != 
HttpMethodPatch)) {
 return EFI_UNSUPPORTED;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
-  ASSERT (HttpInstance != NULL);
 
   //
   // Capture the method into HttpInstance.
   //
   if (Request != NULL) {
@@ -623,12 +621,10 @@ EfiHttpRequest (
 
   if (EFI_ERROR (Status) || NULL == RequestMsg) {
 goto Error3;
   }
 
-  ASSERT (RequestMsg != NULL);
-
   //
   // Every request we insert a TxToken and a response call would remove the 
TxToken.
   // In cases of PUT/POST/PATCH, after an initial request-response pair, we 
would do a
   // continuous request without a response call. So, in such cases, where 
Request
   // structure is NULL, we would not insert a TxToken.
@@ -885,11 +881,10 @@ EfiHttpCancel (
   if (This == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
-  ASSERT (HttpInstance != NULL);
 
   if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
 return EFI_NOT_STARTED;
   }
 
@@ -1543,11 +1538,10 @@ EfiHttpResponse (
   if (HttpMsg == NULL) {
 return EFI_INVALID_PARAMETER;
   }
   
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
-  ASSERT (HttpInstance != NULL);
 
   if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
 return EFI_NOT_STARTED;
   }
 
@@ -1639,11 +1633,10 @@ EfiHttpPoll (
   if (This == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
-  ASSERT (HttpInstance != NULL);
 
   if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
 return EFI_NOT_STARTED;
   }
   
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/5 v2] MdeModulePkg/DxeHttpLib: Add boundary condition check.

2017-12-25 Thread Jiaxin Wu
v2:
* Fix GCC the build error.

This patch is to add the boundary condition check to make sure
the accessed buffer is valid.

Cc: Gary Lin 
Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 38 +---
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c 
b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index caddbb7..915b81d 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -54,11 +54,11 @@ UriPercentDecode (
   Index = 0;
   Offset = 0;
   HexStr[2] = '\0';
   while (Index < BufferLength) {
 if (Buffer[Index] == '%') {
-  if (!NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR 
(Buffer[Index+2])) {
+  if (Index + 1 >= BufferLength || Index + 2 >= BufferLength || 
!NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR (Buffer[Index+2])) {
 return EFI_INVALID_PARAMETER;
   }
   HexStr[0] = Buffer[Index+1];
   HexStr[1] = Buffer[Index+2];
   ResultBuffer[Offset] = (CHAR8) AsciiStrHexToUintn (HexStr);
@@ -1556,20 +1556,31 @@ HttpGetFieldNameAndValue (
   )
 {
   CHAR8  *FieldNameStr;
   CHAR8  *FieldValueStr;
   CHAR8  *StrPtr;
+  CHAR8  *EndofHeader;
 
   if (String == NULL || FieldName == NULL || FieldValue == NULL) {
 return NULL;
   }
 
   *FieldName= NULL;
   *FieldValue   = NULL;
   FieldNameStr  = NULL;
   FieldValueStr = NULL;
   StrPtr= NULL;
+  EndofHeader   = NULL;
+
+
+  //
+  // Check whether the raw HTTP header string is valid or not.
+  //
+  EndofHeader = AsciiStrStr (String, "\r\n\r\n");
+  if (EndofHeader == NULL) {
+return NULL;
+  }
 
   //
   // Each header field consists of a name followed by a colon (":") and the 
field value.
   //
   FieldNameStr = String;
@@ -1583,17 +1594,36 @@ HttpGetFieldNameAndValue (
   //
   *(FieldValueStr - 1) = 0;
 
   //
   // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
+  // Note: LWS  = [CRLF] 1*(SP|HT), it can be '\r\n ' or '\r\n\t' or ' ' or 
'\t'.
+  //   CRLF = '\r\n'.
+  //   SP   = ' '.
+  //   HT   = '\t' (Tab).
   //
   while (TRUE) {
 if (*FieldValueStr == ' ' || *FieldValueStr == '\t') {
+  //
+  // Boundary condition check. 
+  //
+  if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 1) {
+return NULL;  
+  }
+  
   FieldValueStr ++;
-} else if (*FieldValueStr == '\r' && *(FieldValueStr + 1) == '\n' &&
-   (*(FieldValueStr + 2) == ' ' || *(FieldValueStr + 2) == '\t')) {
-  FieldValueStr = FieldValueStr + 3;
+} else if (*FieldValueStr == '\r') {
+  //
+  // Boundary condition check. 
+  //
+  if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 3) {
+return NULL;  
+  }
+
+  if (*(FieldValueStr + 1) == '\n' && (*(FieldValueStr + 2) == ' ' || 
*(FieldValueStr + 2) == '\t')) {
+FieldValueStr = FieldValueStr + 3;
+  }
 } else {
   break;
 }
   }
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/5] MdeModulePkg/DxeHttpLib: Fix series issues in DxeHttpLib.

2017-12-25 Thread Jiaxin Wu
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (5):
  MdeModulePkg/DxeHttpLib: Add boundary condition check.
  MdeModulePkg/DxeHttpLib: Avoid the potential memory leak when error
happen.
  MdeModulePkg/DxeHttpLib: Check the input parameters for some APIs.
  MdeModulePkg/DxeHttpLib: Correct some return Status.
  MdeModulePkg/DxeHttpLib: Refine some coding style.

 MdeModulePkg/Include/Library/HttpLib.h   |  10 +-
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 190 +--
 2 files changed, 125 insertions(+), 75 deletions(-)

-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/5] MdeModulePkg/DxeHttpLib: Add boundary condition check.

2017-12-25 Thread Jiaxin Wu
This patch is to add the boundary condition check to make sure
the accessed buffer is valid.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wang Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 39 
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c 
b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index caddbb7..4d353d7 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -33,11 +33,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
   @retval EFI_SUCCESSSuccessfully decoded the URI.
   @retval EFI_INVALID_PARAMETER  Buffer is not a valid percent-encoded string.
   
 **/
 EFI_STATUS
-EFIAPI
 UriPercentDecode (
   IN  CHAR8*Buffer,
   IN  UINT32BufferLength,
  OUT  CHAR8*ResultBuffer,
  OUT  UINT32   *ResultLength
@@ -54,11 +53,11 @@ UriPercentDecode (
   Index = 0;
   Offset = 0;
   HexStr[2] = '\0';
   while (Index < BufferLength) {
 if (Buffer[Index] == '%') {
-  if (!NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR 
(Buffer[Index+2])) {
+  if (Index + 1 >= BufferLength || Index + 2 >= BufferLength || 
!NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR (Buffer[Index+2])) {
 return EFI_INVALID_PARAMETER;
   }
   HexStr[0] = Buffer[Index+1];
   HexStr[1] = Buffer[Index+2];
   ResultBuffer[Offset] = (CHAR8) AsciiStrHexToUintn (HexStr);
@@ -1556,20 +1555,31 @@ HttpGetFieldNameAndValue (
   )
 {
   CHAR8  *FieldNameStr;
   CHAR8  *FieldValueStr;
   CHAR8  *StrPtr;
+  CHAR8  *EndofHeader;
 
   if (String == NULL || FieldName == NULL || FieldValue == NULL) {
 return NULL;
   }
 
   *FieldName= NULL;
   *FieldValue   = NULL;
   FieldNameStr  = NULL;
   FieldValueStr = NULL;
   StrPtr= NULL;
+  EndofHeader   = NULL;
+
+
+  //
+  // Check whether the raw HTTP header string is valid or not.
+  //
+  EndofHeader = AsciiStrStr (String, "\r\n\r\n");
+  if (EndofHeader == NULL) {
+return NULL;
+  }
 
   //
   // Each header field consists of a name followed by a colon (":") and the 
field value.
   //
   FieldNameStr = String;
@@ -1583,17 +1593,36 @@ HttpGetFieldNameAndValue (
   //
   *(FieldValueStr - 1) = 0;
 
   //
   // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
+  // Note: LWS  = [CRLF] 1*(SP|HT), it can be '\r\n ' or '\r\n\t' or ' ' or 
'\t'.
+  //   CRLF = '\r\n'.
+  //   SP   = ' '.
+  //   HT   = '\t' (Tab).
   //
   while (TRUE) {
 if (*FieldValueStr == ' ' || *FieldValueStr == '\t') {
+  //
+  // Boundary condition check. 
+  //
+  if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 1) {
+return NULL;  
+  }
+  
   FieldValueStr ++;
-} else if (*FieldValueStr == '\r' && *(FieldValueStr + 1) == '\n' &&
-   (*(FieldValueStr + 2) == ' ' || *(FieldValueStr + 2) == '\t')) {
-  FieldValueStr = FieldValueStr + 3;
+} else if (*FieldValueStr == '\r') {
+  //
+  // Boundary condition check. 
+  //
+  if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 3) {
+return NULL;  
+  }
+
+  if (*(FieldValueStr + 1) == '\n' && (*(FieldValueStr + 2) == ' ' || 
*(FieldValueStr + 2) == '\t')) {
+FieldValueStr = FieldValueStr + 3;
+  }
 } else {
   break;
 }
   }
 
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  1   2   3   4   >