From c1e662101addbfd983026f06d119da2d470865a1 Mon Sep 17 00:00:00 2001 From: Zhihao Li Date: Fri, 18 Mar 2022 12:22:09 +0800 Subject: CryptoPkg: Add new hash algorithm ParallelHash256HashAll in BaseCryptLib. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3596 Parallel hash function ParallelHash256HashAll, as defined in NIST's Special Publication 800-185, published December 2016. It utilizes multi-process to calculate the digest. Passed CI test. Onprotocol version code passed test. Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang Cc: Siyuan Fu Signed-off-by: Zhihao Li Reviewed-by: Jiewen Yao --- CryptoPkg/Include/Library/BaseCryptLib.h | 31 +++++++++++++++++++++- .../Include/Pcd/PcdCryptoServiceFamilyEnable.h | 15 ++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'CryptoPkg/Include') diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h index f4bc7c0d73..7d1499350a 100644 --- a/CryptoPkg/Include/Library/BaseCryptLib.h +++ b/CryptoPkg/Include/Library/BaseCryptLib.h @@ -4,7 +4,7 @@ primitives (Hash Serials, HMAC, RSA, Diffie-Hellman, etc) for UEFI security functionality enabling. -Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -753,6 +753,35 @@ Sha512HashAll ( OUT UINT8 *HashValue ); +/** + Parallel hash function ParallelHash256, as defined in NIST's Special Publication 800-185, + published December 2016. + + @param[in] Input Pointer to the input message (X). + @param[in] InputByteLen The number(>0) of input bytes provided for the input data. + @param[in] BlockSize The size of each block (B). + @param[out] Output Pointer to the output buffer. + @param[in] OutputByteLen The desired number of output bytes (L). + @param[in] Customization Pointer to the customization string (S). + @param[in] CustomByteLen The length of the customization string in bytes. + + @retval TRUE ParallelHash256 digest computation succeeded. + @retval FALSE ParallelHash256 digest computation failed. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +ParallelHash256HashAll ( + IN CONST VOID *Input, + IN UINTN InputByteLen, + IN UINTN BlockSize, + OUT VOID *Output, + IN UINTN OutputByteLen, + IN CONST VOID *Customization, + IN UINTN CustomByteLen + ); + /** Retrieves the size, in bytes, of the context buffer required for SM3 hash operations. diff --git a/CryptoPkg/Include/Pcd/PcdCryptoServiceFamilyEnable.h b/CryptoPkg/Include/Pcd/PcdCryptoServiceFamilyEnable.h index 5186a54759..3d53c2f105 100644 --- a/CryptoPkg/Include/Pcd/PcdCryptoServiceFamilyEnable.h +++ b/CryptoPkg/Include/Pcd/PcdCryptoServiceFamilyEnable.h @@ -2,7 +2,7 @@ Defines the PCD_CRYPTO_SERVICE_FAMILY_ENABLE structure associated with gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable. - Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -288,6 +288,19 @@ typedef struct { } Services; UINT32 Family; } TlsGet; + union { + struct { + UINT8 Sign : 1; + UINT8 Verify : 1; + } Services; + UINT32 Family; + } RsaPss; + union { + struct { + UINT8 HashAll : 1; + } Services; + UINT32 Family; + } ParallelHash; } PCD_CRYPTO_SERVICE_FAMILY_ENABLE; #endif -- cgit v1.2.3