summaryrefslogtreecommitdiff
path: root/utility
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-08-22 11:46:33 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-27 04:33:48 +0000
commit4539726499d6ee43077918eee3e1768040b45983 (patch)
tree1285c4f5f13422ece5be1f3a43d3cc9fedf81dd1 /utility
parentc39b1b08124431ce92036b2ac0aedce45fcfa7ce (diff)
downloadvboot-4539726499d6ee43077918eee3e1768040b45983.tar.gz
vboot: remove 9-year old tpm_init_temp_fix workaround
From the original CL:3077016: "Small program to temporarily fix TPM state until we can do this in the BIOS." BUG=b:124141368 TEST=emerge with USE=cros_host and USE=-cros_host BRANCH=none Change-Id: Icc90bc2b3ee76b66b803af4059dafbe5e1d52daf Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1763969 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1763970 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'utility')
-rw-r--r--utility/tpm_init_temp_fix.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/utility/tpm_init_temp_fix.c b/utility/tpm_init_temp_fix.c
deleted file mode 100644
index 8964bee4..00000000
--- a/utility/tpm_init_temp_fix.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Temporary fix for running the TPM selftest and other essential
- * intializations that we forgot to put in the BIOS.
- *
- * This works in a very specific situation: we assume TPM_Startup has been
- * executed, but we don't know if the self test has run. On a ST TPM version
- * 1.2.7.0, GetCapabilities fails before the self test has run, so we use that
- * to check if we need to run it.
- *
- * This also enables the TPM if it is disabled, and activates it if it is
- * deactivated.
- *
- * Exit status always 0. Prints "reboot" to request reboot, "fail" for errors,
- * "success" when everything worked.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <syslog.h>
-
-#include "tlcl.h"
-
-int main(int argc, char* argv[]) {
- uint32_t result;
- uint8_t disable, deactivated;
- int pri = LOG_USER | LOG_ERR;
-
- 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) {
- 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) {
- syslog(pri, "TPM assertpp failed with code 0x%x\n", result);
- printf("fail\n");
- return 0;
- }
- result = TlclGetFlags(&disable, &deactivated, NULL);
- if (result != 0) {
- syslog(pri, "TPM getflags failed with code 0x%x\n", result);
- printf("fail\n");
- return 0;
- }
- if (disable) {
- result = TlclSetEnable();
- if (result != 0) {
- syslog(pri, "TPM physical enable failed with code 0x%x\n", result);
- printf("fail\n");
- return 0;
- }
- }
- if (deactivated) {
- result = TlclSetDeactivated(0);
- if (result != 0) {
- syslog(pri, "TPM physical activate failed with code 0x%x\n", result);
- printf("fail\n");
- } else {
- printf("reboot\n");
- }
- return 0; /* needs reboot */
- }
- printf("success\n");
- return 0;
-}