]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
CryptoPkg: Add new hash algorithm ParallelHash256HashAll in BaseCryptLib.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLibOnProtocolPpi / CryptLib.c
index c8df259ea963e7ed6768bb59a10dcd8f5c9a45eb..8ee1b53cf957a5ee7109cc8fd249b9eb69aec239 100644 (file)
@@ -3,7 +3,7 @@
   Protocol/PPI.\r
 \r
   Copyright (C) Microsoft Corporation. All rights reserved.\r
-  Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -870,6 +870,38 @@ Sha512HashAll (
   CALL_CRYPTO_SERVICE (Sha512HashAll, (Data, DataSize, HashValue), FALSE);\r
 }\r
 \r
+/**\r
+  Parallel hash function ParallelHash256, as defined in NIST's Special Publication 800-185,\r
+  published December 2016.\r
+\r
+  @param[in]   Input            Pointer to the input message (X).\r
+  @param[in]   InputByteLen     The number(>0) of input bytes provided for the input data.\r
+  @param[in]   BlockSize        The size of each block (B).\r
+  @param[out]  Output           Pointer to the output buffer.\r
+  @param[in]   OutputByteLen    The desired number of output bytes (L).\r
+  @param[in]   Customization    Pointer to the customization string (S).\r
+  @param[in]   CustomByteLen    The length of the customization string in bytes.\r
+\r
+  @retval TRUE   ParallelHash256 digest computation succeeded.\r
+  @retval FALSE  ParallelHash256 digest computation failed.\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ParallelHash256HashAll (\r
+  IN CONST VOID   *Input,\r
+  IN       UINTN  InputByteLen,\r
+  IN       UINTN  BlockSize,\r
+  OUT      VOID   *Output,\r
+  IN       UINTN  OutputByteLen,\r
+  IN CONST VOID   *Customization,\r
+  IN       UINTN  CustomByteLen\r
+  )\r
+{\r
+  CALL_CRYPTO_SERVICE (ParallelHash256HashAll, (Input, InputByteLen, BlockSize, Output, OutputByteLen, Customization, CustomByteLen), FALSE);\r
+}\r
+\r
 /**\r
   Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.\r
 \r