TianoCore EDK2 master
Loading...
Searching...
No Matches
TcgStorageCoreLib.h File Reference

Go to the source code of this file.

Data Structures

struct  TCG_CREATE_STRUCT
 
struct  TCG_PARSE_STRUCT
 
struct  TCG_TOKEN
 

Macros

#define ERROR_CHECK(arg)
 
#define METHOD_STATUS_ERROR_CHECK(arg, failRet)
 
#define NULL_CHECK(arg)
 

Typedefs

typedef BOOLEAN(EFIAPI * TCG_LEVEL0_ENUM_CALLBACK) (const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader, TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *Feature, UINTN FeatureSize, VOID *Context)
 

Enumerations

enum  TCG_RESULT {
  TcgResultSuccess , TcgResultFailure , TcgResultFailureNullPointer , TcgResultFailureZeroSize ,
  TcgResultFailureInvalidAction , TcgResultFailureBufferTooSmall , TcgResultFailureEndBuffer , TcgResultFailureInvalidType
}
 

Functions

TCG_RESULT EFIAPI TcgInitTcgCreateStruct (TCG_CREATE_STRUCT *CreateStruct, VOID *Buffer, UINT32 BufferSize)
 
TCG_RESULT EFIAPI TcgStartComPacket (TCG_CREATE_STRUCT *CreateStruct, UINT16 ComId, UINT16 ComIdExtension)
 
TCG_RESULT EFIAPI TcgStartPacket (TCG_CREATE_STRUCT *CreateStruct, UINT32 Tsn, UINT32 Hsn, UINT32 SeqNumber, UINT16 AckType, UINT32 Ack)
 
TCG_RESULT EFIAPI TcgStartSubPacket (TCG_CREATE_STRUCT *CreateStruct, UINT16 Kind)
 
TCG_RESULT EFIAPI TcgEndSubPacket (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgEndPacket (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgEndComPacket (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size)
 
TCG_RESULT EFIAPI TcgAddRawByte (TCG_CREATE_STRUCT *CreateStruct, UINT8 Byte)
 
TCG_RESULT EFIAPI TcgAddByteSequence (TCG_CREATE_STRUCT *CreateStruct, const VOID *Data, UINT32 DataSize, BOOLEAN Continued)
 
TCG_RESULT EFIAPI TcgAddInteger (TCG_CREATE_STRUCT *CreateStruct, const VOID *Data, UINT32 DataSize, BOOLEAN SignedInteger)
 
TCG_RESULT EFIAPI TcgAddUINT8 (TCG_CREATE_STRUCT *CreateStruct, UINT8 Value)
 
TCG_RESULT EFIAPI TcgAddUINT16 (TCG_CREATE_STRUCT *CreateStruct, UINT16 Value)
 
TCG_RESULT EFIAPI TcgAddUINT32 (TCG_CREATE_STRUCT *CreateStruct, UINT32 Value)
 
TCG_RESULT EFIAPI TcgAddUINT64 (TCG_CREATE_STRUCT *CreateStruct, UINT64 Value)
 
TCG_RESULT EFIAPI TcgAddBOOLEAN (TCG_CREATE_STRUCT *CreateStruct, BOOLEAN Value)
 
TCG_RESULT EFIAPI TcgAddTcgUid (TCG_CREATE_STRUCT *CreateStruct, TCG_UID Uid)
 
TCG_RESULT EFIAPI TcgAddStartList (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddEndList (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddStartName (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddEndName (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddCall (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddEndOfData (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddEndOfSession (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddStartTransaction (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgAddEndTransaction (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgInitTcgParseStruct (TCG_PARSE_STRUCT *ParseStruct, const VOID *Buffer, UINT32 BufferSize)
 
TCG_RESULT EFIAPI TcgGetNextToken (TCG_PARSE_STRUCT *ParseStruct, TCG_TOKEN *TcgToken)
 
TCG_RESULT EFIAPI TcgGetNextTokenType (TCG_PARSE_STRUCT *ParseStruct, TCG_TOKEN_TYPE Type)
 
TCG_RESULT EFIAPI TcgGetAtomInfo (const TCG_TOKEN *TcgToken, UINT32 *HeaderLength, UINT32 *DataLength, UINT8 *ByteOrInt, UINT8 *SignOrCont)
 
UINT8 *EFIAPI TcgGetTokenByteSequence (const TCG_TOKEN *TcgToken, UINT32 *Length)
 
TCG_RESULT EFIAPI TcgGetTokenUINT64 (const TCG_TOKEN *TcgToken, UINT64 *Value)
 
TCG_RESULT EFIAPI TcgGetNextUINT8 (TCG_PARSE_STRUCT *ParseStruct, UINT8 *Value)
 
TCG_RESULT EFIAPI TcgGetNextUINT16 (TCG_PARSE_STRUCT *ParseStruct, UINT16 *Value)
 
TCG_RESULT EFIAPI TcgGetNextUINT32 (TCG_PARSE_STRUCT *ParseStruct, UINT32 *Value)
 
TCG_RESULT EFIAPI TcgGetNextUINT64 (TCG_PARSE_STRUCT *ParseStruct, UINT64 *Value)
 
TCG_RESULT EFIAPI TcgGetNextBOOLEAN (TCG_PARSE_STRUCT *ParseStruct, BOOLEAN *Value)
 
TCG_RESULT EFIAPI TcgGetNextTcgUid (TCG_PARSE_STRUCT *ParseStruct, TCG_UID *Uid)
 
TCG_RESULT EFIAPI TcgGetNextByteSequence (TCG_PARSE_STRUCT *ParseStruct, const VOID **Data, UINT32 *Length)
 
TCG_RESULT EFIAPI TcgGetNextStartList (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextEndList (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextStartName (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextEndName (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextCall (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextEndOfData (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextEndOfSession (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextStartTransaction (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgGetNextEndTransaction (TCG_PARSE_STRUCT *ParseStruct)
 
TCG_RESULT EFIAPI TcgStartMethodCall (TCG_CREATE_STRUCT *CreateStruct, TCG_UID InvokingId, TCG_UID MethodId)
 
TCG_RESULT EFIAPI TcgStartParameters (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgEndParameters (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgEndMethodCall (TCG_CREATE_STRUCT *CreateStruct)
 
TCG_RESULT EFIAPI TcgCreateStartSession (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size, UINT16 ComId, UINT16 ComIdExtension, UINT32 HostSessionId, TCG_UID SpId, BOOLEAN Write, UINT32 HostChallengeLength, const VOID *HostChallenge, TCG_UID HostSigningAuthority)
 
TCG_RESULT EFIAPI TcgCreateSetCPin (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size, UINT16 ComId, UINT16 ComIdExtension, UINT32 TperSession, UINT32 HostSession, TCG_UID SidRow, const VOID *Password, UINT32 PasswordSize)
 
TCG_RESULT EFIAPI TcgSetAuthorityEnabled (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size, UINT16 ComId, UINT16 ComIdExtension, UINT32 TperSession, UINT32 HostSession, TCG_UID AuthorityUid, BOOLEAN Enabled)
 
TCG_RESULT EFIAPI TcgCreateEndSession (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size, UINT16 ComId, UINT16 ComIdExtension, UINT32 HostSessionId, UINT32 TpSessionId)
 
CHAR8 *EFIAPI TcgTokenTypeString (TCG_TOKEN_TYPE Type)
 
TCG_RESULT EFIAPI TcgGetMethodStatus (const TCG_PARSE_STRUCT *ParseStruct, UINT8 *MethodStatus)
 
CHAR8 *EFIAPI TcgMethodStatusString (UINT8 MethodStatus)
 
TCG_RESULT EFIAPI TcgGetComIds (const TCG_PARSE_STRUCT *ParseStruct, UINT16 *ComId, UINT16 *ComIdExtension)
 
TCG_RESULT EFIAPI TcgCheckComIds (const TCG_PARSE_STRUCT *ParseStruct, UINT16 ExpectedComId, UINT16 ExpectedComIdExtension)
 
TCG_RESULT EFIAPI TcgParseSyncSession (const TCG_PARSE_STRUCT *ParseStruct, UINT16 ComId, UINT16 ComIdExtension, UINT32 HostSessionId, UINT32 *TperSessionId)
 
TCG_RESULT EFIAPI TcgCreateSetAce (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size, UINT16 ComId, UINT16 ComIdExtension, UINT32 TperSession, UINT32 HostSession, TCG_UID AceRow, TCG_UID Authority1, BOOLEAN LogicalOperator, TCG_UID Authority2)
 
BOOLEAN EFIAPI TcgEnumLevel0Discovery (const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader, TCG_LEVEL0_ENUM_CALLBACK Callback, VOID *Context)
 
TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *EFIAPI TcgGetFeature (const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader, UINT16 FeatureCode, UINTN *FeatureSize)
 
BOOLEAN EFIAPI TcgIsProtocolSupported (const TCG_SUPPORTED_SECURITY_PROTOCOLS *ProtocolList, UINT16 Protocol)
 
BOOLEAN EFIAPI TcgIsLocked (const TCG_LEVEL0_DISCOVERY_HEADER *Discovery)
 

Detailed Description

Public API for the Tcg Core library to perform the lowest level TCG Data encoding.

(TCG Storage Architecture Core Specification, Version 2.01, Revision 1.00, https://trustedcomputinggroup.org/tcg-storage-architecture-core-specification/)

Check http://trustedcomputinggroup.org for latest specification updates.

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

Definition in file TcgStorageCoreLib.h.

Macro Definition Documentation

◆ ERROR_CHECK

#define ERROR_CHECK (   arg)
Value:
{ \
TCG_RESULT ret = (arg); \
if (ret != TcgResultSuccess) { \
DEBUG ((DEBUG_INFO, "ERROR_CHECK failed at %a:%u\n", __FILE__, DEBUG_LINE_NUMBER)); \
return ret; \
} \
}
TCG_RESULT

Definition at line 19 of file TcgStorageCoreLib.h.

◆ METHOD_STATUS_ERROR_CHECK

#define METHOD_STATUS_ERROR_CHECK (   arg,
  failRet 
)
Value:
if ((arg) != TCG_METHOD_STATUS_CODE_SUCCESS) { \
DEBUG ((DEBUG_INFO, "Method Status error: 0x%02X (%a)\n", arg, TcgMethodStatusString(arg))); \
return (failRet); \
}
CHAR8 *EFIAPI TcgMethodStatusString(UINT8 MethodStatus)

Definition at line 28 of file TcgStorageCoreLib.h.

◆ NULL_CHECK

#define NULL_CHECK (   arg)
Value:
do { \
if ((arg) == NULL) { \
DEBUG ((DEBUG_INFO, "NULL_CHECK(%a) failed at %a:%u\n", #arg, __FILE__, DEBUG_LINE_NUMBER)); \
return TcgResultFailureNullPointer; \
} \
} while (0)
#define NULL
Definition: Base.h:319

Definition at line 34 of file TcgStorageCoreLib.h.

Typedef Documentation

◆ TCG_LEVEL0_ENUM_CALLBACK

typedef BOOLEAN(EFIAPI * TCG_LEVEL0_ENUM_CALLBACK) (const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader, TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *Feature, UINTN FeatureSize, VOID *Context)

Definition at line 919 of file TcgStorageCoreLib.h.

Enumeration Type Documentation

◆ TCG_RESULT

enum TCG_RESULT

Tcg result codes.

The result code indicates if the Tcg function call was successful or not

Definition at line 49 of file TcgStorageCoreLib.h.

Function Documentation

◆ TcgAddBOOLEAN()

TCG_RESULT EFIAPI TcgAddBOOLEAN ( TCG_CREATE_STRUCT CreateStruct,
BOOLEAN  Value 
)

Adds a BOOLEAN to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the integer
[in]ValueBOOLEAN Value to add

Definition at line 672 of file TcgStorageCore.c.

◆ TcgAddByteSequence()

TCG_RESULT EFIAPI TcgAddByteSequence ( TCG_CREATE_STRUCT CreateStruct,
const VOID *  Data,
UINT32  DataSize,
BOOLEAN  Continued 
)

Adds the Data parameter as a byte sequence to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the byte sequence
[in]DataByte sequence that will be encoded and copied into Data structure
[in]DataSizeLength of Data provided
[in]ContinuedTRUE if byte sequence is continued or FALSE if the Data contains the entire byte sequence to be encoded

Definition at line 529 of file TcgStorageCore.c.

◆ TcgAddCall()

TCG_RESULT EFIAPI TcgAddCall ( TCG_CREATE_STRUCT CreateStruct)

Adds a Call token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add end call.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 777 of file TcgStorageCore.c.

◆ TcgAddEndList()

TCG_RESULT EFIAPI TcgAddEndList ( TCG_CREATE_STRUCT CreateStruct)

Adds an End List token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add end list.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 726 of file TcgStorageCore.c.

◆ TcgAddEndName()

TCG_RESULT EFIAPI TcgAddEndName ( TCG_CREATE_STRUCT CreateStruct)

Adds an End Name token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add end name.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 760 of file TcgStorageCore.c.

◆ TcgAddEndOfData()

TCG_RESULT EFIAPI TcgAddEndOfData ( TCG_CREATE_STRUCT CreateStruct)

Adds an End of Data token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add end of data.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 794 of file TcgStorageCore.c.

◆ TcgAddEndOfSession()

TCG_RESULT EFIAPI TcgAddEndOfSession ( TCG_CREATE_STRUCT CreateStruct)

Adds an End of Session token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add end of session.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 811 of file TcgStorageCore.c.

◆ TcgAddEndTransaction()

TCG_RESULT EFIAPI TcgAddEndTransaction ( TCG_CREATE_STRUCT CreateStruct)

Adds an End Transaction token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add end transaction.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 845 of file TcgStorageCore.c.

◆ TcgAddInteger()

TCG_RESULT EFIAPI TcgAddInteger ( TCG_CREATE_STRUCT CreateStruct,
const VOID *  Data,
UINT32  DataSize,
BOOLEAN  SignedInteger 
)

Adds an arbitrary-Length integer to the Data structure.

The integer will be encoded using the shortest possible atom.

Parameters
[in/out]CreateStruct Structure used to add the integer
[in]DataInteger in host byte order that will be encoded and copied into Data structure
[in]DataSizeLength in bytes of the Data provided
[in]SignedIntegerTRUE if the integer is signed or FALSE if the integer is unsigned

Definition at line 552 of file TcgStorageCore.c.

◆ TcgAddRawByte()

TCG_RESULT EFIAPI TcgAddRawByte ( TCG_CREATE_STRUCT CreateStruct,
UINT8  Byte 
)

Adds a single raw token byte to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the byte
[in]ByteByte to add

Definition at line 422 of file TcgStorageCore.c.

◆ TcgAddStartList()

TCG_RESULT EFIAPI TcgAddStartList ( TCG_CREATE_STRUCT CreateStruct)

Adds a Start List token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add start list.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 709 of file TcgStorageCore.c.

◆ TcgAddStartName()

TCG_RESULT EFIAPI TcgAddStartName ( TCG_CREATE_STRUCT CreateStruct)

Adds a Start Name token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add start name.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 743 of file TcgStorageCore.c.

◆ TcgAddStartTransaction()

TCG_RESULT EFIAPI TcgAddStartTransaction ( TCG_CREATE_STRUCT CreateStruct)

Adds a Start Transaction token to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the token

Add start transaction.

Parameters
[in/out]CreateStruct Structure used to add the integer
Return values
returnthe action result.

Definition at line 828 of file TcgStorageCore.c.

◆ TcgAddTcgUid()

TCG_RESULT EFIAPI TcgAddTcgUid ( TCG_CREATE_STRUCT CreateStruct,
TCG_UID  Uid 
)

Add tcg uid info.

Parameters
[in/out]CreateStruct Structure used to add the integer
UidInput uid info.
Return values
returnthe action result.

Definition at line 691 of file TcgStorageCore.c.

◆ TcgAddUINT16()

TCG_RESULT EFIAPI TcgAddUINT16 ( TCG_CREATE_STRUCT CreateStruct,
UINT16  Value 
)

Adds a 16-bit unsigned integer to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the integer
[in]ValueInteger Value to add

Definition at line 619 of file TcgStorageCore.c.

◆ TcgAddUINT32()

TCG_RESULT EFIAPI TcgAddUINT32 ( TCG_CREATE_STRUCT CreateStruct,
UINT32  Value 
)

Adds a 32-bit unsigned integer to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the integer
[in]ValueInteger Value to add

Definition at line 637 of file TcgStorageCore.c.

◆ TcgAddUINT64()

TCG_RESULT EFIAPI TcgAddUINT64 ( TCG_CREATE_STRUCT CreateStruct,
UINT64  Value 
)

Adds a 64-bit unsigned integer to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the integer
[in]ValueInteger Value to add

Definition at line 655 of file TcgStorageCore.c.

◆ TcgAddUINT8()

TCG_RESULT EFIAPI TcgAddUINT8 ( TCG_CREATE_STRUCT CreateStruct,
UINT8  Value 
)

Adds an 8-bit unsigned integer to the Data structure.

Parameters
[in/out]CreateStruct Structure used to add the integer
[in]ValueInteger Value to add

Definition at line 601 of file TcgStorageCore.c.

◆ TcgCheckComIds()

TCG_RESULT EFIAPI TcgCheckComIds ( const TCG_PARSE_STRUCT ParseStruct,
UINT16  ExpectedComId,
UINT16  ExpectedComIdExtension 
)

Checks if the ComIDs of the response match the expected values.

Parameters
[in]ParseStructStructure used to parse received TCG response
[in]ExpectedComIdExpected comID
[in]ExpectedComIdExtensionExpected extended comID

Definition at line 224 of file TcgStorageUtil.c.

◆ TcgCreateEndSession()

TCG_RESULT EFIAPI TcgCreateEndSession ( TCG_CREATE_STRUCT CreateStruct,
UINT32 *  Size,
UINT16  ComId,
UINT16  ComIdExtension,
UINT32  HostSessionId,
UINT32  TpSessionId 
)

Creates ComPacket with EndSession. This assumes a start session has already been opened.

Parameters
[in/out]CreateStruct Structure used to add Endsession
[in/out]Size Describes the size of the entire ComPacket (header and payload). Filled out by function.
[in]ComIdComID for the ComPacket
[in]ComIdExtensionExtended ComID for the ComPacket
[in]HostSessionIdHost Session ID for the Packet
[in]TpSessionIdTper Session ID for the Packet

Definition at line 493 of file TcgStorageUtil.c.

◆ TcgCreateSetAce()

TCG_RESULT EFIAPI TcgCreateSetAce ( TCG_CREATE_STRUCT CreateStruct,
UINT32 *  Size,
UINT16  ComId,
UINT16  ComIdExtension,
UINT32  TperSession,
UINT32  HostSession,
TCG_UID  AceRow,
TCG_UID  Authority1,
BOOLEAN  LogicalOperator,
TCG_UID  Authority2 
)

Create set ace.

Parameters
CreateStructInput create structure.
Sizesize info.
ComIdComId info.
ComIdExtensionComId extension info.
TperSessionTper session data.
HostSessionHost session data.
AceRowAce row info.
Authority1Authority 1 info.
LogicalOperatorLogical operator info.
Authority2Authority 2 info.
Return values
Returnthe action result.

Definition at line 659 of file TcgStorageUtil.c.

◆ TcgCreateSetCPin()

TCG_RESULT EFIAPI TcgCreateSetCPin ( TCG_CREATE_STRUCT CreateStruct,
UINT32 *  Size,
UINT16  ComId,
UINT16  ComIdExtension,
UINT32  TperSession,
UINT32  HostSession,
TCG_UID  SidRow,
const VOID *  Password,
UINT32  PasswordSize 
)

Creates ComPacket with a Method call that sets the PIN column for the row specified. This assumes a start session has already been opened with the desired SP.

Parameters
[in/out]CreateStruct Structure used to add method call.
[in/out]Size Describes the size of the entire ComPacket (header and payload). Filled out by function.
[in]ComIdComID for the ComPacket
[in]ComIdExtensionExtended ComID for the ComPacket
[in]TperSessionTper Session ID for the Packet
[in]HostSessionHost Session ID for the Packet
[in]SidRowUID of row of current SP to set PIN column
[in]Passwordvalue of PIN to set
[in]PasswordSizeSize of PIN

Definition at line 576 of file TcgStorageUtil.c.

◆ TcgCreateStartSession()

TCG_RESULT EFIAPI TcgCreateStartSession ( TCG_CREATE_STRUCT CreateStruct,
UINT32 *  Size,
UINT16  ComId,
UINT16  ComIdExtension,
UINT32  HostSessionId,
TCG_UID  SpId,
BOOLEAN  Write,
UINT32  HostChallengeLength,
const VOID *  HostChallenge,
TCG_UID  HostSigningAuthority 
)

Adds Start Session call to the data structure. This creates the entire ComPacket structure and returns the size of the entire compacket in the size parameter.

Parameters
[in/out]CreateStruct Structure used to add the start session call
[in/out]Size Describes the size of the entire ComPacket (header and payload). Filled out by function.
[in]ComIdComID for the ComPacket
[in]ComIdExtensionExtended ComID for the ComPacket
[in]HostSessionIdHost Session ID
[in]SpIdSecurity Provider to start session with
[in]WriteWrite option for start session. TRUE = start session requests write access
[in]HostChallengeLengthLength of the host challenge. Length should be 0 if hostChallenge is NULL
[in]HostChallengeHost challenge for Host Signing Authority. If NULL, then no Host Challenge shall be sent.
[in]HostSigningAuthorityHost Signing Authority used for start session. If NULL, then no Host Signing Authority shall be sent.

Definition at line 358 of file TcgStorageUtil.c.

◆ TcgEndComPacket()

TCG_RESULT EFIAPI TcgEndComPacket ( TCG_CREATE_STRUCT CreateStruct,
UINT32 *  Size 
)

Ends the ComPacket in the Data structure and ret

Parameters
[in/out]CreateStruct Structure used to end the Tcg ComPacket
[in/out]Size Describes the Size of the entire ComPacket (Header and payload). Filled out by function.

Definition at line 299 of file TcgStorageCore.c.

◆ TcgEndMethodCall()

TCG_RESULT EFIAPI TcgEndMethodCall ( TCG_CREATE_STRUCT CreateStruct)

Adds END Data token and method list.

Parameters
CreateStructThe input create structure.

Definition at line 156 of file TcgStorageUtil.c.

◆ TcgEndPacket()

TCG_RESULT EFIAPI TcgEndPacket ( TCG_CREATE_STRUCT CreateStruct)

Ends the current Packet in the Data structure.

Parameters
[in/out]CreateStruct Structure used to end the current Tcg Packet

Definition at line 269 of file TcgStorageCore.c.

◆ TcgEndParameters()

TCG_RESULT EFIAPI TcgEndParameters ( TCG_CREATE_STRUCT CreateStruct)

Adds END LIST token.

Parameters
CreateStructThe input create structure.

Definition at line 130 of file TcgStorageUtil.c.

◆ TcgEndSubPacket()

TCG_RESULT EFIAPI TcgEndSubPacket ( TCG_CREATE_STRUCT CreateStruct)

Ends the current SubPacket in the Data structure. This function will also perform the 4-byte padding required for Subpackets.

Parameters
[in/out]CreateStruct Structure used to end the current Tcg SubPacket

Definition at line 220 of file TcgStorageCore.c.

◆ TcgEnumLevel0Discovery()

BOOLEAN EFIAPI TcgEnumLevel0Discovery ( const TCG_LEVEL0_DISCOVERY_HEADER DiscoveryHeader,
TCG_LEVEL0_ENUM_CALLBACK  Callback,
VOID *  Context 
)

Enum level 0 discovery.

Parameters
DiscoveryHeaderDiscovery header.
CallbackCallback function.
ContextThe context for the function.
Return values
returntrue if the callback return TRUE, else return FALSE.

Definition at line 723 of file TcgStorageUtil.c.

◆ TcgGetAtomInfo()

TCG_RESULT EFIAPI TcgGetAtomInfo ( const TCG_TOKEN TcgToken,
UINT32 *  HeaderLength,
UINT32 *  DataLength,
UINT8 *  ByteOrInt,
UINT8 *  SignOrCont 
)

Get atom info.

Parameters
TcgTokenInput token info.
HeaderLengthreturn the header length.
DataLengthreturn the data length.
ByteOrIntreturn the atom Type.
SignOrContreturn the sign or count info.
Return values
returnthe action result.

Definition at line 1101 of file TcgStorageCore.c.

◆ TcgGetComIds()

TCG_RESULT EFIAPI TcgGetComIds ( const TCG_PARSE_STRUCT ParseStruct,
UINT16 *  ComId,
UINT16 *  ComIdExtension 
)

Retrieves the comID and Extended comID of the ComPacket in the Tcg response. It is intended to be used to confirm the received Tcg response is intended for user that received it.

Parameters
[in]ParseStructStructure used to parse received TCG response.
[in/out]ComId comID retrieved from received ComPacket.
[in/out]ComIdExtension Extended comID retrieved from received ComPacket

Definition at line 193 of file TcgStorageUtil.c.

◆ TcgGetFeature()

TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *EFIAPI TcgGetFeature ( const TCG_LEVEL0_DISCOVERY_HEADER DiscoveryHeader,
UINT16  FeatureCode,
UINTN FeatureSize 
)

Get Feature code from the header.

Parameters
DiscoveryHeaderThe discovery header.
FeatureCodereturn the Feature code.
FeatureSizereturn the Feature size.
Return values
returnthe Feature code data.

Definition at line 829 of file TcgStorageUtil.c.

◆ TcgGetMethodStatus()

TCG_RESULT EFIAPI TcgGetMethodStatus ( const TCG_PARSE_STRUCT ParseStruct,
UINT8 *  MethodStatus 
)

Returns the method status of the current subpacket. Does not affect the current position in the ComPacket. In other words, it can be called whenever you have a valid SubPacket.

Parameters
[in/out]ParseStruct Structure used to parse received TCG response
[in/out]MethodStatus Method status retrieved of the current SubPacket

Definition at line 253 of file TcgStorageUtil.c.

◆ TcgGetNextBOOLEAN()

TCG_RESULT EFIAPI TcgGetNextBOOLEAN ( TCG_PARSE_STRUCT ParseStruct,
BOOLEAN *  Value 
)

Get next specify value.

Parameters
ParseStructInput parse structure.
ValueReturn value.
Return values
returnthe action result.

Definition at line 1403 of file TcgStorageCore.c.

◆ TcgGetNextByteSequence()

TCG_RESULT EFIAPI TcgGetNextByteSequence ( TCG_PARSE_STRUCT ParseStruct,
const VOID **  Data,
UINT32 *  Length 
)

Get next byte sequence.

Parameters
ParseStructInput parse structure.
Datareturn the data.
Lengthreturn the length.
Return values
returnthe action result.

Definition at line 1474 of file TcgStorageCore.c.

◆ TcgGetNextCall()

TCG_RESULT EFIAPI TcgGetNextCall ( TCG_PARSE_STRUCT ParseStruct)

Get next call.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1599 of file TcgStorageCore.c.

◆ TcgGetNextEndList()

TCG_RESULT EFIAPI TcgGetNextEndList ( TCG_PARSE_STRUCT ParseStruct)

Get next end list.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1548 of file TcgStorageCore.c.

◆ TcgGetNextEndName()

TCG_RESULT EFIAPI TcgGetNextEndName ( TCG_PARSE_STRUCT ParseStruct)

Get next end name.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1582 of file TcgStorageCore.c.

◆ TcgGetNextEndOfData()

TCG_RESULT EFIAPI TcgGetNextEndOfData ( TCG_PARSE_STRUCT ParseStruct)

Get next end data.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1616 of file TcgStorageCore.c.

◆ TcgGetNextEndOfSession()

TCG_RESULT EFIAPI TcgGetNextEndOfSession ( TCG_PARSE_STRUCT ParseStruct)

Get next end of session.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1633 of file TcgStorageCore.c.

◆ TcgGetNextEndTransaction()

TCG_RESULT EFIAPI TcgGetNextEndTransaction ( TCG_PARSE_STRUCT ParseStruct)

Get next end transaction.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1667 of file TcgStorageCore.c.

◆ TcgGetNextStartList()

TCG_RESULT EFIAPI TcgGetNextStartList ( TCG_PARSE_STRUCT ParseStruct)

Get next start list.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1531 of file TcgStorageCore.c.

◆ TcgGetNextStartName()

TCG_RESULT EFIAPI TcgGetNextStartName ( TCG_PARSE_STRUCT ParseStruct)

Get next start name.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1565 of file TcgStorageCore.c.

◆ TcgGetNextStartTransaction()

TCG_RESULT EFIAPI TcgGetNextStartTransaction ( TCG_PARSE_STRUCT ParseStruct)

Get next start transaction.

Parameters
ParseStructInput parse structure.
Return values
returnthe action result.

Definition at line 1650 of file TcgStorageCore.c.

◆ TcgGetNextTcgUid()

TCG_RESULT EFIAPI TcgGetNextTcgUid ( TCG_PARSE_STRUCT ParseStruct,
TCG_UID Uid 
)

Get next tcg uid info.

Parameters
ParseStructInput parse structure.
UidGet the uid info.
Return values
returnthe action result.

Definition at line 1436 of file TcgStorageCore.c.

◆ TcgGetNextToken()

TCG_RESULT EFIAPI TcgGetNextToken ( TCG_PARSE_STRUCT ParseStruct,
TCG_TOKEN TcgToken 
)

Get next token info.

Parameters
ParseStructInput parse structure info.
TcgTokenreturn the tcg token info.
Return values
returnthe action result.

Definition at line 933 of file TcgStorageCore.c.

◆ TcgGetNextTokenType()

TCG_RESULT EFIAPI TcgGetNextTokenType ( TCG_PARSE_STRUCT ParseStruct,
TCG_TOKEN_TYPE  Type 
)

Get next token Type.

Parameters
ParseStructInput parse structure.
TypeInput the type need to check.
Return values
returnthe action result.

Definition at line 1505 of file TcgStorageCore.c.

◆ TcgGetNextUINT16()

TCG_RESULT EFIAPI TcgGetNextUINT16 ( TCG_PARSE_STRUCT ParseStruct,
UINT16 *  Value 
)

Get next specify value.

Parameters
ParseStructInput parse structure.
ValueReturn value.
Return values
returnthe action result.

Definition at line 1314 of file TcgStorageCore.c.

◆ TcgGetNextUINT32()

TCG_RESULT EFIAPI TcgGetNextUINT32 ( TCG_PARSE_STRUCT ParseStruct,
UINT32 *  Value 
)

Get next specify value.

Parameters
ParseStructInput parse structure.
ValueReturn value.
Return values
returnthe action result.

Definition at line 1347 of file TcgStorageCore.c.

◆ TcgGetNextUINT64()

TCG_RESULT EFIAPI TcgGetNextUINT64 ( TCG_PARSE_STRUCT ParseStruct,
UINT64 *  Value 
)

Get next specify value.

Parameters
ParseStructInput parse structure.
ValueReturn value.
Return values
returnthe action result.

Definition at line 1380 of file TcgStorageCore.c.

◆ TcgGetNextUINT8()

TCG_RESULT EFIAPI TcgGetNextUINT8 ( TCG_PARSE_STRUCT ParseStruct,
UINT8 *  Value 
)

Get next specify value.

Parameters
ParseStructInput parse structure.
ValueReturn value.
Return values
returnthe action result.

Definition at line 1281 of file TcgStorageCore.c.

◆ TcgGetTokenByteSequence()

UINT8 *EFIAPI TcgGetTokenByteSequence ( const TCG_TOKEN TcgToken,
UINT32 *  Length 
)

Get token byte sequence.

Parameters
TcgTokenInput token info.
LengthInput the length info.
Return values
Returnthe value data.

Definition at line 1243 of file TcgStorageCore.c.

◆ TcgGetTokenUINT64()

TCG_RESULT EFIAPI TcgGetTokenUINT64 ( const TCG_TOKEN TcgToken,
UINT64 *  Value 
)

Get token specified value.

Parameters
TcgTokenInput token info.
Valuereturn the value.
Return values
returnthe action result.

Definition at line 1180 of file TcgStorageCore.c.

◆ TcgInitTcgCreateStruct()

TCG_RESULT EFIAPI TcgInitTcgCreateStruct ( TCG_CREATE_STRUCT CreateStruct,
VOID *  Buffer,
UINT32  BufferSize 
)

Required to be called before calling any other Tcg functions with the TCG_CREATE_STRUCT. Initializes the packet variables to NULL. Additionally, the buffer will be memset.

Parameters
[in/out]CreateStruct Structure to initialize
[in]BufferBuffer allocated by client of library. It will contain the Tcg encoded packet. This cannot be null.
[in]BufferSizeSize of buffer provided. It cannot be 0.

Required to be called before calling any other Tcg functions with the TCG_CREATE_STRUCT. Initializes the packet variables to NULL. Additionally, the buffer will be memset.

Parameters
[in/out]CreateStruct Structure to initialize
[in]BufferBuffer allocated by client of library. It will contain the Tcg encoded packet. This cannot be null.
[in]BufferSizeSize of buffer provided. It cannot be 0.
Return values
Returnthe action result.

Definition at line 28 of file TcgStorageCore.c.

◆ TcgInitTcgParseStruct()

TCG_RESULT EFIAPI TcgInitTcgParseStruct ( TCG_PARSE_STRUCT ParseStruct,
const VOID *  Buffer,
UINT32  BufferSize 
)

Initial the tcg parse structure.

Parameters
ParseStructInput parse structure.
BufferInput buffer data.
BufferSizeInput buffer size.
Return values
returnthe action result.

Definition at line 864 of file TcgStorageCore.c.

◆ TcgIsLocked()

BOOLEAN EFIAPI TcgIsLocked ( const TCG_LEVEL0_DISCOVERY_HEADER Discovery)

Determines if the Locking Feature "Locked" bit is set in the level 0 discovery response.

Parameters
[in]DiscoveryLevel 0 discovery response
Returns
TRUE = Locked is set, FALSE = Locked is false

Check whether lock or not.

Parameters
Discovery
Return values
TRUEif lock, FALSE if not lock.

Definition at line 892 of file TcgStorageUtil.c.

◆ TcgIsProtocolSupported()

BOOLEAN EFIAPI TcgIsProtocolSupported ( const TCG_SUPPORTED_SECURITY_PROTOCOLS ProtocolList,
UINT16  Protocol 
)

Determines if the protocol provided is part of the provided supported protocol list.

Parameters
[in]ProtocolListSupported protocol list to investigate
[in]ProtocolProtocol value to determine if supported
Returns
TRUE = protocol is supported, FALSE = protocol is not supported

Definition at line 859 of file TcgStorageUtil.c.

◆ TcgMethodStatusString()

CHAR8 *EFIAPI TcgMethodStatusString ( UINT8  MethodStatus)

Returns a human-readable string representing a method status return code.

Parameters
[in]MethodStatusMethod status to translate to a string
Return values
returnthe string info.

Definition at line 31 of file TcgStorageUtil.c.

◆ TcgParseSyncSession()

TCG_RESULT EFIAPI TcgParseSyncSession ( const TCG_PARSE_STRUCT ParseStruct,
UINT16  ComId,
UINT16  ComIdExtension,
UINT32  HostSessionId,
UINT32 *  TperSessionId 
)

Parses the Sync Session response contained in the parseStruct to retrieve Tper session ID. If the Sync Session response parameters do not match the comID, extended ComID and host session ID then a failure is returned.

Parameters
[in/out]ParseStruct Structure used to parse received TCG response, contains Sync Session response.
[in]ComIdExpected ComID that is compared to actual ComID of response
[in]ComIdExtensionExpected Extended ComID that is compared to actual Extended ComID of response
[in]HostSessionIdExpected Host Session ID that is compared to actual Host Session ID of response
[in/out]TperSessionId Tper Session ID retrieved from the Sync Session response.

Definition at line 418 of file TcgStorageUtil.c.

◆ TcgSetAuthorityEnabled()

TCG_RESULT EFIAPI TcgSetAuthorityEnabled ( TCG_CREATE_STRUCT CreateStruct,
UINT32 *  Size,
UINT16  ComId,
UINT16  ComIdExtension,
UINT32  TperSession,
UINT32  HostSession,
TCG_UID  AuthorityUid,
BOOLEAN  Enabled 
)

Creates ComPacket with a Method call that sets the "Enabled" column for the row specified using the value specified. This assumes a start session has already been opened with the desired SP.

Parameters
[in/out]CreateStruct Structure used to add method call
[in/out]Size Describes the size of the entire ComPacket (header and payload). Filled out by function.
[in]ComIdComID for the ComPacket
[in]ComIdExtensionExtended ComID for the ComPacket
[in]TperSessionTper Session ID for the Packet
[in]HostSessionHost Session ID for the Packet
[in]AuthorityUidAuthority UID to modify the "Enabled" column for
[in]EnabledValue to set the "Enabled" column to

Definition at line 617 of file TcgStorageUtil.c.

◆ TcgStartComPacket()

TCG_RESULT EFIAPI TcgStartComPacket ( TCG_CREATE_STRUCT CreateStruct,
UINT16  ComId,
UINT16  ComIdExtension 
)

Encodes the ComPacket header to the data structure.

Parameters
[in/out]CreateStruct Structure to initialize
[in]ComIdComID of the Tcg ComPacket.
[in]ComIdExtensionComID Extension of the Tcg ComPacket.

Definition at line 63 of file TcgStorageCore.c.

◆ TcgStartMethodCall()

TCG_RESULT EFIAPI TcgStartMethodCall ( TCG_CREATE_STRUCT CreateStruct,
TCG_UID  InvokingId,
TCG_UID  MethodId 
)

Adds call token and method Header (invoking id, and method id).

Parameters
CreateStructThe input create structure.
InvokingIdInvoking id.
MethodIdMethod id.

adds call token and method Header (invoking id, and method id).

Parameters
CreateStructThe input create structure.
InvokingIdInvoking id.
MethodIdMethod id.

Definition at line 72 of file TcgStorageUtil.c.

◆ TcgStartPacket()

TCG_RESULT EFIAPI TcgStartPacket ( TCG_CREATE_STRUCT CreateStruct,
UINT32  Tsn,
UINT32  Hsn,
UINT32  SeqNumber,
UINT16  AckType,
UINT32  Ack 
)

Starts a new ComPacket in the Data structure.

Parameters
[in/out]CreateStruct Structure used to add Tcg Packet
[in]TsnPacket Tper session number
[in]HsnPacket Host session number
[in]SeqNumberPacket Sequence Number
[in]AckTypePacket Acknowledge Type
[in]AckPacket Acknowledge

Definition at line 112 of file TcgStorageCore.c.

◆ TcgStartParameters()

TCG_RESULT EFIAPI TcgStartParameters ( TCG_CREATE_STRUCT CreateStruct)

Adds START LIST token.

Parameters
CreateStructThe input create structure.

Definition at line 104 of file TcgStorageUtil.c.

◆ TcgStartSubPacket()

TCG_RESULT EFIAPI TcgStartSubPacket ( TCG_CREATE_STRUCT CreateStruct,
UINT16  Kind 
)

Starts a new SubPacket in the Data structure.

Parameters
[in/out]CreateStruct Structure used to start Tcg SubPacket
[in]KindSubPacket kind

Definition at line 170 of file TcgStorageCore.c.

◆ TcgTokenTypeString()

CHAR8 *EFIAPI TcgTokenTypeString ( TCG_TOKEN_TYPE  Type)

Retrieves human-readable token type name.

Parameters
[in]TypeToken type to retrieve

Return the toke type string info.

Parameters
TypeInput the type info.
Return values
Returnthe string for this type.

Definition at line 314 of file TcgStorageUtil.c.