Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: introduce RedfishBootstrapAccountDxe

2024-04-21 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Hi Nickle,
One comment and few questions,

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, April 18, 2024 8:28 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: introduce
> RedfishBootstrapAccountDxe
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Introduce RedfishBootstrapAccountDxe to delete bootstrap
> account from /redfish/v1/AccountService/Accounts after BIOS
> finished all Redfish jobs. The bootstrap account won't be
> available to other application. So deleting bootstrap account
> helps to release resource at BMC.
> - After bootstrap account is deleted at BMC, the Redfish service
> instance is no longer usable. Close Redfish service instance to
> release the HTTP connection between BIOS and BMC.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishClientComponents.dsc.inc   |   1 +
>  .../RedfishBootstrapAccountDxe.inf|  53 +++
>  .../RedfishBootstrapAccountDxe.h  |  58 
>  .../RedfishBootstrapAccountDxe.c  | 328 ++
>  RedfishClientPkg/RedfishClient.fdf.inc|   1 +
>  5 files changed, 441 insertions(+)
>  create mode 100644
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.inf
>  create mode 100644
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.h
>  create mode 100644
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.c
>
> diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc
> b/RedfishClientPkg/RedfishClientComponents.dsc.inc
> index 42fc0c299..fe5248b62 100644
> --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc
> +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc
> @@ -20,6 +20,7 @@
>RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf
>RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf
>RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf
> +
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.inf
>  !endif
>#
># Below two modules should be pulled in by build tool.
> diff --git
> a/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in
> f
> b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in
> f
> new file mode 100644
> index 0..4073e95f4
> --- /dev/null
> +++
> b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in
> f
> @@ -0,0 +1,53 @@
> +## @file
> +#  This driver deletes bootstrap account in BMC after BIOS Redfish finished
> +#  all jobs
> +#
> +#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +#  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.


Not sure if you want to update the copyright to 2024.


> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION   = 0x0001000b
> +  BASE_NAME = RedfishBootstrapAccountDxe
> +  FILE_GUID = 87555253-2F7E-45FC-B469-FD35B2E51210
> +  MODULE_TYPE   = DXE_DRIVER
> +  VERSION_STRING= 1.0
> +  ENTRY_POINT   = RedfishBootstrapAccountEntryPoint
> +  UNLOAD_IMAGE  = RedfishBootstrapAccountUnload
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  RedfishPkg/RedfishPkg.dec
> +  RedfishClientPkg/RedfishClientPkg.dec
> +
> +[Sources]
> +  RedfishBootstrapAccountDxe.h
> +  RedfishBootstrapAccountDxe.c
> +
> +[LibraryClasses]
> +  BaseLib
> +  BaseMemoryLib
> +  DebugLib
> +  MemoryAllocationLib
> +  PrintLib
> +  RedfishEventLib
> +  RedfishFeatureUtilityLib
> +  RedfishDebugLib
> +  RedfishVersionLib
> +  RedfishHttpLib
> +  UefiLib
> +  UefiBootServicesTableLib
> +  UefiRuntimeServicesTableLib
> +  UefiDriverEntryPoint
> +
> +[Protocols]
> +  gEdkIIRedfishConfigHandlerProtocolGuid  ## CONSUMES ##
> +  gEdkIIRedfishCredentialProtocolGuid ## CONSUMES ##
> +  gEfiRestExProtocolGuid  ## CONSUMES ##
> +
> +[Depex]
> +  gEdkIIRedfishCredentialProtocolGuid
> diff --git
> a/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.h
> b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.h
> new file mode 100644
> index 0..5262f1e6b
> --- /dev/null
> +++
> b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.h
> @@ -0,0 +1,58 @@
> +/** @file
> +  Common header file for RedfishBootstrapAccountDxe driver.
> +
> +  (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISH_BOOTSTRAP_ACCOUNT_DXE_H_
> +#define 

[edk2-devel] [PATCH v1 1/1] BaseTools/Fmmt.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid
escape sequence now generates

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Gua Guo 
---
 BaseTools/Source/Python/FMMT/FMMT.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index 26fc4c5792..7505b6c88a 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -37,7 +37,7 @@ parser.add_argument("-l", "--LayoutFileName", 
dest="LayoutFileName", nargs='+',
 the file will be generated with default name 
(Layout_'InputFileName'.txt). \
 Currently supports two formats: json, txt. More 
formats will be added in the future")
 parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", nargs='+',
-help="Provide the target FmmtConf.ini file path: '-c 
C:\Code\FmmtConf.ini' \
+help="Provide the target FmmtConf.ini file path: '-c 
C:\\Code\\FmmtConf.ini' \
 FmmtConf file saves the target guidtool used in 
compress/uncompress process.\
 If do not provide, FMMT tool will search the inputfile 
folder for FmmtConf.ini firstly, if not found,\
 the FmmtConf.ini saved in FMMT tool's folder will be 
used as default.")
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 0/1] BaseTools/Fmmt.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

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

V1:
  Ref to https://docs.python.org/3/whatsnew/3.12.html
  A backslash-character pair that is not a valid
  escape sequence now generates

Gua Guo (1):
  BaseTools/Fmmt.py: Python 3.12 support

 BaseTools/Source/Python/FMMT/FMMT.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118063): https://edk2.groups.io/g/devel/message/118063
Mute This Topic: https://groups.io/mt/105662554/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 0/2] IntelFsp2Pkg: Python3.12 support

2024-04-21 Thread Guo, Gua
Hi FSP folks 

Need to get one of your help, to approve this PR, maybe we can merge it EOW.

Thanks
Gua
-Original Message-
From: Guo, Gua  
Sent: Monday, April 22, 2024 9:37 AM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5577
V1: Prevent Syntax Warning after upgrade python version to 3.12


Gua Guo (2):
  IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support
  IntelFsp2Pkg/PatchFv.py: Python 3.12 support

 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 IntelFsp2Pkg/Tools/PatchFv.py   | 24 -
 2 files changed, 60 insertions(+), 60 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 2/2] IntelFsp2Pkg/PatchFv.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid
escape sequence now generates

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Duggapu Chinni B 
Cc: Star Zeng 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Signed-off-by: Gua Guo 
---
 IntelFsp2Pkg/Tools/PatchFv.py | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 73ab877c71..bd9aa71e3c 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -143,7 +143,7 @@ class Symbols:
 fdIn.close()
 fvInfo['Base'] = 0
 for rptLine in rptLines:
-match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
+match = re.match(r"^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match:
 fvInfo['Base'] = int(match.group(1), 16)
 break
@@ -312,7 +312,7 @@ class Symbols:
 self.fdBase = 0x
 while (rptLine != "" ):
 #EFI_BASE_ADDRESS = 0xFFFDF400
-match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
+match = re.match(r"^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match is not None:
 self.fdBase = int(match.group(1), 16) - fvOffset
 break
@@ -340,7 +340,7 @@ class Symbols:
 fdIn = open(fvTxtFile, "r")
 rptLine  = fdIn.readline()
 while (rptLine != "" ):
-match = re.match("(0x[a-fA-F0-9]+)\s([0-9a-fA-F\-]+)", rptLine)
+match = re.match(r"(0x[a-fA-F0-9]+)\s([0-9a-fA-F\-]+)", rptLine)
 if match is not None:
 if match.group(2) in self.dictFfsOffset:
 self.dictFfsOffset[fvName + ':' + match.group(2)] = 
"0x%08X" % (int(match.group(1), 16) + fvOffset)
@@ -374,10 +374,10 @@ class Symbols:
 while (rptLine != "" ):
 if rptLine[0] != ' ':
 #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, 
EntryPoint=0x00fffb4958,Type=PE)
-match = 
re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)",
 rptLine)
+match = 
re.match(r"([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)",
 rptLine)
 if match is None:
 #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, 
EntryPoint=0x00fffb4958)
-match = 
re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
 rptLine)
+match = 
re.match(r"([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
 rptLine)
 if match is not None:
 foundModHdr = True
 modName = match.group(1)
@@ -386,7 +386,7 @@ class Symbols:
 self.dictModBase['%s:BASE'  % modName] = int 
(match.group(2), 16)
 self.dictModBase['%s:ENTRY' % modName] = int 
(match.group(3), 16)
 #(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 
.textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
-match = 
re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)",
 rptLine)
+match = 
re.match(r"\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)",
 rptLine)
 if match is not None:
 if foundModHdr:
 foundModHdr = False
@@ -399,7 +399,7 @@ class Symbols:
 else:
 #   0x00fff8016c__ModuleEntryPoint
 foundModHdr = False
-match = re.match("^\s+(0x[a-z0-9]+)\s+([_a-zA-Z0-9]+)", 
rptLine)
+match = re.match(r"^\s+(0x[a-z0-9]+)\s+([_a-zA-Z0-9]+)", 
rptLine)
 if match is not None:
 self.dictSymbolAddress["%s:%s"%(modName, match.group(2))] 
= match.group(1)
 rptLine  = fdIn.readline()
@@ -432,14 +432,14 @@ class Symbols:
 if reportLine.strip().find("Archive member included") != -1:
 #GCC
 #0x1d55IoRead8
-patchMapFileMatchString = 
"\s+(0x[0-9a-fA-F]{16})\s+([^\s][^0x][_a-zA-Z0-9\-]+)\s"
+patchMapFileMatchString = 
r"\s+(0x[0-9a-fA-F]{16})\s+([^\s][^0x][_a-zA-Z0-9\-]+)\s"
 matchKeyGroupIndex = 2
 matchSymbolGroupIndex  = 1
 prefix = '_'
 else:
 #MSFT
 #0003:0190   _gComBase  7a50 
SerialPo
-patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"
+patchMapFileMatchString =  

[edk2-devel] [PATCH v1 1/2] IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid
escape sequence now generates

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Duggapu Chinni B 
Cc: Star Zeng 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Signed-off-by: Gua Guo 
---
 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 13be81ddbc..79923c07ed 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -136,7 +136,7 @@ class CLogicalExpression:
 var = var.strip()
 if   re.match('^0x[a-fA-F0-9]+$', var):
 value = int(var, 16)
-elif re.match('^[+-]?\d+$', var):
+elif re.match(r'^[+-]?\d+$', var):
 value = int(var, 10)
 else:
 value = None
@@ -147,7 +147,7 @@ class CLogicalExpression:
 var = ''
 while not self.isLast():
 char = self.getCurr()
-if re.match('^[\w.]', char):
+if re.match(r'^[\w.]', char):
 var += char
 self.moveNext()
 else:
@@ -161,7 +161,7 @@ class CLogicalExpression:
 
 def parseSingleOp(self):
 self.skipSpace()
-if re.match('^NOT\W', self.getCurr(-1)):
+if re.match(r'^NOT\W', self.getCurr(-1)):
 self.moveNext(3)
 op  = self.parseBrace()
 val = self.getNumber (op)
@@ -225,7 +225,7 @@ class CLogicalExpression:
 value = self.parseCompare()
 while True:
 self.skipSpace()
-if re.match('^AND\W', self.getCurr(-1)):
+if re.match(r'^AND\W', self.getCurr(-1)):
 self.moveNext(3)
 result = self.parseCompare()
 test = self.getNonNumber(result, value)
@@ -243,10 +243,10 @@ class CLogicalExpression:
 while True:
 self.skipSpace()
 op = None
-if re.match('^XOR\W', self.getCurr(-1)):
+if re.match(r'^XOR\W', self.getCurr(-1)):
 self.moveNext(3)
 op = '^'
-elif re.match('^OR\W', self.getCurr(-1)):
+elif re.match(r'^OR\W', self.getCurr(-1)):
 self.moveNext(2)
 op = '|'
 else:
@@ -330,11 +330,11 @@ EndList
 continue
 if IsExpression:
 IsExpression = False
-Match = re.match("(\w+)=(.+)", Macro)
+Match = re.match(r"(\w+)=(.+)", Macro)
 if Match:
 self._MacroDict[Match.group(1)] = Match.group(2)
 else:
-Match = re.match("(\w+)", Macro)
+Match = re.match(r"(\w+)", Macro)
 if Match:
 self._MacroDict[Match.group(1)] = ''
 if len(self._MacroDict) == 0:
@@ -355,7 +355,7 @@ EndList
 
 def ExpandMacros (self, Input, Preserve = False):
 Line = Input
-Match = re.findall("\$\(\w+\)", Input)
+Match = re.findall(r"\$\(\w+\)", Input)
 if Match:
 for Each in Match:
   Variable = Each[2:-1]
@@ -370,7 +370,7 @@ EndList
 
 def ExpandPcds (self, Input):
 Line = Input
-Match = re.findall("(\w+\.\w+)", Input)
+Match = re.findall(r"(\w+\.\w+)", Input)
 if Match:
 for PcdName in Match:
   if PcdName in self._PcdsDict:
@@ -390,7 +390,7 @@ EndList
 return Result
 
 def ValueToByteArray (self, ValueStr, Length):
-Match = re.match("\{\s*FILE:(.+)\}", ValueStr)
+Match = re.match(r"\{\s*FILE:(.+)\}", ValueStr)
 if Match:
   FileList = Match.group(1).split(',')
   Result  = bytearray()
@@ -427,7 +427,7 @@ EndList
 if Each[0] in ['"', "'"]:
 Result.extend(list(bytearray(Each[1:-1], 'utf-8')))
 elif ':' in Each:
-Match= re.match("(.+):(\d+)b", Each)
+Match= re.match(r"(.+):(\d+)b", Each)
 if Match is None:
 raise Exception("Invald value list format '%s' !" 
% Each)
 InBitField = True
@@ -539,7 +539,7 @@ EndList
   continue
 
 Handle   = False
-Match= re.match("^\[(.+)\]", DscLine)
+Match= re.match(r"^\[(.+)\]", DscLine)
 if Match is not None:
 IsDefSect = False
 IsPcdSect = False
@@ -575,7 +575,7 @@ EndList
 
 Match = False if DscLine[0] != '!' else True
 if Match:
-Match = 
re.match("^!(else|endif|ifdef|ifndef|if|elseif|include)\s*(.+)?$", 
DscLine.split("#")[0])
+Match = 

[edk2-devel] [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5577
V1: Prevent Syntax Warning after upgrade python version to 3.12


Gua Guo (2):
  IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support
  IntelFsp2Pkg/PatchFv.py: Python 3.12 support

 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 IntelFsp2Pkg/Tools/PatchFv.py   | 24 -
 2 files changed, 60 insertions(+), 60 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH] Add SHA3/SM3 functions with openssl for Mbedtls

2024-04-21 Thread Wenxing Hou
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4177

Because the Mbedlts 3.3.0 doesn't have SHA3 and Sm3, the SHA3 and Sm3
implementaion based on Openssl.

Cc: Jiewen Yao 
Cc: Yi Li 
Signed-off-by: Wenxing Hou 
---
 CryptoPkg/CryptoPkg.ci.yaml   |   1 +
 .../BaseCryptLibMbedTls/Hash/CryptCShake256.c | 282 +
 .../Hash/CryptDispatchApDxe.c |  49 ++
 .../Hash/CryptDispatchApMm.c  |  35 ++
 .../Hash/CryptDispatchApPei.c |  54 ++
 .../Hash/CryptParallelHash.c  | 254 
 .../Hash/CryptParallelHash.h  | 231 +++
 .../BaseCryptLibMbedTls/Hash/CryptSha3.c  | 166 +
 .../BaseCryptLibMbedTls/Hash/CryptSm3.c   | 235 +++
 .../BaseCryptLibMbedTls/Hash/CryptXkcp.c  | 107 
 .../SysCall/DummyOpensslSupport.c | 595 ++
 CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf   |   6 +
 .../Library/MbedTlsLib/MbedTlsLibFull.inf |   6 +
 13 files changed, 2021 insertions(+)
 create mode 100644 CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptCShake256.c
 create mode 100644 
CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptDispatchApDxe.c
 create mode 100644 
CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptDispatchApMm.c
 create mode 100644 
CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptDispatchApPei.c
 create mode 100644 
CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptParallelHash.c
 create mode 100644 
CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptParallelHash.h
 create mode 100644 CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptSha3.c
 create mode 100644 CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptSm3.c
 create mode 100644 CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptXkcp.c
 create mode 100644 
CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/DummyOpensslSupport.c

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index b601bcf85c..046cc05163 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -40,6 +40,7 @@
 "Library/Include/CrtLibSupport.h",
 # This has OpenSSL interfaces that aren't UEFI spec compliant
 "Library/BaseCryptLib/Hash/CryptParallelHash.h",
+"Library/BaseCryptLibMbedTls/Hash/CryptParallelHash.h",
 "Library/Include/fcntl.h",
 # This has Mbedtls interfaces that aren't UEFI spec compliant
 "Library/Include/stdint.h",
diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptCShake256.c 
b/CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptCShake256.c
new file mode 100644
index 00..64d8fa97c5
--- /dev/null
+++ b/CryptoPkg/Library/BaseCryptLibMbedTls/Hash/CryptCShake256.c
@@ -0,0 +1,282 @@
+/** @file
+  cSHAKE-256 Digest Wrapper Implementations.
+
+Copyright (c) 2024, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "CryptParallelHash.h"
+
+#define  CSHAKE256_SECURITY_STRENGTH  256
+#define  CSHAKE256_RATE_IN_BYTES  136
+
+CONST CHAR8  mZeroPadding[CSHAKE256_RATE_IN_BYTES] = { 0 };
+
+/**
+  CShake256 initial function.
+
+  Initializes user-supplied memory pointed by CShake256Context as cSHAKE-256 
hash context for
+  subsequent use.
+
+  @param[out] CShake256Context  Pointer to cSHAKE-256 context being 
initialized.
+  @param[in]  OutputLen The desired number of output length in bytes.
+  @param[in]  Name  Pointer to the function name string.
+  @param[in]  NameLen   The length of the function name in bytes.
+  @param[in]  Customization Pointer to the customization string.
+  @param[in]  CustomizationLen  The length of the customization string in 
bytes.
+
+  @retval TRUE   cSHAKE-256 context initialization succeeded.
+  @retval FALSE  cSHAKE-256 context initialization failed.
+  @retval FALSE  This interface is not supported.
+**/
+BOOLEAN
+EFIAPI
+CShake256Init (
+  OUT  VOID*CShake256Context,
+  IN   UINTN   OutputLen,
+  IN   CONST VOID  *Name,
+  IN   UINTN   NameLen,
+  IN   CONST VOID  *Customization,
+  IN   UINTN   CustomizationLen
+  )
+{
+  BOOLEAN  Status;
+  UINT8EncBuf[sizeof (UINTN) + 1];
+  UINTNEncLen;
+  UINTNAbsorbLen;
+  UINTNPadLen;
+
+  //
+  // Check input parameters.
+  //
+  if ((CShake256Context == NULL) || (OutputLen == 0) || ((NameLen != 0) && 
(Name == NULL)) || ((CustomizationLen != 0) && (Customization == NULL))) {
+return FALSE;
+  }
+
+  //
+  // Initialize KECCAK context with pad value and block size.
+  //
+  if ((NameLen == 0) && (CustomizationLen == 0)) {
+//
+// When N and S are both empty strings, cSHAKE(X, L, N, S) is equivalent to
+// SHAKE as defined in FIPS 202.
+//
+Status = (BOOLEAN)KeccakInit (
+(Keccak1600_Ctx *)CShake256Context,
+'\x1f',
+(KECCAK1600_WIDTH - CSHAKE256_SECURITY_STRENGTH * 2) / 
8,
+OutputLen
+   

Re: [edk2-devel] [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

2024-04-21 Thread Guo, Gua
Hi @Liming Gao and @Rebecca Cran

May I get one of your help for code review + 1 ?
Maybe we can merge it EOW, I think it's no harmful change.

Thanks,
Gua

-Original Message-
From: Guo, Gua  
Sent: Sunday, April 21, 2024 8:51 PM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Kasbekar, Saloni 
Subject: [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5576
V1: Currently, Build FSP will be failure by python3.12 by calling 
GetUtcDateTime.py

Gua Guo (1):
  BaseTools/GetUtcDateTime.py: Python 3.12 support

 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] Event: Tools, CI, Code base construction meeting series - Monday, April 22, 2024 #cal-reminder

2024-04-21 Thread Group Notification
*Reminder: Tools, CI, Code base construction meeting series*

*When:*
Monday, April 22, 2024
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZDI2ZDg4NmMtMjI1My00MzI5LWFmYjAtMGQyNjUzNTBjZGYw%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%2223af6561-6e1c-450d-b917-d9d674eb3cb6%22%7d

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

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118056): https://edk2.groups.io/g/devel/message/118056
Mute This Topic: https://groups.io/mt/105660741/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 1/2] Platform/AMD: Add AmdSvsmLib to required DSC files

2024-04-21 Thread Xing, Eric via groups.io
[AMD Official Use Only - General]

Hi Ard,

Please let me merge VangoGh board code next time after we finished the review 
process and build/verification test since I am maintainer and responsible for 
Vangogh Board platform code.

I will discuss it inside AMD to how to resolve current 
Platform/AMD/VanGoghBoard platform code build fail issue and reduce customer 
impact.
I will also discuss with Abner and other AMD reviewers to make a solution we 
want to move on.


Thanks,
Eric

> -Original Message-
> From: Ard Biesheuvel 
> Sent: Friday, April 19, 2024 10:12 PM
> To: Chang, Abner 
> Cc: Xing, Eric ; devel@edk2.groups.io; Zhai, MingXin
> (Duke) ; Lendacky, Thomas
> ; Yao, Ken ; Roth,
> Michael ; Attar, AbdulLateef (Abdul Lateef)
> ; Ard Biesheuvel
> ; Gerd Hoffmann ; Min
> Xu ; Leif Lindholm 
> Subject: Re: [edk2-devel] [PATCH 1/2] Platform/AMD: Add AmdSvsmLib to
> required DSC files
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On Fri, 19 Apr 2024 at 15:00, Chang, Abner  wrote:
> >
> > [AMD Official Use Only - General]
> >
> > I guess my RB misled contributors thought the patch is good to merge.
> However, I was thinking Eric's team should give the final RB after the
> validation as they are the maintainers for the subordinate VanGoghBoard
> platform. Suppose the impacted packages should be built successfully with
> the patches applied, as this is considered the base requirement of the code
> change. Nevertheless, the special build sauce for VanGoghBoard may be not
> easy for contributors to verify the build.
> >
> > Eric, I have few suggestions for this failure, for the short term, you can
> commit another change to remove this change, as the build failure has
> impacts on our customer support. You can decide to recover this or not
> depends on your business requirement.
>
> Keeping edk2-platforms synced with edk2 is already complicated enough.
> So I object to changes to retain compatibility with downstream forks of EDK2.
> Surely, you are not telling your customers to use EDK202208 with whatever
> the top-of-tree of edk2-platforms is at any given moment?
>
> In any case, if upstream edk2 is important to you, please fix the current
> situation in edk2 first. If it is not important to you, I don't see a reason 
> to
> revert anything, and you can fix it in your downstream.


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




[edk2-devel] [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5576
V1: Currently, Build FSP will be failure by python3.12 by calling 
GetUtcDateTime.py

Gua Guo (1):
  BaseTools/GetUtcDateTime.py: Python 3.12 support

 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 1/1] BaseTools/GetUtcDateTime.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
utcnow() and utcfromtimestamp() are deprecated
Prevent use it cause build error.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Gua Guo 
---
 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/GetUtcDateTime.py 
b/BaseTools/Scripts/GetUtcDateTime.py
index 3cfb6ac2ae..6764fb22a7 100644
--- a/BaseTools/Scripts/GetUtcDateTime.py
+++ b/BaseTools/Scripts/GetUtcDateTime.py
@@ -29,7 +29,7 @@ def Main():
 print ("ERROR: At least one argument is required!\n")
 PARSER.print_help()
 
-today = datetime.datetime.utcnow()
+today = datetime.datetime.now(datetime.UTC)
 if ARGS.year:
 ReversedNumber = str(today.year)[::-1]
 print (''.join(hex(ord(HexString))[2:] for HexString in 
ReversedNumber))
-- 
2.39.2.windows.1



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