From 4da31bf2f99704a99ac9455eb0ffc83b8d08a6df Mon Sep 17 00:00:00 2001 From: Xynnn007 Date: Tue, 15 Jul 2025 16:32:31 +0800 Subject: [PATCH] agent: deliver initdata toml to attestation agent Now AA supports to receive initdata toml plaintext and deliver it in the attestation. This patch creates a file under '/run/confidential-containers/initdata' to store the initdata toml and give it to AA process. When we have a separate component to handle initdata, we will move the logic to that component. Signed-off-by: Xynnn007 --- src/agent/src/initdata.rs | 15 +++++++++++---- src/agent/src/main.rs | 10 +++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/agent/src/initdata.rs b/src/agent/src/initdata.rs index f7d4b7774e..cd4efa6be2 100644 --- a/src/agent/src/initdata.rs +++ b/src/agent/src/initdata.rs @@ -27,6 +27,9 @@ const AA_CONFIG_KEY: &str = "aa.toml"; const CDH_CONFIG_KEY: &str = "cdh.toml"; const POLICY_KEY: &str = "policy.rego"; +/// The path of initdata toml +pub const INITDATA_TOML_PATH: &str = concatcp!(INITDATA_PATH, "/initdata.toml"); + /// The path of AA's config file pub const AA_CONFIG_PATH: &str = concatcp!(INITDATA_PATH, "/aa.toml"); @@ -95,7 +98,7 @@ pub async fn read_initdata(device_path: &str) -> Result> { } pub struct InitdataReturnValue { - pub digest: Vec, + pub _digest: Vec, pub _policy: Option, } @@ -122,7 +125,11 @@ pub async fn initialize_initdata(logger: &Logger) -> Result Sha256::digest(&initdata_content).to_vec(), "sha384" => Sha384::digest(&initdata_content).to_vec(), "sha512" => Sha512::digest(&initdata_content).to_vec(), @@ -143,10 +150,10 @@ pub async fn initialize_initdata(logger: &Logger) -> Result