From 7c9e7ec707b9aa9e40c8e7ebdbbf1138cef85bb1 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 27 Jun 2012 14:50:39 +0200 Subject: sbtools: add option to force sb dump In the case of encrypted SB files without any key match, it is still possible to dump the section headers. The force option allows one to do so. It also allows to dump unencrypted sections of encrypted files if there are some. Change-Id: I36280230679ac5903f9c451c68c276f5c6959536 --- utils/imxtools/sbtools/sbtoelf.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'utils/imxtools/sbtools/sbtoelf.c') diff --git a/utils/imxtools/sbtools/sbtoelf.c b/utils/imxtools/sbtools/sbtoelf.c index c1d1e9aa34..0170ea1836 100644 --- a/utils/imxtools/sbtools/sbtoelf.c +++ b/utils/imxtools/sbtools/sbtoelf.c @@ -169,6 +169,7 @@ static void usage(void) printf(" -a/--add-key \tAdd single key (hex or usbotp)\n"); printf(" -n/--no-color\tDisable output colors\n"); printf(" -l/--loopback \tProduce sb file out of extracted description*\n"); + printf(" -f/--force\tForce reading even without a key*\n"); printf("Options marked with a * are for debug purpose only\n"); exit(1); } @@ -204,10 +205,11 @@ int main(int argc, char **argv) {"add-key", required_argument, 0, 'a'}, {"no-color", no_argument, 0, 'n'}, {"loopback", required_argument, 0, 'l'}, + {"force", no_argument, 0, 'f' }, {0, 0, 0, 0} }; - int c = getopt_long(argc, argv, "?do:k:zra:nl:", long_options, NULL); + int c = getopt_long(argc, argv, "?do:k:zra:nl:f", long_options, NULL); if(c == -1) break; switch(c) @@ -231,6 +233,9 @@ int main(int argc, char **argv) case 'o': g_out_prefix = optarg; break; + case 'f': + g_force = true; + break; case 'k': { if(!add_keys_from_file(optarg)) @@ -250,9 +255,9 @@ int main(int argc, char **argv) struct crypto_key_t key; char *s = optarg; if(!parse_key(&s, &key)) - bug("Invalid key specified as argument"); + bug("Invalid key specified as argument\n"); if(*s != 0) - bug("Trailing characters after key specified as argument"); + bug("Trailing characters after key specified as argument\n"); add_keys(&key, 1); break; } -- cgit v1.2.3