libpayload/libcbfs: Fix file hash check

Fix the buffer pointer passed to cbfs_file_hash_mismatch().

Add a test case with LZ4 compression, which would catch the bug we are
fixing.

Change-Id: I36605e2dbc0423fa6743087512f2042b37c49d35
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65149
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Yu-Ping Wu
2022-06-15 15:03:04 +08:00
committed by Julius Werner
parent e3fded3241
commit c1d7d89d48
2 changed files with 31 additions and 7 deletions

View File

@@ -120,7 +120,7 @@ static size_t cbfs_load_and_decompress(size_t offset, size_t in_size, void *buff
goto out;
}
if (cbfs_file_hash_mismatch(buffer, in_size, mdata, skip_verification))
if (cbfs_file_hash_mismatch(load, in_size, mdata, skip_verification))
goto out;
switch (compression) {