VmSecret struct: Encapsulate secret mechanisms
The current secrets are derived from Dice sealing CDIs , called V1. The
new mechanism will will derive secret from Dice Sealing CDIs and
Rollback protected secret (using Secretkeeper HAL). This patch create
scaffolding code to describe these.
This is guarded by feature flag: release_avf_enable_llpvm_changes,
which when disabled, pVMs use V1 secrets.
Bug: 291216276
Bug: 291213394
Test: atest MicrodroidTests#encryptedStorageIsPersistent
Change-Id: I7d610ba97b6f3e45c757546614dc3216e9d0e78f
diff --git a/microdroid_manager/src/dice.rs b/microdroid_manager/src/dice.rs
index 27ec7a5..27905c9 100644
--- a/microdroid_manager/src/dice.rs
+++ b/microdroid_manager/src/dice.rs
@@ -32,16 +32,6 @@
use std::ptr::null_mut;
use std::slice;
-/// Derives a sealing key from the DICE sealing CDI.
-pub fn derive_sealing_key(
- dice_artifacts: &dyn DiceArtifacts,
- salt: &[u8],
- info: &[u8],
- key: &mut [u8],
-) -> Result<()> {
- Ok(hkdf(key, Md::sha256(), dice_artifacts.cdi_seal(), salt, info)?)
-}
-
/// Artifacts that are mapped into the process address space from the driver.
pub enum DiceDriver<'a> {
Real {
@@ -109,7 +99,7 @@
// input key material is already cryptographically strong.
let mut key = ZVec::new(key_length)?;
let salt = &[];
- derive_sealing_key(self.dice_artifacts(), salt, identifier, &mut key)?;
+ hkdf(&mut key, Md::sha256(), self.dice_artifacts().cdi_seal(), salt, identifier)?;
Ok(key)
}