Add more context for avb::Header::set_algo_for_key() calls

Previously, it was not always obvious which key was problematic.

Issue: #366

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This commit is contained in:
Andrew Gunnerson
2024-11-05 17:53:01 -05:00
parent 37e28eb040
commit 3f25ad7c76
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -398,7 +398,9 @@ fn sign_or_clear(info: &mut AvbInfo, orig_header: &Header, key_group: &KeyGroup)
RsaSigningKey::Internal(private_key)
};
info.header.set_algo_for_key(&signing_key)?;
info.header
.set_algo_for_key(&signing_key)
.context("Failed to set signature algorithm")?;
info.header
.sign(&signing_key)
.context("Failed to sign new AVB header")?;
+3 -1
View File
@@ -593,7 +593,9 @@ fn update_vbmeta_headers(
// have no dependencies and are only being processed to ensure that the
// flags are set to a sane value.
if parent_header != &orig_parent_header {
parent_header.set_algo_for_key(key)?;
parent_header
.set_algo_for_key(key)
.with_context(|| format!("Failed to set signature algorithm: {name}"))?;
parent_header
.sign(key)
.with_context(|| format!("Failed to sign vbmeta header for image: {name}"))?;