diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:54:12 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | c411b485b63a671a1e276700cff025c73997233c (patch) | |
tree | e7a57ca51b659161ab4bc9da95e988760ec57e7a /SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c | |
parent | 39de741e2dcb8f11e9b4438e37224797643d8451 (diff) | |
download | edk2-c411b485b63a671a1e276700cff025c73997233c.tar.gz edk2-c411b485b63a671a1e276700cff025c73997233c.tar.bz2 edk2-c411b485b63a671a1e276700cff025c73997233c.zip |
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>
Diffstat (limited to 'SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c')
-rw-r--r-- | SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c | 339 |
1 files changed, 170 insertions, 169 deletions
diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c index 3d99f0615c..00ae39feb7 100644 --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c @@ -16,62 +16,62 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #pragma pack(1)
typedef struct {
- TPM2_COMMAND_HEADER Header;
- TPM2B_AUTH Auth;
- TPMI_ALG_HASH HashAlg;
+ TPM2_COMMAND_HEADER Header;
+ TPM2B_AUTH Auth;
+ TPMI_ALG_HASH HashAlg;
} TPM2_HASH_SEQUENCE_START_COMMAND;
typedef struct {
- TPM2_RESPONSE_HEADER Header;
- TPMI_DH_OBJECT SequenceHandle;
+ TPM2_RESPONSE_HEADER Header;
+ TPMI_DH_OBJECT SequenceHandle;
} TPM2_HASH_SEQUENCE_START_RESPONSE;
typedef struct {
- TPM2_COMMAND_HEADER Header;
- TPMI_DH_OBJECT SequenceHandle;
- UINT32 AuthorizationSize;
- TPMS_AUTH_COMMAND AuthSessionSeq;
- TPM2B_MAX_BUFFER Buffer;
+ TPM2_COMMAND_HEADER Header;
+ TPMI_DH_OBJECT SequenceHandle;
+ UINT32 AuthorizationSize;
+ TPMS_AUTH_COMMAND AuthSessionSeq;
+ TPM2B_MAX_BUFFER Buffer;
} TPM2_SEQUENCE_UPDATE_COMMAND;
typedef struct {
- TPM2_RESPONSE_HEADER Header;
- UINT32 ParameterSize;
- TPMS_AUTH_RESPONSE AuthSessionSeq;
+ TPM2_RESPONSE_HEADER Header;
+ UINT32 ParameterSize;
+ TPMS_AUTH_RESPONSE AuthSessionSeq;
} TPM2_SEQUENCE_UPDATE_RESPONSE;
typedef struct {
- TPM2_COMMAND_HEADER Header;
- TPMI_DH_PCR PcrHandle;
- TPMI_DH_OBJECT SequenceHandle;
- UINT32 AuthorizationSize;
- TPMS_AUTH_COMMAND AuthSessionPcr;
- TPMS_AUTH_COMMAND AuthSessionSeq;
- TPM2B_MAX_BUFFER Buffer;
+ TPM2_COMMAND_HEADER Header;
+ TPMI_DH_PCR PcrHandle;
+ TPMI_DH_OBJECT SequenceHandle;
+ UINT32 AuthorizationSize;
+ TPMS_AUTH_COMMAND AuthSessionPcr;
+ TPMS_AUTH_COMMAND AuthSessionSeq;
+ TPM2B_MAX_BUFFER Buffer;
} TPM2_EVENT_SEQUENCE_COMPLETE_COMMAND;
typedef struct {
- TPM2_RESPONSE_HEADER Header;
- UINT32 ParameterSize;
- TPML_DIGEST_VALUES Results;
- TPMS_AUTH_RESPONSE AuthSessionPcr;
- TPMS_AUTH_RESPONSE AuthSessionSeq;
+ TPM2_RESPONSE_HEADER Header;
+ UINT32 ParameterSize;
+ TPML_DIGEST_VALUES Results;
+ TPMS_AUTH_RESPONSE AuthSessionPcr;
+ TPMS_AUTH_RESPONSE AuthSessionSeq;
} TPM2_EVENT_SEQUENCE_COMPLETE_RESPONSE;
typedef struct {
- TPM2_COMMAND_HEADER Header;
- TPMI_DH_OBJECT SequenceHandle;
- UINT32 AuthorizationSize;
- TPMS_AUTH_COMMAND AuthSessionSeq;
- TPM2B_MAX_BUFFER Buffer;
- TPMI_RH_HIERARCHY Hierarchy;
+ TPM2_COMMAND_HEADER Header;
+ TPMI_DH_OBJECT SequenceHandle;
+ UINT32 AuthorizationSize;
+ TPMS_AUTH_COMMAND AuthSessionSeq;
+ TPM2B_MAX_BUFFER Buffer;
+ TPMI_RH_HIERARCHY Hierarchy;
} TPM2_SEQUENCE_COMPLETE_COMMAND;
typedef struct {
- TPM2_RESPONSE_HEADER Header;
- UINT32 ParameterSize;
- TPM2B_DIGEST Digest;
- TPMS_AUTH_RESPONSE AuthSessionSeq;
+ TPM2_RESPONSE_HEADER Header;
+ UINT32 ParameterSize;
+ TPM2B_DIGEST Digest;
+ TPMS_AUTH_RESPONSE AuthSessionSeq;
} TPM2_SEQUENCE_COMPLETE_RESPONSE;
#pragma pack()
@@ -91,49 +91,49 @@ typedef struct { EFI_STATUS
EFIAPI
Tpm2HashSequenceStart (
- IN TPMI_ALG_HASH HashAlg,
- OUT TPMI_DH_OBJECT *SequenceHandle
+ IN TPMI_ALG_HASH HashAlg,
+ OUT TPMI_DH_OBJECT *SequenceHandle
)
{
- EFI_STATUS Status;
- TPM2_HASH_SEQUENCE_START_COMMAND Cmd;
- TPM2_HASH_SEQUENCE_START_RESPONSE Res;
- UINT32 CmdSize;
- UINT32 RespSize;
- UINT8 *Buffer;
- UINT32 ResultBufSize;
+ EFI_STATUS Status;
+ TPM2_HASH_SEQUENCE_START_COMMAND Cmd;
+ TPM2_HASH_SEQUENCE_START_RESPONSE Res;
+ UINT32 CmdSize;
+ UINT32 RespSize;
+ UINT8 *Buffer;
+ UINT32 ResultBufSize;
- ZeroMem(&Cmd, sizeof(Cmd));
+ ZeroMem (&Cmd, sizeof (Cmd));
//
// Construct command
//
- Cmd.Header.tag = SwapBytes16(TPM_ST_NO_SESSIONS);
- Cmd.Header.commandCode = SwapBytes32(TPM_CC_HashSequenceStart);
+ Cmd.Header.tag = SwapBytes16 (TPM_ST_NO_SESSIONS);
+ Cmd.Header.commandCode = SwapBytes32 (TPM_CC_HashSequenceStart);
Buffer = (UINT8 *)&Cmd.Auth;
// auth = nullAuth
- WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16(0));
- Buffer += sizeof(UINT16);
+ WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (0));
+ Buffer += sizeof (UINT16);
// hashAlg
- WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16(HashAlg));
- Buffer += sizeof(UINT16);
+ WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (HashAlg));
+ Buffer += sizeof (UINT16);
- CmdSize = (UINT32)(Buffer - (UINT8 *)&Cmd);
- Cmd.Header.paramSize = SwapBytes32(CmdSize);
+ CmdSize = (UINT32)(Buffer - (UINT8 *)&Cmd);
+ Cmd.Header.paramSize = SwapBytes32 (CmdSize);
//
// Call the TPM
//
- ResultBufSize = sizeof(Res);
- Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
- if (EFI_ERROR(Status)) {
+ ResultBufSize = sizeof (Res);
+ Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
+ if (EFI_ERROR (Status)) {
return Status;
}
- if (ResultBufSize > sizeof(Res)) {
+ if (ResultBufSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "HashSequenceStart: Failed ExecuteCommand: Buffer Too Small\r\n"));
return EFI_BUFFER_TOO_SMALL;
}
@@ -141,8 +141,8 @@ Tpm2HashSequenceStart ( //
// Validate response headers
//
- RespSize = SwapBytes32(Res.Header.paramSize);
- if (RespSize > sizeof(Res)) {
+ RespSize = SwapBytes32 (Res.Header.paramSize);
+ if (RespSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "HashSequenceStart: Response size too large! %d\r\n", RespSize));
return EFI_BUFFER_TOO_SMALL;
}
@@ -150,8 +150,8 @@ Tpm2HashSequenceStart ( //
// Fail if command failed
//
- if (SwapBytes32(Res.Header.responseCode) != TPM_RC_SUCCESS) {
- DEBUG ((DEBUG_ERROR, "HashSequenceStart: Response Code error! 0x%08x\r\n", SwapBytes32(Res.Header.responseCode)));
+ if (SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "HashSequenceStart: Response Code error! 0x%08x\r\n", SwapBytes32 (Res.Header.responseCode)));
return EFI_DEVICE_ERROR;
}
@@ -160,7 +160,7 @@ Tpm2HashSequenceStart ( //
// sequenceHandle
- *SequenceHandle = SwapBytes32(Res.SequenceHandle);
+ *SequenceHandle = SwapBytes32 (Res.SequenceHandle);
return EFI_SUCCESS;
}
@@ -179,27 +179,27 @@ Tpm2HashSequenceStart ( EFI_STATUS
EFIAPI
Tpm2SequenceUpdate (
- IN TPMI_DH_OBJECT SequenceHandle,
- IN TPM2B_MAX_BUFFER *Buffer
+ IN TPMI_DH_OBJECT SequenceHandle,
+ IN TPM2B_MAX_BUFFER *Buffer
)
{
- EFI_STATUS Status;
- TPM2_SEQUENCE_UPDATE_COMMAND Cmd;
- TPM2_SEQUENCE_UPDATE_RESPONSE Res;
- UINT32 CmdSize;
- UINT32 RespSize;
- UINT8 *BufferPtr;
- UINT32 SessionInfoSize;
- UINT32 ResultBufSize;
+ EFI_STATUS Status;
+ TPM2_SEQUENCE_UPDATE_COMMAND Cmd;
+ TPM2_SEQUENCE_UPDATE_RESPONSE Res;
+ UINT32 CmdSize;
+ UINT32 RespSize;
+ UINT8 *BufferPtr;
+ UINT32 SessionInfoSize;
+ UINT32 ResultBufSize;
- ZeroMem(&Cmd, sizeof(Cmd));
+ ZeroMem (&Cmd, sizeof (Cmd));
//
// Construct command
//
- Cmd.Header.tag = SwapBytes16(TPM_ST_SESSIONS);
- Cmd.Header.commandCode = SwapBytes32(TPM_CC_SequenceUpdate);
- Cmd.SequenceHandle = SwapBytes32(SequenceHandle);
+ Cmd.Header.tag = SwapBytes16 (TPM_ST_SESSIONS);
+ Cmd.Header.commandCode = SwapBytes32 (TPM_CC_SequenceUpdate);
+ Cmd.SequenceHandle = SwapBytes32 (SequenceHandle);
//
// Add in Auth session
@@ -207,30 +207,30 @@ Tpm2SequenceUpdate ( BufferPtr = (UINT8 *)&Cmd.AuthSessionSeq;
// sessionInfoSize
- SessionInfoSize = CopyAuthSessionCommand (NULL, BufferPtr);
- BufferPtr += SessionInfoSize;
- Cmd.AuthorizationSize = SwapBytes32(SessionInfoSize);
+ SessionInfoSize = CopyAuthSessionCommand (NULL, BufferPtr);
+ BufferPtr += SessionInfoSize;
+ Cmd.AuthorizationSize = SwapBytes32 (SessionInfoSize);
// buffer.size
- WriteUnaligned16 ((UINT16 *)BufferPtr, SwapBytes16(Buffer->size));
- BufferPtr += sizeof(UINT16);
+ WriteUnaligned16 ((UINT16 *)BufferPtr, SwapBytes16 (Buffer->size));
+ BufferPtr += sizeof (UINT16);
- CopyMem(BufferPtr, &Buffer->buffer, Buffer->size);
+ CopyMem (BufferPtr, &Buffer->buffer, Buffer->size);
BufferPtr += Buffer->size;
- CmdSize = (UINT32)(BufferPtr - (UINT8 *)&Cmd);
- Cmd.Header.paramSize = SwapBytes32(CmdSize);
+ CmdSize = (UINT32)(BufferPtr - (UINT8 *)&Cmd);
+ Cmd.Header.paramSize = SwapBytes32 (CmdSize);
//
// Call the TPM
//
- ResultBufSize = sizeof(Res);
- Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd,&ResultBufSize, (UINT8 *)&Res);
- if (EFI_ERROR(Status)) {
+ ResultBufSize = sizeof (Res);
+ Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
+ if (EFI_ERROR (Status)) {
return Status;
}
- if (ResultBufSize > sizeof(Res)) {
+ if (ResultBufSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "SequenceUpdate: Failed ExecuteCommand: Buffer Too Small\r\n"));
return EFI_BUFFER_TOO_SMALL;
}
@@ -238,8 +238,8 @@ Tpm2SequenceUpdate ( //
// Validate response headers
//
- RespSize = SwapBytes32(Res.Header.paramSize);
- if (RespSize > sizeof(Res)) {
+ RespSize = SwapBytes32 (Res.Header.paramSize);
+ if (RespSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "SequenceUpdate: Response size too large! %d\r\n", RespSize));
return EFI_BUFFER_TOO_SMALL;
}
@@ -247,8 +247,8 @@ Tpm2SequenceUpdate ( //
// Fail if command failed
//
- if (SwapBytes32(Res.Header.responseCode) != TPM_RC_SUCCESS) {
- DEBUG ((DEBUG_ERROR, "SequenceUpdate: Response Code error! 0x%08x\r\n", SwapBytes32(Res.Header.responseCode)));
+ if (SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "SequenceUpdate: Response Code error! 0x%08x\r\n", SwapBytes32 (Res.Header.responseCode)));
return EFI_DEVICE_ERROR;
}
@@ -278,33 +278,33 @@ Tpm2SequenceUpdate ( EFI_STATUS
EFIAPI
Tpm2EventSequenceComplete (
- IN TPMI_DH_PCR PcrHandle,
- IN TPMI_DH_OBJECT SequenceHandle,
- IN TPM2B_MAX_BUFFER *Buffer,
- OUT TPML_DIGEST_VALUES *Results
+ IN TPMI_DH_PCR PcrHandle,
+ IN TPMI_DH_OBJECT SequenceHandle,
+ IN TPM2B_MAX_BUFFER *Buffer,
+ OUT TPML_DIGEST_VALUES *Results
)
{
- EFI_STATUS Status;
- TPM2_EVENT_SEQUENCE_COMPLETE_COMMAND Cmd;
- TPM2_EVENT_SEQUENCE_COMPLETE_RESPONSE Res;
- UINT32 CmdSize;
- UINT32 RespSize;
- UINT8 *BufferPtr;
- UINT32 SessionInfoSize;
- UINT32 SessionInfoSize2;
- UINT32 Index;
- UINT32 ResultBufSize;
- UINT16 DigestSize;
+ EFI_STATUS Status;
+ TPM2_EVENT_SEQUENCE_COMPLETE_COMMAND Cmd;
+ TPM2_EVENT_SEQUENCE_COMPLETE_RESPONSE Res;
+ UINT32 CmdSize;
+ UINT32 RespSize;
+ UINT8 *BufferPtr;
+ UINT32 SessionInfoSize;
+ UINT32 SessionInfoSize2;
+ UINT32 Index;
+ UINT32 ResultBufSize;
+ UINT16 DigestSize;
- ZeroMem(&Cmd, sizeof(Cmd));
+ ZeroMem (&Cmd, sizeof (Cmd));
//
// Construct command
//
- Cmd.Header.tag = SwapBytes16(TPM_ST_SESSIONS);
- Cmd.Header.commandCode = SwapBytes32(TPM_CC_EventSequenceComplete);
- Cmd.PcrHandle = SwapBytes32(PcrHandle);
- Cmd.SequenceHandle = SwapBytes32(SequenceHandle);
+ Cmd.Header.tag = SwapBytes16 (TPM_ST_SESSIONS);
+ Cmd.Header.commandCode = SwapBytes32 (TPM_CC_EventSequenceComplete);
+ Cmd.PcrHandle = SwapBytes32 (PcrHandle);
+ Cmd.SequenceHandle = SwapBytes32 (SequenceHandle);
//
// Add in pcrHandle Auth session
@@ -313,33 +313,33 @@ Tpm2EventSequenceComplete ( // sessionInfoSize
SessionInfoSize = CopyAuthSessionCommand (NULL, BufferPtr);
- BufferPtr += SessionInfoSize;
+ BufferPtr += SessionInfoSize;
// sessionInfoSize
- SessionInfoSize2 = CopyAuthSessionCommand (NULL, BufferPtr);
- BufferPtr += SessionInfoSize2;
- Cmd.AuthorizationSize = SwapBytes32(SessionInfoSize + SessionInfoSize2);
+ SessionInfoSize2 = CopyAuthSessionCommand (NULL, BufferPtr);
+ BufferPtr += SessionInfoSize2;
+ Cmd.AuthorizationSize = SwapBytes32 (SessionInfoSize + SessionInfoSize2);
// buffer.size
- WriteUnaligned16 ((UINT16 *)BufferPtr, SwapBytes16(Buffer->size));
- BufferPtr += sizeof(UINT16);
+ WriteUnaligned16 ((UINT16 *)BufferPtr, SwapBytes16 (Buffer->size));
+ BufferPtr += sizeof (UINT16);
- CopyMem(BufferPtr, &Buffer->buffer[0], Buffer->size);
+ CopyMem (BufferPtr, &Buffer->buffer[0], Buffer->size);
BufferPtr += Buffer->size;
- CmdSize = (UINT32)(BufferPtr - (UINT8 *)&Cmd);
- Cmd.Header.paramSize = SwapBytes32(CmdSize);
+ CmdSize = (UINT32)(BufferPtr - (UINT8 *)&Cmd);
+ Cmd.Header.paramSize = SwapBytes32 (CmdSize);
//
// Call the TPM
//
- ResultBufSize = sizeof(Res);
- Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
- if (EFI_ERROR(Status)) {
+ ResultBufSize = sizeof (Res);
+ Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
+ if (EFI_ERROR (Status)) {
return Status;
}
- if (ResultBufSize > sizeof(Res)) {
+ if (ResultBufSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "EventSequenceComplete: Failed ExecuteCommand: Buffer Too Small\r\n"));
return EFI_BUFFER_TOO_SMALL;
}
@@ -347,8 +347,8 @@ Tpm2EventSequenceComplete ( //
// Validate response headers
//
- RespSize = SwapBytes32(Res.Header.paramSize);
- if (RespSize > sizeof(Res)) {
+ RespSize = SwapBytes32 (Res.Header.paramSize);
+ if (RespSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "EventSequenceComplete: Response size too large! %d\r\n", RespSize));
return EFI_BUFFER_TOO_SMALL;
}
@@ -356,8 +356,8 @@ Tpm2EventSequenceComplete ( //
// Fail if command failed
//
- if (SwapBytes32(Res.Header.responseCode) != TPM_RC_SUCCESS) {
- DEBUG ((DEBUG_ERROR, "EventSequenceComplete: Response Code error! 0x%08x\r\n", SwapBytes32(Res.Header.responseCode)));
+ if (SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "EventSequenceComplete: Response Code error! 0x%08x\r\n", SwapBytes32 (Res.Header.responseCode)));
return EFI_DEVICE_ERROR;
}
@@ -368,24 +368,25 @@ Tpm2EventSequenceComplete ( BufferPtr = (UINT8 *)&Res.Results;
// count
- Results->count = SwapBytes32(ReadUnaligned32 ((UINT32 *)BufferPtr));
+ Results->count = SwapBytes32 (ReadUnaligned32 ((UINT32 *)BufferPtr));
if (Results->count > HASH_COUNT) {
DEBUG ((DEBUG_ERROR, "Tpm2EventSequenceComplete - Results->count error %x\n", Results->count));
return EFI_DEVICE_ERROR;
}
- BufferPtr += sizeof(UINT32);
+ BufferPtr += sizeof (UINT32);
for (Index = 0; Index < Results->count; Index++) {
- Results->digests[Index].hashAlg = SwapBytes16(ReadUnaligned16 ((UINT16 *)BufferPtr));
- BufferPtr += sizeof(UINT16);
+ Results->digests[Index].hashAlg = SwapBytes16 (ReadUnaligned16 ((UINT16 *)BufferPtr));
+ BufferPtr += sizeof (UINT16);
DigestSize = GetHashSizeFromAlgo (Results->digests[Index].hashAlg);
if (DigestSize == 0) {
DEBUG ((DEBUG_ERROR, "EventSequenceComplete: Unknown hash algorithm %d\r\n", Results->digests[Index].hashAlg));
return EFI_DEVICE_ERROR;
}
- CopyMem(
+
+ CopyMem (
&Results->digests[Index].digest,
BufferPtr,
DigestSize
@@ -409,28 +410,28 @@ Tpm2EventSequenceComplete ( EFI_STATUS
EFIAPI
Tpm2SequenceComplete (
- IN TPMI_DH_OBJECT SequenceHandle,
- IN TPM2B_MAX_BUFFER *Buffer,
- OUT TPM2B_DIGEST *Result
+ IN TPMI_DH_OBJECT SequenceHandle,
+ IN TPM2B_MAX_BUFFER *Buffer,
+ OUT TPM2B_DIGEST *Result
)
{
- EFI_STATUS Status;
- TPM2_SEQUENCE_COMPLETE_COMMAND Cmd;
- TPM2_SEQUENCE_COMPLETE_RESPONSE Res;
- UINT32 CmdSize;
- UINT32 RespSize;
- UINT8 *BufferPtr;
- UINT32 SessionInfoSize;
- UINT32 ResultBufSize;
+ EFI_STATUS Status;
+ TPM2_SEQUENCE_COMPLETE_COMMAND Cmd;
+ TPM2_SEQUENCE_COMPLETE_RESPONSE Res;
+ UINT32 CmdSize;
+ UINT32 RespSize;
+ UINT8 *BufferPtr;
+ UINT32 SessionInfoSize;
+ UINT32 ResultBufSize;
- ZeroMem(&Cmd, sizeof(Cmd));
+ ZeroMem (&Cmd, sizeof (Cmd));
//
// Construct command
//
- Cmd.Header.tag = SwapBytes16(TPM_ST_SESSIONS);
- Cmd.Header.commandCode = SwapBytes32(TPM_CC_SequenceComplete);
- Cmd.SequenceHandle = SwapBytes32(SequenceHandle);
+ Cmd.Header.tag = SwapBytes16 (TPM_ST_SESSIONS);
+ Cmd.Header.commandCode = SwapBytes32 (TPM_CC_SequenceComplete);
+ Cmd.SequenceHandle = SwapBytes32 (SequenceHandle);
//
// Add in Auth session
@@ -438,34 +439,34 @@ Tpm2SequenceComplete ( BufferPtr = (UINT8 *)&Cmd.AuthSessionSeq;
// sessionInfoSize
- SessionInfoSize = CopyAuthSessionCommand (NULL, BufferPtr);
- BufferPtr += SessionInfoSize;
- Cmd.AuthorizationSize = SwapBytes32(SessionInfoSize);
+ SessionInfoSize = CopyAuthSessionCommand (NULL, BufferPtr);
+ BufferPtr += SessionInfoSize;
+ Cmd.AuthorizationSize = SwapBytes32 (SessionInfoSize);
// buffer.size
- WriteUnaligned16 ((UINT16 *)BufferPtr, SwapBytes16(Buffer->size));
- BufferPtr += sizeof(UINT16);
+ WriteUnaligned16 ((UINT16 *)BufferPtr, SwapBytes16 (Buffer->size));
+ BufferPtr += sizeof (UINT16);
- CopyMem(BufferPtr, &Buffer->buffer[0], Buffer->size);
+ CopyMem (BufferPtr, &Buffer->buffer[0], Buffer->size);
BufferPtr += Buffer->size;
// Hierarchy
WriteUnaligned32 ((UINT32 *)BufferPtr, SwapBytes32 (TPM_RH_NULL));
BufferPtr += sizeof (UINT32);
- CmdSize = (UINT32)(BufferPtr - (UINT8 *)&Cmd);
- Cmd.Header.paramSize = SwapBytes32(CmdSize);
+ CmdSize = (UINT32)(BufferPtr - (UINT8 *)&Cmd);
+ Cmd.Header.paramSize = SwapBytes32 (CmdSize);
//
// Call the TPM
//
- ResultBufSize = sizeof(Res);
- Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
- if (EFI_ERROR(Status)) {
+ ResultBufSize = sizeof (Res);
+ Status = Tpm2SubmitCommand (CmdSize, (UINT8 *)&Cmd, &ResultBufSize, (UINT8 *)&Res);
+ if (EFI_ERROR (Status)) {
return Status;
}
- if (ResultBufSize > sizeof(Res)) {
+ if (ResultBufSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "SequenceComplete: Failed ExecuteCommand: Buffer Too Small\r\n"));
return EFI_BUFFER_TOO_SMALL;
}
@@ -473,8 +474,8 @@ Tpm2SequenceComplete ( //
// Validate response headers
//
- RespSize = SwapBytes32(Res.Header.paramSize);
- if (RespSize > sizeof(Res)) {
+ RespSize = SwapBytes32 (Res.Header.paramSize);
+ if (RespSize > sizeof (Res)) {
DEBUG ((DEBUG_ERROR, "SequenceComplete: Response size too large! %d\r\n", RespSize));
return EFI_BUFFER_TOO_SMALL;
}
@@ -482,8 +483,8 @@ Tpm2SequenceComplete ( //
// Fail if command failed
//
- if (SwapBytes32(Res.Header.responseCode) != TPM_RC_SUCCESS) {
- DEBUG ((DEBUG_ERROR, "SequenceComplete: Response Code error! 0x%08x\r\n", SwapBytes32(Res.Header.responseCode)));
+ if (SwapBytes32 (Res.Header.responseCode) != TPM_RC_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "SequenceComplete: Response Code error! 0x%08x\r\n", SwapBytes32 (Res.Header.responseCode)));
return EFI_DEVICE_ERROR;
}
@@ -494,15 +495,15 @@ Tpm2SequenceComplete ( BufferPtr = (UINT8 *)&Res.Digest;
// digestSize
- Result->size = SwapBytes16(ReadUnaligned16 ((UINT16 *)BufferPtr));
- if (Result->size > sizeof(TPMU_HA)){
+ Result->size = SwapBytes16 (ReadUnaligned16 ((UINT16 *)BufferPtr));
+ if (Result->size > sizeof (TPMU_HA)) {
DEBUG ((DEBUG_ERROR, "Tpm2SequenceComplete - Result->size error %x\n", Result->size));
return EFI_DEVICE_ERROR;
}
- BufferPtr += sizeof(UINT16);
+ BufferPtr += sizeof (UINT16);
- CopyMem(
+ CopyMem (
Result->buffer,
BufferPtr,
Result->size
|