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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 int main(int argc, char* argv[]) { | 143 int main(int argc, char* argv[]) { |
144 uint64_t len; | 144 uint64_t len; |
145 uint8_t* firmware_sign_key_buf = NULL; | 145 uint8_t* firmware_sign_key_buf = NULL; |
146 uint8_t* root_key_blob = NULL; | 146 uint8_t* root_key_blob = NULL; |
147 uint8_t* firmware_blob = NULL; | 147 uint8_t* firmware_blob = NULL; |
148 uint64_t firmware_blob_len = 0; | 148 uint64_t firmware_blob_len = 0; |
149 FirmwareImage* image = NULL; | 149 FirmwareImage* image = NULL; |
150 RSAPublicKey* root_key = NULL; | 150 RSAPublicKey* root_key = NULL; |
151 int error_code = 1; | 151 int error_code = 0; |
152 | 152 |
153 if(argc != 6) { | 153 if(argc != 6) { |
154 fprintf(stderr, "Usage: %s <algorithm> <root key> <processed root pubkey>" | 154 fprintf(stderr, "Usage: %s <algorithm> <root key> <processed root pubkey>" |
155 " <signing key> <processed signing key>\n", argv[0]); | 155 " <signing key> <processed signing key>\n", argv[0]); |
156 return -1; | 156 return -1; |
157 } | 157 } |
158 | 158 |
159 /* Read verification keys and create a test image. */ | 159 /* Read verification keys and create a test image. */ |
160 root_key = RSAPublicKeyFromFile(argv[3]); | 160 root_key = RSAPublicKeyFromFile(argv[3]); |
161 root_key_blob = BufferFromFile(argv[3], &len); | 161 root_key_blob = BufferFromFile(argv[3], &len); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 failure: | 196 failure: |
197 Free(firmware_blob); | 197 Free(firmware_blob); |
198 FirmwareImageFree(image); | 198 FirmwareImageFree(image); |
199 Free(firmware_sign_key_buf); | 199 Free(firmware_sign_key_buf); |
200 Free(root_key_blob); | 200 Free(root_key_blob); |
201 RSAPublicKeyFree(root_key); | 201 RSAPublicKeyFree(root_key); |
202 | 202 |
203 return error_code; | 203 return error_code; |
204 } | 204 } |
OLD | NEW |