libavb: add --check_at_most_once option for dm-verity
When using this option, the partition is set to validate at most once.
Parse the image's hashtree descriptor and making the dm-verity table in
the fisrt_stage_init.
There is a bug in the kernel code, so it seems that android supports
'check_at_most_once' with the following patch.
https://android.googlesource.com/kernel/common/+/cf21a9ac5ee4f57c6f45fe2b09d197bdc038f39d/
Kernel bug has been fixed, so libavb supports it.
Test: atest --host libavb_host_unittest
Signed-off-by: JeongHyeon Lee <jhs2.lee@samsung.com>
Change-Id: I7705c433c0f4f5a087a868a423ebd97de99de0ce
diff --git a/lib/libavb/avb_hashtree_descriptor.h b/lib/libavb/avb_hashtree_descriptor.h
index d7f3eb5..5f74c46 100644
--- a/lib/libavb/avb_hashtree_descriptor.h
+++ b/lib/libavb/avb_hashtree_descriptor.h
@@ -21,9 +21,12 @@
* AVB_HASHTREE_DESCRIPTOR_FLAGS_DO_NOT_USE_AB: Do not apply the default A/B
* partition logic to this partition. This is intentionally a negative boolean
* because A/B should be both the default and most used in practice.
+ * AVB_HASHTREE_DESCRIPTOR_FLAGS_CHECK_AT_MOST_ONCE: supports to validate hashes
+ * at most once in DM-Verity.
*/
typedef enum {
AVB_HASHTREE_DESCRIPTOR_FLAGS_DO_NOT_USE_AB = (1 << 0),
+ AVB_HASHTREE_DESCRIPTOR_FLAGS_CHECK_AT_MOST_ONCE = (1 << 1),
} AvbHashtreeDescriptorFlags;
/* A descriptor containing information about a dm-verity hashtree.