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.trumt...@pengutronix.de>
---
 common/bbu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/bbu.c b/common/bbu.c
index 00bec32a860a..b976b99d7c95 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;
 }
 
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to