summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2010-09-09 14:53:56 -0700
committerBill Richardson <wfrichar@chromium.org>2010-09-09 14:53:56 -0700
commit60bcbe3cd4c3921e6499170fd91eb47a040933a9 (patch)
treee8fc49cf9a6de79bb625ce682d2b047fedd31978 /host
parent7c88d4c31df2bd05494d0fdd2a300d69d7e503bd (diff)
downloadvboot-60bcbe3cd4c3921e6499170fd91eb47a040933a9.tar.gz
New tools to help debug vboot failures.
This adds some tools to help us figure out why a particular kernel isn't booting. Often we suspect it's because it was signed with the wrong keys, or has flags restricting its use to certain boot modes. This change adds some tools to extract and display all the keys from the BIOS, and try them on the various kernels. We also display the sha1sum of all the keys we find, to make comparing them easier. Change-Id: I38e447bf95cb6c3a0b87aa949611bb135f2f94b4 BUG=chromeos-partner:888 TEST=manual To test, obtain a root shell, and run dev_debug_vboot. You should see lots of useful information go by. Review URL: http://codereview.chromium.org/3303018
Diffstat (limited to 'host')
-rw-r--r--host/include/host_misc.h2
-rw-r--r--host/lib/host_misc.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/host/include/host_misc.h b/host/include/host_misc.h
index abbfc0f6..cbf9eaff 100644
--- a/host/include/host_misc.h
+++ b/host/include/host_misc.h
@@ -24,5 +24,7 @@ uint8_t* ReadFile(const char* filename, uint64_t* size);
* Returns 0 if success, 1 if error. */
int WriteFile(const char* filename, const void *data, uint64_t size);
+/* Prints the sha1sum of the given VbPublicKey to stdout. */
+void PrintPubKeySha1Sum(VbPublicKey* key);
#endif /* VBOOT_REFERENCE_HOST_MISC_H_ */
diff --git a/host/lib/host_misc.c b/host/lib/host_misc.c
index d8f52970..91eaea25 100644
--- a/host/lib/host_misc.c
+++ b/host/lib/host_misc.c
@@ -66,3 +66,13 @@ int WriteFile(const char* filename, const void *data, uint64_t size) {
fclose(f);
return 0;
}
+
+void PrintPubKeySha1Sum(VbPublicKey* key) {
+ uint8_t* buf = ((uint8_t *)key) + key->key_offset;
+ uint64_t buflen = key->key_size;
+ uint8_t* digest = DigestBuf(buf, buflen, SHA1_DIGEST_ALGORITHM);
+ int i;
+ for (i=0; i<SHA1_DIGEST_SIZE; i++)
+ printf("%02x", digest[i]);
+ Free(digest);
+}