Skip to content

Conversation

@Ruteri
Copy link
Collaborator

@Ruteri Ruteri commented Jun 17, 2024

Adds verifyTDXDCAPQuote precompile and Suave library call that allows offchain verification of TDX DCAP quotes through https://github.com/intel/SGX-TDX-DCAP-QuoteVerificationLibrary.

const INCORRECT_INPUTS: PrecompileError =
PrecompileError::CustomPrecompileError("incorrect inputs passed in");

fn tgx_verify_quote_run(input: &[u8], gas_limit: u64) -> PrecompileResult {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tgx_verify_quote should be tdx_verify_quote

interface TDX_DCAP {
function verifyQuote(bytes memory quote, string memory pckCertPem, string memory pckCrlPem, string memory tcbInfoJson, string memory qeIdentityJson) external returns (uint status);
/*
TODO: also add the following
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all of these needed, more detail on which ones we can skip is probably helpful.

Comment on lines 29 to 47
// Redefined here to avoid having to import from external services
pub static TDX_DCAP_ABI: Lazy<BaseContract> = Lazy::new(|| {
let contract: Contract =
serde_json::from_str(include_str!("../out/TdxDcap.sol/TDX_DCAP.abi.json")).unwrap();
BaseContract::from(contract)
});

pub static VERIFY_QUOTE_ABI: Lazy<Function> = Lazy::new(|| {
TDX_DCAP_ABI
.abi()
.function("verifyQuote")
.expect("verifyQuote signature not available in TDX DCAP abi")
.clone()
});

const INPUTS_TOO_BIG: PrecompileError =
PrecompileError::CustomPrecompileError("inputs passed in are unreasonably big");
const INCORRECT_INPUTS: PrecompileError =
PrecompileError::CustomPrecompileError("incorrect inputs passed in");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 30 to 42
pub static TDX_DCAP_ABI: Lazy<BaseContract> = Lazy::new(|| {
let contract: Contract =
serde_json::from_str(include_str!("../out/TdxDcap.sol/TDX_DCAP.abi.json")).unwrap();
BaseContract::from(contract)
});

pub static VERIFY_QUOTE_ABI: Lazy<Function> = Lazy::new(|| {
TDX_DCAP_ABI
.abi()
.function("verifyQuote")
.expect("verifyQuote signature not available in TDX DCAP abi")
.clone()
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ruteri Ruteri force-pushed the tdx-dcap-verification branch from 57a9b9c to 0078bd8 Compare July 25, 2024 10:40
@Ruteri Ruteri changed the base branch from main to reth-v1.0.0-rebase July 25, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants