| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 uint8_t disable; | 190 uint8_t disable; |
| 191 uint8_t deactivated; | 191 uint8_t deactivated; |
| 192 uint32_t result; | 192 uint32_t result; |
| 193 | 193 |
| 194 VBDEBUG(("TPM: SetupTPM(r%d, d%d)\n", recovery_mode, developer_mode)); | 194 VBDEBUG(("TPM: SetupTPM(r%d, d%d)\n", recovery_mode, developer_mode)); |
| 195 | 195 |
| 196 if (recovery_mode) | 196 if (recovery_mode) |
| 197 g_rollback_recovery_mode = 1; /* Global variables are usable in | 197 g_rollback_recovery_mode = 1; /* Global variables are usable in |
| 198 * recovery mode */ | 198 * recovery mode */ |
| 199 | 199 |
| 200 /* TODO: TlclLibInit() should be able to return failure */ | 200 RETURN_ON_FAILURE(TlclLibInit()); |
| 201 TlclLibInit(); | |
| 202 | 201 |
| 203 RETURN_ON_FAILURE(TlclStartup()); | 202 RETURN_ON_FAILURE(TlclStartup()); |
| 204 /* Use ContinueSelfTest rather than SelfTestFull(). It enables | 203 /* Use ContinueSelfTest rather than SelfTestFull(). It enables |
| 205 * access to the subset of TPM commands we need in the firmware, and | 204 * access to the subset of TPM commands we need in the firmware, and |
| 206 * allows the full self test to run in paralle with firmware | 205 * allows the full self test to run in paralle with firmware |
| 207 * startup. By the time we get to the OS, self test will have | 206 * startup. By the time we get to the OS, self test will have |
| 208 * completed. */ | 207 * completed. */ |
| 209 RETURN_ON_FAILURE(TlclContinueSelfTest()); | 208 RETURN_ON_FAILURE(TlclContinueSelfTest()); |
| 210 result = TlclAssertPhysicalPresence(); | 209 result = TlclAssertPhysicalPresence(); |
| 211 if (result != 0) { | 210 if (result != 0) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 328 } |
| 330 | 329 |
| 331 uint32_t RollbackKernelLock(void) { | 330 uint32_t RollbackKernelLock(void) { |
| 332 return TPM_SUCCESS; | 331 return TPM_SUCCESS; |
| 333 } | 332 } |
| 334 | 333 |
| 335 #else | 334 #else |
| 336 | 335 |
| 337 uint32_t RollbackS3Resume(void) { | 336 uint32_t RollbackS3Resume(void) { |
| 338 uint32_t result; | 337 uint32_t result; |
| 339 TlclLibInit(); | 338 RETURN_ON_FAILURE(TlclLibInit()); |
| 340 result = TlclResume(); | 339 result = TlclResume(); |
| 341 if (result == TPM_E_INVALID_POSTINIT) { | 340 if (result == TPM_E_INVALID_POSTINIT) { |
| 342 /* We're on a platform where the TPM maintains power in S3, so | 341 /* We're on a platform where the TPM maintains power in S3, so |
| 343 it's already initialized. */ | 342 it's already initialized. */ |
| 344 return TPM_SUCCESS; | 343 return TPM_SUCCESS; |
| 345 } | 344 } |
| 346 return result; | 345 return result; |
| 347 } | 346 } |
| 348 | 347 |
| 349 | 348 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 438 |
| 440 uint32_t RollbackKernelLock(void) { | 439 uint32_t RollbackKernelLock(void) { |
| 441 if (g_rollback_recovery_mode) { | 440 if (g_rollback_recovery_mode) { |
| 442 return TPM_SUCCESS; | 441 return TPM_SUCCESS; |
| 443 } else { | 442 } else { |
| 444 return TlclLockPhysicalPresence(); | 443 return TlclLockPhysicalPresence(); |
| 445 } | 444 } |
| 446 } | 445 } |
| 447 | 446 |
| 448 #endif // DISABLE_ROLLBACK_TPM | 447 #endif // DISABLE_ROLLBACK_TPM |
| OLD | NEW |