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

Unified Diff: delta_performer.cc

Issue 5516009: AU: Split applied update verification into a separate step. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: review comments Created 10 years 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_performer.h ('k') | delta_performer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: delta_performer.cc
diff --git a/delta_performer.cc b/delta_performer.cc
index a5b7a729f2618fa0bee9f1fbe805140e3ae9ccec..6eb8aea0ed494d4262862a3ad11c9e3169cc3774 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -174,8 +174,8 @@ void LogPartitionInfoHash(const PartitionInfo& info, const string& tag) {
if (OmahaHashCalculator::Base64Encode(info.hash().data(),
info.hash().size(),
&sha256)) {
- LOG(INFO) << "PartitionInfo " << tag << " sha256:" << sha256
- << " length:" << tag.size();
+ LOG(INFO) << "PartitionInfo " << tag << " sha256: " << sha256
+ << " size: " << info.size();
} else {
LOG(ERROR) << "Base64Encode failed for tag: " << tag;
}
@@ -589,25 +589,21 @@ bool DeltaPerformer::VerifyPayload(
return true;
}
-bool DeltaPerformer::VerifyAppliedUpdate(const string& path,
- const string& kernel_path) {
- LOG(INFO) << "Verifying applied update.";
+bool DeltaPerformer::GetNewPartitionInfo(uint64_t* kernel_size,
+ vector<char>* kernel_hash,
+ uint64_t* rootfs_size,
+ vector<char>* rootfs_hash) {
TEST_AND_RETURN_FALSE(manifest_valid_ &&
manifest_.has_new_kernel_info() &&
manifest_.has_new_rootfs_info());
- const string* paths[] = { &kernel_path, &path };
- const PartitionInfo* infos[] = {
- &manifest_.new_kernel_info(), &manifest_.new_rootfs_info()
- };
- for (size_t i = 0; i < arraysize(paths); ++i) {
- OmahaHashCalculator hasher;
- TEST_AND_RETURN_FALSE(hasher.UpdateFile(*paths[i], infos[i]->size()));
- TEST_AND_RETURN_FALSE(hasher.Finalize());
- TEST_AND_RETURN_FALSE(hasher.raw_hash().size() == infos[i]->hash().size());
- TEST_AND_RETURN_FALSE(memcmp(hasher.raw_hash().data(),
- infos[i]->hash().data(),
- hasher.raw_hash().size()) == 0);
- }
+ *kernel_size = manifest_.new_kernel_info().size();
+ *rootfs_size = manifest_.new_rootfs_info().size();
+ vector<char> new_kernel_hash(manifest_.new_kernel_info().hash().begin(),
+ manifest_.new_kernel_info().hash().end());
+ vector<char> new_rootfs_hash(manifest_.new_rootfs_info().hash().begin(),
+ manifest_.new_rootfs_info().hash().end());
+ kernel_hash->swap(new_kernel_hash);
+ rootfs_hash->swap(new_rootfs_hash);
return true;
}
@@ -616,19 +612,19 @@ bool DeltaPerformer::VerifySourcePartitions() {
CHECK(manifest_valid_);
if (manifest_.has_old_kernel_info()) {
const PartitionInfo& info = manifest_.old_kernel_info();
- TEST_AND_RETURN_FALSE(current_kernel_hash_ != NULL &&
- current_kernel_hash_->size() == info.hash().size() &&
- memcmp(current_kernel_hash_->data(),
+ TEST_AND_RETURN_FALSE(!current_kernel_hash_.empty() &&
+ current_kernel_hash_.size() == info.hash().size() &&
+ memcmp(current_kernel_hash_.data(),
info.hash().data(),
- current_kernel_hash_->size()) == 0);
+ current_kernel_hash_.size()) == 0);
}
if (manifest_.has_old_rootfs_info()) {
const PartitionInfo& info = manifest_.old_rootfs_info();
- TEST_AND_RETURN_FALSE(current_rootfs_hash_ != NULL &&
- current_rootfs_hash_->size() == info.hash().size() &&
- memcmp(current_rootfs_hash_->data(),
+ TEST_AND_RETURN_FALSE(!current_rootfs_hash_.empty() &&
+ current_rootfs_hash_.size() == info.hash().size() &&
+ memcmp(current_rootfs_hash_.data(),
info.hash().data(),
- current_rootfs_hash_->size()) == 0);
+ current_rootfs_hash_.size()) == 0);
}
return true;
}
« no previous file with comments | « delta_performer.h ('k') | delta_performer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698