[avb] Improve error reporting when parsing descriptors from VBMeta

Prior to this cl, the only error that was reported was an
InvalidMetadata error when the descriptors failed to parse.

This cl enhances the error reporting by saving the internal error
that occurred during the parsing process and passing it along to
a new InvalidDescriptors error.

Test: atest libpvmfw_avb.integration_test
Bug: 279557218
Change-Id: Id90267e137c09d3604ef069b1aef9fa4dc8d9ad8
diff --git a/pvmfw/avb/src/error.rs b/pvmfw/avb/src/error.rs
index c2b7428..1add368 100644
--- a/pvmfw/avb/src/error.rs
+++ b/pvmfw/avb/src/error.rs
@@ -39,6 +39,8 @@
     UnsupportedVersion,
     /// AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION
     Verification,
+    /// VBMeta has invalid descriptors.
+    InvalidDescriptors(AvbIOError),
 }
 
 impl fmt::Display for AvbSlotVerifyError {
@@ -55,6 +57,9 @@
                 "Some of the metadata requires a newer version of libavb than what is in use."
             ),
             Self::Verification => write!(f, "Data does not verify."),
+            Self::InvalidDescriptors(e) => {
+                write!(f, "VBMeta has invalid descriptors. Error: {:?}", e)
+            }
         }
     }
 }
@@ -87,8 +92,9 @@
     }
 }
 
-#[derive(Debug)]
-pub(crate) enum AvbIOError {
+/// AVB IO Error.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum AvbIOError {
     /// AVB_IO_RESULT_ERROR_OOM,
     #[allow(dead_code)]
     Oom,