Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1237)

Side by Side Diff: src/platform/vboot_reference/utils/firmware_utility.cc

Issue 661221: Use uint16_max. (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform/vboot_reference/utils/Makefile ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <getopt.h> 11 #include <getopt.h>
12 #include <stdint.h> // Needed for UINT16_MAX.
13 #include <stdlib.h>
12 #include <unistd.h> 14 #include <unistd.h>
13 #include <stdlib.h>
14 15
15 #include <iostream> 16 #include <iostream>
16 17
17 extern "C" { 18 extern "C" {
18 #include "file_keys.h" 19 #include "file_keys.h"
19 #include "firmware_image.h" 20 #include "firmware_image.h"
20 #include "padding.h" 21 #include "padding.h"
21 #include "rsa_utility.h" 22 #include "rsa_utility.h"
22 #include "sha_utility.h" 23 #include "sha_utility.h"
23 #include "utility.h" 24 #include "utility.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (is_verify_ && root_key_pub_file_.empty()) { 246 if (is_verify_ && root_key_pub_file_.empty()) {
246 cerr << "No pre-processed public root key file specified." << "\n"; 247 cerr << "No pre-processed public root key file specified." << "\n";
247 return false; 248 return false;
248 } 249 }
249 // Required options for --generate. 250 // Required options for --generate.
250 if (is_generate_) { 251 if (is_generate_) {
251 if (root_key_file_.empty()) { 252 if (root_key_file_.empty()) {
252 cerr << "No root key file specified." << "\n"; 253 cerr << "No root key file specified." << "\n";
253 return false; 254 return false;
254 } 255 }
255 if (firmware_version_ <= 0 || firmware_version_ > 0xFFFF) { 256 if (firmware_version_ <= 0 || firmware_version_ > UINT16_MAX) {
256 cerr << "Invalid or no firmware version specified." << "\n"; 257 cerr << "Invalid or no firmware version specified." << "\n";
257 return false; 258 return false;
258 } 259 }
259 if (sign_key_file_.empty()) { 260 if (sign_key_file_.empty()) {
260 cerr << "No signing key file specified." << "\n"; 261 cerr << "No signing key file specified." << "\n";
261 return false; 262 return false;
262 } 263 }
263 if (sign_key_pub_file_.empty()) { 264 if (sign_key_pub_file_.empty()) {
264 cerr << "No pre-processed public signing key file specified." << "\n"; 265 cerr << "No pre-processed public signing key file specified." << "\n";
265 return false; 266 return false;
266 } 267 }
267 if (key_version_ <= 0 || key_version_ > 0xFFFF) { 268 if (key_version_ <= 0 || key_version_ > UINT16_MAX) {
268 cerr << "Invalid or no key version specified." << "\n"; 269 cerr << "Invalid or no key version specified." << "\n";
269 return false; 270 return false;
270 } 271 }
271 if (sign_algorithm_ < 0 || sign_algorithm_ >= kNumAlgorithms) { 272 if (sign_algorithm_ < 0 || sign_algorithm_ >= kNumAlgorithms) {
272 cerr << "Invalid or no signing key algorithm specified." << "\n"; 273 cerr << "Invalid or no signing key algorithm specified." << "\n";
273 return false; 274 return false;
274 } 275 }
275 if (out_file_.empty()) { 276 if (out_file_.empty()) {
276 cerr <<"No output file specified." << "\n"; 277 cerr <<"No output file specified." << "\n";
277 return false; 278 return false;
(...skipping 18 matching lines...) Expand all
296 } 297 }
297 if (fu.is_verify()) { 298 if (fu.is_verify()) {
298 cerr << "Verification "; 299 cerr << "Verification ";
299 if(fu.VerifySignedImage()) 300 if(fu.VerifySignedImage())
300 cerr << "SUCCESS.\n"; 301 cerr << "SUCCESS.\n";
301 else 302 else
302 cerr << "FAILURE.\n"; 303 cerr << "FAILURE.\n";
303 } 304 }
304 return 0; 305 return 0;
305 } 306 }
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/utils/Makefile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698