From 94af71e9e9eb89b70e8ce979a3d933bdf1fc633c Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 25 Mar 2020 08:19:11 -0700 Subject: [PATCH] Fix for signing tool and SHA3 padding at 8-bytes. --- tools/keytools/sign.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/keytools/sign.c b/tools/keytools/sign.c index 38641616..81c78370 100755 --- a/tools/keytools/sign.c +++ b/tools/keytools/sign.c @@ -413,7 +413,7 @@ int main(int argc, char** argv) &fw_version32); /* Append Four pad bytes, so timestamp is aligned */ - header_append_u32(header, &header_idx, 0xFFFFFFFF); + header_idx += 4; /* memset 0xFF above handles value */ /* Append Timestamp field */ stat(image_file, &attrib); @@ -427,6 +427,9 @@ int main(int argc, char** argv) header_append_tag(header, &header_idx, HDR_IMG_TYPE, HDR_IMG_TYPE_LEN, &image_type); + /* Six pad bytes, Sha-3 requires 8-byte alignment. */ + header_idx += 6; /* memset 0xFF above handles value */ + /* Calculate hashes */ if (hash_algo == HASH_SHA256) {