| Index: firmware/lib/vboot_kernel.c
|
| diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
|
| index 0420f2554f332ce123fe18f048266e2b552a0983..3280ba5e17c1bc35e3dc70eed423e2e2468e4b55 100644
|
| --- a/firmware/lib/vboot_kernel.c
|
| +++ b/firmware/lib/vboot_kernel.c
|
| @@ -152,16 +152,12 @@ int LoadKernel(LoadKernelParams* params) {
|
| params->bootloader_address = 0;
|
| params->bootloader_size = 0;
|
|
|
| - if (!is_dev) {
|
| - /* TODO: should use the TPM all the time; for now, only use when
|
| - * not in developer mode. */
|
| - /* Let the TPM know if we're in recovery mode */
|
| - if (is_rec) {
|
| - if (0 != RollbackKernelRecovery(is_dev ? 1 : 0)) {
|
| - VBDEBUG(("Error setting up TPM for recovery kernel\n"));
|
| - /* Ignore return code, since we need to boot recovery mode to
|
| - * fix the TPM. */
|
| - }
|
| + /* Let the TPM know if we're in recovery mode */
|
| + if (is_rec) {
|
| + if (0 != RollbackKernelRecovery(is_dev)) {
|
| + VBDEBUG(("Error setting up TPM for recovery kernel\n"));
|
| + /* Ignore return code, since we need to boot recovery mode to
|
| + * fix the TPM. */
|
| }
|
| }
|
|
|
| @@ -350,6 +346,8 @@ int LoadKernel(LoadKernelParams* params) {
|
| good_partition = gpt.current_kernel + 1;
|
| params->partition_number = gpt.current_kernel + 1;
|
| GetCurrentKernelUniqueGuid(&gpt, ¶ms->partition_guid);
|
| + /* TODO: GetCurrentKernelUniqueGuid() should take a destination size, or
|
| + * the dest should be a struct, so we know it's big enough. */
|
| params->bootloader_address = preamble->bootloader_address;
|
| params->bootloader_size = preamble->bootloader_size;
|
| /* If we're in developer or recovery mode, there's no rollback
|
| @@ -400,24 +398,20 @@ int LoadKernel(LoadKernelParams* params) {
|
| (uint16_t)lowest_kernel_version);
|
| if (0 != status) {
|
| VBDEBUG(("Error writing kernel versions to TPM.\n"));
|
| - return (status == TPM_E_MUST_REBOOT ?
|
| - LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
|
| + return (status == TPM_E_MUST_REBOOT ?
|
| + LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
|
| }
|
| }
|
| }
|
|
|
| - if (!is_dev) {
|
| - /* TODO: should use the TPM all the time; for now, only use when
|
| - * not in developer mode. */
|
| - /* Lock the kernel versions */
|
| - status = RollbackKernelLock();
|
| - if (0 != status) {
|
| - VBDEBUG(("Error locking kernel versions.\n"));
|
| - /* Don't reboot to recovery mode if we're already there */
|
| - if (!is_rec)
|
| - return (status == TPM_E_MUST_REBOOT ?
|
| - LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
|
| - }
|
| + /* Lock the kernel versions */
|
| + status = RollbackKernelLock();
|
| + if (0 != status) {
|
| + VBDEBUG(("Error locking kernel versions.\n"));
|
| + /* Don't reboot to recovery mode if we're already there */
|
| + if (!is_rec)
|
| + return (status == TPM_E_MUST_REBOOT ?
|
| + LOAD_KERNEL_REBOOT : LOAD_KERNEL_RECOVERY);
|
| }
|
|
|
| /* Success! */
|
|
|