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

Unified Diff: delta_diff_generator.cc

Issue 6265001: AU: Add support for signing of update payloads after they're generated. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: rename function Created 9 years, 11 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.h ('k') | delta_performer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: delta_diff_generator.cc
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index 4f71c498283a2d170ffaa57b6d7fa1b29cfd1413..0d1e4cef2360af47c1004c256f762b01d97b646b 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -1426,26 +1426,11 @@ bool DeltaDiffGenerator::GenerateDeltaUpdateFile(
// Signatures appear at the end of the blobs. Note the offset in the
// manifest
if (!private_key_path.empty()) {
- LOG(INFO) << "Making room for signature in file";
- manifest.set_signatures_offset(next_blob_offset);
- LOG(INFO) << "set? " << manifest.has_signatures_offset();
- // Add a dummy op at the end to appease older clients
- DeltaArchiveManifest_InstallOperation* dummy_op =
- manifest.add_kernel_install_operations();
- dummy_op->set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
- dummy_op->set_data_offset(next_blob_offset);
- manifest.set_signatures_offset(next_blob_offset);
uint64_t signature_blob_length = 0;
TEST_AND_RETURN_FALSE(
PayloadSigner::SignatureBlobLength(private_key_path,
&signature_blob_length));
- dummy_op->set_data_length(signature_blob_length);
- manifest.set_signatures_size(signature_blob_length);
- Extent* dummy_extent = dummy_op->add_dst_extents();
- // Tell the dummy op to write this data to a big sparse hole
- dummy_extent->set_start_block(kSparseHole);
- dummy_extent->set_num_blocks((signature_blob_length + kBlockSize - 1) /
- kBlockSize);
+ AddSignatureOp(next_blob_offset, signature_blob_length, &manifest);
}
TEST_AND_RETURN_FALSE(InitializePartitionInfos(old_kernel_part,
@@ -1597,6 +1582,27 @@ bool DeltaDiffGenerator::AddInstallOpToBlocksVector(
return true;
}
+void DeltaDiffGenerator::AddSignatureOp(uint64_t signature_blob_offset,
+ uint64_t signature_blob_length,
+ DeltaArchiveManifest* manifest) {
+ LOG(INFO) << "Making room for signature in file";
+ manifest->set_signatures_offset(signature_blob_offset);
+ LOG(INFO) << "set? " << manifest->has_signatures_offset();
+ // Add a dummy op at the end to appease older clients
+ DeltaArchiveManifest_InstallOperation* dummy_op =
+ manifest->add_kernel_install_operations();
+ dummy_op->set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+ dummy_op->set_data_offset(signature_blob_offset);
+ manifest->set_signatures_offset(signature_blob_offset);
+ dummy_op->set_data_length(signature_blob_length);
+ manifest->set_signatures_size(signature_blob_length);
+ Extent* dummy_extent = dummy_op->add_dst_extents();
+ // Tell the dummy op to write this data to a big sparse hole
+ dummy_extent->set_start_block(kSparseHole);
+ dummy_extent->set_num_blocks((signature_blob_length + kBlockSize - 1) /
+ kBlockSize);
+}
+
const char* const kBsdiffPath = "bsdiff";
const char* const kBspatchPath = "bspatch";
const char* const kDeltaMagic = "CrAU";
« no previous file with comments | « delta_diff_generator.h ('k') | delta_performer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698