20 TPMI_RH_HIERARCHY_AUTH AuthHandle;
21 UINT32 AuthSessionSize;
28 UINT32 AuthSessionSize;
49 IN TPMI_RH_PLATFORM AuthHandle,
51 IN UINT32 AlgorithmSet
57 UINT32 SendBufferSize;
58 UINT32 RecvBufferSize;
60 UINT32 SessionInfoSize;
65 SendBuffer.Header.tag =
SwapBytes16 (TPM_ST_SESSIONS);
66 SendBuffer.Header.commandCode =
SwapBytes32 (TPM_CC_SetAlgorithmSet);
73 Buffer = (UINT8 *)&SendBuffer.AuthSession;
77 Buffer += SessionInfoSize;
78 SendBuffer.AuthSessionSize =
SwapBytes32 (SessionInfoSize);
84 Buffer +=
sizeof (UINT32);
86 SendBufferSize = (UINT32)((
UINTN)Buffer - (
UINTN)&SendBuffer);
87 SendBuffer.Header.paramSize =
SwapBytes32 (SendBufferSize);
92 RecvBufferSize =
sizeof (RecvBuffer);
93 Status =
Tpm2SubmitCommand (SendBufferSize, (UINT8 *)&SendBuffer, &RecvBufferSize, (UINT8 *)&RecvBuffer);
94 if (EFI_ERROR (Status)) {
99 DEBUG ((DEBUG_ERROR,
"Tpm2SetAlgorithmSet - RecvBufferSize Error - %x\n", RecvBufferSize));
100 Status = EFI_DEVICE_ERROR;
104 if (
SwapBytes32 (RecvBuffer.Header.responseCode) != TPM_RC_SUCCESS) {
105 DEBUG ((DEBUG_ERROR,
"Tpm2SetAlgorithmSet - responseCode - %x\n",
SwapBytes32 (RecvBuffer.Header.responseCode)));
106 Status = EFI_DEVICE_ERROR;
114 ZeroMem (&SendBuffer,
sizeof (SendBuffer));
115 ZeroMem (&RecvBuffer,
sizeof (RecvBuffer));
UINT16 EFIAPI SwapBytes16(IN UINT16 Value)
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
UINT32 EFIAPI WriteUnaligned32(OUT UINT32 *Buffer, IN UINT32 Value)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define DEBUG(Expression)
UINT32 EFIAPI CopyAuthSessionCommand(IN TPMS_AUTH_COMMAND *AuthSessionIn OPTIONAL, OUT UINT8 *AuthSessionOut)
EFI_STATUS EFIAPI Tpm2SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
EFI_STATUS EFIAPI Tpm2SetAlgorithmSet(IN TPMI_RH_PLATFORM AuthHandle, IN TPMS_AUTH_COMMAND *AuthSession, IN UINT32 AlgorithmSet)