diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-10-19 14:38:17 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-11-02 09:26:08 +0100 |
commit | d4204476ccf8318abacd7996a48e2fa0d87fe2d4 (patch) | |
tree | 96ba1ec0d49da7cc8853c855a0df522844ffca57 | |
parent | 24f81261a7b82cc47cae7457c56422cc8f1c7837 (diff) | |
download | barebox-d4204476ccf8318abacd7996a48e2fa0d87fe2d4.tar.gz barebox-d4204476ccf8318abacd7996a48e2fa0d87fe2d4.tar.xz |
pbl: decomp: print mismatched hashes on one line each
With DEBUG_LL enabled, hashes are printed to show mismatches, but each
byte is padded with 6 or 14 zeroes and has a line just for itself.
Rework this, so it now looks a lot cleaner:
CH 40e941dfcf53087b86e549fbc279cbc1d4fd87c64febb42af6324c5b3ec64e03
IH 3aa627d34b97f4a6af6a4ebf022236dc4b025c5902296b694a65eb6b92f8d66d
While at it, print a hexdump of the first 64 bytes of the buffer
that could not be verified. This is only printed when DEBUG is
enabled and serves as a first aid to debugging as verification failure
is not an expected occurrence with firmware baked into barebox PBL.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20221019123817.1659468-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | pbl/decomp.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pbl/decomp.c b/pbl/decomp.c index 553895bac5..ebdf81ddfb 100644 --- a/pbl/decomp.c +++ b/pbl/decomp.c @@ -70,20 +70,20 @@ int pbl_barebox_verify(const void *compressed_start, unsigned int len, sha256_update(&d, compressed_start, len); sha256_final(&d, computed_hash); if (IS_ENABLED(CONFIG_DEBUG_LL)) { - putc_ll('C'); - putc_ll('H'); - putc_ll('\n'); - for (i = 0; i < SHA256_DIGEST_SIZE; i++) { - puthex_ll(computed_hash[i]); - putc_ll('\n'); - } - putc_ll('I'); - putc_ll('H'); + puts_ll("CH "); + + for (i = 0; i < SHA256_DIGEST_SIZE; i++) + puthexc_ll(computed_hash[i]); + + puts_ll("\nIH "); + + for (i = 0; i < SHA256_DIGEST_SIZE; i++) + puthexc_ll(char_hash[i]); + putc_ll('\n'); - for (i = 0; i < SHA256_DIGEST_SIZE; i++) { - puthex_ll(char_hash[i]); - putc_ll('\n'); - } + + pr_debug("Hexdump of first 64 bytes of %u\n", len); + print_hex_dump_bytes("", DUMP_PREFIX_ADDRESS, compressed_start, 64); } return memcmp(hash, computed_hash, SHA256_DIGEST_SIZE); |