summaryrefslogtreecommitdiff
path: root/host/lib/crossystem.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-03-18 12:44:27 -0700
committerRandall Spangler <rspangler@chromium.org>2011-03-18 12:44:27 -0700
commitcabe6b3514f3228b350a7d07d6cc7cb39eecaaf6 (patch)
tree40c8aeeb07c2d843278726d6e3fa8db3fa2e0216 /host/lib/crossystem.c
parent17c712672f2c3a6d928c9bffde5b09c8baa1ba24 (diff)
downloadvboot-cabe6b3514f3228b350a7d07d6cc7cb39eecaaf6.tar.gz
Use VbSharedData instead of VbNvStorage for fwb_tries and kernkey_vfy
Change-Id: I5ed3509a9d4e578cd2e98f493dab59bc2fbd5827 R=dlaurie@chromium.org BUG=chrome-os-partner:2748 TEST=manual crossystem fwb_tries=3 (reboot) crossystem tried_fwb (should print 1) crossystem fwb_tries=0 (reboot) crossystem tried_fwb (should print 0) In dev mode... Boot a kernel signed with the same key as in the firmware crossystem kernkey_vfy (should print sig) Boot a kernel signed with a different key than the firmware crossystem kernkey_vfy (should print hash) Review URL: http://codereview.chromium.org/6711045
Diffstat (limited to 'host/lib/crossystem.c')
-rw-r--r--host/lib/crossystem.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index ca61f74f..e841bad6 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -101,9 +101,12 @@ typedef enum VdatStringField {
/* Fields that GetVdatInt() can get */
typedef enum VdatIntField {
- 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 */
+ 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 */
+ VDAT_INT_TRIED_FIRMWARE_B, /* Tried firmware B due to fwb_tries */
+ VDAT_INT_KERNEL_KEY_VERIFIED /* Kernel key verified using
+ * signature, not just hash */
} VdatIntField;
@@ -678,6 +681,12 @@ int GetVdatInt(VdatIntField field) {
case VDAT_INT_KERNEL_VERSION_TPM:
value = (int)sh->kernel_version_tpm;
break;
+ case VDAT_INT_TRIED_FIRMWARE_B:
+ value = (sh->flags & VBSD_FWB_TRIED ? 1 : 0);
+ break;
+ case VDAT_INT_KERNEL_KEY_VERIFIED:
+ value = (sh->flags & VBSD_KERNEL_KEY_VERIFIED ? 1 : 0);
+ break;
}
Free(ab);
@@ -719,9 +728,7 @@ int VbGetSystemPropertyInt(const char* name) {
return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00100000);
}
/* NV storage values with no defaults for older BIOS. */
- else if (!strcasecmp(name,"tried_fwb")) {
- value = VbGetNvStorage(VBNV_TRIED_FIRMWARE_B);
- } else if (!strcasecmp(name,"kern_nv")) {
+ else if (!strcasecmp(name,"kern_nv")) {
value = VbGetNvStorage(VBNV_KERNEL_FIELD);
} else if (!strcasecmp(name,"nvram_cleared")) {
value = VbGetNvStorage(VBNV_KERNEL_SETTINGS_RESET);
@@ -758,6 +765,8 @@ int VbGetSystemPropertyInt(const char* name) {
value = GetVdatInt(VDAT_INT_FW_VERSION_TPM);
} else if (!strcasecmp(name,"tpm_kernver")) {
value = GetVdatInt(VDAT_INT_KERNEL_VERSION_TPM);
+ } else if (!strcasecmp(name,"tried_fwb")) {
+ value = GetVdatInt(VDAT_INT_TRIED_FIRMWARE_B);
}
return value;
@@ -798,7 +807,7 @@ const char* VbGetSystemPropertyString(const char* name, char* dest, int size) {
return NULL;
}
} else if (!strcasecmp(name,"kernkey_vfy")) {
- switch(VbGetNvStorage(VBNV_FW_VERIFIED_KERNEL_KEY)) {
+ switch(GetVdatInt(VDAT_INT_KERNEL_KEY_VERIFIED)) {
case 0:
return "hash";
case 1: