| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| 152 | 152 |
| 153 printf("Key block file: %s\n", infile); | 153 printf("Key block file: %s\n", infile); |
| 154 printf("Flags: %" PRIu64 "\n", block->key_block_flags); | 154 printf("Flags: %" PRIu64 "\n", block->key_block_flags); |
| 155 if (block->key_block_flags & KEY_BLOCK_FLAG_DEVELOPER_0) |
| 156 printf(" !DEV"); |
| 157 if (block->key_block_flags & KEY_BLOCK_FLAG_DEVELOPER_1) |
| 158 printf(" DEV"); |
| 159 if (block->key_block_flags & KEY_BLOCK_FLAG_RECOVERY_0) |
| 160 printf(" !REC"); |
| 161 if (block->key_block_flags & KEY_BLOCK_FLAG_RECOVERY_1) |
| 162 printf(" REC"); |
| 163 printf("\n"); |
| 155 | 164 |
| 156 data_key = &block->data_key; | 165 data_key = &block->data_key; |
| 157 printf("Data key algorithm: %" PRIu64 " %s\n", data_key->algorithm, | 166 printf("Data key algorithm: %" PRIu64 " %s\n", data_key->algorithm, |
| 158 (data_key->algorithm < kNumAlgorithms ? | 167 (data_key->algorithm < kNumAlgorithms ? |
| 159 algo_strings[data_key->algorithm] : "(invalid)")); | 168 algo_strings[data_key->algorithm] : "(invalid)")); |
| 160 printf("Data key version: %" PRIu64 "\n", data_key->key_version); | 169 printf("Data key version: %" PRIu64 "\n", data_key->key_version); |
| 170 printf("Data key sha1sum: "); |
| 171 PrintPubKeySha1Sum(data_key); |
| 172 printf("\n"); |
| 161 | 173 |
| 162 if (datapubkey) { | 174 if (datapubkey) { |
| 163 if (0 != PublicKeyWrite(datapubkey, data_key)) { | 175 if (0 != PublicKeyWrite(datapubkey, data_key)) { |
| 164 fprintf(stderr, | 176 fprintf(stderr, |
| 165 "vbutil_keyblock: unable to write public key\n"); | 177 "vbutil_keyblock: unable to write public key\n"); |
| 166 return 1; | 178 return 1; |
| 167 } | 179 } |
| 168 } | 180 } |
| 169 | 181 |
| 170 Free(block); | 182 Free(block); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 switch(mode) { | 244 switch(mode) { |
| 233 case OPT_MODE_PACK: | 245 case OPT_MODE_PACK: |
| 234 return Pack(filename, datapubkey, signprivate, flags); | 246 return Pack(filename, datapubkey, signprivate, flags); |
| 235 case OPT_MODE_UNPACK: | 247 case OPT_MODE_UNPACK: |
| 236 return Unpack(filename, datapubkey, signpubkey); | 248 return Unpack(filename, datapubkey, signpubkey); |
| 237 default: | 249 default: |
| 238 printf("Must specify a mode.\n"); | 250 printf("Must specify a mode.\n"); |
| 239 return PrintHelp(progname); | 251 return PrintHelp(progname); |
| 240 } | 252 } |
| 241 } | 253 } |
| OLD | NEW |