Skip to content

Commit d98e288

Browse files
committed
dir/gen2: implement check_signature() helper for DirPartition
Signed-off-by: Daniel Maslowski <[email protected]>
1 parent c000697 commit d98e288

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/part/gen2.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ pub struct DirPartition {
1818
pub data: Vec<u8>,
1919
}
2020

21+
impl DirPartition {
22+
pub fn check_signature(&self) -> Result<(), String> {
23+
let (m, mdata) = &self.dir.manifest;
24+
if m.verify(&mdata) {
25+
return Ok(());
26+
} else {
27+
return Err("hash mismatch".into());
28+
}
29+
}
30+
}
31+
2132
#[derive(Serialize, Deserialize, Clone, Debug)]
2233
pub enum Gen2Partition {
2334
Dir(DirPartition),

0 commit comments

Comments
 (0)