diff options
author | Hung-Te Lin <hungte@chromium.org> | 2014-09-11 11:50:03 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-11 08:05:58 +0000 |
commit | 54fbb4cfab141ad4b59aa87bcc4b07c283382dfd (patch) | |
tree | 28c3c8313fb08b59699767af41b34220d647b161 | |
parent | b77aff570216cf1a58d687bde1512d88edba519f (diff) | |
download | vboot-factory-ryu-6212.B.tar.gz |
futility: Wipe GBB data before writing new values.factory-ryu-6212.B
The previous version of gbb_utility always zeros data before writing new values
and we should keep this behavior, to simplify firmware hash calculation and
potential security concern.
BRANCH=none
BUG=chromium:413066
TEST=emerge gbb_utility; factory/bin/gooftool get_firmware_hash bios.bin
Originial-Change-Id: Ic97a118cefc9698d52d9370b627670ff103d5e23
Change-Id: If199040909c4719c89dbc52fd7488d69abd981e5
Reviewed-on: https://chromium-review.googlesource.com/217478
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
-rw-r--r-- | futility/cmd_gbb_utility.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/futility/cmd_gbb_utility.c b/futility/cmd_gbb_utility.c index 9810058d..85b47829 100644 --- a/futility/cmd_gbb_utility.c +++ b/futility/cmd_gbb_utility.c @@ -342,6 +342,9 @@ static int read_from_file(const char *msg, const char *filename, goto done_close; } + /* Wipe existing data. */ + memset(start, 0, size); + /* It's okay if we read less than size. That's just the max. */ count = fread(start, 1, size, fp); if (ferror(fp)) { @@ -568,6 +571,9 @@ static int do_gbb_utility(int argc, char *argv[]) gbb->hwid_size); errorcnt++; } else { + /* Wipe data before writing new value. */ + memset(gbb_base + gbb->hwid_offset, 0, + gbb->hwid_size); strcpy((char *)(gbb_base + gbb->hwid_offset), opt_hwid); } |