Skip to content
Commit cc34e76e authored by Alexandru Gagniuc's avatar Alexandru Gagniuc Committed by Tom Rini
Browse files

image: Avoid erroneous double byte-swap in CRC value



The hash algorithm selection was streamlined in commit 92055e13
("image: Drop if/elseif hash selection in calculate_hash()"). Said
commit kept the call to cpu_to_uimage() to convert the CRC to big
endian format.

This would have been correct when calling crc32_wd(). However, the
->hash_func_ws member of crc32 points to crc32_wd_buf(), which already
converts the CRC to big endian. On a little endian host, doing both
conversions results in a little-endian CRC. This is incorrect.

To remedy this, simply drop the call to cpu_to_uimage(), thus only
doing the byte-order conversion once.

Fixes: 92055e13 ("image: Drop if/elseif hash selection in
       calculate_hash()")
Tested-by: default avatarTom Rini <trini@konsulko.com>
Signed-off-by: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
parent 1edd7e8a
Loading
Loading
Loading
Loading