update_engine: Rename "chromeos" -> "brillo" in include paths and namespaces
libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.
Bug: 24872993
Change-Id: I770659a95be380a50fe3b2ba9f91d65818f40945
diff --git a/payload_generator/ab_generator.cc b/payload_generator/ab_generator.cc
index 065408b..5cb0b17 100644
--- a/payload_generator/ab_generator.cc
+++ b/payload_generator/ab_generator.cc
@@ -272,7 +272,7 @@
TEST_AND_RETURN_FALSE(aop->op.type() == InstallOperation::REPLACE ||
aop->op.type() == InstallOperation::REPLACE_BZ);
- chromeos::Blob data(aop->op.dst_length());
+ brillo::Blob data(aop->op.dst_length());
vector<Extent> dst_extents;
ExtentsToVector(aop->op.dst_extents(), &dst_extents);
TEST_AND_RETURN_FALSE(utils::ReadExtents(target_part_path,
@@ -281,11 +281,11 @@
data.size(),
kBlockSize));
- chromeos::Blob data_bz;
+ brillo::Blob data_bz;
TEST_AND_RETURN_FALSE(BzipCompress(data, &data_bz));
CHECK(!data_bz.empty());
- chromeos::Blob* data_p = nullptr;
+ brillo::Blob* data_p = nullptr;
InstallOperation_Type new_op_type;
if (data_bz.size() < data.size()) {
new_op_type = InstallOperation::REPLACE_BZ;
diff --git a/payload_generator/ab_generator.h b/payload_generator/ab_generator.h
index 7c89ed6..25a7811 100644
--- a/payload_generator/ab_generator.h
+++ b/payload_generator/ab_generator.h
@@ -21,7 +21,7 @@
#include <vector>
#include <base/macros.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include "update_engine/payload_constants.h"
#include "update_engine/payload_generator/blob_file_writer.h"
diff --git a/payload_generator/ab_generator_unittest.cc b/payload_generator/ab_generator_unittest.cc
index 77e2e24..cd4ee0a 100644
--- a/payload_generator/ab_generator_unittest.cc
+++ b/payload_generator/ab_generator_unittest.cc
@@ -59,7 +59,7 @@
"SplitReplaceOrReplaceBzTest_part.XXXXXX", &part_path, nullptr));
ScopedPathUnlinker part_path_unlinker(part_path);
const size_t part_size = part_num_blocks * kBlockSize;
- chromeos::Blob part_data;
+ brillo::Blob part_data;
if (compressible) {
part_data.resize(part_size);
test_utils::FillWithData(&part_data);
@@ -85,14 +85,14 @@
op_ex2_num_blocks);
op.set_dst_length(op_ex1_num_blocks + op_ex2_num_blocks);
- chromeos::Blob op_data;
+ brillo::Blob op_data;
op_data.insert(op_data.end(),
part_data.begin() + op_ex1_offset,
part_data.begin() + op_ex1_offset + op_ex1_size);
op_data.insert(op_data.end(),
part_data.begin() + op_ex2_offset,
part_data.begin() + op_ex2_offset + op_ex2_size);
- chromeos::Blob op_blob;
+ brillo::Blob op_blob;
if (orig_type == InstallOperation::REPLACE) {
op_blob = op_data;
} else {
@@ -137,10 +137,10 @@
EXPECT_TRUE(ExtentEquals(first_op.dst_extents(0), op_ex1_start_block,
op_ex1_num_blocks));
// Obtain the expected blob.
- chromeos::Blob first_expected_data(
+ brillo::Blob first_expected_data(
part_data.begin() + op_ex1_offset,
part_data.begin() + op_ex1_offset + op_ex1_size);
- chromeos::Blob first_expected_blob;
+ brillo::Blob first_expected_blob;
if (compressible) {
ASSERT_TRUE(BzipCompress(first_expected_data, &first_expected_blob));
} else {
@@ -148,7 +148,7 @@
}
EXPECT_EQ(first_expected_blob.size(), first_op.data_length());
// Check that the actual blob matches what's expected.
- chromeos::Blob first_data_blob(first_op.data_length());
+ brillo::Blob first_data_blob(first_op.data_length());
ssize_t bytes_read;
ASSERT_TRUE(utils::PReadAll(data_fd,
first_data_blob.data(),
@@ -166,10 +166,10 @@
EXPECT_TRUE(ExtentEquals(second_op.dst_extents(0), op_ex2_start_block,
op_ex2_num_blocks));
// Obtain the expected blob.
- chromeos::Blob second_expected_data(
+ brillo::Blob second_expected_data(
part_data.begin() + op_ex2_offset,
part_data.begin() + op_ex2_offset + op_ex2_size);
- chromeos::Blob second_expected_blob;
+ brillo::Blob second_expected_blob;
if (compressible) {
ASSERT_TRUE(BzipCompress(second_expected_data, &second_expected_blob));
} else {
@@ -177,7 +177,7 @@
}
EXPECT_EQ(second_expected_blob.size(), second_op.data_length());
// Check that the actual blob matches what's expected.
- chromeos::Blob second_data_blob(second_op.data_length());
+ brillo::Blob second_data_blob(second_op.data_length());
ASSERT_TRUE(utils::PReadAll(data_fd,
second_data_blob.data(),
second_op.data_length(),
@@ -210,7 +210,7 @@
"MergeReplaceOrReplaceBzTest_part.XXXXXX", &part_path, nullptr));
ScopedPathUnlinker part_path_unlinker(part_path);
const size_t part_size = part_num_blocks * kBlockSize;
- chromeos::Blob part_data;
+ brillo::Blob part_data;
if (compressible) {
part_data.resize(part_size);
test_utils::FillWithData(&part_data);
@@ -225,7 +225,7 @@
// Create original operations and blob data.
vector<AnnotatedOperation> aops;
- chromeos::Blob blob_data;
+ brillo::Blob blob_data;
const size_t total_op_size = total_op_num_blocks * kBlockSize;
InstallOperation first_op;
@@ -233,9 +233,9 @@
const size_t first_op_size = first_op_num_blocks * kBlockSize;
first_op.set_dst_length(first_op_size);
*(first_op.add_dst_extents()) = ExtentForRange(0, first_op_num_blocks);
- chromeos::Blob first_op_data(part_data.begin(),
+ brillo::Blob first_op_data(part_data.begin(),
part_data.begin() + first_op_size);
- chromeos::Blob first_op_blob;
+ brillo::Blob first_op_blob;
if (orig_type == InstallOperation::REPLACE) {
first_op_blob = first_op_data;
} else {
@@ -255,9 +255,9 @@
second_op.set_dst_length(second_op_size);
*(second_op.add_dst_extents()) = ExtentForRange(first_op_num_blocks,
second_op_num_blocks);
- chromeos::Blob second_op_data(part_data.begin() + first_op_size,
+ brillo::Blob second_op_data(part_data.begin() + first_op_size,
part_data.begin() + total_op_size);
- chromeos::Blob second_op_blob;
+ brillo::Blob second_op_blob;
if (orig_type == InstallOperation::REPLACE) {
second_op_blob = second_op_data;
} else {
@@ -302,9 +302,9 @@
EXPECT_EQ("first,second", aops[0].name);
// Check to see if the blob pointed to in the new extent has what we expect.
- chromeos::Blob expected_data(part_data.begin(),
+ brillo::Blob expected_data(part_data.begin(),
part_data.begin() + total_op_size);
- chromeos::Blob expected_blob;
+ brillo::Blob expected_blob;
if (compressible) {
ASSERT_TRUE(BzipCompress(expected_data, &expected_blob));
} else {
@@ -312,7 +312,7 @@
}
ASSERT_EQ(expected_blob.size(), new_op.data_length());
ASSERT_EQ(blob_data.size() + expected_blob.size(), data_file_size);
- chromeos::Blob new_op_blob(new_op.data_length());
+ brillo::Blob new_op_blob(new_op.data_length());
ssize_t bytes_read;
ASSERT_TRUE(utils::PReadAll(data_fd,
new_op_blob.data(),
diff --git a/payload_generator/annotated_operation.cc b/payload_generator/annotated_operation.cc
index ca900ce..3331303 100644
--- a/payload_generator/annotated_operation.cc
+++ b/payload_generator/annotated_operation.cc
@@ -36,7 +36,7 @@
}
} // namespace
-bool AnnotatedOperation::SetOperationBlob(chromeos::Blob* blob,
+bool AnnotatedOperation::SetOperationBlob(brillo::Blob* blob,
BlobFileWriter* blob_file) {
off_t data_offset = blob_file->StoreBlob(*blob);
TEST_AND_RETURN_FALSE(data_offset != -1);
diff --git a/payload_generator/annotated_operation.h b/payload_generator/annotated_operation.h
index 08a0d0b..4076070 100644
--- a/payload_generator/annotated_operation.h
+++ b/payload_generator/annotated_operation.h
@@ -20,7 +20,7 @@
#include <ostream> // NOLINT(readability/streams)
#include <string>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include "update_engine/payload_generator/blob_file_writer.h"
#include "update_engine/update_metadata.pb.h"
@@ -38,7 +38,7 @@
// Writes |blob| to the end of |data_fd|, and updates |data_file_size| to
// match the new size of |data_fd|. It sets the data_offset and data_length
// in AnnotatedOperation to match the offset and size of |blob| in |data_fd|.
- bool SetOperationBlob(chromeos::Blob* blob, BlobFileWriter* blob_file);
+ bool SetOperationBlob(brillo::Blob* blob, BlobFileWriter* blob_file);
};
// For logging purposes.
diff --git a/payload_generator/blob_file_writer.cc b/payload_generator/blob_file_writer.cc
index f6dcda7..ab57f6f 100644
--- a/payload_generator/blob_file_writer.cc
+++ b/payload_generator/blob_file_writer.cc
@@ -20,7 +20,7 @@
namespace chromeos_update_engine {
-off_t BlobFileWriter::StoreBlob(const chromeos::Blob& blob) {
+off_t BlobFileWriter::StoreBlob(const brillo::Blob& blob) {
base::AutoLock auto_lock(blob_mutex_);
if (!utils::PWriteAll(blob_fd_, blob.data(), blob.size(), *blob_file_size_))
return -1;
diff --git a/payload_generator/blob_file_writer.h b/payload_generator/blob_file_writer.h
index c850963..6ae1a3f 100644
--- a/payload_generator/blob_file_writer.h
+++ b/payload_generator/blob_file_writer.h
@@ -20,7 +20,7 @@
#include <base/macros.h>
#include <base/synchronization/lock.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
namespace chromeos_update_engine {
@@ -34,7 +34,7 @@
// Store the passed |blob| in the blob file. Returns the offset at which it
// was stored, or -1 in case of failure.
- off_t StoreBlob(const chromeos::Blob& blob);
+ off_t StoreBlob(const brillo::Blob& blob);
// The number of |total_blobs| is the number of blobs that will be stored but
// is only used for logging purposes. If not set, logging will be skipped.
diff --git a/payload_generator/blob_file_writer_unittest.cc b/payload_generator/blob_file_writer_unittest.cc
index 3e11b28..ff2a23c 100644
--- a/payload_generator/blob_file_writer_unittest.cc
+++ b/payload_generator/blob_file_writer_unittest.cc
@@ -40,12 +40,12 @@
BlobFileWriter blob_file(blob_fd, &blob_file_size);
off_t blob_size = 1024;
- chromeos::Blob blob(blob_size);
+ brillo::Blob blob(blob_size);
FillWithData(&blob);
EXPECT_EQ(0, blob_file.StoreBlob(blob));
EXPECT_EQ(blob_size, blob_file.StoreBlob(blob));
- chromeos::Blob stored_blob(blob_size);
+ brillo::Blob stored_blob(blob_size);
ssize_t bytes_read;
ASSERT_TRUE(utils::PReadAll(blob_fd,
stored_blob.data(),
diff --git a/payload_generator/block_mapping.cc b/payload_generator/block_mapping.cc
index a2b641f..81ad4bb 100644
--- a/payload_generator/block_mapping.cc
+++ b/payload_generator/block_mapping.cc
@@ -31,7 +31,7 @@
namespace {
-size_t HashValue(const chromeos::Blob& blob) {
+size_t HashValue(const brillo::Blob& blob) {
std::hash<string> hash_fn;
return hash_fn(string(blob.begin(), blob.end()));
}
@@ -40,12 +40,12 @@
namespace chromeos_update_engine {
-BlockMapping::BlockId BlockMapping::AddBlock(const chromeos::Blob& block_data) {
+BlockMapping::BlockId BlockMapping::AddBlock(const brillo::Blob& block_data) {
return AddBlock(-1, 0, block_data);
}
BlockMapping::BlockId BlockMapping::AddDiskBlock(int fd, off_t byte_offset) {
- chromeos::Blob blob(block_size_);
+ brillo::Blob blob(block_size_);
ssize_t bytes_read = 0;
if (!utils::PReadAll(fd, blob.data(), block_size_, byte_offset, &bytes_read))
return -1;
@@ -70,7 +70,7 @@
BlockMapping::BlockId BlockMapping::AddBlock(int fd,
off_t byte_offset,
- const chromeos::Blob& block_data) {
+ const brillo::Blob& block_data) {
if (block_data.size() != block_size_)
return -1;
size_t h = HashValue(block_data);
@@ -110,14 +110,14 @@
return new_ublock->block_id;
}
-bool BlockMapping::UniqueBlock::CompareData(const chromeos::Blob& other_block,
+bool BlockMapping::UniqueBlock::CompareData(const brillo::Blob& other_block,
bool* equals) {
if (!block_data.empty()) {
*equals = block_data == other_block;
return true;
}
const size_t block_size = other_block.size();
- chromeos::Blob blob(block_size);
+ brillo::Blob blob(block_size);
ssize_t bytes_read = 0;
if (!utils::PReadAll(fd, blob.data(), block_size, byte_offset, &bytes_read))
return false;
@@ -144,7 +144,7 @@
vector<BlockMapping::BlockId>* old_block_ids,
vector<BlockMapping::BlockId>* new_block_ids) {
BlockMapping mapping(block_size);
- if (mapping.AddBlock(chromeos::Blob(block_size, '\0')) != 0)
+ if (mapping.AddBlock(brillo::Blob(block_size, '\0')) != 0)
return false;
int old_fd = HANDLE_EINTR(open(old_part.c_str(), O_RDONLY));
int new_fd = HANDLE_EINTR(open(new_part.c_str(), O_RDONLY));
diff --git a/payload_generator/block_mapping.h b/payload_generator/block_mapping.h
index 027d777..3fe94ab 100644
--- a/payload_generator/block_mapping.h
+++ b/payload_generator/block_mapping.h
@@ -21,14 +21,14 @@
#include <string>
#include <vector>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "update_engine/payload_generator/payload_generation_config.h"
namespace chromeos_update_engine {
-// BlockMapping allows to map data blocks (chromeos::Blobs of block_size size)
+// BlockMapping allows to map data blocks (brillo::Blobs of block_size size)
// into unique integer values called "block ids". This mapping differs from a
// hash function in that two blocks with the same data will have the same id but
// also two blocks with the same id will have the same data. This is only valid
@@ -41,7 +41,7 @@
// Add a single data block to the mapping. Returns its unique block id.
// In case of error returns -1.
- BlockId AddBlock(const chromeos::Blob& block_data);
+ BlockId AddBlock(const brillo::Blob& block_data);
// Add a block from disk reading it from the file descriptor |fd| from the
// offset in bytes |byte_offset|. The data block may or may not be cached, so
@@ -62,7 +62,7 @@
// Add a single block passed in |block_data|. If |fd| is not -1, the block
// can be discarded to save RAM and retrieved later from |fd| at the position
// |byte_offset|.
- BlockId AddBlock(int fd, off_t byte_offset, const chromeos::Blob& block_data);
+ BlockId AddBlock(int fd, off_t byte_offset, const brillo::Blob& block_data);
size_t block_size_;
@@ -71,7 +71,7 @@
// The UniqueBlock represents the data of a block associated to a unique
// block id.
struct UniqueBlock {
- chromeos::Blob block_data;
+ brillo::Blob block_data;
// The block id assigned to this unique block.
BlockId block_id;
@@ -86,7 +86,7 @@
// Compares the UniqueBlock data with the other_block data and stores if
// they are equal in |equals|. Returns whether there was an error reading
// the block from disk while comparing it.
- bool CompareData(const chromeos::Blob& other_block, bool* equals);
+ bool CompareData(const brillo::Blob& other_block, bool* equals);
};
// A mapping from hash values to possible block ids.
diff --git a/payload_generator/block_mapping_unittest.cc b/payload_generator/block_mapping_unittest.cc
index a5be5b7..61080f2 100644
--- a/payload_generator/block_mapping_unittest.cc
+++ b/payload_generator/block_mapping_unittest.cc
@@ -62,7 +62,7 @@
};
TEST_F(BlockMappingTest, FirstAddedBlockIsZero) {
- chromeos::Blob blob(block_size_);
+ brillo::Blob blob(block_size_);
// The BlockMapping just assigns the block ids in order, so it doesn't matter
// what are the contents of the first block.
blob[0] = 42;
@@ -86,7 +86,7 @@
}
}
- chromeos::Blob block(block_size_, 'a');
+ brillo::Blob block(block_size_, 'a');
for (int i = 0; i < 5; ++i) {
// Re-add the same block 5 times.
EXPECT_EQ(0, bm_.AddBlock(block));
diff --git a/payload_generator/delta_diff_utils.cc b/payload_generator/delta_diff_utils.cc
index b567462..583bc79 100644
--- a/payload_generator/delta_diff_utils.cc
+++ b/payload_generator/delta_diff_utils.cc
@@ -417,7 +417,7 @@
ssize_t chunk_blocks,
BlobFileWriter* blob_file,
bool src_ops_allowed) {
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation operation;
uint64_t total_blocks = BlocksInExtents(new_extents);
@@ -498,12 +498,12 @@
const vector<Extent>& old_extents,
const vector<Extent>& new_extents,
bool bsdiff_allowed,
- chromeos::Blob* out_data,
+ brillo::Blob* out_data,
InstallOperation* out_op,
bool src_ops_allowed) {
InstallOperation operation;
// Data blob that will be written to delta file.
- const chromeos::Blob* data_blob = nullptr;
+ const brillo::Blob* data_blob = nullptr;
// We read blocks from old_extents and write blocks to new_extents.
uint64_t blocks_to_read = BlocksInExtents(old_extents);
@@ -514,7 +514,7 @@
vector<Extent> dst_extents = new_extents;
// Read in bytes from new data.
- chromeos::Blob new_data;
+ brillo::Blob new_data;
TEST_AND_RETURN_FALSE(utils::ReadExtents(new_part,
new_extents,
&new_data,
@@ -528,7 +528,7 @@
data_blob = &new_data;
// Try compressing it with bzip2.
- chromeos::Blob new_data_bz;
+ brillo::Blob new_data_bz;
TEST_AND_RETURN_FALSE(BzipCompress(new_data, &new_data_bz));
CHECK(!new_data_bz.empty());
if (new_data_bz.size() < data_blob->size()) {
@@ -537,9 +537,9 @@
data_blob = &new_data_bz;
}
- chromeos::Blob old_data;
- chromeos::Blob empty_blob;
- chromeos::Blob bsdiff_delta;
+ brillo::Blob old_data;
+ brillo::Blob empty_blob;
+ brillo::Blob bsdiff_delta;
if (blocks_to_read > 0) {
// Read old data.
TEST_AND_RETURN_FALSE(
@@ -571,7 +571,7 @@
TEST_AND_RETURN_FALSE(
BsdiffFiles(old_chunk.value(), new_chunk.value(), &bsdiff_delta));
- CHECK_GT(bsdiff_delta.size(), static_cast<chromeos::Blob::size_type>(0));
+ CHECK_GT(bsdiff_delta.size(), static_cast<brillo::Blob::size_type>(0));
if (bsdiff_delta.size() < data_blob->size()) {
if (src_ops_allowed) {
operation.set_type(InstallOperation::SOURCE_BSDIFF);
@@ -614,7 +614,7 @@
// 'out'. Returns true on success.
bool BsdiffFiles(const string& old_file,
const string& new_file,
- chromeos::Blob* out) {
+ brillo::Blob* out) {
const string kPatchFile = "delta.patchXXXXXX";
string patch_file_path;
@@ -628,7 +628,7 @@
cmd.push_back(patch_file_path);
int rc = 1;
- chromeos::Blob patch_file;
+ brillo::Blob patch_file;
TEST_AND_RETURN_FALSE(Subprocess::SynchronousExec(cmd, &rc, nullptr));
TEST_AND_RETURN_FALSE(rc == 0);
TEST_AND_RETURN_FALSE(utils::ReadFile(patch_file_path, out));
@@ -657,7 +657,7 @@
TEST_AND_RETURN_FALSE(hasher.UpdateFile(part.path, part.size) ==
static_cast<off_t>(part.size));
TEST_AND_RETURN_FALSE(hasher.Finalize());
- const chromeos::Blob& hash = hasher.raw_hash();
+ const brillo::Blob& hash = hasher.raw_hash();
info->set_hash(hash.data(), hash.size());
LOG(INFO) << part.path << ": size=" << part.size << " hash=" << hasher.hash();
return true;
diff --git a/payload_generator/delta_diff_utils.h b/payload_generator/delta_diff_utils.h
index dce0793..5ba9bc7 100644
--- a/payload_generator/delta_diff_utils.h
+++ b/payload_generator/delta_diff_utils.h
@@ -20,7 +20,7 @@
#include <string>
#include <vector>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include "update_engine/payload_generator/annotated_operation.h"
#include "update_engine/payload_generator/extent_ranges.h"
@@ -104,7 +104,7 @@
const std::vector<Extent>& old_extents,
const std::vector<Extent>& new_extents,
bool bsdiff_allowed,
- chromeos::Blob* out_data,
+ brillo::Blob* out_data,
InstallOperation* out_op,
bool src_ops_allowed);
@@ -112,7 +112,7 @@
// |out|. Returns true on success.
bool BsdiffFiles(const std::string& old_file,
const std::string& new_file,
- chromeos::Blob* out);
+ brillo::Blob* out);
// Returns true if |op| is a no-op operation that doesn't do any useful work
// (e.g., a move operation that copies blocks onto themselves).
diff --git a/payload_generator/delta_diff_utils_unittest.cc b/payload_generator/delta_diff_utils_unittest.cc
index 6b23197..ce37b27 100644
--- a/payload_generator/delta_diff_utils_unittest.cc
+++ b/payload_generator/delta_diff_utils_unittest.cc
@@ -45,7 +45,7 @@
bool WriteExtents(const string& part_path,
const vector<Extent>& extents,
off_t block_size,
- const chromeos::Blob& data) {
+ const brillo::Blob& data) {
uint64_t offset = 0;
base::ScopedFILE fp(fopen(part_path.c_str(), "r+"));
TEST_AND_RETURN_FALSE(fp.get());
@@ -86,11 +86,11 @@
uint64_t tag) {
TEST_AND_RETURN_FALSE(part.size % block_size == 0);
size_t num_blocks = part.size / block_size;
- chromeos::Blob file_data(part.size);
+ brillo::Blob file_data(part.size);
for (size_t i = 0; i < num_blocks; ++i) {
string prefix = base::StringPrintf(
"block tag 0x%.16" PRIx64 ", block number %16" PRIuS " ", tag, i);
- chromeos::Blob block_data(prefix.begin(), prefix.end());
+ brillo::Blob block_data(prefix.begin(), prefix.end());
TEST_AND_RETURN_FALSE(prefix.size() <= block_size);
block_data.resize(block_size, 'X');
std::copy(block_data.begin(), block_data.end(),
@@ -160,7 +160,7 @@
};
TEST_F(DeltaDiffUtilsTest, MoveSmallTest) {
- chromeos::Blob data_blob(block_size_);
+ brillo::Blob data_blob(block_size_);
test_utils::FillWithData(&data_blob);
// The old file is on a different block than the new one.
@@ -170,7 +170,7 @@
EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -222,7 +222,7 @@
// The size of the data should match the total number of blocks. Each block
// has a different content.
- chromeos::Blob file_data;
+ brillo::Blob file_data;
for (uint64_t i = 0; i < num_blocks; ++i) {
file_data.resize(file_data.size() + kBlockSize, 'a' + i);
}
@@ -230,7 +230,7 @@
EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, file_data));
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, file_data));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -282,7 +282,7 @@
TEST_F(DeltaDiffUtilsTest, BsdiffSmallTest) {
// Test a BSDIFF operation from block 1 to block 2.
- chromeos::Blob data_blob(kBlockSize);
+ brillo::Blob data_blob(kBlockSize);
test_utils::FillWithData(&data_blob);
// The old file is on a different block than the new one.
@@ -294,7 +294,7 @@
data_blob[0]++;
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -324,7 +324,7 @@
TEST_F(DeltaDiffUtilsTest, BsdiffNotAllowedTest) {
// Same setup as the previous test, but this time BSDIFF operations are not
// allowed.
- chromeos::Blob data_blob(kBlockSize);
+ brillo::Blob data_blob(kBlockSize);
test_utils::FillWithData(&data_blob);
// The old file is on a different block than the new one.
@@ -336,7 +336,7 @@
data_blob[0]++;
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -357,7 +357,7 @@
}
TEST_F(DeltaDiffUtilsTest, BsdiffNotAllowedMoveTest) {
- chromeos::Blob data_blob(kBlockSize);
+ brillo::Blob data_blob(kBlockSize);
test_utils::FillWithData(&data_blob);
// The old file is on a different block than the new one.
@@ -367,7 +367,7 @@
EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -393,10 +393,10 @@
vector<Extent> new_extents = { ExtentForRange(2, 1) };
// Make a blob that's just 1's that will compress well.
- chromeos::Blob ones(kBlockSize, 1);
+ brillo::Blob ones(kBlockSize, 1);
// Make a blob with random data that won't compress well.
- chromeos::Blob random_data;
+ brillo::Blob random_data;
std::mt19937 gen(12345);
std::uniform_int_distribution<uint8_t> dis(0, 255);
for (uint32_t i = 0; i < kBlockSize; i++) {
@@ -404,12 +404,12 @@
}
for (int i = 0; i < 2; i++) {
- chromeos::Blob data_to_test = i == 0 ? random_data : ones;
+ brillo::Blob data_to_test = i == 0 ? random_data : ones;
// The old_extents will be initialized with 0.
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize,
data_to_test));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -440,7 +440,7 @@
// Makes sure SOURCE_COPY operations are emitted whenever src_ops_allowed
// is true. It is the same setup as MoveSmallTest, which checks that
// the operation is well-formed.
- chromeos::Blob data_blob(kBlockSize);
+ brillo::Blob data_blob(kBlockSize);
test_utils::FillWithData(&data_blob);
// The old file is on a different block than the new one.
@@ -450,7 +450,7 @@
EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -471,7 +471,7 @@
// Makes sure SOURCE_BSDIFF operations are emitted whenever src_ops_allowed
// is true. It is the same setup as BsdiffSmallTest, which checks
// that the operation is well-formed.
- chromeos::Blob data_blob(kBlockSize);
+ brillo::Blob data_blob(kBlockSize);
test_utils::FillWithData(&data_blob);
// The old file is on a different block than the new one.
@@ -483,7 +483,7 @@
data_blob[0]++;
EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
- chromeos::Blob data;
+ brillo::Blob data;
InstallOperation op;
EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
old_part_.path,
@@ -600,7 +600,7 @@
// Override some of the old blocks with different data.
vector<Extent> different_blocks = {ExtentForRange(40, 5)};
EXPECT_TRUE(WriteExtents(old_part_.path, different_blocks, kBlockSize,
- chromeos::Blob(5 * kBlockSize, 'a')));
+ brillo::Blob(5 * kBlockSize, 'a')));
EXPECT_TRUE(RunDeltaMovedAndZeroBlocks(10, // chunk_blocks
true)); // src_ops_allowed
@@ -642,11 +642,11 @@
new_part_.size = block_size_ * 50;
// Create two identical partitions with 5 copies of the same unique "file".
- chromeos::Blob file_data(block_size_ * 10, 'a');
+ brillo::Blob file_data(block_size_ * 10, 'a');
for (size_t offset = 0; offset < file_data.size(); offset += block_size_)
file_data[offset] = 'a' + offset / block_size_;
- chromeos::Blob partition_data(old_part_.size);
+ brillo::Blob partition_data(old_part_.size);
for (size_t offset = 0; offset < partition_data.size();
offset += file_data.size()) {
std::copy(file_data.begin(), file_data.end(),
@@ -691,7 +691,7 @@
// The last range is split since the old image has zeros in part of it.
ExtentForRange(30, 20),
};
- chromeos::Blob zeros_data(BlocksInExtents(new_zeros) * block_size_, '\0');
+ brillo::Blob zeros_data(BlocksInExtents(new_zeros) * block_size_, '\0');
EXPECT_TRUE(WriteExtents(new_part_.path, new_zeros, block_size_, zeros_data));
vector<Extent> old_zeros = vector<Extent>{ExtentForRange(43, 7)};
@@ -747,7 +747,7 @@
// We initialize the old_part_ with the blocks from new_part but in the
// |permutation| order. Block i in the old_part_ will contain the same data
// as block permutation[i] in the new_part_.
- chromeos::Blob new_contents;
+ brillo::Blob new_contents;
EXPECT_TRUE(utils::ReadFile(new_part_.path, &new_contents));
EXPECT_TRUE(WriteExtents(old_part_.path, perm_extents, block_size_,
new_contents));
diff --git a/payload_generator/ext2_filesystem.cc b/payload_generator/ext2_filesystem.cc
index ff0bc37..182c098 100644
--- a/payload_generator/ext2_filesystem.cc
+++ b/payload_generator/ext2_filesystem.cc
@@ -317,7 +317,7 @@
return true;
}
-bool Ext2Filesystem::LoadSettings(chromeos::KeyValueStore* store) const {
+bool Ext2Filesystem::LoadSettings(brillo::KeyValueStore* store) const {
// First search for the settings inode following symlinks if we find some.
ext2_ino_t ino_num = 0;
errcode_t err = ext2fs_namei_follow(
@@ -339,7 +339,7 @@
if (err != 0)
return false;
- chromeos::Blob blob;
+ brillo::Blob blob;
uint64_t physical_size = BlocksInExtents(extents) * filsys_->blocksize;
// Sparse holes in the settings file are not supported.
if (EXT2_I_SIZE(&ino_data) > physical_size)
diff --git a/payload_generator/ext2_filesystem.h b/payload_generator/ext2_filesystem.h
index afbe524..248e208 100644
--- a/payload_generator/ext2_filesystem.h
+++ b/payload_generator/ext2_filesystem.h
@@ -52,7 +52,7 @@
// and bitmap tables.
bool GetFiles(std::vector<File>* files) const override;
- bool LoadSettings(chromeos::KeyValueStore* store) const override;
+ bool LoadSettings(brillo::KeyValueStore* store) const override;
private:
Ext2Filesystem() = default;
diff --git a/payload_generator/ext2_filesystem_unittest.cc b/payload_generator/ext2_filesystem_unittest.cc
index 628c4e0..fef1c9f 100644
--- a/payload_generator/ext2_filesystem_unittest.cc
+++ b/payload_generator/ext2_filesystem_unittest.cc
@@ -194,7 +194,7 @@
"gen/disk_ext2_1k.img");
unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(path.value());
- chromeos::KeyValueStore store;
+ brillo::KeyValueStore store;
// disk_ext2_1k.img doesn't have the /etc/update_engine.conf file.
EXPECT_FALSE(fs->LoadSettings(&store));
}
@@ -204,7 +204,7 @@
"gen/disk_ext2_ue_settings.img");
unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(path.value());
- chromeos::KeyValueStore store;
+ brillo::KeyValueStore store;
EXPECT_TRUE(fs->LoadSettings(&store));
string minor_version;
EXPECT_TRUE(store.GetString("PAYLOAD_MINOR_VERSION", &minor_version));
diff --git a/payload_generator/fake_filesystem.cc b/payload_generator/fake_filesystem.cc
index 494792d..3a6458d 100644
--- a/payload_generator/fake_filesystem.cc
+++ b/payload_generator/fake_filesystem.cc
@@ -50,7 +50,7 @@
files_.push_back(file);
}
-bool FakeFilesystem::LoadSettings(chromeos::KeyValueStore* store) const {
+bool FakeFilesystem::LoadSettings(brillo::KeyValueStore* store) const {
if (minor_version_ < 0)
return false;
store->SetString("PAYLOAD_MINOR_VERSION", std::to_string(minor_version_));
diff --git a/payload_generator/fake_filesystem.h b/payload_generator/fake_filesystem.h
index 095f8a8..a14b8d3 100644
--- a/payload_generator/fake_filesystem.h
+++ b/payload_generator/fake_filesystem.h
@@ -38,7 +38,7 @@
size_t GetBlockSize() const override;
size_t GetBlockCount() const override;
bool GetFiles(std::vector<File>* files) const override;
- bool LoadSettings(chromeos::KeyValueStore* store) const override;
+ bool LoadSettings(brillo::KeyValueStore* store) const override;
// Fake methods.
diff --git a/payload_generator/filesystem_interface.h b/payload_generator/filesystem_interface.h
index 56d43ee..866c46b 100644
--- a/payload_generator/filesystem_interface.h
+++ b/payload_generator/filesystem_interface.h
@@ -32,7 +32,7 @@
#include <vector>
#include <base/macros.h>
-#include <chromeos/key_value_store.h>
+#include <brillo/key_value_store.h>
#include "update_engine/update_metadata.pb.h"
@@ -81,7 +81,7 @@
// Load the image settings stored in the filesystem in the
// /etc/update_engine.conf file. Returns whether the settings were found.
- virtual bool LoadSettings(chromeos::KeyValueStore* store) const = 0;
+ virtual bool LoadSettings(brillo::KeyValueStore* store) const = 0;
protected:
FilesystemInterface() = default;
diff --git a/payload_generator/full_update_generator.cc b/payload_generator/full_update_generator.cc
index 7ece2ad..f2db3a8 100644
--- a/payload_generator/full_update_generator.cc
+++ b/payload_generator/full_update_generator.cc
@@ -28,7 +28,7 @@
#include <base/strings/stringprintf.h>
#include <base/synchronization/lock.h>
#include <base/threading/simple_thread.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include "update_engine/bzip.h"
#include "update_engine/utils.h"
@@ -73,7 +73,7 @@
// |blob_file_size| accordingly.
// This method is thread-safe since it uses a mutex to access the file.
// Returns the data offset where the data was written to.
- off_t StoreBlob(const chromeos::Blob& blob);
+ off_t StoreBlob(const brillo::Blob& blob);
// Work parameters.
int fd_;
@@ -93,8 +93,8 @@
}
bool ChunkProcessor::ProcessChunk() {
- chromeos::Blob buffer_in_(size_);
- chromeos::Blob op_blob;
+ brillo::Blob buffer_in_(size_);
+ brillo::Blob op_blob;
ssize_t bytes_read = -1;
TEST_AND_RETURN_FALSE(utils::PReadAll(fd_,
buffer_in_.data(),
diff --git a/payload_generator/full_update_generator_unittest.cc b/payload_generator/full_update_generator_unittest.cc
index 6c1047c..21c23e0 100644
--- a/payload_generator/full_update_generator_unittest.cc
+++ b/payload_generator/full_update_generator_unittest.cc
@@ -71,7 +71,7 @@
};
TEST_F(FullUpdateGeneratorTest, RunTest) {
- chromeos::Blob new_part(9 * 1024 * 1024);
+ brillo::Blob new_part(9 * 1024 * 1024);
FillWithData(&new_part);
new_part_conf.size = new_part.size();
@@ -101,7 +101,7 @@
TEST_F(FullUpdateGeneratorTest, ChunkSizeTooBig) {
config_.hard_chunk_size = 1024 * 1024;
config_.soft_chunk_size = config_.hard_chunk_size;
- chromeos::Blob new_part(1536 * 1024); // 1.5 MiB
+ brillo::Blob new_part(1536 * 1024); // 1.5 MiB
new_part_conf.size = new_part.size();
EXPECT_TRUE(test_utils::WriteFileVector(new_part_conf.path, new_part));
@@ -122,7 +122,7 @@
// Test that if the image size is much smaller than the chunk size, it handles
// correctly the only chunk of the partition.
TEST_F(FullUpdateGeneratorTest, ImageSizeTooSmall) {
- chromeos::Blob new_part(16 * 1024);
+ brillo::Blob new_part(16 * 1024);
new_part_conf.size = new_part.size();
EXPECT_TRUE(test_utils::WriteFileVector(new_part_conf.path, new_part));
diff --git a/payload_generator/generate_delta_main.cc b/payload_generator/generate_delta_main.cc
index cdac82f..5924f06 100644
--- a/payload_generator/generate_delta_main.cc
+++ b/payload_generator/generate_delta_main.cc
@@ -27,7 +27,7 @@
#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/string_split.h>
-#include <chromeos/flag_helper.h>
+#include <brillo/flag_helper.h>
#include "update_engine/delta_performer.h"
#include "update_engine/payload_constants.h"
@@ -113,7 +113,7 @@
LOG_IF(FATAL, out_hash_file.empty())
<< "Must pass --out_hash_file to calculate hash for signing.";
- chromeos::Blob hash;
+ brillo::Blob hash;
bool result = PayloadSigner::HashPayloadForSigning(in_file, sizes,
&hash);
CHECK(result);
@@ -133,7 +133,7 @@
LOG_IF(FATAL, out_metadata_hash_file.empty())
<< "Must pass --out_metadata_hash_file to calculate metadata hash.";
- chromeos::Blob hash;
+ brillo::Blob hash;
bool result = PayloadSigner::HashMetadataForSigning(in_file, sizes,
&hash);
CHECK(result);
@@ -156,11 +156,11 @@
<< "Must pass --out_file to sign payload.";
LOG_IF(FATAL, signature_file.empty())
<< "Must pass --signature_file to sign payload.";
- vector<chromeos::Blob> signatures;
+ vector<brillo::Blob> signatures;
vector<string> signature_files;
base::SplitString(signature_file, ':', &signature_files);
for (const string& signature_file : signature_files) {
- chromeos::Blob signature;
+ brillo::Blob signature;
CHECK(utils::ReadFile(signature_file, &signature));
signatures.push_back(signature);
}
@@ -225,7 +225,7 @@
}
DeltaPerformer performer(&prefs, nullptr, &install_plan);
- chromeos::Blob buf(1024 * 1024);
+ brillo::Blob buf(1024 * 1024);
int fd = open(in_file.c_str(), O_RDONLY, 0);
CHECK_GE(fd, 0);
ScopedFdCloser fd_closer(&fd);
@@ -341,7 +341,7 @@
DEFINE_string(new_build_version, "",
"The version of the build containing the new image.");
- chromeos::FlagHelper::Init(argc, argv,
+ brillo::FlagHelper::Init(argc, argv,
"Generates a payload to provide to ChromeOS' update_engine.\n\n"
"This tool can create full payloads and also delta payloads if the src\n"
"image is provided. It also provides debugging options to apply, sign\n"
@@ -499,7 +499,7 @@
// image.
if (payload_config.is_delta) {
payload_config.minor_version = kInPlaceMinorPayloadVersion;
- chromeos::KeyValueStore store;
+ brillo::KeyValueStore store;
uint32_t minor_version;
for (const PartitionConfig& part : payload_config.source.partitions) {
if (part.fs_interface && part.fs_interface->LoadSettings(&store) &&
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index cdcc967..b376326 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -231,7 +231,7 @@
// Write signature blob.
if (!private_key_path.empty()) {
LOG(INFO) << "Signing the update...";
- chromeos::Blob signature_blob;
+ brillo::Blob signature_blob;
TEST_AND_RETURN_FALSE(PayloadSigner::SignPayload(
payload_file,
vector<string>(1, private_key_path),
@@ -266,7 +266,7 @@
if (!aop.op.has_data_offset())
continue;
CHECK(aop.op.has_data_length());
- chromeos::Blob buf(aop.op.data_length());
+ brillo::Blob buf(aop.op.data_length());
ssize_t rc = pread(in_fd, buf.data(), buf.size(), aop.op.data_offset());
TEST_AND_RETURN_FALSE(rc == static_cast<ssize_t>(buf.size()));
@@ -282,11 +282,11 @@
}
bool PayloadFile::AddOperationHash(InstallOperation* op,
- const chromeos::Blob& buf) {
+ const brillo::Blob& buf) {
OmahaHashCalculator hasher;
TEST_AND_RETURN_FALSE(hasher.Update(buf.data(), buf.size()));
TEST_AND_RETURN_FALSE(hasher.Finalize());
- const chromeos::Blob& hash = hasher.raw_hash();
+ const brillo::Blob& hash = hasher.raw_hash();
op->set_data_sha256_hash(hash.data(), hash.size());
return true;
}
diff --git a/payload_generator/payload_file.h b/payload_generator/payload_file.h
index d877ef7..b586d73 100644
--- a/payload_generator/payload_file.h
+++ b/payload_generator/payload_file.h
@@ -20,7 +20,7 @@
#include <string>
#include <vector>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "update_engine/payload_generator/annotated_operation.h"
@@ -63,7 +63,7 @@
// dummy operation for signature blob because the contents of the signature
// blob will not be available at payload creation time. So, update_engine will
// gracefully ignore the dummy signature operation.
- static bool AddOperationHash(InstallOperation* op, const chromeos::Blob& buf);
+ static bool AddOperationHash(InstallOperation* op, const brillo::Blob& buf);
// Install operations in the manifest may reference data blobs, which
// are in data_blobs_path. This function creates a new data blobs file
diff --git a/payload_generator/payload_signer.cc b/payload_generator/payload_signer.cc
index 4a2bb95..25ead8a 100644
--- a/payload_generator/payload_signer.cc
+++ b/payload_generator/payload_signer.cc
@@ -21,7 +21,7 @@
#include <base/logging.h>
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
-#include <chromeos/data_encoding.h>
+#include <brillo/data_encoding.h>
#include <openssl/pem.h>
#include "update_engine/omaha_hash_calculator.h"
@@ -45,11 +45,11 @@
// Given raw |signatures|, packs them into a protobuf and serializes it into a
// binary blob. Returns true on success, false otherwise.
-bool ConvertSignatureToProtobufBlob(const vector<chromeos::Blob>& signatures,
- chromeos::Blob* out_signature_blob) {
+bool ConvertSignatureToProtobufBlob(const vector<brillo::Blob>& signatures,
+ brillo::Blob* out_signature_blob) {
// Pack it into a protobuf
Signatures out_message;
- for (const chromeos::Blob& signature : signatures) {
+ for (const brillo::Blob& signature : signatures) {
Signatures_Signature* sig_message = out_message.add_signatures();
// Set all the signatures with the same version number.
sig_message->set_version(kSignatureMessageLegacyVersion);
@@ -74,14 +74,14 @@
// true on success, false otherwise.
bool AddSignatureOpToPayload(const string& payload_path,
uint64_t signature_blob_size,
- chromeos::Blob* out_payload,
+ brillo::Blob* out_payload,
uint64_t* out_metadata_size,
uint64_t* out_signatures_offset) {
const int kProtobufOffset = 20;
const int kProtobufSizeOffset = 12;
// Loads the payload.
- chromeos::Blob payload;
+ brillo::Blob payload;
DeltaArchiveManifest manifest;
uint64_t metadata_size;
TEST_AND_RETURN_FALSE(PayloadVerifier::LoadPayload(
@@ -134,9 +134,9 @@
}
} // namespace
-bool PayloadSigner::SignHash(const chromeos::Blob& hash,
+bool PayloadSigner::SignHash(const brillo::Blob& hash,
const string& private_key_path,
- chromeos::Blob* out_signature) {
+ brillo::Blob* out_signature) {
LOG(INFO) << "Signing hash with private key: " << private_key_path;
string sig_path;
TEST_AND_RETURN_FALSE(
@@ -149,7 +149,7 @@
ScopedPathUnlinker hash_path_unlinker(hash_path);
// We expect unpadded SHA256 hash coming in
TEST_AND_RETURN_FALSE(hash.size() == 32);
- chromeos::Blob padded_hash(hash);
+ brillo::Blob padded_hash(hash);
PayloadVerifier::PadRSA2048SHA256Hash(&padded_hash);
TEST_AND_RETURN_FALSE(utils::WriteFile(hash_path.c_str(),
padded_hash.data(),
@@ -164,7 +164,7 @@
nullptr));
TEST_AND_RETURN_FALSE(return_code == 0);
- chromeos::Blob signature;
+ brillo::Blob signature;
TEST_AND_RETURN_FALSE(utils::ReadFile(sig_path, &signature));
out_signature->swap(signature);
return true;
@@ -172,15 +172,15 @@
bool PayloadSigner::SignPayload(const string& unsigned_payload_path,
const vector<string>& private_key_paths,
- chromeos::Blob* out_signature_blob) {
- chromeos::Blob hash_data;
+ brillo::Blob* out_signature_blob) {
+ brillo::Blob hash_data;
TEST_AND_RETURN_FALSE(OmahaHashCalculator::RawHashOfFile(
unsigned_payload_path, -1, &hash_data) ==
utils::FileSize(unsigned_payload_path));
- vector<chromeos::Blob> signatures;
+ vector<brillo::Blob> signatures;
for (const string& path : private_key_paths) {
- chromeos::Blob signature;
+ brillo::Blob signature;
TEST_AND_RETURN_FALSE(SignHash(hash_data, path, &signature));
signatures.push_back(signature);
}
@@ -199,7 +199,7 @@
ScopedPathUnlinker x_path_unlinker(x_path);
TEST_AND_RETURN_FALSE(utils::WriteFile(x_path.c_str(), "x", 1));
- chromeos::Blob sig_blob;
+ brillo::Blob sig_blob;
TEST_AND_RETURN_FALSE(PayloadSigner::SignPayload(x_path,
private_key_paths,
&sig_blob));
@@ -210,17 +210,17 @@
bool PayloadSigner::PrepPayloadForHashing(
const string& payload_path,
const vector<int>& signature_sizes,
- chromeos::Blob* payload_out,
+ brillo::Blob* payload_out,
uint64_t* metadata_size_out,
uint64_t* signatures_offset_out) {
// TODO(petkov): Reduce memory usage -- the payload is manipulated in memory.
// Loads the payload and adds the signature op to it.
- vector<chromeos::Blob> signatures;
+ vector<brillo::Blob> signatures;
for (int signature_size : signature_sizes) {
signatures.emplace_back(signature_size, 0);
}
- chromeos::Blob signature_blob;
+ brillo::Blob signature_blob;
TEST_AND_RETURN_FALSE(ConvertSignatureToProtobufBlob(signatures,
&signature_blob));
TEST_AND_RETURN_FALSE(AddSignatureOpToPayload(payload_path,
@@ -234,8 +234,8 @@
bool PayloadSigner::HashPayloadForSigning(const string& payload_path,
const vector<int>& signature_sizes,
- chromeos::Blob* out_hash_data) {
- chromeos::Blob payload;
+ brillo::Blob* out_hash_data) {
+ brillo::Blob payload;
uint64_t metadata_size;
uint64_t signatures_offset;
@@ -255,8 +255,8 @@
bool PayloadSigner::HashMetadataForSigning(const string& payload_path,
const vector<int>& signature_sizes,
- chromeos::Blob* out_metadata_hash) {
- chromeos::Blob payload;
+ brillo::Blob* out_metadata_hash) {
+ brillo::Blob payload;
uint64_t metadata_size;
uint64_t signatures_offset;
@@ -275,16 +275,16 @@
bool PayloadSigner::AddSignatureToPayload(
const string& payload_path,
- const vector<chromeos::Blob>& signatures,
+ const vector<brillo::Blob>& signatures,
const string& signed_payload_path,
uint64_t *out_metadata_size) {
// TODO(petkov): Reduce memory usage -- the payload is manipulated in memory.
// Loads the payload and adds the signature op to it.
- chromeos::Blob signature_blob;
+ brillo::Blob signature_blob;
TEST_AND_RETURN_FALSE(ConvertSignatureToProtobufBlob(signatures,
&signature_blob));
- chromeos::Blob payload;
+ brillo::Blob payload;
uint64_t signatures_offset;
TEST_AND_RETURN_FALSE(AddSignatureOpToPayload(payload_path,
signature_blob.size(),
@@ -311,17 +311,17 @@
string* out_signature) {
// Calculates the hash on the updated payload. Note that the payload includes
// the signature op but doesn't include the signature blob at the end.
- chromeos::Blob metadata_hash;
+ brillo::Blob metadata_hash;
TEST_AND_RETURN_FALSE(OmahaHashCalculator::RawHashOfBytes(metadata,
metadata_size,
&metadata_hash));
- chromeos::Blob signature;
+ brillo::Blob signature;
TEST_AND_RETURN_FALSE(SignHash(metadata_hash,
private_key_path,
&signature));
- *out_signature = chromeos::data_encoding::Base64Encode(signature);
+ *out_signature = brillo::data_encoding::Base64Encode(signature);
return true;
}
diff --git a/payload_generator/payload_signer.h b/payload_generator/payload_signer.h
index f907a92..11116a3 100644
--- a/payload_generator/payload_signer.h
+++ b/payload_generator/payload_signer.h
@@ -21,7 +21,7 @@
#include <vector>
#include <base/macros.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
#include "update_engine/update_metadata.pb.h"
@@ -34,9 +34,9 @@
public:
// Given a raw |hash| and a private key in |private_key_path| calculates the
// raw signature in |out_signature|. Returns true on success, false otherwise.
- static bool SignHash(const chromeos::Blob& hash,
+ static bool SignHash(const brillo::Blob& hash,
const std::string& private_key_path,
- chromeos::Blob* out_signature);
+ brillo::Blob* out_signature);
// Given an unsigned payload in |unsigned_payload_path| and private keys in
// |private_key_path|, calculates the signature blob into
@@ -45,7 +45,7 @@
// false otherwise.
static bool SignPayload(const std::string& unsigned_payload_path,
const std::vector<std::string>& private_key_paths,
- chromeos::Blob* out_signature_blob);
+ brillo::Blob* out_signature_blob);
// Returns the length of out_signature_blob that will result in a call
// to SignPayload with the given private keys. Returns true on success.
@@ -59,7 +59,7 @@
static bool PrepPayloadForHashing(
const std::string& payload_path,
const std::vector<int>& signature_sizes,
- chromeos::Blob* payload_out,
+ brillo::Blob* payload_out,
uint64_t* metadata_size_out,
uint64_t* signatures_offset_out);
@@ -74,7 +74,7 @@
// The dummy signatures are not preserved or written to disk.
static bool HashPayloadForSigning(const std::string& payload_path,
const std::vector<int>& signature_sizes,
- chromeos::Blob* out_hash_data);
+ brillo::Blob* out_hash_data);
// Given an unsigned payload in |payload_path|,
// this method does two things:
@@ -88,7 +88,7 @@
// The dummy signatures are not preserved or written to disk.
static bool HashMetadataForSigning(const std::string& payload_path,
const std::vector<int>& signature_sizes,
- chromeos::Blob* out_metadata_hash);
+ brillo::Blob* out_metadata_hash);
// Given an unsigned payload in |payload_path| (with no dummy signature op)
// and the raw |signatures| updates the payload to include the signature thus
@@ -99,7 +99,7 @@
// on success, false otherwise.
static bool AddSignatureToPayload(
const std::string& payload_path,
- const std::vector<chromeos::Blob>& signatures,
+ const std::vector<brillo::Blob>& signatures,
const std::string& signed_payload_path,
uint64_t* out_metadata_size);
diff --git a/payload_generator/payload_signer_unittest.cc b/payload_generator/payload_signer_unittest.cc
index cedb432..9ef6614 100644
--- a/payload_generator/payload_signer_unittest.cc
+++ b/payload_generator/payload_signer_unittest.cc
@@ -94,7 +94,7 @@
};
namespace {
-void SignSampleData(chromeos::Blob* out_signature_blob,
+void SignSampleData(brillo::Blob* out_signature_blob,
const vector<string>& private_keys) {
string data_path;
ASSERT_TRUE(utils::MakeTempFile("data.XXXXXX", &data_path, nullptr));
@@ -119,11 +119,11 @@
PayloadVerifier::PadRSA2048SHA256Hash(&padded_hash_data_);
}
- chromeos::Blob padded_hash_data_{std::begin(kDataHash), std::end(kDataHash)};
+ brillo::Blob padded_hash_data_{std::begin(kDataHash), std::end(kDataHash)};
};
TEST_F(PayloadSignerTest, SignSimpleTextTest) {
- chromeos::Blob signature_blob;
+ brillo::Blob signature_blob;
SignSampleData(&signature_blob, {kUnittestPrivateKeyPath});
// Check the signature itself
@@ -141,7 +141,7 @@
}
TEST_F(PayloadSignerTest, VerifyAllSignatureTest) {
- chromeos::Blob signature_blob;
+ brillo::Blob signature_blob;
SignSampleData(&signature_blob,
{kUnittestPrivateKeyPath, kUnittestPrivateKey2Path});
@@ -155,7 +155,7 @@
}
TEST_F(PayloadSignerTest, VerifySignatureTest) {
- chromeos::Blob signature_blob;
+ brillo::Blob signature_blob;
SignSampleData(&signature_blob, {kUnittestPrivateKeyPath});
EXPECT_TRUE(PayloadVerifier::VerifySignature(signature_blob,
diff --git a/payload_generator/raw_filesystem.h b/payload_generator/raw_filesystem.h
index 7852573..0aecd81 100644
--- a/payload_generator/raw_filesystem.h
+++ b/payload_generator/raw_filesystem.h
@@ -41,7 +41,7 @@
// with the name passed during construction.
bool GetFiles(std::vector<File>* files) const override;
- bool LoadSettings(chromeos::KeyValueStore* store) const override {
+ bool LoadSettings(brillo::KeyValueStore* store) const override {
return false;
}