X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=SecurityPkg%2FLibrary%2FTpm12CommandLib%2FTpm12NvStorage.c;h=e176b00f6bc8f78c2156864637e2fd9a736747aa;hp=7baafa8f55be2568cb3c4ab61e175be008b95393;hb=8b1331df8b303b296c85883935caf84561f54e37;hpb=fd338d8bd75034fd4fd35c9b326e9829c835c84f diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c index 7baafa8f55..e176b00f6b 100644 --- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c +++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c @@ -2,6 +2,7 @@ Implement TPM1.2 NV storage related command. Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
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 @@ -199,8 +200,9 @@ Tpm12NvWriteValue ( { EFI_STATUS Status; TPM_CMD_NV_WRITE_VALUE Command; + UINT32 CommandLength; TPM_RSP_COMMAND_HDR Response; - UINT32 Length; + UINT32 ResponseLength; if (DataSize > sizeof (Command.Data)) { return EFI_UNSUPPORTED; @@ -210,14 +212,15 @@ Tpm12NvWriteValue ( // send Tpm command TPM_ORD_NV_WriteValue // Command.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND); - Command.Hdr.paramSize = SwapBytes32 (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); Command.Offset = SwapBytes32 (Offset); Command.DataSize = SwapBytes32 (DataSize); CopyMem (Command.Data, Data, DataSize); - Length = sizeof (Response); - Status = Tpm12SubmitCommand (Command.Hdr.paramSize, (UINT8 *)&Command, &Length, (UINT8 *)&Response); + ResponseLength = sizeof (Response); + Status = Tpm12SubmitCommand (CommandLength, (UINT8 *)&Command, &ResponseLength, (UINT8 *)&Response); if (EFI_ERROR (Status)) { return Status; }