diff options
Diffstat (limited to 'pbl/decomp.c')
-rw-r--r-- | pbl/decomp.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/pbl/decomp.c b/pbl/decomp.c index 1e0ef81ada..ebdf81ddfb 100644 --- a/pbl/decomp.c +++ b/pbl/decomp.c @@ -54,14 +54,14 @@ static void noinline errorfn(char *error) extern unsigned char sha_sum[]; extern unsigned char sha_sum_end[]; -static int pbl_barebox_verify(void *compressed_start, unsigned int len, void *hash, - unsigned int hash_len) +int pbl_barebox_verify(const void *compressed_start, unsigned int len, + const void *hash, unsigned int hash_len) { struct sha256_state sha_state = { 0 }; struct digest d = { .ctx = &sha_state }; char computed_hash[SHA256_DIGEST_SIZE]; int i; - char *char_hash = hash; + const char *char_hash = hash; if (hash_len != SHA256_DIGEST_SIZE) return -1; @@ -70,20 +70,20 @@ static int pbl_barebox_verify(void *compressed_start, unsigned int len, void *ha 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); |