summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <klto@zhaw.ch>2009-10-23 18:05:37 +0200
committerTobias Klauser <klto@zhaw.ch>2009-10-23 18:05:37 +0200
commitcd1ec1120f97557237b8f978de1aef7f399c8ef3 (patch)
tree874eb16c41a779ddf4385ee146d4cc49d59bbf28
parent29157750c7a566405a4b148e9087b107db478033 (diff)
Implement CRC checking in reverese mode
-rw-r--r--mkubootenv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mkubootenv.c b/mkubootenv.c
index 4294b76..f8b0bbc 100644
--- a/mkubootenv.c
+++ b/mkubootenv.c
@@ -200,7 +200,10 @@ static void uboot_img_to_env(struct file *s, struct file *t)
dbg("target image file (env): %s\n", t->name);
dbg("target size: %zd\n", t->size);
- /* TODO: check CRC */
+ /* check CRC */
+ crc = (uint32_t *) s->ptr;
+ if (*crc != crc32(0, s->ptr + CRC32_SIZE, s->size - CRC32_SIZE))
+ warn("source image with bad CRC\n");
p = t->ptr;
end = s->ptr + CRC32_SIZE + t->size;