CryptoPkg/BaseHashApiLib: Implement Unified Hash Calculation API

https://bugzilla.tianocore.org/show_bug.cgi?id=2151

This commit introduces a Unified Hash API to calculate hash using a
hashing algorithm specified by the PCD, PcdHashApiLibPolicy. This library
interfaces with the various hashing API, such as, MD4, MD5, SHA1, SHA256,
SHA512 and SM3_256 implemented in BaseCryptLib. The user can calculate
the desired hash by setting PcdHashApiLibPolicy to appropriate value.

This feature is documented in the Bugzilla,
https://bugzilla.tianocore.org/show_bug.cgi?id=2151.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Amol N Sukerkar <amol.n.sukerkar@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Amol N Sukerkar
2020-02-03 10:18:50 -08:00
committed by mergify[bot]
parent 2c061de063
commit 3feea54eae
7 changed files with 553 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
## @file
# Provides Unified API for Hash Calculation
#
# This library is BaseHashApiLib. It will redirect hash request to
# each individual hash API, such as SHA1, SHA256, SHA384, SM3 based
# on hashing algorithm specified by PcdHashApiLibPolicy.
#
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = BaseHashApiLib
MODULE_UNI_FILE = BaseHashApiLib.uni
FILE_GUID = B1E566DD-DE7C-4F04-BDA0-B1295D3BE927
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = BaseHashApiLib
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
BaseHashApiLib.c
[Packages]
MdePkg/MdePkg.dec
CryptoPkg/CryptoPkg.dec
[LibraryClasses]
BaseLib
BaseMemoryLib
DebugLib
MemoryAllocationLib
BaseCryptLib
PcdLib
[Pcd]
gEfiCryptoPkgTokenSpaceGuid.PcdHashApiLibPolicy ## CONSUMES