summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2020-01-27 15:51:51 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-10 09:18:12 +0100
commit93a4a0649cd4b46a11b9de8926ada3ec4f27bcab (patch)
treed0233ff038030e13e5ea668c5a72b9f5fc1f907a /common
parent9d12256bfcc69d7ec7c20bd0e5205c54cefea700 (diff)
downloadbarebox-93a4a0649cd4b46a11b9de8926ada3ec4f27bcab.tar.gz
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 <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/bbu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/bbu.c b/common/bbu.c
index 00bec32..b976b99 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;
}