diff options
Diffstat (limited to 'futility/cmd_gbb_utility.c')
-rw-r--r-- | futility/cmd_gbb_utility.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/futility/cmd_gbb_utility.c b/futility/cmd_gbb_utility.c index e8910e67..9e608d1f 100644 --- a/futility/cmd_gbb_utility.c +++ b/futility/cmd_gbb_utility.c @@ -29,6 +29,7 @@ static void print_help(const char *prog) "with following options:\n" " --hwid \tReport hardware id (default).\n" " --flags \tReport header flags.\n" + " --digest \tReport digest of hwid (>= v1.2)\n" " -k, --rootkey=FILE \tFile name to export Root Key.\n" " -b, --bmpfv=FILE \tFile name to export Bitmap FV.\n" " -r --recoverykey=FILE\tFile name to export Recovery Key.\n" @@ -55,6 +56,10 @@ static void print_help(const char *prog) prog, prog, prog, prog); } +enum { + OPT_DIGEST = 1000, +}; + /* Command line options */ static const struct option long_opts[] = { /* name hasarg *flag val */ @@ -67,6 +72,7 @@ static const struct option long_opts[] = { {"recoverykey", 1, NULL, 'R'}, {"hwid", 2, NULL, 'i'}, {"flags", 2, NULL, 'L'}, + {"digest", 0, NULL, OPT_DIGEST}, {NULL, 0, NULL, 0}, }; @@ -340,6 +346,7 @@ static int do_gbb_utility(int argc, char *argv[]) char *opt_hwid = NULL; char *opt_flags = NULL; int sel_hwid = 0; + int sel_digest = 0; int sel_flags = 0; uint8_t *inbuf = NULL; off_t filesize; @@ -386,6 +393,9 @@ static int do_gbb_utility(int argc, char *argv[]) opt_flags = optarg; sel_flags = 1; break; + case OPT_DIGEST: + sel_digest = 1; + break; case '?': errorcnt++; if (optopt) @@ -437,7 +447,7 @@ static int do_gbb_utility(int argc, char *argv[]) /* With no args, show the HWID */ if (!opt_rootkey && !opt_bmpfv && !opt_recoverykey - && !sel_flags) + && !sel_flags && !sel_digest) sel_hwid = 1; inbuf = read_entire_file(infile, &filesize); @@ -457,6 +467,9 @@ static int do_gbb_utility(int argc, char *argv[]) gbb->hwid_size ? (char *)(gbb_base + gbb-> hwid_offset) : ""); + if (sel_digest) + print_hwid_digest(gbb, "digest: ", "\n"); + if (sel_flags) printf("flags: 0x%08x\n", gbb->flags); if (opt_rootkey) @@ -540,6 +553,7 @@ static int do_gbb_utility(int argc, char *argv[]) gbb->hwid_size); strcpy((char *)(gbb_base + gbb->hwid_offset), opt_hwid); + update_hwid_digest(gbb); } } |