From 93a4a0649cd4b46a11b9de8926ada3ec4f27bcab Mon Sep 17 00:00:00 2001 From: Steffen Trumtrar Date: Mon, 27 Jan 2020 15:51:51 +0100 Subject: commands: bbu: add support for imd checksum Add support for verifying an image by use of the imd checksum. If the checksum that is saved in the image and the one that is calculated over the image differ, barebox_update aborts. Signed-off-by: Steffen Trumtrar Signed-off-by: Sascha Hauer --- common/bbu.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common') diff --git a/common/bbu.c b/common/bbu.c index 00bec32a86..b976b99d7c 100644 --- a/common/bbu.c +++ b/common/bbu.c @@ -206,6 +206,10 @@ static int bbu_check_metadata(struct bbu_data *data) if (ret) return ret; + ret = imd_verify_crc32((void *)data->image, data->len); + if (ret == -EILSEQ && !(data->flags & BBU_FLAG_FORCE)) + return ret; + return 0; } -- cgit v1.2.3