Enable TPM in developer mode again.
Also fix a few comments, and make extra debugging work when compiled
in firmware.
BUG=none
TEST=make && make runtests; all pass
Review URL: http://codereview.chromium.org/3007036
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 0420f25..3280ba5 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -152,16 +152,12 @@
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 @@
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 @@
(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! */