| 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 kernel utility | 5 * Verified boot kernel utility |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <getopt.h> | 9 #include <getopt.h> |
| 10 #include <inttypes.h> /* For PRIu64 */ | 10 #include <inttypes.h> /* For PRIu64 */ |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 key_block = (VbKeyBlockHeader*)ReadFile(keyblock_file, &key_block_size); | 453 key_block = (VbKeyBlockHeader*)ReadFile(keyblock_file, &key_block_size); |
| 454 if (!key_block) { | 454 if (!key_block) { |
| 455 error("Error reading key block.\n"); | 455 error("Error reading key block.\n"); |
| 456 return 1; | 456 return 1; |
| 457 } | 457 } |
| 458 if (pad < key_block->key_block_size) { | 458 if (pad < key_block->key_block_size) { |
| 459 error("Pad too small\n"); | 459 error("Pad too small\n"); |
| 460 return 1; | 460 return 1; |
| 461 } | 461 } |
| 462 | 462 |
| 463 signing_key = PrivateKeyReadPem(signprivate, key_block->data_key.algorithm); | 463 signing_key = PrivateKeyRead(signprivate); |
| 464 if (!signing_key) { | 464 if (!signing_key) { |
| 465 error("Error reading signing key.\n"); | 465 error("Error reading signing key.\n"); |
| 466 return 1; | 466 return 1; |
| 467 } | 467 } |
| 468 | 468 |
| 469 /* Sign the kernel data */ | 469 /* Sign the kernel data */ |
| 470 body_sig = CalculateSignature(bp->blob, bp->blob_size, signing_key); | 470 body_sig = CalculateSignature(bp->blob, bp->blob_size, signing_key); |
| 471 if (!body_sig) { | 471 if (!body_sig) { |
| 472 error("Error calculating body signature\n"); | 472 error("Error calculating body signature\n"); |
| 473 return 1; | 473 return 1; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 716 |
| 717 case OPT_MODE_VERIFY: | 717 case OPT_MODE_VERIFY: |
| 718 return Verify(filename, signpubkey); | 718 return Verify(filename, signpubkey); |
| 719 | 719 |
| 720 default: | 720 default: |
| 721 fprintf(stderr, | 721 fprintf(stderr, |
| 722 "You must specify a mode: --pack, --repack or --verify\n"); | 722 "You must specify a mode: --pack, --repack or --verify\n"); |
| 723 return PrintHelp(progname); | 723 return PrintHelp(progname); |
| 724 } | 724 } |
| 725 } | 725 } |
| OLD | NEW |