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

Unified Diff: dm-bht_unittest.cc

Issue 6670096: verity: create a regular trie when depth=0 (Closed) Base URL: http://git.chromium.org/git/dm-verity.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm-bht.c ('k') | include/linux/kernel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm-bht_unittest.cc
diff --git a/dm-bht_unittest.cc b/dm-bht_unittest.cc
index 2eb2297ee8b43abfc6b8bd2baa1eddca2bd1a2a8..8976418f17edc69332098911dd19776fcd883a9f 100644
--- a/dm-bht_unittest.cc
+++ b/dm-bht_unittest.cc
@@ -206,6 +206,29 @@ TEST_F(MemoryBhtTest, CreateThenVerifyMultipleLevels) {
free(zero_page);
}
+TEST_F(MemoryBhtTest, CreateThenVerifyZeroDepth) {
+ static const unsigned int total_blocks = 16384;
+ // Set the root hash for a 0-filled image
+ static const char kRootDigest[] =
+ "45d65d6f9e5a962f4d80b5f1bd7a918152251c27bdad8c5f52b590c129833372";
+ // A page of all zeros
+ u8 *zero_page = (u8 *)my_memalign(PAGE_SIZE, PAGE_SIZE);
+
+ memset(zero_page, 0, PAGE_SIZE);
+
+ SetupBht(0, total_blocks, "sha256");
+ dm_bht_set_root_hexdigest(bht_.get(),
+ reinterpret_cast<const u8 *>(kRootDigest));
+
+ for (unsigned int blocks = 0; blocks < total_blocks; ++blocks) {
+ DLOG(INFO) << "verifying block: " << blocks;
+ EXPECT_EQ(0, dm_bht_verify_block(bht_.get(), blocks, zero_page));
+ }
+
+ EXPECT_EQ(0, dm_bht_destroy(bht_.get()));
+ free(zero_page);
+}
+
TEST_F(MemoryBhtTest, CreateThenVerifyRealParameters) {
static const unsigned int total_blocks = 217600;
// Set the root hash for a 0-filled image
« no previous file with comments | « dm-bht.c ('k') | include/linux/kernel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698