summaryrefslogtreecommitdiff
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.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:
175 return NULL; 175 return NULL;
176} 176}
177 177
178/* A CRC test in order to reject non OF file */
179int test_firmware_tcc(unsigned char* buf, int length)
180{
181 return telechips_test_crc(buf, length);
182}
183
178#ifndef LIB 184#ifndef LIB
179int main(int argc, char *argv[]) 185int main(int argc, char *argv[])
180{ 186{
@@ -185,7 +191,7 @@ int main(int argc, char *argv[])
185 unsigned char *boot_buf = NULL; 191 unsigned char *boot_buf = NULL;
186 unsigned char* image = NULL; 192 unsigned char* image = NULL;
187 int ret = 0; 193 int ret = 0;
188 194
189 if(argc < 3) { 195 if(argc < 3) {
190 usage(); 196 usage();
191 } 197 }
@@ -202,6 +208,14 @@ int main(int argc, char *argv[])
202 goto error_exit; 208 goto error_exit;
203 } 209 }
204 210
211 /* Validate input file */
212 if (test_firmware_tcc(of_buf, of_size))
213 {
214 printf("[ERR] Unknown OF file used, aborting\n");
215 ret = 2;
216 goto error_exit;
217 }
218
205 boot_buf = file_read(bootfile, &boot_size); 219 boot_buf = file_read(bootfile, &boot_size);
206 if (!boot_buf) 220 if (!boot_buf)
207 { 221 {