| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Utility for signing boot firmware images. | 5 * Utility for signing boot firmware images. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| 11 | 11 |
| 12 #include "file_keys.h" | 12 #include "file_keys.h" |
| 13 #include "utility.h" | 13 #include "utility.h" |
| 14 #include "host_key.h" | 14 #include "host_key.h" |
| 15 #include "host_signature.h" | 15 #include "host_signature.h" |
| 16 #include "host_common.h" | 16 #include "host_common.h" |
| 17 | 17 |
| 18 static void usage() | 18 static void usage() |
| 19 { | 19 { |
| 20 static char* help_mesg = | 20 static char* help_mesg = |
| 21 "Usage: sign_image <fw_version> <fw_key_block> <signing_key> " | 21 "Usage: sign_image <fw_version> <fw_key_block> <signing_key> " |
| 22 "<kernel_public_key> <firmware_file> <output_file>\n"; | 22 "<kernel_public_key> <firmware_file> <output_file>\n"; |
| 23 printf(help_mesg); | 23 printf("%s", help_mesg); |
| 24 } | 24 } |
| 25 | 25 |
| 26 int SignAndWriteImage(uint64_t fw_version, VbKeyBlockHeader* wrapper_kb, | 26 int SignAndWriteImage(uint64_t fw_version, VbKeyBlockHeader* wrapper_kb, |
| 27 VbPrivateKey* signing_key, | 27 VbPrivateKey* signing_key, |
| 28 VbPublicKey* nested_pubkey, | 28 VbPublicKey* nested_pubkey, |
| 29 uint8_t* image, uint64_t image_size, | 29 uint8_t* image, uint64_t image_size, |
| 30 FILE* out_file) | 30 FILE* out_file) |
| 31 { | 31 { |
| 32 VbFirmwarePreambleHeader* fw_preamble = NULL; | 32 VbFirmwarePreambleHeader* fw_preamble = NULL; |
| 33 int rv = 1; | 33 int rv = 1; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 rv = SignAndWriteImage(version, firmware_kb, signing_key, | 107 rv = SignAndWriteImage(version, firmware_kb, signing_key, |
| 108 kernel_pubk, firmware, fw_size, out_file); | 108 kernel_pubk, firmware, fw_size, out_file); |
| 109 | 109 |
| 110 fclose(out_file); | 110 fclose(out_file); |
| 111 if (rv) { | 111 if (rv) { |
| 112 unlink(argv[6]); | 112 unlink(argv[6]); |
| 113 } | 113 } |
| 114 return rv; | 114 return rv; |
| 115 } | 115 } |
| OLD | NEW |