diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-06-30 14:52:30 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-06 22:02:21 -0700 |
commit | 5c537e3ea8d391937938536e7170a5bfefbdafcb (patch) | |
tree | ded9fb37cadc4b201b43bb012814a44120073271 /futility/cmd_sign.c | |
parent | 7d0cc747c75408a6edabbf4adeb4e898b6118e97 (diff) | |
download | vboot-5c537e3ea8d391937938536e7170a5bfefbdafcb.tar.gz |
futility: use vboot2 functions for kernel preamble
Another in a long series of refactoring changes to replace old vboot1
code with its vboot2 equivalent. Futility changes only; no change to
firmware.
BUG=chromium:611535
BRANCH=none
TEST=make runtests
Change-Id: I7be813b82820674e975db13d5e540e49bdea028d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366057
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'futility/cmd_sign.c')
-rw-r--r-- | futility/cmd_sign.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/futility/cmd_sign.c b/futility/cmd_sign.c index 0792081e..e91a1a7b 100644 --- a/futility/cmd_sign.c +++ b/futility/cmd_sign.c @@ -24,12 +24,13 @@ #include "futility_options.h" #include "gbb_header.h" #include "host_common.h" +#include "host_key2.h" #include "kernel_blob.h" #include "util_misc.h" #include "vb1_helper.h" +#include "vb2_common.h" #include "vb2_struct.h" #include "vb21_common.h" -#include "host_key2.h" #include "vboot_common.h" /* Options */ @@ -107,7 +108,7 @@ int ft_sign_raw_kernel(const char *name, uint8_t *buf, uint32_t len, void *data) { uint8_t *vmlinuz_data, *kblob_data, *vblock_data; - uint64_t vmlinuz_size, kblob_size, vblock_size; + uint32_t vmlinuz_size, kblob_size, vblock_size; int rv; vmlinuz_data = buf; @@ -123,7 +124,7 @@ int ft_sign_raw_kernel(const char *name, uint8_t *buf, uint32_t len, fprintf(stderr, "Unable to create kernel blob\n"); return 1; } - Debug("kblob_size = 0x%" PRIx64 "\n", kblob_size); + Debug("kblob_size = 0x%x\n", kblob_size); vblock_data = SignKernelBlob(kblob_data, kblob_size, sign_option.padding, @@ -137,7 +138,7 @@ int ft_sign_raw_kernel(const char *name, uint8_t *buf, uint32_t len, free(kblob_data); return 1; } - Debug("vblock_size = 0x%" PRIx64 "\n", vblock_size); + Debug("vblock_size = 0x%x\n", vblock_size); /* We should be creating a completely new output file. * If not, something's wrong. */ @@ -162,17 +163,18 @@ int ft_sign_kern_preamble(const char *name, uint8_t *buf, uint32_t len, void *data) { uint8_t *kpart_data, *kblob_data, *vblock_data; - uint64_t kpart_size, kblob_size, vblock_size; + uint32_t kpart_size, kblob_size, vblock_size; struct vb2_keyblock *keyblock = NULL; - VbKernelPreambleHeader *preamble = NULL; + struct vb2_kernel_preamble *preamble = NULL; int rv = 0; kpart_data = buf; kpart_size = len; /* Note: This just sets some static pointers. It doesn't malloc. */ - kblob_data = UnpackKPart(kpart_data, kpart_size, sign_option.padding, - &keyblock, &preamble, &kblob_size); + kblob_data = unpack_kernel_partition(kpart_data, kpart_size, + sign_option.padding, + &keyblock, &preamble, &kblob_size); if (!kblob_data) { fprintf(stderr, "Unable to unpack kernel partition\n"); @@ -202,10 +204,9 @@ int ft_sign_kern_preamble(const char *name, uint8_t *buf, uint32_t len, sign_option.version = preamble->kernel_version; /* Preserve the flags if not specified */ - if (VbKernelHasFlags(preamble) == VBOOT_SUCCESS) { - if (sign_option.flags_specified == 0) - sign_option.flags = preamble->flags; - } + uint32_t kernel_flags = vb2_kernel_get_flags(preamble); + if (sign_option.flags_specified == 0) + sign_option.flags = kernel_flags; /* Replace the keyblock if asked */ if (sign_option.keyblock) |