Merge pull request #3340 from kingofpayne/fix-3339

fix(boot): return signature error when no features
This commit is contained in:
Ulf Lilleengen 2024-09-16 10:17:22 +00:00 committed by GitHub
commit a23f56b3dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 8 deletions

View File

@ -107,7 +107,8 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> FirmwareUpdater<'d, DFU, STATE> {
let mut message = [0; 64];
self.hash::<Sha512>(_update_len, &mut chunk_buf, &mut message).await?;
public_key.verify(&message, &signature).map_err(into_signature_error)?
public_key.verify(&message, &signature).map_err(into_signature_error)?;
return self.state.mark_updated().await;
}
#[cfg(feature = "ed25519-salty")]
{
@ -134,10 +135,13 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> FirmwareUpdater<'d, DFU, STATE> {
message,
r.is_ok()
);
r.map_err(into_signature_error)?
r.map_err(into_signature_error)?;
return self.state.mark_updated().await;
}
#[cfg(not(any(feature = "ed25519-dalek", feature = "ed25519-salty")))]
{
Err(FirmwareUpdaterError::Signature(signature::Error::new()))
}
self.state.mark_updated().await
}
/// Verify the update in DFU with any digest.

View File

@ -142,7 +142,8 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> BlockingFirmwareUpdater<'d, DFU, STATE>
let mut chunk_buf = [0; 2];
self.hash::<Sha512>(_update_len, &mut chunk_buf, &mut message)?;
public_key.verify(&message, &signature).map_err(into_signature_error)?
public_key.verify(&message, &signature).map_err(into_signature_error)?;
return self.state.mark_updated();
}
#[cfg(feature = "ed25519-salty")]
{
@ -169,10 +170,13 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> BlockingFirmwareUpdater<'d, DFU, STATE>
message,
r.is_ok()
);
r.map_err(into_signature_error)?
r.map_err(into_signature_error)?;
return self.state.mark_updated();
}
#[cfg(not(any(feature = "ed25519-dalek", feature = "ed25519-salty")))]
{
Err(FirmwareUpdaterError::Signature(signature::Error::new()))
}
self.state.mark_updated()
}
/// Verify the update in DFU with any digest.