| 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 * Verified boot firmware utility | 5 * Verified boot firmware utility |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <getopt.h> | 8 #include <getopt.h> |
| 9 #include <inttypes.h> /* For PRIu64 */ | 9 #include <inttypes.h> /* For PRIu64 */ |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 /* Print help and return error */ | 46 /* Print help and return error */ |
| 47 static int PrintHelp(void) { | 47 static int PrintHelp(void) { |
| 48 | 48 |
| 49 puts("vbutil_firmware - Verified boot key block utility\n" | 49 puts("vbutil_firmware - Verified boot key block utility\n" |
| 50 "\n" | 50 "\n" |
| 51 "Usage: vbutil_firmware <--vblock|--verify> <file> [OPTIONS]\n" | 51 "Usage: vbutil_firmware <--vblock|--verify> <file> [OPTIONS]\n" |
| 52 "\n" | 52 "\n" |
| 53 "For '--vblock <file>', required OPTIONS are:\n" | 53 "For '--vblock <file>', required OPTIONS are:\n" |
| 54 " --keyblock <file> Key block in .keyblock format\n" | 54 " --keyblock <file> Key block in .keyblock format\n" |
| 55 " --signprivate <file> Signing private key in .pem format\n" | 55 " --signprivate <file> Signing private key in .vbprivk format\n" |
| 56 " --version <number> Firmware version\n" | 56 " --version <number> Firmware version\n" |
| 57 " --fv <file> Firmware volume to sign\n" | 57 " --fv <file> Firmware volume to sign\n" |
| 58 " --kernelkey <file> Kernel subkey in .vbpubk format\n" | 58 " --kernelkey <file> Kernel subkey in .vbpubk format\n" |
| 59 "\n" | 59 "\n" |
| 60 "For '--verify <file>', required OPTIONS are:\n" | 60 "For '--verify <file>', required OPTIONS are:\n" |
| 61 " --signpubkey <file> Signing public key in .vbpubk format\n" | 61 " --signpubkey <file> Signing public key in .vbpubk format\n" |
| 62 " --fv <file> Firmware volume to verify\n" | 62 " --fv <file> Firmware volume to verify\n" |
| 63 ""); | 63 ""); |
| 64 return 1; | 64 return 1; |
| 65 } | 65 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 94 return 1; | 94 return 1; |
| 95 } | 95 } |
| 96 | 96 |
| 97 /* Read the key block and keys */ | 97 /* Read the key block and keys */ |
| 98 key_block = (VbKeyBlockHeader*)ReadFile(keyblock_file, &key_block_size); | 98 key_block = (VbKeyBlockHeader*)ReadFile(keyblock_file, &key_block_size); |
| 99 if (!key_block) { | 99 if (!key_block) { |
| 100 error("Error reading key block.\n"); | 100 error("Error reading key block.\n"); |
| 101 return 1; | 101 return 1; |
| 102 } | 102 } |
| 103 | 103 |
| 104 signing_key = PrivateKeyReadPem(signprivate, key_block->data_key.algorithm); | 104 signing_key = PrivateKeyRead(signprivate); |
| 105 if (!signing_key) { | 105 if (!signing_key) { |
| 106 error("Error reading signing key.\n"); | 106 error("Error reading signing key.\n"); |
| 107 return 1; | 107 return 1; |
| 108 } | 108 } |
| 109 | 109 |
| 110 kernel_subkey = PublicKeyRead(kernelkey_file); | 110 kernel_subkey = PublicKeyRead(kernelkey_file); |
| 111 if (!kernel_subkey) { | 111 if (!kernel_subkey) { |
| 112 error("Error reading kernel subkey.\n"); | 112 error("Error reading kernel subkey.\n"); |
| 113 return 1; | 113 return 1; |
| 114 } | 114 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 case OPT_MODE_VBLOCK: | 321 case OPT_MODE_VBLOCK: |
| 322 return Vblock(filename, key_block_file, signprivate, version, fv_file, | 322 return Vblock(filename, key_block_file, signprivate, version, fv_file, |
| 323 kernelkey_file); | 323 kernelkey_file); |
| 324 case OPT_MODE_VERIFY: | 324 case OPT_MODE_VERIFY: |
| 325 return Verify(filename, signpubkey, fv_file); | 325 return Verify(filename, signpubkey, fv_file); |
| 326 default: | 326 default: |
| 327 printf("Must specify a mode.\n"); | 327 printf("Must specify a mode.\n"); |
| 328 return PrintHelp(); | 328 return PrintHelp(); |
| 329 } | 329 } |
| 330 } | 330 } |
| OLD | NEW |