rockchip: weak: support check uncompressed data hash

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I04c54daa0d8bc43566c7b59a390b5c2789cf1425
This commit is contained in:
Joseph Chen 2020-07-27 19:50:24 +08:00
parent 50466f5805
commit 6c625d1e8c
1 changed files with 28 additions and 0 deletions

View File

@ -22,6 +22,27 @@ DECLARE_GLOBAL_DATA_PTR;
*/
#if CONFIG_IS_ENABLED(FIT_IMAGE_POST_PROCESS)
#if CONFIG_IS_ENABLED(MISC_DECOMPRESS)
#define FIT_UNCOMP_HASH_NODENAME "digest"
static int fit_image_check_uncomp_hash(const void *fit, int parent_noffset,
const void *data, size_t size)
{
const char *name;
char *err_msgp;
int noffset;
fdt_for_each_subnode(noffset, fit, parent_noffset) {
name = fit_get_name(fit, noffset, NULL);
if (!strncmp(name, FIT_UNCOMP_HASH_NODENAME,
strlen(FIT_UNCOMP_HASH_NODENAME))) {
return fit_image_check_hash(fit, noffset, data,
size, &err_msgp);
}
}
return 0;
}
static int fit_hw_gunzip(void *fit, int node, ulong *load_addr,
ulong **src_addr, size_t *src_len)
{
@ -50,6 +71,13 @@ static int fit_hw_gunzip(void *fit, int node, ulong *load_addr,
return ret;
}
/* check uncompressed data hash */
ret = fit_image_check_uncomp_hash(fit, node, (void *)(*load_addr), len);
if (!ret)
puts("+ ");
else
return ret;
*src_addr = (ulong *)*load_addr;
*src_len = len;