summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-11-04 16:12:24 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-10 06:54:41 -0800
commitb09d5ece2f9799e9271e2f618b34c340e23d7725 (patch)
treec96f8c9df6ec8831e340ccd761496d55c4e48fea
parentbaed1d86720d531abc2794967929bcb1ffa96cbf (diff)
downloadchrome-ec-b09d5ece2f9799e9271e2f618b34c340e23d7725.tar.gz
util: signer: fix nonzero offset binary image signing bug
When signer code was ported and enhanced to work with binaries (in addition to hex), a bug was introduced, where the signed image is considered to always to be based at the bottom of the flash. In fact the image could be anywhere in the flash, the actual address derived from the input elf file should be used. BRANCH=none BUG=chrome-os-partner:43025 TEST=verified that when enabled, RW image is signed properly (build/cr50/RW/ec.RW.flat starts with a signature). Change-Id: I194bd02f932529165adcbebf4bcbd9020fc261dc Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311314 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--util/signer/image.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/signer/image.cc b/util/signer/image.cc
index e82d3846ad..b0657b8892 100644
--- a/util/signer/image.cc
+++ b/util/signer/image.cc
@@ -324,7 +324,7 @@ void Image::generate(const std::string& filename, bool hex_output) const {
if (hex_output)
toIntelHex(fout);
else // TODO: we don't expect write to fail, can be made more robust.
- fwrite(mem_, 1, high_ - base_, fout);
+ fwrite(mem_ + base_, 1, high_ - base_, fout);
fclose(fout);
}