Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: utility/tpm_init_temp_fix.c

Issue 3131007: Run self test unconditionally. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Temporary fix for running the TPM selftest and other essential 5 * Temporary fix for running the TPM selftest and other essential
6 * intializations that we forgot to put in the BIOS. 6 * intializations that we forgot to put in the BIOS.
7 * 7 *
8 * This works in a very specific situation: we assume TPM_Startup has been 8 * This works in a very specific situation: we assume TPM_Startup has been
9 * executed, but we don't know if the self test has run. On a ST TPM version 9 * executed, but we don't know if the self test has run. On a ST TPM version
10 * 1.2.7.0, GetCapabilities fails before the self test has run, so we use that 10 * 1.2.7.0, GetCapabilities fails before the self test has run, so we use that
(...skipping 11 matching lines...) Expand all
22 22
23 #include "tlcl.h" 23 #include "tlcl.h"
24 24
25 int main(int argc, char* argv[]) { 25 int main(int argc, char* argv[]) {
26 uint32_t result; 26 uint32_t result;
27 uint8_t disable, deactivated; 27 uint8_t disable, deactivated;
28 int pri = LOG_USER | LOG_ERR; 28 int pri = LOG_USER | LOG_ERR;
29 29
30 TlclLibInit(); 30 TlclLibInit();
31 TlclStartup(); /* ignore result */ 31 TlclStartup(); /* ignore result */
32
33 /* On the dogfood device, GetFlags causes an assertion failure because the
34 * device uses an older TPM which is not compatible with the current spec.
35 * We take advantage of this to cause the program to exit and not run the
36 * self test again (which takes 1 second).
37 */
32 result = TlclGetFlags(NULL, NULL, NULL); 38 result = TlclGetFlags(NULL, NULL, NULL);
39
40 result = TlclSelfTestFull();
33 if (result != 0) { 41 if (result != 0) {
34 result = TlclSelfTestFull(); 42 syslog(pri, "TPM selftest failed with code 0x%x\n", result);
35 if (result != 0) { 43 printf("fail\n");
36 syslog(pri, "TPM selftest failed with code 0x%x\n", result); 44 return 0;
37 printf("fail\n");
38 return 0;
39 }
40 } 45 }
46
41 /* Optional one-time enabling of TPM. */ 47 /* Optional one-time enabling of TPM. */
42 result = TlclAssertPhysicalPresence(); 48 result = TlclAssertPhysicalPresence();
43 if (result != 0) { 49 if (result != 0) {
44 syslog(pri, "TPM assertpp failed with code 0x%x\n", result); 50 syslog(pri, "TPM assertpp failed with code 0x%x\n", result);
45 printf("fail\n"); 51 printf("fail\n");
46 return 0; 52 return 0;
47 } 53 }
48 result = TlclGetFlags(&disable, &deactivated, NULL); 54 result = TlclGetFlags(&disable, &deactivated, NULL);
49 if (result != 0) { 55 if (result != 0) {
50 syslog(pri, "TPM getflags failed with code 0x%x\n", result); 56 syslog(pri, "TPM getflags failed with code 0x%x\n", result);
(...skipping 14 matching lines...) Expand all
65 syslog(pri, "TPM physical activate failed with code 0x%x\n", result); 71 syslog(pri, "TPM physical activate failed with code 0x%x\n", result);
66 printf("fail\n"); 72 printf("fail\n");
67 } else { 73 } else {
68 printf("reboot\n"); 74 printf("reboot\n");
69 } 75 }
70 return 0; /* needs reboot */ 76 return 0; /* needs reboot */
71 } 77 }
72 printf("success\n"); 78 printf("success\n");
73 return 0; 79 return 0;
74 } 80 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698