TianoCore EDK2 master
|
#include <Library/TcgStorageCoreLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
Go to the source code of this file.
Data Structures | |
struct | TCG_FIND_FEATURE_CTX |
Macros | |
#define | C(status) case TCG_METHOD_STATUS_CODE_ ## status: return #status |
Functions | |
CHAR8 *EFIAPI | TcgMethodStatusString (UINT8 MethodStatus) |
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 | 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 | TcgGetMethodStatus (const TCG_PARSE_STRUCT *ParseStruct, UINT8 *MethodStatus) |
CHAR8 *EFIAPI | TcgTokenTypeString (TCG_TOKEN_TYPE Type) |
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 | TcgParseSyncSession (const TCG_PARSE_STRUCT *ParseStruct, UINT16 ComId, UINT16 ComIdExtension, UINT32 HostSessionId, UINT32 *TperSessionId) |
TCG_RESULT EFIAPI | TcgCreateEndSession (TCG_CREATE_STRUCT *CreateStruct, UINT32 *Size, UINT16 ComId, UINT16 ComIdExtension, UINT32 HostSessionId, UINT32 TpSessionId) |
TCG_RESULT EFIAPI | TcgStartMethodSet (TCG_CREATE_STRUCT *CreateStruct, TCG_UID Row, UINT32 ColumnNumber) |
TCG_RESULT EFIAPI | TcgEndMethodSet (TCG_CREATE_STRUCT *CreateStruct) |
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 | 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) |
BOOLEAN EFIAPI | TcgFindFeatureCallback (const TCG_LEVEL0_DISCOVERY_HEADER *DiscoveryHeader, TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *Feature, UINTN FeatureSize, 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) |
Provide functions to provide tcg storage core spec related functions.
Copyright (c) 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file TcgStorageUtil.c.
TCG_RESULT EFIAPI TcgCheckComIds | ( | const TCG_PARSE_STRUCT * | ParseStruct, |
UINT16 | ExpectedComId, | ||
UINT16 | ExpectedComIdExtension | ||
) |
Checks if the ComIDs of the response match the expected values.
[in] | ParseStruct | Structure used to parse received TCG response |
[in] | ExpectedComId | Expected comID |
[in] | ExpectedComIdExtension | Expected extended comID |
Definition at line 224 of file TcgStorageUtil.c.
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.
[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] | ComId | ComID for the ComPacket |
[in] | ComIdExtension | Extended ComID for the ComPacket |
[in] | HostSessionId | Host Session ID for the Packet |
[in] | TpSessionId | Tper Session ID for the Packet |
Definition at line 493 of file TcgStorageUtil.c.
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.
CreateStruct | Input create structure. |
Size | size info. |
ComId | ComId info. |
ComIdExtension | ComId extension info. |
TperSession | Tper session data. |
HostSession | Host session data. |
AceRow | Ace row info. |
Authority1 | Authority 1 info. |
LogicalOperator | Logical operator info. |
Authority2 | Authority 2 info. |
Return | the action result. |
Definition at line 659 of file TcgStorageUtil.c.
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.
[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] | ComId | ComID for the ComPacket |
[in] | ComIdExtension | Extended ComID for the ComPacket |
[in] | TperSession | Tper Session ID for the Packet |
[in] | HostSession | Host Session ID for the Packet |
[in] | SidRow | UID of row of current SP to set PIN column |
[in] | Password | value of PIN to set |
[in] | PasswordSize | Size of PIN |
Definition at line 576 of file TcgStorageUtil.c.
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.
[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] | ComId | ComID for the ComPacket |
[in] | ComIdExtension | Extended ComID for the ComPacket |
[in] | HostSessionId | Host Session ID |
[in] | SpId | Security Provider to start session with |
[in] | Write | Write option for start session. TRUE = start session requests write access |
[in] | HostChallengeLength | Length of the host challenge. Length should be 0 if hostChallenge is NULL |
[in] | HostChallenge | Host challenge for Host Signing Authority. If NULL, then no Host Challenge shall be sent. |
[in] | HostSigningAuthority | Host Signing Authority used for start session. If NULL, then no Host Signing Authority shall be sent. |
Definition at line 358 of file TcgStorageUtil.c.
TCG_RESULT EFIAPI TcgEndMethodCall | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Adds END Data token and method list.
CreateStruct | The input create structure. |
Definition at line 156 of file TcgStorageUtil.c.
TCG_RESULT EFIAPI TcgEndMethodSet | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Set end method.
CreateStruct | Input create structure. |
Definition at line 547 of file TcgStorageUtil.c.
TCG_RESULT EFIAPI TcgEndParameters | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Adds END LIST token.
CreateStruct | The input create structure. |
Definition at line 130 of file TcgStorageUtil.c.
BOOLEAN EFIAPI TcgEnumLevel0Discovery | ( | const TCG_LEVEL0_DISCOVERY_HEADER * | DiscoveryHeader, |
TCG_LEVEL0_ENUM_CALLBACK | Callback, | ||
VOID * | Context | ||
) |
Enum level 0 discovery.
DiscoveryHeader | Discovery header. |
Callback | Callback function. |
Context | The context for the function. |
return | true if the callback return TRUE, else return FALSE. |
Definition at line 723 of file TcgStorageUtil.c.
BOOLEAN EFIAPI TcgFindFeatureCallback | ( | const TCG_LEVEL0_DISCOVERY_HEADER * | DiscoveryHeader, |
TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER * | Feature, | ||
UINTN | FeatureSize, | ||
VOID * | Context | ||
) |
The callback function for Get Feature function.
DiscoveryHeader | Input discovery header. |
Feature | Input Feature. |
FeatureSize | Input Feature size. |
Context | The context. |
Definition at line 799 of file TcgStorageUtil.c.
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.
[in] | ParseStruct | Structure 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.
TCG_LEVEL0_FEATURE_DESCRIPTOR_HEADER *EFIAPI TcgGetFeature | ( | const TCG_LEVEL0_DISCOVERY_HEADER * | DiscoveryHeader, |
UINT16 | FeatureCode, | ||
UINTN * | FeatureSize | ||
) |
Get Feature code from the header.
DiscoveryHeader | The discovery header. |
FeatureCode | return the Feature code. |
FeatureSize | return the Feature size. |
return | the Feature code data. |
Definition at line 829 of file TcgStorageUtil.c.
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.
[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.
BOOLEAN EFIAPI TcgIsLocked | ( | const TCG_LEVEL0_DISCOVERY_HEADER * | Discovery | ) |
Check whether lock or not.
Discovery |
TRUE | if lock, FALSE if not lock. |
Definition at line 892 of file TcgStorageUtil.c.
BOOLEAN EFIAPI TcgIsProtocolSupported | ( | const TCG_SUPPORTED_SECURITY_PROTOCOLS * | ProtocolList, |
UINT16 | Protocol | ||
) |
Determines if the protocol provided is part of the provided supported protocol list.
[in] | ProtocolList | Supported protocol list to investigate |
[in] | Protocol | Protocol value to determine if supported |
Definition at line 859 of file TcgStorageUtil.c.
CHAR8 *EFIAPI TcgMethodStatusString | ( | UINT8 | MethodStatus | ) |
Returns a human-readable string representing a method status return code.
[in] | MethodStatus | Method status to translate to a string |
return | the string info. |
Definition at line 31 of file TcgStorageUtil.c.
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.
[in/out] | ParseStruct Structure used to parse received TCG response, contains Sync Session response. | |
[in] | ComId | Expected ComID that is compared to actual ComID of response |
[in] | ComIdExtension | Expected Extended ComID that is compared to actual Extended ComID of response |
[in] | HostSessionId | Expected 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.
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.
[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] | ComId | ComID for the ComPacket |
[in] | ComIdExtension | Extended ComID for the ComPacket |
[in] | TperSession | Tper Session ID for the Packet |
[in] | HostSession | Host Session ID for the Packet |
[in] | AuthorityUid | Authority UID to modify the "Enabled" column for |
[in] | Enabled | Value to set the "Enabled" column to |
Definition at line 617 of file TcgStorageUtil.c.
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).
CreateStruct | The input create structure. |
InvokingId | Invoking id. |
MethodId | Method id. |
Definition at line 72 of file TcgStorageUtil.c.
TCG_RESULT EFIAPI TcgStartMethodSet | ( | TCG_CREATE_STRUCT * | CreateStruct, |
TCG_UID | Row, | ||
UINT32 | ColumnNumber | ||
) |
Set start method.
CreateStruct | Input create structure. |
Row | Input the row info. |
ColumnNumber | the column info. |
Definition at line 523 of file TcgStorageUtil.c.
TCG_RESULT EFIAPI TcgStartParameters | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Adds START LIST token.
CreateStruct | The input create structure. |
Definition at line 104 of file TcgStorageUtil.c.
CHAR8 *EFIAPI TcgTokenTypeString | ( | TCG_TOKEN_TYPE | Type | ) |
Return the toke type string info.
Type | Input the type info. |
Return | the string for this type. |
Definition at line 314 of file TcgStorageUtil.c.