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 key block utility | 5 * Verified boot key block 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 <stdio.h> | 10 #include <stdio.h> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (!signpubkey) { | 131 if (!signpubkey) { |
132 fprintf(stderr, | 132 fprintf(stderr, |
133 "vbutil_keyblock: keyblock requires public key to verify\n"); | 133 "vbutil_keyblock: keyblock requires public key to verify\n"); |
134 return 1; | 134 return 1; |
135 } | 135 } |
136 sign_key = PublicKeyRead(signpubkey); | 136 sign_key = PublicKeyRead(signpubkey); |
137 if (!sign_key) { | 137 if (!sign_key) { |
138 fprintf(stderr, "vbutil_keyblock: Error reading signpubkey.\n"); | 138 fprintf(stderr, "vbutil_keyblock: Error reading signpubkey.\n"); |
139 return 1; | 139 return 1; |
140 } | 140 } |
141 if (0 != KeyBlockVerify(block, block->key_block_size, sign_key)) { | 141 if (0 != KeyBlockVerify(block, block->key_block_size, sign_key, 0)) { |
142 fprintf(stderr, "vbutil_keyblock: Error verifying key block.\n"); | 142 fprintf(stderr, "vbutil_keyblock: Error verifying key block.\n"); |
143 return 1; | 143 return 1; |
144 } | 144 } |
145 printf("Signature algorithm: %" PRIu64 " %s\n", sign_key->algorithm, | 145 printf("Signature algorithm: %" PRIu64 " %s\n", sign_key->algorithm, |
146 (sign_key->algorithm < kNumAlgorithms ? | 146 (sign_key->algorithm < kNumAlgorithms ? |
147 algo_strings[sign_key->algorithm] : "(invalid)")); | 147 algo_strings[sign_key->algorithm] : "(invalid)")); |
148 Free(sign_key); | 148 Free(sign_key); |
149 } else { | 149 } else { |
150 printf("Signature Algorithm: <none>\n"); | 150 printf("Signature Algorithm: <none>\n"); |
151 } | 151 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 switch(mode) { | 232 switch(mode) { |
233 case OPT_MODE_PACK: | 233 case OPT_MODE_PACK: |
234 return Pack(filename, datapubkey, signprivate, flags); | 234 return Pack(filename, datapubkey, signprivate, flags); |
235 case OPT_MODE_UNPACK: | 235 case OPT_MODE_UNPACK: |
236 return Unpack(filename, datapubkey, signpubkey); | 236 return Unpack(filename, datapubkey, signpubkey); |
237 default: | 237 default: |
238 printf("Must specify a mode.\n"); | 238 printf("Must specify a mode.\n"); |
239 return PrintHelp(progname); | 239 return PrintHelp(progname); |
240 } | 240 } |
241 } | 241 } |
OLD | NEW |