Separate errors for no public key and signature verify failure
This commit is contained in:
parent
ad29d58413
commit
72b7af4f2d
@ -196,8 +196,14 @@ impl ResourceImage {
|
|||||||
|
|
||||||
pub fn setup_verity_device(&self) -> Result<PathBuf> {
|
pub fn setup_verity_device(&self) -> Result<PathBuf> {
|
||||||
if !CommandLine::nosignatures() {
|
if !CommandLine::nosignatures() {
|
||||||
self.header.verify_signature()?;
|
match self.header.public_key()? {
|
||||||
info!("Image signature is valid for channel {}", self.metainfo.channel());
|
Some(pubkey) => {
|
||||||
|
if !self.header.verify_signature(pubkey) {
|
||||||
|
bail!("Header signature verification failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => bail!("Cannot verify header signature because no public key for channel {} is available", self.metainfo.channel())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
info!("Setting up dm-verity device for image");
|
info!("Setting up dm-verity device for image");
|
||||||
if !self.has_verity_hashtree() {
|
if !self.has_verity_hashtree() {
|
||||||
|
Loading…
Reference in New Issue
Block a user