forked from OERV-BSP/u-boot
test/py: Check hashes produced by mkimage against known values
Target code and mkimage share the same hashing infrastructure. If one
is wrong, it's very likely that both are wrong in the same way. Thus
testing won't catch hash regressions. This already happened in
commit 92055e138f ("image: Drop if/elseif hash selection in
calculate_hash()"). None of the tests caught that CRC32 was broken.
Instead of testing hash_calculate() against itself, create a FIT with
containing a kernel with pre-calculated hashes. Then check the hashes
produced against the known good hashes.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Tom Rini
parent
8a47982ed8
commit
01e1e2a966
76
test/py/tests/vboot/hash-images.its
Normal file
76
test/py/tests/vboot/hash-images.its
Normal file
@@ -0,0 +1,76 @@
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "Chrome OS kernel image with one or more FDT blobs";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
kernel {
|
||||
data = /incbin/("test-kernel.bin");
|
||||
type = "kernel_noload";
|
||||
arch = "sandbox";
|
||||
os = "linux";
|
||||
compression = "none";
|
||||
load = <0x4>;
|
||||
entry = <0x8>;
|
||||
kernel-version = <1>;
|
||||
hash-0 {
|
||||
algo = "crc16-ccitt";
|
||||
};
|
||||
hash-1 {
|
||||
algo = "crc32";
|
||||
};
|
||||
hash-2 {
|
||||
algo = "md5";
|
||||
};
|
||||
hash-3 {
|
||||
algo = "sha1";
|
||||
};
|
||||
hash-4 {
|
||||
algo = "sha256";
|
||||
};
|
||||
hash-5 {
|
||||
algo = "sha384";
|
||||
};
|
||||
hash-6 {
|
||||
algo = "sha512";
|
||||
};
|
||||
};
|
||||
fdt-1 {
|
||||
description = "snow";
|
||||
data = /incbin/("sandbox-kernel.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "sandbox";
|
||||
compression = "none";
|
||||
fdt-version = <1>;
|
||||
hash-0 {
|
||||
algo = "crc16-ccitt";
|
||||
};
|
||||
hash-1 {
|
||||
algo = "crc32";
|
||||
};
|
||||
hash-2 {
|
||||
algo = "md5";
|
||||
};
|
||||
hash-3 {
|
||||
algo = "sha1";
|
||||
};
|
||||
hash-4 {
|
||||
algo = "sha256";
|
||||
};
|
||||
hash-5 {
|
||||
algo = "sha384";
|
||||
};
|
||||
hash-6 {
|
||||
algo = "sha512";
|
||||
};
|
||||
};
|
||||
};
|
||||
configurations {
|
||||
default = "conf-1";
|
||||
conf-1 {
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user