paycheck: use base64 encoding for SHA256 hashes throughout
Turns out we were using base64 when adding SHA256 data to a payload
report, but intermittently using hex encoding in error messages. This is
now fixed.
BUG=None
TEST=No mention of hex encoding in the code
TEST=gpylinted correctly
TEST=Passes unit tests
Change-Id: Id2dc2fcd154d4647cc1a076579dde7a789c09e40
Reviewed-on: https://gerrit.chromium.org/gerrit/50104
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py
index e1b08a1..13a0518 100644
--- a/scripts/update_payload/checker.py
+++ b/scripts/update_payload/checker.py
@@ -437,8 +437,8 @@
signed_hash = signed_data[len(common.SIG_ASN1_HEADER):]
if signed_hash != actual_hash:
raise PayloadError('%s: signed hash (%s) different from actual (%s)' %
- (sig_name, signed_hash.encode('hex'),
- actual_hash.encode('hex')))
+ (sig_name, common.FormatSha256(signed_hash),
+ common.FormatSha256(actual_hash)))
@staticmethod
def _CheckBlocksFitLength(length, num_blocks, block_size, length_name,
@@ -837,8 +837,8 @@
if op.data_sha256_hash != actual_hash.digest():
raise PayloadError(
'%s: data_sha256_hash (%s) does not match actual hash (%s)' %
- (op_name, op.data_sha256_hash.encode('hex'),
- actual_hash.hexdigest()))
+ (op_name, common.FormatSha256(op.data_sha256_hash),
+ common.FormatSha256(actual_hash.digest())))
elif data_offset is not None:
if allow_signature_in_extents:
blob_hash_counts['signature'] += 1