[PATCH v3 3/3] commands: bbu: add support for imd checksum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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.25.0


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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux