Skip to content

Commit

Permalink
Verifier: fix lint error for SGX/TDX
Browse files Browse the repository at this point in the history
delete useless code for SGX, also makes submodules public.

Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Jul 15, 2024
1 parent b96a3b4 commit 2720dd7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
32 changes: 0 additions & 32 deletions deps/verifier/src/sgx/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
//! ```
use anyhow::*;
use byteorder::{LittleEndian, ReadBytesExt};
use serde_json::{Map, Value};

use crate::TeeEvidenceParsedClaim;
Expand Down Expand Up @@ -112,37 +111,6 @@ pub fn generate_parsed_claims(quote: sgx_quote3_t) -> Result<TeeEvidenceParsedCl
Ok(Value::Object(claims) as TeeEvidenceParsedClaim)
}

/// Kernel Commandline Event inside Eventlog
pub struct TdShimPlatformConfigInfo<'a> {
pub descriptor: [u8; 16],
pub info_length: u32,
pub data: &'a [u8],
}

impl<'a> TryFrom<&'a [u8]> for TdShimPlatformConfigInfo<'a> {
type Error = anyhow::Error;

fn try_from(data: &'a [u8]) -> std::result::Result<Self, Self::Error> {
if data.len() < core::mem::size_of::<[u8; 16]>() + core::mem::size_of::<u32>() {
bail!("give data slice is too short");
}

let descriptor = data[0..core::mem::size_of::<[u8; 16]>()].try_into()?;
let info_length = (&data[core::mem::size_of::<[u8; 16]>()
..core::mem::size_of::<[u8; 16]>() + core::mem::size_of::<u32>()])
.read_u32::<LittleEndian>()?;
let data = &data[core::mem::size_of::<[u8; 16]>() + core::mem::size_of::<u32>()
..core::mem::size_of::<[u8; 16]>()
+ core::mem::size_of::<u32>()
+ info_length as usize];
Ok(Self {
descriptor,
info_length,
data,
})
}
}

#[cfg(test)]
mod tests {
use assert_json_diff::assert_json_eq;
Expand Down
2 changes: 1 addition & 1 deletion deps/verifier/src/tdx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use quote::{ecdsa_quote_verification, parse_tdx_quote};
use serde::{Deserialize, Serialize};

pub(crate) mod claims;
mod eventlog;
pub mod eventlog;
pub(crate) mod quote;

#[derive(Serialize, Deserialize, Debug)]
Expand Down

0 comments on commit 2720dd7

Please sign in to comment.