summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang, Chao B <chao.b.zhang@intel.com>2018-03-20 23:10:26 +0800
committerZhang, Chao B <chao.b.zhang@intel.com>2018-03-21 16:46:25 +0800
commit2e8ea3f20bedfe09b32dbf17b29c561391b6dcae (patch)
treeee310da9bcdfb18025df6988699f7a8f517b87fe
parentcf54069a3662d3895629e37cfc677a0c14a6b641 (diff)
downloadedk2-2e8ea3f20bedfe09b32dbf17b29c561391b6dcae.tar.gz
edk2-2e8ea3f20bedfe09b32dbf17b29c561391b6dcae.tar.bz2
edk2-2e8ea3f20bedfe09b32dbf17b29c561391b6dcae.zip
SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error
TPM12 command lib doesn't convert Response Size before using. Add logic to fix the issue. Cc: Long Qin <qin.long@intel.com> Cc: Yao Jiewen <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Long Qin <qin.long@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com> (cherry picked from commit 28892d768be4ad731d754fb13de58368d524fd14)
-rw-r--r--SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c b/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c
index c6eb9e1050..29d7a13edb 100644
--- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c
+++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12GetCapability.c
@@ -1,7 +1,7 @@
/** @file
Implement TPM1.2 Get Capabilities related commands.
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved. <BR>
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved. <BR>
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
@@ -85,7 +85,7 @@ Tpm12GetCapabilityFlagPermanent (
}
ZeroMem (TpmPermanentFlags, sizeof (*TpmPermanentFlags));
- CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), Response.ResponseSize));
+ CopyMem (TpmPermanentFlags, &Response.Flags, MIN (sizeof (*TpmPermanentFlags), SwapBytes32(Response.ResponseSize)));
return Status;
}
@@ -131,7 +131,7 @@ Tpm12GetCapabilityFlagVolatile (
}
ZeroMem (VolatileFlags, sizeof (*VolatileFlags));
- CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), Response.ResponseSize));
+ CopyMem (VolatileFlags, &Response.Flags, MIN (sizeof (*VolatileFlags), SwapBytes32(Response.ResponseSize)));
return Status;
}