microdroid_manager: Zero DICE hidden input
As we assume that instance.img entries can't be individually modified
without it being detected (thanks to the avf,new-instance flag), there
is no need to generate a random salt for DICE in microdroid_manager if
pvmfw has run (i.e. avf,strict-boot is received) so use a zero value if
one isn't found in the instance.img. This makes pvmfw the only source of
per-instance secret uniqueness, enabling end-to-end tests to validate
that functionality of pvmfw.
Bug: 268307476
Test: atest MicrodroidTestApp
Change-Id: Ia1c4f056b8106ddae4f2fd753fbc19e4c203b65a
diff --git a/microdroid_manager/src/main.rs b/microdroid_manager/src/main.rs
index 1148c31..a464163 100644
--- a/microdroid_manager/src/main.rs
+++ b/microdroid_manager/src/main.rs
@@ -721,6 +721,9 @@
// 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.
+ vec![0u8; 64]
} else {
let mut salt = vec![0u8; 64];
salt.as_mut_slice().try_fill(&mut rand::thread_rng())?;