Skip to content

Commit 8b5a9d4

Browse files
committed
add --tcb_eval_data_num option to zkdcap-sim command
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent d1c14ec commit 8b5a9d4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

app/src/commands/attestation.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,14 @@ pub struct ZKDCAPSIMRemoteAttestation {
437437
help = "Quote status to include in the report"
438438
)]
439439
pub isv_enclave_quote_status: String,
440+
441+
/// TCB Evaluation Data Number for TCB Info and QE Identity
442+
#[clap(
443+
long = "tcb_eval_data_num",
444+
default_value = "1",
445+
help = "TCB Evaluation Data Number"
446+
)]
447+
pub tcb_eval_data_num: u32,
440448
}
441449

442450
impl ZKDCAPSIMRemoteAttestation {
@@ -477,7 +485,8 @@ fn run_zkdcap_ra_simulation<E: EnclaveCommandAPI<S>, S: CommitStore>(
477485
DCAP_SIM_ROOT_KEY_PKCS8.as_bytes(),
478486
)?
479487
.with_advisory_ids(cmd.advisory_ids.clone())
480-
.with_isv_enclave_quote_status(cmd.isv_enclave_quote_status.as_str())?,
488+
.with_isv_enclave_quote_status(cmd.isv_enclave_quote_status.as_str())?
489+
.with_tcb_evaluation_data_number(cmd.tcb_eval_data_num),
481490
)?;
482491
Ok(())
483492
}

modules/remote-attestation/src/dcap_simulation.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct DCAPRASimulationOpts {
7474

7575
advisory_ids: Vec<String>,
7676
isv_enclave_quote_status: Status,
77+
tcb_evaluation_data_number: u32,
7778
}
7879

7980
impl DCAPRASimulationOpts {
@@ -96,6 +97,7 @@ impl DCAPRASimulationOpts {
9697
root_key,
9798
advisory_ids: Default::default(),
9899
isv_enclave_quote_status: Status::Ok,
100+
tcb_evaluation_data_number: 1,
99101
})
100102
}
101103

@@ -122,6 +124,11 @@ impl DCAPRASimulationOpts {
122124
})?;
123125
Ok(self)
124126
}
127+
128+
pub fn with_tcb_evaluation_data_number(mut self, number: u32) -> Self {
129+
self.tcb_evaluation_data_number = number;
130+
self
131+
}
125132
}
126133

127134
pub fn run_dcap_ra_simulation(
@@ -253,11 +260,13 @@ pub(crate) fn simulate_gen_quote_and_collaterals(
253260
// fmspc and tcb_levels must be consistent with the sgx extensions in the pck cert
254261
let tcb_info = TcbInfoV3Builder::new(true)
255262
.fmspc([0, 96, 106, 0, 0, 0])
263+
.tcb_evaluation_data_number(opts.tcb_evaluation_data_number)
256264
.tcb_levels(target_tcb_levels)
257265
.build_and_sign(&tcb_certchain.key)
258266
.unwrap();
259267

260268
let qe_identity = EnclaveIdentityV2Builder::new(EnclaveIdentityId::QE)
269+
.tcb_evaluation_data_number(opts.tcb_evaluation_data_number)
261270
.tcb_levels_json(json!([
262271
{
263272
"tcb": {

0 commit comments

Comments
 (0)