Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: firmware/lib/rollback_index.c

Issue 6685075: Add TPM version checking (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « firmware/lib/include/rollback_index.h ('k') | firmware/lib/vboot_firmware.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/rollback_index.c
diff --git a/firmware/lib/rollback_index.c b/firmware/lib/rollback_index.c
index 9442b7792c3004483475d9465f8ae01a4a4a264a..697bd0e79645529e1bf01b3bf4447ff795a0451b 100644
--- a/firmware/lib/rollback_index.c
+++ b/firmware/lib/rollback_index.c
@@ -301,6 +301,11 @@ uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) {
return TPM_SUCCESS;
}
+uint32_t RollbackFirmwareRead(uint32_t* version) {
+ *version = 0;
+ return TPM_SUCCESS;
+}
+
uint32_t RollbackFirmwareWrite(uint32_t version) {
return TPM_SUCCESS;
}
@@ -357,6 +362,16 @@ uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) {
return TPM_SUCCESS;
}
+uint32_t RollbackFirmwareRead(uint32_t* version) {
+ RollbackSpaceFirmware rsf;
+
+ RETURN_ON_FAILURE(ReadSpaceFirmware(&rsf));
+ VBDEBUG(("TPM: RollbackFirmwareRead %x --> %x\n", (int)rsf.fw_versions,
+ (int)version));
+ *version = rsf.fw_versions;
+ VBDEBUG(("TPM: RollbackFirmwareRead %x\n", (int)rsf.fw_versions));
+ return TPM_SUCCESS;
+}
uint32_t RollbackFirmwareWrite(uint32_t version) {
RollbackSpaceFirmware rsf;
@@ -390,40 +405,32 @@ uint32_t RollbackKernelRecovery(int developer_mode) {
}
uint32_t RollbackKernelRead(uint32_t* version) {
- if (g_rollback_recovery_mode) {
- *version = 0;
- } else {
- RollbackSpaceKernel rsk;
- uint32_t perms;
-
- /* Read the kernel space and verify its permissions. If the kernel
- * space has the wrong permission, or it doesn't contain the right
- * identifier, we give up. This will need to be fixed by the
- * recovery kernel. We have to worry about this because at any time
- * (even with PP turned off) the TPM owner can remove and redefine a
- * PP-protected space (but not write to it). */
- RETURN_ON_FAILURE(ReadSpaceKernel(&rsk));
- RETURN_ON_FAILURE(TlclGetPermissions(KERNEL_NV_INDEX, &perms));
- if (TPM_NV_PER_PPWRITE != perms || ROLLBACK_SPACE_KERNEL_UID != rsk.uid)
- return TPM_E_CORRUPTED_STATE;
-
- *version = rsk.kernel_versions;
- VBDEBUG(("TPM: RollbackKernelRead %x\n", (int)rsk.kernel_versions));
- }
+ RollbackSpaceKernel rsk;
+ uint32_t perms;
+
+ /* Read the kernel space and verify its permissions. If the kernel
+ * space has the wrong permission, or it doesn't contain the right
+ * identifier, we give up. This will need to be fixed by the
+ * recovery kernel. We have to worry about this because at any time
+ * (even with PP turned off) the TPM owner can remove and redefine a
+ * PP-protected space (but not write to it). */
+ RETURN_ON_FAILURE(ReadSpaceKernel(&rsk));
+ RETURN_ON_FAILURE(TlclGetPermissions(KERNEL_NV_INDEX, &perms));
+ if (TPM_NV_PER_PPWRITE != perms || ROLLBACK_SPACE_KERNEL_UID != rsk.uid)
+ return TPM_E_CORRUPTED_STATE;
+
+ *version = rsk.kernel_versions;
+ VBDEBUG(("TPM: RollbackKernelRead %x\n", (int)rsk.kernel_versions));
return TPM_SUCCESS;
}
uint32_t RollbackKernelWrite(uint32_t version) {
- if (g_rollback_recovery_mode) {
- return TPM_SUCCESS;
- } else {
- RollbackSpaceKernel rsk;
- RETURN_ON_FAILURE(ReadSpaceKernel(&rsk));
- VBDEBUG(("TPM: RollbackKernelWrite %x --> %x\n", (int)rsk.kernel_versions,
- (int)version));
- rsk.kernel_versions = version;
- return WriteSpaceKernel(&rsk);
- }
+ RollbackSpaceKernel rsk;
+ RETURN_ON_FAILURE(ReadSpaceKernel(&rsk));
+ VBDEBUG(("TPM: RollbackKernelWrite %x --> %x\n", (int)rsk.kernel_versions,
+ (int)version));
+ rsk.kernel_versions = version;
+ return WriteSpaceKernel(&rsk);
}
uint32_t RollbackKernelLock(void) {
« no previous file with comments | « firmware/lib/include/rollback_index.h ('k') | firmware/lib/vboot_firmware.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698