| 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 * Tests for firmware image library. | 5 * Tests for firmware image library. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 if(argc != 4) { | 207 if(argc != 4) { |
| 208 fprintf(stderr, "Usage: %s <key_algorithm> <key> <processed pubkey>" | 208 fprintf(stderr, "Usage: %s <key_algorithm> <key> <processed pubkey>" |
| 209 " <signing key> <processed signing key>\n", argv[0]); | 209 " <signing key> <processed signing key>\n", argv[0]); |
| 210 return -1; | 210 return -1; |
| 211 } | 211 } |
| 212 | 212 |
| 213 /* Read verification keys and create a test image. */ | 213 /* Read verification keys and create a test image. */ |
| 214 key_algorithm = atoi(argv[1]); | 214 key_algorithm = atoi(argv[1]); |
| 215 | 215 |
| 216 private_key = PrivateKeyRead(argv[2], key_algorithm); | 216 private_key = PrivateKeyReadPem(argv[2], key_algorithm); |
| 217 if (!private_key) { | 217 if (!private_key) { |
| 218 fprintf(stderr, "Error reading private_key"); | 218 fprintf(stderr, "Error reading private_key"); |
| 219 return 1; | 219 return 1; |
| 220 } | 220 } |
| 221 | 221 |
| 222 public_key = PublicKeyReadKeyb(argv[3], key_algorithm, 1); | 222 public_key = PublicKeyReadKeyb(argv[3], key_algorithm, 1); |
| 223 if (!public_key) { | 223 if (!public_key) { |
| 224 fprintf(stderr, "Error reading public_key"); | 224 fprintf(stderr, "Error reading public_key"); |
| 225 return 1; | 225 return 1; |
| 226 } | 226 } |
| 227 | 227 |
| 228 VerifyPublicKeyToRSA(public_key); | 228 VerifyPublicKeyToRSA(public_key); |
| 229 VerifyDataTest(public_key, private_key); | 229 VerifyDataTest(public_key, private_key); |
| 230 VerifyDigestTest(public_key, private_key); | 230 VerifyDigestTest(public_key, private_key); |
| 231 VerifyKernelPreambleTest(public_key, private_key); | 231 VerifyKernelPreambleTest(public_key, private_key); |
| 232 | 232 |
| 233 if (public_key) | 233 if (public_key) |
| 234 Free(public_key); | 234 Free(public_key); |
| 235 if (private_key) | 235 if (private_key) |
| 236 Free(private_key); | 236 Free(private_key); |
| 237 | 237 |
| 238 return error_code; | 238 return error_code; |
| 239 } | 239 } |
| OLD | NEW |