| 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 #ifndef VBOOT_REFERENCE_KERNEL_UTILITY_H_ | 5 #ifndef VBOOT_REFERENCE_KERNEL_UTILITY_H_ |
| 6 #define VBOOT_REFERENCE_KERNEL_UTILITY_H_ | 6 #define VBOOT_REFERENCE_KERNEL_UTILITY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 extern "C" { | 10 extern "C" { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 KernelUtility(); | 21 KernelUtility(); |
| 22 ~KernelUtility(); | 22 ~KernelUtility(); |
| 23 | 23 |
| 24 // Print usage to stderr. | 24 // Print usage to stderr. |
| 25 void PrintUsage(void); | 25 void PrintUsage(void); |
| 26 | 26 |
| 27 // Parse command line options and populate data members. | 27 // Parse command line options and populate data members. |
| 28 // Return true on success, false on failure. | 28 // Return true on success, false on failure. |
| 29 bool ParseCmdLineOptions(int argc, char* argv[]); | 29 bool ParseCmdLineOptions(int argc, char* argv[]); |
| 30 | 30 |
| 31 // Print description of a verified boot kernel image. |
| 32 void DescribeSignedImage(); |
| 33 |
| 31 // Generate a verified boot image by reading kernel data from in_file_. | 34 // Generate a verified boot image by reading kernel data from in_file_. |
| 32 // Return true on success, false on failure. | 35 // Return true on success, false on failure. |
| 33 bool GenerateSignedImage(); | 36 bool GenerateSignedImage(); |
| 34 | 37 |
| 35 // Verify a previously generated signed firmware image using the key read | 38 // Verify a previously generated signed firmware image using the key read |
| 36 // from [firmware_key_pub_file_]. | 39 // from [firmware_key_pub_file_]. |
| 37 bool VerifySignedImage(); | 40 bool VerifySignedImage(); |
| 38 | 41 |
| 39 // Output the verified boot kernel image to out_file_. | 42 // Output the verified boot kernel image to out_file_. |
| 40 void OutputSignedImage(); | 43 void OutputSignedImage(); |
| 41 | 44 |
| 42 bool is_generate() { return is_generate_; } | 45 bool is_generate() { return is_generate_; } |
| 43 bool is_verify() { return is_verify_; } | 46 bool is_verify() { return is_verify_; } |
| 47 bool is_describe() { return is_describe_; } |
| 44 | 48 |
| 45 private: | 49 private: |
| 46 | 50 |
| 47 // Check if all options were specified and sane. | 51 // Check if all options were specified and sane. |
| 48 // Return true on success, false on failure. | 52 // Return true on success, false on failure. |
| 49 bool CheckOptions(); | 53 bool CheckOptions(); |
| 50 | 54 |
| 51 KernelImage* image_; | 55 KernelImage* image_; |
| 52 RSAPublicKey* firmware_key_pub_; // Root key used for verification. | 56 RSAPublicKey* firmware_key_pub_; // Root key used for verification. |
| 53 std::string firmware_key_file_; // Private key for signing the kernel key. | 57 std::string firmware_key_file_; // Private key for signing the kernel key. |
| 54 std::string firmware_key_pub_file_; | 58 std::string firmware_key_pub_file_; |
| 55 std::string kernel_key_file_; // Private key for signing the kernel. | 59 std::string kernel_key_file_; // Private key for signing the kernel. |
| 56 std::string kernel_key_pub_file_; | 60 std::string kernel_key_pub_file_; |
| 57 | 61 |
| 58 // Fields of a KernelImage. (read from the command line). | 62 // Fields of a KernelImage. (read from the command line). |
| 59 int header_version_; | 63 int header_version_; |
| 60 int firmware_sign_algorithm_; | 64 int firmware_sign_algorithm_; |
| 61 int kernel_sign_algorithm_; | 65 int kernel_sign_algorithm_; |
| 62 int kernel_key_version_; | 66 int kernel_key_version_; |
| 63 int kernel_version_; | 67 int kernel_version_; |
| 64 kconfig_options options_; | 68 kconfig_options options_; |
| 65 | 69 |
| 66 std::string in_file_; | 70 std::string in_file_; |
| 67 std::string out_file_; | 71 std::string out_file_; |
| 68 bool is_generate_; // Are we generating a new image? | 72 bool is_generate_; // Are we generating a new image? |
| 69 bool is_verify_; // Are we just verifying an already signed image? | 73 bool is_verify_; // Are we just verifying an already signed image? |
| 74 bool is_describe_; // Should we print out description of the image? |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 } // namespace vboot_reference | 77 } // namespace vboot_reference |
| 73 | 78 |
| 74 #endif // VBOOT_REFERENCE_FIRMWARE_UTILITY_H_ | 79 #endif // VBOOT_REFERENCE_FIRMWARE_UTILITY_H_ |
| OLD | NEW |