summaryrefslogtreecommitdiffstats
path: root/rbutil/mktccboot/mktccboot.c
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-11-01 18:26:00 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-11-01 18:26:00 +0000
commitbcadf96066c20953ae6be7447f1ee2cd8742ab4f (patch)
tree422ba0e39a5275103eee185b2fd63e4120a87058 /rbutil/mktccboot/mktccboot.c
parent50edc5819ea22c9635bfdc7459a1cd7bcd6d82fa (diff)
downloadrockbox-bcadf96066c20953ae6be7447f1ee2cd8742ab4f.tar.gz
rockbox-bcadf96066c20953ae6be7447f1ee2cd8742ab4f.tar.bz2
rockbox-bcadf96066c20953ae6be7447f1ee2cd8742ab4f.zip
FS#10740 - rbutil: Test Cowon D2 OF file for CRC consistency before patching
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23470 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mktccboot/mktccboot.c')
-rw-r--r--rbutil/mktccboot/mktccboot.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/rbutil/mktccboot/mktccboot.c b/rbutil/mktccboot/mktccboot.c
index 432bc03213..7103f23895 100644
--- a/rbutil/mktccboot/mktccboot.c
+++ b/rbutil/mktccboot/mktccboot.c
@@ -175,6 +175,12 @@ error:
return NULL;
}
+/* A CRC test in order to reject non OF file */
+int test_firmware_tcc(unsigned char* buf, int length)
+{
+ return telechips_test_crc(buf, length);
+}
+
#ifndef LIB
int main(int argc, char *argv[])
{
@@ -185,7 +191,7 @@ int main(int argc, char *argv[])
unsigned char *boot_buf = NULL;
unsigned char* image = NULL;
int ret = 0;
-
+
if(argc < 3) {
usage();
}
@@ -202,6 +208,14 @@ int main(int argc, char *argv[])
goto error_exit;
}
+ /* Validate input file */
+ if (test_firmware_tcc(of_buf, of_size))
+ {
+ printf("[ERR] Unknown OF file used, aborting\n");
+ ret = 2;
+ goto error_exit;
+ }
+
boot_buf = file_read(bootfile, &boot_size);
if (!boot_buf)
{