Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: utility/dev_sign_file.c

Issue 3122023: Enhance 'cgpt find' command to match keyblocks if desired. (Closed) Base URL: http://src.chromium.org/git/vboot_reference.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utility/dev_make_keypair ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utility/dev_sign_file.c
diff --git a/utility/dev_sign_file.c b/utility/dev_sign_file.c
index d59ec4adb11a0e65e107cd0b1c1f14fe104ea5b4..81cea42aec5a61c4209acc42861bb2015d9bd7ed 100644
--- a/utility/dev_sign_file.c
+++ b/utility/dev_sign_file.c
@@ -67,6 +67,10 @@ static int PrintHelp(const char *progname) {
"\n"
" Required parameters:\n"
" --vblock <file> Signature file in .vblock format\n"
+ "\n"
+ " Optional parameters:\n"
+ " --keyblock <file>"
+ " Extract .keyblock to file if verification succeeds\n"
"\n",
progname);
return 1;
@@ -165,7 +169,8 @@ static int Sign(const char* filename, const char* keyblock_file,
return 0;
}
-static int Verify(const char* filename, const char* vblock_file) {
+static int Verify(const char* filename, const char* vblock_file,
+ const char* keyblock_file) {
uint8_t* file_data;
uint64_t file_size;
uint8_t* buf;
@@ -256,6 +261,14 @@ static int Verify(const char* filename, const char* vblock_file) {
}
printf("Body verification succeeded.\n");
+ if (keyblock_file) {
+ if (0 != WriteFile(keyblock_file, key_block, key_block->key_block_size)) {
+ error("Unable to export keyblock file\n");
+ return 1;
+ }
+ printf("Key block exported to %s\n", keyblock_file);
+ }
+
return 0;
}
@@ -329,7 +342,7 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Some required options are missing\n");
return PrintHelp(progname);
}
- return Verify(filename, vblock_file);
+ return Verify(filename, vblock_file, keyblock_file);
default:
fprintf(stderr,
« no previous file with comments | « utility/dev_make_keypair ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698