From 0bf8618f9aa97ee5be58a024c1dd9a882e4189bb Mon Sep 17 00:00:00 2001 From: Qi Feng Huo Date: Fri, 7 Jun 2024 23:18:50 +0800 Subject: [PATCH] aa/attester: IBM Secure Execution driver fix comments Signed-off-by: Qi Feng Huo --- attestation-agent/attester/src/se/mod.rs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/attestation-agent/attester/src/se/mod.rs b/attestation-agent/attester/src/se/mod.rs index 121b37f4f..667a5445e 100644 --- a/attestation-agent/attester/src/se/mod.rs +++ b/attestation-agent/attester/src/se/mod.rs @@ -7,6 +7,7 @@ use super::Attester; use anyhow::*; use log::debug; use pv::{ + misc, request::BootHdrTags, uv::{AttestationCmd, ConfigUid, UvDevice}, }; @@ -15,17 +16,7 @@ use serde_json; use serde_with::{base64::Base64, serde_as}; pub fn detect_platform() -> bool { - // run always on s390x machine - let v = std::fs::read("/sys/firmware/uv/prot_virt_guest").unwrap_or_else(|_| vec![0]); - let v: u8 = String::from_utf8_lossy(&v[..1]).parse().unwrap_or(0); - v == 1 -} - -#[serde_as] -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct UserData { - #[serde_as(as = "Base64")] - image_btph: Vec, + misc::pv_guest_bit_set } #[repr(C)] @@ -70,14 +61,6 @@ pub struct SeAttester {} #[async_trait::async_trait] impl Attester for SeAttester { async fn get_evidence(&self, req: Vec) -> Result { - // req is serialized SeAttestationRequest String bytes - // TODO, optionally calculate image boot partition hash (btph). - let image_btph = "optional check"; - let userdata = UserData { - image_btph: image_btph.into(), - }; - - debug!("userdata json: {userdata:#?}"); // req is serialized SeAttestationRequest String bytes let request: SeAttestationRequest = serde_json::from_slice(&req)?; let SeAttestationRequest { @@ -88,7 +71,7 @@ impl Attester for SeAttester { encr_request_nonce, image_hdr_tags, } = request; - let user_data = serde_json::to_vec(&userdata)?; + let user_data = vec![0]; let mut uvc: AttestationCmd = AttestationCmd::new_request( request_blob.into(), Some(user_data.to_vec()),