[microdroid] Refator payload apk verification
Refactoring the payload apk verification by removing some
unnecessary vectors created during the verification.
Bug: 271275206
Test: atest MicrodroidTests
Change-Id: Ia0fcca8d78015b1bdf3bd14e52deaed9ba05d869
diff --git a/microdroid_manager/src/instance.rs b/microdroid_manager/src/instance.rs
index 6900ea5..b16a1e1 100644
--- a/microdroid_manager/src/instance.rs
+++ b/microdroid_manager/src/instance.rs
@@ -279,12 +279,24 @@
pub apex_data: Vec<ApexData>,
}
+impl MicrodroidData {
+ pub fn extra_apk_root_hash_eq(&self, i: usize, root_hash: &[u8]) -> bool {
+ self.extra_apks_data.get(i).map_or(false, |apk| apk.root_hash_eq(root_hash))
+ }
+}
+
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct ApkData {
pub root_hash: Box<RootHash>,
pub pubkey: Box<[u8]>,
}
+impl ApkData {
+ pub fn root_hash_eq(&self, root_hash: &[u8]) -> bool {
+ self.root_hash.as_ref() == root_hash
+ }
+}
+
pub type RootHash = [u8];
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]