Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2010-2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010-2011 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 * Functions for querying, manipulating and locking rollback indices | 5 * Functions for querying, manipulating and locking rollback indices |
| 6 * stored in the TPM NVRAM. | 6 * stored in the TPM NVRAM. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "rollback_index.h" | 9 #include "rollback_index.h" |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 | 175 |
| 176 VBDEBUG(("TPM: SetupTPM(r%d, d%d)\n", recovery_mode, developer_mode)); | 176 VBDEBUG(("TPM: SetupTPM(r%d, d%d)\n", recovery_mode, developer_mode)); |
| 177 | 177 |
| 178 if (recovery_mode) | 178 if (recovery_mode) |
| 179 g_rollback_recovery_mode = 1; /* Global variables are usable in | 179 g_rollback_recovery_mode = 1; /* Global variables are usable in |
| 180 * recovery mode */ | 180 * recovery mode */ |
| 181 | 181 |
| 182 RETURN_ON_FAILURE(TlclLibInit()); | 182 RETURN_ON_FAILURE(TlclLibInit()); |
| 183 | 183 |
| 184 RETURN_ON_FAILURE(TlclStartup()); | 184 RETURN_ON_FAILURE(TlclStartup()); |
| 185 /* Use ContinueSelfTest rather than SelfTestFull(). It enables | 185 /* Some TPMs start the self test automatically at power on. In that case we |
| 186 * access to the subset of TPM commands we need in the firmware, and | 186 * don't need to call ContinueSelfTest. On some (other) TPMs, |
| 187 * allows the full self test to run in paralle with firmware | 187 * ContinueSelfTest may block. In that case, we don't want to call it here. |
| 188 * startup. By the time we get to the OS, self test will have | 188 * For TPMs in the intersection of these two sets, we're screwed. |
|
Randall Spangler
2011/03/16 19:23:06
"we're screwed" --> "TPMs that require manually st
Luigi Semenzato
2011/03/16 20:51:59
OK, but I thought mine was more concise and to the
| |
| 189 * completed. */ | 189 */ |
| 190 #ifdef TPM_MANUAL_SELFTEST | |
| 191 #ifdef TPM_BLOCKING_CONTINUESELFTEST | |
| 192 #warning "lousy TPM!" | |
| 193 #endif | |
| 190 RETURN_ON_FAILURE(TlclContinueSelfTest()); | 194 RETURN_ON_FAILURE(TlclContinueSelfTest()); |
| 195 #endif | |
| 191 result = TlclAssertPhysicalPresence(); | 196 result = TlclAssertPhysicalPresence(); |
| 192 if (result != 0) { | 197 if (result != 0) { |
| 193 /* It is possible that the TPM was delivered with the physical presence | 198 /* It is possible that the TPM was delivered with the physical presence |
| 194 * command disabled. This tries enabling it, then tries asserting PP | 199 * command disabled. This tries enabling it, then tries asserting PP |
| 195 * again. | 200 * again. |
| 196 */ | 201 */ |
| 197 RETURN_ON_FAILURE(TlclPhysicalPresenceCMDEnable()); | 202 RETURN_ON_FAILURE(TlclPhysicalPresenceCMDEnable()); |
| 198 RETURN_ON_FAILURE(TlclAssertPhysicalPresence()); | 203 RETURN_ON_FAILURE(TlclAssertPhysicalPresence()); |
| 199 } | 204 } |
| 200 | 205 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 | 412 |
| 408 uint32_t RollbackKernelLock(void) { | 413 uint32_t RollbackKernelLock(void) { |
| 409 if (g_rollback_recovery_mode) { | 414 if (g_rollback_recovery_mode) { |
| 410 return TPM_SUCCESS; | 415 return TPM_SUCCESS; |
| 411 } else { | 416 } else { |
| 412 return TlclLockPhysicalPresence(); | 417 return TlclLockPhysicalPresence(); |
| 413 } | 418 } |
| 414 } | 419 } |
| 415 | 420 |
| 416 #endif // DISABLE_ROLLBACK_TPM | 421 #endif // DISABLE_ROLLBACK_TPM |
| OLD | NEW |