From d7bff87a745dd378aebec5bc6e78039426044b3a Mon Sep 17 00:00:00 2001 From: Luigi Semenzato Date: Thu, 12 Aug 2010 09:26:50 -0700 Subject: Run self test unconditionally. Review URL: http://codereview.chromium.org/3131007 --- utility/tpm_init_temp_fix.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'utility/tpm_init_temp_fix.c') diff --git a/utility/tpm_init_temp_fix.c b/utility/tpm_init_temp_fix.c index b6418133..d3004a62 100644 --- a/utility/tpm_init_temp_fix.c +++ b/utility/tpm_init_temp_fix.c @@ -29,15 +29,21 @@ int main(int argc, char* argv[]) { TlclLibInit(); TlclStartup(); /* ignore result */ + + /* On the dogfood device, GetFlags causes an assertion failure because the + * device uses an older TPM which is not compatible with the current spec. + * We take advantage of this to cause the program to exit and not run the + * self test again (which takes 1 second). + */ result = TlclGetFlags(NULL, NULL, NULL); + + result = TlclSelfTestFull(); if (result != 0) { - result = TlclSelfTestFull(); - if (result != 0) { - syslog(pri, "TPM selftest failed with code 0x%x\n", result); - printf("fail\n"); - return 0; - } + syslog(pri, "TPM selftest failed with code 0x%x\n", result); + printf("fail\n"); + return 0; } + /* Optional one-time enabling of TPM. */ result = TlclAssertPhysicalPresence(); if (result != 0) { -- cgit v1.2.1