Re: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to 3.0.9

2023-08-02 Thread Li, Yi
Hi Liming,

Yes, we'd better catch edk2 202308 stable tag. If there are new CVE problems 
after OpenSSL1.1 EOL, we won't get support from the openssl community. Updating 
to 3.0 ASAP is the best choice.

Regards,
Yi

-Original Message-
From: gaoliming  
Sent: Wednesday, August 2, 2023 6:07 PM
To: devel@edk2.groups.io; Li, Yi1 
Cc: Yao, Jiewen ; Lu, Xiaoyu1 ; 
Jiang, Guomin ; 'Gerd Hoffmann' 
Subject: 回复: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to 
3.0.9

Yi:
  Thanks for your great work to update openssl 3.0. The commit message shows 
this patch set must catch edk2 202308 stable tag. Right?
  Edk2 202308 stable tag will start soft feature free from Aug 7th (next 
Monday). That means this patch set needs to pass code review in one week. 

Jiwen, Gerd:
  Can you give your comments for this patch set this week? If you need more 
time, I will raise the request to defer the soft feature freeze.

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Li, Yi
> 发送时间: 2023年7月28日 14:40
> 收件人: devel@edk2.groups.io
> 抄送: Yi Li ; Jiewen Yao ; 
> Xiaoyu Lu ; Guomin Jiang 
> ; Gerd Hoffmann 
> 主题: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to
> 3.0.9
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3466
> 
> According to https://www.OpenSSL.org/policies/releasestrat.html,
> OpenSSL Version 1.1.1 will be supported until 2023-09-11 (LTS).
> Need to upgrade OpenSsl to 3.0.9 before 1.1.1 support stopping.
> 
> PR: https://github.com/tianocore/edk2/pull/4692
> 
> Cc: Jiewen Yao 
> Cc: Xiaoyu Lu 
> Cc: Guomin Jiang 
> Cc: Gerd Hoffmann 
> Gerd Hoffmann (15):
>   CryptoPkg/openssl: update submodule to openssl-3.0.9
>   CryptoPkg/openssl: cleanup all openssl1.1.1 generated files and code
>   CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0
>   CryptoPkg/openssl: add openssl3 configure scripts
>   CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0
>   CryptoPkg/BaseCryptLib: no openssl deprecation warnings please
>   CryptoPkg/BaseCryptLib: adapt CryptSm3.c to openssl 3.0 changes.
>   CryptoPkg/BaseCryptLib: drop BIO_* dummy functions
>   CryptoPkg/TlsLib: ERR_GET_FUNC is gone
>   CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes
>   CryptoPkg/openssl: move compiler_flags to buildinf.c
>   CryptoPkg/openssl: store dummy update for openssl 3.0
>   CryptoPkg/openssl: adapt EcSm2Null.c for openssl 3.0
>   CryptoPkg/TlsLib: use unsigned long for ErrorCode
>   CryptoPkg/openssl: update CI config for openssl 3.0
> 
> Yi Li (14):
>   CryptoPkg: Move all UEFI implement of openssl to OpensslStub
>   CryptoPkg: use UEFI provider as default
>   CryptoPkg: adapt 3.0 change in SslNull.c
>   CryptoPkg: Add instrinsics to support building openssl3 on IA32
> windows
>   CryptoPkg: disable C4133 warning in openssl libraries
>   CryptoPkg: Align with 4096 when build with OpensslFullAccel
>   CryptoPkg: Enable memcpy sys call in RISCV64 build
>   CryptoPkg: add missing gcc instructions
>   CryptoPkg: add define of maximum unsigned size_t
>   CryptoPkg: add implemention of _ftol2_sse() to avoid build error
>   CryptoPkg: add more dummy implement of openssl for size optimization
>   CryptoPkg: run configure.py to update all generated files
>   CryptoPkg: remove strcmp to syscall
>   CryptoPkg: remove BN and EC accel for size optimization
> 
>  CryptoPkg/CryptoPkg.ci.yaml   |   54 +-
>  CryptoPkg/CryptoPkg.dec   |4 +
>  CryptoPkg/CryptoPkg.dsc   |   12 +-
>  .../Library/BaseCryptLib/Hash/CryptSm3.c  |   14 +-
>  .../Library/BaseCryptLib/InternalCryptLib.h   |2 +
>  .../Library/BaseCryptLib/SysCall/CrtWrapper.c |   36 +-
>  .../SysCall/UnitTestHostCrtWrapper.c  |   25 -
>  CryptoPkg/Library/Include/CrtLibSupport.h |1 +
>  .../Library/Include/openssl/opensslconf.h |  333 -
>  .../IntrinsicLib/Ia32/MathDivModU64x64.c  |   23 +
>  .../Library/IntrinsicLib/Ia32/MathDivS64x64.c |   22 +
>  .../Library/IntrinsicLib/Ia32/MathDivU64x64.c |   22 +
>  .../Library/IntrinsicLib/Ia32/MathFtol.c  |   12 +
>  .../Library/IntrinsicLib/Ia32/MathLldiv.asm   |  203 +
>  .../Library/IntrinsicLib/Ia32/MathModU64x64.c |   26 +
>  .../Library/IntrinsicLib/Ia32/MathUlldiv.asm  |  157 +  
> .../Library/IntrinsicLib/Ia32/MathUlldvrm.asm |  184 +  
> .../Library/IntrinsicLib/Ia32/MathUllrem.asm  |  163 +
>  .../Library/IntrinsicLib/IntrinsicLib.inf |   11 +-
>  .../Library/IntrinsicLib/MemoryIntrinsics.c   |9 -
>  .../IA32/crypto/modes/ghash-x86.nasm  |  700 --
>  .../OpensslLib/IA32/crypto/sha/sha1-586.nasm  | 1394 ---
>  .../IA32/crypto/sha/sha256-586.nasm   | 3364 ---
>  .../IA32/crypto/sha/sha512-586.nasm   |  579 --
>  .../IA32Gcc/crypto/modes/ghash-x86.S  |  703 --
>  .../OpensslLib/IA32Gcc/crypto/sha/sha1-586.S  | 1389 ---
>  .../IA32Gcc/crypto/sha/sha256-586.S   | 3356 ---
>  .../IA32Gcc/crypto/sha/sha512-586.S   |  

Re: [edk2-devel] [PATCH v2] MdeModulePkg: AllocatePages for TranslateBmpToGopBlt

2023-08-02 Thread Ni, Ray
Please don't mix the two changes in one patch.
The two changes are:
1. change to use __func__
2. AllocatePages

> -Original Message-
> From: Ck, Chitralekha 
> Sent: Thursday, August 3, 2023 1:00 PM
> To: devel@edk2.groups.io
> Cc: Ck, Chitralekha ; Ni, Ray ; 
> Gao,
> Zhichao ; S, Ashraf Ali ;
> Duggapu, Chinni B 
> Subject: [PATCH v2] MdeModulePkg: AllocatePages for TranslateBmpToGopBlt
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4507
> AllocatePool limits to allocate memory of 64 KB at most in PEI Phase.
> AllocatePool() is being avoided due to its 64k allocation size limit
> when the library is incorporated into a PEI component.
> 
> change the function debug string to __func__
> 
> Cc: Ray Ni 
> Cc: Zhichao Gao 
> Cc: Ashraf Ali S 
> Cc: Chinni B Duggapu 
> Signed-off-by: chitralekha ck 
> ---
>  .../Library/BaseBmpSupportLib/BmpSupportLib.c | 58 +++
>  1 file changed, 33 insertions(+), 25 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> index c5e885d7a6..d0833a721f 100644
> --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> @@ -52,7 +52,7 @@ const BMP_IMAGE_HEADER  mBmpImageHeaderTemplate
> = {
>  /**
>Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
>is passed in a GopBlt buffer will be allocated by this routine using
> -  EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will 
> be
> +  EFI_BOOT_SERVICES.AllocatePages(). If a GopBlt buffer is passed in it will 
> be
>used if it is big enough.
> 
>@param[in]   BmpImage  Pointer to BMP file.
> @@ -113,14 +113,14 @@ TranslateBmpToGopBlt (
>}
> 
>if (BmpImageSize < sizeof (BMP_IMAGE_HEADER)) {
> -DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpImageSize too
> small\n"));
> +DEBUG ((DEBUG_ERROR, "%a: BmpImageSize too small\n", __func__));
>  return RETURN_UNSUPPORTED;
>}
> 
>BmpHeader = (BMP_IMAGE_HEADER *)BmpImage;
> 
>if ((BmpHeader->CharB != 'B') || (BmpHeader->CharM != 'M')) {
> -DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->Char fields
> incorrect\n"));
> +DEBUG ((DEBUG_ERROR, "%a: BmpHeader->Char fields incorrect\n",
> __func__));
>  return RETURN_UNSUPPORTED;
>}
> 
> @@ -128,12 +128,12 @@ TranslateBmpToGopBlt (
>// Doesn't support compress.
>//
>if (BmpHeader->CompressionType != 0) {
> -DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: Compression Type
> unsupported.\n"));
> +DEBUG ((DEBUG_ERROR, "%a: Compression Type unsupported\n",
> __func__));
>  return RETURN_UNSUPPORTED;
>}
> 
>if ((BmpHeader->PixelHeight == 0) || (BmpHeader->PixelWidth == 0)) {
> -DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight
> or BmpHeader->PixelWidth is 0.\n"));
> +DEBUG ((DEBUG_ERROR, "%a: BmpHeader PixelHeight or PixelWidth is 0\n",
> __func__));
>  return RETURN_UNSUPPORTED;
>}
> 
> @@ -144,7 +144,8 @@ TranslateBmpToGopBlt (
>if (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - OFFSET_OF
> (BMP_IMAGE_HEADER, HeaderSize)) {
>  DEBUG ((
>DEBUG_ERROR,
> -  "TranslateBmpToGopBlt: BmpHeader->Headership is not as expected.
> Headersize is 0x%x\n",
> +  "%a: BmpHeader->Headership is not as expected. Headersize is 0x%x\n",
> +  __func__,
>BmpHeader->HeaderSize
>));
>  return RETURN_UNSUPPORTED;
> @@ -161,7 +162,8 @@ TranslateBmpToGopBlt (
>if (EFI_ERROR (Status)) {
>  DEBUG ((
>DEBUG_ERROR,
> -  "TranslateBmpToGopBlt: invalid BmpImage... PixelWidth:0x%x
> BitPerPixel:0x%x\n",
> +  "%a: invalid BmpImage. PixelWidth:0x%x BitPerPixel:0x%x\n",
> +  __func__,
>BmpHeader->PixelWidth,
>BmpHeader->BitPerPixel
>));
> @@ -172,7 +174,8 @@ TranslateBmpToGopBlt (
>if (EFI_ERROR (Status)) {
>  DEBUG ((
>DEBUG_ERROR,
> -  "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x\n",
> +  "%a: invalid BmpImage. DataSizePerLine:0x%x\n",
> +  __func__,
>DataSizePerLine
>));
> 
> @@ -189,7 +192,8 @@ TranslateBmpToGopBlt (
>if (EFI_ERROR (Status)) {
>  DEBUG ((
>DEBUG_ERROR,
> -  "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x
> PixelHeight:0x%x\n",
> +  "%a: invalid BmpImage. DataSizePerLine:0x%x PixelHeight:0x%x\n",
> +  __func__,
>DataSizePerLine,
>BmpHeader->PixelHeight
>));
> @@ -206,7 +210,8 @@ TranslateBmpToGopBlt (
>if (EFI_ERROR (Status)) {
>  DEBUG ((
>DEBUG_ERROR,
> -  "TranslateBmpToGopBlt: invalid BmpImage... PixelHeight:0x%x
> DataSizePerLine:0x%x\n",
> +  "%a: invalid BmpImage. PixelHeight:0x%x DataSizePerLine:0x%x\n",
> +  __func__,
>BmpHeader->PixelHeight,
>DataSizePerLine
>));
> @@ -218,11 +223,11 @@ TranslateBmpToGopBlt (

[edk2-devel] [PATCH v2] MdeModulePkg: AllocatePages for TranslateBmpToGopBlt

2023-08-02 Thread chitralekha ck
https://bugzilla.tianocore.org/show_bug.cgi?id=4507
AllocatePool limits to allocate memory of 64 KB at most in PEI Phase.
AllocatePool() is being avoided due to its 64k allocation size limit
when the library is incorporated into a PEI component.

change the function debug string to __func__

Cc: Ray Ni 
Cc: Zhichao Gao 
Cc: Ashraf Ali S 
Cc: Chinni B Duggapu 
Signed-off-by: chitralekha ck 
---
 .../Library/BaseBmpSupportLib/BmpSupportLib.c | 58 +++
 1 file changed, 33 insertions(+), 25 deletions(-)

diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c 
b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index c5e885d7a6..d0833a721f 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -52,7 +52,7 @@ const BMP_IMAGE_HEADER  mBmpImageHeaderTemplate = {
 /**
   Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
   is passed in a GopBlt buffer will be allocated by this routine using
-  EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be
+  EFI_BOOT_SERVICES.AllocatePages(). If a GopBlt buffer is passed in it will be
   used if it is big enough.
 
   @param[in]   BmpImage  Pointer to BMP file.
@@ -113,14 +113,14 @@ TranslateBmpToGopBlt (
   }
 
   if (BmpImageSize < sizeof (BMP_IMAGE_HEADER)) {
-DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpImageSize too small\n"));
+DEBUG ((DEBUG_ERROR, "%a: BmpImageSize too small\n", __func__));
 return RETURN_UNSUPPORTED;
   }
 
   BmpHeader = (BMP_IMAGE_HEADER *)BmpImage;
 
   if ((BmpHeader->CharB != 'B') || (BmpHeader->CharM != 'M')) {
-DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->Char fields 
incorrect\n"));
+DEBUG ((DEBUG_ERROR, "%a: BmpHeader->Char fields incorrect\n", __func__));
 return RETURN_UNSUPPORTED;
   }
 
@@ -128,12 +128,12 @@ TranslateBmpToGopBlt (
   // Doesn't support compress.
   //
   if (BmpHeader->CompressionType != 0) {
-DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: Compression Type 
unsupported.\n"));
+DEBUG ((DEBUG_ERROR, "%a: Compression Type unsupported\n", __func__));
 return RETURN_UNSUPPORTED;
   }
 
   if ((BmpHeader->PixelHeight == 0) || (BmpHeader->PixelWidth == 0)) {
-DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight or 
BmpHeader->PixelWidth is 0.\n"));
+DEBUG ((DEBUG_ERROR, "%a: BmpHeader PixelHeight or PixelWidth is 0\n", 
__func__));
 return RETURN_UNSUPPORTED;
   }
 
@@ -144,7 +144,8 @@ TranslateBmpToGopBlt (
   if (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - OFFSET_OF 
(BMP_IMAGE_HEADER, HeaderSize)) {
 DEBUG ((
   DEBUG_ERROR,
-  "TranslateBmpToGopBlt: BmpHeader->Headership is not as expected.  
Headersize is 0x%x\n",
+  "%a: BmpHeader->Headership is not as expected. Headersize is 0x%x\n",
+  __func__,
   BmpHeader->HeaderSize
   ));
 return RETURN_UNSUPPORTED;
@@ -161,7 +162,8 @@ TranslateBmpToGopBlt (
   if (EFI_ERROR (Status)) {
 DEBUG ((
   DEBUG_ERROR,
-  "TranslateBmpToGopBlt: invalid BmpImage... PixelWidth:0x%x 
BitPerPixel:0x%x\n",
+  "%a: invalid BmpImage. PixelWidth:0x%x BitPerPixel:0x%x\n",
+  __func__,
   BmpHeader->PixelWidth,
   BmpHeader->BitPerPixel
   ));
@@ -172,7 +174,8 @@ TranslateBmpToGopBlt (
   if (EFI_ERROR (Status)) {
 DEBUG ((
   DEBUG_ERROR,
-  "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x\n",
+  "%a: invalid BmpImage. DataSizePerLine:0x%x\n",
+  __func__,
   DataSizePerLine
   ));
 
@@ -189,7 +192,8 @@ TranslateBmpToGopBlt (
   if (EFI_ERROR (Status)) {
 DEBUG ((
   DEBUG_ERROR,
-  "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x 
PixelHeight:0x%x\n",
+  "%a: invalid BmpImage. DataSizePerLine:0x%x PixelHeight:0x%x\n",
+  __func__,
   DataSizePerLine,
   BmpHeader->PixelHeight
   ));
@@ -206,7 +210,8 @@ TranslateBmpToGopBlt (
   if (EFI_ERROR (Status)) {
 DEBUG ((
   DEBUG_ERROR,
-  "TranslateBmpToGopBlt: invalid BmpImage... PixelHeight:0x%x 
DataSizePerLine:0x%x\n",
+  "%a: invalid BmpImage. PixelHeight:0x%x DataSizePerLine:0x%x\n",
+  __func__,
   BmpHeader->PixelHeight,
   DataSizePerLine
   ));
@@ -218,11 +223,11 @@ TranslateBmpToGopBlt (
   (BmpHeader->Size < BmpHeader->ImageOffset) ||
   (BmpHeader->Size - BmpHeader->ImageOffset != DataSize))
   {
-DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
-DEBUG ((DEBUG_ERROR, "   BmpHeader->Size: 0x%x\n", BmpHeader->Size));
-DEBUG ((DEBUG_ERROR, "   BmpHeader->ImageOffset: 0x%x\n", 
BmpHeader->ImageOffset));
-DEBUG ((DEBUG_ERROR, "   BmpImageSize: 0x%lx\n", (UINTN)BmpImageSize));
-DEBUG ((DEBUG_ERROR, "   DataSize: 0x%lx\n", (UINTN)DataSize));
+DEBUG ((DEBUG_ERROR, "%a: invalid BmpImage... \n", __func__));
+DEBUG ((DEBUG_ERROR, " Size: 0x%x\n", BmpHeader->Size));
+   

Re: [edk2-devel] [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via GetVariable for EfiVarStore

2023-08-02 Thread Dandan Bi
Hi Liming,

Yes, with this change, the performance is better than before. 
Especially for the big formset with lots of configuration, it has better use 
experience when loading the formset to display. 

Could you help review this patch? Thanks.


Thanks,
Dandan
-Original Message-
From: gaoliming  
Sent: Wednesday, August 2, 2023 1:08 PM
To: Dong, Eric ; Bi, Dandan ; 
devel@edk2.groups.io
Subject: 回复: [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via GetVariable 
for EfiVarStore

Dandan:
  Have you collected the performance data for this enhancement? Is the updated 
one better than before?

Thanks
Liming
> -邮件原件-
> 发件人: Dong, Eric 
> 发送时间: 2023年7月31日 13:04
> 收件人: Bi, Dandan ; devel@edk2.groups.io
> 抄送: Gao, Liming 
> 主题: RE: [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via 
> GetVariable for EfiVarStore
> 
> Reviewed-by: Eric Dong 
> 
> -Original Message-
> From: Bi, Dandan 
> Sent: Monday, July 31, 2023 8:46 AM
> To: devel@edk2.groups.io
> Cc: Gao, Liming ; Dong, Eric 
> 
> Subject: [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via 
> GetVariable for EfiVarStore
> 
> For EfiVarStore (EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER), it will call 
> ExtractConfig-GetVariable-HiiBlockToConfig-ConfigToBlock when load 
> storage value in LoadStorage function. It's not necessary and costs 
> lots of time
to do
> the conversion between config and block.
> So now enhance it to call GetVariable directly.
> 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Dandan Bi 
> ---
> v2: Fix coding style issue.
> 
>  .../Universal/SetupBrowserDxe/Setup.c | 54 +++
>  1 file changed, 32 insertions(+), 22 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> index 5158baf5bd..2f7b11b1aa 100644
> --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
> @@ -5634,32 +5634,42 @@ LoadStorage (
>  ConfigRequest = Storage->ConfigRequest;
>}
> 
> -  //
> -  // Request current settings from Configuration Driver
> -  //
> -  Status = mHiiConfigRouting->ExtractConfig (
> -mHiiConfigRouting,
> -ConfigRequest,
> -,
> -
> -);
> -
> -  //
> -  // If get value fail, extract default from IFR binary
> -  //
> -  if (EFI_ERROR (Status)) {
> -ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD,
> FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE, 
> TRUE);
> -  } else {
> +  if (Storage->BrowserStorage->Type ==
> + EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
>  //
> -// Convert Result from  to 
> +// Call GetVariable directly for EfiVarStore
>  //
> -StrPtr = StrStr (Result, L"=");
> -if (StrPtr != NULL) {
> -  *StrPtr = L'\0';
> +Status = gRT->GetVariable (Storage->BrowserStorage->Name,
> &(Storage->BrowserStorage->Guid), NULL, (UINTN 
> *)(&(Storage->BrowserStorage->Size)),
> Storage->BrowserStorage->EditBuffer);
> +if (EFI_ERROR (Status)) {
> +  ExtractDefault (FormSet, NULL,
> EFI_HII_DEFAULT_CLASS_STANDARD,
> + FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE, 
> + TRUE);
>  }
> +  } else {
> +//
> +// Request current settings from Configuration Driver
> +//
> +Status = mHiiConfigRouting->ExtractConfig (
> +  mHiiConfigRouting,
> +  ConfigRequest,
> +  ,
> +  
> +  );
> 
> -Status = ConfigRespToStorage (Storage->BrowserStorage, Result);
> -FreePool (Result);
> +//
> +// If get value fail, extract default from IFR binary
> +//
> +if (EFI_ERROR (Status)) {
> +  ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD,
> FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE, 
> TRUE);
> +} else {
> +  //
> +  // Convert Result from  to 
> +  //
> +  StrPtr = StrStr (Result, L"=");
> +  if (StrPtr != NULL) {
> +*StrPtr = L'\0';
> +  }
> +
> +  Status = ConfigRespToStorage (Storage->BrowserStorage, Result);
> +  FreePool (Result);
> +}
>}
> 
>Storage->BrowserStorage->ConfigRequest = AllocateCopyPool (StrSize 
> (Storage->ConfigRequest), Storage->ConfigRequest);
> --
> 2.39.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107512): https://edk2.groups.io/g/devel/message/107512
Mute This Topic: https://groups.io/mt/100520724/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 01/22] CryptoPkg/openssl: update submodule to openssl-3.0.8

2023-08-02 Thread Li, Yi
Hi Ard,

Your feedback already integrated to latest patch series:  [PATCH V2 00/29] 
CryptoPkg: Update OpenSSL submodule to 3.0.9
Thanks for your review, let me know if you have any feedback.

Regards,
Yi

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Ard Biesheuvel
Sent: Friday, June 2, 2023 5:15 PM
To: Yao, Jiewen 
Cc: devel@edk2.groups.io; kra...@redhat.com; Li, Yi1 ; Wang, 
Jian J ; Pawel Polawski ; Lu, 
Xiaoyu1 ; Jiang, Guomin ; Oliver 
Steffen ; Justen, Jordan L 
Subject: Re: [edk2-devel] [PATCH 01/22] CryptoPkg/openssl: update submodule to 
openssl-3.0.8

On Fri, 2 Jun 2023 at 04:53, Yao, Jiewen  wrote:
>
> Hi Ard
> Would you please take a look at 
> https://github.com/tianocore/edk2-staging/tree/OpenSSL30, which is our 
> current working version? If you have any idea, please propose patch.
>
> Also, could you please try that on ARM/AARCH64 platform to see if there is 
> anything broken?
>
> I think those are important to make sure we have a working version for next 
> stable tag.
>

Agreed.

With GCC5 and the tweak below [0], that branch builds OVMF/ArmVirtQemu fine for 
me on {X64,AARCH64,ARM} x {DEBUG,RELEASE,NOOPT}.

I also built DeveloperBox.dsc and DeveloperBoxMm.dsc from edk2-platforms 
without problems, with SECURE_BOOT_ENABLE and TPM2_ENABLE both set.

Clang seemed to work fine as well, but the branch still uses CLANG3x so we need 
to rebase this branch onto the latest stable tag first and retest.

I did only a quick boot test to check whether secure boot verification was 
working, but all seemed to work fine.

In any case, if we want to make the next stable tag, I think we should move 
quickly, so that we have enough time to fix any issues that may arise.



[0] first hunk is based on 7880536fe17c2b54 in openssl upstream

--- a/CryptoPkg/Library/OpensslLib/OpensslGen/openssl/x509v3.h
+++ b/CryptoPkg/Library/OpensslLib/OpensslGen/openssl/x509v3.h
@@ -177,7 +177,7 @@ typedef struct GENERAL_NAME_st {
 OTHERNAME *otherName;   /* otherName */
 ASN1_IA5STRING *rfc822Name;
 ASN1_IA5STRING *dNSName;
-ASN1_TYPE *x400Address;
+ASN1_STRING *x400Address;
 X509_NAME *directoryName;
 EDIPARTYNAME *ediPartyName;
 ASN1_IA5STRING *uniformResourceIdentifier; diff --git 
a/CryptoPkg/Library/OpensslLib/SslExtServNull.c
b/CryptoPkg/Library/OpensslLib/SslExtServNull.c
index c256f17667668866..a736dca8b73d27d5 100644
--- a/CryptoPkg/Library/OpensslLib/SslExtServNull.c
+++ b/CryptoPkg/Library/OpensslLib/SslExtServNull.c
@@ -177,12 +177,6 @@ int tls_parse_ctos_early_data(SSL *s, PACKET *pkt, 
unsigned int context,
 return 0;
 }

-static SSL_TICKET_STATUS tls_get_stateful_ticket(SSL *s, PACKET *tick,
- SSL_SESSION **sess)
-{
-return SSL_TICKET_NO_DECRYPT;
-}
-
 int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
size_t chainidx)  {







-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107511): https://edk2.groups.io/g/devel/message/107511
Mute This Topic: https://groups.io/mt/97576405/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 29/29] CryptoPkg: remove BN and EC accel for size optimization

2023-08-02 Thread Li, Yi
BN and EC have not been fully tested, and will greatly increase
the size of the Crypto driver(>150KB).

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 .../Library/OpensslLib/OpensslLibAccel.inf| 26 ++
 .../OpensslLib/OpensslLibFullAccel.inf| 34 ++-
 CryptoPkg/Library/OpensslLib/configure.py | 21 
 3 files changed, 27 insertions(+), 54 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 1d4b6bb6c7..a37347fbbf 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -22,8 +22,8 @@
   DEFINE OPENSSL_PATH= openssl
   DEFINE OPENSSL_GEN_PATH= OpensslGen
   DEFINE OPENSSL_FLAGS   = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DEDK2_OPENSSL_NOEC=1
-  DEFINE OPENSSL_FLAGS_IA32  = -DAES_ASM -DGHASH_ASM -DMD5_ASM 
-DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_PART_WORDS 
-DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM 
-DVPAES_ASM
-  DEFINE OPENSSL_FLAGS_X64   = -DAES_ASM -DBSAES_ASM -DGHASH_ASM 
-DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT 
-DOPENSSL_BN_ASM_MONT5 -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DSHA1_ASM 
-DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
+  DEFINE OPENSSL_FLAGS_IA32  = -DAES_ASM -DGHASH_ASM -DMD5_ASM 
-DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
+  DEFINE OPENSSL_FLAGS_X64   = -DAES_ASM -DBSAES_ASM -DGHASH_ASM 
-DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM 
-DSHA512_ASM -DVPAES_ASM
 
 #
 #  VALID_ARCHITECTURES   = IA32 X64
@@ -33,6 +33,7 @@
   OpensslLibConstructor.c
   $(OPENSSL_PATH)/e_os.h
   $(OPENSSL_PATH)/ms/uplink.h
+  $(OPENSSL_PATH)/crypto/bn/bn_asm.c
 # Autogenerated files list starts here
 # Autogenerated files list ends here
   buildinf.h
@@ -660,10 +661,6 @@
   $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/aes/aes-586.nasm | MSFT
   $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/aes/aesni-x86.nasm | MSFT
   $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/aes/vpaes-x86.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/bn/bn-586.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/bn/co-586.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/bn/x86-gf2m.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/bn/x86-mont.nasm | MSFT
   $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/x86cpuid.nasm | MSFT
   $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/md5/md5-586.nasm | MSFT
   $(OPENSSL_GEN_PATH)/IA32-MSFT/crypto/modes/ghash-x86.nasm | MSFT
@@ -673,10 +670,6 @@
   $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/aes/aes-586.S | GCC
   $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/aes/aesni-x86.S | GCC
   $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/aes/vpaes-x86.S | GCC
-  $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/bn/bn-586.S | GCC
-  $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/bn/co-586.S | GCC
-  $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/bn/x86-gf2m.S | GCC
-  $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/bn/x86-mont.S | GCC
   $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/x86cpuid.S | GCC
   $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/md5/md5-586.S | GCC
   $(OPENSSL_GEN_PATH)/IA32-GCC/crypto/modes/ghash-x86.S | GCC
@@ -790,7 +783,6 @@
   $(OPENSSL_PATH)/crypto/bio/bss_null.c
   $(OPENSSL_PATH)/crypto/bio/bss_sock.c
   $(OPENSSL_PATH)/crypto/bio/ossl_core_bio.c
-  $(OPENSSL_PATH)/crypto/bn/asm/x86_64-gcc.c
   $(OPENSSL_PATH)/crypto/bn/bn_add.c
   $(OPENSSL_PATH)/crypto/bn/bn_blind.c
   $(OPENSSL_PATH)/crypto/bn/bn_const.c
@@ -1305,12 +1297,6 @@
   $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/aes/aesni-x86_64.nasm | MSFT
   $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/aes/bsaes-x86_64.nasm | MSFT
   $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/aes/vpaes-x86_64.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/bn/rsaz-avx2.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/bn/rsaz-avx512.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/bn/rsaz-x86_64.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/bn/x86_64-gf2m.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/bn/x86_64-mont.nasm | MSFT
-  $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/bn/x86_64-mont5.nasm | MSFT
   $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/x86_64cpuid.nasm | MSFT
   $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/md5/md5-x86_64.nasm | MSFT
   $(OPENSSL_GEN_PATH)/X64-MSFT/crypto/modes/aesni-gcm-x86_64.nasm | MSFT
@@ -1328,12 +1314,6 @@
   $(OPENSSL_GEN_PATH)/X64-GCC/crypto/aes/aesni-x86_64.s | GCC
   $(OPENSSL_GEN_PATH)/X64-GCC/crypto/aes/bsaes-x86_64.s | GCC
   $(OPENSSL_GEN_PATH)/X64-GCC/crypto/aes/vpaes-x86_64.s | GCC
-  $(OPENSSL_GEN_PATH)/X64-GCC/crypto/bn/rsaz-avx2.s | GCC
-  $(OPENSSL_GEN_PATH)/X64-GCC/crypto/bn/rsaz-avx512.s | GCC
-  $(OPENSSL_GEN_PATH)/X64-GCC/crypto/bn/rsaz-x86_64.s | GCC
-  $(OPENSSL_GEN_PATH)/X64-GCC/crypto/bn/x86_64-gf2m.s | GCC
-  $(OPENSSL_GEN_PATH)/X64-GCC/crypto/bn/x86_64-mont.s | GCC
-  

[edk2-devel] [PATCH V2 28/29] CryptoPkg/openssl: update CI config for openssl 3.0

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/CryptoPkg.ci.yaml | 54 +
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index 47f2975967..59ba56d41e 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -9,11 +9,7 @@
 "LicenseCheck": {
 "IgnoreFiles": [
 # These directories contain auto-generated OpenSSL content
-"Library/OpensslLib/IA32",
-"Library/OpensslLib/IA32Gcc",
-"Library/OpensslLib/X64",
-"Library/OpensslLib/X64Gcc",
-"Library/Include/openssl"
+"Library/OpensslLib/OpensslGen"
 ]
 },
 "EccCheck": {
@@ -30,14 +26,13 @@
 ## Both file path and directory path are accepted.
 "IgnoreFiles": [
 "Library/OpensslLib/openssl",
-"Library/Include/openssl",
-"Library/Include/crypto",
+"Library/OpensslLib/OpensslGen",
 # The unit testing folder is not to be checked
 "Test/UnitTest",
 # This has OpenSSL interfaces that aren't UEFI spec compliant
 "Library/BaseCryptLib/SysCall",
 # This has OpenSSL interfaces that aren't UEFI spec compliant
-"Library/OpensslLib/rand_pool.c",
+"Library/OpensslLib/OpensslStub",
 # This has OpenSSL interfaces that aren't UEFI spec compliant
 "Library/Include/CrtLibSupport.h",
 # This has OpenSSL interfaces that aren't UEFI spec compliant
@@ -96,9 +91,46 @@
 # options defined in .pytool/Plugin/UncrustifyCheck
 "UncrustifyCheck": {
 "IgnoreFiles": [
-"opensslconf.h",
-"dso_conf.h",
-"opensslconf_generated.h"
+"Library/OpensslLib/OpensslGen/include/crypto/bn_conf.h",
+"Library/OpensslLib/OpensslGen/include/crypto/dso_conf.h",
+"Library/OpensslLib/OpensslGen/include/openssl/asn1.h",
+"Library/OpensslLib/OpensslGen/include/openssl/asn1t.h",
+"Library/OpensslLib/OpensslGen/include/openssl/bio.h",
+"Library/OpensslLib/OpensslGen/include/openssl/cmp.h",
+"Library/OpensslLib/OpensslGen/include/openssl/cms.h",
+"Library/OpensslLib/OpensslGen/include/openssl/conf.h",
+"Library/OpensslLib/OpensslGen/include/openssl/configuration-ec.h",
+
"Library/OpensslLib/OpensslGen/include/openssl/configuration-noec.h",
+"Library/OpensslLib/OpensslGen/include/openssl/configuration.h",
+"Library/OpensslLib/OpensslGen/include/openssl/crmf.h",
+"Library/OpensslLib/OpensslGen/include/openssl/crypto.h",
+"Library/OpensslLib/OpensslGen/include/openssl/ct.h",
+"Library/OpensslLib/OpensslGen/include/openssl/err.h",
+"Library/OpensslLib/OpensslGen/include/openssl/ess.h",
+"Library/OpensslLib/OpensslGen/include/openssl/fipskey.h",
+"Library/OpensslLib/OpensslGen/include/openssl/lhash.h",
+"Library/OpensslLib/OpensslGen/include/openssl/ocsp.h",
+"Library/OpensslLib/OpensslGen/include/openssl/opensslv.h",
+"Library/OpensslLib/OpensslGen/include/openssl/pkcs12.h",
+"Library/OpensslLib/OpensslGen/include/openssl/pkcs7.h",
+"Library/OpensslLib/OpensslGen/include/openssl/safestack.h",
+"Library/OpensslLib/OpensslGen/include/openssl/srp.h",
+"Library/OpensslLib/OpensslGen/include/openssl/ssl.h",
+"Library/OpensslLib/OpensslGen/include/openssl/ui.h",
+"Library/OpensslLib/OpensslGen/include/openssl/x509.h",
+"Library/OpensslLib/OpensslGen/include/openssl/x509v3.h",
+"Library/OpensslLib/OpensslGen/include/openssl/x509_vfy.h",
+
"Library/OpensslLib/OpensslGen/providers/common/der/der_digests_gen.c",
+"Library/OpensslLib/OpensslGen/providers/common/der/der_ecx_gen.c",
+"Library/OpensslLib/OpensslGen/providers/common/der/der_ec_gen.c",
+"Library/OpensslLib/OpensslGen/providers/common/der/der_rsa_gen.c",
+
"Library/OpensslLib/OpensslGen/providers/common/der/der_wrap_gen.c",
+
"Library/OpensslLib/OpensslGen/providers/common/include/prov/der_digests.h",
+
"Library/OpensslLib/OpensslGen/providers/common/include/prov/der_ec.h",
+
"Library/OpensslLib/OpensslGen/providers/common/include/prov/der_ecx.h",
+
"Library/OpensslLib/OpensslGen/providers/common/include/prov/der_rsa.h",
+
"Library/OpensslLib/OpensslGen/providers/common/include/prov/der_wrap.h",
+"Library/OpensslLib/OpensslStub/uefiprov.c"
 ]
 }
 }
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages 

[edk2-devel] [PATCH V2 27/29] CryptoPkg: remove strcmp to syscall

2023-08-02 Thread Li, Yi
In rare cases the platform may not provide the full IntrinsicLib.
But openssl30 build always require strcmp, provide this function by
moving it into CrtWrapper.c.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 9 +
 CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c   | 9 -
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 6d7ac3efdc..37cdecc9bd 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
@@ -275,6 +275,15 @@ strcpy (
   return strDest;
 }
 
+int
+strcmp (
+  const char  *s1,
+  const char  *s2
+  )
+{
+  return (int)AsciiStrCmp (s1, s2);
+}
+
 //
 // -- Character Classification Routines --
 //
diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c 
b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
index 611e9fd773..9b091f1901 100644
--- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
+++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
@@ -63,12 +63,3 @@ memcmp (
 {
   return (int)CompareMem (buf1, buf2, count);
 }
-
-int
-strcmp (
-  const char  *s1,
-  const char  *s2
-  )
-{
-  return (int)AsciiStrCmp (s1, s2);
-}
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107508): https://edk2.groups.io/g/devel/message/107508
Mute This Topic: https://groups.io/mt/100520612/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 25/29] CryptoPkg: add more dummy implement of openssl for size optimization

2023-08-02 Thread Li, Yi
Add dummy implement of Encoder, Pkcs12 and sslserver.
OpenSSL libraries which don't need these features can include
these files to reduce the size of output.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   |   4 +
 .../Library/OpensslLib/OpensslLibAccel.inf|   4 +
 .../Library/OpensslLib/OpensslLibCrypto.inf   |   2 +
 .../Library/OpensslLib/OpensslLibFull.inf |   4 +
 .../OpensslLib/OpensslLibFullAccel.inf|   4 +
 .../OpensslLib/OpensslStub/EncoderNull.c  | 364 
 .../OpensslLib/OpensslStub/Pkcs12Null.c   | 146 +
 .../OpensslLib/OpensslStub/SslExtServNull.c   | 517 ++
 .../OpensslLib/OpensslStub/SslStatServNull.c  | 306 +++
 9 files changed, 1351 insertions(+)
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/EncoderNull.c
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/Pkcs12Null.c
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/SslExtServNull.c
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/SslStatServNull.c

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 856cbdd859..3fbebde0e5 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -40,6 +40,10 @@
 #  OpensslStub/SslNull.c
   OpensslStub/EcSm2Null.c
   OpensslStub/uefiprov.c
+  OpensslStub/EncoderNull.c
+  OpensslStub/SslStatServNull.c
+  OpensslStub/SslExtServNull.c
+  OpensslStub/Pkcs12Null.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 5e8bface2e..1b1f021ca0 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -42,6 +42,10 @@
 #  OpensslStub/SslNull.c
   OpensslStub/EcSm2Null.c
   OpensslStub/uefiprov.c
+  OpensslStub/EncoderNull.c
+  OpensslStub/SslStatServNull.c
+  OpensslStub/SslExtServNull.c
+  OpensslStub/Pkcs12Null.c
 
 [Sources.IA32]
 # Autogenerated files list starts here
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index e17f813f22..1916c230bb 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -41,6 +41,8 @@
   OpensslStub/SslNull.c
   OpensslStub/EcSm2Null.c
   OpensslStub/uefiprov.c
+  OpensslStub/EncoderNull.c
+  OpensslStub/Pkcs12Null.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
index b049bd4067..0bb7a52f57 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
@@ -45,6 +45,10 @@
 #  OpensslStub/SslNull.c
 #  OpensslStub/EcSm2Null.c
   OpensslStub/uefiprov.c
+  OpensslStub/EncoderNull.c
+  OpensslStub/SslStatServNull.c
+  OpensslStub/SslExtServNull.c
+  OpensslStub/Pkcs12Null.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index 56962afffc..de6766 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -47,6 +47,10 @@
 #  OpensslStub/SslNull.c
 #  OpensslStub/EcSm2Null.c
   OpensslStub/uefiprov.c
+  OpensslStub/EncoderNull.c
+  OpensslStub/SslStatServNull.c
+  OpensslStub/SslExtServNull.c
+  OpensslStub/Pkcs12Null.c
 
 [Sources.IA32]
 # Autogenerated files list starts here
diff --git a/CryptoPkg/Library/OpensslLib/OpensslStub/EncoderNull.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/EncoderNull.c
new file mode 100644
index 00..f3106cf8ab
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/OpensslStub/EncoderNull.c
@@ -0,0 +1,364 @@
+/** @file
+  Null implementation of ENCODER functions called by BaseCryptLib.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+
+OSSL_ENCODER *
+OSSL_ENCODER_fetch (
+  OSSL_LIB_CTX  *libctx,
+  const char*name,
+  const char*properties
+  )
+{
+  return NULL;
+}
+
+int
+OSSL_ENCODER_up_ref (
+  OSSL_ENCODER  *encoder
+  )
+{
+  return 0;
+}
+
+void
+OSSL_ENCODER_free (
+  OSSL_ENCODER  *encoder
+  )
+{
+}
+
+const OSSL_PROVIDER *
+OSSL_ENCODER_get0_provider (
+  const OSSL_ENCODER  *encoder
+  )
+{
+  return NULL;
+}
+
+const char *
+OSSL_ENCODER_get0_properties (
+  const OSSL_ENCODER  *encoder
+  )
+{
+  return NULL;
+}
+
+const char *
+OSSL_ENCODER_get0_name (
+  const OSSL_ENCODER  *kdf
+  )
+{
+  return NULL;
+}
+
+const char *
+OSSL_ENCODER_get0_description (
+  const OSSL_ENCODER  *kdf
+  )
+{
+  return NULL;
+}
+
+int
+OSSL_ENCODER_is_a (
+  const OSSL_ENCODER  *encoder,
+  const char  *name
+  )
+{
+  return 0;
+}
+
+void

[edk2-devel] [PATCH V2 24/29] CryptoPkg: add implemention of _ftol2_sse() to avoid build error

2023-08-02 Thread Li, Yi
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c
index 09000c6bec..adfe249b1d 100644
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c
@@ -23,3 +23,15 @@ _ftol2 (
 ret
   }
 }
+
+__declspec(naked) void
+_ftol2_sse (
+  void
+  )
+{
+  _asm {
+fistp dword ptr [esp-4]
+mov   eax,[esp-4]
+ret
+  }
+}
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107505): https://edk2.groups.io/g/devel/message/107505
Mute This Topic: https://groups.io/mt/100520609/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 23/29] CryptoPkg: add define of maximum unsigned size_t

2023-08-02 Thread Li, Yi
Used by openssl30 source code.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/Include/CrtLibSupport.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h 
b/CryptoPkg/Library/Include/CrtLibSupport.h
index 94b0e6b601..f36fe08f0c 100644
--- a/CryptoPkg/Library/Include/CrtLibSupport.h
+++ b/CryptoPkg/Library/Include/CrtLibSupport.h
@@ -87,6 +87,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define UINT_MAX  0x  /* Maximum unsigned int value */
 #define ULONG_MAX 0x  /* Maximum unsigned long value */
 #define CHAR_BIT  8   /* Number of bits in a char */
+#define SIZE_MAX  0x  /* Maximum unsigned size_t */
 
 //
 // Address families.
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107504): https://edk2.groups.io/g/devel/message/107504
Mute This Topic: https://groups.io/mt/100520607/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 22/29] CryptoPkg: add missing gcc instructions

2023-08-02 Thread Li, Yi
Used when build IA32 CryptoPkg by gcc, the definition of the
instructions can be found at:
https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 .../IntrinsicLib/Ia32/MathDivModU64x64.c  | 23 
 .../Library/IntrinsicLib/Ia32/MathDivS64x64.c | 22 
 .../Library/IntrinsicLib/Ia32/MathDivU64x64.c | 22 
 .../Library/IntrinsicLib/Ia32/MathModU64x64.c | 26 +++
 .../Library/IntrinsicLib/IntrinsicLib.inf |  5 +++-
 5 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c
new file mode 100644
index 00..6c75a1ff1d
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c
@@ -0,0 +1,23 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+
+/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */
+__attribute__ ((__used__))
+unsigned long long
+__udivmoddi4 (
+  unsigned long long  A,
+  unsigned long long  B,
+  unsigned long long  *C
+  )
+{
+  return DivU64x64Remainder ((UINT64)A, (UINT64)B, (UINT64 *)C);
+}
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c
new file mode 100644
index 00..54ff619b61
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c
@@ -0,0 +1,22 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+
+/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */
+__attribute__ ((__used__))
+long long
+__divdi3 (
+  long long  A,
+  long long  B
+  )
+{
+  return DivS64x64Remainder ((INT64)A, (INT64)B, NULL);
+}
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c
new file mode 100644
index 00..dbb7b516fb
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c
@@ -0,0 +1,22 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+
+/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */
+__attribute__ ((__used__))
+unsigned long long
+__udivdi3 (
+  unsigned long long  A,
+  unsigned long long  B
+  )
+{
+  return DivU64x64Remainder ((UINT64)A, (UINT64)B, NULL);
+}
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c
new file mode 100644
index 00..eedd96074e
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c
@@ -0,0 +1,26 @@
+/** @file
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+
+/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */
+__attribute__ ((__used__))
+unsigned long long
+__umoddi3 (
+  unsigned long long  A,
+  unsigned long long  B
+  )
+{
+  unsigned long long  Reminder;
+
+  DivU64x64Remainder ((UINT64)A, (UINT64)B, (UINT64 *));
+
+  return Reminder;
+}
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index 4d2440466d..ae238ccc0b 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -43,7 +43,10 @@
 
   Ia32/MathLShiftS64.nasm   | GCC
   Ia32/MathRShiftU64.nasm   | GCC
-
+  Ia32/MathDivModU64x64.c   | GCC
+  Ia32/MathDivS64x64.c  | GCC
+  Ia32/MathDivU64x64.c  | GCC
+  Ia32/MathModU64x64.c  | GCC
 [Sources.X64]
   CopyMem.c
 [Sources.RISCV64]
-- 
2.31.1.windows.1



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

[edk2-devel] [PATCH V2 21/29] CryptoPkg: Enable memcpy sys call in RISCV64 build

2023-08-02 Thread Li, Yi
When build Openssl30, compiler optimization may use memcpy()
for memory copy.
Need enable it in RISCV64 build also.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index 2ec987b260..4d2440466d 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -46,6 +46,8 @@
 
 [Sources.X64]
   CopyMem.c
+[Sources.RISCV64]
+  CopyMem.c
 
 [Packages]
   MdePkg/MdePkg.dec
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107502): https://edk2.groups.io/g/devel/message/107502
Mute This Topic: https://groups.io/mt/100520605/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 20/29] CryptoPkg: Align with 4096 when build with OpensslFullAccel

2023-08-02 Thread Li, Yi
Should align to 4096 when build ecp_nistz256 related asm files.
ecp_nistz256-x86.S Line3:
.globl  ecp_nistz256_precomputed
.align  4096

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/CryptoPkg.dsc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 4676193e89..a55dcb9668 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -456,8 +456,8 @@
 
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
 
-  MSFT:*_*_IA32_DLINK_FLAGS = /ALIGN:64
-  MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:256
+  MSFT:*_*_IA32_DLINK_FLAGS = /ALIGN:4096
+  MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:4096
   }
 !endif
 
@@ -522,8 +522,8 @@
 
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
 
-  MSFT:*_*_IA32_DLINK_FLAGS = /ALIGN:64
-  MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:256
+  MSFT:*_*_IA32_DLINK_FLAGS = /ALIGN:4096
+  MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:4096
   }
   #
   # CryptoSmm with OpensslLib instance with no SSL or EC services
@@ -575,8 +575,8 @@
 
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
 
-  MSFT:*_*_IA32_DLINK_FLAGS = /ALIGN:64
-  MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:256
+  MSFT:*_*_IA32_DLINK_FLAGS = /ALIGN:4096
+  MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:4096
   }
 !endif
 
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107501): https://edk2.groups.io/g/devel/message/107501
Mute This Topic: https://groups.io/mt/100520604/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 19/29] CryptoPkg/TlsLib: use unsigned long for ErrorCode

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/TlsLib/TlsConfig.c  | 3 ++-
 CryptoPkg/Library/TlsLib/TlsProcess.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index 5adb1976e3..f9333165a9 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -701,7 +701,6 @@ TlsSetCaCertificate (
   TLS_CONNECTION  *TlsConn;
   SSL_CTX *SslCtx;
   INTNRet;
-  UINTN   ErrorCode;
 
   BioCert   = NULL;
   Cert  = NULL;
@@ -753,6 +752,8 @@ TlsSetCaCertificate (
   //
   Ret = X509_STORE_add_cert (X509Store, Cert);
   if (Ret != 1) {
+unsigned long  ErrorCode;
+
 ErrorCode = ERR_peek_last_error ();
 //
 // Ignore "already in table" errors
diff --git a/CryptoPkg/Library/TlsLib/TlsProcess.c 
b/CryptoPkg/Library/TlsLib/TlsProcess.c
index ddd0317ee6..1b712cd452 100644
--- a/CryptoPkg/Library/TlsLib/TlsProcess.c
+++ b/CryptoPkg/Library/TlsLib/TlsProcess.c
@@ -81,7 +81,6 @@ TlsDoHandshake (
   TLS_CONNECTION  *TlsConn;
   UINTN   PendingBufferSize;
   INTNRet;
-  UINTN   ErrorCode;
 
   TlsConn   = (TLS_CONNECTION *)Tls;
   PendingBufferSize = 0;
@@ -133,6 +132,8 @@ TlsDoHandshake (
 ));
   DEBUG_CODE_BEGIN ();
   while (TRUE) {
+unsigned long  ErrorCode;
+
 ErrorCode = ERR_get_error ();
 if (ErrorCode == 0) {
   break;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107500): https://edk2.groups.io/g/devel/message/107500
Mute This Topic: https://groups.io/mt/100520603/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 18/29] CryptoPkg: disable C4133 warning in openssl libraries

2023-08-02 Thread Li, Yi
Disable warning as error of C4133:
v3_genn.c(101): warning C4133: 'function': incompatible types
- from 'ASN1_TYPE *' to 'const ASN1_STRING *'.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf  | 5 +++--
 CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf | 5 +++--
 CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf| 5 +++--
 CryptoPkg/Library/OpensslLib/OpensslLibFull.inf  | 5 +++--
 CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf | 5 +++--
 5 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 270f96ee69..856cbdd859 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -70,9 +70,10 @@
   #   C4702: unreachable code
   #   C4706: assignment within conditional expression
   #   C4819: The file contains a character that cannot be represented in the 
current code page
+  #   C4133: incompatible types - from 'ASN1_TYPE *' to 'const ASN1_STRING *' 
(v3_genn.c(101))
   #
-  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819
-  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819 /wd4133
+  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819 /wd4133
 
   #
   # Disable following Visual Studio 2015 compiler warnings brought by openssl 
source,
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 3bd3dfd37a..5e8bface2e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -78,9 +78,10 @@
   #   C4702: unreachable code
   #   C4706: assignment within conditional expression
   #   C4819: The file contains a character that cannot be represented in the 
current code page
+  #   C4133: incompatible types - from 'ASN1_TYPE *' to 'const ASN1_STRING *' 
(v3_genn.c(101))
   #
-  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_IA32) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819
-  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_X64) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_IA32) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819 /wd4133
+  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_X64) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819 /wd4133
 
   #
   # Disable following Visual Studio 2015 compiler warnings brought by openssl 
source,
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 581f556eb2..e17f813f22 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -71,9 +71,10 @@
   #   C4702: unreachable code
   #   C4706: assignment within conditional expression
   #   C4819: The file contains a character that cannot be represented in the 
current code page
+  #   C4133: incompatible types - from 'ASN1_TYPE *' to 'const ASN1_STRING *' 
(v3_genn.c(101))
   #
-  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819
-  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819 /wd4133
+  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819 /wd4133
 
   #
   # Disable following Visual Studio 2015 compiler warnings brought by openssl 

[edk2-devel] [PATCH V2 17/29] CryptoPkg: Add instrinsics to support building openssl3 on IA32 windows

2023-08-02 Thread Li, Yi
This dependency is needed to build openssl lib with openssl3
under IA32 Windows, so added implementation for _alldiv, _aulldiv,
_aullrem and _alldvrm instrinsics.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 .../Library/IntrinsicLib/Ia32/MathLldiv.asm   | 203 ++
 .../Library/IntrinsicLib/Ia32/MathUlldiv.asm  | 157 ++
 .../Library/IntrinsicLib/Ia32/MathUlldvrm.asm | 184 
 .../Library/IntrinsicLib/Ia32/MathUllrem.asm  | 163 ++
 .../Library/IntrinsicLib/IntrinsicLib.inf |   4 +
 5 files changed, 711 insertions(+)
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLldiv.asm
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathUlldiv.asm
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathUlldvrm.asm
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathUllrem.asm

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLldiv.asm 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLldiv.asm
new file mode 100644
index 00..2fccfd6dc0
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLldiv.asm
@@ -0,0 +1,203 @@
+;***
+;lldiv.asm - signed long divide routine
+;
+;   Copyright (c) Microsoft Corporation. All rights reserved.
+;   SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;Purpose:
+;   defines the signed long divide routine
+;   __alldiv
+;
+;Original Implemenation: MSVC 14.29.30133
+;
+;***
+.686
+.model  flat,C
+.code
+
+
+
+;***
+;lldiv - signed long divide
+;
+;Purpose:
+;   Does a signed long divide of the arguments.  Arguments are
+;   not changed.
+;
+;Entry:
+;   Arguments are passed on the stack:
+;   1st pushed: divisor (QWORD)
+;   2nd pushed: dividend (QWORD)
+;
+;Exit:
+;   EDX:EAX contains the quotient (dividend/divisor)
+;   NOTE: this routine removes the parameters from the stack.
+;
+;Uses:
+;   ECX
+;
+;Exceptions:
+;
+;***
+_alldiv PROC NEAR
+
+HIWORD  EQU [4] ;
+LOWORD  EQU [0]
+
+pushedi
+pushesi
+pushebx
+
+; Set up the local stack and save the index registers.  When this is done
+; the stack frame will look as follows (assuming that the expression a/b will
+; generate a call to lldiv(a, b)):
+;
+;   -
+;   |   |
+;   |---|
+;   |   |
+;   |--divisor (b)--|
+;   |   |
+;   |---|
+;   |   |
+;   |--dividend (a)-|
+;   |   |
+;   |---|
+;   | return addr** |
+;   |---|
+;   |  EDI  |
+;   |---|
+;   |  ESI  |
+;   |---|
+;   ESP>|  EBX  |
+;   -
+;
+
+DVNDequ [esp + 16]  ; stack address of dividend (a)
+DVSRequ [esp + 24]  ; stack address of divisor (b)
+
+
+; Determine sign of the result (edi = 0 if result is positive, non-zero
+; otherwise) and make operands positive.
+
+xor edi,edi ; result sign assumed positive
+
+mov eax,HIWORD(DVND) ; hi word of a
+or  eax,eax ; test to see if signed
+jge short L1; skip rest if a is already positive
+inc edi ; complement result sign flag
+mov edx,LOWORD(DVND) ; lo word of a
+neg eax ; make a positive
+neg edx
+sbb eax,0
+mov HIWORD(DVND),eax ; save positive value
+mov LOWORD(DVND),edx
+L1:
+mov eax,HIWORD(DVSR) ; hi word of b
+or  eax,eax ; test to see if signed
+jge short L2; skip rest if b is already positive
+inc edi ; complement the result sign flag
+mov edx,LOWORD(DVSR) ; lo word of a
+neg eax ; make b positive
+neg edx
+sbb eax,0
+mov HIWORD(DVSR),eax ; save positive value
+mov LOWORD(DVSR),edx
+L2:
+
+;
+; Now do the divide.  First look to see if the divisor is less than 4194304K.
+; If so, then we can use a simple algorithm with word divides, otherwise
+; things get a little more complex.
+;
+; NOTE - eax currently contains the high order word of DVSR
+;
+
+or  eax,eax ; check to see if divisor < 4194304K
+jnz short L3; nope, gotta do this the hard way
+mov ecx,LOWORD(DVSR) ; load divisor
+mov eax,HIWORD(DVND) ; load high word of dividend
+xor edx,edx
+div ecx ; eax <- high 

[edk2-devel] [PATCH V2 09/29] CryptoPkg/TlsLib: ERR_GET_FUNC is gone

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/TlsLib/TlsConfig.c  | 2 +-
 CryptoPkg/Library/TlsLib/TlsProcess.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c 
b/CryptoPkg/Library/TlsLib/TlsConfig.c
index fdda73690a..5adb1976e3 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -757,7 +757,7 @@ TlsSetCaCertificate (
 //
 // Ignore "already in table" errors
 //
-if (!((ERR_GET_FUNC (ErrorCode) == X509_F_X509_STORE_ADD_CERT) &&
+if (!((ERR_GET_LIB (ErrorCode) == ERR_LIB_X509) &&
   (ERR_GET_REASON (ErrorCode) == X509_R_CERT_ALREADY_IN_HASH_TABLE)))
 {
   Status = EFI_ABORTED;
diff --git a/CryptoPkg/Library/TlsLib/TlsProcess.c 
b/CryptoPkg/Library/TlsLib/TlsProcess.c
index db296053fd..ddd0317ee6 100644
--- a/CryptoPkg/Library/TlsLib/TlsProcess.c
+++ b/CryptoPkg/Library/TlsLib/TlsProcess.c
@@ -140,11 +140,10 @@ TlsDoHandshake (
 
 DEBUG ((
   DEBUG_ERROR,
-  "%a ERROR 0x%x=L%x:F%x:R%x\n",
+  "%a ERROR 0x%x=L%x:R%x\n",
   __func__,
   ErrorCode,
   ERR_GET_LIB (ErrorCode),
-  ERR_GET_FUNC (ErrorCode),
   ERR_GET_REASON (ErrorCode)
   ));
   }
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107492): https://edk2.groups.io/g/devel/message/107492
Mute This Topic: https://groups.io/mt/100520594/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 12/29] CryptoPkg/openssl: store dummy update for openssl 3.0

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/ossl_store.c | 156 ++
 1 file changed, 156 insertions(+)

diff --git a/CryptoPkg/Library/OpensslLib/ossl_store.c 
b/CryptoPkg/Library/OpensslLib/ossl_store.c
index b4297395d7..f1e1b8b60f 100644
--- a/CryptoPkg/Library/OpensslLib/ossl_store.c
+++ b/CryptoPkg/Library/OpensslLib/ossl_store.c
@@ -6,6 +6,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include 
+#include 
+#include 
+
 /*
  * This function is cleanup ossl store.
  *
@@ -17,3 +21,155 @@ ossl_store_cleanup_int (
   )
 {
 }
+
+int
+ossl_store_loader_store_cache_flush (
+  OSSL_LIB_CTX  *libctx
+  )
+{
+  return 1;
+}
+
+int
+ossl_store_loader_store_remove_all_provided (
+  OSSL_PROVIDER  *prov
+  )
+{
+  return 1;
+}
+
+static void *
+file_open (
+  void*provctx,
+  const char  *uri
+  )
+{
+  return NULL;
+}
+
+const OSSL_DISPATCH  ossl_file_store_functions[] = {
+  { OSSL_FUNC_STORE_OPEN, (void (*)(void)) file_open },
+  { 0,NULL   },
+};
+
+OSSL_STORE_CTX *
+OSSL_STORE_open (
+  const char   *uri,
+  const UI_METHOD  *ui_method,
+  void *ui_data,
+  OSSL_STORE_post_process_info_fn  post_process,
+  void *post_process_data
+  )
+{
+  return NULL;
+}
+
+OSSL_STORE_CTX *
+OSSL_STORE_open_ex (
+  const char   *uri,
+  OSSL_LIB_CTX *libctx,
+  const char   *propq,
+  const UI_METHOD  *ui_method,
+  void *ui_data,
+  const OSSL_PARAM params[],
+  OSSL_STORE_post_process_info_fn  post_process,
+  void *post_process_data
+  )
+{
+  return NULL;
+}
+
+int
+OSSL_STORE_INFO_get_type (
+  const OSSL_STORE_INFO  *info
+  )
+{
+  return 0;
+}
+
+int
+OSSL_STORE_find (
+  OSSL_STORE_CTX   *ctx,
+  const OSSL_STORE_SEARCH  *search
+  )
+{
+  return 0;
+}
+
+OSSL_STORE_INFO *
+OSSL_STORE_load (
+  OSSL_STORE_CTX  *ctx
+  )
+{
+  return NULL;
+}
+
+const char *
+OSSL_STORE_INFO_get0_NAME (
+  const OSSL_STORE_INFO  *info
+  )
+{
+  return NULL;
+}
+
+X509 *
+OSSL_STORE_INFO_get0_CERT (
+  const OSSL_STORE_INFO  *info
+  )
+{
+  return NULL;
+}
+
+X509_CRL *
+OSSL_STORE_INFO_get0_CRL (
+  const OSSL_STORE_INFO  *info
+  )
+{
+  return NULL;
+}
+
+int
+OSSL_STORE_eof (
+  OSSL_STORE_CTX  *ctx
+  )
+{
+  return 0;
+}
+
+int
+OSSL_STORE_error (
+  OSSL_STORE_CTX  *ctx
+  )
+{
+  return 0;
+}
+
+int
+OSSL_STORE_close (
+  OSSL_STORE_CTX  *ctx
+  )
+{
+  return 0;
+}
+
+void
+OSSL_STORE_INFO_free (
+  OSSL_STORE_INFO  *info
+  )
+{
+}
+
+OSSL_STORE_SEARCH *
+OSSL_STORE_SEARCH_by_name (
+  X509_NAME  *name
+  )
+{
+  return NULL;
+}
+
+void
+OSSL_STORE_SEARCH_free (
+  OSSL_STORE_SEARCH  *search
+  )
+{
+}
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107493): https://edk2.groups.io/g/devel/message/107493
Mute This Topic: https://groups.io/mt/100520595/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 11/29] CryptoPkg/openssl: move compiler_flags to buildinf.c

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Seems with openssl 3.0 this is used by multiple source files,
so we get duplicate symbol errors when linking.  Fix that by
moving compiler_flags from header file to a source file.

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf  | 1 +
 CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf | 1 +
 CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf| 1 +
 CryptoPkg/Library/OpensslLib/OpensslLibFull.inf  | 1 +
 CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf | 1 +
 CryptoPkg/Library/OpensslLib/buildinf.c  | 4 
 CryptoPkg/Library/OpensslLib/buildinf.h  | 2 +-
 7 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 CryptoPkg/Library/OpensslLib/buildinf.c

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 9c922d0f49..d43806708a 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -34,6 +34,7 @@
 # Autogenerated files list starts here
 # Autogenerated files list ends here
   buildinf.h
+  buildinf.c
   ossl_store.c
   rand_pool.c
 #  SslNull.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index e6f2b8e07b..54cf01279c 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -36,6 +36,7 @@
 # Autogenerated files list starts here
 # Autogenerated files list ends here
   buildinf.h
+  buildinf.c
   ossl_store.c
   rand_pool.c
 #  SslNull.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index c7e63ca16c..3037eba9d3 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -35,6 +35,7 @@
 # Autogenerated files list starts here
 # Autogenerated files list ends here
   buildinf.h
+  buildinf.c
   ossl_store.c
   rand_pool.c
   SslNull.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
index 8dffe936fc..f9c00605f2 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
@@ -39,6 +39,7 @@
 # Autogenerated files list starts here
 # Autogenerated files list ends here
   buildinf.h
+  buildinf.c
   ossl_store.c
   rand_pool.c
 #  SslNull.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index e8ebf6afb7..7ba262cb01 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -41,6 +41,7 @@
 # Autogenerated files list starts here
 # Autogenerated files list ends here
   buildinf.h
+  buildinf.c
   ossl_store.c
   rand_pool.c
 #  SslNull.c
diff --git a/CryptoPkg/Library/OpensslLib/buildinf.c 
b/CryptoPkg/Library/OpensslLib/buildinf.c
new file mode 100644
index 00..cd7fe9322e
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/buildinf.c
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+#include "buildinf.h"
+
+const char  *compiler_flags = "compiler: information not available from edk2";
diff --git a/CryptoPkg/Library/OpensslLib/buildinf.h 
b/CryptoPkg/Library/OpensslLib/buildinf.h
index 9042c7526f..7cf0eae008 100644
--- a/CryptoPkg/Library/OpensslLib/buildinf.h
+++ b/CryptoPkg/Library/OpensslLib/buildinf.h
@@ -1,4 +1,4 @@
 #define PLATFORM  "UEFI"
 #define DATE  "Fri Dec 22 01:23:45 PDT 2017"
 
-const char  *compiler_flags = "compiler: information not available from edk2";
+extern const char  *compiler_flags;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107495): https://edk2.groups.io/g/devel/message/107495
Mute This Topic: https://groups.io/mt/100520597/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 13/29] CryptoPkg/openssl: adapt EcSm2Null.c for openssl 3.0

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/EcSm2Null.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/EcSm2Null.c 
b/CryptoPkg/Library/OpensslLib/EcSm2Null.c
index 6d5ab2d4cc..b72a749189 100644
--- a/CryptoPkg/Library/OpensslLib/EcSm2Null.c
+++ b/CryptoPkg/Library/OpensslLib/EcSm2Null.c
@@ -9,8 +9,9 @@
 #include 
 #include 
 
-#undef OPENSSL_NO_EC
+#undef EDK2_OPENSSL_NOEC
 
+#include 
 #include 
 #include 
 #include 
@@ -300,9 +301,9 @@ ECDH_compute_key (
   return 0;
 }
 
-struct ec_key_st *
+const struct ec_key_st *
 EVP_PKEY_get0_EC_KEY (
-  EVP_PKEY  *pkey
+  const EVP_PKEY  *pkey
   )
 {
   ASSERT (FALSE);
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107494): https://edk2.groups.io/g/devel/message/107494
Mute This Topic: https://groups.io/mt/100520596/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 16/29] CryptoPkg: adapt 3.0 change in SslNull.c

2023-08-02 Thread Li, Yi
Type of input params changed in openssl30.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c
index 49f1405bc0..9f659728fe 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c
+++ b/CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c
@@ -80,10 +80,10 @@ SSL_CTX_new (
   return NULL;
 }
 
-unsigned long
+uint64_t
 SSL_CTX_set_options (
-  SSL_CTX*ctx,
-  unsigned long  op
+  SSL_CTX   *ctx,
+  uint64_t  op
   )
 {
   ASSERT (FALSE);
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107497): https://edk2.groups.io/g/devel/message/107497
Mute This Topic: https://groups.io/mt/100520599/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 10/29] CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Some functions have been renamed.

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/rand_pool.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/rand_pool.c 
b/CryptoPkg/Library/OpensslLib/rand_pool.c
index 13e860a853..03047b233e 100644
--- a/CryptoPkg/Library/OpensslLib/rand_pool.c
+++ b/CryptoPkg/Library/OpensslLib/rand_pool.c
@@ -74,7 +74,7 @@ RandGetBytes (
  * This is OpenSSL required interface.
  */
 size_t
-rand_pool_acquire_entropy (
+ossl_pool_acquire_entropy (
   RAND_POOL  *pool
   )
 {
@@ -82,21 +82,21 @@ rand_pool_acquire_entropy (
   size_t Bytes_needed;
   unsigned char  *Buffer;
 
-  Bytes_needed = rand_pool_bytes_needed (pool, 1 /*entropy_factor*/);
+  Bytes_needed = ossl_rand_pool_bytes_needed (pool, 1 /*entropy_factor*/);
   if (Bytes_needed > 0) {
-Buffer = rand_pool_add_begin (pool, Bytes_needed);
+Buffer = ossl_rand_pool_add_begin (pool, Bytes_needed);
 
 if (Buffer != NULL) {
   Ret = RandGetBytes (Bytes_needed, Buffer);
   if (FALSE == Ret) {
-rand_pool_add_end (pool, 0, 0);
+ossl_rand_pool_add_end (pool, 0, 0);
   } else {
-rand_pool_add_end (pool, Bytes_needed, 8 * Bytes_needed);
+ossl_rand_pool_add_end (pool, Bytes_needed, 8 * Bytes_needed);
   }
 }
   }
 
-  return rand_pool_entropy_available (pool);
+  return ossl_rand_pool_entropy_available (pool);
 }
 
 /*
@@ -105,7 +105,7 @@ rand_pool_acquire_entropy (
  * This is OpenSSL required interface.
  */
 int
-rand_pool_add_nonce_data (
+ossl_pool_add_nonce_data (
   RAND_POOL  *pool
   )
 {
@@ -113,7 +113,7 @@ rand_pool_add_nonce_data (
 
   RandGetBytes (sizeof (data), data);
 
-  return rand_pool_add (pool, (unsigned char *), sizeof (data), 0);
+  return ossl_rand_pool_add (pool, (unsigned char *), sizeof (data), 0);
 }
 
 /*
@@ -130,7 +130,7 @@ rand_pool_add_additional_data (
 
   RandGetBytes (sizeof (data), data);
 
-  return rand_pool_add (pool, (unsigned char *), sizeof (data), 0);
+  return ossl_rand_pool_add (pool, (unsigned char *), sizeof (data), 0);
 }
 
 /*
@@ -139,7 +139,7 @@ rand_pool_add_additional_data (
  * This is OpenSSL required interface.
  */
 int
-rand_pool_init (
+ossl_rand_pool_init (
   VOID
   )
 {
@@ -152,7 +152,7 @@ rand_pool_init (
  * This is OpenSSL required interface.
  */
 VOID
-rand_pool_cleanup (
+ossl_rand_pool_cleanup (
   VOID
   )
 {
@@ -164,7 +164,7 @@ rand_pool_cleanup (
  * This is OpenSSL required interface.
  */
 VOID
-rand_pool_keep_random_devices_open (
+ossl_rand_pool_keep_random_devices_open (
   int  keep
   )
 {
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107496): https://edk2.groups.io/g/devel/message/107496
Mute This Topic: https://groups.io/mt/100520598/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 14/29] CryptoPkg: Move all UEFI implement of openssl to OpensslStub

2023-08-02 Thread Li, Yi
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   | 8 
 CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf  | 8 
 CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 8 
 CryptoPkg/Library/OpensslLib/OpensslLibFull.inf   | 8 
 CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf  | 8 
 .../Library/OpensslLib/{ => OpensslStub}/EcSm2Null.c  | 0
 CryptoPkg/Library/OpensslLib/{ => OpensslStub}/SslNull.c  | 0
 .../Library/OpensslLib/{ => OpensslStub}/ossl_store.c | 0
 .../Library/OpensslLib/{ => OpensslStub}/rand_pool.c  | 0
 9 files changed, 20 insertions(+), 20 deletions(-)
 rename CryptoPkg/Library/OpensslLib/{ => OpensslStub}/EcSm2Null.c (100%)
 rename CryptoPkg/Library/OpensslLib/{ => OpensslStub}/SslNull.c (100%)
 rename CryptoPkg/Library/OpensslLib/{ => OpensslStub}/ossl_store.c (100%)
 rename CryptoPkg/Library/OpensslLib/{ => OpensslStub}/rand_pool.c (100%)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index d43806708a..c6f72193e7 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -35,10 +35,10 @@
 # Autogenerated files list ends here
   buildinf.h
   buildinf.c
-  ossl_store.c
-  rand_pool.c
-#  SslNull.c
-  EcSm2Null.c
+  OpensslStub/ossl_store.c
+  OpensslStub/rand_pool.c
+#  OpensslStub/SslNull.c
+  OpensslStub/EcSm2Null.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 54cf01279c..98fcad47dc 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -37,10 +37,10 @@
 # Autogenerated files list ends here
   buildinf.h
   buildinf.c
-  ossl_store.c
-  rand_pool.c
-#  SslNull.c
-  EcSm2Null.c
+  OpensslStub/ossl_store.c
+  OpensslStub/rand_pool.c
+#  OpensslStub/SslNull.c
+  OpensslStub/EcSm2Null.c
 
 [Sources.IA32]
 # Autogenerated files list starts here
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 3037eba9d3..861f42c3d8 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -36,10 +36,10 @@
 # Autogenerated files list ends here
   buildinf.h
   buildinf.c
-  ossl_store.c
-  rand_pool.c
-  SslNull.c
-  EcSm2Null.c
+  OpensslStub/ossl_store.c
+  OpensslStub/rand_pool.c
+  OpensslStub/SslNull.c
+  OpensslStub/EcSm2Null.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
index f9c00605f2..7815b5fea1 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
@@ -40,10 +40,10 @@
 # Autogenerated files list ends here
   buildinf.h
   buildinf.c
-  ossl_store.c
-  rand_pool.c
-#  SslNull.c
-#  EcSm2Null.c
+  OpensslStub/ossl_store.c
+  OpensslStub/rand_pool.c
+#  OpensslStub/SslNull.c
+#  OpensslStub/EcSm2Null.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index 7ba262cb01..0a13bd04bf 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -42,10 +42,10 @@
 # Autogenerated files list ends here
   buildinf.h
   buildinf.c
-  ossl_store.c
-  rand_pool.c
-#  SslNull.c
-#  EcSm2Null.c
+  OpensslStub/ossl_store.c
+  OpensslStub/rand_pool.c
+#  OpensslStub/SslNull.c
+#  OpensslStub/EcSm2Null.c
 
 [Sources.IA32]
 # Autogenerated files list starts here
diff --git a/CryptoPkg/Library/OpensslLib/EcSm2Null.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/EcSm2Null.c
similarity index 100%
rename from CryptoPkg/Library/OpensslLib/EcSm2Null.c
rename to CryptoPkg/Library/OpensslLib/OpensslStub/EcSm2Null.c
diff --git a/CryptoPkg/Library/OpensslLib/SslNull.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c
similarity index 100%
rename from CryptoPkg/Library/OpensslLib/SslNull.c
rename to CryptoPkg/Library/OpensslLib/OpensslStub/SslNull.c
diff --git a/CryptoPkg/Library/OpensslLib/ossl_store.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/ossl_store.c
similarity index 100%
rename from CryptoPkg/Library/OpensslLib/ossl_store.c
rename to CryptoPkg/Library/OpensslLib/OpensslStub/ossl_store.c
diff --git a/CryptoPkg/Library/OpensslLib/rand_pool.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/rand_pool.c
similarity index 100%
rename from CryptoPkg/Library/OpensslLib/rand_pool.c
rename to CryptoPkg/Library/OpensslLib/OpensslStub/rand_pool.c
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107490): https://edk2.groups.io/g/devel/message/107490

[edk2-devel] [PATCH V2 15/29] CryptoPkg: use UEFI provider as default

2023-08-02 Thread Li, Yi
Added UEFI provider which removed unused features to
optimize the size of openssl3.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   |   1 +
 .../Library/OpensslLib/OpensslLibAccel.inf|   1 +
 .../Library/OpensslLib/OpensslLibCrypto.inf   |   1 +
 .../Library/OpensslLib/OpensslLibFull.inf |   1 +
 .../OpensslLib/OpensslLibFullAccel.inf|   1 +
 .../Library/OpensslLib/OpensslStub/uefiprov.c | 328 ++
 6 files changed, 333 insertions(+)
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index c6f72193e7..270f96ee69 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -39,6 +39,7 @@
   OpensslStub/rand_pool.c
 #  OpensslStub/SslNull.c
   OpensslStub/EcSm2Null.c
+  OpensslStub/uefiprov.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 98fcad47dc..3bd3dfd37a 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -41,6 +41,7 @@
   OpensslStub/rand_pool.c
 #  OpensslStub/SslNull.c
   OpensslStub/EcSm2Null.c
+  OpensslStub/uefiprov.c
 
 [Sources.IA32]
 # Autogenerated files list starts here
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 861f42c3d8..581f556eb2 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -40,6 +40,7 @@
   OpensslStub/rand_pool.c
   OpensslStub/SslNull.c
   OpensslStub/EcSm2Null.c
+  OpensslStub/uefiprov.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
index 7815b5fea1..0011f157eb 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
@@ -44,6 +44,7 @@
   OpensslStub/rand_pool.c
 #  OpensslStub/SslNull.c
 #  OpensslStub/EcSm2Null.c
+  OpensslStub/uefiprov.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index 0a13bd04bf..fa8aabdccf 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -46,6 +46,7 @@
   OpensslStub/rand_pool.c
 #  OpensslStub/SslNull.c
 #  OpensslStub/EcSm2Null.c
+  OpensslStub/uefiprov.c
 
 [Sources.IA32]
 # Autogenerated files list starts here
diff --git a/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
new file mode 100644
index 00..40ab7e937c
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
@@ -0,0 +1,328 @@
+/** @file
+  UEFI Openssl provider implementation.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "prov/bio.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommon.h"
+#include "prov/implementations.h"
+#include "prov/names.h"
+#include "prov/provider_util.h"
+#include "prov/seeding.h"
+#include "internal/nelem.h"
+#include "provider_local.h"
+
+OSSL_provider_init_fn ossl_uefi_provider_init;
+const OSSL_PROVIDER_INFO ossl_predefined_providers[] = {
+{ "default", NULL, ossl_uefi_provider_init, NULL, 1 },
+{ NULL, NULL, NULL, NULL, 0 }
+};
+
+/*
+ * Forward declarations to ensure that interface functions are correctly
+ * defined.
+ */
+static OSSL_FUNC_provider_gettable_params_fn deflt_gettable_params;
+static OSSL_FUNC_provider_get_params_fn deflt_get_params;
+static OSSL_FUNC_provider_query_operation_fn deflt_query;
+
+#define ALGC(NAMES, FUNC, CHECK) { { NAMES, "provider=default", FUNC }, CHECK }
+#define ALG(NAMES, FUNC) ALGC(NAMES, FUNC, NULL)
+
+/* Functions provided by the core */
+static OSSL_FUNC_core_gettable_params_fn *c_gettable_params = NULL;
+static OSSL_FUNC_core_get_params_fn *c_get_params = NULL;
+
+/* Parameters we provide to the core */
+static const OSSL_PARAM deflt_param_types[] = {
+OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0),
+OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0),
+OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0),
+OSSL_PARAM_DEFN(OSSL_PROV_PARAM_STATUS, OSSL_PARAM_INTEGER, NULL, 0),
+OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *deflt_gettable_params(void *provctx)
+{
+return deflt_param_types;
+}
+
+static int deflt_get_params(void *provctx, OSSL_PARAM params[])
+{
+OSSL_PARAM *p;
+
+p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_NAME);

[edk2-devel] [PATCH V2 08/29] CryptoPkg/BaseCryptLib: drop BIO_* dummy functions

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

openssl 3.0 requires a functional BIO_sprintf() implementation.

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 .../Library/BaseCryptLib/SysCall/CrtWrapper.c | 27 ---
 .../SysCall/UnitTestHostCrtWrapper.c  | 25 -
 2 files changed, 52 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index b65d29485b..6d7ac3efdc 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
@@ -472,33 +472,6 @@ fwrite (
   return 0;
 }
 
-//
-//  -- Dummy OpenSSL Support Routines --
-//
-
-int
-BIO_printf (
-  void*bio,
-  const char  *format,
-  ...
-  )
-{
-  return 0;
-}
-
-int
-BIO_snprintf (
-  char*buf,
-  size_t  n,
-  const char  *format,
-  ...
-  )
-{
-  // Because the function does not actually print anything to buf, it returns 
-1 as error.
-  // Otherwise, the consumer may think that the buf is valid and parse the 
buffer.
-  return -1;
-}
-
 #ifdef __GNUC__
 
 typedef
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
index 066d53e4fa..244e57437e 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
@@ -72,31 +72,6 @@ sscanf (
   return 0;
 }
 
-//
-//  -- Dummy OpenSSL Support Routines --
-//
-
-int
-BIO_printf (
-  void*bio,
-  const char  *format,
-  ...
-  )
-{
-  return 0;
-}
-
-int
-BIO_snprintf (
-  char*buf,
-  size_t  n,
-  const char  *format,
-  ...
-  )
-{
-  return 0;
-}
-
 uid_t
 getuid (
   void
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107489): https://edk2.groups.io/g/devel/message/107489
Mute This Topic: https://groups.io/mt/100520583/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 07/29] CryptoPkg/BaseCryptLib: adapt CryptSm3.c to openssl 3.0 changes.

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Functions have been renamed.

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/BaseCryptLib/Hash/CryptSm3.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSm3.c 
b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSm3.c
index bbbc1e56f2..03b168b9e2 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSm3.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSm3.c
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include "InternalCryptLib.h"
-#include "crypto/sm3.h"
+#include "internal/sm3.h"
 
 /**
   Retrieves the size, in bytes, of the context buffer required for SM3 hash 
operations.
@@ -55,7 +55,7 @@ Sm3Init (
   //
   // Openssl SM3 Context Initialization
   //
-  sm3_init ((SM3_CTX *)Sm3Context);
+  ossl_sm3_init ((SM3_CTX *)Sm3Context);
   return TRUE;
 }
 
@@ -136,7 +136,7 @@ Sm3Update (
   //
   // Openssl SM3 Hash Update
   //
-  sm3_update ((SM3_CTX *)Sm3Context, Data, DataSize);
+  ossl_sm3_update ((SM3_CTX *)Sm3Context, Data, DataSize);
 
   return TRUE;
 }
@@ -178,7 +178,7 @@ Sm3Final (
   //
   // Openssl SM3 Hash Finalization
   //
-  sm3_final (HashValue, (SM3_CTX *)Sm3Context);
+  ossl_sm3_final (HashValue, (SM3_CTX *)Sm3Context);
 
   return TRUE;
 }
@@ -225,11 +225,11 @@ Sm3HashAll (
   //
   // SM3 Hash Computation.
   //
-  sm3_init ();
+  ossl_sm3_init ();
 
-  sm3_update (, Data, DataSize);
+  ossl_sm3_update (, Data, DataSize);
 
-  sm3_final (HashValue, );
+  ossl_sm3_final (HashValue, );
 
   return TRUE;
 }
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107488): https://edk2.groups.io/g/devel/message/107488
Mute This Topic: https://groups.io/mt/100520582/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 06/29] CryptoPkg/BaseCryptLib: no openssl deprecation warnings please

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Stop using deprecated interfaces is left as exercise for another day.
So please don't warn for now so -Werror builds can work.

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h 
b/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
index 3412acc676..477e3ae5f1 100644
--- a/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
+++ b/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
@@ -20,6 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "CrtLibSupport.h"
 
+#define OPENSSL_NO_DEPRECATED  0
+
 #include 
 
 #if OPENSSL_VERSION_NUMBER < 0x1010L
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107487): https://edk2.groups.io/g/devel/message/107487
Mute This Topic: https://groups.io/mt/100520581/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 03/29] CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

The configure workflow as changed, see the commit adding the configure
script for details.  Adapt the *.inf files to the changes.  The
configuration define handling has changed a bit.  The new configure
script will build a single per-arch file list, which simplifies the
Accel configs.

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/CryptoPkg.dec   |  4 +++
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   | 21 ++--
 .../Library/OpensslLib/OpensslLibAccel.inf| 33 +--
 .../Library/OpensslLib/OpensslLibCrypto.inf   | 21 ++--
 .../Library/OpensslLib/OpensslLibFull.inf | 19 ++-
 .../OpensslLib/OpensslLibFullAccel.inf| 30 -
 6 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/CryptoPkg/CryptoPkg.dec b/CryptoPkg/CryptoPkg.dec
index e20a5e9c38..0c7d16109b 100644
--- a/CryptoPkg/CryptoPkg.dec
+++ b/CryptoPkg/CryptoPkg.dec
@@ -23,6 +23,10 @@
   Private
   Library/Include
   Library/OpensslLib/openssl/include
+  Library/OpensslLib/openssl/providers/common/include
+  Library/OpensslLib/openssl/providers/implementations/include
+  Library/OpensslLib/OpensslGen/include
+  Library/OpensslLib/OpensslGen/providers/common/include
 
 [LibraryClasses]
   ##  @libraryclass  Provides basic library functions for cryptographic 
primitives.
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 9cf4344b4b..9c922d0f49 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -19,8 +19,9 @@
   CONSTRUCTOR= OpensslLibConstructor
 
   DEFINE OPENSSL_PATH= openssl
-  DEFINE OPENSSL_FLAGS   = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_EC 
-DOPENSSL_NO_ECDH -DOPENSSL_NO_ECDSA -DOPENSSL_NO_TLS1_3 -DOPENSSL_NO_SM2 
-DOPENSSL_NO_ASM
-  DEFINE OPENSSL_FLAGS_CONFIG=
+  DEFINE OPENSSL_GEN_PATH= OpensslGen
+  DEFINE OPENSSL_FLAGS   = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DEDK2_OPENSSL_NOEC=1 
-DOPENSSL_NO_ASM
+  DEFINE OPENSSL_FLAGS_NOASM =
 
 #
 #  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64
@@ -68,8 +69,8 @@
   #   C4706: assignment within conditional expression
   #   C4819: The file contains a character that cannot be represented in the 
current code page
   #
-  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_CONFIG) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819
-  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_CONFIG) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4310 
/wd4389 /wd4700 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) /wd4090 /wd4132 /wd4210 /wd4244 /wd4245 /wd4267 /wd4306 
/wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
 
   #
   # Disable following Visual Studio 2015 compiler warnings brought by openssl 
source,
@@ -79,8 +80,8 @@
   MSFT:*_VS2015x86_IA32_CC_FLAGS = /wd4718
   MSFT:*_VS2015x86_X64_CC_FLAGS  = /wd4718
 
-  INTEL:*_*_IA32_CC_FLAGS  = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC 
$(OPENSSL_FLAGS) $(OPENSSL_FLAGS_CONFIG) /w
-  INTEL:*_*_X64_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC 
$(OPENSSL_FLAGS) $(OPENSSL_FLAGS_CONFIG) /w
+  INTEL:*_*_IA32_CC_FLAGS  = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC 
$(OPENSSL_FLAGS) $(OPENSSL_FLAGS_NOASM) /w
+  INTEL:*_*_X64_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC 
$(OPENSSL_FLAGS) $(OPENSSL_FLAGS_NOASM) /w
 
   #
   # Suppress the following build warnings in openssl so we don't break the 
build with -Werror
@@ -89,8 +90,8 @@
   #   types appropriate to the format string specified.
   #   -Werror=unused-but-set-variable: Warn whenever a local variable is 
assigned to, but otherwise unused (aside from its declaration).
   #
-  GCC:*_*_IA32_CC_FLAGS= -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_CONFIG) -Wno-error=maybe-uninitialized 
-Wno-error=unused-but-set-variable
-  GCC:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_CONFIG) -Wno-error=maybe-uninitialized -Wno-error=format 
-Wno-format -Wno-error=unused-but-set-variable -DNO_MSABI_VA_FUNCS
+  GCC:*_*_IA32_CC_FLAGS= -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) -Wno-error=maybe-uninitialized 
-Wno-error=unused-but-set-variable
+  GCC:*_*_X64_CC_FLAGS = -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_NOASM) -Wno-error=maybe-uninitialized 

[edk2-devel] [PATCH V2 04/29] CryptoPkg/openssl: add openssl3 configure scripts

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Rewrite the script to configure openssl 3.0 from scratch.  It's two
scripts now:

 * Tiny helper script, dumping the perl configdata as json.
 * Actual configure.py script, written in python, which copies over
   the generated files to openssl-gen and updates the OpensslLib*.inf
   file lists and build flags.

The configuration workflow has changed a bit:

 * All generated files are stored in the OpensslGen directory tree.
 * For ec/no-ec builds two different header files are used.  Default is
   the ec variant, and the new EDK2_OPENSSL_NOEC define is used to
   select the no-ec build.  A five line wrapper include is used to pick
   the one or the other.
 * For non-accel builds -DOPENSSL_NO_ASM on the command line is used
   (same as before).
 * For configration defines the OPENSSL_FLAGS_$(variant) variable is
   used, where variant is the architecture for the accelerated builds
   and 'NOASM' for the non-accelerated builds.

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 .../Library/OpensslLib/OpenSSL-HOWTO.txt  |   4 +-
 CryptoPkg/Library/OpensslLib/configure.py | 395 ++
 CryptoPkg/Library/OpensslLib/perl2json.pl |  19 +
 3 files changed, 416 insertions(+), 2 deletions(-)
 create mode 100755 CryptoPkg/Library/OpensslLib/configure.py
 create mode 100755 CryptoPkg/Library/OpensslLib/perl2json.pl

diff --git a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt 
b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
index e52ee27b49..fff47d9f6b 100644
--- a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
+++ b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
@@ -28,9 +28,9 @@ on the cryptography.
 refer to edk2/Readme.md for how to clone the code.
 
 =
-  About process_files.pl
+  About configure.py
 =
-  "process_files.pl" is one Perl script which runs the OpenSSL Configure,
+  "configure.py" is one python script which runs the OpenSSL Configure,
 then processes the resulting file list into our local OpensslLib.inf and
 OpensslLibCrypto.inf.
   This only needs to be done once by the maintainer / developer when
diff --git a/CryptoPkg/Library/OpensslLib/configure.py 
b/CryptoPkg/Library/OpensslLib/configure.py
new file mode 100755
index 00..fc7f16ddb9
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/configure.py
@@ -0,0 +1,395 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+import os
+import sys
+import json
+import shutil
+import pprint
+import argparse
+import subprocess
+
+def openssl_configure(openssldir, target, ec = True):
+""" Run openssl Configure script. """
+cmdline = [
+'perl',
+'Configure',
+'--config=../UefiAsm.conf',
+'--api=1.1.1',
+'--with-rand-seed=none',
+target,
+'no-afalgeng',
+'no-aria',
+'no-async',
+'no-autoerrinit',
+'no-autoload-config',
+'no-bf',
+'no-blake2',
+'no-camellia',
+'no-capieng',
+'no-cast',
+'no-chacha',
+'no-cmac',
+'no-cmp',
+'no-cms',
+'no-ct',
+'no-deprecated',
+'no-des',
+'no-dgram',
+'no-dsa',
+'no-dso',
+'no-dtls',
+'no-dtls1-method',
+'no-dtls1_2-method',
+'no-dynamic-engine',
+'no-ec2m',
+'no-engine',
+'no-err',
+'no-filenames',
+'no-gost',
+'no-hw',
+'no-idea',
+'no-ktls',
+'no-makedepend',
+'no-module',
+'no-md4',
+'no-mdc2',
+'no-multiblock',
+'no-nextprotoneg',
+'no-pic',
+'no-psk',
+'no-ocb',
+'no-ocsp',
+'no-padlockeng',
+'no-poly1305',
+'no-posix-io',
+'no-rc2',
+'no-rc4',
+'no-rc5',
+'no-rfc3779',
+'no-rmd160',
+'no-scrypt',
+'no-seed',
+'no-shared',
+'no-siphash',
+'no-siv',
+'no-sm2',
+'no-sm4',
+'no-sock',
+'no-srp',
+'no-srtp',
+'no-ssl',
+'no-ssl3-method',
+'no-ssl-trace',
+'no-static-engine',
+'no-stdio',
+'no-threads',
+'no-tls1_3',
+'no-ts',
+'no-ui-console',
+'no-whirlpool',
+'disable-legacy',
+]
+if not ec:
+cmdline += [ 'no-ec', ]
+print('')
+print(f'# -*-  configure openssl for {target} (ec={ec})  -*-')
+rc = subprocess.run(cmdline, cwd = openssldir,
+stdout = subprocess.PIPE,
+stderr = subprocess.PIPE)
+if rc.returncode:
+print(rc.stdout)
+print(rc.stderr)
+sys.exit(rc.returncode)
+
+def 

[edk2-devel] [PATCH V2 05/29] CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

New naming convention for the configs:  UEFI-${efiarch}-${compiler}.

Signed-off-by: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/UefiAsm.conf | 41 +++
 1 file changed, 12 insertions(+), 29 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/UefiAsm.conf 
b/CryptoPkg/Library/OpensslLib/UefiAsm.conf
index c3940b5886..907582f93e 100644
--- a/CryptoPkg/Library/OpensslLib/UefiAsm.conf
+++ b/CryptoPkg/Library/OpensslLib/UefiAsm.conf
@@ -8,41 +8,24 @@
 ##
 
 my %targets = (
- UEFI
-"UEFI-x86" => {
-perlasm_scheme  => "win32n",
-# inherit_from=> [ "UEFI",  asm("x86_asm") ],
+"UEFI-IA32-MSFT" => {
 inherit_from=> [ "UEFI" ],
-cpuid_asm_src   => "x86cpuid.s",
-aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86.s aesni-x86.s",
-sha1_asm_src=> "sha1-586.s sha256-586.s sha512-586.s",
-modes_asm_src   => "ghash-x86.s",
+perlasm_scheme  => "win32n",
+asm_arch=> "x86",
 },
-"UEFI-x86-GCC" => {
-perlasm_scheme  => "elf",
-# inherit_from=> [ "UEFI",  asm("x86_asm") ],
+"UEFI-IA32-GCC" => {
 inherit_from=> [ "UEFI" ],
-cpuid_asm_src   => "x86cpuid.s",
-aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86.s aesni-x86.s",
-sha1_asm_src=> "sha1-586.s sha256-586.s sha512-586.s",
-modes_asm_src   => "ghash-x86.s",
+perlasm_scheme  => "elf",
+asm_arch=> "x86",
 },
-"UEFI-x86_64" => {
-perlasm_scheme  => "nasm",
-# inherit_from=> [ "UEFI",  asm("x86_64_asm") ],
+"UEFI-X64-MSFT" => {
 inherit_from=> [ "UEFI" ],
-cpuid_asm_src   => "x86_64cpuid.s",
-aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s 
aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s",
-sha1_asm_src=> "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s 
sha1-mb-x86_64.s sha256-mb-x86_64.s",
-modes_asm_src   => "ghash-x86_64.s aesni-gcm-x86_64.s",
+perlasm_scheme  => "nasm",
+asm_arch=> "x86_64",
 },
-"UEFI-x86_64-GCC" => {
-perlasm_scheme  => "elf",
-# inherit_from=> [ "UEFI",  asm("x86_64_asm") ],
+"UEFI-X64-GCC" => {
 inherit_from=> [ "UEFI" ],
-cpuid_asm_src   => "x86_64cpuid.s",
-aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s 
aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s",
-sha1_asm_src=> "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s 
sha1-mb-x86_64.s sha256-mb-x86_64.s",
-modes_asm_src   => "ghash-x86_64.s aesni-gcm-x86_64.s",
+perlasm_scheme  => "elf",
+asm_arch=> "x86_64",
 },
 );
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107486): https://edk2.groups.io/g/devel/message/107486
Mute This Topic: https://groups.io/mt/100520580/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH V2 00/29] CryptoPkg: Update OpenSSL submodule to 3.0.9

2023-08-02 Thread Li, Yi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3466

According to https://www.OpenSSL.org/policies/releasestrat.html,
OpenSSL Version 1.1.1 will be supported until 2023-09-11 (LTS).
Need to upgrade OpenSsl to 3.0.9 before 1.1.1 support stopping.

PR: https://github.com/tianocore/edk2/pull/4692

V2 Change:
CryptoPkg: use UEFI provider as default:
Fix typo of kdf provider.

Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Cc: Gerd Hoffmann 

Gerd Hoffmann (15):
  CryptoPkg/openssl: update submodule to openssl-3.0.9
  CryptoPkg/openssl: cleanup all openssl1.1.1 generated files and code
  CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0
  CryptoPkg/openssl: add openssl3 configure scripts
  CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0
  CryptoPkg/BaseCryptLib: no openssl deprecation warnings please
  CryptoPkg/BaseCryptLib: adapt CryptSm3.c to openssl 3.0 changes.
  CryptoPkg/BaseCryptLib: drop BIO_* dummy functions
  CryptoPkg/TlsLib: ERR_GET_FUNC is gone
  CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes
  CryptoPkg/openssl: move compiler_flags to buildinf.c
  CryptoPkg/openssl: store dummy update for openssl 3.0
  CryptoPkg/openssl: adapt EcSm2Null.c for openssl 3.0
  CryptoPkg/TlsLib: use unsigned long for ErrorCode
  CryptoPkg/openssl: update CI config for openssl 3.0

Yi Li (14):
  CryptoPkg: Move all UEFI implement of openssl to OpensslStub
  CryptoPkg: use UEFI provider as default
  CryptoPkg: adapt 3.0 change in SslNull.c
  CryptoPkg: Add instrinsics to support building openssl3 on IA32
windows
  CryptoPkg: disable C4133 warning in openssl libraries
  CryptoPkg: Align with 4096 when build with OpensslFullAccel
  CryptoPkg: Enable memcpy sys call in RISCV64 build
  CryptoPkg: add missing gcc instructions
  CryptoPkg: add define of maximum unsigned size_t
  CryptoPkg: add implemention of _ftol2_sse() to avoid build error
  CryptoPkg: add more dummy implement of openssl for size optimization
  CryptoPkg: run configure.py to update all generated files
  CryptoPkg: remove strcmp to syscall
  CryptoPkg: remove BN and EC accel for size optimization

 CryptoPkg/CryptoPkg.ci.yaml   |   54 +-
 CryptoPkg/CryptoPkg.dec   |4 +
 CryptoPkg/CryptoPkg.dsc   |   12 +-
 .../Library/BaseCryptLib/Hash/CryptSm3.c  |   14 +-
 .../Library/BaseCryptLib/InternalCryptLib.h   |2 +
 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |   36 +-
 .../SysCall/UnitTestHostCrtWrapper.c  |   25 -
 CryptoPkg/Library/Include/CrtLibSupport.h |1 +
 .../Library/Include/openssl/opensslconf.h |  333 -
 .../IntrinsicLib/Ia32/MathDivModU64x64.c  |   23 +
 .../Library/IntrinsicLib/Ia32/MathDivS64x64.c |   22 +
 .../Library/IntrinsicLib/Ia32/MathDivU64x64.c |   22 +
 .../Library/IntrinsicLib/Ia32/MathFtol.c  |   12 +
 .../Library/IntrinsicLib/Ia32/MathLldiv.asm   |  203 +
 .../Library/IntrinsicLib/Ia32/MathModU64x64.c |   26 +
 .../Library/IntrinsicLib/Ia32/MathUlldiv.asm  |  157 +
 .../Library/IntrinsicLib/Ia32/MathUlldvrm.asm |  184 +
 .../Library/IntrinsicLib/Ia32/MathUllrem.asm  |  163 +
 .../Library/IntrinsicLib/IntrinsicLib.inf |   11 +-
 .../Library/IntrinsicLib/MemoryIntrinsics.c   |9 -
 .../IA32/crypto/modes/ghash-x86.nasm  |  700 --
 .../OpensslLib/IA32/crypto/sha/sha1-586.nasm  | 1394 ---
 .../IA32/crypto/sha/sha256-586.nasm   | 3364 ---
 .../IA32/crypto/sha/sha512-586.nasm   |  579 --
 .../IA32Gcc/crypto/modes/ghash-x86.S  |  703 --
 .../OpensslLib/IA32Gcc/crypto/sha/sha1-586.S  | 1389 ---
 .../IA32Gcc/crypto/sha/sha256-586.S   | 3356 ---
 .../IA32Gcc/crypto/sha/sha512-586.S   |  574 --
 .../Library/OpensslLib/OpenSSL-HOWTO.txt  |4 +-
 .../OpensslGen/IA32-GCC/crypto/aes/aes-586.S  | 3320 +++
 .../IA32-GCC}/crypto/aes/aesni-x86.S  |  141 +-
 .../IA32-GCC}/crypto/aes/vpaes-x86.S  |   92 +-
 .../OpensslGen/IA32-GCC/crypto/bn/bn-586.S| 1572 
 .../OpensslGen/IA32-GCC/crypto/bn/co-586.S| 1290 +++
 .../OpensslGen/IA32-GCC/crypto/bn/x86-gf2m.S  |  374 +
 .../OpensslGen/IA32-GCC/crypto/bn/x86-mont.S  |  494 +
 .../IA32-GCC/crypto/ec/ecp_nistz256-x86.S | 5290 +++
 .../OpensslGen/IA32-GCC/crypto/md5/md5-586.S  |  700 ++
 .../IA32-GCC/crypto/modes/ghash-x86.S | 1316 +++
 .../OpensslGen/IA32-GCC/crypto/sha/sha1-586.S | 4006 
 .../IA32-GCC/crypto/sha/sha256-586.S  | 6804 ++
 .../IA32-GCC/crypto/sha/sha512-586.S  | 2850 ++
 .../IA32-GCC}/crypto/x86cpuid.S   |  252 +-
 .../IA32-MSFT/crypto/aes/aes-586.nasm | 3211 +++
 .../IA32-MSFT}/crypto/aes/aesni-x86.nasm  |   14 +-
 .../IA32-MSFT}/crypto/aes/vpaes-x86.nasm  |   10 -
 .../IA32-MSFT/crypto/bn/bn-586.nasm   | 1515 +++
 .../IA32-MSFT/crypto/bn/co-586.nasm   | 1252 +++
 .../IA32-MSFT/crypto/bn/x86-gf2m.nasm |  345 +
 .../IA32-MSFT/crypto/bn/x86-mont.nasm   

[edk2-devel] [PATCH V2 01/29] CryptoPkg/openssl: update submodule to openssl-3.0.9

2023-08-02 Thread Li, Yi
From: Gerd Hoffmann 

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/Library/OpensslLib/openssl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/OpensslLib/openssl 
b/CryptoPkg/Library/OpensslLib/openssl
index 70c2912f63..de90e54bbe 16
--- a/CryptoPkg/Library/OpensslLib/openssl
+++ b/CryptoPkg/Library/OpensslLib/openssl
@@ -1 +1 @@
-Subproject commit 70c2912f635aac8ab28629a2b5ea0c09740d2bda
+Subproject commit de90e54bbe82e5be4fb9608b6f5c308bb837d355
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107482): https://edk2.groups.io/g/devel/message/107482
Mute This Topic: https://groups.io/mt/100520569/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Event: TianoCore Community Meeting - APAC/NAMO - Thursday, August 3, 2023 #cal-reminder

2023-08-02 Thread Group Notification
*Reminder: TianoCore Community Meeting - APAC/NAMO*

*When:*
Thursday, August 3, 2023
7:30pm to 8:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_Y2M1NDE3ODYtN2M3Yy00MDMxLTk3OWYtMTlkNjhlNWFlMjA2%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d

*Organizer:* Miki Demeter

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1981592 )

*Description:*



Microsoft Teams meeting

*Join on your computer or mobile app*

Click here to join the meeting ( 
https://teams.microsoft.com/l/meetup-join/19%3ameeting_Y2M1NDE3ODYtN2M3Yy00MDMxLTk3OWYtMTlkNjhlNWFlMjA2%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d
 )

Meeting ID: 283 318 374 436
Passcode: 633zLo

Download Teams ( https://www.microsoft.com/en-us/microsoft-teams/download-app ) 
| Join on the web ( https://www.microsoft.com/microsoft-teams/join-a-meeting )

*Join with a video conferencing device*

te...@conf.intel.com

Video Conference ID: 119 493 012 8

Alternate VTC instructions ( 
https://conf.intel.com/teams/?conf=1194930128=teams=conf.intel.com=test_call
 )

Learn More ( https://aka.ms/JoinTeamsMeeting ) | Meeting options ( 
https://teams.microsoft.com/meetingOptions/?organizerId=6e4ce4c4-1242-431b-9a51-92cd01a5df3c=46c98d88-e344-4ed4-8496-4ed7712e255d=19_meeting_Y2M1NDE3ODYtN2M3Yy00MDMxLTk3OWYtMTlkNjhlNWFlMjA2@thread.v2=0=en-US
 )




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107479): https://edk2.groups.io/g/devel/message/107479
Mute This Topic: https://groups.io/mt/100519336/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH edk2-platforms v1 2/3] Platform/ARM: FVP: Specify TRBE interrupt in MADT GICC

2023-08-02 Thread Jeshua Smith via groups.io
This code depends on ArmReadIdAA64Dfr0(), which as far as I can tell is not 
present in the EDK2 repo or the patch series mentioned in your 0/3 message.

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Jeshua Smith via 
groups.io
Sent: Tuesday, August 1, 2023 9:38 AM
To: devel@edk2.groups.io; sami.muja...@arm.com
Cc: ardb+tianoc...@kernel.org; thomas.abra...@arm.com; pierre.gond...@arm.com; 
anshuman.khand...@arm.com; matteo.carl...@arm.com; akanksha.ja...@arm.com; 
sibel.allin...@arm.com; n...@arm.com
Subject: Re: [edk2-devel] [PATCH edk2-platforms v1 2/3] Platform/ARM: FVP: 
Specify TRBE interrupt in MADT GICC

External email: Use caution opening links or attachments


This comment in the code looks wrong:

+// TRBE Interrupt is PPI 13 on FVP model.
+TrbeInterrupt = 31;

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Sami Mujawar via 
groups.io
Sent: Tuesday, July 25, 2023 4:31 AM
To: devel@edk2.groups.io
Cc: Sami Mujawar ; ardb+tianoc...@kernel.org; 
thomas.abra...@arm.com; pierre.gond...@arm.com; anshuman.khand...@arm.com; 
matteo.carl...@arm.com; akanksha.ja...@arm.com; sibel.allin...@arm.com; 
n...@arm.com
Subject: [edk2-devel] [PATCH edk2-platforms v1 2/3] Platform/ARM: FVP: Specify 
TRBE interrupt in MADT GICC

External email: Use caution opening links or attachments


When TRBE is enabled the FVP model uses the PPI 15 (i.e. INT ID 31) as the TRBE 
interrupt.
Ref: https://www.kernel.org/doc/Documentation/
devicetree/bindings/arm/arm,trace-buffer-extension.yaml

Therefore, check the debug feature register ID_AA64DFR0_EL1.TraceBuffer field 
to see if TRBE is enabled and configure the TRBE interrupt in the GICC 
structure in the MADT ACPI table.

Note: To enable TRBE support in the FVP REvC model 1. Build TF-A with the 
CTX_INCLUDE_AARCH32_REGS=0
   build flag set, otherwise this results in an
   exception when booting TF-A.
2. Set the model parameters to enable TRBE
-C cluster0.has_trbe=1 -C cluster1.has_trbe=1

Signed-off-by: Sami Mujawar 
---
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
  | 39 
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 |  3 +-
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 
4df2d6cdae58df344804a8b41208a3adb8ee0110..03393905be1c627b7cdbaa0efed33e920072c8cb
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager
+++ Dxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
 /** @file
   Configuration Manager Dxe

-  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,8 +38,8 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
   {
 // FADT Table
 {
-  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+  EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
   NULL
 },
@@ -51,8 +52,8 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
 },
 // MADT Table
 {
-  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
   NULL
 },
@@ -109,15 +110,15 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo 
= {
   },

   // Boot architecture information
-  { EFI_ACPI_6_3_ARM_PSCI_COMPLIANT },  // BootArchFlags
+  { EFI_ACPI_6_5_ARM_PSCI_COMPLIANT },  // BootArchFlags

 #ifdef HEADLESS_PLATFORM
   // Fixed feature flag information
-  { EFI_ACPI_6_3_HEADLESS },// Fixed feature flags
+  { EFI_ACPI_6_5_HEADLESS },// Fixed feature flags
 #endif

   // Power management profile information
-  { EFI_ACPI_6_3_PM_PROFILE_ENTERPRISE_SERVER },// PowerManagement Profile
+  { EFI_ACPI_6_5_PM_PROFILE_ENTERPRISE_SERVER },// PowerManagement Profile

   /* GIC CPU Interface information
  GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency) 
@@ -474,6 +475,9 @@ InitializePlatformRepository (
   )
 {
   EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+  UINT64 DbgFeatures;
+  UINTN  Index;
+  

[edk2-devel] [PATCH] OvmfPkg/BaseMemEncryptTdxLib: Make SetOrClearSharedBit() handle retry error

2023-08-02 Thread Isaku Yamahata
From: Isaku Yamahata 

TDG.VP.VMCALL can return TDG.VP.VMCALL_RETRY when the length is too
large so that VMM can avoid too long processing time.  The caller should
retry with the updated starting GPA on the error.  Add check
TDG.VP.VMCALL_RETRY check.

Signed-off-by: Isaku Yamahata 
---
 MdePkg/Include/IndustryStandard/Tdx.h  |  4 
 MdePkg/Library/BaseLib/X64/TdVmcall.nasm   |  4 +---
 .../Library/BaseMemEncryptTdxLib/MemoryEncryption.c| 10 --
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Tdx.h 
b/MdePkg/Include/IndustryStandard/Tdx.h
index 81df1361842b..4ea2960a70f9 100644
--- a/MdePkg/Include/IndustryStandard/Tdx.h
+++ b/MdePkg/Include/IndustryStandard/Tdx.h
@@ -103,6 +103,10 @@
 #define TDVMCALL_REPORT_FATAL_ERR0x10003
 #define TDVMCALL_SETUP_EVENT_NOTIFY  0x10004
 
+// TDVMCALL API sub-function Completion Status Codes
+#define TDG_VP_VMCALL_SUCCESS   0x
+#define TDG_VP_VMCALL_RETRY 0x0001
+
 #pragma pack(1)
 typedef struct {
   UINT64Data[6];
diff --git a/MdePkg/Library/BaseLib/X64/TdVmcall.nasm 
b/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
index 5ecc10b17193..8dd9bfcbfa14 100644
--- a/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
+++ b/MdePkg/Library/BaseLib/X64/TdVmcall.nasm
@@ -133,9 +133,7 @@ ASM_PFX(TdVmCall):
test r9, r9
jz .no_return_data
 
-   ; On success, propagate TDVMCALL output value to output param
-   test rax, rax
-   jnz .no_return_data
+   ; Propagate TDVMCALL output value to output param
mov [r9], r11
 .no_return_data:
tdcall_regs_postamble
diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c 
b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
index a01dc98852b8..d55c2a34a44e 100644
--- a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
+++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
@@ -526,6 +526,8 @@ SetOrClearSharedBit (
   UINT64TdStatus;
   EFI_STATUSStatus;
   EDKII_MEMORY_ACCEPT_PROTOCOL  *MemoryAcceptProtocol;
+  PHYSICAL_ADDRESS  TmpPhysicalAddress;
+  UINT64TmpLength;
 
   AddressEncMask = GetMemEncryptionAddressMask ();
 
@@ -540,8 +542,12 @@ SetOrClearSharedBit (
 PhysicalAddress   &= ~AddressEncMask;
   }
 
-  TdStatus = TdVmCall (TDVMCALL_MAPGPA, PhysicalAddress, Length, 0, 0, NULL);
-  if (TdStatus != 0) {
+  TmpPhysicalAddress = PhysicalAddress;
+  do {
+TmpLength = PhysicalAddress + Length - TmpPhysicalAddress;
+TdStatus = TdVmCall (TDVMCALL_MAPGPA, TmpPhysicalAddress, TmpLength, 0, 0, 
);
+  } while (TdStatus == TDG_VP_VMCALL_RETRY);
+  if (TdStatus != TDG_VP_VMCALL_SUCCESS) {
 DEBUG ((DEBUG_ERROR, "%a: TdVmcall(MAPGPA) failed with %llx\n", __func__, 
TdStatus));
 ASSERT (FALSE);
 return EFI_DEVICE_ERROR;

base-commit: 677f2c6f1509da21258e02957b869b71b008fc61
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107477): https://edk2.groups.io/g/devel/message/107477
Mute This Topic: https://groups.io/mt/100514591/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 6/6] AlderlakeOpenBoardPkg: Add Library Instances

2023-08-02 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kasbekar, Saloni  
Sent: Tuesday, August 01, 2023 3:18 PM
To: devel@edk2.groups.io
Cc: Kasbekar, Saloni ; Chaganty, Rangasai V 
; Desimone, Nathaniel L 
; Oram, Isaac W ; 
Chuang, Rosen 
Subject: [PATCH v2 6/6] AlderlakeOpenBoardPkg: Add Library Instances

Adds the following libraries
- BasePlatformHookLib
- PeiBoardConfigLib
- PeiGetFvInfoLib
- SmmSpiFlashCommonLib

Cc: Sai Chaganty 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Rosen Chuang 
Signed-off-by: Saloni Kasbekar 
---
 .../BasePlatformHookLib/BasePlatformHookLib.c |  38 
 .../BasePlatformHookLib.inf   |  44 
 .../PeiBoardConfigLib/PeiBoardConfigLib.c | 136 +++
 .../PeiBoardConfigLib/PeiBoardConfigLib.inf   |  56 +
 .../Library/PeiGetFvInfoLib/PeiGetFvInfoLib.c |  89 
 .../PeiGetFvInfoLib/PeiGetFvInfoLib.inf   |  34 +++
 .../SmmSpiFlashCommonLib.inf  |  49 
 .../SmmSpiFlashCommonLib/SpiFlashCommon.c | 215 ++
 .../SpiFlashCommonSmmLib.c|  60 +
 9 files changed, 721 insertions(+)
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/PeiBoardConfigLib/PeiBoardConfigLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/PeiBoardConfigLib/PeiBoardConfigLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/PeiGetFvInfoLib/PeiGetFvInfoLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/PeiGetFvInfoLib/PeiGetFvInfoLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommonSmmLib.c

diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c
 
b/Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c
new file mode 100644
index 00..cccb1e18cc
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/B
+++ asePlatformHookLib.c
@@ -0,0 +1,38 @@
+/** @file
+  Platform Hook Library instances
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+
+/**
+  Performs platform specific initialization required for the CPU to 
+access
+  the hardware associated with a SerialPortLib instance.  This function 
+does
+  not initialize the serial port hardware itself.  Instead, it 
+initializes
+  hardware devices that are required for the CPU to access the serial 
+port
+  hardware.  This function may be called more than once.
+
+  @retval RETURN_SUCCESS   The platform specific initialization succeeded.
+  @retval RETURN_DEVICE_ERROR  The platform specific initialization could not 
be completed.
+
+**/
+RETURN_STATUS
+EFIAPI
+PlatformHookSerialPortInitialize (
+  VOID
+  )
+{
+
+  //
+  // Enable I/O decoding for COM1(3F8h-3FFh), COM2(2F8h-2FFh), I/O port 
2Eh/2Fh, 4Eh/4Fh, 60h/64Fh and 62h/66h.
+  //
+  PchLpcIoDecodeRangesSet (PcdGet16 (PcdLpcIoDecodeRange));  
+ PchLpcIoEnableDecodingSet (PcdGet16 (PchLpcIoEnableDecoding));
+
+  return RETURN_SUCCESS;
+}
diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.inf
 
b/Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.inf
new file mode 100644
index 00..b77724d5ab
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Library/BasePlatformHookLib/B
+++ asePlatformHookLib.inf
@@ -0,0 +1,44 @@
+### @file
+# Platform Hook Library instance for Alderlake Mobile/Desktop CRB.
+#
+#   Copyright (c) 2022, Intel Corporation. All rights reserved.
+#   SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION= 0x00010017
+  BASE_NAME  = BasePlatformHookLib
+  FILE_GUID  = E22ADCC6-ED90-4A90-9837-C8E7FF9E963D
+  VERSION_STRING = 1.0
+  MODULE_TYPE= BASE
+  LIBRARY_CLASS  = PlatformHookLib
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC #
+
+[LibraryClasses]
+  BaseLib
+  IoLib
+  PciSegmentLib
+  PciLib
+  PchCycleDecodingLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+  AlderlakeOpenBoardPkg/OpenBoardPkg.dec
+  AlderlakeSiliconPkg/SiPkg.dec
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress## CONSUMES
+
+[FixedPcd]
+  

Re: [edk2-devel] [PATCH v2 5/6] AlderlakeOpenBoardPkg: Adds the Policy Module

2023-08-02 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kasbekar, Saloni  
Sent: Tuesday, August 01, 2023 3:18 PM
To: devel@edk2.groups.io
Cc: Kasbekar, Saloni ; Chaganty, Rangasai V 
; Desimone, Nathaniel L 
; Oram, Isaac W ; 
Chuang, Rosen 
Subject: [PATCH v2 5/6] AlderlakeOpenBoardPkg: Adds the Policy Module

Adds the following libraries within the Policy module
- DxeSiliconPolicyUpdateLib
- PeiPolicyUpdateLib
- PeiSiliconPolicyUpdateLib

Cc: Sai Chaganty 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Rosen Chuang 
Signed-off-by: Saloni Kasbekar 
---
 .../DxeSaPolicyInit.c |  64 +++
 .../DxeSiliconPolicyUpdateLate.c  |  78 
 .../DxeSiliconPolicyUpdateLib.inf |  53 +++
 .../PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c   | 114 +
 .../PeiPolicyUpdateLib/PeiCpuPolicyUpdate.h   |  31 ++
 .../PeiCpuPolicyUpdatePreMem.c|  93 +
 .../PeiPolicyUpdateLib/PeiPchPolicyUpdate.c   | 210 ++
 .../PeiPolicyUpdateLib/PeiPchPolicyUpdate.h   |  24 ++
 .../PeiPchPolicyUpdatePreMem.c| 124 ++
 .../PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf | 208 ++
 .../PeiPolicyUpdateLib/PeiSaPolicyUpdate.c| 214 ++
 .../PeiPolicyUpdateLib/PeiSaPolicyUpdate.h|  27 ++
 .../PeiSaPolicyUpdatePreMem.c | 389 ++
 .../PeiSiliconPolicyUpdateLib.inf |  65 +++
 .../PeiSiliconPolicyUpdatePostMem.c   |  39 ++
 .../PeiSiliconPolicyUpdatePreMem.c|  37 ++
 16 files changed, 1770 insertions(+)
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLate.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdate.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdatePreMem.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdatePostMem.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdatePreMem.c

diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c
 
b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c
new file mode 100644
index 00..da2f568e07
--- /dev/null
+++ 
b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c
@@ -0,0 +1,64 @@
+/** @file
+  This file initialises and Installs GopPolicy Protocol.
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+EFI_STATUS
+EFIAPI
+CreateSaDxeConfigBlocks (
+  IN OUT  VOID  **SaPolicy
+  );
+
+EFI_STATUS
+EFIAPI
+SaInstallPolicyProtocol (
+  IN  EFI_HANDLE  ImageHandle,
+  IN  VOID*SaPolicy
+  );
+
+/**
+  Initialize SA DXE Policy
+
+  @param[in] ImageHandle  Image handle of this driver.
+
+  @retval EFI_SUCCESS Initialization complete.
+  @retval EFI_UNSUPPORTED The chipset is unsupported by this driver.
+  @retval EFI_OUT_OF_RESOURCESDo not have enough resources to initialize 
the driver.
+  @retval EFI_DEVICE_ERRORDevice error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+SaPolicyInitDxe (
+  IN EFI_HANDLE   ImageHandle
+  )
+{
+  EFI_STATUS   Status;
+  SA_POLICY_PROTOCOL   *SaPolicy;
+
+  //
+  // Call CreateSaDxeConfigBlocks to create & initialize platform policy 

Re: [edk2-devel] [PATCH v2 4/6] AlderlakeOpenBoardPkg: Add ACPI module

2023-08-02 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kasbekar, Saloni  
Sent: Tuesday, August 01, 2023 3:18 PM
To: devel@edk2.groups.io
Cc: Kasbekar, Saloni ; Chaganty, Rangasai V 
; Desimone, Nathaniel L 
; Oram, Isaac W ; 
Chuang, Rosen 
Subject: [PATCH v2 4/6] AlderlakeOpenBoardPkg: Add ACPI module

Adds the MinDsdt driver

Cc: Sai Chaganty 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Rosen Chuang 
Signed-off-by: Saloni Kasbekar 
---
 .../Acpi/MinDsdt/MinDsdt.asl  |  68 +
 .../Acpi/MinDsdt/MinDsdt.c| 232 ++
 .../Acpi/MinDsdt/MinDsdt.inf  |  48 
 3 files changed, 348 insertions(+)
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.asl
 create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.inf

diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.asl 
b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.asl
new file mode 100644
index 00..be110145bc
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.asl
@@ -0,0 +1,68 @@
+/** @file
+  ACPI minimum DSDT table
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock (
+  "DSDT.aml",
+  "DSDT",
+  0x01, // DSDT revision.
+// A Revision field value greater than or equal to 2 signifies that 
integers
+// declared within the Definition Block are to be evaluated as 64-bit 
values
+  "INTEL ",   // OEM ID (6 byte string)
+  "MIN ",// OEM table ID  (8 byte string)
+  0x00 // OEM version of DSDT table (4 byte Integer)
+)
+
+// BEGIN OF ASL SCOPE
+{
+  Scope(\_SB) {
+  
+//-
+--
+  // Begin PCI tree object scope
+  //---
+Device(PCI0) { // PCI Bridge "Host Bridge"
+  Name(_HID, EISAID("PNP0A08")) // Indicates PCI Express/PCI-X Mode2 host 
hierarchy
+  Name(_CID, EISAID("PNP0A03")) // To support legacy OS that doesn't 
understand the new HID
+  Name(_SEG, 0)
+  Method(^BN00, 0){ return(0x) }  // Returns default Bus number for 
Peer PCI busses. Name can be overriden with control method placed directly 
under Device scope
+  Method(_BBN, 0){ return(BN00()) } // Bus number, optional for the Root 
PCI Bus
+  Name(_UID, 0x)  // Unique Bus ID, optional
+  Name(BUF0,ResourceTemplate()
+  {
+//
+// PCI Configuration Registers ( 0x0CF8 - 0x0CFF )
+//
+Io(Decode16,0x0CF8,0x0CF8,1,0x08)
+//
+// PCI MMIO space
+//
+DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,NonCacheable,
+  ReadWrite,0x00,0x00,0x00,0x00,0x00,,,PM01)
+  })
+  Method(_CRS,0,Serialized)
+  {
+//
+// Create pointers to Memory Sizing values.
+//
+CreateDwordField(BUF0, ^PM01._MIN,M1MN)
+CreateDwordField(BUF0, ^PM01._MAX,M1MX)
+CreateDwordField(BUF0, ^PM01._LEN,M1LN)
+
+//
+// Set Memory Size Values. TLUD represents bits 31:20 of phyical
+// TOM, so shift these bits into the correct position and fix up
+// the Memory Region available to PCI.
+//
+Subtract 
(FixedPcdGet32(PcdPciReservedMemLimit),FixedPcdGet32(PcdPciReservedMemBase),M1LN)
+Store (FixedPcdGet32(PcdPciReservedMemBase), M1MN)
+Subtract (FixedPcdGet32(PcdPciReservedMemLimit), 1, M1MX)
+
+Return(BUF0)
+  }
+}
+  }
+}// End of ASL File
+
diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c 
b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c
new file mode 100644
index 00..08709a43cd
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c
@@ -0,0 +1,232 @@
+/** @file
+  Min DSDT Driver
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+//
+// Function implementations
+//
+
+/**
+  Locate the first instance of a protocol.  If the protocol requested 
+is an
+  FV protocol, then it will return the first FV that contains the ACPI 
+table
+  storage file.
+
+  @param[in]  Protocol   The protocol to find.
+  @param[in]  FfsGuidThe FFS that contains the ACPI table.
+  @param[out] Instance   Return pointer to the first instance of the 
protocol.
+
+  @retval EFI_SUCCESS   The function completed successfully.
+  @retval EFI_NOT_FOUND The protocol could not be located.
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to find the 
protocol.
+**/

Re: [edk2-devel] [edk2-platforms][PATCH V5-2] IpmiFeaturePkg:Provided multiple IPMI interface support in DXE and SMM

2023-08-02 Thread Isaac Oram
Pushed as 3037c13015016f7c398da37eabe33fb0961dc490

Note I fixed PatchCheck.py issues and committed in an order that doesn't break 
git bisect.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107473): https://edk2.groups.io/g/devel/message/107473
Mute This Topic: https://groups.io/mt/100352689/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH V5-1] IpmiFeaturePkg:Provided multiple IPMI interface support in PEI

2023-08-02 Thread Isaac Oram
Pushed as 421e64019d4622b049f510ba8eef7c82fba7b32d

Note I fixed PatchCheck.py issues and committed in an order that doesn't break 
git bisect.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107472): https://edk2.groups.io/g/devel/message/107472
Mute This Topic: https://groups.io/mt/100352666/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH V5-3] IpmiFeaturePkg:Provided multiple IPMI interface support in Library

2023-08-02 Thread Isaac Oram
Pushed as e563c1c528f15d4224103f5c49559df620b5a655

Note I fixed PatchCheck.py issues and committed in an order that doesn't break 
git bisect.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107471): https://edk2.groups.io/g/devel/message/107471
Mute This Topic: https://groups.io/mt/100352699/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to 3.0.9

2023-08-02 Thread Leif Lindholm
I am a little bit nervous about introducing this massive change so late in the 
cycle,
and am not sure whether any deferral of the soft freeze would be sufficient to
change that.
My preference would be having this introduced right after the stable tag,
giving it a full cycle of enforced testing before the next stable tag.

*But* I'm probably less vested in that outcome than some others, and am happy
to leave the call to the CryptoPkg (and other affected) maintainers.

/
Leif

> -Original Message-
> From: Kinney, Michael D 
> Sent: Wednesday, August 2, 2023 5:42 PM
> To: devel@edk2.groups.io; Gao, Liming ; Li, Yi1
> 
> Cc: Yao, Jiewen ; Lu, Xiaoyu1 ;
> Jiang, Guomin ; 'Gerd Hoffmann'
> ; Andrew Fish (af...@apple.com) ;
> Leif Lindholm ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL
> submodule to 3.0.9
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary
> of any links or attachments, and do not enable macros.
> 
> Hi Liming,
> 
> I have added Andrew and Leif to this thread so we can discuss
> if the release date need to be adjusted.
> 
> Mike
> 
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of
> gaoliming
> > via groups.io
> > Sent: Wednesday, August 2, 2023 3:07 AM
> > To: devel@edk2.groups.io; Li, Yi1 
> > Cc: Yao, Jiewen ; Lu, Xiaoyu1
> > ; Jiang, Guomin ; 'Gerd
> > Hoffmann' 
> > Subject: 回复: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL
> > submodule to 3.0.9
> >
> > Yi:
> >   Thanks for your great work to update openssl 3.0. The commit message
> > shows this patch set must catch edk2 202308 stable tag. Right?
> >   Edk2 202308 stable tag will start soft feature free from Aug 7th (next
> > Monday). That means this patch set needs to pass code review in one
> > week.
> >
> > Jiwen, Gerd:
> >   Can you give your comments for this patch set this week? If you need
> > more time, I will raise the request to defer the soft feature freeze.
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Li, Yi
> > > 发送时间: 2023年7月28日 14:40
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Yi Li ; Jiewen Yao ;
> > Xiaoyu
> > > Lu ; Guomin Jiang ;
> Gerd
> > > Hoffmann 
> > > 主题: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL
> submodule to
> > > 3.0.9
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3466
> > >
> > > According to https://www.OpenSSL.org/policies/releasestrat.html,
> > > OpenSSL Version 1.1.1 will be supported until 2023-09-11 (LTS).
> > > Need to upgrade OpenSsl to 3.0.9 before 1.1.1 support stopping.
> > >
> > > PR: https://github.com/tianocore/edk2/pull/4692
> > >
> > > Cc: Jiewen Yao 
> > > Cc: Xiaoyu Lu 
> > > Cc: Guomin Jiang 
> > > Cc: Gerd Hoffmann 
> > > Gerd Hoffmann (15):
> > >   CryptoPkg/openssl: update submodule to openssl-3.0.9
> > >   CryptoPkg/openssl: cleanup all openssl1.1.1 generated files and code
> > >   CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0
> > >   CryptoPkg/openssl: add openssl3 configure scripts
> > >   CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0
> > >   CryptoPkg/BaseCryptLib: no openssl deprecation warnings please
> > >   CryptoPkg/BaseCryptLib: adapt CryptSm3.c to openssl 3.0 changes.
> > >   CryptoPkg/BaseCryptLib: drop BIO_* dummy functions
> > >   CryptoPkg/TlsLib: ERR_GET_FUNC is gone
> > >   CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes
> > >   CryptoPkg/openssl: move compiler_flags to buildinf.c
> > >   CryptoPkg/openssl: store dummy update for openssl 3.0
> > >   CryptoPkg/openssl: adapt EcSm2Null.c for openssl 3.0
> > >   CryptoPkg/TlsLib: use unsigned long for ErrorCode
> > >   CryptoPkg/openssl: update CI config for openssl 3.0
> > >
> > > Yi Li (14):
> > >   CryptoPkg: Move all UEFI implement of openssl to OpensslStub
> > >   CryptoPkg: use UEFI provider as default
> > >   CryptoPkg: adapt 3.0 change in SslNull.c
> > >   CryptoPkg: Add instrinsics to support building openssl3 on IA32
> > > windows
> > >   CryptoPkg: disable C4133 warning in openssl libraries
> > >   CryptoPkg: Align with 4096 when build with OpensslFullAccel
> > >   CryptoPkg: Enable memcpy sys call in RISCV64 build
> > >   CryptoPkg: add missing gcc instructions
> > >   CryptoPkg: add define of maximum unsigned size_t
> > >   CryptoPkg: add implemention of _ftol2_sse() to avoid build error
> > >   CryptoPkg: add more dummy implement of openssl for size optimization
> > >   CryptoPkg: run configure.py to update all generated files
> > >   CryptoPkg: remove strcmp to syscall
> > >   CryptoPkg: remove BN and EC accel for size optimization
> > >
> > >  CryptoPkg/CryptoPkg.ci.yaml   |   54 +-
> > >  CryptoPkg/CryptoPkg.dec   |4 +
> > >  CryptoPkg/CryptoPkg.dsc   |   12 +-
> > >  .../Library/BaseCryptLib/Hash/CryptSm3.c  |   14 +-
> > >  .../Library/BaseCryptLib/InternalCryptLib.h   |2 +
> > >  

Re: [edk2-devel] [PATCH v2 3/6] AlderlakeOpenBoardPkg/AlderlakePRvp: Add libraries

2023-08-02 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kasbekar, Saloni  
Sent: Tuesday, August 01, 2023 3:18 PM
To: devel@edk2.groups.io
Cc: Kasbekar, Saloni ; Chaganty, Rangasai V 
; Desimone, Nathaniel L 
; Oram, Isaac W ; 
Chuang, Rosen 
Subject: [PATCH v2 3/6] AlderlakeOpenBoardPkg/AlderlakePRvp: Add libraries

Adds the following library instances:
- BoardAcpiLib
- BoardInitLib

Cc: Sai Chaganty 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Rosen Chuang 
Signed-off-by: Saloni Kasbekar 
---
 .../SmmAlderlakePRvpAcpiEnableLib.c   |  50 +
 .../SmmMultiBoardAcpiSupportLib.c |  88 
 .../SmmMultiBoardAcpiSupportLib.inf   |  41 
 .../BoardAcpiLib/SmmSiliconAcpiEnableLib.c| 134 
 .../BoardInitLib/Pei/BoardPchInitPreMemLib.c  | 104 +
 .../BoardInitLib/Pei/BoardSaConfigPreMem.h|  73 +++
 .../BoardInitLib/Pei/BoardSaInitPreMemLib.c   | 160 ++
 .../Library/BoardInitLib/Pei/PeiDetect.c  |  62 ++
 .../BoardInitLib/Pei/PeiInitPostMemLib.c  | 100 +
 .../BoardInitLib/Pei/PeiInitPreMemLib.c   | 202 ++
 .../Pei/PeiMultiBoardInitPostMemLib.c |  45 
 .../Pei/PeiMultiBoardInitPostMemLib.inf   |  53 +
 .../Pei/PeiMultiBoardInitPreMemLib.c  |  89 
 .../Pei/PeiMultiBoardInitPreMemLib.inf| 149 +
 14 files changed, 1350 insertions(+)
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmAlderlakePRvpAcpiEnableLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/BoardPchInitPreMemLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/BoardSaConfigPreMem.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/BoardSaInitPreMemLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiDetect.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiInitPostMemLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiInitPreMemLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiMultiBoardInitPostMemLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiMultiBoardInitPostMemLib.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiMultiBoardInitPreMemLib.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiMultiBoardInitPreMemLib.inf

diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmAlderlakePRvpAcpiEnableLib.c
 
b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmAlderlakePRvpAcpiEnableLib.c
new file mode 100644
index 00..8dfc04c5f5
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAc
+++ piLib/SmmAlderlakePRvpAcpiEnableLib.c
@@ -0,0 +1,50 @@
+/** @file
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Enable Board Acpi
+
+  @param[in]  EnableSci Enable SCI if EnableSci parameters is True.
+
+  @retval EFI_SUCCESS   The function always return successfully.
+**/
+EFI_STATUS
+EFIAPI
+AdlBoardEnableAcpi (
+  IN BOOLEAN  EnableSci
+  )
+{
+  // enable additional board register
+  return EFI_SUCCESS;
+}
+
+/**
+  Disable Board Acpi
+
+  @param[in]  DisableSciDisable SCI if DisableSci parameters is True.
+
+  @retval EFI_SUCCESS   The function always return successfully.
+**/
+EFI_STATUS
+EFIAPI
+AdlBoardDisableAcpi (
+  IN BOOLEAN  DisableSci
+  )
+{
+  // enable additional board register
+  return EFI_SUCCESS;
+}
diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
 
b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
new file mode 100644
index 00..ea0f7c966b
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardAc
+++ piLib/SmmMultiBoardAcpiSupportLib.c
@@ -0,0 +1,88 @@
+/** @file
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 

Re: [edk2-devel] [PATCH v2 2/6] AlderlakeOpenBoardPkg: Add modules

2023-08-02 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kasbekar, Saloni  
Sent: Tuesday, August 01, 2023 3:18 PM
To: devel@edk2.groups.io
Cc: Kasbekar, Saloni ; Chaganty, Rangasai V 
; Desimone, Nathaniel L 
; Oram, Isaac W ; 
Chuang, Rosen 
Subject: [PATCH v2 2/6] AlderlakeOpenBoardPkg: Add modules

Adds the following modules:
-BiosInfo
-OpenBoardPlatformInit
-SBCVpdStructurePcd

Cc: Sai Chaganty 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Rosen Chuang 
Signed-off-by: Saloni Kasbekar 
---
 .../AlderlakeOpenBoardPkg/BiosInfo/BiosInfo.c | 196 +++
 .../BiosInfo/BiosInfo.inf |  84 +++
 .../OpenBoardPlatformInitPostMem.c| 233 ++
 .../OpenBoardPlatformInitPostMem.inf  |  75 ++
 .../SBCVpdStructurePcd/AllStructPCD.dsc   |  19 ++
 .../GpioTableAdlPPostMem.dsc  |  40 +++
 .../GpioTableAdlPPreMem.dsc   |  29 +++
 .../MrcDqDqsSPD/AdlPSpdMap.dsc| 138 +++
 .../PcieClocks/AdlPPcieClocks.dsc |  31 +++
 9 files changed, 845 insertions(+)
 create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/BiosInfo/BiosInfo.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoardPlatformInitPei/OpenBoardPlatformInitPostMem.c
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoardPlatformInitPei/OpenBoardPlatformInitPostMem.inf
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/SBCVpdStructurePcd/AllStructPCD.dsc
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/SBCVpdStructurePcd/GpioTableAdlPPostMem.dsc
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/SBCVpdStructurePcd/GpioTableAdlPPreMem.dsc
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/SBCVpdStructurePcd/MrcDqDqsSPD/AdlPSpdMap.dsc
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/SBCVpdStructurePcd/PcieClocks/AdlPPcieClocks.dsc

diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/BiosInfo/BiosInfo.c 
b/Platform/Intel/AlderlakeOpenBoardPkg/BiosInfo/BiosInfo.c
new file mode 100644
index 00..64462900de
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/BiosInfo/BiosInfo.c
@@ -0,0 +1,196 @@
+/** @file
+  PEIM to provide BiosInfo structure listing up all firmware volume's 
+base addresses, sizes,
+  attributes, and information associated to the firmware volume.
+  Primarily the structure is used on FIT table creation and Bpm.
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BASE_FV_SIZE 10
+
+#define FSP_WRAPPER_FV_SIZE 3
+
+#define TSN_MAC_ADDRESS_FV_SIZE 0
+
+#define BIOS_INFO_STRUCT_SIZE (BASE_FV_SIZE + FSP_WRAPPER_FV_SIZE + 
+TSN_MAC_ADDRESS_FV_SIZE)
+
+
+/*
+  BIOS_INFO structure is the base of the firmware volume layout for 
+Intel platform BIOS implementation
+  so security checker module can run based on the structure and throw 
+warnings, error or deadloop
+  when any unexpected firmware volumes are detected.
+
+  BIOS_INFO is recommended to support full entries of firmware volumes 
+present in a flash
+  with right type, attribute, version, flash map base address and size,
+  all associated information which is defined by BIOS_INFO_STRUCT structure.
+  - IBB firmware volumes, which are expected to be measured or/and verified
+by hardware base security solution to meet SecureBoot chain of trust
+(Intel BootGuard for example), have attribute 0x0.
+  - Post IBB firmware volumes, which are expected to be measured or/and 
verified
+by BIOS (TCG code for measurement, RSA2048SHA256Sign algorithm for 
verification for example),
+have attribute BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB.
+  - Else, follows Firmware Interface Table specification.
+*/
+#pragma pack (1)
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[BIOS_INFO_STRUCT_SIZE]; } BIOS_INFO; #pragma 
+pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+BIOS_INFO_SIGNATURE,
+BIOS_INFO_STRUCT_SIZE,
+0,
+  },
+  {
+{
+  FIT_TYPE_07_BIOS_STARTUP_MODULE,
+  BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT,
+  0x0100,
+  FixedPcdGet32 (PcdFlashNvStorageVariableSize) + FixedPcdGet32 
(PcdFlashNvStorageFtwWorkingSize) + FixedPcdGet32 
(PcdFlashNvStorageFtwSpareSize),
+  FixedPcdGet32 (PcdFlashNvStorageVariableBase)
+},
+{
+  FIT_TYPE_07_BIOS_STARTUP_MODULE,
+  BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,
+  0x0100,
+  FixedPcdGet32 (PcdFlashFvAdvancedSize),
+  FixedPcdGet32 (PcdFlashFvAdvancedBase)
+},
+{
+  FIT_TYPE_07_BIOS_STARTUP_MODULE,
+  BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,
+  0x0100,
+  FixedPcdGet32 (PcdFlashFvOptionalSize),
+  

Re: [edk2-devel][edk2-platforms][PATCH V5-1] IpmiFeaturePkg:Provided multiple IPMI interface support in PEI

2023-08-02 Thread Isaac Oram
Reviewed-by: Isaac Oram 

-Original Message-
From: Arun K  
Sent: Tuesday, July 25, 2023 8:36 AM
To: devel@edk2.groups.io; Arun K 
Cc: Oram, Isaac W ; Desimone, Nathaniel L 
; Ramkumar Krishnamoorthi ; 
Gao, Liming 
Subject: [edk2-devel][edk2-platforms][PATCH V5-1] IpmiFeaturePkg:Provided 
multiple IPMI interface support in PEI

Created IpmiTransport2 PPI/Protocol to support multiple
IPMI BMC Interface support such as KCS/BT/SSIF/IPMB with 2 API's
IpmiSubmitCommand2 & IpmiSubmitCommand2Ex.
IpmiSubmitCommand2 - This API use the default interface
(PcdDefaultSystemInterface) to send IPMI command.
IpmiSubmitCommand2Ex - This API use the specific interface type
to send IPMI command which is passed as an argument.

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Liming Gao 

Signed-off-by: Arun K 
---
 .../GenericIpmi/Pei/PeiGenericIpmi.c  | 550 +-
 .../GenericIpmi/Pei/PeiGenericIpmi.h  |  75 ++-
 .../GenericIpmi/Pei/PeiGenericIpmi.inf|  17 +
 .../GenericIpmi/Pei/PeiIpmiBmc.c  | 117 ++--
 .../GenericIpmi/Pei/PeiIpmiBmc.h  |  11 +-
 .../GenericIpmi/Pei/PeiIpmiBmcDef.h   |  86 +--
 .../GenericIpmi/Pei/PeiIpmiHooks.c| 346 +++
 .../GenericIpmi/Pei/PeiIpmiHooks.h| 218 +++
 8 files changed, 1159 insertions(+), 261 deletions(-)
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiIpmiHooks.c
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiIpmiHooks.h

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
index e8b99b6900..61e7ce4ecd 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
@@ -3,6 +3,7 @@


   @copyright

   Copyright 2017 - 2021 Intel Corporation. 

+  Copyright (c) 1985 - 2023, American Megatrends International LLC. 

   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/



@@ -10,10 +11,208 @@
 #include "PeiGenericIpmi.h"

 #include 

 #include 

+#include 



 ///

-// Function Implementations

-//

+

+static EFI_PEI_NOTIFY_DESCRIPTOR  mNotifyList = {

+  EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,

+  ,

+  UpdateIpmiInstancePtr

+};

+

+/**

+Initialize the API and parameters for IPMI Transport2 Instance

+

+@param[in] IpmiInstance Pointer to IPMI Instance

+

+@return VOID

+

+**/

+VOID

+InitIpmiTransport2 (

+  IN  PEI_IPMI_BMC_INSTANCE_DATA  *IpmiInstance

+  )

+{

+  IpmiInstance->IpmiTransport2Ppi.InterfaceType   = FixedPcdGet8 
(PcdDefaultSystemInterface);

+  IpmiInstance->IpmiTransport2Ppi.IpmiTransport2BmcStatus = BmcStatusOk;

+  IpmiInstance->IpmiTransport2Ppi.IpmiSubmitCommand2  = 
PeiIpmiSendCommand2;

+  IpmiInstance->IpmiTransport2Ppi.IpmiSubmitCommand2Ex= 
PeiIpmiSendCommand2Ex;

+

+  if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {

+if (!EFI_ERROR (PlatformIpmiIoRangeSet (FixedPcdGet16 
(PcdBtControlPort {

+  InitBtInterfaceData (>IpmiTransport2Ppi);

+}

+  }

+

+  if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {

+InitSsifInterfaceData (>IpmiTransport2Ppi);

+  }

+

+  if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {

+InitIpmbInterfaceData (>IpmiTransport2Ppi);

+  }

+}

+

+/*++

+

+Routine Description:

+  Notify callback function for interfaces.

+

+Arguments:

+  PeiServices  - Describes the list of possible PEI Services.

+  NotifyDescriptor - Pointer to notify descriptor.

+  Ppi  - Pointer to Ppi.

+

+Returns:

+  Status

+

+--*/

+EFI_STATUS

+EFIAPI

+NotifyCallback (

+  IN EFI_PEI_SERVICES   **PeiServices,

+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,

+  IN VOID   *Ppi

+  )

+{

+  EFI_STATUS  Status;

+  PEI_IPMI_BMC_INSTANCE_DATA  *IpmiInstance;

+  PEI_IPMI_DATA_HOB   *IpmiInstancePtrHob;

+  EFI_HOB_GUID_TYPE   *GuidHob;

+  IPMI_INTERFACE_STATEInterfaceState;

+

+  InterfaceState = IpmiInterfaceNotReady;

+

+  GuidHob = GetFirstGuidHob ();

+  ASSERT (GuidHob != NULL);

+  if (GuidHob == NULL) {

+return EFI_NOT_FOUND;

+  }

+

+  IpmiInstancePtrHob = (PEI_IPMI_DATA_HOB *)GET_GUID_HOB_DATA (GuidHob);

+  IpmiInstance   = (PEI_IPMI_BMC_INSTANCE_DATA 
*)IpmiInstancePtrHob->IpmiInstance;

+

+  if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {

+InitSsifInterfaceData (>IpmiTransport2Ppi);

+

+if (IpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == 
IpmiInterfaceInitialized) {

+  InterfaceState = IpmiInterfaceInitialized;

+}

+  }

+

+  if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {

+

Re: [edk2-devel][edk2-platforms][PATCH V5-2] IpmiFeaturePkg:Provided multiple IPMI interface support in DXE and SMM

2023-08-02 Thread Isaac Oram
Reviewed-by: Isaac Oram 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Arun K via 
groups.io
Sent: Tuesday, July 25, 2023 8:37 AM
To: devel@edk2.groups.io; Arun K 
Cc: Oram, Isaac W ; Desimone, Nathaniel L 
; Ramkumar Krishnamoorthi ; 
Gao, Liming 
Subject: [edk2-devel][edk2-platforms][PATCH V5-2] IpmiFeaturePkg:Provided 
multiple IPMI interface support in DXE and SMM

Created IpmiTransport2 PPI/Protocol to support multiple
IPMI BMC Interface support such as KCS/BT/SSIF/IPMB with 2 API's
IpmiSubmitCommand2 & IpmiSubmitCommand2Ex.
IpmiSubmitCommand2 - This API use the default interface
(PcdDefaultSystemInterface) to send IPMI command.
IpmiSubmitCommand2Ex - This API use the specific interface type
to send IPMI command which is passed as an argument.

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Liming Gao 

Signed-off-by: Arun K 
---
 .../GenericIpmi/Common/IpmiBmc.h  |  13 +-
 .../GenericIpmi/Common/IpmiBmcCommon.h|  82 +--
 .../GenericIpmi/Common/IpmiHooks.c| 298 ++-
 .../GenericIpmi/Common/IpmiHooks.h| 119 -
 .../GenericIpmi/Dxe/GenericIpmi.inf   |  14 +-
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 505 +-
 .../GenericIpmi/Smm/SmmGenericIpmi.c  | 351 +---
 .../GenericIpmi/Smm/SmmGenericIpmi.inf|  12 +
 8 files changed, 1117 insertions(+), 277 deletions(-)

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
index d306a085e5..76ee988623 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
@@ -3,6 +3,7 @@


   @copyright

   Copyright 1999 - 2021 Intel Corporation. 

+  Copyright (c) 1985 - 2023, American Megatrends International LLC. 

   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/



@@ -21,17 +22,17 @@
 #include 

 #include 

 #include 

+#include 



 #include "IpmiBmcCommon.h"

 #include "KcsBmc.h"



-

 #define BMC_KCS_TIMEOUT  5   // [s] Single KSC request timeout



 //

 // IPMI Instance signature

 //

-#define SM_IPMI_BMC_SIGNATURE SIGNATURE_32 ('i', 'p', 'm', 'i')

+#define SM_IPMI_BMC_SIGNATURESIGNATURE_32 ('i', 'p', 'm', 'i')

 #define IPMI_SEND_COMMAND_MAX_RETRY  3   // Number of retries

 #define INSTANCE_FROM_SM_IPMI_BMC_THIS(a) \

   CR ( \

@@ -41,4 +42,12 @@
   SM_IPMI_BMC_SIGNATURE \

   )



+#define INSTANCE_FROM_IPMI_TRANSPORT2_THIS(a) \

+  CR ( \

+  a, \

+  IPMI_BMC_INSTANCE_DATA, \

+  IpmiTransport2, \

+  SM_IPMI_BMC_SIGNATURE \

+  )

+

 #endif // _IPMI_BMC_H_

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
index 06eab62aae..faf6cc6685 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
@@ -3,16 +3,17 @@


   @copyright

   Copyright 1999 - 2021 Intel Corporation. 

+  Copyright (c) 1985 - 2023, American Megatrends International LLC. 

   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/



 #ifndef _IPMI_COMMON_BMC_H_

 #define _IPMI_COMMON_BMC_H_



-#define MAX_TEMP_DATA 255 // 160 Modified to increase number of bytes 
transfered per command

-#define BMC_SLAVE_ADDRESS 0x20

-#define MAX_SOFT_COUNT10

-#define COMP_CODE_NORMAL  0x00

+#define MAX_TEMP_DATA  255// 160 Modified to increase number of bytes 
transfered per command

+#define BMC_SLAVE_ADDRESS  0x20

+#define MAX_SOFT_COUNT 10

+#define COMP_CODE_NORMAL   0x00



 //

 // IPMI command completion codes to check for in the UpdateErrorStatus routine.

@@ -33,8 +34,8 @@
 // D4h C Insufficient privilege, in KCS channel this indicates KCS Policy 
Control Mode is Deny All.

 // In authenticated channels this indicates invalid authentication/privilege.

 //

-#define COMP_INSUFFICIENT_PRIVILEGE   0xD4

-#define COMP_CODE_UNSPECIFIED 0xFF

+#define COMP_INSUFFICIENT_PRIVILEGE  0xD4

+#define COMP_CODE_UNSPECIFIED0xFF



 #define COMPLETION_CODES \

   { \

@@ -47,15 +48,16 @@
 // Dxe Ipmi instance data

 //

 typedef struct {

-  UINTN   Signature;

-  UINT64  KcsTimeoutPeriod;

-  UINT8   SlaveAddress;

-  BMC_STATUS  BmcStatus;

-  UINT64  ErrorStatus;

-  UINT8   SoftErrorCount;

-  UINT16  IpmiIoBase;

-  IPMI_TRANSPORT  IpmiTransport;

-  EFI_HANDLE  IpmiSmmHandle;

+  UINTN  Signature;

+  UINT64 KcsTimeoutPeriod;

+  UINT8  SlaveAddress;

+  BMC_STATUS BmcStatus;

+  UINT64 ErrorStatus;

+  UINT8  SoftErrorCount;

+  UINT16 IpmiIoBase;

+  

Re: [edk2-devel] [PATCH v2 1/6] AlderlakeOpenBoardPkg: Add package and headers

2023-08-02 Thread Chaganty, Rangasai V
Reviewed-by: Sai Chaganty 

-Original Message-
From: Kasbekar, Saloni  
Sent: Tuesday, August 01, 2023 3:18 PM
To: devel@edk2.groups.io
Cc: Kasbekar, Saloni ; Chaganty, Rangasai V 
; Desimone, Nathaniel L 
; Oram, Isaac W ; 
Chuang, Rosen 
Subject: [PATCH v2 1/6] AlderlakeOpenBoardPkg: Add package and headers

Create the AlderlakeOpenBoardPkg to provide board support code. The package 
supports Alderlake Mobile board with LPDDR4. The package serves as a support 
package in the EDK II Minimum Platform design.

Cc: Sai Chaganty 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Rosen Chuang 
Signed-off-by: Saloni Kasbekar 
---
 .../Include/Library/BoardConfigLib.h  |  59 
 .../Include/Library/PeiGetFvInfoLib.h |  29 ++
 .../Include/Library/SpiFlashCommon.h  |  99 ++
 .../Include/PlatformBoardConfig.h |  93 ++
 .../Include/PlatformBoardId.h |  21 ++
 .../Include/PlatformGpioConfig.h  |  18 +
 .../Include/PlatformPostCode.h|  39 +++
 .../Include/PolicyUpdateMacro.h   |  48 +++
 .../AlderlakeOpenBoardPkg/OpenBoardPkg.dec| 307 ++
 9 files changed, 713 insertions(+)
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/BoardConfigLib.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/PeiGetFvInfoLib.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlashCommon.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/PlatformBoardConfig.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/PlatformBoardId.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/PlatformGpioConfig.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/PlatformPostCode.h
 create mode 100644 
Platform/Intel/AlderlakeOpenBoardPkg/Include/PolicyUpdateMacro.h
 create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPkg.dec

diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/BoardConfigLib.h 
b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/BoardConfigLib.h
new file mode 100644
index 00..3a07563c5d
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/BoardConfigLi
+++ b.h
@@ -0,0 +1,59 @@
+/** @file
+  Function prototype of BoardConfigLib.
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _BOARD_CONFIG_LIB_H_
+#define _BOARD_CONFIG_LIB_H_
+
+#include 
+#include 
+
+#define SIZE_OF_FIELD(TYPE, Field) (sizeof (((TYPE *)0)->Field))
+
+#define SIZE_OF_TABLE(TABLE, TYPE) (sizeof (TABLE) / sizeof (TYPE))
+
+#define BOARD_CONFIG PLATFORM_INFO
+
+#define PRE_MEM0
+#define POST_MEM   1
+#define EARLY_PRE_MEM  2
+
+/**
+  Procedure to detect current board HW configuration.
+
+**/
+VOID
+EFIAPI
+GetBoardConfig (
+  VOID
+  );
+
+
+/**
+  Count the number of GPIO settings in the Table.
+
+  @param[in]  GpioTable   The pointer of GPIO config table
+  @param[out] GpioCount   The number of GPIO config entries
+**/
+VOID
+GetGpioTableSize (
+  GPIO_INIT_CONFIG   *GpioTable,
+  OUT UINT16 *GpioCount
+  );
+
+
+/**
+  Configure GPIO pads in PEI phase.
+
+  @param[in]  GpioTable  Pointer to Gpio table **/ VOID GpioInit (
+  IN GPIO_INIT_CONFIG *GpioTable
+  );
+
+#endif // _BOARD_CONFIG_LIB_H_
diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/PeiGetFvInfoLib.h 
b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/PeiGetFvInfoLib.h
new file mode 100644
index 00..f2e5a77787
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/PeiGetFvInfoL
+++ ib.h
@@ -0,0 +1,29 @@
+/** @file
+  Header file for PeiGetFvInfoLib..
+
+   Copyright (c) 2022, Intel Corporation. All rights reserved.
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _PEI_GET_FV_INFO_LIB_H_
+#define _PEI_GET_FV_INFO_LIB_H_
+
+/**
+  PeiGetSectionFromFv finds the file in FV and gets file Address and 
+Size
+
+  @param[in] NameGuid  - File GUID
+  @param[out] Address  - Pointer to the File Address
+  @param[out] Size - Pointer to File Size
+
+  @retval EFI_SUCCESSSuccessfull in reading the section from FV
+**/
+EFI_STATUS
+EFIAPI
+PeiGetSectionFromFv (
+  IN CONST  EFI_GUIDNameGuid,
+  OUT VOID  **Address,
+  OUT UINT32*Size
+  );
+
+#endif
diff --git 
a/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlashCommon.h 
b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlashCommon.h
new file mode 100644
index 00..76ba3a8094
--- /dev/null
+++ b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlashCommo
+++ n.h
@@ -0,0 +1,99 @@
+/** @file
+  The header file includes the common header files, defines
+  internal structure and functions used by SpiFlashCommonLib.
+
+   Copyright (c) 2022, Intel Corporation. All rights 

Re: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to 3.0.9

2023-08-02 Thread Michael D Kinney
Hi Liming,

I have added Andrew and Leif to this thread so we can discuss 
if the release date need to be adjusted.

Mike


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of gaoliming
> via groups.io
> Sent: Wednesday, August 2, 2023 3:07 AM
> To: devel@edk2.groups.io; Li, Yi1 
> Cc: Yao, Jiewen ; Lu, Xiaoyu1
> ; Jiang, Guomin ; 'Gerd
> Hoffmann' 
> Subject: 回复: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL
> submodule to 3.0.9
> 
> Yi:
>   Thanks for your great work to update openssl 3.0. The commit message
> shows this patch set must catch edk2 202308 stable tag. Right?
>   Edk2 202308 stable tag will start soft feature free from Aug 7th (next
> Monday). That means this patch set needs to pass code review in one
> week.
> 
> Jiwen, Gerd:
>   Can you give your comments for this patch set this week? If you need
> more time, I will raise the request to defer the soft feature freeze.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Li, Yi
> > 发送时间: 2023年7月28日 14:40
> > 收件人: devel@edk2.groups.io
> > 抄送: Yi Li ; Jiewen Yao ;
> Xiaoyu
> > Lu ; Guomin Jiang ; Gerd
> > Hoffmann 
> > 主题: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to
> > 3.0.9
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3466
> >
> > According to https://www.OpenSSL.org/policies/releasestrat.html,
> > OpenSSL Version 1.1.1 will be supported until 2023-09-11 (LTS).
> > Need to upgrade OpenSsl to 3.0.9 before 1.1.1 support stopping.
> >
> > PR: https://github.com/tianocore/edk2/pull/4692
> >
> > Cc: Jiewen Yao 
> > Cc: Xiaoyu Lu 
> > Cc: Guomin Jiang 
> > Cc: Gerd Hoffmann 
> > Gerd Hoffmann (15):
> >   CryptoPkg/openssl: update submodule to openssl-3.0.9
> >   CryptoPkg/openssl: cleanup all openssl1.1.1 generated files and code
> >   CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0
> >   CryptoPkg/openssl: add openssl3 configure scripts
> >   CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0
> >   CryptoPkg/BaseCryptLib: no openssl deprecation warnings please
> >   CryptoPkg/BaseCryptLib: adapt CryptSm3.c to openssl 3.0 changes.
> >   CryptoPkg/BaseCryptLib: drop BIO_* dummy functions
> >   CryptoPkg/TlsLib: ERR_GET_FUNC is gone
> >   CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes
> >   CryptoPkg/openssl: move compiler_flags to buildinf.c
> >   CryptoPkg/openssl: store dummy update for openssl 3.0
> >   CryptoPkg/openssl: adapt EcSm2Null.c for openssl 3.0
> >   CryptoPkg/TlsLib: use unsigned long for ErrorCode
> >   CryptoPkg/openssl: update CI config for openssl 3.0
> >
> > Yi Li (14):
> >   CryptoPkg: Move all UEFI implement of openssl to OpensslStub
> >   CryptoPkg: use UEFI provider as default
> >   CryptoPkg: adapt 3.0 change in SslNull.c
> >   CryptoPkg: Add instrinsics to support building openssl3 on IA32
> > windows
> >   CryptoPkg: disable C4133 warning in openssl libraries
> >   CryptoPkg: Align with 4096 when build with OpensslFullAccel
> >   CryptoPkg: Enable memcpy sys call in RISCV64 build
> >   CryptoPkg: add missing gcc instructions
> >   CryptoPkg: add define of maximum unsigned size_t
> >   CryptoPkg: add implemention of _ftol2_sse() to avoid build error
> >   CryptoPkg: add more dummy implement of openssl for size optimization
> >   CryptoPkg: run configure.py to update all generated files
> >   CryptoPkg: remove strcmp to syscall
> >   CryptoPkg: remove BN and EC accel for size optimization
> >
> >  CryptoPkg/CryptoPkg.ci.yaml   |   54 +-
> >  CryptoPkg/CryptoPkg.dec   |4 +
> >  CryptoPkg/CryptoPkg.dsc   |   12 +-
> >  .../Library/BaseCryptLib/Hash/CryptSm3.c  |   14 +-
> >  .../Library/BaseCryptLib/InternalCryptLib.h   |2 +
> >  .../Library/BaseCryptLib/SysCall/CrtWrapper.c |   36 +-
> >  .../SysCall/UnitTestHostCrtWrapper.c  |   25 -
> >  CryptoPkg/Library/Include/CrtLibSupport.h |1 +
> >  .../Library/Include/openssl/opensslconf.h |  333 -
> >  .../IntrinsicLib/Ia32/MathDivModU64x64.c  |   23 +
> >  .../Library/IntrinsicLib/Ia32/MathDivS64x64.c |   22 +
> >  .../Library/IntrinsicLib/Ia32/MathDivU64x64.c |   22 +
> >  .../Library/IntrinsicLib/Ia32/MathFtol.c  |   12 +
> >  .../Library/IntrinsicLib/Ia32/MathLldiv.asm   |  203 +
> >  .../Library/IntrinsicLib/Ia32/MathModU64x64.c |   26 +
> >  .../Library/IntrinsicLib/Ia32/MathUlldiv.asm  |  157 +
> >  .../Library/IntrinsicLib/Ia32/MathUlldvrm.asm |  184 +
> >  .../Library/IntrinsicLib/Ia32/MathUllrem.asm  |  163 +
> >  .../Library/IntrinsicLib/IntrinsicLib.inf |   11 +-
> >  .../Library/IntrinsicLib/MemoryIntrinsics.c   |9 -
> >  .../IA32/crypto/modes/ghash-x86.nasm  |  700 --
> >  .../OpensslLib/IA32/crypto/sha/sha1-586.nasm  | 1394 ---
> >  .../IA32/crypto/sha/sha256-586.nasm   | 3364 ---
> >  .../IA32/crypto/sha/sha512-586.nasm   |  579 --
> >  .../IA32Gcc/crypto/modes/ghash-x86.S  |  703 --
> >  

Re: [edk2-devel] [PATCH v1 1/1] ArmPkg: DefaultExceptionHandlerLib: Do Not Allocate Memory

2023-08-02 Thread Ard Biesheuvel
On Wed, 2 Aug 2023 at 18:21, Oliver Smith-Denny
 wrote:
>
> On 8/2/2023 9:06 AM, Ard Biesheuvel wrote:
> > On Tue, 1 Aug 2023 at 00:04, Oliver Smith-Denny
> >  wrote:
> >>
> >> If gST->ConOut is available when Arm's DefaultExceptionHandler
> >> is running, AsciiPrint will get called to attempt to print to
> >> ConOut, in addition to the serial output.
> >>
> >> AsciiPrint calls AsciiInternalPrint in UefiLibPrint.c which
> >> in turn calls AllocatePool to allocate a buffer to convert
> >> the Ascii input string to a Unicode string to pass to
> >> ConOut->OutputString.
> >>
> >> Per the comment on DefaultExceptionHandler, we should not be
> >> allocating memory in the exception handler, as this can cause
> >> the exception handler to fail if we had a memory exception or
> >> the system state is such that we cannot allocate memory.
> >>
> >> It has been observed on ArmVirtQemu that exceptions generated
> >> in the memory handling code will fail to output the stack dump
> >> and CPU state that is critical to debugging because the
> >> AllocatePool will fail.
> >>
> >> This patch fixes the Arm and AARCH64 DefaultExceptionHandlers to
> >> not allocate memory when ConOut is available and instead use
> >> stack memory to convert the Ascii string needed for SerialPortWrite
> >> to the Unicode string needed for ConOut->OutputString. Correspondingly,
> >> ArmVirtQemu can now output the stack dump and CPU state when hitting
> >> an exception in memory code.
> >>
> >> GitHub PR: https://github.com/tianocore/edk2/pull/4703
> >>
> >> Cc: Leif Lindholm 
> >> Cc: Ard Biesheuvel 
> >> Cc: Sami Mujawar 
> >> Cc: Gerd Hoffmann 
> >>
> >> Signed-off-by: Oliver Smith-Denny 
> >
> > Thanks a lot for fixing this.
> >
> > Is calling into gST->ConOut guaranteed to be safe in this regard? Or
> > is it still best effort?
> >
> >
>
> Yeah, this is something I worried about when fixing this. It is very
> much best effort, because there are no guarantees that OutputString will
> not allocate memory (or some other such unsafe operation in an exception
> handler). With the ability to BYO ConOut stack and the complications
> with graphics that can be involved here, I personally would be happy to
> drop the ConOut call entirely and rely on the serial output.
>
> In my testing, this did work on ArmVirtQemu and I can envision a case
> where having the ConOut output would be nice, but I tend towards lets
> keep the exception handler as simple as possible and make sure we get
> the useful information dumped out.
>
> Another option would be to keep this change but move the ConOut calls
> to after all of the serial output, so that if we do get a recursive
> exception in ConOut, at least we got our serial output.
>
> Let me know what you think, happy to spin up a v2.
>

Yeah, that seems like a nice approach - it will still be best effort,
but it won't derail the more reliable serial console if it fails.

That probably also means we shouldn't bother printing the 'recursive
exception' to ConOut at all, or perhap have a special 'recursive
exception in conout' flag on top of the existing one but that might be
overkill.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107461): https://edk2.groups.io/g/devel/message/107461
Mute This Topic: https://groups.io/mt/100472023/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 1/1] ArmPkg: DefaultExceptionHandlerLib: Do Not Allocate Memory

2023-08-02 Thread Ard Biesheuvel
On Tue, 1 Aug 2023 at 00:04, Oliver Smith-Denny
 wrote:
>
> If gST->ConOut is available when Arm's DefaultExceptionHandler
> is running, AsciiPrint will get called to attempt to print to
> ConOut, in addition to the serial output.
>
> AsciiPrint calls AsciiInternalPrint in UefiLibPrint.c which
> in turn calls AllocatePool to allocate a buffer to convert
> the Ascii input string to a Unicode string to pass to
> ConOut->OutputString.
>
> Per the comment on DefaultExceptionHandler, we should not be
> allocating memory in the exception handler, as this can cause
> the exception handler to fail if we had a memory exception or
> the system state is such that we cannot allocate memory.
>
> It has been observed on ArmVirtQemu that exceptions generated
> in the memory handling code will fail to output the stack dump
> and CPU state that is critical to debugging because the
> AllocatePool will fail.
>
> This patch fixes the Arm and AARCH64 DefaultExceptionHandlers to
> not allocate memory when ConOut is available and instead use
> stack memory to convert the Ascii string needed for SerialPortWrite
> to the Unicode string needed for ConOut->OutputString. Correspondingly,
> ArmVirtQemu can now output the stack dump and CPU state when hitting
> an exception in memory code.
>
> GitHub PR: https://github.com/tianocore/edk2/pull/4703
>
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Sami Mujawar 
> Cc: Gerd Hoffmann 
>
> Signed-off-by: Oliver Smith-Denny 

Thanks a lot for fixing this.

Is calling into gST->ConOut guaranteed to be safe in this regard? Or
is it still best effort?


> ---
>  ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c 
> | 18 +-
>  ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c 
> | 11 +--
>  2 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git 
> a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c 
> b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
> index f2bca5d74005..07c8aade1c5f 100644
> --- 
> a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
> +++ 
> b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
> @@ -22,6 +22,11 @@
>  #include 
>  #include 
>
> +//
> +// Maximum number of characters to print to serial (UINT8s) and to console 
> if available (as UINT16s)
> +//
> +#define MAX_PRINT_CHARS  100
> +
>  STATIC CHAR8  *gExceptionTypeString[] = {
>"Synchronous",
>"IRQ",
> @@ -188,16 +193,18 @@ DefaultExceptionHandler (
>IN OUT EFI_SYSTEM_CONTEXT  SystemContext
>)
>  {
> -  CHAR8  Buffer[100];
> -  UINTN  CharCount;
> -  INT32  Offset;
> +  CHAR8   Buffer[MAX_PRINT_CHARS];
> +  CHAR16  UnicodeBuffer[MAX_PRINT_CHARS];
> +  UINTN   CharCount;
> +  INT32   Offset;
>
>if (mRecursiveException) {
>  STATIC CHAR8 CONST  Message[] = "\nRecursive exception occurred while 
> dumping the CPU state\n";
>
>  SerialPortWrite ((UINT8 *)Message, sizeof Message - 1);
>  if (gST->ConOut != NULL) {
> -  AsciiPrint (Message);
> +  UnicodeSPrintAsciiFormat (UnicodeBuffer, MAX_PRINT_CHARS, Buffer);
> +  gST->ConOut->OutputString (gST->ConOut, UnicodeBuffer);
>  }
>
>  CpuDeadLoop ();
> @@ -208,7 +215,8 @@ DefaultExceptionHandler (
>CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "\n\n%a Exception at 
> 0x%016lx\n", gExceptionTypeString[ExceptionType], 
> SystemContext.SystemContextAArch64->ELR);
>SerialPortWrite ((UINT8 *)Buffer, CharCount);
>if (gST->ConOut != NULL) {
> -AsciiPrint (Buffer);
> +UnicodeSPrintAsciiFormat (UnicodeBuffer, MAX_PRINT_CHARS, Buffer);
> +gST->ConOut->OutputString (gST->ConOut, UnicodeBuffer);
>}
>
>DEBUG_CODE_BEGIN ();
> diff --git 
> a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c 
> b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
> index 13b321e45615..08d62c0dbfa2 100644
> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
> @@ -23,6 +23,11 @@
>  #include 
>  #include 
>
> +//
> +// Maximum number of characters to print to serial (UINT8s) and to console 
> if available (as UINT16s)
> +//
> +#define MAX_PRINT_CHARS  100
> +
>  //
>  // The number of elements in a CHAR8 array, including the terminating NUL, 
> that
>  // is meant to hold the string rendering of the CPSR.
> @@ -198,7 +203,8 @@ DefaultExceptionHandler (
>IN OUT EFI_SYSTEM_CONTEXT  SystemContext
>)
>  {
> -  CHAR8Buffer[100];
> +  CHAR8Buffer[MAX_PRINT_CHARS];
> +  CHAR16   UnicodeBuffer[MAX_PRINT_CHARS];
>UINTNCharCount;
>UINT32   DfsrStatus;
>UINT32   IfsrStatus;
> @@ -217,7 +223,8 @@ DefaultExceptionHandler (
>  );
>SerialPortWrite ((UINT8 *)Buffer, CharCount);
>if (gST->ConOut != NULL) {
> -AsciiPrint (Buffer);
> +

[edk2-devel] Event: TianoCore Community Meeting EMEA/NAMO - Thursday, August 3, 2023 #cal-reminder

2023-08-02 Thread Group Notification
*Reminder: TianoCore Community Meeting EMEA/NAMO*

*When:*
Thursday, August 3, 2023
8:00am to 9:00am
(UTC-07:00) America/Los Angeles

*Where:*
Microsoft Teams meeting Join on your computer or mobile app Click here to join 
the meeting Meeting ID: 226 323 011 029 Passcode: hMRCj6 Download Teams | Join 
on the web Join with a video conferencing device te...@conf.intel.com Video 
Conference ID: 112 716 814 3 Alternate VTC instructions Learn More | Meeting 
options

*Organizer:* Miki Demeter

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1981682 )

*Description:*



Microsoft Teams meeting

*Join on your computer or mobile app*

Click here to join the meeting ( 
https://teams.microsoft.com/l/meetup-join/19%3ameeting_MTAyZGJhNjMtYzQ4Mi00MTUxLWFlMWMtOGU0MWNlZDk4NjY5%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d
 )

Meeting ID: 226 323 011 029
Passcode: hMRCj6

Download Teams ( https://www.microsoft.com/en-us/microsoft-teams/download-app ) 
| Join on the web ( https://www.microsoft.com/microsoft-teams/join-a-meeting )

*Join with a video conferencing device*

te...@conf.intel.com

Video Conference ID: 112 716 814 3

Alternate VTC instructions ( 
https://conf.intel.com/teams/?conf=1127168143=teams=conf.intel.com=test_call
 )

Learn More ( https://aka.ms/JoinTeamsMeeting ) | Meeting options ( 
https://teams.microsoft.com/meetingOptions/?organizerId=6e4ce4c4-1242-431b-9a51-92cd01a5df3c=46c98d88-e344-4ed4-8496-4ed7712e255d=19_meeting_MTAyZGJhNjMtYzQ4Mi00MTUxLWFlMWMtOGU0MWNlZDk4NjY5@thread.v2=0=en-US
 )




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107458): https://edk2.groups.io/g/devel/message/107458
Mute This Topic: https://groups.io/mt/100507209/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Event: TianoCore edk2-test Bug Triage Meeting - Thursday, August 3, 2023 #cal-reminder

2023-08-02 Thread Group Notification
*Reminder: TianoCore edk2-test Bug Triage Meeting*

*When:*
Thursday, August 3, 2023
10:00pm to 11:00pm
(UTC+08:00) Asia/Shanghai

*Where:*
https://armltd.zoom.us/j/91247522013?pwd=ei9nUndTbG9oWEROS2M1aVREZkpiQT09=addon

*Organizer:* Edhaya Chandran edhaya.chand...@arm.com ( 
edhaya.chand...@arm.com?subject=Re:%20Event:%20TianoCore%20edk2-test%20Bug%20Triage%20Meeting
 )

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1981602 )

*Description:*


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107457): https://edk2.groups.io/g/devel/message/107457
Mute This Topic: https://groups.io/mt/100505864/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




回复: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to 3.0.9

2023-08-02 Thread gaoliming via groups.io
Yi:
  Thanks for your great work to update openssl 3.0. The commit message shows 
this patch set must catch edk2 202308 stable tag. Right?
  Edk2 202308 stable tag will start soft feature free from Aug 7th (next 
Monday). That means this patch set needs to pass code review in one week. 

Jiwen, Gerd:
  Can you give your comments for this patch set this week? If you need more 
time, I will raise the request to defer the soft feature freeze.

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Li, Yi
> 发送时间: 2023年7月28日 14:40
> 收件人: devel@edk2.groups.io
> 抄送: Yi Li ; Jiewen Yao ; Xiaoyu
> Lu ; Guomin Jiang ; Gerd
> Hoffmann 
> 主题: [edk2-devel] [PATCH 00/29] CryptoPkg: Update OpenSSL submodule to
> 3.0.9
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3466
> 
> According to https://www.OpenSSL.org/policies/releasestrat.html,
> OpenSSL Version 1.1.1 will be supported until 2023-09-11 (LTS).
> Need to upgrade OpenSsl to 3.0.9 before 1.1.1 support stopping.
> 
> PR: https://github.com/tianocore/edk2/pull/4692
> 
> Cc: Jiewen Yao 
> Cc: Xiaoyu Lu 
> Cc: Guomin Jiang 
> Cc: Gerd Hoffmann 
> Gerd Hoffmann (15):
>   CryptoPkg/openssl: update submodule to openssl-3.0.9
>   CryptoPkg/openssl: cleanup all openssl1.1.1 generated files and code
>   CryptoPkg/openssl: update Openssl*.inf files for openssl 3.0
>   CryptoPkg/openssl: add openssl3 configure scripts
>   CryptoPkg/openssl: UefiAsm.conf update for openssl 3.0
>   CryptoPkg/BaseCryptLib: no openssl deprecation warnings please
>   CryptoPkg/BaseCryptLib: adapt CryptSm3.c to openssl 3.0 changes.
>   CryptoPkg/BaseCryptLib: drop BIO_* dummy functions
>   CryptoPkg/TlsLib: ERR_GET_FUNC is gone
>   CryptoPkg/openssl: adapt rand_pool.c to openssl 3.0 changes
>   CryptoPkg/openssl: move compiler_flags to buildinf.c
>   CryptoPkg/openssl: store dummy update for openssl 3.0
>   CryptoPkg/openssl: adapt EcSm2Null.c for openssl 3.0
>   CryptoPkg/TlsLib: use unsigned long for ErrorCode
>   CryptoPkg/openssl: update CI config for openssl 3.0
> 
> Yi Li (14):
>   CryptoPkg: Move all UEFI implement of openssl to OpensslStub
>   CryptoPkg: use UEFI provider as default
>   CryptoPkg: adapt 3.0 change in SslNull.c
>   CryptoPkg: Add instrinsics to support building openssl3 on IA32
> windows
>   CryptoPkg: disable C4133 warning in openssl libraries
>   CryptoPkg: Align with 4096 when build with OpensslFullAccel
>   CryptoPkg: Enable memcpy sys call in RISCV64 build
>   CryptoPkg: add missing gcc instructions
>   CryptoPkg: add define of maximum unsigned size_t
>   CryptoPkg: add implemention of _ftol2_sse() to avoid build error
>   CryptoPkg: add more dummy implement of openssl for size optimization
>   CryptoPkg: run configure.py to update all generated files
>   CryptoPkg: remove strcmp to syscall
>   CryptoPkg: remove BN and EC accel for size optimization
> 
>  CryptoPkg/CryptoPkg.ci.yaml   |   54 +-
>  CryptoPkg/CryptoPkg.dec   |4 +
>  CryptoPkg/CryptoPkg.dsc   |   12 +-
>  .../Library/BaseCryptLib/Hash/CryptSm3.c  |   14 +-
>  .../Library/BaseCryptLib/InternalCryptLib.h   |2 +
>  .../Library/BaseCryptLib/SysCall/CrtWrapper.c |   36 +-
>  .../SysCall/UnitTestHostCrtWrapper.c  |   25 -
>  CryptoPkg/Library/Include/CrtLibSupport.h |1 +
>  .../Library/Include/openssl/opensslconf.h |  333 -
>  .../IntrinsicLib/Ia32/MathDivModU64x64.c  |   23 +
>  .../Library/IntrinsicLib/Ia32/MathDivS64x64.c |   22 +
>  .../Library/IntrinsicLib/Ia32/MathDivU64x64.c |   22 +
>  .../Library/IntrinsicLib/Ia32/MathFtol.c  |   12 +
>  .../Library/IntrinsicLib/Ia32/MathLldiv.asm   |  203 +
>  .../Library/IntrinsicLib/Ia32/MathModU64x64.c |   26 +
>  .../Library/IntrinsicLib/Ia32/MathUlldiv.asm  |  157 +
>  .../Library/IntrinsicLib/Ia32/MathUlldvrm.asm |  184 +
>  .../Library/IntrinsicLib/Ia32/MathUllrem.asm  |  163 +
>  .../Library/IntrinsicLib/IntrinsicLib.inf |   11 +-
>  .../Library/IntrinsicLib/MemoryIntrinsics.c   |9 -
>  .../IA32/crypto/modes/ghash-x86.nasm  |  700 --
>  .../OpensslLib/IA32/crypto/sha/sha1-586.nasm  | 1394 ---
>  .../IA32/crypto/sha/sha256-586.nasm   | 3364 ---
>  .../IA32/crypto/sha/sha512-586.nasm   |  579 --
>  .../IA32Gcc/crypto/modes/ghash-x86.S  |  703 --
>  .../OpensslLib/IA32Gcc/crypto/sha/sha1-586.S  | 1389 ---
>  .../IA32Gcc/crypto/sha/sha256-586.S   | 3356 ---
>  .../IA32Gcc/crypto/sha/sha512-586.S   |  574 --
>  .../Library/OpensslLib/OpenSSL-HOWTO.txt  |4 +-
>  .../OpensslGen/IA32-GCC/crypto/aes/aes-586.S  | 3320 +++
>  .../IA32-GCC}/crypto/aes/aesni-x86.S  |  141 +-
>  .../IA32-GCC}/crypto/aes/vpaes-x86.S  |   92 +-
>  .../OpensslGen/IA32-GCC/crypto/bn/bn-586.S| 1572 
>  .../OpensslGen/IA32-GCC/crypto/bn/co-586.S| 1290 +++
>  .../OpensslGen/IA32-GCC/crypto/bn/x86-gf2m.S  |  374 +
>  .../OpensslGen/IA32-GCC/crypto/bn/x86-mont.S  |  494 +
>  

回复: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for CERT_RSA3072 and CERT_RSA4096

2023-08-02 Thread gaoliming via groups.io
Sheng Wei:
  I gave my comments for the patch 1/3 on this morning. Have you got my
response? 

  I just want to confirm whether these two new GUID are in the public UEFI
spec or not.

Thanks
Liming
> -邮件原件-
> 发件人: Sheng, W 
> 发送时间: 2023年8月2日 16:04
> 收件人: devel@edk2.groups.io; Gao, Liming 
> 抄送: Yao, Jiewen ; Wang, Jian J
> ; Xu, Min M ; Chen, Zeyi
> ; Wang, Fiona ; Lu, Xiaoyu1
> ; Jiang, Guomin ; Kinney,
> Michael D 
> 主题: RE: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for
> CERT_RSA3072 and CERT_RSA4096
> 
> Hi Gao, Liming,
> For this patch group, we have got review-by from Yao, Jiewen on patch
> 2/3(CryptoPkg) and patch 3/3(SecurityPkg).
> Do you any comments on the patch 1/3 (MdePkg) ?
> Patch 1/3 is only to add 2 new GUIDs.
> Could you help to merge it ?
> 
> Thank you.
> BR
> Sheng Wei
> 
> > -Original Message-
> > From: Sheng, W
> > Sent: 2023年7月31日 10:02
> > To: 'devel@edk2.groups.io' ; Gao, Liming
> > 
> > Cc: Yao, Jiewen ; Wang, Jian J
> > ; Xu, Min M ; Chen, Zeyi
> > ; Wang, Fiona ; Lu, Xiaoyu1
> > ; Jiang, Guomin ; Kinney,
> > Michael D 
> > Subject: RE: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for
> > CERT_RSA3072 and CERT_RSA4096
> >
> > Hi Gao, Liming,
> > Could you help to review and merge this patch to MdePkg?
> > This patch is only to add 2 new GUIDs.
> > These 2 GUIDs will be used for adding RSA3072/RSA4096 cert support for
> > secure boot feature.
> > Thank you.
> > BR
> > Sheng Wei
> >
> > > > -Original Message-
> > > > From: devel@edk2.groups.io  On Behalf Of
> > Sheng
> > > > Wei
> > > > Sent: 2023年7月27日 14:35
> > > > To: devel@edk2.groups.io
> > > > Cc: Yao, Jiewen ; Wang, Jian J
> > > > ; Xu, Min M ; Chen, Zeyi
> > > > ; Wang, Fiona ; Lu,
> > > > Xiaoyu1 ; Jiang, Guomin
> > > > ; Kinney, Michael D
> > > > ; Gao, Liming
> 
> > > > Subject: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for
> > > > CERT_RSA3072 and CERT_RSA4096
> > > >
> > > > Add gEfiCertRsa3072Guid and gEfiCertRsa4096Guid
> > > >
> > > > Cc: Jiewen Yao 
> > > > Cc: Jian J Wang 
> > > > Cc: Min Xu 
> > > > Cc: Zeyi Chen 
> > > > Cc: Fiona Wang 
> > > > Cc: Xiaoyu Lu 
> > > > Cc: Guomin Jiang 
> > > > Cc: Michael D Kinney 
> > > > Cc: Liming Gao 
> > > > Signed-off-by: Sheng Wei 
> > > > ---
> > > >  MdePkg/Include/Guid/ImageAuthentication.h | 26
> > > > +++
> > > >  MdePkg/MdePkg.dec |  2 ++
> > > >  2 files changed, 28 insertions(+)
> > > >
> > > > diff --git a/MdePkg/Include/Guid/ImageAuthentication.h
> > > > b/MdePkg/Include/Guid/ImageAuthentication.h
> > > > index fe83596571..c8ea2c14fb 100644
> > > > --- a/MdePkg/Include/Guid/ImageAuthentication.h
> > > > +++ b/MdePkg/Include/Guid/ImageAuthentication.h
> > > > @@ -144,6 +144,30 @@ typedef struct {
> > > >  0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e,
0x85,
> 0xb3,
> > > > 0xb6} \   } +///+/// This identifies a signature containing an
RSA-3072
> key.
> > > The
> > > > key (only the modulus+/// since the public key exponent is known to
> > > > be
> > > > 0x10001) shall be stored in big-endian+/// order.+/// The
> > > > SignatureHeader size shall always be 0. The SignatureSize shall
> > > > always be 16 (size+/// of SignatureOwner component) + 384
> > bytes.+///+#define
> > > > EFI_CERT_RSA3072_GUID \+  { \+0xedd320c2, 0xb057, 0x4b8e,
> {0xad,
> > > 0x46,
> > > > 0x2c, 0x9b, 0x85, 0x89, 0xee, 0x92 } \+  }++///+/// This identifies
> > > > a signature containing an RSA-4096 key. The key (only the
> > > > modulus+/// since the public key exponent is known to be 0x10001)
> > > > shall be stored in big-endian+/// order.+/// The SignatureHeader
> > > > size shall always be 0. The SignatureSize shall always be 16
> > > > (size+/// of SignatureOwner
> > > component) + 512
> > > > bytes.+///+#define EFI_CERT_RSA4096_GUID \+  { \+
> 0xb23e89a6,
> > 0x8c8b,
> > > > 0x4412, {0x85, 0x73, 0x15, 0x4e, 0x8d, 0x00, 0x98, 0x2c } \+  }+ ///
> > > > /// This identifies a signature containing a RSA-2048 signature of a
> > > > SHA-256 hash.  The /// SignatureHeader size shall always be 0. The
> > > > SignatureSize shall always be
> > > > 16 (size of@@ -330,6 +354,8 @@ typedef struct {  extern EFI_GUID
> > > > gEfiImageSecurityDatabaseGuid; extern EFI_GUID gEfiCertSha256Guid;
> > > > extern EFI_GUID  gEfiCertRsa2048Guid;+extern EFI_GUID
> > > > gEfiCertRsa3072Guid;+extern EFI_GUID  gEfiCertRsa4096Guid; extern
> > > > EFI_GUID  gEfiCertRsa2048Sha256Guid; extern EFI_GUID
> > > > gEfiCertSha1Guid; extern EFI_GUID  gEfiCertRsa2048Sha1Guid;diff
> > > > --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > > > b85614992b..24e4779d33 100644
> > > > --- a/MdePkg/MdePkg.dec
> > > > +++ b/MdePkg/MdePkg.dec
> > > > @@ -581,6 +581,8 @@
> > > >gEfiImageSecurityDatabaseGuid  = { 0xd719b2cb, 0x3d3a, 0x4596,
> {0xa3,
> > > > 0xbc, 0xda, 0xd0,  0xe, 0x67, 0x65, 0x6f }}   gEfiCertSha256Guid
> =
> > > > { 0xc1c41626, 0x504c, 0x4092, {0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93,
> > > > 0x43,

Re: [edk2-devel] [PATCH V2 3/6] MdePkg: Add definitions in DEC for SPI NOR Flash SPDF driver

2023-08-02 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

This makes sense to me, I will update it.
Thanks
Abner

> -Original Message-
> From: gaoliming 
> Sent: Wednesday, August 2, 2023 4:06 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: 'Michael D Kinney' ; 'Zhiguang Liu'
> ; Attar, AbdulLateef (Abdul Lateef)
> 
> Subject: 回复: [PATCH V2 3/6] MdePkg: Add definitions in DEC for SPI NOR Flash
> SPDF driver
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Abner:
>   I add my comments.
>
> > -邮件原件-
> > 发件人: abner.ch...@amd.com 
> > 发送时间: 2023年8月1日 15:57
> > 收件人: devel@edk2.groups.io
> > 抄送: Michael D Kinney ; Liming Gao
> > ; Zhiguang Liu ; Abdul
> > Lateef Attar 
> > 主题: [PATCH V2 3/6] MdePkg: Add definitions in DEC for SPI NOR Flash SPDF
> > driver
> >
> > From: Abner Chang 
> >
> > BZ#: 4473
> >
> > Signed-off-by: Abner Chang 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > Cc: Abdul Lateef Attar 
> > ---
> >  MdePkg/MdePkg.dec | 19 +++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> > index b85614992b9..47d8daba826 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -875,6 +875,12 @@
> >## Include/Protocol/CcMeasurement.h
> >gEfiCcFinalEventsTableGuid = { 0xdd4a4648, 0x2de7, 0x4665, { 0x96,
> > 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46 }}
> >
> > +  #
> > +  # SPI NOR flash JEDEC Serial Flash Discoverable Parameters (SFDP)
> driver
> > GUID
> > +  #
> > +  gEdk2JedecSfdpSpiDxeDriverGuid  = { 0xBE71701E, 0xB63C, 0x4574,
> > { 0x9C, 0x5C, 0x36, 0x29, 0xE8, 0xEA, 0xC4, 0x14 }}
> > +  gEdk2JedecSfdpSpiSmmDriverGuid  = { 0x95A1E915, 0x195C, 0x477C,
> > { 0x92, 0x6F, 0x7E, 0x24, 0x67, 0xC1, 0xB3, 0x1F }}
> > +
>
> They are for JedecSfdp SPI instance. One GUID can be shared for DXE and SMM.
>
> And, this GUID is not defined in PI spec. So, I suggest to define it into
> MdeModulePkg.dec.
>
> Thanks
> Liming
> >  [Guids.IA32, Guids.X64]
> >## Include/Guid/Cper.h
> >gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de,
> > { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}
> > @@ -2232,6 +2238,19 @@
> ># @Prompt Speculation Barrier Type.
> >
> > gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x3000
> > 1018
> >
> > +  ## SPI NOR Flash operation retry counts
> > +  #  0x:  No retry
> > +  #  0x:  Maximum retry value
> > +  #
> > +  # @Prompt SPI NOR Flash Operation Retry Value
> > +
> > gEfiMdePkgTokenSpaceGuid.PcdSpiNorFlashOperationRetryCount|0x
> > |UINT32|0x30001019
> > +
> > +  ## SPI NOR Flash operation delay in microseconds
> > +  #  Deafult is set to 0x000f microseconds
> > +  #
> > +  # @Prompt SPI NOR Flash Operation Delay in Microseconds
> > +
> > gEfiMdePkgTokenSpaceGuid.PcdSpiNorFlashOperationDelayMicroseconds|0x
> > 000F|UINT32|0x3000101A
> > +
> >  [PcdsFixedAtBuild,PcdsPatchableInModule]
> >## Indicates the maximum length of unicode string used in the following
> >#  BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(),
> StrCpy(),
> > StrnCpy()
> > --
> > 2.37.1.windows.1
>
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107454): https://edk2.groups.io/g/devel/message/107454
Mute This Topic: https://groups.io/mt/100501361/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] 回复: [PATCH V2 3/6] MdePkg: Add definitions in DEC for SPI NOR Flash SPDF driver

2023-08-02 Thread gaoliming via groups.io
Abner:
  I add my comments.

> -邮件原件-
> 发件人: abner.ch...@amd.com 
> 发送时间: 2023年8月1日 15:57
> 收件人: devel@edk2.groups.io
> 抄送: Michael D Kinney ; Liming Gao
> ; Zhiguang Liu ; Abdul
> Lateef Attar 
> 主题: [PATCH V2 3/6] MdePkg: Add definitions in DEC for SPI NOR Flash SPDF
> driver
> 
> From: Abner Chang 
> 
> BZ#: 4473
> 
> Signed-off-by: Abner Chang 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Abdul Lateef Attar 
> ---
>  MdePkg/MdePkg.dec | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index b85614992b9..47d8daba826 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -875,6 +875,12 @@
>## Include/Protocol/CcMeasurement.h
>gEfiCcFinalEventsTableGuid = { 0xdd4a4648, 0x2de7, 0x4665, { 0x96,
> 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46 }}
> 
> +  #
> +  # SPI NOR flash JEDEC Serial Flash Discoverable Parameters (SFDP)
driver
> GUID
> +  #
> +  gEdk2JedecSfdpSpiDxeDriverGuid  = { 0xBE71701E, 0xB63C, 0x4574,
> { 0x9C, 0x5C, 0x36, 0x29, 0xE8, 0xEA, 0xC4, 0x14 }}
> +  gEdk2JedecSfdpSpiSmmDriverGuid  = { 0x95A1E915, 0x195C, 0x477C,
> { 0x92, 0x6F, 0x7E, 0x24, 0x67, 0xC1, 0xB3, 0x1F }}
> +

They are for JedecSfdp SPI instance. One GUID can be shared for DXE and SMM.

And, this GUID is not defined in PI spec. So, I suggest to define it into
MdeModulePkg.dec.

Thanks
Liming
>  [Guids.IA32, Guids.X64]
>## Include/Guid/Cper.h
>gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de,
> { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}
> @@ -2232,6 +2238,19 @@
># @Prompt Speculation Barrier Type.
> 
> gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x3000
> 1018
> 
> +  ## SPI NOR Flash operation retry counts
> +  #  0x:  No retry
> +  #  0x:  Maximum retry value
> +  #
> +  # @Prompt SPI NOR Flash Operation Retry Value
> +
> gEfiMdePkgTokenSpaceGuid.PcdSpiNorFlashOperationRetryCount|0x
> |UINT32|0x30001019
> +
> +  ## SPI NOR Flash operation delay in microseconds
> +  #  Deafult is set to 0x000f microseconds
> +  #
> +  # @Prompt SPI NOR Flash Operation Delay in Microseconds
> +
> gEfiMdePkgTokenSpaceGuid.PcdSpiNorFlashOperationDelayMicroseconds|0x
> 000F|UINT32|0x3000101A
> +
>  [PcdsFixedAtBuild,PcdsPatchableInModule]
>## Indicates the maximum length of unicode string used in the following
>#  BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(),
StrCpy(),
> StrnCpy()
> --
> 2.37.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107453): https://edk2.groups.io/g/devel/message/107453
Mute This Topic: https://groups.io/mt/100501078/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for CERT_RSA3072 and CERT_RSA4096

2023-08-02 Thread Sheng Wei
Hi Gao, Liming,
For this patch group, we have got review-by from Yao, Jiewen on patch 
2/3(CryptoPkg) and patch 3/3(SecurityPkg).
Do you any comments on the patch 1/3 (MdePkg) ? 
Patch 1/3 is only to add 2 new GUIDs.
Could you help to merge it ?

Thank you.
BR
Sheng Wei

> -Original Message-
> From: Sheng, W
> Sent: 2023年7月31日 10:02
> To: 'devel@edk2.groups.io' ; Gao, Liming
> 
> Cc: Yao, Jiewen ; Wang, Jian J
> ; Xu, Min M ; Chen, Zeyi
> ; Wang, Fiona ; Lu, Xiaoyu1
> ; Jiang, Guomin ; Kinney,
> Michael D 
> Subject: RE: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for
> CERT_RSA3072 and CERT_RSA4096
> 
> Hi Gao, Liming,
> Could you help to review and merge this patch to MdePkg?
> This patch is only to add 2 new GUIDs.
> These 2 GUIDs will be used for adding RSA3072/RSA4096 cert support for
> secure boot feature.
> Thank you.
> BR
> Sheng Wei
> 
> > > -Original Message-
> > > From: devel@edk2.groups.io  On Behalf Of
> Sheng
> > > Wei
> > > Sent: 2023年7月27日 14:35
> > > To: devel@edk2.groups.io
> > > Cc: Yao, Jiewen ; Wang, Jian J
> > > ; Xu, Min M ; Chen, Zeyi
> > > ; Wang, Fiona ; Lu,
> > > Xiaoyu1 ; Jiang, Guomin
> > > ; Kinney, Michael D
> > > ; Gao, Liming 
> > > Subject: [edk2-devel] [PATCH V5 1/3] MdePkg/Include: Add GUID for
> > > CERT_RSA3072 and CERT_RSA4096
> > >
> > > Add gEfiCertRsa3072Guid and gEfiCertRsa4096Guid
> > >
> > > Cc: Jiewen Yao 
> > > Cc: Jian J Wang 
> > > Cc: Min Xu 
> > > Cc: Zeyi Chen 
> > > Cc: Fiona Wang 
> > > Cc: Xiaoyu Lu 
> > > Cc: Guomin Jiang 
> > > Cc: Michael D Kinney 
> > > Cc: Liming Gao 
> > > Signed-off-by: Sheng Wei 
> > > ---
> > >  MdePkg/Include/Guid/ImageAuthentication.h | 26
> > > +++
> > >  MdePkg/MdePkg.dec |  2 ++
> > >  2 files changed, 28 insertions(+)
> > >
> > > diff --git a/MdePkg/Include/Guid/ImageAuthentication.h
> > > b/MdePkg/Include/Guid/ImageAuthentication.h
> > > index fe83596571..c8ea2c14fb 100644
> > > --- a/MdePkg/Include/Guid/ImageAuthentication.h
> > > +++ b/MdePkg/Include/Guid/ImageAuthentication.h
> > > @@ -144,6 +144,30 @@ typedef struct {
> > >  0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85, 
> > > 0xb3,
> > > 0xb6} \   } +///+/// This identifies a signature containing an RSA-3072 
> > > key.
> > The
> > > key (only the modulus+/// since the public key exponent is known to
> > > be
> > > 0x10001) shall be stored in big-endian+/// order.+/// The
> > > SignatureHeader size shall always be 0. The SignatureSize shall
> > > always be 16 (size+/// of SignatureOwner component) + 384
> bytes.+///+#define
> > > EFI_CERT_RSA3072_GUID \+  { \+0xedd320c2, 0xb057, 0x4b8e, {0xad,
> > 0x46,
> > > 0x2c, 0x9b, 0x85, 0x89, 0xee, 0x92 } \+  }++///+/// This identifies
> > > a signature containing an RSA-4096 key. The key (only the
> > > modulus+/// since the public key exponent is known to be 0x10001)
> > > shall be stored in big-endian+/// order.+/// The SignatureHeader
> > > size shall always be 0. The SignatureSize shall always be 16
> > > (size+/// of SignatureOwner
> > component) + 512
> > > bytes.+///+#define EFI_CERT_RSA4096_GUID \+  { \+0xb23e89a6,
> 0x8c8b,
> > > 0x4412, {0x85, 0x73, 0x15, 0x4e, 0x8d, 0x00, 0x98, 0x2c } \+  }+ ///
> > > /// This identifies a signature containing a RSA-2048 signature of a
> > > SHA-256 hash.  The /// SignatureHeader size shall always be 0. The
> > > SignatureSize shall always be
> > > 16 (size of@@ -330,6 +354,8 @@ typedef struct {  extern EFI_GUID
> > > gEfiImageSecurityDatabaseGuid; extern EFI_GUID gEfiCertSha256Guid;
> > > extern EFI_GUID  gEfiCertRsa2048Guid;+extern EFI_GUID
> > > gEfiCertRsa3072Guid;+extern EFI_GUID  gEfiCertRsa4096Guid; extern
> > > EFI_GUID  gEfiCertRsa2048Sha256Guid; extern EFI_GUID
> > > gEfiCertSha1Guid; extern EFI_GUID  gEfiCertRsa2048Sha1Guid;diff
> > > --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > > b85614992b..24e4779d33 100644
> > > --- a/MdePkg/MdePkg.dec
> > > +++ b/MdePkg/MdePkg.dec
> > > @@ -581,6 +581,8 @@
> > >gEfiImageSecurityDatabaseGuid  = { 0xd719b2cb, 0x3d3a, 0x4596, {0xa3,
> > > 0xbc, 0xda, 0xd0,  0xe, 0x67, 0x65, 0x6f }}   gEfiCertSha256Guid  
> > >=
> > > { 0xc1c41626, 0x504c, 0x4092, {0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93,
> > > 0x43,
> > 0x28 }}
> > > gEfiCertRsa2048Guid= { 0x3c5766e8, 0x269c, 0x4e34, {0xaa, 
> > > 0x14,
> > 0xed,
> > > 0x77, 0x6e, 0x85, 0xb3, 0xb6 }}+  gEfiCertRsa3072Guid=
> { 0xedd320c2,
> > > 0xb057, 0x4b8e, {0xad, 0x46, 0x2c, 0x9b, 0x85, 0x89, 0xee, 0x92 }}+
> > > gEfiCertRsa4096Guid= { 0xb23e89a6, 0x8c8b, 0x4412, {0x85, 
> > > 0x73,
> > 0x15,
> > > 0x4e, 0x8d, 0x00, 0x98, 0x2c }}   gEfiCertRsa2048Sha256Guid  =
> > { 0xe2b36190,
> > > 0x879b, 0x4a3d, {0xad, 0x8d, 0xf2, 0xe7, 0xbb, 0xa3, 0x27, 0x84 }}
> > > gEfiCertSha1Guid   = { 0x826ca512, 0xcf10, 0x4ac9, {0xb1, 
> > > 0x87, 0xbe,
> > > 0x1, 0x49, 0x66, 0x31, 0xbd }}   gEfiCertRsa2048Sha1Guid=
> { 0x67f8444f,
> > > 

回复: [edk2-devel] [PATCH] Add PCI_EXPRESS_EXTENDED_CAPABILITY_DVSEC_ID

2023-08-02 Thread gaoliming via groups.io
Foster:
  Please add MdePkg/Include into the commit message subject. 
  
  The code looks good. Reviewed-by: Liming Gao 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Foster Nong
> 发送时间: 2023年8月2日 12:01
> 收件人: devel@edk2.groups.io
> 抄送: Foster Nong 
> 主题: [edk2-devel] [PATCH] Add
> PCI_EXPRESS_EXTENDED_CAPABILITY_DVSEC_ID
> 
> Package/Module: MdePkg/Include
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4515
> 
> Add
> PCI_EXPRESS_EXTENDED_CAPABILITY_DESIGNATED_VENDOR_SPECIFIC_ID
> 0x0023 in PciExpress40.h
> 
> Signed-off-by: Foster Nong 
> ---
>  MdePkg/Include/IndustryStandard/PciExpress40.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdePkg/Include/IndustryStandard/PciExpress40.h
> b/MdePkg/Include/IndustryStandard/PciExpress40.h
> index 2a6a0f20a4..d0aa7987b8 100644
> --- a/MdePkg/Include/IndustryStandard/PciExpress40.h
> +++ b/MdePkg/Include/IndustryStandard/PciExpress40.h
> @@ -82,6 +82,8 @@ typedef struct {
>  /// The Designated Vendor Specific Capability definitions
> 
>  /// Based on section 7.9.6 of PCI Express Base Specification 4.0.
> 
>  ///@{
> 
> +#define
> PCI_EXPRESS_EXTENDED_CAPABILITY_DESIGNATED_VENDOR_SPECIFIC_ID
> 0x0023
> 
> +
> 
>  typedef union {
> 
>struct {
> 
>  UINT32DvsecVendorId : 16;
> // bit 0..15
> 
> --
> 2.37.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#107444):
> https://edk2.groups.io/g/devel/message/107444
> Mute This Topic: https://groups.io/mt/100499473/4905953
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaolim...@byosoft.com.cn]
> -=-=-=-=-=-=
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107451): https://edk2.groups.io/g/devel/message/107451
Mute This Topic: https://groups.io/mt/100501035/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2 1/6] MdePkg/Include: Update definitions of SPI related header files

2023-08-02 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Hi Liming,
I think as the ECR already approved as the errata by PIWG, can we just merged 
the code to save sometime?

Thanks
Abner

> -Original Message-
> From: gaoliming 
> Sent: Wednesday, August 2, 2023 1:41 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: 'Michael D Kinney' ; 'Zhiguang Liu'
> ; Attar, AbdulLateef (Abdul Lateef)
> 
> Subject: 回复: [PATCH V2 1/6] MdePkg/Include: Update definitions of SPI related
> header files
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Abner:
>   PI 1.8 Errata has not been published. This change may be deferred until
> new spec is public.
>
> Thanks
> Liming
> > -邮件原件-
> > 发件人: abner.ch...@amd.com 
> > 发送时间: 2023年8月1日 15:57
> > 收件人: devel@edk2.groups.io
> > 抄送: Michael D Kinney ; Liming Gao
> > ; Zhiguang Liu ; Abdul
> > Lateef Attar 
> > 主题: [PATCH V2 1/6] MdePkg/Include: Update definitions of SPI related
> > header files
> >
> > From: Abner Chang 
> >
> > BZ#: 4471
> > Update definitions according to PI spec v1.8 Errata as it
> > is approved in PIWG (Ticket #2394).
> >
> > Signed-off-by: Abner Chang 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > Cc: Abdul Lateef Attar 
> > ---
> >  MdePkg/Include/Protocol/SpiConfiguration.h |  8 
> >  MdePkg/Include/Protocol/SpiHc.h| 14 ++
> >  MdePkg/Include/Protocol/SpiIo.h| 10 ++
> >  3 files changed, 32 insertions(+)
> >
> > diff --git a/MdePkg/Include/Protocol/SpiConfiguration.h
> > b/MdePkg/Include/Protocol/SpiConfiguration.h
> > index 3f8fb9ff62c..cffdc8e232d 100644
> > --- a/MdePkg/Include/Protocol/SpiConfiguration.h
> > +++ b/MdePkg/Include/Protocol/SpiConfiguration.h
> > @@ -2,6 +2,7 @@
> >This file defines the SPI Configuration Protocol.
> >
> >Copyright (c) 2017, Intel Corporation. All rights reserved.
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> >SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >@par Revision Reference:
> > @@ -168,6 +169,13 @@ typedef struct _EFI_SPI_BUS {
> >VOID*ClockParameter;
> >  } EFI_SPI_BUS;
> >
> > +///
> > +/// Definitions of SPI Part Attributes.
> > +///
> > +#define SPI_PART_SUPPORTS_2_BIT_DATA_BUS_WIDTH  BIT0
> > +#define SPl_PART_SUPPORTS_4_B1T_DATA_BUS_WIDTH  BIT1
> > +#define SPl_PART_SUPPORTS_8_B1T_DATA_BUS_WIDTH  BIT2
> > +
> >  ///
> >  /// The EFI_SPI_PERIPHERAL data structure describes how a specific block
> of
> >  /// logic which is connected to the SPI bus. This data structure also
> selects
> > diff --git a/MdePkg/Include/Protocol/SpiHc.h
> > b/MdePkg/Include/Protocol/SpiHc.h
> > index 30128dd5c4d..645bfdefe9b 100644
> > --- a/MdePkg/Include/Protocol/SpiHc.h
> > +++ b/MdePkg/Include/Protocol/SpiHc.h
> > @@ -2,6 +2,7 @@
> >This file defines the SPI Host Controller Protocol.
> >
> >Copyright (c) 2017, Intel Corporation. All rights reserved.
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> >SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >@par Revision Reference:
> > @@ -121,6 +122,19 @@ typedef EFI_STATUS
> >IN EFI_SPI_BUS_TRANSACTION*BusTransaction
> >);
> >
> > +///
> > +/// Definitions of SPI Host Controller Attributes.
> > +///
> > +#define HC_SUPPORTS_WRITE_ONLY_OPERATIONS   BIT0
> > +#define HC_SUPPORTS_READ_ONLY_OPERATIONSBIT1
> > +#define HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS  BIT2
> > +#define HC_TX_FRAME_IN_MOST_SIGNIFICANT_BITSBIT3
> > +#define HC_RX_FRAME_IN_MOST_SIGNIFICANT_BITSBIT4
> > +#define HC_SUPPORTS_2_BIT_DATA_BUS_WIDTHBIT5
> > +#define HC_SUPPORTS_4_BIT_DATA_BUS_WIDTHBIT6
> > +#define HC_SUPPORTS_8_BIT_DATA_BUS_WIDTHBIT7
> > +#define HC_TRANSFER_SIZE_INCLUDES_OPCODEBIT8
> > +#define HC_TRANSFER_SIZE_INCLUDES_ADDRESS   BIT9
> >  ///
> >  /// Support a SPI data transaction between the SPI controller and a SPI
> chip.
> >  ///
> > diff --git a/MdePkg/Include/Protocol/SpiIo.h
> > b/MdePkg/Include/Protocol/SpiIo.h
> > index b4fc5e03b88..0ea881fd115 100644
> > --- a/MdePkg/Include/Protocol/SpiIo.h
> > +++ b/MdePkg/Include/Protocol/SpiIo.h
> > @@ -2,6 +2,7 @@
> >This file defines the SPI I/O Protocol.
> >
> >Copyright (c) 2017, Intel Corporation. All rights reserved.
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> >SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >@par Revision Reference:
> > @@ -223,6 +224,15 @@ typedef struct _EFI_SPI_BUS_TRANSACTION {
> >UINT8   *ReadBuffer;
> >  } EFI_SPI_BUS_TRANSACTION;
> >
> > +///
> > +/// Definitions of SPI I/O Attributes.
> > +///
> > +#define SPI_IO_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT0
> > +#define SPI_IO_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT1
> > +#define SPI_IO_SUPPORTS_8_BIT_DATA_BUS_WIDTH   BIT2
> > +#define SPI_IO_TRANSFER_SIZE_INCLUDES_OPCODE