| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 if (algorithm >= kNumAlgorithms) { | 86 if (algorithm >= kNumAlgorithms) { |
| 87 fprintf(stderr, "Invalid algorithm\n"); | 87 fprintf(stderr, "Invalid algorithm\n"); |
| 88 return 1; | 88 return 1; |
| 89 } | 89 } |
| 90 | 90 |
| 91 data_key = PublicKeyRead(datapubkey); | 91 data_key = PublicKeyRead(datapubkey); |
| 92 if (!data_key) { | 92 if (!data_key) { |
| 93 fprintf(stderr, "vbutil_keyblock: Error reading data key.\n"); | 93 fprintf(stderr, "vbutil_keyblock: Error reading data key.\n"); |
| 94 return 1; | 94 return 1; |
| 95 } | 95 } |
| 96 signing_key = PrivateKeyRead(signprivate, algorithm); | 96 signing_key = PrivateKeyReadPem(signprivate, algorithm); |
| 97 if (!signing_key) { | 97 if (!signing_key) { |
| 98 fprintf(stderr, "vbutil_keyblock: Error reading signing key.\n"); | 98 fprintf(stderr, "vbutil_keyblock: Error reading signing key.\n"); |
| 99 return 1; | 99 return 1; |
| 100 } | 100 } |
| 101 | 101 |
| 102 block = KeyBlockCreate(data_key, signing_key, flags); | 102 block = KeyBlockCreate(data_key, signing_key, flags); |
| 103 Free(data_key); | 103 Free(data_key); |
| 104 Free(signing_key); | 104 Free(signing_key); |
| 105 | 105 |
| 106 if (0 != KeyBlockWrite(outfile, block)) { | 106 if (0 != KeyBlockWrite(outfile, block)) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 switch(mode) { | 224 switch(mode) { |
| 225 case OPT_MODE_PACK: | 225 case OPT_MODE_PACK: |
| 226 return Pack(filename, datapubkey, signprivate, algorithm, flags); | 226 return Pack(filename, datapubkey, signprivate, algorithm, flags); |
| 227 case OPT_MODE_UNPACK: | 227 case OPT_MODE_UNPACK: |
| 228 return Unpack(filename, datapubkey, signpubkey); | 228 return Unpack(filename, datapubkey, signpubkey); |
| 229 default: | 229 default: |
| 230 printf("Must specify a mode.\n"); | 230 printf("Must specify a mode.\n"); |
| 231 return PrintHelp(); | 231 return PrintHelp(); |
| 232 } | 232 } |
| 233 } | 233 } |
| OLD | NEW |