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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 rsf.fw_versions = version; | 373 rsf.fw_versions = version; |
374 return WriteSpaceFirmware(&rsf); | 374 return WriteSpaceFirmware(&rsf); |
375 } | 375 } |
376 | 376 |
377 uint32_t RollbackFirmwareLock(void) { | 377 uint32_t RollbackFirmwareLock(void) { |
378 return TlclSetGlobalLock(); | 378 return TlclSetGlobalLock(); |
379 } | 379 } |
380 | 380 |
381 uint32_t RollbackKernelRecovery(int developer_mode) { | 381 uint32_t RollbackKernelRecovery(int developer_mode) { |
382 RollbackSpaceFirmware rsf; | 382 RollbackSpaceFirmware rsf; |
383 uint32_t result = SetupTPM(1, developer_mode, &rsf); | 383 |
384 /* In recovery mode we ignore TPM malfunctions or corruptions, and leave the | 384 /* In recovery mode we ignore TPM malfunctions or corruptions, and * |
385 * TPM completely unlocked if and only if the dev mode switch is ON. The | 385 * leave the TPM complelely unlocked; we call neither |
386 * recovery kernel will fix the TPM (if needed) and lock it ASAP. We leave | 386 * TlclSetGlobalLock() nor TlclLockPhysicalPresence(). The recovery |
| 387 * kernel will fix the TPM (if needed) and lock it ASAP. We leave |
387 * Physical Presence on in either case. */ | 388 * Physical Presence on in either case. */ |
388 if (!developer_mode) { | 389 return SetupTPM(1, developer_mode, &rsf); |
389 RETURN_ON_FAILURE(TlclSetGlobalLock()); | |
390 } | |
391 /* We still return the result of SetupTPM even though we expect the caller to | |
392 * ignore it. It's useful in unit testing. */ | |
393 return result; | |
394 } | 390 } |
395 | 391 |
396 uint32_t RollbackKernelRead(uint32_t* version) { | 392 uint32_t RollbackKernelRead(uint32_t* version) { |
397 if (g_rollback_recovery_mode) { | 393 if (g_rollback_recovery_mode) { |
398 *version = 0; | 394 *version = 0; |
399 } else { | 395 } else { |
400 RollbackSpaceKernel rsk; | 396 RollbackSpaceKernel rsk; |
401 uint32_t perms; | 397 uint32_t perms; |
402 | 398 |
403 /* Read the kernel space and verify its permissions. If the kernel | 399 /* Read the kernel space and verify its permissions. If the kernel |
(...skipping 28 matching lines...) Expand all Loading... |
432 | 428 |
433 uint32_t RollbackKernelLock(void) { | 429 uint32_t RollbackKernelLock(void) { |
434 if (g_rollback_recovery_mode) { | 430 if (g_rollback_recovery_mode) { |
435 return TPM_SUCCESS; | 431 return TPM_SUCCESS; |
436 } else { | 432 } else { |
437 return TlclLockPhysicalPresence(); | 433 return TlclLockPhysicalPresence(); |
438 } | 434 } |
439 } | 435 } |
440 | 436 |
441 #endif // DISABLE_ROLLBACK_TPM | 437 #endif // DISABLE_ROLLBACK_TPM |
OLD | NEW |