Revert^2 "Make salt in Microdroid's instance img obsolete"
Salt has been used to provide differentiation of secrets of 2
non-protected VMs (as hidden input in DICE). Have hidden input be
derived from instance_id of the (non protected) VM. In all other cases,
it will be all 0s.
Test: Microdroid tests use this code path.
Bug: 291306122
Re-revert: The reason for failures was a different issue(b/291306122),
this patch is harmless.
Change-Id: I86727ce5361b2cf4e9be59b2f8c0c5e76af9d2e8
diff --git a/microdroid_manager/src/verify.rs b/microdroid_manager/src/verify.rs
index 445c1ae..65c32b0 100644
--- a/microdroid_manager/src/verify.rs
+++ b/microdroid_manager/src/verify.rs
@@ -169,13 +169,14 @@
// verified is consistent with the root hash) or because we have the saved APK data which will
// be checked as identical to the data we have verified.
- // Use the salt from a verified instance, or generate a salt for a new instance.
- let salt = if let Some(saved_data) = saved_data {
- saved_data.salt.clone()
- } else if is_strict_boot() {
- // No need to add more entropy as a previous stage must have used a new, random salt.
+ let salt = if cfg!(llpvm_changes) || is_strict_boot() {
+ // Salt is obsolete with llpvm_changes.
vec![0u8; 64]
+ } else if let Some(saved_data) = saved_data {
+ // Use the salt from a verified instance.
+ saved_data.salt.clone()
} else {
+ // Generate a salt for a new instance.
let mut salt = vec![0u8; 64];
salt.as_mut_slice().try_fill(&mut rand::thread_rng())?;
salt