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

Unified Diff: firmware/lib/rollback_index.c

Issue 3010019: TPM cleanup (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: this e-mail Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | firmware/lib/tpm_lite/tlcl.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/rollback_index.c
diff --git a/firmware/lib/rollback_index.c b/firmware/lib/rollback_index.c
index 312950e1a2ace9f7bccd911718ff0e6a37fa4393..ba1c3e982e801eb81ecd0b73e884475cf90dee07 100644
--- a/firmware/lib/rollback_index.c
+++ b/firmware/lib/rollback_index.c
@@ -30,7 +30,7 @@ uint32_t TPMClearAndReenable(void) {
RETURN_ON_FAILURE(TlclForceClear());
RETURN_ON_FAILURE(TlclSetEnable());
RETURN_ON_FAILURE(TlclSetDeactivated(0));
-
+
return TPM_SUCCESS;
}
@@ -99,15 +99,12 @@ static uint32_t InitializeSpaces(void) {
uint32_t zero = 0;
uint32_t firmware_perm = TPM_NV_PER_GLOBALLOCK | TPM_NV_PER_PPWRITE;
uint8_t nvlocked = 0;
- uint32_t i;
VBDEBUG(("TPM: Initializing spaces\n"));
-#ifdef FORCE_CLEAR_ON_INIT
/* Force the TPM clear, in case it previously had an owner, so that we can
* redefine the NVRAM spaces. */
RETURN_ON_FAILURE(TPMClearAndReenable());
-#endif
/* The TPM will not enforce the NV authorization restrictions until the
* execution of a TPM_NV_DefineSpace with the handle of TPM_NV_INDEX_LOCK.
@@ -119,12 +116,6 @@ static uint32_t InitializeSpaces(void) {
RETURN_ON_FAILURE(TlclSetNvLocked());
}
- /* If the spaces were previously defined, we need to undefine them before we
- * can redefine them. Undefine by setting size=0. Ignore these return codes,
- * since they fail if the spaces aren't actually defined? */
- for (i = FIRST_ROLLBACK_NV_INDEX; i <= LAST_ROLLBACK_NV_INDEX; i++)
- SafeDefineSpace(i, firmware_perm, 0);
-
RETURN_ON_FAILURE(SafeDefineSpace(FIRMWARE_VERSIONS_NV_INDEX,
firmware_perm, sizeof(uint32_t)));
RETURN_ON_FAILURE(SafeWrite(FIRMWARE_VERSIONS_NV_INDEX,
@@ -338,9 +329,15 @@ __pragma(warning (disable: 4100))
#ifdef DISABLE_ROLLBACK_TPM
-/* Dummy implementations which don't call into the tpm_lite library */
+/* Dummy implementations which don't support TPM rollback protection */
uint32_t RollbackFirmwareSetup(int developer_mode) {
+#ifndef CHROMEOS_ENVIRONMENT
+ /* Initialize the TPM, but ignore return codes. In ChromeOS
+ * environment, don't even talk to the TPM. */
+ TlclLibInit();
+ TlclStartup();
+#endif
return TPM_SUCCESS;
}
@@ -358,6 +355,12 @@ uint32_t RollbackFirmwareLock(void) {
}
uint32_t RollbackKernelRecovery(int developer_mode) {
+#ifndef CHROMEOS_ENVIRONMENT
+ /* Initialize the TPM, but ignore return codes. In ChromeOS
+ * environment, don't even talk to the TPM. */
+ TlclLibInit();
+ TlclStartup();
+#endif
return TPM_SUCCESS;
}
« no previous file with comments | « no previous file | firmware/lib/tpm_lite/tlcl.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698