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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 printf(" Flags: %" PRIu64 "\n", key_block->key_block_flags); | 654 printf(" Flags: %" PRIu64 "\n", key_block->key_block_flags); |
655 | 655 |
656 rsa = PublicKeyToRSA(&key_block->data_key); | 656 rsa = PublicKeyToRSA(&key_block->data_key); |
657 if (!rsa) { | 657 if (!rsa) { |
658 error("Error parsing data key.\n"); | 658 error("Error parsing data key.\n"); |
659 goto verify_exit; | 659 goto verify_exit; |
660 } | 660 } |
661 | 661 |
662 /* Verify preamble */ | 662 /* Verify preamble */ |
663 preamble = bp->preamble; | 663 preamble = bp->preamble; |
664 if (0 != VerifyKernelPreamble2( | 664 if (0 != VerifyKernelPreamble( |
665 preamble, bp->blob_size - key_block->key_block_size, rsa)) { | 665 preamble, bp->blob_size - key_block->key_block_size, rsa)) { |
666 error("Error verifying preamble.\n"); | 666 error("Error verifying preamble.\n"); |
667 goto verify_exit; | 667 goto verify_exit; |
668 } | 668 } |
669 now += preamble->preamble_size; | 669 now += preamble->preamble_size; |
670 | 670 |
671 printf("Preamble:\n"); | 671 printf("Preamble:\n"); |
672 printf(" Size: 0x%" PRIx64 "\n", preamble->preamble_size); | 672 printf(" Size: 0x%" PRIx64 "\n", preamble->preamble_size); |
673 printf(" Header version: %" PRIu32 ".%" PRIu32"\n", | 673 printf(" Header version: %" PRIu32 ".%" PRIu32"\n", |
674 preamble->header_version_major, preamble->header_version_minor); | 674 preamble->header_version_major, preamble->header_version_minor); |
675 printf(" Kernel version: %" PRIu64 "\n", preamble->kernel_version); | 675 printf(" Kernel version: %" PRIu64 "\n", preamble->kernel_version); |
676 printf(" Body load address: 0x%" PRIx64 "\n", preamble->body_load_address); | 676 printf(" Body load address: 0x%" PRIx64 "\n", preamble->body_load_address); |
677 printf(" Body size: 0x%" PRIx64 "\n", | 677 printf(" Body size: 0x%" PRIx64 "\n", |
678 preamble->body_signature.data_size); | 678 preamble->body_signature.data_size); |
679 printf(" Bootloader address: 0x%" PRIx64 "\n", preamble->bootloader_address)
; | 679 printf(" Bootloader address: 0x%" PRIx64 "\n", |
| 680 preamble->bootloader_address); |
680 printf(" Bootloader size: 0x%" PRIx64 "\n", preamble->bootloader_size); | 681 printf(" Bootloader size: 0x%" PRIx64 "\n", preamble->bootloader_size); |
681 | 682 |
682 /* Verify body */ | 683 /* Verify body */ |
683 if (0 != VerifyData(bp->blob, &preamble->body_signature, rsa)) { | 684 if (0 != VerifyData(bp->blob, bp->blob_size, &preamble->body_signature, |
| 685 rsa)) { |
684 error("Error verifying kernel body.\n"); | 686 error("Error verifying kernel body.\n"); |
685 goto verify_exit; | 687 goto verify_exit; |
686 } | 688 } |
687 printf("Body verification succeeded.\n"); | 689 printf("Body verification succeeded.\n"); |
688 | 690 |
689 rv = 0; | 691 rv = 0; |
690 | 692 |
691 if (!verbose) { | 693 if (!verbose) { |
692 goto verify_exit; | 694 goto verify_exit; |
693 } | 695 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 | 834 |
833 case OPT_MODE_VERIFY: | 835 case OPT_MODE_VERIFY: |
834 return Verify(filename, signpubkey, verbose); | 836 return Verify(filename, signpubkey, verbose); |
835 | 837 |
836 default: | 838 default: |
837 fprintf(stderr, | 839 fprintf(stderr, |
838 "You must specify a mode: --pack, --repack or --verify\n"); | 840 "You must specify a mode: --pack, --repack or --verify\n"); |
839 return PrintHelp(progname); | 841 return PrintHelp(progname); |
840 } | 842 } |
841 } | 843 } |
OLD | NEW |