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

Unified Diff: delta_performer.h

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 | « delta_diff_generator.cc ('k') | delta_performer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: delta_performer.h
diff --git a/delta_performer.h b/delta_performer.h
index 7394f940acacb9b7d23c92744f547ff304f80fb3..0e3cb93aea18c8e3686894af6de4614f2b13c1eb 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -34,7 +34,9 @@ class DeltaPerformer : public FileWriter {
next_operation_num_(0),
buffer_offset_(0),
last_updated_buffer_offset_(kuint64max),
- block_size_(0) {}
+ block_size_(0),
+ current_kernel_hash_(NULL),
+ current_rootfs_hash_(NULL) {}
// Opens the kernel. Should be called before or after Open(), but before
// Write(). The kernel file will be close()d when Close() is called.
@@ -94,6 +96,14 @@ class DeltaPerformer : public FileWriter {
// success, false otherwise.
static bool ResetUpdateProgress(PrefsInterface* prefs, bool quick);
+ void set_current_kernel_hash(const std::vector<char>* hash) {
+ current_kernel_hash_ = hash;
+ }
+
+ void set_current_rootfs_hash(const std::vector<char>* hash) {
+ current_rootfs_hash_ = hash;
+ }
+
private:
friend class DeltaPerformerTest;
FRIEND_TEST(DeltaPerformerTest, IsIdempotentOperationTest);
@@ -101,6 +111,12 @@ class DeltaPerformer : public FileWriter {
static bool IsIdempotentOperation(
const DeltaArchiveManifest_InstallOperation& op);
+ // Verifies that the expected source partition hashes (if present) match the
+ // hashes for the current partitions. Returns true if there're no expected
+ // hashes in the payload (e.g., if it's a new-style full update) or if the
+ // hashes match; returns false otherwise.
+ bool VerifySourcePartitions();
+
// Returns true if enough of the delta file has been passed via Write()
// to be able to perform a given install operation.
bool CanPerformInstallOperation(
@@ -181,6 +197,11 @@ class DeltaPerformer : public FileWriter {
// Signatures message blob extracted directly from the payload.
std::vector<char> signatures_message_data_;
+ // Hashes for the current partitions to be used for source partition
+ // verification.
+ const std::vector<char>* current_kernel_hash_;
+ const std::vector<char>* current_rootfs_hash_;
+
DISALLOW_COPY_AND_ASSIGN(DeltaPerformer);
};
« no previous file with comments | « delta_diff_generator.cc ('k') | delta_performer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698