SecurityPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SecurityPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
39de741e2d
commit
c411b485b6
@@ -16,22 +16,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
UINT32 Capability;
|
||||
UINT32 CapabilityFlagSize;
|
||||
UINT32 CapabilityFlag;
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
UINT32 Capability;
|
||||
UINT32 CapabilityFlagSize;
|
||||
UINT32 CapabilityFlag;
|
||||
} TPM_CMD_GET_CAPABILITY;
|
||||
|
||||
typedef struct {
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
UINT32 ResponseSize;
|
||||
TPM_PERMANENT_FLAGS Flags;
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
UINT32 ResponseSize;
|
||||
TPM_PERMANENT_FLAGS Flags;
|
||||
} TPM_RSP_GET_CAPABILITY_PERMANENT_FLAGS;
|
||||
|
||||
typedef struct {
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
UINT32 ResponseSize;
|
||||
TPM_STCLEAR_FLAGS Flags;
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
UINT32 ResponseSize;
|
||||
TPM_STCLEAR_FLAGS Flags;
|
||||
} TPM_RSP_GET_CAPABILITY_STCLEAR_FLAGS;
|
||||
|
||||
#pragma pack()
|
||||
@@ -67,8 +67,8 @@ Tpm12GetCapabilityFlagPermanent (
|
||||
Command.Capability = SwapBytes32 (TPM_CAP_FLAG);
|
||||
Command.CapabilityFlagSize = SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT));
|
||||
Command.CapabilityFlag = SwapBytes32 (TPM_CAP_FLAG_PERMANENT);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ Tpm12GetCapabilityFlagPermanent (
|
||||
}
|
||||
|
||||
ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags));
|
||||
CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), SwapBytes32(Response.ResponseSize)));
|
||||
CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), SwapBytes32 (Response.ResponseSize)));
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -113,8 +113,8 @@ Tpm12GetCapabilityFlagVolatile (
|
||||
Command.Capability = SwapBytes32 (TPM_CAP_FLAG);
|
||||
Command.CapabilityFlagSize = SwapBytes32 (sizeof (TPM_CAP_FLAG_VOLATILE));
|
||||
Command.CapabilityFlag = SwapBytes32 (TPM_CAP_FLAG_VOLATILE);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ Tpm12GetCapabilityFlagVolatile (
|
||||
}
|
||||
|
||||
ZeroMem (VolatileFlags, sizeof (*VolatileFlags));
|
||||
CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), SwapBytes32(Response.ResponseSize)));
|
||||
CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), SwapBytes32 (Response.ResponseSize)));
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@@ -22,30 +22,30 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM12_NV_DATA_PUBLIC PubInfo;
|
||||
TPM_ENCAUTH EncAuth;
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM12_NV_DATA_PUBLIC PubInfo;
|
||||
TPM_ENCAUTH EncAuth;
|
||||
} TPM_CMD_NV_DEFINE_SPACE;
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_NV_INDEX NvIndex;
|
||||
UINT32 Offset;
|
||||
UINT32 DataSize;
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_NV_INDEX NvIndex;
|
||||
UINT32 Offset;
|
||||
UINT32 DataSize;
|
||||
} TPM_CMD_NV_READ_VALUE;
|
||||
|
||||
typedef struct {
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
UINT32 DataSize;
|
||||
UINT8 Data[TPMNVVALUELENGTH];
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
UINT32 DataSize;
|
||||
UINT8 Data[TPMNVVALUELENGTH];
|
||||
} TPM_RSP_NV_READ_VALUE;
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_NV_INDEX NvIndex;
|
||||
UINT32 Offset;
|
||||
UINT32 DataSize;
|
||||
UINT8 Data[TPMNVVALUELENGTH];
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_NV_INDEX NvIndex;
|
||||
UINT32 Offset;
|
||||
UINT32 DataSize;
|
||||
UINT8 Data[TPMNVVALUELENGTH];
|
||||
} TPM_CMD_NV_WRITE_VALUE;
|
||||
|
||||
#pragma pack()
|
||||
@@ -74,41 +74,42 @@ Tpm12NvDefineSpace (
|
||||
//
|
||||
// send Tpm command TPM_ORD_NV_DefineSpace
|
||||
//
|
||||
Command.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.Hdr.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.Hdr.ordinal = SwapBytes32 (TPM_ORD_NV_DefineSpace);
|
||||
Command.PubInfo.tag = SwapBytes16 (PubInfo->tag);
|
||||
Command.PubInfo.nvIndex = SwapBytes32 (PubInfo->nvIndex);
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.sizeOfSelect = SwapBytes16 (PubInfo->pcrInfoRead.pcrSelection.sizeOfSelect);
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.pcrSelect[0] = PubInfo->pcrInfoRead.pcrSelection.pcrSelect[0];
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.pcrSelect[1] = PubInfo->pcrInfoRead.pcrSelection.pcrSelect[1];
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.pcrSelect[2] = PubInfo->pcrInfoRead.pcrSelection.pcrSelect[2];
|
||||
Command.PubInfo.pcrInfoRead.localityAtRelease = PubInfo->pcrInfoRead.localityAtRelease;
|
||||
CopyMem (&Command.PubInfo.pcrInfoRead.digestAtRelease, &PubInfo->pcrInfoRead.digestAtRelease, sizeof(PubInfo->pcrInfoRead.digestAtRelease));
|
||||
Command.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.Hdr.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.Hdr.ordinal = SwapBytes32 (TPM_ORD_NV_DefineSpace);
|
||||
Command.PubInfo.tag = SwapBytes16 (PubInfo->tag);
|
||||
Command.PubInfo.nvIndex = SwapBytes32 (PubInfo->nvIndex);
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.sizeOfSelect = SwapBytes16 (PubInfo->pcrInfoRead.pcrSelection.sizeOfSelect);
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.pcrSelect[0] = PubInfo->pcrInfoRead.pcrSelection.pcrSelect[0];
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.pcrSelect[1] = PubInfo->pcrInfoRead.pcrSelection.pcrSelect[1];
|
||||
Command.PubInfo.pcrInfoRead.pcrSelection.pcrSelect[2] = PubInfo->pcrInfoRead.pcrSelection.pcrSelect[2];
|
||||
Command.PubInfo.pcrInfoRead.localityAtRelease = PubInfo->pcrInfoRead.localityAtRelease;
|
||||
CopyMem (&Command.PubInfo.pcrInfoRead.digestAtRelease, &PubInfo->pcrInfoRead.digestAtRelease, sizeof (PubInfo->pcrInfoRead.digestAtRelease));
|
||||
Command.PubInfo.pcrInfoWrite.pcrSelection.sizeOfSelect = SwapBytes16 (PubInfo->pcrInfoWrite.pcrSelection.sizeOfSelect);
|
||||
Command.PubInfo.pcrInfoWrite.pcrSelection.pcrSelect[0] = PubInfo->pcrInfoWrite.pcrSelection.pcrSelect[0];
|
||||
Command.PubInfo.pcrInfoWrite.pcrSelection.pcrSelect[1] = PubInfo->pcrInfoWrite.pcrSelection.pcrSelect[1];
|
||||
Command.PubInfo.pcrInfoWrite.pcrSelection.pcrSelect[2] = PubInfo->pcrInfoWrite.pcrSelection.pcrSelect[2];
|
||||
Command.PubInfo.pcrInfoWrite.localityAtRelease = PubInfo->pcrInfoWrite.localityAtRelease;
|
||||
CopyMem (&Command.PubInfo.pcrInfoWrite.digestAtRelease, &PubInfo->pcrInfoWrite.digestAtRelease, sizeof(PubInfo->pcrInfoWrite.digestAtRelease));
|
||||
CopyMem (&Command.PubInfo.pcrInfoWrite.digestAtRelease, &PubInfo->pcrInfoWrite.digestAtRelease, sizeof (PubInfo->pcrInfoWrite.digestAtRelease));
|
||||
Command.PubInfo.permission.tag = SwapBytes16 (PubInfo->permission.tag);
|
||||
Command.PubInfo.permission.attributes = SwapBytes32 (PubInfo->permission.attributes);
|
||||
Command.PubInfo.bReadSTClear = PubInfo->bReadSTClear;
|
||||
Command.PubInfo.bWriteSTClear = PubInfo->bWriteSTClear;
|
||||
Command.PubInfo.bWriteDefine = PubInfo->bWriteDefine;
|
||||
Command.PubInfo.dataSize = SwapBytes32 (PubInfo->dataSize);
|
||||
CopyMem (&Command.EncAuth, EncAuth, sizeof(*EncAuth));
|
||||
CopyMem (&Command.EncAuth, EncAuth, sizeof (*EncAuth));
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Tpm12NvDefineSpace - ReturnCode = %x\n", SwapBytes32 (Response.returnCode)));
|
||||
switch (SwapBytes32 (Response.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,17 +147,18 @@ Tpm12NvReadValue (
|
||||
Command.NvIndex = SwapBytes32 (NvIndex);
|
||||
Command.Offset = SwapBytes32 (Offset);
|
||||
Command.DataSize = SwapBytes32 (*DataSize);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Tpm12NvReadValue - ReturnCode = %x\n", SwapBytes32 (Response.Hdr.returnCode)));
|
||||
switch (SwapBytes32 (Response.Hdr.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
break;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case TPM_SUCCESS:
|
||||
break;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -165,6 +167,7 @@ Tpm12NvReadValue (
|
||||
if (SwapBytes32 (Response.DataSize) > *DataSize) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
*DataSize = SwapBytes32 (Response.DataSize);
|
||||
ZeroMem (Data, *DataSize);
|
||||
CopyMem (Data, &Response.Data, *DataSize);
|
||||
@@ -206,7 +209,7 @@ Tpm12NvWriteValue (
|
||||
// send Tpm command TPM_ORD_NV_WriteValue
|
||||
//
|
||||
Command.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
CommandLength = sizeof (Command) - sizeof(Command.Data) + DataSize;
|
||||
CommandLength = sizeof (Command) - sizeof (Command.Data) + DataSize;
|
||||
Command.Hdr.paramSize = SwapBytes32 (CommandLength);
|
||||
Command.Hdr.ordinal = SwapBytes32 (TPM_ORD_NV_WriteValue);
|
||||
Command.NvIndex = SwapBytes32 (NvIndex);
|
||||
@@ -214,15 +217,16 @@ Tpm12NvWriteValue (
|
||||
Command.DataSize = SwapBytes32 (DataSize);
|
||||
CopyMem (Command.Data, Data, DataSize);
|
||||
ResponseLength = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (CommandLength, (UINT8 *)&Command, &ResponseLength, (UINT8 *)&Response);
|
||||
Status = Tpm12SubmitCommand (CommandLength, (UINT8 *)&Command, &ResponseLength, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Tpm12NvWriteValue - ReturnCode = %x\n", SwapBytes32 (Response.returnCode)));
|
||||
switch (SwapBytes32 (Response.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@@ -31,19 +31,20 @@ Tpm12ForceClear (
|
||||
//
|
||||
// send Tpm command TPM_ORD_ForceClear
|
||||
//
|
||||
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.ordinal = SwapBytes32 (TPM_ORD_ForceClear);
|
||||
Length = sizeof (Response);
|
||||
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.ordinal = SwapBytes32 (TPM_ORD_ForceClear);
|
||||
Length = sizeof (Response);
|
||||
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
switch (SwapBytes32 (Response.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@@ -16,14 +16,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_PCRINDEX PcrIndex;
|
||||
TPM_DIGEST TpmDigest;
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_PCRINDEX PcrIndex;
|
||||
TPM_DIGEST TpmDigest;
|
||||
} TPM_CMD_EXTEND;
|
||||
|
||||
typedef struct {
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
TPM_DIGEST TpmDigest;
|
||||
TPM_RSP_COMMAND_HDR Hdr;
|
||||
TPM_DIGEST TpmDigest;
|
||||
} TPM_RSP_EXTEND;
|
||||
|
||||
#pragma pack()
|
||||
@@ -68,8 +68,8 @@ Tpm12Extend (
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (SwapBytes32(Response.Hdr.returnCode) != TPM_SUCCESS) {
|
||||
DEBUG ((DEBUG_ERROR, "Tpm12Extend: Response Code error! 0x%08x\r\n", SwapBytes32(Response.Hdr.returnCode)));
|
||||
if (SwapBytes32 (Response.Hdr.returnCode) != TPM_SUCCESS) {
|
||||
DEBUG ((DEBUG_ERROR, "Tpm12Extend: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.Hdr.returnCode)));
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
@@ -15,8 +15,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_PHYSICAL_PRESENCE PhysicalPresence;
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_PHYSICAL_PRESENCE PhysicalPresence;
|
||||
} TPM_CMD_PHYSICAL_PRESENCE;
|
||||
|
||||
#pragma pack()
|
||||
@@ -50,15 +50,15 @@ Tpm12PhysicalPresence (
|
||||
Command.Hdr.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.Hdr.ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence);
|
||||
Command.PhysicalPresence = SwapBytes16 (PhysicalPresence);
|
||||
Length = sizeof (Response);
|
||||
Length = sizeof (Response);
|
||||
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (SwapBytes32(Response.returnCode) != TPM_SUCCESS) {
|
||||
DEBUG ((DEBUG_ERROR, "Tpm12PhysicalPresence: Response Code error! 0x%08x\r\n", SwapBytes32(Response.returnCode)));
|
||||
if (SwapBytes32 (Response.returnCode) != TPM_SUCCESS) {
|
||||
DEBUG ((DEBUG_ERROR, "Tpm12PhysicalPresence: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.returnCode)));
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
@@ -39,8 +39,8 @@ Tpm12ContinueSelfTest (
|
||||
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.ordinal = SwapBytes32 (TPM_ORD_ContinueSelfTest);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
@@ -16,8 +16,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_STARTUP_TYPE TpmSt;
|
||||
TPM_RQU_COMMAND_HDR Hdr;
|
||||
TPM_STARTUP_TYPE TpmSt;
|
||||
} TPM_CMD_START_UP;
|
||||
|
||||
#pragma pack()
|
||||
@@ -48,21 +48,22 @@ Tpm12Startup (
|
||||
Command.Hdr.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.Hdr.ordinal = SwapBytes32 (TPM_ORD_Startup);
|
||||
Command.TpmSt = SwapBytes16 (TpmSt);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
switch (SwapBytes32(Response.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
DEBUG ((DEBUG_INFO, "TPM12Startup: TPM_SUCCESS\n"));
|
||||
return EFI_SUCCESS;
|
||||
case TPM_INVALID_POSTINIT:
|
||||
// In warm reset, TPM may response TPM_INVALID_POSTINIT
|
||||
DEBUG ((DEBUG_INFO, "TPM12Startup: TPM_INVALID_POSTINIT\n"));
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
||||
switch (SwapBytes32 (Response.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
DEBUG ((DEBUG_INFO, "TPM12Startup: TPM_SUCCESS\n"));
|
||||
return EFI_SUCCESS;
|
||||
case TPM_INVALID_POSTINIT:
|
||||
// In warm reset, TPM may response TPM_INVALID_POSTINIT
|
||||
DEBUG ((DEBUG_INFO, "TPM12Startup: TPM_INVALID_POSTINIT\n"));
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,18 +87,19 @@ Tpm12SaveState (
|
||||
//
|
||||
// send Tpm command TPM_ORD_SaveState
|
||||
//
|
||||
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.ordinal = SwapBytes32 (TPM_ORD_SaveState);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
|
||||
Command.paramSize = SwapBytes32 (sizeof (Command));
|
||||
Command.ordinal = SwapBytes32 (TPM_ORD_SaveState);
|
||||
Length = sizeof (Response);
|
||||
Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
switch (SwapBytes32 (Response.returnCode)) {
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case TPM_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user