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 // Utility for manipulating verified boot firmware images. | 5 // Utility for manipulating verified boot firmware images. |
6 // | 6 // |
7 | 7 |
8 #include "firmware_utility.h" | 8 #include "firmware_utility.h" |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 if (!root_key_pub_) { | 220 if (!root_key_pub_) { |
221 cerr << "Couldn't read pre-processed public root key.\n"; | 221 cerr << "Couldn't read pre-processed public root key.\n"; |
222 return false; | 222 return false; |
223 } | 223 } |
224 | 224 |
225 if (!image_) { | 225 if (!image_) { |
226 cerr << "Couldn't read firmware image or malformed image.\n"; | 226 cerr << "Couldn't read firmware image or malformed image.\n"; |
227 return false; | 227 return false; |
228 } | 228 } |
229 if (!(error = VerifyFirmwareImage(root_key_pub_, image_, | 229 if (VERIFY_FIRMWARE_SUCCESS == |
230 0))) // Trusted Mode. | 230 (error = VerifyFirmwareImage(root_key_pub_, image_))) |
231 return true; | 231 return true; |
232 cerr << VerifyFirmwareErrorString(error) << "\n"; | 232 cerr << VerifyFirmwareErrorString(error) << "\n"; |
233 return false;; | 233 return false;; |
234 } | 234 } |
235 | 235 |
236 bool FirmwareUtility::CheckOptions(void) { | 236 bool FirmwareUtility::CheckOptions(void) { |
237 // Ensure that only one of --{describe|generate|verify} is set. | 237 // Ensure that only one of --{describe|generate|verify} is set. |
238 if (!((is_describe_ && !is_generate_ && !is_verify_) || | 238 if (!((is_describe_ && !is_generate_ && !is_verify_) || |
239 (!is_describe_ && is_generate_ && !is_verify_) || | 239 (!is_describe_ && is_generate_ && !is_verify_) || |
240 (!is_describe_ && !is_generate_ && is_verify_))) { | 240 (!is_describe_ && !is_generate_ && is_verify_))) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 if (fu.is_verify()) { | 307 if (fu.is_verify()) { |
308 cerr << "Verification "; | 308 cerr << "Verification "; |
309 if (fu.VerifySignedImage()) | 309 if (fu.VerifySignedImage()) |
310 cerr << "SUCCESS.\n"; | 310 cerr << "SUCCESS.\n"; |
311 else | 311 else |
312 cerr << "FAILURE.\n"; | 312 cerr << "FAILURE.\n"; |
313 } | 313 } |
314 return 0; | 314 return 0; |
315 } | 315 } |
OLD | NEW |