summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2016-10-04 09:48:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-10-17 15:23:10 -0700
commit0d503c7923ed80e1b4d208c81da38116b454cd18 (patch)
tree036748294dadf9a7cbc41de89e13ab2455edc386
parent8fe8f6ca89c9f6e03486703efd8b2898a8347333 (diff)
downloadvboot-0d503c7923ed80e1b4d208c81da38116b454cd18.tar.gz
bdb: Enable futility-show to dump signature info
This change makes futility show command dump information of the signatures found in a BDB. BUG=chromium:649554 BRANCH=none TEST=make runtests $ futility show --type bdb ~/tmp/rotor/bin/coreboot.rom Change-Id: I168dcd5adf237ec9989f43e3834577257e9a10ff Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/399060 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--futility/bdb_helper.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/futility/bdb_helper.c b/futility/bdb_helper.c
index 74bdc467..daaf9160 100644
--- a/futility/bdb_helper.c
+++ b/futility/bdb_helper.c
@@ -63,6 +63,18 @@ static void print_key_info(const char *label, const struct bdb_key *key)
print_digest(" Digest: ", digest, sizeof(digest));
}
+static void print_sig_info(const char *label, const struct bdb_sig *sig)
+{
+ if (label)
+ printf("%s", label);
+ printf(" Struct Version: 0x%x:0x%x\n",
+ sig->struct_major_version, sig->struct_minor_version);
+ printf(" Hash Algorithm: %d\n", sig->hash_alg);
+ printf(" Sign Algorithm: %d\n", sig->sig_alg);
+ printf(" Signed Size: %d\n", sig->signed_size);
+ printf(" Description: %s\n", sig->description);
+}
+
static void show_bdb_header(const uint8_t *bdb)
{
const struct bdb_header *header = bdb_get_header(bdb);
@@ -82,6 +94,11 @@ static void show_datakey_info(const uint8_t *bdb)
print_key_info("Data key:\n", bdb_get_datakey(bdb));
}
+static void show_header_signature(const uint8_t *bdb)
+{
+ print_sig_info("Header Signature:\n" , bdb_get_header_sig(bdb));
+}
+
static void show_data_header(const uint8_t *bdb)
{
const struct bdb_data *data = bdb_get_data(bdb);
@@ -107,6 +124,11 @@ static void show_hashes(const uint8_t *bdb)
}
}
+static void show_data_signature(const uint8_t *bdb)
+{
+ print_sig_info("Data Signature:\n" , bdb_get_data_sig(bdb));
+}
+
int ft_show_bdb(const char *name, uint8_t *buf, uint32_t len, void *data)
{
const struct bdb_header *header = bdb_get_header(buf);
@@ -123,8 +145,10 @@ int ft_show_bdb(const char *name, uint8_t *buf, uint32_t len, void *data)
show_bdb_header(buf);
show_bdbkey_info(buf);
show_datakey_info(buf);
+ show_header_signature(buf);
show_data_header(buf);
show_hashes(buf);
+ show_data_signature(buf);
return 0;
}