[apk_digest] Pass SignatureAlgorithmID to compute_digest
This CL passes the enum SignatureAlgorithmID to compute_digest
instead of raw integer.
Bug: 246254355
Test: libapkverify.integration_test
Change-Id: I451c841f5bb95701f350791c7395b9a50bf4455f
diff --git a/libs/apkverify/src/v3.rs b/libs/apkverify/src/v3.rs
index 76617e1..570ad49 100644
--- a/libs/apkverify/src/v3.rs
+++ b/libs/apkverify/src/v3.rs
@@ -195,7 +195,12 @@
.iter()
.find(|&dig| dig.signature_algorithm_id == strongest.signature_algorithm_id)
.unwrap(); // ok to unwrap since we check if two lists are the same above
- let computed = sections.compute_digest(digest.signature_algorithm_id)?;
+ let computed = sections.compute_digest(
+ // TODO(b/246254355): Removes the conversion once Digest contains the enum
+ // SignatureAlgorithmID.
+ SignatureAlgorithmID::from_u32(digest.signature_algorithm_id)
+ .context("Unsupported algorithm")?,
+ )?;
// 6. Verify that the computed digest is identical to the corresponding digest from digests.
ensure!(