OLD | NEW |
---|---|
1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 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 loading a kernel from disk. | 5 * Functions for loading a kernel from disk. |
6 * (Firmware portion) | 6 * (Firmware portion) |
7 */ | 7 */ |
8 | 8 |
9 #include "vboot_kernel.h" | 9 #include "vboot_kernel.h" |
10 | 10 |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
590 /* Write and free GPT data */ | 590 /* Write and free GPT data */ |
591 WriteAndFreeGptData(&gpt); | 591 WriteAndFreeGptData(&gpt); |
592 | 592 |
593 /* Handle finding a good partition */ | 593 /* Handle finding a good partition */ |
594 if (good_partition >= 0) { | 594 if (good_partition >= 0) { |
595 VBDEBUG(("Good_partition >= 0\n")); | 595 VBDEBUG(("Good_partition >= 0\n")); |
596 if (shcall) | 596 if (shcall) |
597 shcall->check_result = VBSD_LKC_CHECK_GOOD_PARTITION; | 597 shcall->check_result = VBSD_LKC_CHECK_GOOD_PARTITION; |
598 | 598 |
599 /* See if we need to update the TPM */ | 599 /* See if we need to update the TPM */ |
600 if (kBootRecovery != boot_mode && good_partition_key_block_valid) { | 600 if ((kBootNormal == boot_mode) && |
601 /* We only update the TPM in normal and developer boot modes. In | 601 !((1 == shared->firmware_index) && (shared->flags & VBSD_FWB_TRIED))) { |
Will Drewry
2011/04/17 17:53:18
What case will shared->firmware_index==1 without V
| |
602 * developer mode, we only advanced lowest_version for kernels with valid | 602 /* We only update the TPM in normal mode. We don't advance the |
603 * key blocks, and didn't count self-signed key blocks. In recovery | 603 * TPM if we're trying a new firmware B, because that firmware |
604 * mode, the TPM stays PP-unlocked, so anything we write gets blown away | 604 * may have a key change and roll forward the TPM too soon. */ |
605 * by the firmware when we go back to normal mode. */ | 605 VBDEBUG(("Checking if TPM kernel version needs advancing\n")); |
606 VBDEBUG(("Boot_flags = not recovery\n")); | |
607 | 606 |
608 if ((lowest_version > tpm_version) && | 607 if ((lowest_version > tpm_version) && |
Will Drewry
2011/04/17 17:53:18
Since we only increment when the lowest_version of
gauravsh
2011/04/17 19:32:24
Belated comment: I'd really like to see a check fo
| |
609 (lowest_version != LOWEST_TPM_VERSION)) { | 608 (lowest_version != LOWEST_TPM_VERSION)) { |
610 status = RollbackKernelWrite((uint32_t)lowest_version); | 609 status = RollbackKernelWrite((uint32_t)lowest_version); |
611 if (0 != status) { | 610 if (0 != status) { |
612 VBDEBUG(("Error writing kernel versions to TPM.\n")); | 611 VBDEBUG(("Error writing kernel versions to TPM.\n")); |
613 if (status == TPM_E_MUST_REBOOT) | 612 if (status == TPM_E_MUST_REBOOT) |
614 retval = LOAD_KERNEL_REBOOT; | 613 retval = LOAD_KERNEL_REBOOT; |
615 else | 614 else |
616 recovery = VBNV_RECOVERY_RW_TPM_ERROR; | 615 recovery = VBNV_RECOVERY_RW_TPM_ERROR; |
617 goto LoadKernelExit; | 616 goto LoadKernelExit; |
618 } | 617 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 | 665 |
667 /* Save timer values */ | 666 /* Save timer values */ |
668 shared->timer_load_kernel_enter = timer_enter; | 667 shared->timer_load_kernel_enter = timer_enter; |
669 shared->timer_load_kernel_exit = VbGetTimer(); | 668 shared->timer_load_kernel_exit = VbGetTimer(); |
670 /* Store how much shared data we used, if any */ | 669 /* Store how much shared data we used, if any */ |
671 params->shared_data_size = shared->data_used; | 670 params->shared_data_size = shared->data_used; |
672 } | 671 } |
673 | 672 |
674 return retval; | 673 return retval; |
675 } | 674 } |
OLD | NEW |