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

Unified Diff: src/platform/vboot_reference/include/firmware_utility.h

Issue 652216: Vboot reference: A basic user-land verified boot firmware signing and verification utility. (Closed)
Patch Set: Style fixes. Segfault fix. 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 side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/include/firmware_utility.h
diff --git a/src/platform/vboot_reference/include/firmware_utility.h b/src/platform/vboot_reference/include/firmware_utility.h
new file mode 100644
index 0000000000000000000000000000000000000000..72cbc851260546326dba6e768da7abe5c4d2a0b9
--- /dev/null
+++ b/src/platform/vboot_reference/include/firmware_utility.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef VBOOT_REFERENCE_FIRMWARE_UTILITY_H_
+#define VBOOT_REFERENCE_FIRMWARE_UTILITY_H_
+
+#include <string>
+
+class FirmwareImage;
+struct RSAPublicKey;
+
+namespace vboot_reference {
+
+// A class for handling verified boot firmware images.
+class FirmwareUtility {
+ public:
+ FirmwareUtility();
+ ~FirmwareUtility();
+
+ // Print usage to stderr.
+ void PrintUsage(void);
+
+ // Parse command line options and populate data members.
+ // Return true on success, false on failure.
+ bool ParseCmdLineOptions(int argc, char* argv[]);
+
+ // Generate a verified boot image by reading firmware data from in_file_.
+ // Return true on success, false on failure.
+ bool GenerateSignedImage();
+
+ // Verify a previously generated signed firmware image using the root key read
+ // from [root_key_pub_file_].
+ bool VerifySignedImage();
+
+ // Output the verified boot image to out_file_.
+ void OutputSignedImage();
+
+
+ bool is_generate() { return is_generate_; }
+ bool is_verify() { return is_verify_; }
+
+ private:
+
+ // Check if all options were specified and sane.
+ // Return true on success, false on failure.
+ bool CheckOptions();
+
+ FirmwareImage* image_;
+ RSAPublicKey* root_key_pub_;
+ std::string root_key_file_;
+ std::string root_key_pub_file_;
+ int firmware_version_;
+ std::string sign_key_file_;
+ std::string sign_key_pub_file_;
+ int key_version_;
+ int sign_algorithm_;
+ std::string in_file_;
+ std::string out_file_;
+ bool is_generate_; // Are we generating a new image?
+ bool is_verify_; // Are we just verifying an already signed image?
+};
+
+} // namespace vboot_reference
+
+#endif // VBOOT_REFERENCE_FIRMWARE_UTILITY_H_
« no previous file with comments | « src/platform/vboot_reference/include/firmware_image.h ('k') | src/platform/vboot_reference/tests/firmware_image_tests.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698