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

Side by Side Diff: utility/tpm_init_temp_fix.c

Issue 3077016: Small program to temporary fix TPM state until we can do this in the BIOS. (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 | « utility/Makefile ('k') | 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
(Empty)
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
3 * found in the LICENSE file.
4 *
5 * Temporary fix for running the TPM selftest and other essential
6 * intializations that we forgot to put in the BIOS.
7 *
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
10 * 1.2.7.0, GetCapabilities fails before the self test has run, so we use that
11 * to check if we need to run it.
12 *
13 * This also enables the TPM if it is disabled, and activates it if it is
14 * deactivated.
15 *
16 * Exit status: 0 for normal, 1 for errors (see syslog), 2 for normal but needs
17 * reboot.
18 */
19
20 #include "tlcl.h"
21
22 #include <syslog.h>
23
24 int main(int argc, char* argv[]) {
25 uint32_t result;
26 uint8_t disable, deactivated;
27 int pri = LOG_USER | LOG_ERR;
28
29 TlclLibInit();
30 TlclStartup(); /* ignore result */
31 result = TlclGetFlags(NULL, NULL, NULL);
32 if (result != 0) {
33 result = TlclSelfTestFull();
34 if (result != 0) {
35 syslog(pri, "TPM selftest failed with code 0x%x\n", result);
36 return 1;
37 }
38 }
39 /* Optional one-time enabling of TPM. */
40 result = TlclAssertPhysicalPresence();
41 if (result != 0) {
42 syslog(pri, "TPM assertpp failed with code 0x%x\n", result);
43 return 1;
44 }
45 result = TlclGetFlags(&disable, &deactivated, NULL);
46 if (result != 0) {
47 syslog(pri, "TPM getflags failed with code 0x%x\n", result);
48 return 1;
49 }
50 if (disable) {
51 result = TlclSetEnable();
52 if (result != 0) {
53 syslog(pri, "TPM physical enable failed with code 0x%x\n", result);
54 return 1;
55 }
56 }
57 if (deactivated) {
58 result = TlclSetDeactivated(0);
59 if (result != 0) {
60 syslog(pri, "TPM physical activate failed with code 0x%x\n", result);
61 return 1;
62 }
63 return 2; /* needs reboot */
64 }
65 return 0;
66 }
OLDNEW
« no previous file with comments | « utility/Makefile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698