mirror of https://github.com/acidanthera/audk.git
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> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com> Reviewed-by: Long Qin <qin.long@intel.com>
This commit is contained in:
parent
6c59c7c2f4
commit
950a3bc788
|
@ -74,6 +74,11 @@ Tpm12Extend (
|
||||||
return Status;
|
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) {
|
if (NewPcrValue != NULL) {
|
||||||
CopyMem (NewPcrValue, &Response.TpmDigest, sizeof (*NewPcrValue));
|
CopyMem (NewPcrValue, &Response.TpmDigest, sizeof (*NewPcrValue));
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ Tpm12PhysicalPresence (
|
||||||
IN TPM_PHYSICAL_PRESENCE PhysicalPresence
|
IN TPM_PHYSICAL_PRESENCE PhysicalPresence
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
TPM_CMD_PHYSICAL_PRESENCE Command;
|
TPM_CMD_PHYSICAL_PRESENCE Command;
|
||||||
TPM_RSP_COMMAND_HDR Response;
|
TPM_RSP_COMMAND_HDR Response;
|
||||||
UINT32 Length;
|
UINT32 Length;
|
||||||
|
@ -56,5 +57,16 @@ Tpm12PhysicalPresence (
|
||||||
Command.Hdr.ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence);
|
Command.Hdr.ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence);
|
||||||
Command.PhysicalPresence = SwapBytes16 (PhysicalPresence);
|
Command.PhysicalPresence = SwapBytes16 (PhysicalPresence);
|
||||||
Length = sizeof (Response);
|
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue