summaryrefslogtreecommitdiff
path: root/payload_consumer/filesystem_verifier_action_unittest.cc
diff options
context:
space:
mode:
authorSen Jiang <senj@google.com>2018-09-13 11:42:56 -0700
committerSen Jiang <senj@google.com>2018-10-03 21:08:48 +0000
commita778e5b5f636c26c205dc2730a5289a5729c6743 (patch)
tree11b41e061ccf3f5b5d80790e47c1304be95d4457 /payload_consumer/filesystem_verifier_action_unittest.cc
parent270524ffe9463e2d20fda43584d24cd84d4602df (diff)
Support writing FEC.
After hash tree is written, we re-read the partition to encode FEC, this cannot be done incrementally for each Update() like the hash tree, because the data needed to encode each rs block are spreaded across entire partition, and we can not afford to use that much memory. For each round, we encode block_size number of rs blocks, which will produce block_size * fec_roots bytes of FEC data, this will allow us to read one block at a time instead of one byte. Bug: 28171891 Test: update_engine_unittests Test: brillo_update_payload generate Test: brillo_update_payload verify Change-Id: I35ba7e0647b9ee5a97b972dc480deef60d813676
Diffstat (limited to 'payload_consumer/filesystem_verifier_action_unittest.cc')
-rw-r--r--payload_consumer/filesystem_verifier_action_unittest.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
index 9eeecb14..15ec77a8 100644
--- a/payload_consumer/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -277,7 +277,7 @@ TEST_F(FilesystemVerifierActionTest, RunAsRootTerminateEarlyTest) {
}
#ifdef __ANDROID__
-TEST_F(FilesystemVerifierActionTest, VerityHashTreeTest) {
+TEST_F(FilesystemVerifierActionTest, WriteVerityTest) {
FilesystemVerifierActionTestDelegate delegate;
processor_.set_delegate(&delegate);
@@ -302,16 +302,21 @@ TEST_F(FilesystemVerifierActionTest, VerityHashTreeTest) {
part.hash_tree_data_size = filesystem_size;
part.hash_tree_offset = filesystem_size;
part.hash_tree_size = 3 * 4096;
+ part.fec_data_offset = 0;
+ part.fec_data_size = filesystem_size + part.hash_tree_size;
+ part.fec_offset = part.fec_data_size;
+ part.fec_size = 2 * 4096;
+ part.fec_roots = 2;
// for i in {1..$((200 * 4096))}; do echo -n -e '\x1' >> part; done
// avbtool add_hashtree_footer --image part --partition_size $((256 * 4096))
- // --partition_name part --do_not_generate_fec
- // --do_not_append_vbmeta_image --output_vbmeta_image vbmeta
+ // --partition_name part --do_not_append_vbmeta_image
+ // --output_vbmeta_image vbmeta
// truncate -s $((256 * 4096)) part
// sha256sum part | xxd -r -p | hexdump -v -e '/1 "0x%02x, "'
- part.target_hash = {0xf0, 0x2c, 0x81, 0xf5, 0xec, 0x30, 0xa6, 0x99,
- 0x1b, 0x41, 0x72, 0x16, 0x38, 0x48, 0xe5, 0x68,
- 0x06, 0x7c, 0x3b, 0x88, 0xb5, 0x97, 0xa9, 0x29,
- 0xa5, 0x7d, 0xdd, 0xa5, 0x9f, 0x5c, 0x15, 0x84};
+ part.target_hash = {0x28, 0xd4, 0x96, 0x75, 0x4c, 0xf5, 0x8a, 0x3e,
+ 0x31, 0x85, 0x08, 0x92, 0x85, 0x62, 0xf0, 0x37,
+ 0xbc, 0x8d, 0x7e, 0xa4, 0xcb, 0x24, 0x18, 0x7b,
+ 0xf3, 0xeb, 0xb5, 0x8d, 0x6f, 0xc8, 0xd8, 0x1a};
// avbtool info_image --image vbmeta | grep Salt | cut -d':' -f 2 |
// xxd -r -p | hexdump -v -e '/1 "0x%02x, "'
part.hash_tree_salt = {0x9e, 0xcb, 0xf8, 0xd5, 0x0b, 0xb4, 0x43,