Re: [edk2] [PATCH 0/5] NetworkPkg: HTTP and TLS updates

2018-03-27 Thread Wu, Jiaxin
Series Reviewed-by: Jiaxin Wu 

Thanks,
Jiaxin

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, March 23, 2018 12:39 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 0/5] NetworkPkg: HTTP and TLS updates
> 
> Repo:   https://github.com/lersek/edk2.git
> Branch: http_and_tls_updates
> 
> Patch #4 fixes TianoCore BZ#909
> .
> 
> Patches #2 and #3 are cleanups / preparation for patch #4.
> 
> Patch #1 fixes an independent typo that I noticed in the code while
> configuring my DHCP server for HTTP(S) booting. It's isolated, so I put
> it first in the series.
> 
> Patch #5 is preparation for future platform enablement, so that a
> platform can create both "TlsCaCertificate" and "HttpTlsCipherList"
> variables on every boot from scratch as volatile variables (without
> flash varstore footprint).
> 
> I regression-tested this series with a successful HTTPS boot of an ISO
> image from OVMF, using a DER-formatted self-signed certificate that I
> enrolled with TlsAuthConfigDxe.
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (5):
>   NetworkPkg/HttpBootDxe: fix typo in DHCPv4 packet parsing
>   NetworkPkg/HttpDxe: use error handler epilogue in
> TlsConfigCertificate()
>   NetworkPkg/HttpDxe: drop misleading comment / status code in cert
> config
>   NetworkPkg/HttpDxe: sanity-check the TlsCaCertificate variable before
> use
>   NetworkPkg/TlsAuthConfigDxe: preserve TlsCaCertificate variable
> attributes
> 
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.c  |  4 +-
>  NetworkPkg/HttpDxe/HttpDxe.inf  |  3 +-
>  NetworkPkg/HttpDxe/HttpsSupport.c   | 74 ++--
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 15 ++--
>  4 files changed, 80 insertions(+), 16 deletions(-)
> 
> --
> 2.14.1.3.gb7cf6e02401b

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


[edk2] [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch

2018-03-27 Thread Kinney, Michael D
https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update Minnow Max FLASH libraries to match libraries in
the UDK2017 development branch in edk2-platforms.

https://github.com/tianocore/edk2-platforms/tree/devel-MinnowBoardMax-UDK2017

Cc: David Wei 
Cc: Mang Guo 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 .../PlatformFlashAccessLib.c   | 491 -
 .../PlatformFlashAccessLib.inf |  19 +-
 .../Library/FlashDeviceLib/FlashDeviceLib.c| 158 ++-
 .../Library/FlashDeviceLib/FlashDeviceLib.inf  |   6 +-
 .../Library/FlashDeviceLib/SpiChipDefinitions.h|   1 +
 5 files changed, 639 insertions(+), 36 deletions(-)

diff --git 
a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
 
b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index f3cb31daaa..9162e025ed 100644
--- 
a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
+++ 
b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2017, 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
@@ -11,6 +11,7 @@
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
+#include 
 
 #include 
 
@@ -19,14 +20,366 @@
 #include 
 #include 
 #include 
-#include 
+//#include 
 #include 
+#include 
+#include 
+#include "PchAccess.h"
+#include 
+#include 
+#include 
+#include 
 
-#define SECTOR_SIZE_64KB  0x1  // Common 64kBytes sector size
-#define ALINGED_SIZE  SECTOR_SIZE_64KB
+//#define SECTOR_SIZE_64KB  0x1  // Common 64kBytes sector size
+//#define ALINGED_SIZE  SECTOR_SIZE_64KB
+
+#define BLOCK_SIZE 0x1000
+#define ALINGED_SIZE BLOCK_SIZE
+
+#define R_PCH_LPC_BIOS_CNTL   0xDC
+#define B_PCH_LPC_BIOS_CNTL_SMM_BWP   0x20///< SMM 
BIOS write protect disable
+
+//
+// Prefix Opcode Index on the host SPI controller
+//
+typedef enum {
+  SPI_WREN, // Prefix Opcode 0: Write Enable
+  SPI_EWSR, // Prefix Opcode 1: Enable Write Status Register
+} PREFIX_OPCODE_INDEX;
+//
+// Opcode Menu Index on the host SPI controller
+//
+typedef enum {
+  SPI_READ_ID,// Opcode 0: READ ID, Read cycle with address
+  SPI_READ,   // Opcode 1: READ, Read cycle with address
+  SPI_RDSR,   // Opcode 2: Read Status Register, No address
+  SPI_WRDI_SFDP,  // Opcode 3: Write Disable or Discovery Parameters, No 
address
+  SPI_SERASE, // Opcode 4: Sector Erase (4KB), Write cycle with address
+  SPI_BERASE, // Opcode 5: Block Erase (32KB), Write cycle with address
+  SPI_PROG,   // Opcode 6: Byte Program, Write cycle with address
+  SPI_WRSR,   // Opcode 7: Write Status Register, No address
+} SPI_OPCODE_INDEX;
 
 STATIC EFI_PHYSICAL_ADDRESS mInternalFdAddress;
 
+EFI_SPI_PROTOCOL  *mSpiProtocol;
+
+/**
+  Read NumBytes bytes of data from the address specified by
+  PAddress into Buffer.
+
+  @param[in]  Address   The starting physical address of the read.
+  @param[in,out]  NumBytes  On input, the number of bytes to read. On 
output, the number
+of bytes actually read.
+  @param[out] BufferThe destination data buffer for the read.
+
+  @retval EFI_SUCCESS   Opertion is successful.
+  @retval EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashRead (
+  IN UINTN Address,
+  IN OUT UINT32*NumBytes,
+ OUT UINT8 *Buffer
+  )
+{
+  EFI_STATUSStatus = EFI_SUCCESS;
+  UINTN Offset = 0;
+
+  ASSERT ((NumBytes != NULL) && (Buffer != NULL));
+
+
+  //if (Address >= (UINTN)PcdGet32 (PcdGbeRomBase) && Address < 
(UINTN)PcdGet32 (PcdPDRRomBase)) {
+Offset = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+Status = mSpiProtocol->Execute (
+   mSpiProtocol,
+   1, //SPI_READ,
+   0, //SPI_WREN,
+   TRUE,
+   TRUE,
+   FALSE,
+   Offset,
+   BLOCK_SIZE,
+   Buffer,
+   EnumSpiRegionAll
+   );
+return Status;
+}
+
+/**
+  Write NumBytes bytes of data from Buffer 

[edk2] [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues

2018-03-27 Thread Kinney, Michael D
https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix a the following issues

* Update build scripts to work when Vlv2Binaries are placed in PACKAGES_PATH
* Fix some compiler build breaks when using VS2015
* Remove references to  drivers that are not present
* Enable the Tianocore boot logo and BGRT table
* Enable full UEFI shell
* Enable more debug messages in DXE phase
* Update PlatformBdsLib to show boot logo when the boot
  mode is BOOT_ON_FLASH_UPDATE.
* Update FLASH libraries to match libraries in the UDK2017
  development branch in edk2-platforms.

Cc: David Wei 
Cc: Mang Guo 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 

Kinney, Michael D (4):
  Vlv2TbltDevicePkg: Fix VS2015 build breaks
  Vlv2TbltDevicePkg: Fix build issues in DSC/FDF
  Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
  Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch

Michael D Kinney (1):
  Vlv2TbltDevicePkg: Fix build scripts

 Vlv2TbltDevicePkg/.gitignore   |   3 +
 Vlv2TbltDevicePkg/Build_IFWI.bat   |   8 +-
 .../PlatformFlashAccessLib.c   | 491 -
 .../PlatformFlashAccessLib.inf |  19 +-
 .../Library/FlashDeviceLib/FlashDeviceLib.c| 158 ++-
 .../Library/FlashDeviceLib/FlashDeviceLib.inf  |   6 +-
 .../Library/FlashDeviceLib/SpiChipDefinitions.h|   1 +
 .../Library/PlatformBdsLib/BdsPlatform.c   |  14 +-
 Vlv2TbltDevicePkg/PlatformPkg.fdf  |  15 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf   |  17 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc|  12 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  |  12 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   |  14 +-
 .../PlatformSetupDxe/SetupInfoRecords.c|   1 -
 .../SmBiosMiscDxe/MiscProcessorCacheFunction.c |   6 -
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat|   2 +-
 .../VlvPlatformInitDxe/VlvPlatformInit.c   |   2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat  | 117 ++---
 18 files changed, 775 insertions(+), 123 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/.gitignore

-- 
2.14.2.windows.3

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


[edk2] [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts

2018-03-27 Thread Kinney, Michael D
From: Michael D Kinney 

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

Update build scripts to work with edk2 and Vlv2Binaries
in PACKAGES_PATH.

Cc: David Wei 
Cc: Mang Guo 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 Vlv2TbltDevicePkg/.gitignore|   3 +
 Vlv2TbltDevicePkg/Build_IFWI.bat|   8 +--
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat |   2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat   | 117 +---
 4 files changed, 72 insertions(+), 58 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/.gitignore

diff --git a/Vlv2TbltDevicePkg/.gitignore b/Vlv2TbltDevicePkg/.gitignore
new file mode 100644
index 00..b4699122b8
--- /dev/null
+++ b/Vlv2TbltDevicePkg/.gitignore
@@ -0,0 +1,3 @@
+AutoPlatformCFG.txt
+Stitch/Stitching.log
+Stitch/MNW*.bin
diff --git a/Vlv2TbltDevicePkg/Build_IFWI.bat b/Vlv2TbltDevicePkg/Build_IFWI.bat
index ac22a76b73..c8e3ec3d76 100644
--- a/Vlv2TbltDevicePkg/Build_IFWI.bat
+++ b/Vlv2TbltDevicePkg/Build_IFWI.bat
@@ -1,7 +1,7 @@
 @REM @file
 @REM   Windows batch file to build BIOS ROM
 @REM
-@REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+@REM Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 @REM This program and the accompanying materials
 @REM are licensed and made available under the terms and conditions of the BSD 
License
 @REM which accompanies this distribution.  The full text of the license may be 
found at
@@ -131,11 +131,11 @@ if %ERRORLEVEL% NEQ 0 (
 echo.
 echo Finished Building BIOS.
 @REM Set BIOS_ID environment variable here.
-call Conf\BiosId.bat
+call %WORKSPACE%\Conf\BiosId.bat
 echo BIOS_ID=%BIOS_ID%
 
 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment 
variables
-find /v "#" Conf\BiosId.env > ver_strings
+find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
 del /f/q ver_strings >nul
 set 
BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
@@ -149,7 +149,7 @@ if "%Platform_Type%" == "BYTC" (
 pushd %PLATFORM_PACKAGE%\Stitch
 )
:: IFWIStitch.bat [/nG] [/nM] [/nB] [/B BIOS.rom] [/C StitchConfig] [/S 
IFWISuffix]
-   call IFWIStitch.bat %Stitch_Flags% /B ..\..\%BIOS_Name% %IFWI_Suffix%
+   call IFWIStitch.bat %Stitch_Flags% /B %WORKSPACE%\%BIOS_Name% %IFWI_Suffix%

@echo off
 popd
diff --git a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat 
b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
index f3a9cf3d74..5f19983c91 100644
--- a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
+++ b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
@@ -191,7 +191,7 @@ for %%i in (%BIOS_Names%) do (
 echo Generating IFWI... %BIOS_ID%.bin
 echo.
 
-copy /b/y !IFWI_HEADER_FILE! + 
..\..\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin + 
..\..\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\Vacant.bin + !BIOS_Rom! 
%BIOS_ID%.bin
+copy /b/y !IFWI_HEADER_FILE! + 
%WORKSPACE%\Vlv2Binaries\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin
 + %WORKSPACE%\Vlv2Binaries\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\Vacant.bin + 
!BIOS_Rom! %BIOS_ID%.bin
 echo.
 echo 
===
 )
diff --git a/Vlv2TbltDevicePkg/bld_vlv.bat b/Vlv2TbltDevicePkg/bld_vlv.bat
index a1d8c5b525..27bc4e7c41 100644
--- a/Vlv2TbltDevicePkg/bld_vlv.bat
+++ b/Vlv2TbltDevicePkg/bld_vlv.bat
@@ -20,8 +20,8 @@ echo.
 ::**
 :: Initial Setup
 ::**
-set WORKSPACE=%CD%
-if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
+REM set WORKSPACE=%CD%
+REM if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
 set /a build_threads=1
 set "Build_Flags= "
 set exitCode=0
@@ -36,7 +36,7 @@ if exist %WORKSPACE%\Conf\target.txt del 
%WORKSPACE%\Conf\target.txt
 if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
 if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
 if exist %WORKSPACE%\Conf\FrameworkDatabase.db del 
%WORKSPACE%\Conf\FrameworkDatabase.db
-if exist conf\.cache rmdir /q/s conf\.cache
+if exist %WORKSPACE%\Conf\.cache rmdir /q/s %WORKSPACE%\Conf\.cache
 
 :: Setup EDK environment. Edksetup puts new copies of target.txt, 
tools_def.txt, build_rule.txt in WorkSpace\Conf
 :: Also run edksetup as soon as possible to avoid it from changing environment 
variables we're overriding
@@ -48,7 +48,7 @@ set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
 set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
 
-set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
+REM set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
 
 ::create new AutoPlatformCFG.txt file
 

[edk2] [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE

2018-03-27 Thread Kinney, Michael D
https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update PlatformBdsLib to show boot logo when the boot
mode is BOOT_ON_FLASH_UPDATE.

Cc: David Wei 
Cc: Mang Guo 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c 
b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
index e42e82b678..c25e1d301a 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -1,6 +1,6 @@
 /** @file
 
-  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 that accompanies this 
distribution.  
@@ -1871,6 +1871,7 @@ PlatformBdsPolicyBehavior (
 //
 PlatformBdsConnectConsole (gPlatformConsole);
 PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
+EnableQuietBoot (PcdGetPtr(PcdLogoFile));
 
 DEBUG((DEBUG_INFO, "ProcessCapsules Before EndOfDxe..\n"));
 ProcessCapsules ();
@@ -2642,6 +2643,8 @@ PlatformBdsEnterFrontPageWithHotKey (
 {
   EFI_STATUSStatus;
 
+  EFI_STATUS LogoStatus;
+  EFI_BOOT_LOGO_PROTOCOL *BootLogo;
   EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*SimpleTextOut;
   UINTN  BootTextColumn;
@@ -2721,6 +2724,14 @@ PlatformBdsEnterFrontPageWithHotKey (
 gST->ConOut->EnableCursor (gST->ConOut, TRUE);
 gST->ConOut->ClearScreen (gST->ConOut);
 
+//
+// Boot Logo is corrupted, report it using Boot Logo protocol.
+//
+LogoStatus = gBS->LocateProtocol (, NULL, (VOID 
**) );
+if (!EFI_ERROR (LogoStatus) && (BootLogo != NULL)) {
+  BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
+}
+
 if (EFI_ERROR (Status)) {
   //
   // Timeout or user press enter to continue
@@ -2728,6 +2739,7 @@ PlatformBdsEnterFrontPageWithHotKey (
   goto Exit;
 }
   }
+
   //
   // Install BM HiiPackages. 
   // Keep BootMaint HiiPackage, so that it can be covered by global setting. 
-- 
2.14.2.windows.3

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


[edk2] [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks

2018-03-27 Thread Kinney, Michael D
https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix minor code issues that break VS2015 builds.

Cc: David Wei 
Cc: Mang Guo 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c| 1 -
 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c | 6 --
 Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c   | 2 +-
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c 
b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
index b0e29f02d0..f608651cd4 100644
--- a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
+++ b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
@@ -1185,7 +1185,6 @@ UpdatePlatformInformation (
   EFI_STATUS   Status;
   UINT8CpuFlavor=0;
   EFI_PEI_HOB_POINTERS GuidHob;
-  EFI_PLATFORM_INFO_HOB*mPlatformInfo=NULL;
   UINTNNumHandles;
   EFI_HANDLE*HandleBuffer;
   UINTN Index;
diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c 
b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
index b18a6aaa3b..4a83aedc97 100644
--- a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
+++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
@@ -28,12 +28,6 @@ Abstract:
 #include 
 #include 
 
-
-extern  SMBIOS_TABLE_TYPE7*SmbiosRecordL1;
-extern  SMBIOS_TABLE_TYPE7*SmbiosRecordL2;
-extern  SMBIOS_TABLE_TYPE7*SmbiosRecordL3;
-
-
 UINT32
 ConvertBase2ToRaw (
   IN  EFI_EXP_BASE2_DATA *Data)
diff --git a/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c 
b/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
index 5e8d95ae9f..f8274e9df0 100644
--- a/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
+++ b/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
@@ -147,7 +147,7 @@ PostPmInitCallBack (
 EFI_STATUS
 IgdPmHook (
   IN EFI_HANDLE  ImageHandle,
-  IN DXE_VLV_PLATFORM_POLICY_PROTOCOL *DxePlatformSaPolicy
+  IN DXE_VLV_PLATFORM_POLICY_PROTOCOL *DxePlatformSaPolicyParam
   )
 {
 
-- 
2.14.2.windows.3

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


[edk2] [Patch 3/5] Vlv2TbltDevicePkg: Fix build issues in DSC/FDF

2018-03-27 Thread Kinney, Michael D
https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix a the following issues in DSC/FDF files

* Remove references to  drivers that are not present
* Enable the Tianocore boot logo and BGRT table
* Enable full UEFI shell
* Enable more debug messages in DXE phase

Cc: David Wei 
Cc: Mang Guo 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 Vlv2TbltDevicePkg/PlatformPkg.fdf   | 15 ---
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf| 17 +
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 12 
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 12 
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 14 +-
 5 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf 
b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 846db044b4..85309650db 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -319,7 +319,7 @@ [FV.FVRECOVERY2]
 INF 
EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
 !endif
 
-INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+# INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 !if $(TPM_ENABLED) == TRUE
 INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
 INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
@@ -473,6 +473,7 @@ [FV.FVMAIN]
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MpCpu.inf
 INF $(PLATFORM_PACKAGE)/Metronome/Metronome.inf
 INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+INF USE=X64 MdeModulePkg/Logo/Logo.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -612,6 +613,8 @@ [FV.FVMAIN]
 
 INF $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+INF 
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -635,8 +638,8 @@ [FV.FVMAIN]
 #
 # SDIO
 #
-INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
 #
 # IDE/SCSI/AHCI
 #
@@ -1091,6 +1094,12 @@ [Rule.Common.USER_DEFINED]
 RAW BIN|.bin
   }
 
+[Rule.Common.USER_DEFINED.BINARY]
+  FILE FREEFORM = $(NAMED_GUID) {
+UI  STRING="$(MODULE_NAME)" Optional
+RAW BIN|.bin
+  }
+
 [Rule.Common.USER_DEFINED.ACPITABLE]
   FILE FREEFORM = $(NAMED_GUID) {
 RAW ACPI  Optional|.acpi
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf 
b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
index 479c4c7264..51a620ea15 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
@@ -276,7 +276,7 @@ [FV.FVRECOVERY2]
 INF 
EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
 !endif
 
-INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+# INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 !if $(TPM_ENABLED) == TRUE
 INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
 INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
@@ -430,6 +430,7 @@ [FV.FVMAIN]
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MpCpu.inf
 INF $(PLATFORM_PACKAGE)/Metronome/Metronome.inf
 INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+INF USE=X64 MdeModulePkg/Logo/Logo.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -569,6 +570,8 @@ [FV.FVMAIN]
 
 INF $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+INF 
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -592,8 +595,8 @@ [FV.FVMAIN]
 #
 # SDIO
 #
-INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#INF 

Re: [edk2] [PATCH 0/5] NetworkPkg: HTTP and TLS updates

2018-03-27 Thread Fu, Siyuan
Reviewed-by: Fu Siyuan 


> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, March 22, 2018 9:39 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 0/5] NetworkPkg: HTTP and TLS updates
> 
> Repo:   https://github.com/lersek/edk2.git
> Branch: http_and_tls_updates
> 
> Patch #4 fixes TianoCore BZ#909
> .
> 
> Patches #2 and #3 are cleanups / preparation for patch #4.
> 
> Patch #1 fixes an independent typo that I noticed in the code while
> configuring my DHCP server for HTTP(S) booting. It's isolated, so I put
> it first in the series.
> 
> Patch #5 is preparation for future platform enablement, so that a
> platform can create both "TlsCaCertificate" and "HttpTlsCipherList"
> variables on every boot from scratch as volatile variables (without
> flash varstore footprint).
> 
> I regression-tested this series with a successful HTTPS boot of an ISO
> image from OVMF, using a DER-formatted self-signed certificate that I
> enrolled with TlsAuthConfigDxe.
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (5):
>   NetworkPkg/HttpBootDxe: fix typo in DHCPv4 packet parsing
>   NetworkPkg/HttpDxe: use error handler epilogue in
> TlsConfigCertificate()
>   NetworkPkg/HttpDxe: drop misleading comment / status code in cert
> config
>   NetworkPkg/HttpDxe: sanity-check the TlsCaCertificate variable before
> use
>   NetworkPkg/TlsAuthConfigDxe: preserve TlsCaCertificate variable
> attributes
> 
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.c  |  4 +-
>  NetworkPkg/HttpDxe/HttpDxe.inf  |  3 +-
>  NetworkPkg/HttpDxe/HttpsSupport.c   | 74 ++--
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 15 ++--
>  4 files changed, 80 insertions(+), 16 deletions(-)
> 
> --
> 2.14.1.3.gb7cf6e02401b

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


Re: [edk2] internal structure of EFI_TLS_CA_CERTIFICATE_VARIABLE

2018-03-27 Thread Zeng, Star
Is there a PCD pointers to the siglist?


For adding PcdMaxVolatileVariableSize: non-authenticated, volatile, I think it 
is acceptable if there are use cases.


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Wednesday, March 28, 2018 10:32 AM
To: Fu, Siyuan ; Wu, Jiaxin 
Cc: edk2-devel-01 ; Daniel P. Berrange 
; Zeng, Star 
Subject: Re: [edk2] internal structure of EFI_TLS_CA_CERTIFICATE_VARIABLE

Hi,

On 03/21/18 02:30, Fu, Siyuan wrote:
> Hi, Laszlo
>
> The data structure of EFI_TLS_CA_CERTIFICATE_VARIABLE is 
> EFI_SIGNATURE_LIST and we have documented this in HTTPs Boot wiki
> page:
> https://github.com/tianocore/tianocore.github.io/wiki/HTTPS-Boot
>
> You can refer section 31.4.1 "Signature Database" in UEFI 2.7 A for a 
> detail description of EFI_SIGNATURE_LIST structure.

I implemented a "p11-kit" extractor so that it produces a sequence of 
EFI_SIGNATURE_LIST objects, each siglist containing a single EFI_SIGNATURE_DATA 
object (with an X509 CA certificate in it).

In order to test that, I started writing the OVMF enablement patches, on top of 
the following series (pending review):

  [edk2] [PATCH 0/5] NetworkPkg: HTTP and TLS updates

In the OVMF platform code, I created EFI_TLS_CA_CERTIFICATE_VARIABLE as a 
*volatile* and boot-service only variable, so that there would be no flash 
impact, regardless of the number and size of the certificates that the 
extractor produced.

Unfortunately, I still ran into a limitation here. The EFI_SIGNATURE_LIST 
bundle produced by the extractor is 182 KB in size (it comes from the Mozilla 
CA root certificate bundle, aka the "ca-certificates" package). In order to 
create such a large variable, I had to raise the following two PCDs for OVMF:

- PcdVariableStoreSize: this controls the cumulative storage size for
  *volatile* variables.

- PcdMaxVariableSize: this limits the individual variable size for
  non-authenticated variables, *regardless* of their volatility.

I set PcdMaxVariableSize to 256KB (to accommodate the 182KB size mentioned 
above, and to leave a bit of margin). I set PcdVariableStoreSize to 512KB (so 
that there would be quite a bit of volatile space left after a 256KB volatile 
variable was created).

And this is where the variable driver runs into an assertion failure:

> ASSERT MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c(3809):
> GetNonVolatileMaxVariableSize () < (VariableStoreLength - sizeof
> (VARIABLE_STORE_HEADER))

The GetNonVolatileMaxVariableSize() function calculates the maximum of 
PcdMaxVariableSize and PcdMaxAuthVariableSize. This is not good because I 
didn't mean to raise PcdMaxVariableSize for non-volatile purposes; I only meant 
to raise it for volatile storage.

Then the InitNonVolatileVariableStore() function attempts to fit this maximum 
into the *flash* storage. Obviously, individual 256KB variables (which I never 
meant to place into flash) don't fit into flash, and the
ASSERT() fires.

The issue is that the variable driver does not distinguish the max variable 
size between volatile and non-volatile storage, and the non-volatile 
availability effectively limits the volatile one.

I think we should have three PCDs:

- PcdMaxVariableSize: non-authenticated, non-volatile
- PcdMaxAuthVariableSize: authenticated, non-volatile
- PcdMaxVolatileVariableSize: non-authenticated, volatile

(The fourth variation needs no PCD because authenticated volatile variables 
make no sense.)

How can we solve this?

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


Re: [edk2] [PATCH v1 1/1] BaseTools: refactor repeated RegExp when no special searching is needed.

2018-03-27 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Tuesday, March 27, 2018 8:33 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v1 1/1] BaseTools: refactor repeated RegExp when no special 
searching is needed.

use str.replace and try/except.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Expression.py | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index 4f0f377f3788..b7500bff9051 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -938,12 +938,13 @@ class ValueExpressionEx(ValueExpression):
 OffsetList = ReOffset.findall(Item)
 except:
 pass
+# replace each offset, except errors
 for Offset in OffsetList:
-if Offset in LabelDict.keys():
-Re = re.compile('OFFSET_OF\(%s\)' % Offset)
-Item = Re.sub(LabelDict[Offset], Item)
-else:
+try:
+Item = 
Item.replace('OFFSET_OF({})'.format(Offset),LabelDict[Offset])
+except:
 raise BadExpression('%s not defined' % 
Offset)
+
 NewPcdValueList.append(Item)
 
 AllPcdValueList = []
-- 
2.16.2.windows.1

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


Re: [edk2] internal structure of EFI_TLS_CA_CERTIFICATE_VARIABLE

2018-03-27 Thread Laszlo Ersek
Hi,

On 03/21/18 02:30, Fu, Siyuan wrote:
> Hi, Laszlo
>
> The data structure of EFI_TLS_CA_CERTIFICATE_VARIABLE is
> EFI_SIGNATURE_LIST and we have documented this in HTTPs Boot wiki
> page:
> https://github.com/tianocore/tianocore.github.io/wiki/HTTPS-Boot
>
> You can refer section 31.4.1 "Signature Database" in UEFI 2.7 A for a
> detail description of EFI_SIGNATURE_LIST structure.

I implemented a "p11-kit" extractor so that it produces a sequence of
EFI_SIGNATURE_LIST objects, each siglist containing a single
EFI_SIGNATURE_DATA object (with an X509 CA certificate in it).

In order to test that, I started writing the OVMF enablement patches, on
top of the following series (pending review):

  [edk2] [PATCH 0/5] NetworkPkg: HTTP and TLS updates

In the OVMF platform code, I created EFI_TLS_CA_CERTIFICATE_VARIABLE as
a *volatile* and boot-service only variable, so that there would be no
flash impact, regardless of the number and size of the certificates that
the extractor produced.

Unfortunately, I still ran into a limitation here. The
EFI_SIGNATURE_LIST bundle produced by the extractor is 182 KB in size
(it comes from the Mozilla CA root certificate bundle, aka the
"ca-certificates" package). In order to create such a large variable, I
had to raise the following two PCDs for OVMF:

- PcdVariableStoreSize: this controls the cumulative storage size for
  *volatile* variables.

- PcdMaxVariableSize: this limits the individual variable size for
  non-authenticated variables, *regardless* of their volatility.

I set PcdMaxVariableSize to 256KB (to accommodate the 182KB size
mentioned above, and to leave a bit of margin). I set
PcdVariableStoreSize to 512KB (so that there would be quite a bit of
volatile space left after a 256KB volatile variable was created).

And this is where the variable driver runs into an assertion failure:

> ASSERT MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c(3809):
> GetNonVolatileMaxVariableSize () < (VariableStoreLength - sizeof
> (VARIABLE_STORE_HEADER))

The GetNonVolatileMaxVariableSize() function calculates the maximum of
PcdMaxVariableSize and PcdMaxAuthVariableSize. This is not good because
I didn't mean to raise PcdMaxVariableSize for non-volatile purposes; I
only meant to raise it for volatile storage.

Then the InitNonVolatileVariableStore() function attempts to fit this
maximum into the *flash* storage. Obviously, individual 256KB variables
(which I never meant to place into flash) don't fit into flash, and the
ASSERT() fires.

The issue is that the variable driver does not distinguish the max
variable size between volatile and non-volatile storage, and the
non-volatile availability effectively limits the volatile one.

I think we should have three PCDs:

- PcdMaxVariableSize: non-authenticated, non-volatile
- PcdMaxAuthVariableSize: authenticated, non-volatile
- PcdMaxVolatileVariableSize: non-authenticated, volatile

(The fourth variation needs no PCD because authenticated volatile
variables make no sense.)

How can we solve this?

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


Re: [edk2] [PATCH v1 1/4] BaseTools: remove irrelevant code

2018-03-27 Thread Zhu, Yonghong
Hi Jaben,

Current we support flexible PCD value format, example:  UINT64 type PCD can use 
{0x1, 2, 'A', UINT16(10), "B"} as its value, so the block can't be removed 
since it maybe a list after SplitPcdValueString function.
https://bugzilla.tianocore.org/show_bug.cgi?id=541 is the feature request for 
flexible Pcd value format.

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Wednesday, March 28, 2018 7:43 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v1 1/4] BaseTools: remove irrelevant code

Since PcdValue is a string, no need to test it's type() for string Also remove 
the block used if it's a list (which is never is)

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Expression.py | 55 ++--
 1 file changed, 5 insertions(+), 50 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index 4f0f377f3788..b70f7da1233e 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -815,57 +815,12 @@ class ValueExpressionEx(ValueExpression):
 except BadExpression, Value:
 if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
 PcdValue = PcdValue.strip()
-if type(PcdValue) == type('') and PcdValue.startswith('{') and 
PcdValue.endswith('}'):
+if PcdValue.startswith('{') and PcdValue.endswith('}'):
 PcdValue = SplitPcdValueString(PcdValue[1:-1])
-if type(PcdValue) == type([]):
-TmpValue = 0
-Size = 0
-ValueType = ''
-for Item in PcdValue:
-Item = Item.strip()
-if Item.startswith('UINT8'):
-ItemSize = 1
-ValueType = 'UINT8'
-elif Item.startswith('UINT16'):
-ItemSize = 2
-ValueType = 'UINT16'
-elif Item.startswith('UINT32'):
-ItemSize = 4
-ValueType = 'UINT32'
-elif Item.startswith('UINT64'):
-ItemSize = 8
-ValueType = 'UINT64'
-elif Item.startswith('"') or Item.startswith("'") or 
Item.startswith('L'):
-ItemSize = 0
-ValueType = 'VOID*'
-else:
-ItemSize = 0
-ValueType = 'UINT8'
-Item = ValueExpressionEx(Item, ValueType, 
self._Symb)(True)
-
-if ItemSize == 0:
-try:
-tmpValue = int(Item, 16) if 
Item.upper().startswith('0X') else int(Item, 0)
-if tmpValue > 255:
-raise BadExpression("Byte  array number %s 
should less than 0xFF." % Item)
-except BadExpression, Value:
-raise BadExpression(Value)
-except ValueError:
-pass
-ItemValue, ItemSize = ParseFieldValue(Item)
-else:
-ItemValue = ParseFieldValue(Item)[0]
-
-if type(ItemValue) == type(''):
-ItemValue = int(ItemValue, 16) if 
ItemValue.startswith('0x') else int(ItemValue)
-
-TmpValue = (ItemValue << (Size * 8)) | TmpValue
-Size = Size + ItemSize
-else:
-try:
-TmpValue, Size = ParseFieldValue(PcdValue)
-except BadExpression, Value:
-raise BadExpression("Type: %s, Value: %s, %s" % 
(self.PcdType, PcdValue, Value))
+try:
+TmpValue, Size = ParseFieldValue(PcdValue)
+except BadExpression, Value:
+raise BadExpression("Type: %s, Value: %s, %s" % 
+ (self.PcdType, PcdValue, Value))
 if type(TmpValue) == type(''):
 try:
 TmpValue = int(TmpValue)
--
2.16.2.windows.1

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


Re: [edk2] [Patch V2] BaseTools/BinToPcd: Add support for multiple binary input files

2018-03-27 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Kinney, Michael D 
Sent: Thursday, March 22, 2018 6:54 AM
To: edk2-devel@lists.01.org
Cc: Kinney, Michael D ; Sean Brogan 
; Zhu, Yonghong ; Gao, 
Liming 
Subject: [Patch V2] BaseTools/BinToPcd: Add support for multiple binary input 
files

From: "Kinney, Michael D" 

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

There are use cases where a VOID * PCD needs to be generated from multiple 
binary input files.  This can be in the form of an array of fixed size elements 
or a set of variable sized elements.

Update BinToPcd to support multiple one or more -i INPUTFILE arguments.
By default, the contents of each binary input file are concatenated in the 
order provided.  This supports generating a PCD that is an array of fixed size 
elements

Add -x, --xdr flags to BinToPcd  to encodes the PCD using the Variable-Length 
Opaque Data of RFC 4506 External Data Representation Standard (XDR).

https://tools.ietf.org/html/rfc4506
https://tools.ietf.org/html/rfc4506#section-4.10

The data format from RFC 4506 meets the requirements for a PCD that is a set of 
variable sized elements in the Variable-Length Opaque Data format.
The overhead of this format is a 32-bit length and 0 to 3 bytes of padding to 
align the next element at a 32-bit boundary.

Cc: Sean Brogan 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/BinToPcd.py | 83 ---
 1 file changed, 54 insertions(+), 29 deletions(-)

diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py 
index 68a7ac652d..f2485a27fa 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -1,7 +1,7 @@
 ## @file
 # Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
 #
-# 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 @@ 
-18,14 +18,15 @@ BinToPcd  import sys  import argparse  import re
+import xdrlib
 
 #
 # Globals for help information
 #
 __prog__= 'BinToPcd'
-__version__ = '%s Version %s' % (__prog__, '0.9 ')
-__copyright__   = 'Copyright (c) 2016, Intel Corporation. All rights reserved.'
-__description__ = 'Convert a binary file to a VOID* PCD value or DSC file 
VOID* PCD statement.\n'
+__version__ = '%s Version %s' % (__prog__, '0.91 ')
+__copyright__   = 'Copyright (c) 2016 - 2018, Intel Corporation. All rights 
reserved.'
+__description__ = 'Convert one or more binary files to a VOID* PCD value or 
DSC file VOID* PCD statement.\n'
 
 if __name__ == '__main__':
   def ValidateUnsignedInteger (Argument):
@@ -50,21 +51,35 @@ if __name__ == '__main__':
   Message = '%s is not a valid GUID C name' % (Argument)
   raise argparse.ArgumentTypeError(Message)
 return Argument
-
-  def ByteArray (Buffer):
+
+  def ByteArray (Buffer, Xdr = False):
+if Xdr:
+  #
+  # If Xdr flag is set then encode data using the Variable-Length Opaque
+  # Data format of RFC 4506 External Data Representation Standard (XDR).
+  #
+  XdrEncoder = xdrlib.Packer()
+  for Item in Buffer:
+XdrEncoder.pack_bytes(Item)
+  Buffer = XdrEncoder.get_buffer()
+else:
+  #
+  # If Xdr flag is not set, then concatenate all the data
+  #
+  Buffer = ''.join(Buffer)
 #
-# Append byte array of values of the form '{0x01, 0x02, ...}'
+# Return a PCD value of the form '{0x01, 0x02, ...}' along with the 
+ PCD length in bytes
 #
-return '{%s}' % (', '.join(['0x%02x' % (ord(Item)) for Item in Buffer]))
-
+return '{%s}' % (', '.join(['0x%02x' % (ord(Item)) for Item in 
+ Buffer])), len (Buffer)
+
   #
   # Create command line argument parser object
   #
   parser = argparse.ArgumentParser(prog = __prog__, version = __version__,
description = __description__ + 
__copyright__,
conflict_handler = 'resolve')
-  parser.add_argument("-i", "--input", dest = 'InputFile', type = 
argparse.FileType('rb'),
-  help = "Input binary filename", required = True)
+  parser.add_argument("-i", "--input", dest = 'InputFile', type = 
argparse.FileType('rb'), action='append', required = True,
+  help = "Input binary filename.  Multiple input 
+ files are combined into a 

Re: [edk2] [PATCH edk2-platforms 00/12] Hisilicon/D0x: Switch to generic PciHostBridge

2018-03-27 Thread Guo Heyi
Hi Leif, Ard,

Any comments for this series of patches?

Thanks,
Heyi

On Wed, Mar 21, 2018 at 09:03:06AM +0800, Heyi Guo wrote:
> For BAR address translation support was added to edk2 generic PciHostBridge by
> commit 74d0a33, now we can also use it for D03/D05 platforms.
> This series of patches include 3 parts of change:
> - Preparation for the switch, moving platform specific code out of 
> PciHostBridge
>   driver.
> - Add depending libraries and protocol implementations, like PciHostBridgeLib,
>   PciSegmentLib and CpuIo2 Protocol.
> - Other enhancement and refinement.
> 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Haojian Zhuang 
> 
> Heyi Guo (12):
>   Hisilicon: Enable WARN and INFO debug message
>   Hisilicon/D05/PlatformPciLib: fix misuse of macro
>   Hisilicon/Pci: move ATU configuration to PcieInitDxe
>   Hisilicon/Pci: Merge PciPlatform into PcieInit Driver
>   Hisilicon/Pci: Move EnlargeAtuConfig0() to PcieInitDxe
>   Hisilicon/PlatformPciLib: add segment for each root bridge
>   Hisilicon: add PciHostBridgeLib
>   Hisilicon: add PciCpuIo2Dxe
>   Hisilicon: add PciSegmentLib for Hi161x
>   Hisilicon/D0x: Switch to generic PciHostBridge driver
>   Hisilicon: remove platform specific PciHostBridge
>   Hisilicon/PlatformPciLib: clear redundant felds in RESOURCE_APPETURE
> 
>  Silicon/Hisilicon/Hisilicon.dsc.inc  
>|8 +-
>  Platform/Hisilicon/D03/D03.dsc   
>|7 +-
>  Platform/Hisilicon/D05/D05.dsc   
>|7 +-
>  Platform/Hisilicon/D03/D03.fdf   
>|4 +-
>  Platform/Hisilicon/D05/D05.fdf   
>|4 +-
>  Platform/Hisilicon/D03/Drivers/PciPlatform/PciPlatform.inf   
>|   53 -
>  Platform/Hisilicon/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
>|   51 +
>  Silicon/Hisilicon/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
>|   48 +
>  Silicon/Hisilicon/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf  
>|   74 -
>  Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitDxe.inf
>|9 +-
>  Silicon/Hisilicon/Hi1610/Library/Hi161xPciSegmentLib/Hi161xPciSegmentLib.inf 
>|   36 +
>  Silicon/Hisilicon/Drivers/PciHostBridgeDxe/PciHostBridge.h   
>|  528 -
>  {Platform/Hisilicon/D03/Drivers/PciPlatform => 
> Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610}/PciPlatform.h |0
>  Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitLib.h  
>|   13 +
>  Silicon/Hisilicon/Include/Library/PlatformPciLib.h   
>|3 +-
>  Platform/Hisilicon/D03/Library/PlatformPciLib/PlatformPciLib.c   
>|   24 +-
>  Platform/Hisilicon/D05/Library/PlatformPciLib/PlatformPciLib.c   
>|   66 +-
>  Platform/Hisilicon/Library/PciHostBridgeLib/PciHostBridgeLib.c   
>|  304 +++
>  Silicon/Hisilicon/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.c  
>|  557 +
>  Silicon/Hisilicon/Drivers/PciHostBridgeDxe/PciHostBridge.c   
>| 1659 --
>  Silicon/Hisilicon/Drivers/PciHostBridgeDxe/PciRootBridgeIo.c 
>| 2404 
>  {Platform/Hisilicon/D03/Drivers/PciPlatform => 
> Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610}/PciPlatform.c |   12 +
>  Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInit.c 
>|7 +-
>  Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitAtu.c  
>|  309 +++
>  Silicon/Hisilicon/Hi1610/Library/Hi161xPciSegmentLib/PciSegmentLib.c 
>| 1503 
>  25 files changed, 2897 insertions(+), 4793 deletions(-)
>  delete mode 100644 Platform/Hisilicon/D03/Drivers/PciPlatform/PciPlatform.inf
>  create mode 100644 
> Platform/Hisilicon/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>  create mode 100644 
> Silicon/Hisilicon/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
>  delete mode 100644 
> Silicon/Hisilicon/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf
>  create 

[edk2] [Patch] BaseTools: Fix two cases that use GUID CName as PCD Value

2018-03-27 Thread Yonghong Zhu
1. use CName format in components section:
  [Components]
   TestPkg/TestDriver.inf {
 
  PcdToken.PcdName |{GUID(TestGuid)}|VOID*|16
  }

2. Use Guid CName format in INF and the Guid is defined in the DEC
file but not write in driver's [Guids] section.
PcdToken.PcdName  | {GUID(TestGuid)}

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 9 +++--
 BaseTools/Source/Python/Workspace/InfBuildData.py | 1 +
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 95e3e91..0057839 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -395,16 +395,12 @@ class WorkspaceAutoGen(AutoGen):
 self.CapTargetList = []
 
 # apply SKU and inject PCDs from Flash Definition file
 for Arch in self.ArchList:
 Platform = self.BuildDatabase[self.MetaFile, Arch, Target, 
Toolchain]
-
-
-
-
-
-
+PlatformPcds = Platform.Pcds
+self._GuidDict = Platform._GuidDict
 SourcePcdDict = {'DynamicEx':[], 
'PatchableInModule':[],'Dynamic':[],'FixedAtBuild':[]}
 BinaryPcdDict = {'DynamicEx':[], 'PatchableInModule':[]}
 SourcePcdDict_Keys = SourcePcdDict.keys()
 BinaryPcdDict_Keys = BinaryPcdDict.keys()
 
@@ -2797,10 +2793,11 @@ class ModuleAutoGen(AutoGen):
 EdkLogger.debug(EdkLogger.DEBUG_9, "AutoGen module [%s] [%s]" % 
(ModuleFile, Arch))
 GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (ModuleFile, Arch, 
Toolchain, Target)
 
 self.Workspace = Workspace
 self.WorkspaceDir = Workspace.WorkspaceDir
+self._GuidDict = Workspace._GuidDict
 
 self.MetaFile = ModuleFile
 self.PlatformInfo = PlatformAutoGen(Workspace, PlatformFile, Target, 
Toolchain, Arch)
 # check if this module is employed by active platform
 if not self.PlatformInfo.ValidModule(self.MetaFile):
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 7ea9b56..7e1b8ba 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -1054,10 +1054,11 @@ class InfBuildData(ModuleBuildClassObject):
 # if platform doesn't give its type, use 'lowest' one in the
 # following order, if any
 #
 #   "FixedAtBuild", "PatchableInModule", "FeatureFlag", 
"Dynamic", "DynamicEx"
 #
+self.Guids.update(Package.Guids)
 PcdType = self._PCD_TYPE_STRING_[Type]
 if Type == MODEL_PCD_DYNAMIC:
 Pcd.Pending = True
 for T in ["FixedAtBuild", "PatchableInModule", 
"FeatureFlag", "Dynamic", "DynamicEx"]:
 if (PcdRealName, TokenSpaceGuid) in 
GlobalData.MixedPcd:
-- 
2.6.1.windows.1

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


[edk2] [PATCH v1 3/4] BaseTools: move regular expression compile out of function call.

2018-03-27 Thread Jaben Carsey
move to the root of the file and dont recompile.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Expression.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index 3f2b43118553..340c50ebe00f 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -41,6 +41,8 @@ ERR_EMPTY_EXPR  = 'Empty expression is not allowed.'
 ERR_IN_OPERAND  = 'Macro after IN operator can only be: $(FAMILY), 
$(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).'
 
 __ValidString = re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$')
+_ReLabel = re.compile('LABEL\((\w+)\)')
+_ReOffset = re.compile('OFFSET_OF\((\w+)\)')
 
 ## SplitString
 #  Split string to list according double quote
@@ -853,13 +855,11 @@ class ValueExpressionEx(ValueExpression):
 PcdValueList = 
SplitPcdValueString(PcdValue.strip()[1:-1])
 LabelDict = {}
 NewPcdValueList = []
-ReLabel = re.compile('LABEL\((\w+)\)')
-ReOffset = re.compile('OFFSET_OF\((\w+)\)')
 LabelOffset = 0
 for Index, Item in enumerate(PcdValueList):
 # compute byte offset of every LABEL
-LabelList = ReLabel.findall(Item)
-Item = ReLabel.sub('', Item)
+LabelList = _ReLabel.findall(Item)
+Item = _ReLabel.sub('', Item)
 Item = Item.strip()
 if LabelList:
 for Label in LabelList:
@@ -886,11 +886,11 @@ class ValueExpressionEx(ValueExpression):
 # for LABEL parse
 Item = Item.strip()
 try:
-Item = ReLabel.sub('', Item)
+Item = _ReLabel.sub('', Item)
 except:
 pass
 try:
-OffsetList = ReOffset.findall(Item)
+OffsetList = _ReOffset.findall(Item)
 except:
 pass
 for Offset in OffsetList:
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 1/4] BaseTools: remove irrelevant code

2018-03-27 Thread Jaben Carsey
Since PcdValue is a string, no need to test it's type() for string
Also remove the block used if it's a list (which is never is)

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Expression.py | 55 ++--
 1 file changed, 5 insertions(+), 50 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index 4f0f377f3788..b70f7da1233e 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -815,57 +815,12 @@ class ValueExpressionEx(ValueExpression):
 except BadExpression, Value:
 if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
 PcdValue = PcdValue.strip()
-if type(PcdValue) == type('') and PcdValue.startswith('{') and 
PcdValue.endswith('}'):
+if PcdValue.startswith('{') and PcdValue.endswith('}'):
 PcdValue = SplitPcdValueString(PcdValue[1:-1])
-if type(PcdValue) == type([]):
-TmpValue = 0
-Size = 0
-ValueType = ''
-for Item in PcdValue:
-Item = Item.strip()
-if Item.startswith('UINT8'):
-ItemSize = 1
-ValueType = 'UINT8'
-elif Item.startswith('UINT16'):
-ItemSize = 2
-ValueType = 'UINT16'
-elif Item.startswith('UINT32'):
-ItemSize = 4
-ValueType = 'UINT32'
-elif Item.startswith('UINT64'):
-ItemSize = 8
-ValueType = 'UINT64'
-elif Item.startswith('"') or Item.startswith("'") or 
Item.startswith('L'):
-ItemSize = 0
-ValueType = 'VOID*'
-else:
-ItemSize = 0
-ValueType = 'UINT8'
-Item = ValueExpressionEx(Item, ValueType, 
self._Symb)(True)
-
-if ItemSize == 0:
-try:
-tmpValue = int(Item, 16) if 
Item.upper().startswith('0X') else int(Item, 0)
-if tmpValue > 255:
-raise BadExpression("Byte  array number %s 
should less than 0xFF." % Item)
-except BadExpression, Value:
-raise BadExpression(Value)
-except ValueError:
-pass
-ItemValue, ItemSize = ParseFieldValue(Item)
-else:
-ItemValue = ParseFieldValue(Item)[0]
-
-if type(ItemValue) == type(''):
-ItemValue = int(ItemValue, 16) if 
ItemValue.startswith('0x') else int(ItemValue)
-
-TmpValue = (ItemValue << (Size * 8)) | TmpValue
-Size = Size + ItemSize
-else:
-try:
-TmpValue, Size = ParseFieldValue(PcdValue)
-except BadExpression, Value:
-raise BadExpression("Type: %s, Value: %s, %s" % 
(self.PcdType, PcdValue, Value))
+try:
+TmpValue, Size = ParseFieldValue(PcdValue)
+except BadExpression, Value:
+raise BadExpression("Type: %s, Value: %s, %s" % 
(self.PcdType, PcdValue, Value))
 if type(TmpValue) == type(''):
 try:
 TmpValue = int(TmpValue)
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 0/4] BaseTools: remove code without affect

2018-03-27 Thread Jaben Carsey
this is a refactoring of the code to make it more readable and less wasteful

*** BLURB HERE ***

Jaben Carsey (4):
  BaseTools: remove irrelevant code
  BaseTools: expression can use single in instead of 3 API calls.
  BaseTools: move regular expression compile out of function call.
  BaseTools: dont use enumerate when un-needed

 BaseTools/Source/Python/Common/Expression.py | 73 

 BaseTools/Source/Python/Common/Misc.py   |  2 +-
 BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py |  2 +-
 3 files changed, 16 insertions(+), 61 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 v1 2/4] BaseTools: expression can use single in instead of 3 API calls.

2018-03-27 Thread Jaben Carsey
change 3 StartsWith() calls to a single 'in' operation.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Expression.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index b70f7da1233e..3f2b43118553 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -948,7 +948,7 @@ class ValueExpressionEx(ValueExpression):
 Item = '0x%x' % TmpValue if type(TmpValue) != 
type('') else TmpValue
 if ItemSize == 0:
 ItemValue, ItemSize = ParseFieldValue(Item)
-if not (Item.startswith('"') or 
Item.startswith('L') or Item.startswith('{')) and ItemSize > 1:
+if Item[0] not in ['"','L','{'] and 
ItemSize > 1:
 raise BadExpression("Byte  array 
number %s should less than 0xFF." % Item)
 else:
 ItemValue = ParseFieldValue(Item)[0]
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 4/4] BaseTools: dont use enumerate when un-needed

2018-03-27 Thread Jaben Carsey
Since we only use the item from the list and not the numeric value,
dont bother with enumerate()

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Expression.py | 4 ++--
 BaseTools/Source/Python/Common/Misc.py   | 2 +-
 BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index 340c50ebe00f..f28d770aad94 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -856,7 +856,7 @@ class ValueExpressionEx(ValueExpression):
 LabelDict = {}
 NewPcdValueList = []
 LabelOffset = 0
-for Index, Item in enumerate(PcdValueList):
+for Item in PcdValueList:
 # compute byte offset of every LABEL
 LabelList = _ReLabel.findall(Item)
 Item = _ReLabel.sub('', Item)
@@ -882,7 +882,7 @@ class ValueExpressionEx(ValueExpression):
 except:
 LabelOffset = LabelOffset + 1
 
-for Index, Item in enumerate(PcdValueList):
+for Item in PcdValueList:
 # for LABEL parse
 Item = Item.strip()
 try:
diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 7d44fdcf8ba7..8f479ace4cb1 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -76,7 +76,7 @@ def GetVariableOffset(mapfilepath, efifilepath, varnames):
 def _parseForXcode(lines, efifilepath, varnames):
 status = 0
 ret = []
-for index, line in enumerate(lines):
+for line in lines:
 line = line.strip()
 if status == 0 and line == "# Symbols:":
 status = 1
diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py 
b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
index fdad5a44dc3d..0a701158e2c2 100644
--- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
+++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -65,7 +65,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
 def _parseForXcode(lines, efifilepath):
 status = 0
 pcds = []
-for index, line in enumerate(lines):
+for line in lines:
 line = line.strip()
 if status == 0 and line == "# Symbols:":
 status = 1
-- 
2.16.2.windows.1

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


Re: [edk2] [Patch] BaseTools: Update Rsa2048Sha256Sign to use openssl dgst option

2018-03-27 Thread Long, Qin
Reviewed-by: Long Qin 

Best Regards & Thanks,
LONG, Qin

-Original Message-
From: Gao, Liming 
Sent: Tuesday, March 27, 2018 8:59 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Long, Qin 
Subject: [Patch] BaseTools: Update Rsa2048Sha256Sign to use openssl dgst option

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
Cc: Qin Long 
---
 BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py 
b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index 4188f8e..d36a14f 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -4,7 +4,7 @@
 #   {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 
0xbf}}
 # This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013  # -# Copyright 
(c) 2013 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 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 @@ 
-176,7 +176,7 @@ if __name__ == '__main__':
 # 
 # Sign the input file using the specified private key and capture 
signature from STDOUT
 #
-Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
+Process = subprocess.Popen('%s dgst -sha256 -sign "%s"' % 
+ (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, 
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
 Signature = Process.communicate(input=FullInputFileBuffer)[0]
 if Process.returncode <> 0:
   sys.exit(Process.returncode)
@@ -225,7 +225,7 @@ if __name__ == '__main__':
 #
 # Verify signature
 #
-Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -signature %s' 
% (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
+Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" 
+ -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, 
+ args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
+ stderr=subprocess.PIPE, shell=True)
 Process.communicate(input=FullInputFileBuffer)
 if Process.returncode <> 0:
   print 'ERROR: Verification failed'
--
2.8.0.windows.1

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


[edk2] [Patch] BaseTools: Update Rsa2048Sha256Sign to use openssl dgst option

2018-03-27 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
Cc: Qin Long 
---
 BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py 
b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index 4188f8e..d36a14f 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -4,7 +4,7 @@
 #   {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 
0xbf}}
 # This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
 #
-# Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 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
@@ -176,7 +176,7 @@ if __name__ == '__main__':
 # 
 # Sign the input file using the specified private key and capture 
signature from STDOUT
 #
-Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
+Process = subprocess.Popen('%s dgst -sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
 Signature = Process.communicate(input=FullInputFileBuffer)[0]
 if Process.returncode <> 0:
   sys.exit(Process.returncode)
@@ -225,7 +225,7 @@ if __name__ == '__main__':
 #
 # Verify signature
 #
-Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -signature %s' 
% (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
+Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" -signature %s' 
% (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
 Process.communicate(input=FullInputFileBuffer)
 if Process.returncode <> 0:
   print 'ERROR: Verification failed'
-- 
2.8.0.windows.1

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


Re: [edk2] How to make a memory mapped to FV ffs efi program?

2018-03-27 Thread Laszlo Ersek
On 03/27/18 13:43, david moheban wrote:

> I was just curious on how certain firmware packages take a Efi Shell
> and make it available to boot from the F8 or F11 (or whatever) boot
> menu. I suppose to make your own you have to write a dxe driver that
> adds the location via guid to the boot menu?

Almost. In edk2 platforms, the agent that does this is usually not a
separate DXE driver, but the given platform's PlatformBootManagerLib
instance, which is linked into, and called from, BdsDxe.

For two examples, please see PlatformRegisterFvBootOption() in:

- ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
- OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

A related function is RemoveStaleFvFileOptions(), in both.

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


[edk2] How to make a memory mapped to FV ffs efi program?

2018-03-27 Thread david moheban
Some months back I played around with the Simple File System code examples
in the Edk2 package and am familiar sort of on how it works. I was just
curious on how certain firmware packages take a Efi Shell and make it
available to boot from the F8 or F11 (or whatever) boot menu. I suppose to
make your own you have to write a dxe driver that adds the location via
guid to the boot menu?

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


Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl standard options

2018-03-27 Thread Liao, Jui-pengX
Hi all,
The "openssl dgst -sha256" is working as well.

[configuration]
Xcode 9
Openssl 0.9.8zh 14 Jan 2016

Best regards
George Liao
-Original Message-
From: Gao, Liming 
Sent: Tuesday, March 27, 2018 4:49 PM
To: Long, Qin ; Zhu, Yonghong ; 
edk2-devel@lists.01.org
Cc: Kinney, Michael D ; Liao, Jui-pengX 

Subject: RE: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl 
standard options

Qin:
  Thanks for your suggestion. It also work. I agree this style is better. 

Thanks
Liming
>-Original Message-
>From: Long, Qin
>Sent: Tuesday, March 27, 2018 4:33 PM
>To: Zhu, Yonghong ; Gao, Liming 
>; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Liao, Jui-pengX 
>
>Subject: RE: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use 
>openssl standard options
>
>This ("sha1 -sha256") looks a little odd.
>Could we try "openssl dgst -sha256 "?
>
>
>Best Regards & Thanks,
>LONG, Qin
>
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
>Zhu, Yonghong
>Sent: Tuesday, March 27, 2018 3:56 PM
>To: Gao, Liming ; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Liao, Jui-pengX 
>
>Subject: Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to 
>use openssl standard options
>
>Reviewed-by: Yonghong Zhu 
>
>Best Regards,
>Zhu Yonghong
>
>
>-Original Message-
>From: Gao, Liming
>Sent: Tuesday, March 27, 2018 1:48 PM
>To: edk2-devel@lists.01.org
>Cc: Liao, Jui-pengX ; Kinney, Michael D 
>; Zhu, Yonghong 
>Subject: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl 
>standard options
>
>sha256 is not the standard option. It should be replaced by sha -sha256.
>Otherwise, it doesn't work in MAC OS.
>
>In V2, update the option to sha1 -sha256.
>In late openssl version >= 1.1, there is no sha option, but has sha1,sha256.
>In previous openssl version < 1.1, there is no sha256, but has sha,sha1.
>To work with all openssl version, use sha1 -sha256 for it.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Liao Jui-peng 
>Signed-off-by: Liming Gao 
>Cc: Michael Kinney 
>Cc: Yonghong Zhu 
>---
> BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 4 
>++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git
>a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>index 1ae6ebb..4188f8e 100644
>--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>@@ -176,7 +176,7 @@ if __name__ == '__main__':
> #
> # Sign the input file using the specified private key and capture 
>signature from STDOUT
> #
>-Process = subprocess.Popen('%s sha256 -sign "%s"' % (OpenSslCommand,
>args.PrivateKeyFileName), stdin=subprocess.PIPE, 
>stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
>+Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' %
>(OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, 
>stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
> Signature = Process.communicate(input=FullInputFileBuffer)[0]
> if Process.returncode <> 0:
>   sys.exit(Process.returncode)
>@@ -225,7 +225,7 @@ if __name__ == '__main__':
> #
> # Verify signature
> #
>-Process = subprocess.Popen('%s sha256 -prverify "%s" -signature %s' %
>(OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
>stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
>shell=True)
>+Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -
>signature %s' % (OpenSslCommand, args.PrivateKeyFileName, 
>args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
>stderr=subprocess.PIPE, shell=True)
> Process.communicate(input=FullInputFileBuffer)
> if Process.returncode <> 0:
>   print 'ERROR: Verification failed'
>--
>2.8.0.windows.1
>
>___
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/5] NetworkPkg: HTTP and TLS updates

2018-03-27 Thread Laszlo Ersek
Siyuan, Jiaxin,

do you have any comments please?

Thanks,
Laszlo

On 03/22/18 17:39, Laszlo Ersek wrote:
> Repo:   https://github.com/lersek/edk2.git
> Branch: http_and_tls_updates
> 
> Patch #4 fixes TianoCore BZ#909
> .
> 
> Patches #2 and #3 are cleanups / preparation for patch #4.
> 
> Patch #1 fixes an independent typo that I noticed in the code while
> configuring my DHCP server for HTTP(S) booting. It's isolated, so I put
> it first in the series.
> 
> Patch #5 is preparation for future platform enablement, so that a
> platform can create both "TlsCaCertificate" and "HttpTlsCipherList"
> variables on every boot from scratch as volatile variables (without
> flash varstore footprint).
> 
> I regression-tested this series with a successful HTTPS boot of an ISO
> image from OVMF, using a DER-formatted self-signed certificate that I
> enrolled with TlsAuthConfigDxe.
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (5):
>   NetworkPkg/HttpBootDxe: fix typo in DHCPv4 packet parsing
>   NetworkPkg/HttpDxe: use error handler epilogue in
> TlsConfigCertificate()
>   NetworkPkg/HttpDxe: drop misleading comment / status code in cert
> config
>   NetworkPkg/HttpDxe: sanity-check the TlsCaCertificate variable before
> use
>   NetworkPkg/TlsAuthConfigDxe: preserve TlsCaCertificate variable
> attributes
> 
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.c  |  4 +-
>  NetworkPkg/HttpDxe/HttpDxe.inf  |  3 +-
>  NetworkPkg/HttpDxe/HttpsSupport.c   | 74 ++--
>  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 15 ++--
>  4 files changed, 80 insertions(+), 16 deletions(-)
> 

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


Re: [edk2] Question regarding structure PCD

2018-03-27 Thread Laszlo Ersek
On 03/26/18 22:16, Kinney, Michael D wrote:
> Jeff,
> 
> You can provide default values for structure fields
> in the DEC file.
> 
> Liming has an example posted in the following branch:
> 
> https://github.com/lgao4/edk2/tree/UDK2018
> 
> DEC file example in TestPkg:
> 
> https://github.com/lgao4/edk2/blob/UDK2018/TestPkg/TestPkg.dec

Liming also posted a DEC spec (i.e. documentation) patch recently:

  [edk2] [Patch] DecSpecification: Add structure PCD definition syntax

It's upstream now and the rendered version can be seen here:

https://edk2-docs.gitbooks.io/edk-ii-dec-specification/content/3_edk_ii_dec_file_format/310_pcd_sections.html

https://edk2-docs.gitbooks.io/edk-ii-dec-specification/content/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.html

Laszlo

>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-
>> boun...@lists.01.org] On Behalf Of jbrasen.qdt
>> Sent: Monday, March 26, 2018 11:51 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] Question regarding structure PCD
>>
>> Hello,
>>
>>I was implementing support for PCDs in my platform
>> using the new structure PCD support, and I had a
>> question regarding this. Is it possible in the dec file
>> to define the default values of a PCD defined as a
>> structure using this format or just the byte array
>> format?
>>
>> Thanks,
>> Jeff Brasen
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 

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


Re: [edk2] How to make a memory mapped to FV ffs efi program?

2018-03-27 Thread Laszlo Ersek
On 03/27/18 07:28, Andrew Fish wrote:
> David,
> 
> I'm not sure what you are asking? Per UEFI Spec boot policy there are
> well know NVRAM variables that define boot policy. See UEFI Spec 3.3
> Globally Defined Variables. Look at BootOrder, BootNext, Boot etc.
> 
> The memory mapped volume part is tricky as there is not a concept of
> booting from a memory mapped volume. See "3.5 Boot Mechanisms" in the
> UEFI Spec.
> 
> If you loaded a RAM Disk driver that produced Simple File System then
> you could form boot from that. The PI spec also defines how to load
> something out of the FV, so it is also possible to boot from an FV via
> a device path, but that is not mentioned in the UEFI Spec, as the PI
> Spec is not required to implement UEFI.

edk2 also offers:

  MdeModulePkg/Universal/FvSimpleFileSystemDxe

(Please see "FvSimpleFileSystemDxe.inf" for a description -- "Its
primary intended use is to be able to start EFI applications embedded in
FVs from the UEFI shell".)

Thanks
Laszlo

>> On Mar 26, 2018, at 8:52 PM, david moheban  wrote:
>>
>> Hi,
>>
>> This question has always been very elusive despite hours of google
>> searching. Was wondering how it would be possible to convert an efi program
>> into a memory mapped volume that advertises itself onto your boot menu? For
>> example to convert shell.efi into a bootable item on my boot menu.
>>
>> Thank you
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 

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


Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl standard options

2018-03-27 Thread Gao, Liming
Qin:
  Thanks for your suggestion. It also work. I agree this style is better. 

Thanks
Liming
>-Original Message-
>From: Long, Qin
>Sent: Tuesday, March 27, 2018 4:33 PM
>To: Zhu, Yonghong ; Gao, Liming
>; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Liao, Jui-pengX pengx.l...@intel.com>
>Subject: RE: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl
>standard options
>
>This ("sha1 -sha256") looks a little odd.
>Could we try "openssl dgst -sha256 "?
>
>
>Best Regards & Thanks,
>LONG, Qin
>
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhu,
>Yonghong
>Sent: Tuesday, March 27, 2018 3:56 PM
>To: Gao, Liming ; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Liao, Jui-pengX pengx.l...@intel.com>
>Subject: Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use
>openssl standard options
>
>Reviewed-by: Yonghong Zhu 
>
>Best Regards,
>Zhu Yonghong
>
>
>-Original Message-
>From: Gao, Liming
>Sent: Tuesday, March 27, 2018 1:48 PM
>To: edk2-devel@lists.01.org
>Cc: Liao, Jui-pengX ; Kinney, Michael D
>; Zhu, Yonghong 
>Subject: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl
>standard options
>
>sha256 is not the standard option. It should be replaced by sha -sha256.
>Otherwise, it doesn't work in MAC OS.
>
>In V2, update the option to sha1 -sha256.
>In late openssl version >= 1.1, there is no sha option, but has sha1,sha256.
>In previous openssl version < 1.1, there is no sha256, but has sha,sha1.
>To work with all openssl version, use sha1 -sha256 for it.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Liao Jui-peng 
>Signed-off-by: Liming Gao 
>Cc: Michael Kinney 
>Cc: Yonghong Zhu 
>---
> BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git
>a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>index 1ae6ebb..4188f8e 100644
>--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
>@@ -176,7 +176,7 @@ if __name__ == '__main__':
> #
> # Sign the input file using the specified private key and capture 
> signature
>from STDOUT
> #
>-Process = subprocess.Popen('%s sha256 -sign "%s"' % (OpenSslCommand,
>args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE,
>stderr=subprocess.PIPE, shell=True)
>+Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' %
>(OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE,
>stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
> Signature = Process.communicate(input=FullInputFileBuffer)[0]
> if Process.returncode <> 0:
>   sys.exit(Process.returncode)
>@@ -225,7 +225,7 @@ if __name__ == '__main__':
> #
> # Verify signature
> #
>-Process = subprocess.Popen('%s sha256 -prverify "%s" -signature %s' %
>(OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName),
>stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
>shell=True)
>+Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -
>signature %s' % (OpenSslCommand, args.PrivateKeyFileName,
>args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE,
>stderr=subprocess.PIPE, shell=True)
> Process.communicate(input=FullInputFileBuffer)
> if Process.returncode <> 0:
>   print 'ERROR: Verification failed'
>--
>2.8.0.windows.1
>
>___
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl standard options

2018-03-27 Thread Long, Qin
This ("sha1 -sha256") looks a little odd. 
Could we try "openssl dgst -sha256 "?


Best Regards & Thanks,
LONG, Qin

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhu, 
Yonghong
Sent: Tuesday, March 27, 2018 3:56 PM
To: Gao, Liming ; edk2-devel@lists.01.org
Cc: Kinney, Michael D ; Liao, Jui-pengX 

Subject: Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use 
openssl standard options

Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Tuesday, March 27, 2018 1:48 PM
To: edk2-devel@lists.01.org
Cc: Liao, Jui-pengX ; Kinney, Michael D 
; Zhu, Yonghong 
Subject: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl standard 
options

sha256 is not the standard option. It should be replaced by sha -sha256.
Otherwise, it doesn't work in MAC OS.

In V2, update the option to sha1 -sha256.
In late openssl version >= 1.1, there is no sha option, but has sha1,sha256.
In previous openssl version < 1.1, there is no sha256, but has sha,sha1.
To work with all openssl version, use sha1 -sha256 for it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liao Jui-peng 
Signed-off-by: Liming Gao 
Cc: Michael Kinney 
Cc: Yonghong Zhu 
---
 BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py 
b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index 1ae6ebb..4188f8e 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -176,7 +176,7 @@ if __name__ == '__main__':
 # 
 # Sign the input file using the specified private key and capture 
signature from STDOUT
 #
-Process = subprocess.Popen('%s sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
+Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
 Signature = Process.communicate(input=FullInputFileBuffer)[0]
 if Process.returncode <> 0:
   sys.exit(Process.returncode)
@@ -225,7 +225,7 @@ if __name__ == '__main__':
 #
 # Verify signature
 #
-Process = subprocess.Popen('%s sha256 -prverify "%s" -signature %s' % 
(OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
+Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -signature %s' 
% (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
 Process.communicate(input=FullInputFileBuffer)
 if Process.returncode <> 0:
   print 'ERROR: Verification failed'
-- 
2.8.0.windows.1

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


Re: [edk2] [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl standard options

2018-03-27 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Tuesday, March 27, 2018 1:48 PM
To: edk2-devel@lists.01.org
Cc: Liao, Jui-pengX ; Kinney, Michael D 
; Zhu, Yonghong 
Subject: [PATCH v2] BaseTools: Update Rsa2048Sha256Sign to use openssl standard 
options

sha256 is not the standard option. It should be replaced by sha -sha256.
Otherwise, it doesn't work in MAC OS.

In V2, update the option to sha1 -sha256.
In late openssl version >= 1.1, there is no sha option, but has sha1,sha256.
In previous openssl version < 1.1, there is no sha256, but has sha,sha1.
To work with all openssl version, use sha1 -sha256 for it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liao Jui-peng 
Signed-off-by: Liming Gao 
Cc: Michael Kinney 
Cc: Yonghong Zhu 
---
 BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py 
b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index 1ae6ebb..4188f8e 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -176,7 +176,7 @@ if __name__ == '__main__':
 # 
 # Sign the input file using the specified private key and capture 
signature from STDOUT
 #
-Process = subprocess.Popen('%s sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
+Process = subprocess.Popen('%s sha1 -sha256 -sign "%s"' % (OpenSslCommand, 
args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)
 Signature = Process.communicate(input=FullInputFileBuffer)[0]
 if Process.returncode <> 0:
   sys.exit(Process.returncode)
@@ -225,7 +225,7 @@ if __name__ == '__main__':
 #
 # Verify signature
 #
-Process = subprocess.Popen('%s sha256 -prverify "%s" -signature %s' % 
(OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
+Process = subprocess.Popen('%s sha1 -sha256 -prverify "%s" -signature %s' 
% (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
shell=True)
 Process.communicate(input=FullInputFileBuffer)
 if Process.returncode <> 0:
   print 'ERROR: Verification failed'
-- 
2.8.0.windows.1

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