Add TPM version checking

Change-Id: Ic32b7bcf0bc5501e21dc84e79419a256d9b0d095

R=semenzato@chromium.org,reinauer@chromium.org
BUG=chrome-os-partner:2832
TEST=manual

crossystem tpm_fwver tpm_kernver
On a debug system, this will return 0x00010001 0x00010001

Review URL: http://codereview.chromium.org/6685075
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 6ba67e6..ca61f74 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -101,7 +101,9 @@
 
 /* Fields that GetVdatInt() can get */
 typedef enum VdatIntField {
-  VDAT_INT_FLAGS = 0  /* Flags */
+  VDAT_INT_FLAGS = 0,              /* Flags */
+  VDAT_INT_FW_VERSION_TPM,         /* Current firmware version in TPM */
+  VDAT_INT_KERNEL_VERSION_TPM      /* Current kernel version in TPM */
 } VdatIntField;
 
 
@@ -670,7 +672,12 @@
     case VDAT_INT_FLAGS:
       value = (int)sh->flags;
       break;
-
+    case VDAT_INT_FW_VERSION_TPM:
+      value = (int)sh->fw_version_tpm;
+      break;
+    case VDAT_INT_KERNEL_VERSION_TPM:
+      value = (int)sh->kernel_version_tpm;
+      break;
   }
 
   Free(ab);
@@ -747,6 +754,10 @@
     value = VbGetCrosDebug();
   } else if (!strcasecmp(name,"vdat_flags")) {
     value = GetVdatInt(VDAT_INT_FLAGS);
+  } else if (!strcasecmp(name,"tpm_fwver")) {
+    value = GetVdatInt(VDAT_INT_FW_VERSION_TPM);
+  } else if (!strcasecmp(name,"tpm_kernver")) {
+    value = GetVdatInt(VDAT_INT_KERNEL_VERSION_TPM);
   }
 
   return value;