TianoCore EDK2 master
Loading...
Searching...
No Matches
Tpm2Help.c File Reference

Go to the source code of this file.

Data Structures

struct  INTERNAL_HASH_INFO
 

Functions

UINT16 EFIAPI GetHashSizeFromAlgo (IN TPMI_ALG_HASH HashAlgo)
 
UINT32 EFIAPI GetHashMaskFromAlgo (IN TPMI_ALG_HASH HashAlgo)
 
UINT32 EFIAPI CopyAuthSessionCommand (IN TPMS_AUTH_COMMAND *AuthSessionIn OPTIONAL, OUT UINT8 *AuthSessionOut)
 
UINT32 EFIAPI CopyAuthSessionResponse (IN UINT8 *AuthSessionIn, OUT TPMS_AUTH_RESPONSE *AuthSessionOut OPTIONAL)
 
BOOLEAN EFIAPI IsHashAlgSupportedInHashAlgorithmMask (IN TPMI_ALG_HASH HashAlg, IN UINT32 HashAlgorithmMask)
 
VOID *EFIAPI CopyDigestListToBuffer (IN OUT VOID *Buffer, IN TPML_DIGEST_VALUES *DigestList, IN UINT32 HashAlgorithmMask)
 
UINT32 EFIAPI GetDigestListSize (IN TPML_DIGEST_VALUES *DigestList)
 
EFI_STATUS EFIAPI GetDigestFromDigestList (IN TPMI_ALG_HASH HashAlg, IN TPML_DIGEST_VALUES *DigestList, OUT VOID *Digest)
 

Variables

STATIC INTERNAL_HASH_INFO mHashInfo []
 

Detailed Description

Implement TPM2 help.

Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Tpm2Help.c.

Function Documentation

◆ CopyAuthSessionCommand()

UINT32 EFIAPI CopyAuthSessionCommand ( IN TPMS_AUTH_COMMAND *AuthSessionIn  OPTIONAL,
OUT UINT8 *  AuthSessionOut 
)

Copy AuthSessionIn to TPM2 command buffer.

Parameters
[in]AuthSessionInInput AuthSession data
[out]AuthSessionOutOutput AuthSession data in TPM2 command buffer
Returns
AuthSession size

Definition at line 88 of file Tpm2Help.c.

◆ CopyAuthSessionResponse()

UINT32 EFIAPI CopyAuthSessionResponse ( IN UINT8 *  AuthSessionIn,
OUT TPMS_AUTH_RESPONSE *AuthSessionOut  OPTIONAL 
)

Copy AuthSessionIn from TPM2 response buffer.

Parameters
[in]AuthSessionInInput AuthSession data in TPM2 response buffer
[out]AuthSessionOutOutput AuthSession data
Returns
0 copy failed else AuthSession size

Definition at line 154 of file Tpm2Help.c.

◆ CopyDigestListToBuffer()

VOID *EFIAPI CopyDigestListToBuffer ( IN OUT VOID *  Buffer,
IN TPML_DIGEST_VALUES DigestList,
IN UINT32  HashAlgorithmMask 
)

Copy TPML_DIGEST_VALUES into a buffer

Parameters
[in,out]BufferBuffer to hold copied TPML_DIGEST_VALUES compact binary.
[in]DigestListTPML_DIGEST_VALUES to be copied.
[in]HashAlgorithmMaskHASH bits corresponding to the desired digests to copy.
Returns
The end of buffer to hold TPML_DIGEST_VALUES.

Definition at line 260 of file Tpm2Help.c.

◆ GetDigestFromDigestList()

EFI_STATUS EFIAPI GetDigestFromDigestList ( IN TPMI_ALG_HASH  HashAlg,
IN TPML_DIGEST_VALUES DigestList,
OUT VOID *  Digest 
)

This function get digest from digest list.

Parameters
[in]HashAlgDigest algorithm
[in]DigestListDigest list
[out]DigestDigest
Return values
EFI_SUCCESSDigest is found and returned.
EFI_NOT_FOUNDDigest is not found.

Definition at line 331 of file Tpm2Help.c.

◆ GetDigestListSize()

UINT32 EFIAPI GetDigestListSize ( IN TPML_DIGEST_VALUES DigestList)

Get TPML_DIGEST_VALUES data size.

Parameters
[in]DigestListTPML_DIGEST_VALUES data.
Returns
TPML_DIGEST_VALUES data size.

Definition at line 302 of file Tpm2Help.c.

◆ GetHashMaskFromAlgo()

UINT32 EFIAPI GetHashMaskFromAlgo ( IN TPMI_ALG_HASH  HashAlgo)

Get hash mask from algorithm.

Parameters
[in]HashAlgoHash algorithm
Returns
Hash mask

Definition at line 63 of file Tpm2Help.c.

◆ GetHashSizeFromAlgo()

UINT16 EFIAPI GetHashSizeFromAlgo ( IN TPMI_ALG_HASH  HashAlgo)

Return size of digest.

Parameters
[in]HashAlgoHash algorithm
Returns
size of digest

Definition at line 39 of file Tpm2Help.c.

◆ IsHashAlgSupportedInHashAlgorithmMask()

BOOLEAN EFIAPI IsHashAlgSupportedInHashAlgorithmMask ( IN TPMI_ALG_HASH  HashAlg,
IN UINT32  HashAlgorithmMask 
)

Return if hash alg is supported in HashAlgorithmMask.

Parameters
HashAlgHash algorithm to be checked.
HashAlgorithmMaskBitfield of allowed hash algorithms.
Return values
TRUEHash algorithm is supported.
FALSEHash algorithm is not supported.

Definition at line 208 of file Tpm2Help.c.

Variable Documentation

◆ mHashInfo

Initial value:
= {
{ TPM_ALG_SHA1, SHA1_DIGEST_SIZE, HASH_ALG_SHA1 },
{ TPM_ALG_SHA256, SHA256_DIGEST_SIZE, HASH_ALG_SHA256 },
{ TPM_ALG_SM3_256, SM3_256_DIGEST_SIZE, HASH_ALG_SM3_256 },
{ TPM_ALG_SHA384, SHA384_DIGEST_SIZE, HASH_ALG_SHA384 },
{ TPM_ALG_SHA512, SHA512_DIGEST_SIZE, HASH_ALG_SHA512 },
}
#define SHA1_DIGEST_SIZE
Definition: BaseCryptLib.h:39
#define SM3_256_DIGEST_SIZE
Definition: BaseCryptLib.h:59
#define SHA512_DIGEST_SIZE
Definition: BaseCryptLib.h:54
#define SHA256_DIGEST_SIZE
Definition: BaseCryptLib.h:44
#define SHA384_DIGEST_SIZE
Definition: BaseCryptLib.h:49

Definition at line 22 of file Tpm2Help.c.