summaryrefslogtreecommitdiff
path: root/firmware/lib/include
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-05-16 10:04:38 -0700
committerGerrit <chrome-bot@google.com>2012-05-17 09:21:50 -0700
commitfeac077c1d96d81f9c1c0b5253d0223b0a2d9448 (patch)
treebbc7c7346a37a9f78fd7d03e852a3df987ca180e /firmware/lib/include
parentf63ab219c5ee858a89ec0f33ad12536eff813bb2 (diff)
downloadvboot-feac077c1d96d81f9c1c0b5253d0223b0a2d9448.tar.gz
Add checksum to TPM RollbackSpace regions for FW and kernel.
BUG=chrome-os-partner:9707 TEST=manual make make runtests You can also test it by clearing the TPM, then manually looking at the TPM regions. In dev-mode, clear the regions and you'll see something like this: localhost ~ # tpmc read 1007 a 1 0 0 0 0 0 0 0 0 0 localhost ~ # tpmc read 1008 d 1 4c 57 52 47 0 0 0 0 0 0 0 0 localhost ~ # Go back to normal mode and reboot, and you'll see something like this: localhost ~ # tpmc read 1007 a 2 0 1 0 1 0 0 0 0 4f localhost ~ # tpmc read 1008 d 2 4c 57 52 47 1 0 1 0 0 0 0 55 localhost ~ # The important things are that the first number is now 2, instead of 1, and the last number is not zero (it's a checksum, so it'll vary depending on the other numbers, which will themselves vary according to the firmware and kernel versions). Change-Id: Ia4040311c2a4b2819792549b883377c8b6b89d48 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/22856 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware/lib/include')
-rw-r--r--firmware/lib/include/crc8.h13
-rw-r--r--firmware/lib/include/rollback_index.h10
2 files changed, 19 insertions, 4 deletions
diff --git a/firmware/lib/include/crc8.h b/firmware/lib/include/crc8.h
new file mode 100644
index 00000000..95bc9862
--- /dev/null
+++ b/firmware/lib/include/crc8.h
@@ -0,0 +1,13 @@
+/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Very simple 8-bit CRC function.
+ */
+#ifndef VBOOT_REFERENCE_CRC8_H_
+#define VBOOT_REFERENCE_CRC8_H_
+#include "sysincludes.h"
+
+uint8_t Crc8(const void* data, int len);
+
+#endif /* VBOOT_REFERENCE_CRC8_H_ */
diff --git a/firmware/lib/include/rollback_index.h b/firmware/lib/include/rollback_index.h
index 4d92bb71..4d847626 100644
--- a/firmware/lib/include/rollback_index.h
+++ b/firmware/lib/include/rollback_index.h
@@ -21,14 +21,15 @@
__pragma(pack(push, 1)) /* Support packing for MSVC. */
/* Kernel space - KERNEL_NV_INDEX, locked with physical presence. */
-#define ROLLBACK_SPACE_KERNEL_VERSION 1
+#define ROLLBACK_SPACE_KERNEL_VERSION 2
#define ROLLBACK_SPACE_KERNEL_UID 0x4752574C /* 'GRWL' */
typedef struct RollbackSpaceKernel {
uint8_t struct_version; /* Struct version, for backwards
* compatibility */
uint32_t uid; /* Unique ID to detect space redefinition */
uint32_t kernel_versions; /* Kernel versions */
- uint32_t reserved; /* Reserved for future expansion */
+ uint8_t reserved[3]; /* Reserved for future expansion */
+ uint8_t crc8; /* Checksum (v2 and later only) */
} __attribute__((packed)) RollbackSpaceKernel;
@@ -41,13 +42,14 @@ typedef struct RollbackSpaceKernel {
* from the backup copy. */
#define FLAG_KERNEL_SPACE_USE_BACKUP 0x02
-#define ROLLBACK_SPACE_FIRMWARE_VERSION 1
+#define ROLLBACK_SPACE_FIRMWARE_VERSION 2
/* Firmware space - FIRMWARE_NV_INDEX, locked with global lock. */
typedef struct RollbackSpaceFirmware {
uint8_t struct_version; /* Struct version, for backwards compatibility */
uint8_t flags; /* Flags (see FLAG_* above) */
uint32_t fw_versions; /* Firmware versions */
- uint32_t reserved; /* Reserved for future expansion */
+ uint8_t reserved[3]; /* Reserved for future expansion */
+ uint8_t crc8; /* Checksum (v2 and later only) */
} __attribute__((packed)) RollbackSpaceFirmware;
__pragma(pack(pop)) /* Support packing for MSVC. */