From 939cc3a5c25a3333fadafc7fc341d7e320f72fab Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 21 Jun 2016 15:23:32 -0700 Subject: futility: Use only vboot 2.0 APIs for keyblocks This refactors futility and the host library to use only vboot 2.0 APIs to create and verify keyblocks. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Ia3cc1e24971b94f01bcb4890c8666a3af6f84841 Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/356129 Reviewed-by: Daisuke Nojiri --- futility/cmd_vbutil_kernel.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'futility/cmd_vbutil_kernel.c') diff --git a/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c index d13749bf..cf8b26e0 100644 --- a/futility/cmd_vbutil_kernel.c +++ b/futility/cmd_vbutil_kernel.c @@ -25,6 +25,7 @@ #include "host_common.h" #include "kernel_blob.h" #include "vb1_helper.h" +#include "vb2_struct.h" static void Fatal(const char *format, ...) { @@ -236,8 +237,8 @@ static int do_vbutil_kernel(int argc, char *argv[]) int i = 0; int errcount = 0; int rv; - VbKeyBlockHeader *keyblock = NULL; - VbKeyBlockHeader *t_keyblock = NULL; + struct vb2_keyblock *keyblock = NULL; + struct vb2_keyblock *t_keyblock = NULL; VbPrivateKey *signpriv_key = NULL; VbPublicKey *signpub_key = NULL; uint8_t *kpart_data = NULL; @@ -395,7 +396,7 @@ static int do_vbutil_kernel(int argc, char *argv[]) if (!keyblock_file) Fatal("Missing required keyblock file.\n"); - t_keyblock = (VbKeyBlockHeader *)ReadFile(keyblock_file, 0); + t_keyblock = (struct vb2_keyblock *)ReadFile(keyblock_file, 0); if (!t_keyblock) Fatal("Error reading key block.\n"); @@ -517,8 +518,8 @@ static int do_vbutil_kernel(int argc, char *argv[]) flags = preamble->flags; if (keyblock_file) { - t_keyblock = - (VbKeyBlockHeader *)ReadFile(keyblock_file, 0); + t_keyblock = (struct vb2_keyblock *) + ReadFile(keyblock_file, 0); if (!t_keyblock) Fatal("Error reading key block.\n"); } @@ -619,7 +620,7 @@ static int do_vbutil_kernel(int argc, char *argv[]) // the keyblock and preamble sections. vmlinuz_header_offset = vmlinuz_header_address - preamble->body_load_address + - keyblock->key_block_size + + keyblock->keyblock_size + preamble->preamble_size; errcount |= (1 != fwrite(kpart_data + vmlinuz_header_offset, -- cgit v1.2.1