summaryrefslogtreecommitdiff
path: root/futility
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-14 01:02:18 -0700
commit6858261b271322e2c1180f563908ac4111e5000f (patch)
treebc32922efcdfa39a3bed5673e0ea318b1ea70b33 /futility
parente96e46a5185e9bd9bc758a6757500c5e97dc2829 (diff)
downloadvboot-6858261b271322e2c1180f563908ac4111e5000f.tar.gz
bdb: Enable futility show to dump data header info
This change makes futility show command to dump data header information in a BDB. # of hashes is used to verify 'futility bdb --add' can add a hash in the unit test. BUG=chromium:649554 BRANCH=none TEST=make runtests. run futility show tests/futility/data/bdb.bin BDB Header: Struct Version: 0x1:0x0 BDB key digest: c7895611c24efb2249d97376189eeee07def6bcd8ab162a3850d279354f08ddf size: 1176 Data Header: Struct Version: 0x1:0x0 # of Hashes: 2 Hash Entry Size:56 Signed Size: 272 Description: Hash #0: Offset: 0x2 Size: 35 Partition: 3 Type: 1 Load Address: 0x4 Digest: 72bcf33f448465f035bd58e4b61501db925e67c89feb4a70cb909d8b425861f4 Hash #1: Offset: 0x2 Size: 35 Partition: 3 Type: 1 Load Address: 0x4 Digest: 72bcf33f448465f035bd58e4b61501db925e67c89feb4a70cb909d8b425861f4 Change-Id: I88934b761236f36a5d607c96f6f2543a62e50b68 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/392949
Diffstat (limited to 'futility')
-rw-r--r--futility/bdb_helper.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/futility/bdb_helper.c b/futility/bdb_helper.c
index ac8012ad..83a57bc6 100644
--- a/futility/bdb_helper.c
+++ b/futility/bdb_helper.c
@@ -61,6 +61,19 @@ static void show_bdb_header(const uint8_t *bdb)
printf(" size: %d\n", key->struct_size);
}
+static void show_data_header(const uint8_t *bdb)
+{
+ const struct bdb_data *data = bdb_get_data(bdb);
+
+ printf("Data Header:\n");
+ printf(" Struct Version: 0x%x:0x%x\n",
+ data->struct_major_version, data->struct_minor_version);
+ printf(" # of Hashes: %d\n", data->num_hashes);
+ printf(" Hash Entry Size:%d\n", data->hash_entry_size);
+ printf(" Signed Size: %d\n", data->signed_size);
+ printf(" Description: %s\n", data->description);
+}
+
static void show_hashes(const uint8_t *bdb)
{
const struct bdb_data *data = bdb_get_data(bdb);
@@ -87,6 +100,7 @@ int ft_show_bdb(const char *name, uint8_t *buf, uint32_t len, void *data)
printf("Boot Descriptor Block: %s\n", name);
show_bdb_header(buf);
+ show_data_header(buf);
show_hashes(buf);
return 0;