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

Unified Diff: omaha_hash_calculator.cc

Issue 3712003: AU: Verify source rootfs/kernel hashes before applying delta. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: verify source partitions only for new updates Created 10 years, 2 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
« no previous file with comments | « omaha_hash_calculator.h ('k') | omaha_hash_calculator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: omaha_hash_calculator.cc
diff --git a/omaha_hash_calculator.cc b/omaha_hash_calculator.cc
index fdc70f01990ad136238efc99042d7b86f008e076..ac4edf480d6589846192cd70318a538a76fa2f8e 100644
--- a/omaha_hash_calculator.cc
+++ b/omaha_hash_calculator.cc
@@ -113,6 +113,20 @@ bool OmahaHashCalculator::RawHashOfData(const vector<char>& data,
return true;
}
+off_t OmahaHashCalculator::RawHashOfFile(const std::string& name, off_t length,
+ std::vector<char>* out_hash) {
+ OmahaHashCalculator calc;
+ off_t res = calc.UpdateFile(name, length);
+ if (res < 0) {
+ return res;
+ }
+ if (!calc.Finalize()) {
+ return -1;
+ }
+ *out_hash = calc.raw_hash();
+ return res;
+}
+
string OmahaHashCalculator::OmahaHashOfBytes(
const void* data, size_t length) {
OmahaHashCalculator calc;
« no previous file with comments | « omaha_hash_calculator.h ('k') | omaha_hash_calculator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698