Fix-up coding style and add PREUPLOAD.cfg file.

Previous commits broke the style specified our .clang-format file -
fixed this by running it through clang-format(1). During this process
discovered that I've been invoking clang-format(1) without the
--style=file option meaning that our .clang-format file actually
hadn't been used at all. So there's a rather big amount of formatting
changes in this CL.

Also replaced the .clang-format symlink target to
../../build/tools/brillo-clang-format with our own file since the
brillo one may go away in the future or not exist at all.

Finally, added a PREULOAD.cfg file to do this on every commit. See

 https://android.googlesource.com/platform/tools/repohooks/

for more information about how this works.

Bug: None
Test: Manually tested.
Test: All unit tests pass.
Change-Id: I6461478a62efd81689bc4316c22f758e7f98f59f
diff --git a/test/avb_ab_flow_unittest.cc b/test/avb_ab_flow_unittest.cc
index 1640e5a..e13fccb 100644
--- a/test/avb_ab_flow_unittest.cc
+++ b/test/avb_ab_flow_unittest.cc
@@ -45,8 +45,10 @@
 TEST(ABTest, InitData) {
   AvbABData data;
   avb_ab_data_init(&data);
-  EXPECT_EQ(0, strncmp(reinterpret_cast<const char*>(data.magic), AVB_AB_MAGIC,
-                       AVB_AB_MAGIC_LEN));
+  EXPECT_EQ(0,
+            strncmp(reinterpret_cast<const char*>(data.magic),
+                    AVB_AB_MAGIC,
+                    AVB_AB_MAGIC_LEN));
   EXPECT_EQ(AVB_AB_MAX_PRIORITY, data.slots[0].priority);
   EXPECT_EQ(AVB_AB_MAX_TRIES_REMAINING, data.slots[0].tries_remaining);
   EXPECT_EQ(0, data.slots[0].successful_boot);
@@ -70,9 +72,10 @@
             std::string(reinterpret_cast<const char*>(restored.magic), 4));
   EXPECT_EQ(data.version_major, restored.version_major);
   EXPECT_EQ(data.version_minor, restored.version_minor);
-  EXPECT_EQ(0, memcmp(reinterpret_cast<void*>(data.slots),
-                      reinterpret_cast<void*>(restored.slots),
-                      sizeof(AvbABSlotData) * 2));
+  EXPECT_EQ(0,
+            memcmp(reinterpret_cast<void*>(data.slots),
+                   reinterpret_cast<void*>(restored.slots),
+                   sizeof(AvbABSlotData) * 2));
 }
 
 TEST(ABTest, CatchBadCRC) {
@@ -135,17 +138,20 @@
     misc.resize(MISC_PART_SIZE);
     base::FilePath misc_path = testdir_.Append("misc.img");
     EXPECT_EQ(misc.size(),
-              static_cast<const size_t>(base::WriteFile(
-                  misc_path, reinterpret_cast<const char*>(misc.data()),
-                  misc.size())));
+              static_cast<const size_t>(
+                  base::WriteFile(misc_path,
+                                  reinterpret_cast<const char*>(misc.data()),
+                                  misc.size())));
 
     // We're going to use this key for all images.
     ops_.set_expected_public_key(
         PublicKeyAVB(base::FilePath("test/data/testkey_rsa2048.pem")));
   }
 
-  void GenerateSlot(unsigned int slot_number, SlotValidity slot_validity,
-                    uint64_t rollback_boot, uint64_t rollback_odm) {
+  void GenerateSlot(unsigned int slot_number,
+                    SlotValidity slot_validity,
+                    uint64_t rollback_boot,
+                    uint64_t rollback_odm) {
     std::string boot_name = "boot_a.img";
     std::string vbmeta_name = "vbmeta_a.img";
     std::string odm_name = "odm_a.img";
@@ -174,7 +180,8 @@
                    " --partition_name boot"
                    " --partition_size %zd"
                    " --salt deadbeef",
-                   boot_path.value().c_str(), rollback_boot,
+                   boot_path.value().c_str(),
+                   rollback_boot,
                    boot_partition_size);
 
     const size_t odm_partition_size = 512 * 1024;
@@ -189,7 +196,9 @@
                    " --salt deadbeef"
                    " --algorithm SHA512_RSA4096 "
                    " --key test/data/testkey_rsa4096.pem",
-                   odm_path.value().c_str(), rollback_odm, odm_partition_size);
+                   odm_path.value().c_str(),
+                   rollback_odm,
+                   odm_partition_size);
 
     base::FilePath pk_path = testdir_.Append("testkey_rsa4096.avbpubkey");
     EXPECT_COMMAND(
@@ -205,18 +214,27 @@
       pk_path = GenerateImage("dummy.avbpubkey", 32);
     }
 
-    GenerateVBMetaImage(
-        vbmeta_name, "SHA256_RSA2048", rollback_boot,
-        base::FilePath("test/data/testkey_rsa2048.pem"),
-        base::StringPrintf("--include_descriptors_from_image %s"
-                           " --chain_partition odm:1:%s",
-                           boot_path.value().c_str(), pk_path.value().c_str()));
+    GenerateVBMetaImage(vbmeta_name,
+                        "SHA256_RSA2048",
+                        rollback_boot,
+                        base::FilePath("test/data/testkey_rsa2048.pem"),
+                        base::StringPrintf("--include_descriptors_from_image %s"
+                                           " --chain_partition odm:1:%s",
+                                           boot_path.value().c_str(),
+                                           pk_path.value().c_str()));
   }
 
-  void SetMD(int a_pri, int a_tries, bool a_success,
-             SlotValidity a_slot_validity, uint64_t a_rollback_boot,
-             uint64_t a_rollback_odm, int b_pri, int b_tries, bool b_success,
-             SlotValidity b_slot_validity, uint64_t b_rollback_boot,
+  void SetMD(int a_pri,
+             int a_tries,
+             bool a_success,
+             SlotValidity a_slot_validity,
+             uint64_t a_rollback_boot,
+             uint64_t a_rollback_odm,
+             int b_pri,
+             int b_tries,
+             bool b_success,
+             SlotValidity b_slot_validity,
+             uint64_t b_rollback_boot,
              uint64_t b_rollback_odm,
              const std::map<size_t, uint64_t>& stored_rollback_indexes) {
     AvbABData data;
@@ -242,7 +260,12 @@
   FakeAvbOps ops_;
 };
 
-#define ExpMD(a_pri, a_tries, a_success, b_pri, b_tries, b_success,           \
+#define ExpMD(a_pri,                                                          \
+              a_tries,                                                        \
+              a_success,                                                      \
+              b_pri,                                                          \
+              b_tries,                                                        \
+              b_success,                                                      \
               stored_rollback_indexes)                                        \
   do {                                                                        \
     AvbABData data;                                                           \
@@ -286,29 +309,61 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(14, 0, 1, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        15, 0, 1, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(14, 0, 1,                        // A: pri, tries, successful
-        15, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(14,
+        0,
+        1,  // A: pri, tries, successful
+        15,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Also check the other slot.
-  SetMD(15, 0, 1, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -318,15 +373,31 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(0, 0, 0, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        0, 0, 0, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(0,
+        0,
+        0,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        0,
+        0,
+        0,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_ERROR_NO_BOOTABLE_SLOTS,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_EQ(nullptr, data);
 }
 
@@ -334,38 +405,66 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(15, 3, 0, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        0, 0, 0, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        3,
+        0,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        0,
+        0,
+        0,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 2, 0,                        // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        2,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Keep counting down...
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 1, 0,                        // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        1,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Last try...
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 0,                        // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -373,11 +472,17 @@
   // And we're out of tries. At this point, (15, 0, 0) is normalized
   // to (0, 0, 0) so expect that.
   EXPECT_EQ(AVB_AB_FLOW_RESULT_ERROR_NO_BOOTABLE_SLOTS,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_EQ(nullptr, data);
 }
 
@@ -385,37 +490,65 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(15, 2, 0, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        2,
+        0,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 1, 0,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        1,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Last try...
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 0,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // And we're out of tries. Check we fall back to slot B.
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -425,15 +558,31 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(15, 0, 1, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 7, 0, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        7,
+        0,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        14, 7, 0,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        14,
+        7,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -444,43 +593,91 @@
   const char* requested_partitions[] = {"boot", NULL};
 
   // Slot A is invalid.
-  SetMD(15, 0, 1, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Slot B is invalid.
-  SetMD(15, 0, 1, SV_OK, 0, 0,   // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_INV, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Both slots are invalid.
-  SetMD(15, 0, 1, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_INV, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_ERROR_NO_BOOTABLE_SLOTS,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_EQ(nullptr, data);
 }
 
@@ -489,43 +686,91 @@
   const char* requested_partitions[] = {"boot", NULL};
 
   // Slot A fails verification.
-  SetMD(15, 0, 1, SV_UNV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_UNV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Slot B fails verification.
-  SetMD(15, 0, 1, SV_OK, 0, 0,   // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_UNV, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_UNV,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Both slots fail verification.
-  SetMD(15, 0, 1, SV_UNV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_UNV, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_UNV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_UNV,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_ERROR_NO_BOOTABLE_SLOTS,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_EQ(nullptr, data);
 }
 
@@ -534,29 +779,61 @@
   const char* requested_partitions[] = {"boot", NULL};
 
   // Slot A rollback index failure for 'boot'.
-  SetMD(15, 0, 1, SV_OK, 0, 2,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 2, 2,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        0,
+        2,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        2,
+        2,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(2, 2));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(2, 2));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(2, 2));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Slot A rollback index failure for 'odm'.
-  SetMD(15, 0, 1, SV_OK, 2, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 2, 2,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        2,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        2,
+        2,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(2, 2));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(2, 2));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(2, 2));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -566,30 +843,62 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(15, 0, 1, SV_OK, 3, 3,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 3, 3,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        3,
+        3,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        3,
+        3,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(2, 2));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(3, 3));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(3, 3));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // The case where different partitions have different rollback
   // index values.
-  SetMD(15, 0, 1, SV_OK, 4, 9,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 5, 7,  // B: pri, tries, success, slot_validity, RIs
-        MakeRollbackIndexes(0, 0)); // stored_rollback_indexes
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        4,
+        9,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        5,
+        7,  // B: pri, tries, success, slot_validity, RIs
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(4, 7));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(4, 7));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -597,90 +906,204 @@
   // If the slot with the low RI fails verification (or is invalid),
   // check that these low Rollback Indexs are not taken into account
   // after marking it as unbootable.
-  SetMD(15, 0, 1, SV_INV, 4, 9,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 5, 7,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        4,
+        9,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        5,
+        7,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(5, 7));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(5, 7));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 }
 
 TEST_F(AvbABFlowTest, MarkSlotActive) {
-  SetMD(15, 0, 1, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        11, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        11,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK, avb_ab_mark_slot_active(ops_.avb_ab_ops(), 0));
-  ExpMD(15, 7, 0,                        // A: pri, tries, successful
-        11, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(15,
+        7,
+        0,  // A: pri, tries, successful
+        11,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 
   // Note how priority of slot A is altered to make room for newly
   // activated slot.
-  SetMD(15, 0, 1, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK, avb_ab_mark_slot_active(ops_.avb_ab_ops(), 1));
-  ExpMD(14, 0, 1,                        // A: pri, tries, successful
-        15, 7, 0,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(14,
+        0,
+        1,  // A: pri, tries, successful
+        15,
+        7,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 }
 
 TEST_F(AvbABFlowTest, MarkSlotUnbootable) {
-  SetMD(15, 0, 1, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        11, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        11,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK,
             avb_ab_mark_slot_unbootable(ops_.avb_ab_ops(), 0));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        11, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        11,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 
-  SetMD(15, 0, 1, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK,
             avb_ab_mark_slot_unbootable(ops_.avb_ab_ops(), 1));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        0, 0, 0,                         // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        0,
+        0,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 }
 
 TEST_F(AvbABFlowTest, MarkSlotSuccessful) {
-  SetMD(15, 5, 0, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        11, 3, 0, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        5,
+        0,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        11,
+        3,
+        0,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK,
             avb_ab_mark_slot_successful(ops_.avb_ab_ops(), 0));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        11, 3, 0,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        11,
+        3,
+        0,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 
-  SetMD(15, 5, 0, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        5,
+        0,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK,
             avb_ab_mark_slot_successful(ops_.avb_ab_ops(), 1));
-  ExpMD(15, 5, 0,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(15,
+        5,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 
   // Marking an unbootable slot (A) as successful won't work (it's a
   // programmer error to do so)... notice however that the unbootable
   // slot is normalized in the process.
-  SetMD(0, 3, 2, SV_INV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(0,
+        3,
+        2,
+        SV_INV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_IO_RESULT_OK,
             avb_ab_mark_slot_successful(ops_.avb_ab_ops(), 0));
-  ExpMD(0, 0, 0,                         // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+  ExpMD(0,
+        0,
+        0,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
 }
 
 static AvbABData my_serialized_data;
@@ -710,29 +1133,61 @@
   ops_.avb_ab_ops()->read_ab_metadata = my_read_ab_metadata;
   ops_.avb_ab_ops()->write_ab_metadata = my_write_ab_metadata;
 
-  SetMD(14, 0, 1, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        15, 0, 1, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(14, 0, 1,                        // A: pri, tries, successful
-        15, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(14,
+        0,
+        1,  // A: pri, tries, successful
+        15,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Also check the other slot.
-  SetMD(15, 0, 1, SV_OK, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        false /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        false /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
@@ -751,29 +1206,61 @@
   AvbSlotVerifyData* data;
   const char* requested_partitions[] = {"boot", NULL};
 
-  SetMD(14, 0, 1, SV_OK, 0, 0,   // A: pri, tries, success, slot_validity, RIs
-        15, 0, 1, SV_UNV, 0, 0,  // B: pri, tries, success, slot_validity, RIs
+  SetMD(14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        15,
+        0,
+        1,
+        SV_UNV,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK_WITH_VERIFICATION_ERROR,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        true /* allow_verification_error */, &data));
-  ExpMD(14, 0, 1,                        // A: pri, tries, successful
-        15, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        true /* allow_verification_error */,
+                        &data));
+  ExpMD(14,
+        0,
+        1,  // A: pri, tries, successful
+        15,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_b", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
 
   // Also check the other slot.
-  SetMD(15, 0, 1, SV_UNV, 0, 0,  // A: pri, tries, success, slot_validity, RIs
-        14, 0, 1, SV_OK, 0, 0,   // B: pri, tries, success, slot_validity, RIs
+  SetMD(15,
+        0,
+        1,
+        SV_UNV,
+        0,
+        0,  // A: pri, tries, success, slot_validity, RIs
+        14,
+        0,
+        1,
+        SV_OK,
+        0,
+        0,  // B: pri, tries, success, slot_validity, RIs
         MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   EXPECT_EQ(AVB_AB_FLOW_RESULT_OK_WITH_VERIFICATION_ERROR,
-            avb_ab_flow(ops_.avb_ab_ops(), requested_partitions,
-                        true /* allow_verification_error */, &data));
-  ExpMD(15, 0, 1,                        // A: pri, tries, successful
-        14, 0, 1,                        // B: pri, tries, successful
-        MakeRollbackIndexes(0, 0));      // stored_rollback_indexes
+            avb_ab_flow(ops_.avb_ab_ops(),
+                        requested_partitions,
+                        true /* allow_verification_error */,
+                        &data));
+  ExpMD(15,
+        0,
+        1,  // A: pri, tries, successful
+        14,
+        0,
+        1,                           // B: pri, tries, successful
+        MakeRollbackIndexes(0, 0));  // stored_rollback_indexes
   ASSERT_NE(nullptr, data);
   EXPECT_EQ("_a", std::string(data->ab_suffix));
   avb_slot_verify_data_free(data);
diff --git a/test/avb_slot_verify_unittest.cc b/test/avb_slot_verify_unittest.cc
index 571dba8..33a36ac 100644
--- a/test/avb_slot_verify_unittest.cc
+++ b/test/avb_slot_verify_unittest.cc
@@ -50,7 +50,9 @@
 };
 
 TEST_F(AvbSlotVerifyTest, Basic) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   ops_.set_expected_public_key(
@@ -59,8 +61,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   EXPECT_EQ(
       "androidboot.slot_suffix=_a androidboot.vbmeta.device_state=locked "
@@ -72,7 +77,9 @@
 }
 
 TEST_F(AvbSlotVerifyTest, BasicSha512) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA512_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA512_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   ops_.set_expected_public_key(
@@ -81,8 +88,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   EXPECT_EQ(
       "androidboot.slot_suffix=_a androidboot.vbmeta.device_state=locked "
@@ -95,7 +105,9 @@
 }
 
 TEST_F(AvbSlotVerifyTest, BasicUnlocked) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   ops_.set_expected_public_key(
@@ -106,8 +118,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   EXPECT_EQ(
       "androidboot.slot_suffix=_a androidboot.vbmeta.device_state=unlocked "
@@ -119,7 +134,9 @@
 }
 
 TEST_F(AvbSlotVerifyTest, SlotDataIsCorrect) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   ops_.set_expected_public_key(
@@ -128,25 +145,36 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
 
 TEST_F(AvbSlotVerifyTest, WrongPublicKey) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
@@ -155,8 +183,11 @@
   const char* requested_partitions[] = {"boot", NULL};
   AvbSlotVerifyData* slot_data = NULL;
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_IO,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
 }
 
@@ -166,18 +197,26 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
 
 TEST_F(AvbSlotVerifyTest, CorruptedImage) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   // Corrupt four bytes of data in the end of the image. Since the aux
@@ -185,26 +224,35 @@
   // value of the computed hash.
   uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
   EXPECT_EQ(AVB_IO_RESULT_OK,
-            ops_.avb_ops()->write_to_partition(
-                ops_.avb_ops(), "vbmeta_a",
-                -4,  // offset from end
-                sizeof corrupt_data, corrupt_data));
+            ops_.avb_ops()->write_to_partition(ops_.avb_ops(),
+                                               "vbmeta_a",
+                                               -4,  // offset from end
+                                               sizeof corrupt_data,
+                                               corrupt_data));
 
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
 
 TEST_F(AvbSlotVerifyTest, CorruptedMetadata) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   // Corrupt four bytes of data in the beginning of the image. Unlike
@@ -213,22 +261,28 @@
   // even if the device is unlocked. Specifically no AvbSlotVerifyData
   // is returned.
   uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
-  EXPECT_EQ(
-      AVB_IO_RESULT_OK,
-      ops_.avb_ops()->write_to_partition(ops_.avb_ops(), "vbmeta_a",
-                                         0,  // offset: beginning
-                                         sizeof corrupt_data, corrupt_data));
+  EXPECT_EQ(AVB_IO_RESULT_OK,
+            ops_.avb_ops()->write_to_partition(ops_.avb_ops(),
+                                               "vbmeta_a",
+                                               0,  // offset: beginning
+                                               sizeof corrupt_data,
+                                               corrupt_data));
 
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
 }
 
 TEST_F(AvbSlotVerifyTest, RollbackIndex) {
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 42,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      42,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   ops_.set_expected_public_key(
@@ -241,8 +295,11 @@
   // succeed since the image rollback index is 42 (as set above).
   ops_.set_stored_rollback_indexes({{0, 42}});
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 
@@ -250,12 +307,18 @@
   // because the image has rollback index 42 which is less than 43.
   ops_.set_stored_rollback_indexes({{0, 43}});
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
@@ -274,10 +337,13 @@
       " --partition_size %zd"
       " --kernel_cmdline 'cmdline in hash footer $(ANDROID_SYSTEM_PARTUUID)'"
       " --salt deadbeef",
-      boot_path.value().c_str(), boot_partition_size);
+      boot_path.value().c_str(),
+      boot_partition_size);
 
   GenerateVBMetaImage(
-      "vbmeta_a.img", "SHA256_RSA2048", 4,
+      "vbmeta_a.img",
+      "SHA256_RSA2048",
+      4,
       base::FilePath("test/data/testkey_rsa2048.pem"),
       base::StringPrintf(
           "--include_descriptors_from_image %s"
@@ -316,8 +382,8 @@
                  boot_path.value().c_str());
 
   // With no footer, 'avbtool info_image' should fail (exit status 1).
-  EXPECT_COMMAND(1, "./avbtool info_image --image %s",
-                 boot_path.value().c_str());
+  EXPECT_COMMAND(
+      1, "./avbtool info_image --image %s", boot_path.value().c_str());
 
   ops_.set_expected_public_key(
       PublicKeyAVB(base::FilePath("test/data/testkey_rsa2048.pem")));
@@ -325,8 +391,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
 
   // Now verify the slot data. The vbmeta data should match our
@@ -334,9 +403,10 @@
   EXPECT_EQ(size_t(1), slot_data->num_vbmeta_images);
   EXPECT_EQ("vbmeta", std::string(slot_data->vbmeta_images[0].partition_name));
   EXPECT_EQ(slot_data->vbmeta_images[0].vbmeta_size, vbmeta_image_.size());
-  EXPECT_EQ(
-      0, memcmp(vbmeta_image_.data(), slot_data->vbmeta_images[0].vbmeta_data,
-                slot_data->vbmeta_images[0].vbmeta_size));
+  EXPECT_EQ(0,
+            memcmp(vbmeta_image_.data(),
+                   slot_data->vbmeta_images[0].vbmeta_data,
+                   slot_data->vbmeta_images[0].vbmeta_size));
 
   // The boot image data should match what is generated above with
   // GenerateImage().
@@ -379,9 +449,12 @@
                  " --partition_name boot"
                  " --partition_size %zd"
                  " --salt deadbeef",
-                 boot_path.value().c_str(), boot_partition_size);
+                 boot_path.value().c_str(),
+                 boot_partition_size);
 
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"),
                       base::StringPrintf("--include_descriptors_from_image %s",
                                          boot_path.value().c_str()));
@@ -397,26 +470,36 @@
   // So far, so good.
   AvbSlotVerifyData* slot_data = NULL;
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 
   // Now corrupt boot_a.img and expect verification error.
   uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
-  EXPECT_EQ(
-      AVB_IO_RESULT_OK,
-      ops_.avb_ops()->write_to_partition(ops_.avb_ops(), "boot_a",
-                                         1024 * 1024,  // offset: 1 MiB
-                                         sizeof corrupt_data, corrupt_data));
+  EXPECT_EQ(AVB_IO_RESULT_OK,
+            ops_.avb_ops()->write_to_partition(ops_.avb_ops(),
+                                               "boot_a",
+                                               1024 * 1024,  // offset: 1 MiB
+                                               sizeof corrupt_data,
+                                               corrupt_data));
 
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
@@ -437,7 +520,8 @@
                  " --algorithm SHA256_RSA4096"
                  " --key test/data/testkey_rsa4096.pem"
                  " --salt deadbeef",
-                 boot_path.value().c_str(), boot_partition_size);
+                 boot_path.value().c_str(),
+                 boot_partition_size);
 
   base::FilePath pk_path = testdir_.Append("testkey_rsa4096.avbpubkey");
   EXPECT_COMMAND(
@@ -447,7 +531,9 @@
       pk_path.value().c_str());
 
   GenerateVBMetaImage(
-      "vbmeta_a.img", "SHA256_RSA2048", 11,
+      "vbmeta_a.img",
+      "SHA256_RSA2048",
+      11,
       base::FilePath("test/data/testkey_rsa2048.pem"),
       base::StringPrintf("--chain_partition boot:1:%s"
                          " --kernel_cmdline 'cmdline2 in vbmeta'",
@@ -504,8 +590,11 @@
 
   AvbSlotVerifyData* slot_data = NULL;
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
 
   // Now verify the slot data. We should have two vbmeta
@@ -514,24 +603,28 @@
   EXPECT_EQ(size_t(2), slot_data->num_vbmeta_images);
   EXPECT_EQ("vbmeta", std::string(slot_data->vbmeta_images[0].partition_name));
   EXPECT_EQ(slot_data->vbmeta_images[0].vbmeta_size, vbmeta_image_.size());
-  EXPECT_EQ(
-      0, memcmp(vbmeta_image_.data(), slot_data->vbmeta_images[0].vbmeta_data,
-                slot_data->vbmeta_images[0].vbmeta_size));
+  EXPECT_EQ(0,
+            memcmp(vbmeta_image_.data(),
+                   slot_data->vbmeta_images[0].vbmeta_data,
+                   slot_data->vbmeta_images[0].vbmeta_size));
   // And for the second vbmeta struct we check that the descriptors
   // match the info_image output from above.
   EXPECT_EQ("boot", std::string(slot_data->vbmeta_images[1].partition_name));
   const AvbDescriptor** descriptors =
       avb_descriptor_get_all(slot_data->vbmeta_images[1].vbmeta_data,
-                             slot_data->vbmeta_images[1].vbmeta_size, NULL);
+                             slot_data->vbmeta_images[1].vbmeta_size,
+                             NULL);
   EXPECT_NE(nullptr, descriptors);
   AvbHashDescriptor hash_desc;
-  EXPECT_EQ(true, avb_hash_descriptor_validate_and_byteswap(
-                      ((AvbHashDescriptor*)descriptors[0]), &hash_desc));
+  EXPECT_EQ(true,
+            avb_hash_descriptor_validate_and_byteswap(
+                ((AvbHashDescriptor*)descriptors[0]), &hash_desc));
   const uint8_t* desc_end = reinterpret_cast<const uint8_t*>(descriptors[0]) +
                             sizeof(AvbHashDescriptor);
   uint64_t o = 0;
-  EXPECT_EQ("boot", std::string(reinterpret_cast<const char*>(desc_end + o),
-                                hash_desc.partition_name_len));
+  EXPECT_EQ("boot",
+            std::string(reinterpret_cast<const char*>(desc_end + o),
+                        hash_desc.partition_name_len));
   o += hash_desc.partition_name_len;
   EXPECT_EQ("deadbeef", mem_to_hexstring(desc_end + o, hash_desc.salt_len));
   o += hash_desc.salt_len;
@@ -589,7 +682,8 @@
                  " --algorithm SHA256_RSA4096"
                  " --key test/data/testkey_rsa4096.pem"
                  " --salt deadbeef",
-                 boot_path.value().c_str(), boot_partition_size);
+                 boot_path.value().c_str(),
+                 boot_partition_size);
 
   base::FilePath pk_path = testdir_.Append("testkey_rsa4096.avbpubkey");
   EXPECT_COMMAND(
@@ -598,7 +692,9 @@
       " --output %s",
       pk_path.value().c_str());
 
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"),
                       base::StringPrintf("--chain_partition boot:1:%s",
                                          pk_path.value().c_str()));
@@ -608,26 +704,36 @@
 
   AvbSlotVerifyData* slot_data = NULL;
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 
   // Now corrupt boot_a.img and expect verification error.
   uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
-  EXPECT_EQ(
-      AVB_IO_RESULT_OK,
-      ops_.avb_ops()->write_to_partition(ops_.avb_ops(), "boot_a",
-                                         1024 * 1024,  // offset: 1 MiB
-                                         sizeof corrupt_data, corrupt_data));
+  EXPECT_EQ(AVB_IO_RESULT_OK,
+            ops_.avb_ops()->write_to_partition(ops_.avb_ops(),
+                                               "boot_a",
+                                               1024 * 1024,  // offset: 1 MiB
+                                               sizeof corrupt_data,
+                                               corrupt_data));
 
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
@@ -651,7 +757,8 @@
                  " --algorithm SHA256_RSA8192"
                  " --key test/data/testkey_rsa8192.pem"
                  " --salt deadbeef",
-                 boot_path.value().c_str(), boot_partition_size);
+                 boot_path.value().c_str(),
+                 boot_partition_size);
 
   base::FilePath pk_path = testdir_.Append("testkey_rsa4096.avbpubkey");
   EXPECT_COMMAND(
@@ -660,7 +767,9 @@
       " --output %s",
       pk_path.value().c_str());
 
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"),
                       base::StringPrintf("--chain_partition boot:1:%s",
                                          pk_path.value().c_str()));
@@ -670,12 +779,18 @@
 
   AvbSlotVerifyData* slot_data = NULL;
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 }
@@ -694,7 +809,8 @@
                  " --algorithm SHA256_RSA4096"
                  " --key test/data/testkey_rsa4096.pem"
                  " --salt deadbeef",
-                 boot_path.value().c_str(), boot_partition_size);
+                 boot_path.value().c_str(),
+                 boot_partition_size);
 
   base::FilePath pk_path = testdir_.Append("testkey_rsa4096.avbpubkey");
   EXPECT_COMMAND(
@@ -703,7 +819,9 @@
       " --output %s",
       pk_path.value().c_str());
 
-  GenerateVBMetaImage("vbmeta_a.img", "SHA256_RSA2048", 110,
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      110,
                       base::FilePath("test/data/testkey_rsa2048.pem"),
                       base::StringPrintf("--chain_partition boot:1:%s",
                                          pk_path.value().c_str()));
@@ -717,8 +835,11 @@
   // so it should work if the stored rollback indexes are 0 and 0.
   ops_.set_stored_rollback_indexes({{0, 0}, {1, 0}});
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 
@@ -727,12 +848,18 @@
   // where we test rollback index checks for the vbmeta partition).
   ops_.set_stored_rollback_indexes({{0, 0}, {1, 20}});
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            true /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            true /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   avb_slot_verify_data_free(slot_data);
 
@@ -741,8 +868,11 @@
   // fail.
   ops_.set_stored_rollback_indexes({{0, 0}});
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_IO,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_EQ(nullptr, slot_data);
 }
 
@@ -762,7 +892,8 @@
                  " --algorithm SHA256_RSA4096"
                  " --key test/data/testkey_rsa4096.pem"
                  " --salt deadbeef",
-                 boot_path.value().c_str(), boot_partition_size);
+                 boot_path.value().c_str(),
+                 boot_partition_size);
 
   base::FilePath pk_path = testdir_.Append("testkey_rsa4096.avbpubkey");
   EXPECT_COMMAND(
@@ -772,7 +903,9 @@
       pk_path.value().c_str());
 
   GenerateVBMetaImage(
-      "vbmeta.img", "SHA256_RSA2048", 11,
+      "vbmeta.img",
+      "SHA256_RSA2048",
+      11,
       base::FilePath("test/data/testkey_rsa2048.pem"),
       base::StringPrintf("--chain_partition boot:1:%s"
                          " --kernel_cmdline 'cmdline2 in vbmeta'",
@@ -802,8 +935,11 @@
 
   AvbSlotVerifyData* slot_data = NULL;
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
 
   // Now verify the slot data. The first vbmeta data should match our
@@ -812,9 +948,10 @@
   EXPECT_EQ(size_t(2), slot_data->num_vbmeta_images);
   EXPECT_EQ("vbmeta", std::string(slot_data->vbmeta_images[0].partition_name));
   EXPECT_EQ(slot_data->vbmeta_images[0].vbmeta_size, vbmeta_image_.size());
-  EXPECT_EQ(
-      0, memcmp(vbmeta_image_.data(), slot_data->vbmeta_images[0].vbmeta_data,
-                slot_data->vbmeta_images[0].vbmeta_size));
+  EXPECT_EQ(0,
+            memcmp(vbmeta_image_.data(),
+                   slot_data->vbmeta_images[0].vbmeta_data,
+                   slot_data->vbmeta_images[0].vbmeta_size));
   EXPECT_EQ("boot", std::string(slot_data->vbmeta_images[1].partition_name));
 
   // The boot image data should match what is generated above with
@@ -859,7 +996,8 @@
                  " --partition_name foo"
                  " --partition_size %zd"
                  " --salt deadbeef",
-                 foo_path.value().c_str(), foo_partition_size);
+                 foo_path.value().c_str(),
+                 foo_partition_size);
 
   EXPECT_COMMAND(0,
                  "./avbtool add_hash_footer"
@@ -867,14 +1005,17 @@
                  " --partition_name bar"
                  " --partition_size %zd"
                  " --salt deadbeef",
-                 bar_path.value().c_str(), bar_partition_size);
+                 bar_path.value().c_str(),
+                 bar_partition_size);
 
-  GenerateVBMetaImage(
-      "vbmeta_a.img", "SHA256_RSA2048", 4,
-      base::FilePath("test/data/testkey_rsa2048.pem"),
-      base::StringPrintf("--include_descriptors_from_image %s"
-                         " --include_descriptors_from_image %s",
-                         foo_path.value().c_str(), bar_path.value().c_str()));
+  GenerateVBMetaImage("vbmeta_a.img",
+                      "SHA256_RSA2048",
+                      4,
+                      base::FilePath("test/data/testkey_rsa2048.pem"),
+                      base::StringPrintf("--include_descriptors_from_image %s"
+                                         " --include_descriptors_from_image %s",
+                                         foo_path.value().c_str(),
+                                         bar_path.value().c_str()));
 
   EXPECT_EQ(
       "VBMeta image version:     1.0\n"
@@ -907,8 +1048,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"foo", "bar", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
 
   // Now verify the slot data. The vbmeta data should match our
@@ -916,9 +1060,10 @@
   EXPECT_EQ(size_t(1), slot_data->num_vbmeta_images);
   EXPECT_EQ("vbmeta", std::string(slot_data->vbmeta_images[0].partition_name));
   EXPECT_EQ(slot_data->vbmeta_images[0].vbmeta_size, vbmeta_image_.size());
-  EXPECT_EQ(
-      0, memcmp(vbmeta_image_.data(), slot_data->vbmeta_images[0].vbmeta_data,
-                slot_data->vbmeta_images[0].vbmeta_size));
+  EXPECT_EQ(0,
+            memcmp(vbmeta_image_.data(),
+                   slot_data->vbmeta_images[0].vbmeta_data,
+                   slot_data->vbmeta_images[0].vbmeta_size));
 
   // The 'foo' and 'bar' image data should match what is generated
   // above with GenerateImage().
@@ -941,7 +1086,9 @@
   base::FilePath md_path = GenerateImage("md.bin", 1536);
 
   GenerateVBMetaImage(
-      "vbmeta_a.img", "SHA256_RSA2048", 0,
+      "vbmeta_a.img",
+      "SHA256_RSA2048",
+      0,
       base::FilePath("test/data/testkey_rsa2048.pem"),
       base::StringPrintf("--public_key_metadata %s", md_path.value().c_str()));
 
@@ -955,8 +1102,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   EXPECT_EQ(
       "androidboot.slot_suffix=_a androidboot.vbmeta.device_state=locked "
@@ -975,24 +1125,29 @@
   // Generate a 1028 KiB file with known content.
   std::vector<uint8_t> rootfs;
   rootfs.resize(rootfs_size);
-  for (size_t n = 0; n < rootfs_size; n++) rootfs[n] = uint8_t(n);
+  for (size_t n = 0; n < rootfs_size; n++)
+    rootfs[n] = uint8_t(n);
   base::FilePath rootfs_path = testdir_.Append("rootfs.bin");
   EXPECT_EQ(rootfs_size,
-            static_cast<const size_t>(base::WriteFile(
-                rootfs_path, reinterpret_cast<const char*>(rootfs.data()),
-                rootfs.size())));
+            static_cast<const size_t>(
+                base::WriteFile(rootfs_path,
+                                reinterpret_cast<const char*>(rootfs.data()),
+                                rootfs.size())));
 
   EXPECT_COMMAND(0,
                  "./avbtool add_hashtree_footer --salt d00df00d --image %s "
                  "--partition_size %d --partition_name foobar "
                  "--algorithm SHA256_RSA2048 "
                  "--key test/data/testkey_rsa2048.pem",
-                 rootfs_path.value().c_str(), (int)partition_size);
+                 rootfs_path.value().c_str(),
+                 (int)partition_size);
 
   // Check that we correctly generate dm-verity kernel cmdline
   // snippets, if requested.
   GenerateVBMetaImage(
-      "vbmeta_a.img", "SHA256_RSA2048", 4,
+      "vbmeta_a.img",
+      "SHA256_RSA2048",
+      4,
       base::FilePath("test/data/testkey_rsa2048.pem"),
       base::StringPrintf("--generate_dm_verity_cmdline_from_hashtree %s "
                          "--kernel_cmdline should_be_in_both=1 "
@@ -1040,8 +1195,11 @@
   AvbSlotVerifyData* slot_data = NULL;
   const char* requested_partitions[] = {"boot", NULL};
   EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_OK,
-            avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
-                            false /* allow_verification_error */, &slot_data));
+            avb_slot_verify(ops_.avb_ops(),
+                            requested_partitions,
+                            "_a",
+                            false /* allow_verification_error */,
+                            &slot_data));
   EXPECT_NE(nullptr, slot_data);
   if (hashtree_verification_on) {
     EXPECT_EQ(
diff --git a/test/avb_unittest_util.h b/test/avb_unittest_util.h
index 05390e4..e93e68c 100644
--- a/test/avb_unittest_util.h
+++ b/test/avb_unittest_util.h
@@ -81,8 +81,10 @@
                    " --rollback_index %" PRIu64
                    " %s %s "
                    " --output %s",
-                   rollback_index, additional_options.c_str(),
-                   signing_options.c_str(), vbmeta_image_path_.value().c_str());
+                   rollback_index,
+                   additional_options.c_str(),
+                   signing_options.c_str(),
+                   vbmeta_image_path_.value().c_str());
     int64_t file_size;
     ASSERT_TRUE(base::GetFileSize(vbmeta_image_path_, &file_size));
     vbmeta_image_.resize(file_size);
@@ -102,17 +104,20 @@
     }
     base::FilePath image_path = testdir_.Append(file_name);
     EXPECT_EQ(image_size,
-              static_cast<const size_t>(base::WriteFile(
-                  image_path, reinterpret_cast<const char*>(image.data()),
-                  image.size())));
+              static_cast<const size_t>(
+                  base::WriteFile(image_path,
+                                  reinterpret_cast<const char*>(image.data()),
+                                  image.size())));
     return image_path;
   }
 
   /* Returns the output of 'avbtool info_image' for a given image. */
   std::string InfoImage(const base::FilePath& image_path) {
     base::FilePath tmp_path = testdir_.Append("info_output.txt");
-    EXPECT_COMMAND(0, "./avbtool info_image --image %s --output %s",
-                   image_path.value().c_str(), tmp_path.value().c_str());
+    EXPECT_COMMAND(0,
+                   "./avbtool info_image --image %s --output %s",
+                   image_path.value().c_str(),
+                   tmp_path.value().c_str());
     std::string info_data;
     EXPECT_TRUE(base::ReadFileToString(tmp_path, &info_data));
     return info_data;
@@ -124,7 +129,8 @@
     EXPECT_COMMAND(0,
                    "./avbtool extract_public_key --key %s"
                    " --output %s",
-                   key_path.value().c_str(), tmp_path.value().c_str());
+                   key_path.value().c_str(),
+                   tmp_path.value().c_str());
     std::string key_data;
     EXPECT_TRUE(base::ReadFileToString(tmp_path, &key_data));
     return key_data;
diff --git a/test/avb_util_unittest.cc b/test/avb_util_unittest.cc
index dc0116f..0c8c375 100644
--- a/test/avb_util_unittest.cc
+++ b/test/avb_util_unittest.cc
@@ -461,8 +461,8 @@
 TEST(UtilTest, StrReplace) {
   // We don't care about leaking strings from avb_replace().
   EXPECT_EQ("OK blah bah $(FOO OK blah",
-            std::string(avb_replace("$(FOO) blah bah $(FOO $(FOO) blah",
-                                    "$(FOO)", "OK")));
+            std::string(avb_replace(
+                "$(FOO) blah bah $(FOO $(FOO) blah", "$(FOO)", "OK")));
   EXPECT_EQ("OK", std::string(avb_replace("$(FOO)", "$(FOO)", "OK")));
   EXPECT_EQ(" OK", std::string(avb_replace(" $(FOO)", "$(FOO)", "OK")));
   EXPECT_EQ("OK ", std::string(avb_replace("$(FOO) ", "$(FOO)", "OK")));
diff --git a/test/avb_vbmeta_image_unittest.cc b/test/avb_vbmeta_image_unittest.cc
index d42cf52..560dd01 100644
--- a/test/avb_vbmeta_image_unittest.cc
+++ b/test/avb_vbmeta_image_unittest.cc
@@ -47,7 +47,8 @@
   // boot_image_ in a number of places in the sub-array at |offset| of
   // size |length| and checks that avb_vbmeta_image_verify() returns
   // |expected_result|.
-  bool test_modification(AvbVBMetaVerifyResult expected_result, size_t offset,
+  bool test_modification(AvbVBMetaVerifyResult expected_result,
+                         size_t offset,
                          size_t length);
 };
 
@@ -56,108 +57,128 @@
 }
 
 TEST_F(VerifyTest, CheckSHA256RSA2048) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckSHA256RSA4096) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA4096", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA4096",
+                      0,
                       base::FilePath("test/data/testkey_rsa4096.pem"));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckSHA256RSA8192) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA8192", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA8192",
+                      0,
                       base::FilePath("test/data/testkey_rsa8192.pem"));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckSHA512RSA2048) {
-  GenerateVBMetaImage("vbmeta.img", "SHA512_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA512_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckSHA512RSA4096) {
-  GenerateVBMetaImage("vbmeta.img", "SHA512_RSA4096", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA512_RSA4096",
+                      0,
                       base::FilePath("test/data/testkey_rsa4096.pem"));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckSHA512RSA8192) {
-  GenerateVBMetaImage("vbmeta.img", "SHA512_RSA8192", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA512_RSA8192",
+                      0,
                       base::FilePath("test/data/testkey_rsa8192.pem"));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckUnsigned) {
   GenerateVBMetaImage("vbmeta.img", "", 0, base::FilePath(""));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK_NOT_SIGNED,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, CheckBiggerLength) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
   // Check that it's OK if we pass a bigger length than what the
   // header indicates.
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(),
-                                    vbmeta_image_.size() + 8192, NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size() + 8192, NULL, NULL));
 }
 
 TEST_F(VerifyTest, BadMagic) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
   vbmeta_image_[0] = 'Z';
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, MajorVersionCheck) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
   h->header_version_major = htobe32(1 + be32toh(h->header_version_major));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, MinorVersionCheck) {
   GenerateVBMetaImage("vbmeta.img", "", 0, base::FilePath(""));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
   h->header_version_minor = htobe32(1 + be32toh(h->header_version_minor));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK_NOT_SIGNED,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, BlockSizesAddUpToLessThanLength) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
   AvbVBMetaImageHeader backup = *h;
 
   // Check that the sum of the two block lengths is less than passed
@@ -167,14 +188,14 @@
 
   h->authentication_data_block_size = htobe64(size);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
   *h = backup;
 
   h->auxiliary_data_block_size = htobe64(size);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
   *h = backup;
 
   // Overflow checks - choose overflow candidate so it's a multiple of
@@ -183,178 +204,194 @@
 
   h->authentication_data_block_size = htobe64(size);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
   *h = backup;
 
   h->auxiliary_data_block_size = htobe64(size);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
   *h = backup;
 
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, BlockSizesMultipleOf64) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
   AvbVBMetaImageHeader backup = *h;
 
   h->authentication_data_block_size =
       htobe32(be32toh(h->authentication_data_block_size) - 32);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(),
-                                    vbmeta_image_.size() - 32, NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size() - 32, NULL, NULL));
   *h = backup;
 
   h->auxiliary_data_block_size =
       htobe32(be32toh(h->auxiliary_data_block_size) - 32);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(),
-                                    vbmeta_image_.size() - 32, NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size() - 32, NULL, NULL));
   *h = backup;
 
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, HashOutOfBounds) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
 
   // Check we catch when hash data goes out of bounds.
   h->hash_offset = htobe64(4);
   h->hash_size = htobe64(be64toh(h->authentication_data_block_size));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 
   // Overflow checks.
   h->hash_offset = htobe64(4);
   h->hash_size = htobe64(0xfffffffffffffffeUL);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, SignatureOutOfBounds) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
 
   // Check we catch when signature data goes out of bounds.
   h->signature_offset = htobe64(4);
   h->signature_size = htobe64(be64toh(h->authentication_data_block_size));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 
   // Overflow checks.
   h->signature_offset = htobe64(4);
   h->signature_size = htobe64(0xfffffffffffffffeUL);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, PublicKeyOutOfBounds) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
 
   // Check we catch when public key data goes out of bounds.
   h->public_key_offset = htobe64(4);
   h->public_key_size = htobe64(be64toh(h->auxiliary_data_block_size));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 
   // Overflow checks.
   h->public_key_offset = htobe64(4);
   h->public_key_size = htobe64(0xfffffffffffffffeUL);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, PublicKeyMetadataOutOfBounds) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
 
   // Check we catch when public key metadata data goes out of bounds.
   h->public_key_metadata_offset = htobe64(4);
   h->public_key_metadata_size = htobe64(be64toh(h->auxiliary_data_block_size));
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 
   // Overflow checks.
   h->public_key_metadata_offset = htobe64(4);
   h->public_key_metadata_size = htobe64(0xfffffffffffffffeUL);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, InvalidAlgorithmField) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
   AvbVBMetaImageHeader backup = *h;
 
   // Check we bail on unknown algorithm.
   h->algorithm_type = htobe32(_AVB_ALGORITHM_NUM_TYPES);
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
   *h = backup;
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 TEST_F(VerifyTest, PublicKeyBlockTooSmall) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
-  AvbVBMetaImageHeader *h =
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data());
+  AvbVBMetaImageHeader* h =
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data());
   AvbVBMetaImageHeader backup = *h;
 
   // Check we bail if the auxiliary data block is too small.
   uint64_t change = be64toh(h->auxiliary_data_block_size) - 64;
   h->auxiliary_data_block_size = htobe64(change);
-  EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
-            avb_vbmeta_image_verify(vbmeta_image_.data(),
-                                    vbmeta_image_.size() - change, NULL, NULL));
+  EXPECT_EQ(
+      AVB_VBMETA_VERIFY_RESULT_INVALID_VBMETA_HEADER,
+      avb_vbmeta_image_verify(
+          vbmeta_image_.data(), vbmeta_image_.size() - change, NULL, NULL));
   *h = backup;
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 }
 
 bool VerifyTest::test_modification(AvbVBMetaVerifyResult expected_result,
-                                   size_t offset, size_t length) {
-  uint8_t *d = reinterpret_cast<uint8_t *>(vbmeta_image_.data());
+                                   size_t offset,
+                                   size_t length) {
+  uint8_t* d = reinterpret_cast<uint8_t*>(vbmeta_image_.data());
   const int kNumCheckpoints = 16;
 
   // Test |kNumCheckpoints| modifications in the start, middle, and
@@ -365,23 +402,27 @@
     AvbVBMetaVerifyResult result = avb_vbmeta_image_verify(
         vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL);
     d[o] ^= 0x80;
-    if (result != expected_result) return false;
+    if (result != expected_result) {
+      return false;
+    }
   }
 
   return true;
 }
 
 TEST_F(VerifyTest, ModificationDetection) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    NULL, NULL));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), NULL, NULL));
 
   AvbVBMetaImageHeader h;
   avb_vbmeta_image_header_to_host_byte_order(
-      reinterpret_cast<AvbVBMetaImageHeader *>(vbmeta_image_.data()), &h);
+      reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data()), &h);
 
   size_t header_block_offset = 0;
   size_t authentication_block_offset =
@@ -416,9 +457,10 @@
   // Modifications in the signature part of the Authentication data
   // block, should not cause a hash mismatch ... but will cause a
   // signature mismatch.
-  EXPECT_TRUE(test_modification(
-      AVB_VBMETA_VERIFY_RESULT_SIGNATURE_MISMATCH,
-      authentication_block_offset + h.signature_offset, h.signature_size));
+  EXPECT_TRUE(
+      test_modification(AVB_VBMETA_VERIFY_RESULT_SIGNATURE_MISMATCH,
+                        authentication_block_offset + h.signature_offset,
+                        h.signature_size));
 
   // Mofications outside the hash and signature parts of the
   // Authentication data block are not detected. This is because it's
diff --git a/test/avbtool_unittest.cc b/test/avbtool_unittest.cc
index 6fb664f..761e32b 100644
--- a/test/avbtool_unittest.cc
+++ b/test/avbtool_unittest.cc
@@ -63,7 +63,9 @@
 }
 
 TEST_F(AvbToolTest, ExtractPublicKey) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   std::string key_data =
@@ -76,13 +78,16 @@
   size_t auxiliary_data_block_offset =
       sizeof(AvbVBMetaImageHeader) + h.authentication_data_block_size;
   EXPECT_GT(h.auxiliary_data_block_size, key_data.size());
-  EXPECT_EQ(0, memcmp(key_data.data(),
-                      d + auxiliary_data_block_offset + h.public_key_offset,
-                      key_data.size()));
+  EXPECT_EQ(0,
+            memcmp(key_data.data(),
+                   d + auxiliary_data_block_offset + h.public_key_offset,
+                   key_data.size()));
 }
 
 TEST_F(AvbToolTest, CheckDescriptors) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"),
                       "--prop foo:brillo "
                       "--prop bar:chromeos "
@@ -99,69 +104,84 @@
       reinterpret_cast<AvbVBMetaImageHeader*>(vbmeta_image_.data()), &h);
 
   EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    nullptr, nullptr));
+            avb_vbmeta_image_verify(
+                vbmeta_image_.data(), vbmeta_image_.size(), nullptr, nullptr));
 
   const char* s;
   size_t len;
   uint64_t val;
 
   // Basic.
-  s = avb_property_lookup(vbmeta_image_.data(), vbmeta_image_.size(), "foo", 0,
-                          &len);
+  s = avb_property_lookup(
+      vbmeta_image_.data(), vbmeta_image_.size(), "foo", 0, &len);
   EXPECT_EQ(0, strcmp(s, "brillo"));
   EXPECT_EQ(6U, len);
-  s = avb_property_lookup(vbmeta_image_.data(), vbmeta_image_.size(), "bar", 0,
-                          &len);
+  s = avb_property_lookup(
+      vbmeta_image_.data(), vbmeta_image_.size(), "bar", 0, &len);
   EXPECT_EQ(0, strcmp(s, "chromeos"));
   EXPECT_EQ(8U, len);
-  s = avb_property_lookup(vbmeta_image_.data(), vbmeta_image_.size(),
-                          "non-existant", 0, &len);
+  s = avb_property_lookup(
+      vbmeta_image_.data(), vbmeta_image_.size(), "non-existant", 0, &len);
   EXPECT_EQ(0U, len);
   EXPECT_EQ(NULL, s);
 
   // Numbers.
   EXPECT_NE(
-      0, avb_property_lookup_uint64(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    "prisoner", 0, &val));
+      0,
+      avb_property_lookup_uint64(
+          vbmeta_image_.data(), vbmeta_image_.size(), "prisoner", 0, &val));
   EXPECT_EQ(24601U, val);
 
   EXPECT_NE(
-      0, avb_property_lookup_uint64(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    "hexnumber", 0, &val));
+      0,
+      avb_property_lookup_uint64(
+          vbmeta_image_.data(), vbmeta_image_.size(), "hexnumber", 0, &val));
   EXPECT_EQ(0xcafeU, val);
 
-  EXPECT_NE(
-      0, avb_property_lookup_uint64(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    "hexnumber_capital", 0, &val));
+  EXPECT_NE(0,
+            avb_property_lookup_uint64(vbmeta_image_.data(),
+                                       vbmeta_image_.size(),
+                                       "hexnumber_capital",
+                                       0,
+                                       &val));
   EXPECT_EQ(0xcafeU, val);
 
-  EXPECT_NE(
-      0, avb_property_lookup_uint64(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    "large_hexnumber", 0, &val));
+  EXPECT_NE(0,
+            avb_property_lookup_uint64(vbmeta_image_.data(),
+                                       vbmeta_image_.size(),
+                                       "large_hexnumber",
+                                       0,
+                                       &val));
   EXPECT_EQ(0xfedcba9876543210U, val);
 
   // We could catch overflows and return an error ... but we currently don't.
-  EXPECT_NE(
-      0, avb_property_lookup_uint64(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    "larger_than_uint64", 0, &val));
+  EXPECT_NE(0,
+            avb_property_lookup_uint64(vbmeta_image_.data(),
+                                       vbmeta_image_.size(),
+                                       "larger_than_uint64",
+                                       0,
+                                       &val));
   EXPECT_EQ(0xedcba98765432101U, val);
 
   // Number-parsing failures.
-  EXPECT_EQ(0, avb_property_lookup_uint64(
-                   vbmeta_image_.data(), vbmeta_image_.size(), "foo", 0, &val));
+  EXPECT_EQ(0,
+            avb_property_lookup_uint64(
+                vbmeta_image_.data(), vbmeta_image_.size(), "foo", 0, &val));
 
-  EXPECT_EQ(
-      0, avb_property_lookup_uint64(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    "almost_a_number", 0, &val));
+  EXPECT_EQ(0,
+            avb_property_lookup_uint64(vbmeta_image_.data(),
+                                       vbmeta_image_.size(),
+                                       "almost_a_number",
+                                       0,
+                                       &val));
 
   // Blobs.
   //
   // test/data/small_blob.bin is 21 byte file full of NUL-bytes except
   // for the string "brillo ftw!" at index 2 and '\n' at the last
   // byte.
-  s = avb_property_lookup(vbmeta_image_.data(), vbmeta_image_.size(), "blob", 0,
-                          &len);
+  s = avb_property_lookup(
+      vbmeta_image_.data(), vbmeta_image_.size(), "blob", 0, &len);
   EXPECT_EQ(21U, len);
   EXPECT_EQ(0, memcmp(s, "\0\0", 2));
   EXPECT_EQ(0, memcmp(s + 2, "brillo ftw!", 11));
@@ -171,7 +191,9 @@
 
 TEST_F(AvbToolTest, CheckRollbackIndex) {
   uint64_t rollback_index = 42;
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", rollback_index,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      rollback_index,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   AvbVBMetaImageHeader h;
@@ -182,15 +204,18 @@
 }
 
 TEST_F(AvbToolTest, CheckPubkeyReturned) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"));
 
   const uint8_t* pubkey = NULL;
   size_t pubkey_length = 0;
 
-  EXPECT_EQ(AVB_VBMETA_VERIFY_RESULT_OK,
-            avb_vbmeta_image_verify(vbmeta_image_.data(), vbmeta_image_.size(),
-                                    &pubkey, &pubkey_length));
+  EXPECT_EQ(
+      AVB_VBMETA_VERIFY_RESULT_OK,
+      avb_vbmeta_image_verify(
+          vbmeta_image_.data(), vbmeta_image_.size(), &pubkey, &pubkey_length));
 
   AvbVBMetaImageHeader h;
   avb_vbmeta_image_header_to_host_byte_order(
@@ -205,7 +230,9 @@
 }
 
 TEST_F(AvbToolTest, Info) {
-  GenerateVBMetaImage("vbmeta.img", "SHA256_RSA2048", 0,
+  GenerateVBMetaImage("vbmeta.img",
+                      "SHA256_RSA2048",
+                      0,
                       base::FilePath("test/data/testkey_rsa2048.pem"),
                       "--prop foo:brillo "
                       "--prop bar:chromeos "
@@ -268,14 +295,19 @@
   }
   base::FilePath rootfs_path = testdir_.Append("rootfs.bin");
   EXPECT_EQ(rootfs_size,
-            static_cast<const size_t>(base::WriteFile(
-                rootfs_path, reinterpret_cast<const char*>(rootfs.data()),
-                rootfs.size())));
+            static_cast<const size_t>(
+                base::WriteFile(rootfs_path,
+                                reinterpret_cast<const char*>(rootfs.data()),
+                                rootfs.size())));
 
   if (sparse_image) {
-    EXPECT_COMMAND(0, "mv %s %s.unsparse", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "mv %s %s.unsparse",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
-    EXPECT_COMMAND(0, "img2simg %s.unsparse %s", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "img2simg %s.unsparse %s",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
     EXPECT_COMMAND(0, "rm -f %s.unsparse", rootfs_path.value().c_str());
   }
@@ -288,7 +320,8 @@
                    "--partition_size %d --partition_name foobar "
                    "--algorithm SHA256_RSA2048 "
                    "--key test/data/testkey_rsa2048.pem",
-                   rootfs_path.value().c_str(), (int)partition_size);
+                   rootfs_path.value().c_str(),
+                   (int)partition_size);
 
     ASSERT_EQ(base::StringPrintf("Footer version:           1.0\n"
                                  "Image size:               1572864 bytes\n"
@@ -317,9 +350,13 @@
   }
 
   if (sparse_image) {
-    EXPECT_COMMAND(0, "mv %s %s.sparse", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "mv %s %s.sparse",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
-    EXPECT_COMMAND(0, "simg2img %s.sparse %s", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "simg2img %s.sparse %s",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
     EXPECT_COMMAND(0, "rm -f %s.sparse", rootfs_path.value().c_str());
   }
@@ -340,10 +377,11 @@
 
   // Check footer contains correct data.
   AvbFooter f;
-  EXPECT_NE(0, avb_footer_validate_and_byteswap(
-                   reinterpret_cast<const AvbFooter*>(
-                       part_data.data() + part_data.size() - AVB_FOOTER_SIZE),
-                   &f));
+  EXPECT_NE(0,
+            avb_footer_validate_and_byteswap(
+                reinterpret_cast<const AvbFooter*>(
+                    part_data.data() + part_data.size() - AVB_FOOTER_SIZE),
+                &f));
   EXPECT_EQ(
       std::string(reinterpret_cast<const char*>(f.magic), AVB_FOOTER_MAGIC_LEN),
       AVB_FOOTER_MAGIC);
@@ -361,8 +399,8 @@
 
   // Collect all descriptors.
   std::vector<const AvbDescriptor*> descriptors;
-  avb_descriptor_foreach(vbmeta_data, f.vbmeta_size, collect_descriptors,
-                         &descriptors);
+  avb_descriptor_foreach(
+      vbmeta_data, f.vbmeta_size, collect_descriptors, &descriptors);
 
   // We should only have a single descriptor and it should be a
   // hash descriptor.
@@ -370,8 +408,9 @@
   EXPECT_EQ(AVB_DESCRIPTOR_TAG_HASH, avb_be64toh(descriptors[0]->tag));
   AvbHashDescriptor d;
   EXPECT_NE(
-      0, avb_hash_descriptor_validate_and_byteswap(
-             reinterpret_cast<const AvbHashDescriptor*>(descriptors[0]), &d));
+      0,
+      avb_hash_descriptor_validate_and_byteswap(
+          reinterpret_cast<const AvbHashDescriptor*>(descriptors[0]), &d));
   EXPECT_EQ(1052672UL, d.image_size);
   EXPECT_EQ(6UL, d.partition_name_len);
   EXPECT_EQ(4UL, d.salt_len);
@@ -379,8 +418,9 @@
   const uint8_t* desc_end = reinterpret_cast<const uint8_t*>(descriptors[0]) +
                             sizeof(AvbHashDescriptor);
   uint64_t o = 0;
-  EXPECT_EQ("foobar", std::string(reinterpret_cast<const char*>(desc_end + o),
-                                  d.partition_name_len));
+  EXPECT_EQ("foobar",
+            std::string(reinterpret_cast<const char*>(desc_end + o),
+                        d.partition_name_len));
   o += d.partition_name_len;
   EXPECT_EQ("d00df00d", mem_to_hexstring(desc_end + o, d.salt_len));
   o += d.salt_len;
@@ -388,24 +428,28 @@
             mem_to_hexstring(desc_end + o, d.digest_len));
 
   // Check that the footer is correctly erased.
-  EXPECT_COMMAND(0, "./avbtool erase_footer --image %s",
-                 rootfs_path.value().c_str());
+  EXPECT_COMMAND(
+      0, "./avbtool erase_footer --image %s", rootfs_path.value().c_str());
   int64_t erased_footer_file_size;
   ASSERT_TRUE(base::GetFileSize(rootfs_path, &erased_footer_file_size));
   EXPECT_EQ(static_cast<size_t>(erased_footer_file_size), rootfs_size);
 }
 
-TEST_F(AvbToolTest, AddHashFooter) { AddHashFooterTest(false); }
+TEST_F(AvbToolTest, AddHashFooter) {
+  AddHashFooterTest(false);
+}
 
-TEST_F(AvbToolTest, AddHashFooterSparse) { AddHashFooterTest(true); }
+TEST_F(AvbToolTest, AddHashFooterSparse) {
+  AddHashFooterTest(true);
+}
 
 static std::string RemoveLinesStartingWith(const std::string& str,
                                            const std::string& prefix) {
   std::vector<std::string> lines;
   std::string ret;
 
-  lines = base::SplitString(str, "\n", base::KEEP_WHITESPACE,
-                            base::SPLIT_WANT_NONEMPTY);
+  lines = base::SplitString(
+      str, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
   for (const std::string& line : lines) {
     if (!base::StartsWith(line, prefix, base::CompareCase::SENSITIVE)) {
       ret += line;
@@ -425,7 +469,8 @@
   // this since it will put a big hole (e.g. "Don't care" chunk) at
   // the end.
   base::FilePath partition_path = testdir_.Append("partition.bin");
-  EXPECT_COMMAND(0, "make_ext4fs -s -L test -l %zd %s",
+  EXPECT_COMMAND(0,
+                 "make_ext4fs -s -L test -l %zd %s",
                  partition_size - metadata_size,
                  partition_path.value().c_str());
 
@@ -435,7 +480,8 @@
                  "--partition_size %d --partition_name foobar "
                  "--algorithm SHA256_RSA2048 "
                  "--key test/data/testkey_rsa2048.pem",
-                 partition_path.value().c_str(), (int)partition_size);
+                 partition_path.value().c_str(),
+                 (int)partition_size);
 
   // Since we may be using an arbritary version of make_ext4fs
   // (because of different branches) the contents of the resulting
@@ -465,9 +511,13 @@
       "      Salt:                  d00df00d\n",
       info);
 
-  EXPECT_COMMAND(0, "mv %s %s.sparse", partition_path.value().c_str(),
+  EXPECT_COMMAND(0,
+                 "mv %s %s.sparse",
+                 partition_path.value().c_str(),
                  partition_path.value().c_str());
-  EXPECT_COMMAND(0, "simg2img %s.sparse %s", partition_path.value().c_str(),
+  EXPECT_COMMAND(0,
+                 "simg2img %s.sparse %s",
+                 partition_path.value().c_str(),
                  partition_path.value().c_str());
   EXPECT_COMMAND(0, "rm -f %s.sparse", partition_path.value().c_str());
 }
@@ -479,17 +529,23 @@
   // Generate a 1028 KiB file with known content.
   std::vector<uint8_t> rootfs;
   rootfs.resize(rootfs_size);
-  for (size_t n = 0; n < rootfs_size; n++) rootfs[n] = uint8_t(n);
+  for (size_t n = 0; n < rootfs_size; n++)
+    rootfs[n] = uint8_t(n);
   base::FilePath rootfs_path = testdir_.Append("rootfs.bin");
   EXPECT_EQ(rootfs_size,
-            static_cast<const size_t>(base::WriteFile(
-                rootfs_path, reinterpret_cast<const char*>(rootfs.data()),
-                rootfs.size())));
+            static_cast<const size_t>(
+                base::WriteFile(rootfs_path,
+                                reinterpret_cast<const char*>(rootfs.data()),
+                                rootfs.size())));
 
   if (sparse_image) {
-    EXPECT_COMMAND(0, "mv %s %s.unsparse", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "mv %s %s.unsparse",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
-    EXPECT_COMMAND(0, "img2simg %s.unsparse %s", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "img2simg %s.unsparse %s",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
     EXPECT_COMMAND(0, "rm -f %s.unsparse", rootfs_path.value().c_str());
   }
@@ -501,7 +557,8 @@
                    "--partition_size %d --partition_name foobar "
                    "--algorithm SHA256_RSA2048 "
                    "--key test/data/testkey_rsa2048.pem",
-                   rootfs_path.value().c_str(), (int)partition_size);
+                   rootfs_path.value().c_str(),
+                   (int)partition_size);
 
     ASSERT_EQ(base::StringPrintf("Footer version:           1.0\n"
                                  "Image size:               1572864 bytes\n"
@@ -537,9 +594,13 @@
   }
 
   if (sparse_image) {
-    EXPECT_COMMAND(0, "mv %s %s.sparse", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "mv %s %s.sparse",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
-    EXPECT_COMMAND(0, "simg2img %s.sparse %s", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "simg2img %s.sparse %s",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
     EXPECT_COMMAND(0, "rm -f %s.sparse", rootfs_path.value().c_str());
   }
@@ -560,7 +621,8 @@
                  "verify "
                  "%s %s "
                  "e811611467dcd6e8dc4324e45f706c2bdd51db67",
-                 rootfs_path.value().c_str(), rootfs_path.value().c_str());
+                 rootfs_path.value().c_str(),
+                 rootfs_path.value().c_str());
 
   // Now check that we can find the VBMeta block again from the footer.
   std::string part_data;
@@ -568,10 +630,11 @@
 
   // Check footer contains correct data.
   AvbFooter f;
-  EXPECT_NE(0, avb_footer_validate_and_byteswap(
-                   reinterpret_cast<const AvbFooter*>(
-                       part_data.data() + part_data.size() - AVB_FOOTER_SIZE),
-                   &f));
+  EXPECT_NE(0,
+            avb_footer_validate_and_byteswap(
+                reinterpret_cast<const AvbFooter*>(
+                    part_data.data() + part_data.size() - AVB_FOOTER_SIZE),
+                &f));
   EXPECT_EQ(
       std::string(reinterpret_cast<const char*>(f.magic), AVB_FOOTER_MAGIC_LEN),
       AVB_FOOTER_MAGIC);
@@ -589,8 +652,8 @@
 
   // Collect all descriptors.
   std::vector<const AvbDescriptor*> descriptors;
-  avb_descriptor_foreach(vbmeta_data, f.vbmeta_size, collect_descriptors,
-                         &descriptors);
+  avb_descriptor_foreach(
+      vbmeta_data, f.vbmeta_size, collect_descriptors, &descriptors);
 
   // We should only have a single descriptor and it should be a
   // hashtree descriptor.
@@ -613,8 +676,9 @@
   const uint8_t* desc_end = reinterpret_cast<const uint8_t*>(descriptors[0]) +
                             sizeof(AvbHashtreeDescriptor);
   uint64_t o = 0;
-  EXPECT_EQ("foobar", std::string(reinterpret_cast<const char*>(desc_end + o),
-                                  d.partition_name_len));
+  EXPECT_EQ("foobar",
+            std::string(reinterpret_cast<const char*>(desc_end + o),
+                        d.partition_name_len));
   o += d.partition_name_len;
   EXPECT_EQ("d00df00d", mem_to_hexstring(desc_end + o, d.salt_len));
   o += d.salt_len;
@@ -630,7 +694,8 @@
                  "--generate_dm_verity_cmdline_from_hashtree %s "
                  "--algorithm SHA256_RSA2048 "
                  "--key test/data/testkey_rsa2048.pem",
-                 vbmeta_dmv_path.value().c_str(), rootfs_path.value().c_str());
+                 vbmeta_dmv_path.value().c_str(),
+                 rootfs_path.value().c_str());
 
   ASSERT_EQ(
       "VBMeta image version:     1.0\n"
@@ -656,16 +721,21 @@
 
   // Check that the footer is correctly erased and the hashtree
   // remains - see above for why the constant 1069056 is used.
-  EXPECT_COMMAND(0, "./avbtool erase_footer --image %s --keep_hashtree",
+  EXPECT_COMMAND(0,
+                 "./avbtool erase_footer --image %s --keep_hashtree",
                  rootfs_path.value().c_str());
   int64_t erased_footer_file_size;
   ASSERT_TRUE(base::GetFileSize(rootfs_path, &erased_footer_file_size));
   EXPECT_EQ(static_cast<size_t>(erased_footer_file_size), 1069056UL);
 }
 
-TEST_F(AvbToolTest, AddHashtreeFooter) { AddHashtreeFooterTest(false); }
+TEST_F(AvbToolTest, AddHashtreeFooter) {
+  AddHashtreeFooterTest(false);
+}
 
-TEST_F(AvbToolTest, AddHashtreeFooterSparse) { AddHashtreeFooterTest(true); }
+TEST_F(AvbToolTest, AddHashtreeFooterSparse) {
+  AddHashtreeFooterTest(true);
+}
 
 void AvbToolTest::AddHashtreeFooterFECTest(bool sparse_image) {
   const size_t rootfs_size = 1028 * 1024;
@@ -674,17 +744,23 @@
   // Generate a 1028 KiB file with known content.
   std::vector<uint8_t> rootfs;
   rootfs.resize(rootfs_size);
-  for (size_t n = 0; n < rootfs_size; n++) rootfs[n] = uint8_t(n);
+  for (size_t n = 0; n < rootfs_size; n++)
+    rootfs[n] = uint8_t(n);
   base::FilePath rootfs_path = testdir_.Append("rootfs.bin");
   EXPECT_EQ(rootfs_size,
-            static_cast<const size_t>(base::WriteFile(
-                rootfs_path, reinterpret_cast<const char*>(rootfs.data()),
-                rootfs.size())));
+            static_cast<const size_t>(
+                base::WriteFile(rootfs_path,
+                                reinterpret_cast<const char*>(rootfs.data()),
+                                rootfs.size())));
 
   if (sparse_image) {
-    EXPECT_COMMAND(0, "mv %s %s.unsparse", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "mv %s %s.unsparse",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
-    EXPECT_COMMAND(0, "img2simg %s.unsparse %s", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "img2simg %s.unsparse %s",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
     EXPECT_COMMAND(0, "rm -f %s.unsparse", rootfs_path.value().c_str());
   }
@@ -697,7 +773,8 @@
                    "--generate_fec "
                    "--algorithm SHA256_RSA2048 "
                    "--key test/data/testkey_rsa2048.pem",
-                   rootfs_path.value().c_str(), (int)partition_size);
+                   rootfs_path.value().c_str(),
+                   (int)partition_size);
 
     ASSERT_EQ(base::StringPrintf("Footer version:           1.0\n"
                                  "Image size:               1572864 bytes\n"
@@ -733,9 +810,13 @@
   }
 
   if (sparse_image) {
-    EXPECT_COMMAND(0, "mv %s %s.sparse", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "mv %s %s.sparse",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
-    EXPECT_COMMAND(0, "simg2img %s.sparse %s", rootfs_path.value().c_str(),
+    EXPECT_COMMAND(0,
+                   "simg2img %s.sparse %s",
+                   rootfs_path.value().c_str(),
                    rootfs_path.value().c_str());
     EXPECT_COMMAND(0, "rm -f %s.sparse", rootfs_path.value().c_str());
   }
@@ -748,10 +829,11 @@
 
   // Check footer contains correct data.
   AvbFooter f;
-  EXPECT_NE(0, avb_footer_validate_and_byteswap(
-                   reinterpret_cast<const AvbFooter*>(
-                       part_data.data() + part_data.size() - AVB_FOOTER_SIZE),
-                   &f));
+  EXPECT_NE(0,
+            avb_footer_validate_and_byteswap(
+                reinterpret_cast<const AvbFooter*>(
+                    part_data.data() + part_data.size() - AVB_FOOTER_SIZE),
+                &f));
   EXPECT_EQ(
       std::string(reinterpret_cast<const char*>(f.magic), AVB_FOOTER_MAGIC_LEN),
       AVB_FOOTER_MAGIC);
@@ -769,8 +851,8 @@
 
   // Collect all descriptors.
   std::vector<const AvbDescriptor*> descriptors;
-  avb_descriptor_foreach(vbmeta_data, f.vbmeta_size, collect_descriptors,
-                         &descriptors);
+  avb_descriptor_foreach(
+      vbmeta_data, f.vbmeta_size, collect_descriptors, &descriptors);
 
   // We should only have a single descriptor and it should be a
   // hashtree descriptor.
@@ -795,8 +877,9 @@
   const uint8_t* desc_end = reinterpret_cast<const uint8_t*>(descriptors[0]) +
                             sizeof(AvbHashtreeDescriptor);
   uint64_t o = 0;
-  EXPECT_EQ("foobar", std::string(reinterpret_cast<const char*>(desc_end + o),
-                                  d.partition_name_len));
+  EXPECT_EQ("foobar",
+            std::string(reinterpret_cast<const char*>(desc_end + o),
+                        d.partition_name_len));
   o += d.partition_name_len;
   EXPECT_EQ("d00df00d", mem_to_hexstring(desc_end + o, d.salt_len));
   o += d.salt_len;
@@ -812,7 +895,8 @@
                  "--generate_dm_verity_cmdline_from_hashtree %s "
                  "--algorithm SHA256_RSA2048 "
                  "--key test/data/testkey_rsa2048.pem",
-                 vbmeta_dmv_path.value().c_str(), rootfs_path.value().c_str());
+                 vbmeta_dmv_path.value().c_str(),
+                 rootfs_path.value().c_str());
 
   ASSERT_EQ(
       "VBMeta image version:     1.0\n"
@@ -840,14 +924,17 @@
 
   // Check that the footer is correctly erased and the hashtree
   // remains - see above for why the constant 1069056 is used.
-  EXPECT_COMMAND(0, "./avbtool erase_footer --image %s --keep_hashtree",
+  EXPECT_COMMAND(0,
+                 "./avbtool erase_footer --image %s --keep_hashtree",
                  rootfs_path.value().c_str());
   int64_t erased_footer_file_size;
   ASSERT_TRUE(base::GetFileSize(rootfs_path, &erased_footer_file_size));
   EXPECT_EQ(static_cast<size_t>(erased_footer_file_size), 1069056UL);
 }
 
-TEST_F(AvbToolTest, AddHashtreeFooterFEC) { AddHashtreeFooterFECTest(false); }
+TEST_F(AvbToolTest, AddHashtreeFooterFEC) {
+  AddHashtreeFooterFECTest(false);
+}
 
 TEST_F(AvbToolTest, AddHashtreeFooterFECSparse) {
   AddHashtreeFooterFECTest(true);
@@ -860,7 +947,8 @@
   EXPECT_COMMAND(0,
                  "./avbtool add_hashtree_footer "
                  "--partition_size %zd --calc_max_image_size > %s",
-                 partition_size, output_path.value().c_str());
+                 partition_size,
+                 output_path.value().c_str());
   std::string max_image_size_data;
   EXPECT_TRUE(base::ReadFileToString(output_path, &max_image_size_data));
   EXPECT_EQ("10330112\n", max_image_size_data);
@@ -881,7 +969,8 @@
                  " --salt deadbeef"
                  " --algorithm SHA512_RSA4096 "
                  " --key test/data/testkey_rsa4096.pem",
-                 system_path.value().c_str(), partition_size);
+                 system_path.value().c_str(),
+                 partition_size);
 }
 
 TEST_F(AvbToolTest, AddHashtreeFooterCalcMaxImageSizeWithFEC) {
@@ -892,7 +981,8 @@
                  "./avbtool add_hashtree_footer "
                  "--partition_size %zd --generate_fec "
                  "--calc_max_image_size > %s",
-                 partition_size, output_path.value().c_str());
+                 partition_size,
+                 output_path.value().c_str());
   std::string max_image_size_data;
   EXPECT_TRUE(base::ReadFileToString(output_path, &max_image_size_data));
   EXPECT_EQ("10235904\n", max_image_size_data);
@@ -914,7 +1004,8 @@
                  " --generate_fec "
                  " --algorithm SHA512_RSA4096 "
                  " --key test/data/testkey_rsa4096.pem",
-                 system_path.value().c_str(), partition_size);
+                 system_path.value().c_str(),
+                 partition_size);
 }
 
 TEST_F(AvbToolTest, KernelCmdlineDescriptor) {
@@ -959,8 +1050,8 @@
 
   // Collect all descriptors.
   std::vector<const AvbDescriptor*> descriptors;
-  avb_descriptor_foreach(vbmeta_data, vbmeta_size, collect_descriptors,
-                         &descriptors);
+  avb_descriptor_foreach(
+      vbmeta_data, vbmeta_size, collect_descriptors, &descriptors);
 
   // We should have two descriptors - check them.
   EXPECT_EQ(2UL, descriptors.size());
@@ -1014,7 +1105,8 @@
                  "--prop name4:value4 "
                  "--include_descriptors_from_image %s "
                  "--include_descriptors_from_image %s ",
-                 vbmeta3_path.value().c_str(), vbmeta1_path.value().c_str(),
+                 vbmeta3_path.value().c_str(),
+                 vbmeta1_path.value().c_str(),
                  vbmeta2_path.value().c_str());
 
   ASSERT_EQ(
@@ -1053,7 +1145,8 @@
       "--output %s "
       "--chain_partition system:1:%s "
       "--algorithm SHA256_RSA2048 --key test/data/testkey_rsa2048.pem",
-      vbmeta_path.value().c_str(), pk_path.value().c_str());
+      vbmeta_path.value().c_str(),
+      pk_path.value().c_str());
 
   ASSERT_EQ(
       "VBMeta image version:     1.0\n"
@@ -1083,8 +1176,8 @@
 
   // Collect all descriptors.
   std::vector<const AvbDescriptor*> descriptors;
-  avb_descriptor_foreach(vbmeta_data, vbmeta_size, collect_descriptors,
-                         &descriptors);
+  avb_descriptor_foreach(
+      vbmeta_data, vbmeta_size, collect_descriptors, &descriptors);
 
   // We should have one descriptor - check it.
   EXPECT_EQ(1UL, descriptors.size());
@@ -1103,24 +1196,28 @@
   const uint8_t* desc_end = reinterpret_cast<const uint8_t*>(descriptors[0]) +
                             sizeof(AvbChainPartitionDescriptor);
   uint64_t o = 0;
-  EXPECT_EQ("system", std::string(reinterpret_cast<const char*>(desc_end + o),
-                                  d.partition_name_len));
+  EXPECT_EQ("system",
+            std::string(reinterpret_cast<const char*>(desc_end + o),
+                        d.partition_name_len));
   o += d.partition_name_len;
-  EXPECT_EQ(pk_data, std::string(reinterpret_cast<const char*>(descriptors[0]) +
-                                     sizeof(AvbChainPartitionDescriptor) + o,
-                                 d.public_key_len));
+  EXPECT_EQ(pk_data,
+            std::string(reinterpret_cast<const char*>(descriptors[0]) +
+                            sizeof(AvbChainPartitionDescriptor) + o,
+                        d.public_key_len));
 }
 
 TEST_F(AvbToolTest, SigningHelperBasic) {
   base::FilePath vbmeta_path = testdir_.Append("vbmeta.bin");
-  base::FilePath signing_helper_test_path = testdir_.Append("signing_helper_test");
+  base::FilePath signing_helper_test_path =
+      testdir_.Append("signing_helper_test");
   EXPECT_COMMAND(
       0,
       "SIGNING_HELPER_TEST=\"%s\" ./avbtool make_vbmeta_image "
       "--output %s "
       "--algorithm SHA256_RSA2048 --key test/data/testkey_rsa2048.pem "
       "--signing_helper test/avbtool_signing_helper_test.py",
-      signing_helper_test_path.value().c_str(), vbmeta_path.value().c_str());
+      signing_helper_test_path.value().c_str(),
+      vbmeta_path.value().c_str());
 
   // Now check the value in test file.
   std::string value;
diff --git a/test/fake_avb_ops.cc b/test/fake_avb_ops.cc
index 8882dc0..6f5be76 100644
--- a/test/fake_avb_ops.cc
+++ b/test/fake_avb_ops.cc
@@ -43,7 +43,8 @@
 namespace avb {
 
 AvbIOResult FakeAvbOps::read_from_partition(const char* partition,
-                                            int64_t offset, size_t num_bytes,
+                                            int64_t offset,
+                                            size_t num_bytes,
                                             void* buffer,
                                             size_t* out_num_read) {
   base::FilePath path =
@@ -52,8 +53,8 @@
   if (offset < 0) {
     int64_t file_size;
     if (!base::GetFileSize(path, &file_size)) {
-      fprintf(stderr, "Error getting size of file '%s'\n",
-              path.value().c_str());
+      fprintf(
+          stderr, "Error getting size of file '%s'\n", path.value().c_str());
       return AVB_IO_RESULT_ERROR_IO;
     }
     offset = file_size - (-offset);
@@ -61,13 +62,18 @@
 
   int fd = open(path.value().c_str(), O_RDONLY);
   if (fd < 0) {
-    fprintf(stderr, "Error opening file '%s': %s\n", path.value().c_str(),
+    fprintf(stderr,
+            "Error opening file '%s': %s\n",
+            path.value().c_str(),
             strerror(errno));
     return AVB_IO_RESULT_ERROR_IO;
   }
   if (lseek(fd, offset, SEEK_SET) != offset) {
-    fprintf(stderr, "Error seeking to pos %zd in file %s: %s\n", offset,
-            path.value().c_str(), strerror(errno));
+    fprintf(stderr,
+            "Error seeking to pos %zd in file %s: %s\n",
+            offset,
+            path.value().c_str(),
+            strerror(errno));
     close(fd);
     return AVB_IO_RESULT_ERROR_IO;
   }
@@ -75,7 +81,10 @@
   if (num_read < 0) {
     fprintf(stderr,
             "Error reading %zd bytes from pos %" PRId64 " in file %s: %s\n",
-            num_bytes, offset, path.value().c_str(), strerror(errno));
+            num_bytes,
+            offset,
+            path.value().c_str(),
+            strerror(errno));
     close(fd);
     return AVB_IO_RESULT_ERROR_IO;
   }
@@ -89,7 +98,8 @@
 }
 
 AvbIOResult FakeAvbOps::write_to_partition(const char* partition,
-                                           int64_t offset, size_t num_bytes,
+                                           int64_t offset,
+                                           size_t num_bytes,
                                            const void* buffer) {
   base::FilePath path =
       partition_dir_.Append(std::string(partition)).AddExtension("img");
@@ -97,8 +107,8 @@
   if (offset < 0) {
     int64_t file_size;
     if (!base::GetFileSize(path, &file_size)) {
-      fprintf(stderr, "Error getting size of file '%s'\n",
-              path.value().c_str());
+      fprintf(
+          stderr, "Error getting size of file '%s'\n", path.value().c_str());
       return AVB_IO_RESULT_ERROR_IO;
     }
     offset = file_size - (-offset);
@@ -106,13 +116,18 @@
 
   int fd = open(path.value().c_str(), O_WRONLY);
   if (fd < 0) {
-    fprintf(stderr, "Error opening file '%s': %s\n", path.value().c_str(),
+    fprintf(stderr,
+            "Error opening file '%s': %s\n",
+            path.value().c_str(),
             strerror(errno));
     return AVB_IO_RESULT_ERROR_IO;
   }
   if (lseek(fd, offset, SEEK_SET) != offset) {
-    fprintf(stderr, "Error seeking to pos %zd in file %s: %s\n", offset,
-            path.value().c_str(), strerror(errno));
+    fprintf(stderr,
+            "Error seeking to pos %zd in file %s: %s\n",
+            offset,
+            path.value().c_str(),
+            strerror(errno));
     close(fd);
     return AVB_IO_RESULT_ERROR_IO;
   }
@@ -120,7 +135,10 @@
   if (num_written < 0) {
     fprintf(stderr,
             "Error writing %zd bytes at pos %" PRId64 " in file %s: %s\n",
-            num_bytes, offset, path.value().c_str(), strerror(errno));
+            num_bytes,
+            offset,
+            path.value().c_str(),
+            strerror(errno));
     close(fd);
     return AVB_IO_RESULT_ERROR_IO;
   }
@@ -130,16 +148,21 @@
 }
 
 AvbIOResult FakeAvbOps::validate_vbmeta_public_key(
-    AvbOps* ops, const uint8_t* public_key_data, size_t public_key_length,
-    const uint8_t* public_key_metadata, size_t public_key_metadata_length,
+    AvbOps* ops,
+    const uint8_t* public_key_data,
+    size_t public_key_length,
+    const uint8_t* public_key_metadata,
+    size_t public_key_metadata_length,
     bool* out_key_is_trusted) {
   if (out_key_is_trusted != NULL) {
     bool pk_matches = (public_key_length == expected_public_key_.size() &&
-                       (memcmp(expected_public_key_.c_str(), public_key_data,
+                       (memcmp(expected_public_key_.c_str(),
+                               public_key_data,
                                public_key_length) == 0));
     bool pkmd_matches =
         (public_key_metadata_length == expected_public_key_metadata_.size() &&
-         (memcmp(expected_public_key_metadata_.c_str(), public_key_metadata,
+         (memcmp(expected_public_key_metadata_.c_str(),
+                 public_key_metadata,
                  public_key_metadata_length) == 0));
     *out_key_is_trusted = pk_matches && pkmd_matches;
   }
@@ -150,8 +173,10 @@
                                             size_t rollback_index_location,
                                             uint64_t* out_rollback_index) {
   if (stored_rollback_indexes_.count(rollback_index_location) == 0) {
-    fprintf(stderr, "No rollback index for location %zd (has %zd locations).\n",
-            rollback_index_location, stored_rollback_indexes_.size());
+    fprintf(stderr,
+            "No rollback index for location %zd (has %zd locations).\n",
+            rollback_index_location,
+            stored_rollback_indexes_.size());
     return AVB_IO_RESULT_ERROR_IO;
   }
   *out_rollback_index = stored_rollback_indexes_[rollback_index_location];
@@ -162,8 +187,10 @@
                                              size_t rollback_index_location,
                                              uint64_t rollback_index) {
   if (stored_rollback_indexes_.count(rollback_index_location) == 0) {
-    fprintf(stderr, "No rollback index for location %zd (has %zd locations).\n",
-            rollback_index_location, stored_rollback_indexes_.size());
+    fprintf(stderr,
+            "No rollback index for location %zd (has %zd locations).\n",
+            rollback_index_location,
+            stored_rollback_indexes_.size());
     return AVB_IO_RESULT_ERROR_IO;
   }
   stored_rollback_indexes_[rollback_index_location] = rollback_index;
@@ -203,9 +230,8 @@
                                              int64_t offset,
                                              size_t num_bytes,
                                              const void* buffer) {
-  return FakeAvbOps::GetInstanceFromAvbOps(ops)
-      ->delegate()
-      ->write_to_partition(partition, offset, num_bytes, buffer);
+  return FakeAvbOps::GetInstanceFromAvbOps(ops)->delegate()->write_to_partition(
+      partition, offset, num_bytes, buffer);
 }
 
 static AvbIOResult my_ops_validate_vbmeta_public_key(
@@ -266,13 +292,11 @@
 
   avb_ops_.read_from_partition = my_ops_read_from_partition;
   avb_ops_.write_to_partition = my_ops_write_to_partition;
-  avb_ops_.validate_vbmeta_public_key =
-      my_ops_validate_vbmeta_public_key;
+  avb_ops_.validate_vbmeta_public_key = my_ops_validate_vbmeta_public_key;
   avb_ops_.read_rollback_index = my_ops_read_rollback_index;
   avb_ops_.write_rollback_index = my_ops_write_rollback_index;
   avb_ops_.read_is_device_unlocked = my_ops_read_is_device_unlocked;
-  avb_ops_.get_unique_guid_for_partition =
-      my_ops_get_unique_guid_for_partition;
+  avb_ops_.get_unique_guid_for_partition = my_ops_get_unique_guid_for_partition;
 
   // Just use the built-in A/B metadata read/write routines.
   avb_ab_ops_.ops = avb_ops_;
diff --git a/test/fake_avb_ops.h b/test/fake_avb_ops.h
index 7680604..8d8f6cf 100644
--- a/test/fake_avb_ops.h
+++ b/test/fake_avb_ops.h
@@ -88,9 +88,13 @@
     return (*instance_map_)[&ops->ops];
   }
 
-  AvbOps* avb_ops() { return &avb_ops_; }
+  AvbOps* avb_ops() {
+    return &avb_ops_;
+  }
 
-  AvbABOps* avb_ab_ops() { return &avb_ab_ops_; }
+  AvbABOps* avb_ab_ops() {
+    return &avb_ab_ops_;
+  }
 
   FakeAvbOpsDelegate* delegate() {
     return delegate_;
@@ -128,12 +132,16 @@
   }
 
   // FakeAvbOpsDelegate methods.
-  AvbIOResult read_from_partition(const char* partition, int64_t offset,
-                                  size_t num_bytes, void* buffer,
+  AvbIOResult read_from_partition(const char* partition,
+                                  int64_t offset,
+                                  size_t num_bytes,
+                                  void* buffer,
                                   size_t* out_num_read) override;
 
-  AvbIOResult write_to_partition(const char* partition, int64_t offset,
-                                 size_t num_bytes, const void* buffer) override;
+  AvbIOResult write_to_partition(const char* partition,
+                                 int64_t offset,
+                                 size_t num_bytes,
+                                 const void* buffer) override;
 
   AvbIOResult validate_vbmeta_public_key(AvbOps* ops,
                                          const uint8_t* public_key_data,
@@ -142,16 +150,19 @@
                                          size_t public_key_metadata_length,
                                          bool* out_key_is_trusted) override;
 
-  AvbIOResult read_rollback_index(AvbOps* ops, size_t rollback_index_location,
+  AvbIOResult read_rollback_index(AvbOps* ops,
+                                  size_t rollback_index_location,
                                   uint64_t* out_rollback_index) override;
 
-  AvbIOResult write_rollback_index(AvbOps* ops, size_t rollback_index_location,
+  AvbIOResult write_rollback_index(AvbOps* ops,
+                                   size_t rollback_index_location,
                                    uint64_t rollback_index) override;
 
   AvbIOResult read_is_device_unlocked(AvbOps* ops,
                                       bool* out_is_device_unlocked) override;
 
-  AvbIOResult get_unique_guid_for_partition(AvbOps* ops, const char* partition,
+  AvbIOResult get_unique_guid_for_partition(AvbOps* ops,
+                                            const char* partition,
                                             char* guid_buf,
                                             size_t guid_buf_size) override;