[avb] Collect hash descriptors when verification succeeds
This cl uses `avb_descriptor_foreach()` to collect all the
hash descriptors once the verification succeeds and checks
that there's no unknown, duplicated or non-hash descriptor
in the vbmeta.
We will extract the partition digest from the collected
hash descriptors later.
Bug: 256148034
Bug: 265897559
Test: m pvmfw_img && atest libpvmfw_avb.integration_test
Change-Id: Ifa0a91f1e4384007e58d99585d72cdee81bd8dbc
diff --git a/pvmfw/avb/src/partition.rs b/pvmfw/avb/src/partition.rs
index 82d89f8..10a5084 100644
--- a/pvmfw/avb/src/partition.rs
+++ b/pvmfw/avb/src/partition.rs
@@ -25,7 +25,16 @@
InitrdDebug,
}
+/// This is needed to build the default `HashDescriptor`.
+impl Default for PartitionName {
+ fn default() -> Self {
+ Self::Kernel
+ }
+}
+
impl PartitionName {
+ pub(crate) const NUM_OF_KNOWN_PARTITIONS: usize = 3;
+
const KERNEL_PARTITION_NAME: &[u8] = b"boot\0";
const INITRD_NORMAL_PARTITION_NAME: &[u8] = b"initrd_normal\0";
const INITRD_DEBUG_PARTITION_NAME: &[u8] = b"initrd_debug\0";