X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=SecurityPkg%2FLibrary%2FTpm12CommandLib%2FTpm12Ownership.c;h=1dae03d17a12e272c4574dbc3a84e5920d6c01c8;hb=HEAD;hp=5ca1323c30f02feb5a9deaa9d9a643ff8fe71157;hpb=4ccef56102cc104ad0bc881f5312f84fb4e569ef;p=mirror_edk2.git
diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12Ownership.c b/SecurityPkg/Library/Tpm12CommandLib/Tpm12Ownership.c
index 5ca1323c30..1dae03d17a 100644
--- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12Ownership.c
+++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12Ownership.c
@@ -1,35 +1,16 @@
/** @file
Implement TPM1.2 Ownership related command.
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include
-#include
+#include
#include
#include
#include
-#pragma pack(1)
-
-typedef struct {
- TPM_RQU_COMMAND_HDR Hdr;
-} TPM_CMD_FORCE_CLEAR;
-
-typedef struct {
- TPM_RSP_COMMAND_HDR Hdr;
-} TPM_RSP_FORCE_CLEAR;
-
-#pragma pack()
-
/**
Send ForceClear command to TPM1.2.
@@ -42,31 +23,28 @@ Tpm12ForceClear (
VOID
)
{
- EFI_STATUS Status;
- UINT32 TpmRecvSize;
- UINT32 TpmSendSize;
- TPM_CMD_FORCE_CLEAR SendBuffer;
- TPM_RSP_FORCE_CLEAR RecvBuffer;
- UINT32 ReturnCode;
+ EFI_STATUS Status;
+ TPM_RQU_COMMAND_HDR Command;
+ TPM_RSP_COMMAND_HDR Response;
+ UINT32 Length;
//
// send Tpm command TPM_ORD_ForceClear
//
- TpmRecvSize = sizeof (TPM_RSP_FORCE_CLEAR);
- TpmSendSize = sizeof (TPM_CMD_FORCE_CLEAR);
- SendBuffer.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
- SendBuffer.Hdr.paramSize = SwapBytes32 (TpmSendSize);
- SendBuffer.Hdr.ordinal = SwapBytes32 (TPM_ORD_ForceClear);
+ Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
+ Command.paramSize = SwapBytes32 (sizeof (Command));
+ Command.ordinal = SwapBytes32 (TPM_ORD_ForceClear);
+ Length = sizeof (Response);
- Status = Tpm12SubmitCommand (TpmSendSize, (UINT8 *)&SendBuffer, &TpmRecvSize, (UINT8 *)&RecvBuffer);
+ Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
if (EFI_ERROR (Status)) {
return Status;
}
- ReturnCode = SwapBytes32(RecvBuffer.Hdr.returnCode);
- switch (ReturnCode) {
- case TPM_SUCCESS:
- return EFI_SUCCESS;
- default:
- return EFI_DEVICE_ERROR;
+
+ switch (SwapBytes32 (Response.returnCode)) {
+ case TPM_SUCCESS:
+ return EFI_SUCCESS;
+ default:
+ return EFI_DEVICE_ERROR;
}
-}
\ No newline at end of file
+}