| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 #ifdef DISABLE_ROLLBACK_TPM | 276 #ifdef DISABLE_ROLLBACK_TPM |
| 277 | 277 |
| 278 /* Dummy implementations which don't support TPM rollback protection */ | 278 /* Dummy implementations which don't support TPM rollback protection */ |
| 279 | 279 |
| 280 uint32_t RollbackS3Resume(void) { | 280 uint32_t RollbackS3Resume(void) { |
| 281 #ifndef CHROMEOS_ENVIRONMENT | 281 #ifndef CHROMEOS_ENVIRONMENT |
| 282 /* Initialize the TPM, but ignore return codes. In ChromeOS | 282 /* Initialize the TPM, but ignore return codes. In ChromeOS |
| 283 * environment, don't even talk to the TPM. */ | 283 * environment, don't even talk to the TPM. */ |
| 284 TlclLibInit(); | 284 TlclLibInit(); |
| 285 TlclResume(); | 285 TlclResume(); |
| 286 TlclContinueSelfTest(); | |
| 287 #endif | 286 #endif |
| 288 return TPM_SUCCESS; | 287 return TPM_SUCCESS; |
| 289 } | 288 } |
| 290 | 289 |
| 291 uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) { | 290 uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) { |
| 292 #ifndef CHROMEOS_ENVIRONMENT | 291 #ifndef CHROMEOS_ENVIRONMENT |
| 293 /* Initializes the TPM, but ignores return codes. In ChromeOS | 292 /* Initializes the TPM, but ignores return codes. In ChromeOS |
| 294 * environment, doesn't even talk to the TPM. */ | 293 * environment, doesn't even talk to the TPM. */ |
| 295 TlclLibInit(); | 294 TlclLibInit(); |
| 296 TlclStartup(); | 295 TlclStartup(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 333 } |
| 335 | 334 |
| 336 #else | 335 #else |
| 337 | 336 |
| 338 uint32_t RollbackS3Resume(void) { | 337 uint32_t RollbackS3Resume(void) { |
| 339 uint32_t result; | 338 uint32_t result; |
| 340 TlclLibInit(); | 339 TlclLibInit(); |
| 341 result = TlclResume(); | 340 result = TlclResume(); |
| 342 if (result == TPM_E_INVALID_POSTINIT) { | 341 if (result == TPM_E_INVALID_POSTINIT) { |
| 343 /* We're on a platform where the TPM maintains power in S3, so | 342 /* We're on a platform where the TPM maintains power in S3, so |
| 344 it's already initialized. No need for a self-test. */ | 343 it's already initialized. */ |
| 345 return TPM_SUCCESS; | 344 return TPM_SUCCESS; |
| 346 } | 345 } |
| 347 if (result != TPM_SUCCESS) { | 346 return result; |
| 348 return result; | |
| 349 } | |
| 350 | |
| 351 RETURN_ON_FAILURE(TlclContinueSelfTest()); | |
| 352 | |
| 353 return TPM_SUCCESS; | |
| 354 } | 347 } |
| 355 | 348 |
| 356 | 349 |
| 357 uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) { | 350 uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) { |
| 358 RollbackSpaceFirmware rsf; | 351 RollbackSpaceFirmware rsf; |
| 359 uint8_t out_digest[20]; /* For PCR extend output */ | 352 uint8_t out_digest[20]; /* For PCR extend output */ |
| 360 | 353 |
| 361 RETURN_ON_FAILURE(SetupTPM(0, developer_mode, &rsf)); | 354 RETURN_ON_FAILURE(SetupTPM(0, developer_mode, &rsf)); |
| 362 *version = rsf.fw_versions; | 355 *version = rsf.fw_versions; |
| 363 VBDEBUG(("TPM: RollbackFirmwareSetup %x\n", (int)rsf.fw_versions)); | 356 VBDEBUG(("TPM: RollbackFirmwareSetup %x\n", (int)rsf.fw_versions)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 439 |
| 447 uint32_t RollbackKernelLock(void) { | 440 uint32_t RollbackKernelLock(void) { |
| 448 if (g_rollback_recovery_mode) { | 441 if (g_rollback_recovery_mode) { |
| 449 return TPM_SUCCESS; | 442 return TPM_SUCCESS; |
| 450 } else { | 443 } else { |
| 451 return TlclLockPhysicalPresence(); | 444 return TlclLockPhysicalPresence(); |
| 452 } | 445 } |
| 453 } | 446 } |
| 454 | 447 |
| 455 #endif // DISABLE_ROLLBACK_TPM | 448 #endif // DISABLE_ROLLBACK_TPM |
| OLD | NEW |