| 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 definitely don't want to |
| 188 * startup. By the time we get to the OS, self test will have | 188 * call it here. For TPMs in the intersection of these two sets, we're |
| 189 * completed. */ | 189 * screwed. (In other words: TPMs that require manually starting the |
| 190 * self-test AND block will have poor performance until we split |
| 191 * TlclSendReceive() into Send() and Receive(), and have a state machine to |
| 192 * control setup.) |
| 193 * |
| 194 * This comment is likely to become obsolete in the near future, so don't |
| 195 * trust it. It may have not been updated. |
| 196 */ |
| 197 #ifdef TPM_MANUAL_SELFTEST |
| 198 #ifdef TPM_BLOCKING_CONTINUESELFTEST |
| 199 #warning "lousy TPM!" |
| 200 #endif |
| 190 RETURN_ON_FAILURE(TlclContinueSelfTest()); | 201 RETURN_ON_FAILURE(TlclContinueSelfTest()); |
| 202 #endif |
| 191 result = TlclAssertPhysicalPresence(); | 203 result = TlclAssertPhysicalPresence(); |
| 192 if (result != 0) { | 204 if (result != 0) { |
| 193 /* It is possible that the TPM was delivered with the physical presence | 205 /* It is possible that the TPM was delivered with the physical presence |
| 194 * command disabled. This tries enabling it, then tries asserting PP | 206 * command disabled. This tries enabling it, then tries asserting PP |
| 195 * again. | 207 * again. |
| 196 */ | 208 */ |
| 197 RETURN_ON_FAILURE(TlclPhysicalPresenceCMDEnable()); | 209 RETURN_ON_FAILURE(TlclPhysicalPresenceCMDEnable()); |
| 198 RETURN_ON_FAILURE(TlclAssertPhysicalPresence()); | 210 RETURN_ON_FAILURE(TlclAssertPhysicalPresence()); |
| 199 } | 211 } |
| 200 | 212 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 419 |
| 408 uint32_t RollbackKernelLock(void) { | 420 uint32_t RollbackKernelLock(void) { |
| 409 if (g_rollback_recovery_mode) { | 421 if (g_rollback_recovery_mode) { |
| 410 return TPM_SUCCESS; | 422 return TPM_SUCCESS; |
| 411 } else { | 423 } else { |
| 412 return TlclLockPhysicalPresence(); | 424 return TlclLockPhysicalPresence(); |
| 413 } | 425 } |
| 414 } | 426 } |
| 415 | 427 |
| 416 #endif // DISABLE_ROLLBACK_TPM | 428 #endif // DISABLE_ROLLBACK_TPM |
| OLD | NEW |