X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=SecurityPkg%2FLibrary%2FTpm12CommandLib%2FTpm12PhysicalPresence.c;fp=SecurityPkg%2FLibrary%2FTpm12CommandLib%2FTpm12PhysicalPresence.c;h=d8d1998d4bb9dacbf75112f5320513fdd3e93dc7;hp=a730334c3f252117f8a5f3ebe0cc0ce229a6e563;hb=950a3bc788b5b101729b26aed3ff75fd2a64a570;hpb=6c59c7c2f488d7c9b951b5ead780f6102dafae8a diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c b/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c index a730334c3f..d8d1998d4b 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; }