SecurityPkg/Include/Library/HashLib.h File Reference


Data Structures

struct  HASH_INTERFACE

Defines

#define HASH_ALGORITHM_SHA1_GUID   EFI_HASH_ALGORITHM_SHA1_GUID
#define HASH_ALGORITHM_SHA256_GUID   EFI_HASH_ALGORITHM_SHA256_GUID
#define HASH_ALGORITHM_SHA384_GUID   EFI_HASH_ALGORITHM_SHA384_GUID
#define HASH_ALGORITHM_SHA512_GUID   EFI_HASH_ALGORITHM_SHA512_GUID

Typedefs

typedef UINTN HASH_HANDLE
typedef IN VOID * DataToHash
typedef IN VOID IN UINTN DataToHashLen
typedef OUT TPML_DIGEST_VALUES * DigestList

Functions

EFI_STATUS EFIAPI HashStart (OUT HASH_HANDLE *HashHandle)
EFI_STATUS EFIAPI HashUpdate (IN HASH_HANDLE HashHandle, IN VOID *DataToHash, IN UINTN DataToHashLen)
EFI_STATUS EFIAPI HashCompleteAndExtend (IN HASH_HANDLE HashHandle, IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
EFI_STATUS EFIAPI HashAndExtend (IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
typedef EFI_STATUS (EFIAPI *HASH_INIT)(OUT HASH_HANDLE *HashHandle)
EFI_STATUS EFIAPI RegisterHashInterfaceLib (IN HASH_INTERFACE *HashInterface)

Detailed Description

Ihis library abstract TPM2 hash calculation. The platform can choose multiply hash, while caller just need invoke these API. Then all hash value will be returned and/or extended.

Copyright (c) 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define HASH_ALGORITHM_SHA1_GUID   EFI_HASH_ALGORITHM_SHA1_GUID

#define HASH_ALGORITHM_SHA256_GUID   EFI_HASH_ALGORITHM_SHA256_GUID

#define HASH_ALGORITHM_SHA384_GUID   EFI_HASH_ALGORITHM_SHA384_GUID

#define HASH_ALGORITHM_SHA512_GUID   EFI_HASH_ALGORITHM_SHA512_GUID


Typedef Documentation

typedef IN VOID* DataToHash

typedef IN VOID IN UINTN DataToHashLen

typedef OUT TPML_DIGEST_VALUES* DigestList

typedef UINTN HASH_HANDLE


Function Documentation

typedef EFI_STATUS ( EFIAPI *  HASH_INIT  ) 

Start hash sequence.

Parameters:
HashHandle Hash handle.
Return values:
EFI_SUCCESS Hash sequence start and HandleHandle returned.
EFI_OUT_OF_RESOURCES No enough resource to start hash.
Update hash sequence data.

Parameters:
HashHandle Hash handle.
DataToHash Data to be hashed.
DataToHashLen Data size.
Return values:
EFI_SUCCESS Hash sequence updated.
Complete hash sequence complete.

Parameters:
HashHandle Hash handle.
DigestList Digest list.
Return values:
EFI_SUCCESS Hash sequence complete and DigestList is returned.
This service requests use TPM2.

Return values:
EFI_SUCCESS Get the control of TPM2 chip.
EFI_NOT_FOUND TPM2 not found.
EFI_DEVICE_ERROR Unexpected device behavior.
This service enables the sending of commands to the TPM2.

Parameters:
[in] InputParameterBlockSize Size of the TPM2 input parameter block.
[in] InputParameterBlock Pointer to the TPM2 input parameter block.
[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
Return values:
EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
EFI_BUFFER_TOO_SMALL The output parameter block is too small.
This service requests use TPM2.

Return values:
EFI_SUCCESS Get the control of TPM2 chip.
EFI_NOT_FOUND TPM2 not found.
EFI_DEVICE_ERROR Unexpected device behavior.

Referenced by AccessVariableStore(), AddDefaultUserProfile(), AddPubKeyInStore(), AddUserInfo(), AddUserProfile(), AddUserSelection(), AssignOpRegion(), AutenticatedVariableServiceInitialize(), AuthServiceInternalFindVariable(), AuthServiceInternalUpdateVariableWithTimeStamp(), AuthVariableLibInitialize(), AuthVariableLibProcessVariable(), AutoUpdateLangVariable(), BaseCrypto2Hash(), CallAddUser(), CheckConsole(), CheckCurrentUserAccessRight(), CleanCertsFromDb(), CreatePkX509SignatureList(), CreateTimeBasedPayload(), CreateUserProfile(), CredentialDelete(), CredentialDriverCallback(), CredentialEnroll(), CredentialUser(), DeleteCertsFromDb(), DeleteKeyExchangeKey(), DeletePlatformKey(), DeleteSignature(), DeleteUser(), DeleteVariable(), DelUserInfo(), DelUserProfile(), DetectTpmDevice(), DisplayLoadPermit(), DriverEntry(), DxeDeferImageLoadHandler(), DxeImageVerificationHandler(), DxeTpm2MeasureBootHandler(), DxeTpmMeasureBootHandler(), EnrollImageSignatureToSigDB(), EnrollKeyExchangeKey(), EnrollPlatformKey(), EnrollRsa2048ToKek(), EnrollSignatureDatabase(), EnrollX509HashtoSigDB(), EnrollX509ToKek(), EnrollX509toSigDB(), EsalGetNextVariableName(), EsalGetVariable(), EsalSetVariable(), ExecutePendingTpmRequest(), FileInfo(), FileSystemVolumeLabelInfo(), FilterSignatureList(), FindFiles(), FindFileSystem(), FindInfoByType(), FindUserInfo(), FindUserInfoByType(), FindUserProfileByInfo(), FirmwareVolmeInfoPpiNotifyCallback(), FlushHob2Nv(), FtwVariableSpace(), GenerateUserId(), GetAccessControl(), GetAccessRight(), GetAllUserInfo(), GetAvailableKeyIndex(), GetCertsFromDb(), GetEndPointer(), GetFileData(), GetFileType(), GetFvbHandleByAddress(), GetIdentifyType(), GetImageType(), GetLbaAndOffsetByAddress(), GetProcessorsCpuLocation(), GetToken(), GetTpmCapability(), GetTpmState(), GetTpmStatus(), GetUserInfo(), GetUserName(), GetVariableDataPtr(), GetVariableNamePtr(), GetVarStoreHeader(), Hash2DriverEntryPoint(), Hash2ServiceBindingCreateChild(), Hash2ServiceBindingDestroyChild(), HashAndExtend(), HashCompleteAndExtend(), HashInstanceLibSha1Constructor(), HashInstanceLibSha256Constructor(), HashLogExtendEvent(), HashStart(), HashUpdate(), IdentifyAndTypeUser(), IdentifyAutoLogonUser(), IdentifyByProviderId(), IdentifyOrTypeUser(), IdentifyUser(), InCustomMode(), InitCredentialTable(), InitFormBrowser(), InitializeTcgSmm(), InitiateTPerReset(), InitProviderInfo(), InitUserProfileDb(), InsertCertsToDb(), InstallAcpiTable(), InstallSecureBootConfigForm(), InstallTcg2(), InstallTcg2ConfigForm(), InstallTcgConfigForm(), InstallTrEE(), InstallTrEEConfigForm(), IsAllowedByDb(), IsBootOption(), IsCertHashFoundInDbx(), IsDevicePathInList(), IsForbiddenByDbx(), IsRdRandSupported(), IsSignatureFoundInDatabase(), IsTpmUsable(), IsValidVariableHeader(), IsX509CertInDbx(), LoadDeferredImage(), LoadDeferredImageInit(), LockTpmPhysicalPresence(), LogHashEvent(), MeasureAllBootVariables(), MeasureAllSecureVariables(), MeasureFvImage(), MeasureHandoffTables(), MeasureMainBios(), MeasurePeImageAndExtend(), MeasureSecureBootPolicy(), MeasureVariable(), MemoryClearCallback(), ModifyTable(), ModifyUserInfo(), ModifyUserName(), MorDriverEntryPoint(), MorLockDriverEntryPointSmm(), MorLockDriverInit(), OnExitBootServices(), OnExitBootServicesFailed(), OnReadyToBoot(), OpenFileByDevicePath(), OpenRoot(), P7CheckRevocation(), P7CheckTrust(), PassTimestampCheck(), PasswordProviderInit(), PeimEntryMA(), PeimEntryMP(), PhysicalPresenceCallback(), PhysicalPresencePpiNotifyCallback(), Pkcs7VerifyDriverEntry(), ProcessVariable(), ProcessVarWithKek(), ProcessVarWithPk(), PublishAcpiTable(), PublishTpm2(), PublishUserTable(), RdRandGenerateEntropy(), RdRandGetBytes(), RdRandGetSeed128(), RdRandGetWords(), ReadAndMeasureBootVariable(), ReadAndMeasureVariable(), ReadFileContent(), ReadUserKey(), ReadVariable(), Reclaim(), ReclaimForOS(), RngDriverEntry(), RngGetInfo(), RngGetRNG(), Rsa2048Sha256GuidedSectionHandler(), SaveAccessPolicy(), SaveIdentityPolicy(), SaveNvUserProfile(), SavePpRequest(), SaveSecureBootVariable(), SaveTcg2PCRBanksRequest(), SaveTcg2PpRequest(), SaveTcg2PpRequestParameter(), SaveTrEEPpRequest(), SecureBootCallback(), SecureBootConfigDriverEntryPoint(), SecureBootConfigDriverUnload(), SecureBootExtractConfig(), SecureBootHook(), SecureBootRouteConfig(), SelectUserToDelete(), SelectUserToModify(), SetCreateDate(), SetTpm2HashMask(), SetupEventLog(), SetUserName(), SetVariableCheckHandlerMor(), SignalEventUserProfileChanged(), Tcg2ConfigDriverEntryPoint(), Tcg2ConfigDriverUnload(), Tcg2ConfigPeimEntryPoint(), Tcg2ExecutePendingTpmRequest(), Tcg2ExecutePhysicalPresence(), Tcg2HashLogExtendEvent(), Tcg2MeasureGptTable(), Tcg2MeasurePeImage(), Tcg2PhysicalPresenceLibConstructor(), Tcg2PhysicalPresenceLibGetManagementFlags(), Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction(), Tcg2PhysicalPresenceLibNeedUserConfirm(), Tcg2PhysicalPresenceLibProcessRequest(), Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction(), Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction(), Tcg2ReadUserKey(), Tcg2SetActivePCRBanks(), Tcg2SubmitCommand(), Tcg2UserConfirm(), TcgConfigDriverEntryPoint(), TcgConfigDriverUnload(), TcgDxeHashLogExtendEvent(), TcgDxeHashLogExtendEventI(), TcgDxeLogEvent(), TcgDxeLogHashEvent(), TcgExtractConfig(), TcgMeasureGptTable(), TcgMeasurePeImage(), TcgPhysicalPresenceLibNeedUserConfirm(), TcgPhysicalPresenceLibProcessRequest(), TcgRouteConfig(), TisPcExecute(), TisPcPrepareCommand(), TisPcReceive(), TisPcRequestUseTpm(), TisPcSend(), TisTpmCommand(), TPerResetAtEndOfDxe(), Tpm12ForceClear(), Tpm12MeasureAndLogData(), Tpm12NvDefineSpace(), Tpm12NvReadValue(), Tpm12NvWriteValue(), Tpm12RequestUseTpm(), Tpm12SaveState(), Tpm12Startup(), Tpm12SubmitCommand(), Tpm12TisPcPrepareCommand(), Tpm12TisPcRequestUseTpm(), Tpm12TisTpmCommand(), Tpm20MeasureAndLogData(), Tpm2ChangeEPS(), Tpm2ChangePPS(), Tpm2Clear(), Tpm2ClearControl(), Tpm2CommandAllocPcr(), Tpm2CommandChangeEps(), Tpm2CommandClear(), Tpm2DictionaryAttackLockReset(), Tpm2DictionaryAttackParameters(), Tpm2EventSequenceComplete(), Tpm2FlushContext(), Tpm2GetCapability(), Tpm2GetCapabilityAlgorithmSet(), Tpm2GetCapabilityFamily(), Tpm2GetCapabilityFirmwareVersion(), Tpm2GetCapabilityInputBufferSize(), Tpm2GetCapabilityLockoutCounter(), Tpm2GetCapabilityLockoutInterval(), Tpm2GetCapabilityManufactureID(), Tpm2GetCapabilityMaxCommandResponseSize(), Tpm2GetCapabilityPcrs(), Tpm2GetCapabilitySupportedAlg(), Tpm2HashSequenceStart(), Tpm2HierarchyChangeAuth(), Tpm2HierarchyControl(), Tpm2InstanceLibDTpmConstructor(), Tpm2NvDefineSpace(), Tpm2NvGlobalWriteLock(), Tpm2NvRead(), Tpm2NvReadLock(), Tpm2NvReadPublic(), Tpm2NvUndefineSpace(), Tpm2NvWrite(), Tpm2NvWriteLock(), Tpm2PcrAllocate(), Tpm2PcrEvent(), Tpm2PcrExtend(), Tpm2PcrRead(), Tpm2PolicyCommandCode(), Tpm2PolicyGetDigest(), Tpm2PolicyOR(), Tpm2PolicySecret(), Tpm2RequestUseTpm(), Tpm2SelfTest(), Tpm2SequenceComplete(), Tpm2SequenceUpdate(), Tpm2SetAlgorithmSet(), Tpm2SetPrimaryPolicy(), Tpm2Shutdown(), Tpm2StartAuthSession(), Tpm2Startup(), Tpm2SubmitCommand(), Tpm2TestParms(), TpmCommandClear(), TpmCommandNoReturnData(), TpmCommContinueSelfTest(), TpmCommExtend(), TpmCommGetCapability(), TpmCommGetFlags(), TpmCommPhysicalPresence(), TpmCommStartup(), TpmMeasureAndLogData(), TpmPhysicalPresence(), TrEEConfigDriverEntryPoint(), TrEEConfigDriverUnload(), TrEEConfigPeimEntryPoint(), TrEEExecutePendingTpmRequest(), TrEEExecutePhysicalPresence(), TreeHashLogExtendEvent(), TrEEPhysicalPresenceLibNeedUserConfirm(), TrEEPhysicalPresenceLibProcessRequest(), TrEEReadUserKey(), TreeSubmitCommand(), UefiMain(), UpdateCredentialProvider(), UpdateDeletePage(), UpdateFileExplorer(), UpdatePlatformMode(), UpdateUserInfo(), UpdateVariable(), UsbProviderInit(), UserIdentifyManagerCallback(), UserIdentifyManagerInit(), UserProfileCreate(), UserProfileDelete(), UserProfileDeleteInfo(), UserProfileFind(), UserProfileGetInfo(), UserProfileGetNext(), UserProfileIdentify(), UserProfileManagerCallback(), UserProfileManagerInit(), UserProfileSetInfo(), VariableCommonInitialize(), VariableServiceInitialize(), VendorKeyIsModified(), VerifyBuffer(), VerifyTimeBasedPayload(), VerifyTimeBasedPayloadAndUpdate(), and VerifyVariable().

EFI_STATUS EFIAPI HashAndExtend ( IN TPMI_DH_PCR  PcrIndex,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen,
OUT TPML_DIGEST_VALUES *  DigestList 
)

Hash data and extend to PCR.

Parameters:
PcrIndex PCR to be extended.
DataToHash Data to be hashed.
DataToHashLen Data size.
DigestList Digest list.
Return values:
EFI_SUCCESS Hash data and DigestList is returned.

References EFI_STATUS(), HashCompleteAndExtend(), HashStart(), HashUpdate(), InternalGetHashInterface(), mHashInterfaceCount, Tpm2EventSequenceComplete(), Tpm2GetAlgoFromHashMask(), Tpm2HashSequenceStart(), Tpm2PcrEvent(), Tpm2PcrExtend(), Tpm2SequenceComplete(), Tpm2SequenceUpdate(), and UINTN().

Referenced by HashLogExtendEvent(), and TcgDxeHashLogExtendEvent().

EFI_STATUS EFIAPI HashCompleteAndExtend ( IN HASH_HANDLE  HashHandle,
IN TPMI_DH_PCR  PcrIndex,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen,
OUT TPML_DIGEST_VALUES *  DigestList 
)

Hash sequence complete and extend to PCR.

Parameters:
HashHandle Hash handle.
PcrIndex PCR to be extended.
DataToHash Data to be hashed.
DataToHashLen Data size.
DigestList Digest list.
Return values:
EFI_SUCCESS Hash sequence complete and DigestList is returned.

References EFI_STATUS(), HASH_INTERFACE::HashFinal, HASH_INTERFACE::HashUpdate, InternalGetHashInterface(), mHashInterfaceCount, Tpm2EventSequenceComplete(), Tpm2GetAlgoFromHashMask(), Tpm2GetHashMaskFromAlgo(), Tpm2PcrExtend(), Tpm2SequenceComplete(), Tpm2SequenceUpdate(), Tpm2SetHashToDigestList(), and UINTN().

Referenced by HashAndExtend(), and MeasurePeImageAndExtend().

EFI_STATUS EFIAPI HashStart ( OUT HASH_HANDLE HashHandle  ) 

Start hash sequence.

Parameters:
HashHandle Hash handle.
Return values:
EFI_SUCCESS Hash sequence start and HandleHandle returned.
EFI_OUT_OF_RESOURCES No enough resource to start hash.

References EFI_STATUS(), HASH_INTERFACE::HashInit, InternalGetHashInterface(), mHashInterfaceCount, Tpm2GetAlgoFromHashMask(), Tpm2GetHashMaskFromAlgo(), Tpm2HashSequenceStart(), and UINTN().

Referenced by HashAndExtend(), and MeasurePeImageAndExtend().

EFI_STATUS EFIAPI HashUpdate ( IN HASH_HANDLE  HashHandle,
IN VOID *  DataToHash,
IN UINTN  DataToHashLen 
)

Update hash sequence data.

Parameters:
HashHandle Hash handle.
DataToHash Data to be hashed.
DataToHashLen Data size.
Return values:
EFI_SUCCESS Hash sequence updated.

References EFI_STATUS(), HASH_INTERFACE::HashUpdate, InternalGetHashInterface(), mHashInterfaceCount, Tpm2GetHashMaskFromAlgo(), Tpm2SequenceUpdate(), and UINTN().

Referenced by HashAndExtend(), and MeasurePeImageAndExtend().

EFI_STATUS EFIAPI RegisterHashInterfaceLib ( IN HASH_INTERFACE HashInterface  ) 

This service register Hash.

Parameters:
HashInterface Hash interface
Return values:
EFI_SUCCESS This hash interface is registered successfully.
EFI_UNSUPPORTED System does not support register this interface.
EFI_ALREADY_STARTED System already register this interface.

References HASH_INTERFACE::HashGuid, InternalGetHashInterface(), mHashInterfaceCount, mHashLibPeiRouterGuid, Tpm2GetHashMaskFromAlgo(), and UINTN().

Referenced by HashInstanceLibSha1Constructor(), and HashInstanceLibSha256Constructor().


Generated on Thu Sep 24 23:44:24 2015 for SecurityPkg[ALL] by  doxygen 1.5.7.1