From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Zhang, Chao B" <chao.b.zhang@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Long, Qin" <qin.long@intel.com>
Subject: Re: [PATCH] SecurityPkg: TPM12CommandLib: Add Response returnCode Check
Date: Wed, 31 Aug 2016 01:59:37 +0000 [thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50385F6041@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1472607998-21964-1-git-send-email-chao.b.zhang@intel.com>
Reviewed-by: Jiewen.yao@intel.com
> -----Original Message-----
> From: Zhang, Chao B
> Sent: Wednesday, August 31, 2016 9:47 AM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin <qin.long@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Zhang, Chao B <chao.b.zhang@intel.com>
> Subject: [PATCH] SecurityPkg: TPM12CommandLib: Add Response
> returnCode Check
>
> Check response return code before return from Tpm12Extend and
> Tpm12PhysicalPresence.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
> SecurityPkg/Library/Tpm12CommandLib/Tpm12Pcr.c | 5
> +++++
> .../Library/Tpm12CommandLib/Tpm12PhysicalPresence.c | 14
> +++++++++++++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12Pcr.c
> b/SecurityPkg/Library/Tpm12CommandLib/Tpm12Pcr.c
> index 321653f..18d5b96 100644
> --- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12Pcr.c
> +++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12Pcr.c
> @@ -74,6 +74,11 @@ Tpm12Extend (
> return Status;
> }
>
> + if (SwapBytes32(Response.Hdr.returnCode) != TPM_SUCCESS) {
> + DEBUG ((EFI_D_ERROR, "Tpm12Extend: Response Code error!
> 0x%08x\r\n", SwapBytes32(Response.Hdr.returnCode)));
> + return EFI_DEVICE_ERROR;
> + }
> +
> if (NewPcrValue != NULL) {
> CopyMem (NewPcrValue, &Response.TpmDigest, sizeof
> (*NewPcrValue));
> }
> diff --git
> a/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c
> b/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c
> index a730334..d8d1998 100644
> --- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c
> +++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c
> @@ -44,6 +44,7 @@ Tpm12PhysicalPresence (
> IN TPM_PHYSICAL_PRESENCE PhysicalPresence
> )
> {
> + EFI_STATUS Status;
> TPM_CMD_PHYSICAL_PRESENCE Command;
> TPM_RSP_COMMAND_HDR Response;
> UINT32 Length;
> @@ -56,5 +57,16 @@ Tpm12PhysicalPresence (
> Command.Hdr.ordinal = SwapBytes32
> (TSC_ORD_PhysicalPresence);
> Command.PhysicalPresence = SwapBytes16 (PhysicalPresence);
> Length = sizeof (Response);
> - return Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command,
> &Length, (UINT8 *)&Response);
> +
> + Status = Tpm12SubmitCommand (sizeof (Command), (UINT8
> *)&Command, &Length, (UINT8 *)&Response);
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + if (SwapBytes32(Response.returnCode) != TPM_SUCCESS) {
> + DEBUG ((EFI_D_ERROR, "Tpm12PhysicalPresence: Response Code
> error! 0x%08x\r\n", SwapBytes32(Response.returnCode)));
> + return EFI_DEVICE_ERROR;
> + }
> +
> + return EFI_SUCCESS;
> }
> --
> 1.9.5.msysgit.1
next prev parent reply other threads:[~2016-08-31 1:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 1:46 [PATCH] SecurityPkg: TPM12CommandLib: Add Response returnCode Check Zhang, Chao B
2016-08-31 1:59 ` Yao, Jiewen [this message]
2016-09-01 6:42 ` Long, Qin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=74D8A39837DF1E4DA445A8C0B3885C50385F6041@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox