| 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 | 5 |
| 6 #ifndef VBOOT_REFERENCE_GBB_UTILITY_H_ | 6 #ifndef VBOOT_REFERENCE_GBB_UTILITY_H_ |
| 7 #define VBOOT_REFERENCE_GBB_UTILITY_H_ | 7 #define VBOOT_REFERENCE_GBB_UTILITY_H_ |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> |
| 10 #include "gbb_header.h" | 11 #include "gbb_header.h" |
| 11 | 12 |
| 12 namespace vboot_reference { | 13 namespace vboot_reference { |
| 13 | 14 |
| 14 class GoogleBinaryBlockUtil { | 15 class GoogleBinaryBlockUtil { |
| 15 public: | 16 public: |
| 16 // enumerate of available data fields | 17 // enumerate of available data fields |
| 17 enum PROPINDEX { | 18 enum PROPINDEX { |
| 18 PROP_HWID, // hardware id | 19 PROP_HWID, // hardware id |
| 19 PROP_ROOTKEY, // root key | 20 PROP_ROOTKEY, // root key |
| 20 PROP_BMPFV, // bitmap FV | 21 PROP_BMPFV, // bitmap FV |
| 21 PROP_RCVKEY, // recovery key | 22 PROP_RCVKEY, // recovery key |
| 22 PROP_RANGE, // indicator of valid property range | 23 PROP_RANGE, // indicator of valid property range |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 GoogleBinaryBlockUtil(); | 26 GoogleBinaryBlockUtil(); |
| 26 ~GoogleBinaryBlockUtil(); | 27 ~GoogleBinaryBlockUtil(); |
| 27 | 28 |
| 28 // load GBB from a BIOS image file. | 29 // load GBB from a BIOS image file. |
| 29 // return true if a valid GBB was retrieved. | 30 // return true if a valid GBB was retrieved. |
| 30 bool load_from_file(const char *filename); | 31 bool load_from_file(const char *filename); |
| 31 | 32 |
| 32 // save loaded (and modified) GBB with BIOS image to new file | 33 // save loaded (and modified) GBB with BIOS image to new file |
| 33 // return true on success. | 34 // return true on success. |
| 34 bool save_to_file(const char *filename); | 35 bool save_to_file(const char *filename); |
| 35 | 36 |
| 37 // create a new GBB blob by providing a list of reserved data size for each |
| 38 // properties, following the order described in GoogleBinaryBlockHeader. |
| 39 // return true on success. |
| 40 bool create_new(const std::vector<uint32_t> &create_param); |
| 41 |
| 36 // retrieve the value of a property from GBB data. | 42 // retrieve the value of a property from GBB data. |
| 37 // return the property value. | 43 // return the property value. |
| 38 std::string get_property(PROPINDEX i) const; | 44 std::string get_property(PROPINDEX i) const; |
| 39 | 45 |
| 40 // overwrite a property in GBB data. | 46 // overwrite a property in GBB data. |
| 41 // return true on success. | 47 // return true on success. |
| 42 bool set_property(PROPINDEX i, const std::string &value); | 48 bool set_property(PROPINDEX i, const std::string &value); |
| 43 | 49 |
| 44 // get a readable name by a property index. | 50 // get a readable name by a property index. |
| 45 // return the name for valid properties, otherwise unexpected empty string. | 51 // return the name for valid properties, otherwise unexpected empty string. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 std::string file_content_; // complete image file content | 85 std::string file_content_; // complete image file content |
| 80 long header_offset_; // offset to GBB header in file_content_ | 86 long header_offset_; // offset to GBB header in file_content_ |
| 81 bool is_valid_gbb; // if we are holding a valid GBB | 87 bool is_valid_gbb; // if we are holding a valid GBB |
| 82 | 88 |
| 83 bool verbose; // provide verbose messages | 89 bool verbose; // provide verbose messages |
| 84 }; | 90 }; |
| 85 | 91 |
| 86 } // namespace vboot_reference | 92 } // namespace vboot_reference |
| 87 | 93 |
| 88 #endif // VBOOT_REFERENCE_GBB_UTILITY_H_ | 94 #endif // VBOOT_REFERENCE_GBB_UTILITY_H_ |
| 89 | |
| OLD | NEW |