void TestFailureMode(Tpm2 tpm, TestContext testCtx) { tpm._GetUnderlyingDevice().TestFailureMode(); tpm._ExpectError(TpmRc.Failure) .SelfTest(1); TpmRc testResult = TpmRc.None; byte[] outData = tpm.GetTestResult(out testResult); testCtx.Assert("TestResult", testResult == TpmRc.Failure); testCtx.Assert("OutData", outData != null && outData.Length > 0); // Make sure that selected capabilities can be retrieved even when TPM is in failure mode Tpm2.GetProperty(tpm, Pt.Manufacturer); Tpm2.GetProperty(tpm, Pt.VendorString1); Tpm2.GetProperty(tpm, Pt.VendorTpmType); Tpm2.GetProperty(tpm, Pt.FirmwareVersion1); // Check if other commands fail as expected while in failure mode. tpm._ExpectError(TpmRc.Failure) .GetRandom(8); // Bring TPM back to normal. tpm._GetUnderlyingDevice().PowerCycle(); tpm.Startup(Su.Clear); } // TestFailureMode