Hash/CryptSha256.c\r
Hash/CryptSha512.c\r
Hash/CryptSm3.c\r
- Hash/CryptParallelHashNull.c\r
+ Hash/CryptSha3.c\r
+ Hash/CryptXkcp.c\r
+ Hash/CryptCShake256.c\r
+ Hash/CryptParallelHash.c\r
+ Hash/CryptDispatchApDxe.c\r
Hmac/CryptHmac.c\r
Kdf/CryptHkdf.c\r
Cipher/CryptAes.c\r
OpensslLib\r
IntrinsicLib\r
PrintLib\r
+ UefiBootServicesTableLib\r
+ SynchronizationLib\r
+\r
+[Protocols]\r
+ gEfiMpServiceProtocolGuid\r
\r
#\r
# Remove these [BuildOptions] after this library is cleaned up\r
--- /dev/null
+/** @file\r
+ Dispatch Block to Aps in Dxe phase for parallelhash algorithm.\r
+\r
+Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "CryptParallelHash.h"\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Protocol/MpService.h>\r
+\r
+/**\r
+ Dispatch the block task to each AP in PEI phase.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DispatchBlockToAp (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_MP_SERVICES_PROTOCOL *MpServices;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiMpServiceProtocolGuid,\r
+ NULL,\r
+ (VOID **)&MpServices\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Failed to locate MpServices Protocol, do parallel hash by one core.\r
+ //\r
+ DEBUG ((DEBUG_ERROR, "[DispatchBlockToApDxe] Failed to locate MpServices Protocol. Status = %r\n", Status));\r
+ return;\r
+ }\r
+\r
+ Status = MpServices->StartupAllAPs (\r
+ MpServices,\r
+ ParallelHashApExecute,\r
+ FALSE,\r
+ NULL,\r
+ 0,\r
+ NULL,\r
+ NULL\r
+ );\r
+ return;\r
+}\r
--- /dev/null
+/** @file\r
+ Dispatch the block task to each AP in Smm mode for parallelhash algorithm.\r
+\r
+Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "CryptParallelHash.h"\r
+#include <Library/MmServicesTableLib.h>\r
+\r
+/**\r
+ Dispatch the block task to each AP in SMM mode.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DispatchBlockToAp (\r
+ VOID\r
+ )\r
+{\r
+ UINTN Index;\r
+\r
+ if (gMmst == NULL) {\r
+ return;\r
+ }\r
+\r
+ for (Index = 0; Index < gMmst->NumberOfCpus; Index++) {\r
+ if (Index != gMmst->CurrentlyExecutingCpu) {\r
+ gMmst->MmStartupThisAp (ParallelHashApExecute, Index, NULL);\r
+ }\r
+ }\r
+\r
+ return;\r
+}\r
--- /dev/null
+/** @file\r
+ Dispatch Block to Aps in Pei phase for parallelhash algorithm.\r
+\r
+Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "CryptParallelHash.h"\r
+#include <Library/PeiServicesTablePointerLib.h>\r
+#include <PiPei.h>\r
+#include <Ppi/MpServices.h>\r
+#include <Library/PeiServicesLib.h>\r
+\r
+/**\r
+ Dispatch the block task to each AP in PEI phase.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DispatchBlockToAp (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ CONST EFI_PEI_SERVICES **PeiServices;\r
+ EFI_PEI_MP_SERVICES_PPI *MpServicesPpi;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ Status = (*PeiServices)->LocatePpi (\r
+ PeiServices,\r
+ &gEfiPeiMpServicesPpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **)&MpServicesPpi\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Failed to locate MpServices Ppi, do parallel hash by one core.\r
+ //\r
+ DEBUG ((DEBUG_ERROR, "[DispatchBlockToApPei] Failed to locate MpServices Ppi. Status = %r\n", Status));\r
+ return;\r
+ }\r
+\r
+ Status = MpServicesPpi->StartupAllAPs (\r
+ (CONST EFI_PEI_SERVICES **)PeiServices,\r
+ MpServicesPpi,\r
+ ParallelHashApExecute,\r
+ FALSE,\r
+ 0,\r
+ NULL\r
+ );\r
+ return;\r
+}\r
**/\r
\r
#include "CryptParallelHash.h"\r
-#include <Library/MmServicesTableLib.h>\r
#include <Library/SynchronizationLib.h>\r
\r
#define PARALLELHASH_CUSTOMIZATION "ParallelHash"\r
}\r
}\r
\r
-/**\r
- Dispatch the block task to each AP in SMM mode.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-MmDispatchBlockToAP (\r
- VOID\r
- )\r
-{\r
- UINTN Index;\r
-\r
- for (Index = 0; Index < gMmst->NumberOfCpus; Index++) {\r
- if (Index != gMmst->CurrentlyExecutingCpu) {\r
- gMmst->MmStartupThisAp (ParallelHashApExecute, Index, NULL);\r
- }\r
- }\r
-\r
- return;\r
-}\r
-\r
/**\r
Parallel hash function ParallelHash256, as defined in NIST's Special Publication 800-185,\r
published December 2016.\r
//\r
// Dispatch blocklist to each AP.\r
//\r
- if (gMmst != NULL) {\r
- MmDispatchBlockToAP ();\r
- }\r
+ DispatchBlockToAp ();\r
\r
//\r
// Wait until all block hash completed.\r
IN UINTN CustomizationLen,\r
OUT UINT8 *HashValue\r
);\r
+\r
+/**\r
+ Complete computation of digest of each block.\r
+\r
+ Each AP perform the function called by BSP.\r
+\r
+ @param[in] ProcedureArgument Argument of the procedure.\r
+**/\r
+VOID\r
+EFIAPI\r
+ParallelHashApExecute (\r
+ IN VOID *ProcedureArgument\r
+ );\r
+\r
+/**\r
+ Dispatch the block task to each AP.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DispatchBlockToAp (\r
+ VOID\r
+ );\r
Hash/CryptSha256.c\r
Hash/CryptSm3.c\r
Hash/CryptSha512.c\r
- Hash/CryptParallelHashNull.c\r
+ Hash/CryptSha3.c\r
+ Hash/CryptXkcp.c\r
+ Hash/CryptCShake256.c\r
+ Hash/CryptParallelHash.c\r
+ Hash/CryptDispatchApPei.c\r
Hmac/CryptHmac.c\r
Kdf/CryptHkdf.c\r
Cipher/CryptAesNull.c\r
OpensslLib\r
IntrinsicLib\r
PrintLib\r
+ PeiServicesTablePointerLib\r
+ PeiServicesLib\r
+ SynchronizationLib\r
\r
+[Ppis]\r
+ gEfiPeiMpServicesPpiGuid\r
#\r
# Remove these [BuildOptions] after this library is cleaned up\r
#\r
Hash/CryptXkcp.c\r
Hash/CryptCShake256.c\r
Hash/CryptParallelHash.c\r
+ Hash/CryptDispatchApMm.c\r
Hmac/CryptHmac.c\r
Kdf/CryptHkdfNull.c\r
Cipher/CryptAes.c\r