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

Unified Diff: utility/load_kernel_test.c

Issue 2762009: Add vbutil_key (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Util to pack/unpack .vbpubk files Created 10 years, 6 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/Makefile ('k') | utility/vbutil_key.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utility/load_kernel_test.c
diff --git a/utility/load_kernel_test.c b/utility/load_kernel_test.c
index 7beb414ef7b582c0069b4bac643820a1a6b929c6..6d3d81c8efbf0ed7e1ab299ff641f3d79546d15c 100644
--- a/utility/load_kernel_test.c
+++ b/utility/load_kernel_test.c
@@ -15,6 +15,7 @@
#include "load_kernel_fw.h"
#include "boot_device.h"
+#include "host_common.h"
#include "rollback_index.h"
#include "utility.h"
@@ -95,25 +96,12 @@ int main(int argc, char* argv[]) {
/* Read header signing key blob */
{
- FILE* f;
- int key_size;
- printf("Reading key from: %s\n", keyfile_name);
- f = fopen(keyfile_name, "rb");
- if (!f) {
- fprintf(stderr, "Unable to open key file %s\n", keyfile_name);
+ uint64_t key_size;
+ lkp.header_sign_key_blob = ReadFile(keyfile_name, &key_size);
+ if (!lkp.header_sign_key_blob)
+ fprintf(stderr, "Unable to read key file %s\n", keyfile_name);
return 1;
}
- fseek(f, 0, SEEK_END);
- key_size = ftell(f);
- rewind(f);
- lkp.header_sign_key_blob = Malloc(key_size);
- printf("Reading %d bytes of key\n", key_size);
- if (fread(lkp.header_sign_key_blob, key_size, 1, f) != 1) {
- fprintf(stderr, "Unable to read key data\n");
- return 1;
- }
- fclose(f);
- }
/* Get image size */
printf("Reading from image: %s\n", image_name);
« no previous file with comments | « utility/Makefile ('k') | utility/vbutil_key.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698