diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-12-03 14:10:13 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-04 05:08:21 +0000 |
commit | b406c1064b3a37002b3d4d953a4932628408f25b (patch) | |
tree | 4856ba249a1ef333b771431d82115aadce99b8fd /futility/misc.c | |
parent | 64ef69c48da1cdd227b169accb5f576247cd8a89 (diff) | |
download | vboot-b406c1064b3a37002b3d4d953a4932628408f25b.tar.gz |
futility: Don't copy the entire kernel partition just to sign a blob
When re-signing a kernel partition and writing the result into a
new file, make sure we only emit the vblock and kernel blob
instead of creating a new file that's the size of the entire
partition.
Also add a test for that.
BUG=chromium:418647
BRANCH=none
TEST=make runtests
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I2c42aec6816e7e7abbeed360089c9b51fdcfe786
Reviewed-on: https://chromium-review.googlesource.com/233039
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/misc.c')
-rw-r--r-- | futility/misc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/futility/misc.c b/futility/misc.c index 42e8bb44..4d8d762e 100644 --- a/futility/misc.c +++ b/futility/misc.c @@ -130,7 +130,7 @@ int print_hwid_digest(GoogleBinaryBlockHeader *gbb, uint8_t *buf = (uint8_t *)gbb; char *hwid_str = (char *)(buf + gbb->hwid_offset); int is_valid = 0; - uint8_t* digest = DigestBuf(buf + gbb->hwid_offset, + uint8_t *digest = DigestBuf(buf + gbb->hwid_offset, strlen(hwid_str), SHA256_DIGEST_ALGORITHM); if (digest) { @@ -159,7 +159,7 @@ void update_hwid_digest(GoogleBinaryBlockHeader *gbb) uint8_t *buf = (uint8_t *)gbb; char *hwid_str = (char *)(buf + gbb->hwid_offset); - uint8_t* digest = DigestBuf(buf + gbb->hwid_offset, + uint8_t *digest = DigestBuf(buf + gbb->hwid_offset, strlen(hwid_str), SHA256_DIGEST_ALGORITHM); memcpy(gbb->hwid_digest, digest, SHA256_DIGEST_SIZE); @@ -175,6 +175,8 @@ void futil_copy_file_or_die(const char *infile, const char *outfile) pid_t pid; int status; + Debug("%s(%s, %s)\n", __func__, infile, outfile); + pid = fork(); if (pid < 0) { |