Skip to content

Commit 02d72de

Browse files
committed
update zkDCAP crate
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent 1620076 commit 02d72de

File tree

18 files changed

+110
-219
lines changed

18 files changed

+110
-219
lines changed

Cargo.lock

Lines changed: 53 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ test:
198198

199199
.PHONY: integration-test
200200
integration-test: $(Signed_RustEnclave_Name) bin/gaiad
201-
@PATH=${PATH}:$(CURDIR)/bin cargo test $(CARGO_TARGET) --package integration-test $(APP_CARGO_FEATURES)
201+
cargo test $(CARGO_TARGET) --package integration-test $(APP_CARGO_FEATURES)
202202

203203
.PHONY: test-nodes
204204
test-setup-nodes: bin/gaiad

app/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ crypto = { path = "../modules/crypto" }
2727
keymanager = { path = "../modules/keymanager" }
2828
remote-attestation = { path = "../modules/remote-attestation" }
2929
attestation-report = { path = "../modules/attestation-report" }
30-
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "54ab01c04ca8738b8568b4a6c74a493715af9d2b" }
30+
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "ff61208c9c8e6019289bb2beb7a76cfbf94e801f" }
3131

3232
[build-dependencies]
3333
git2 = { version = "0.20", default-features = false }

app/src/commands/attestation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use enclave_api::{Enclave, EnclaveCommandAPI, EnclaveProtoAPI};
99
use host::store::transaction::CommitStore;
1010
use remote_attestation::{
1111
dcap,
12+
dcap_pcs::client::PCSClient,
1213
dcap_simulation::{DCAP_SIM_ROOT_CA_PEM, DCAP_SIM_ROOT_KEY_PKCS8},
13-
dcap_utils::CollateralService,
1414
ias, zkdcap, IASMode,
1515
};
1616
use remote_attestation::{
@@ -263,13 +263,13 @@ impl SgxCollateralService {
263263
}
264264
}
265265

266-
impl From<SgxCollateralService> for CollateralService {
266+
impl From<SgxCollateralService> for PCSClient {
267267
fn from(service: SgxCollateralService) -> Self {
268-
Self {
269-
pccs_url: service.get_pccs_url(),
270-
certs_service_url: service.get_certs_service_url(),
271-
is_early_update: service.is_early_update,
272-
}
268+
Self::new(
269+
service.get_pccs_url().as_str(),
270+
service.get_certs_service_url().as_str(),
271+
service.is_early_update,
272+
)
273273
}
274274
}
275275

app/src/commands/enclave.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn run_list_keys<E: EnclaveCommandAPI<S>, S: CommitStore>(
156156
"address": eki.address.to_hex_string(),
157157
"attested": true,
158158
"report_data": quote.report_data()?.to_string(),
159-
"isv_enclave_quote_status": quote.tcb_status,
159+
"isv_enclave_quote_status": quote.status,
160160
"advisory_ids": quote.advisory_ids,
161161
"attested_at": quote.attested_at.to_string(),
162162
}});
@@ -167,7 +167,7 @@ fn run_list_keys<E: EnclaveCommandAPI<S>, S: CommitStore>(
167167
"address": eki.address.to_hex_string(),
168168
"attested": true,
169169
"report_data": quote.dcap_quote.report_data()?.to_string(),
170-
"isv_enclave_quote_status": quote.dcap_quote.tcb_status,
170+
"isv_enclave_quote_status": quote.dcap_quote.status,
171171
"advisory_ids": quote.dcap_quote.advisory_ids,
172172
"attested_at": quote.dcap_quote.attested_at.to_string(),
173173
}});

modules/attestation-report/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pem = { version = "2.0", default-features = false }
1818
webpki = { version = "0.22", features = ["alloc"] }
1919
anyhow = { version = "1", default-features = false }
2020

21-
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "54ab01c04ca8738b8568b4a6c74a493715af9d2b", optional = true }
21+
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "ff61208c9c8e6019289bb2beb7a76cfbf94e801f", optional = true }
2222

2323
[dev-dependencies]
2424
tokio = { version = "1.0", default-features = false, features = ["macros"] }

modules/attestation-report/src/dcap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct DCAPQuote {
1717
#[serde_as(as = "serde_with::hex::Hex<serde_with::formats::Lowercase>")]
1818
pub fmspc: [u8; 6],
1919
/// TCB status of the processor/platform
20-
pub tcb_status: String,
20+
pub status: String,
2121
/// Advisory IDs of the processor/platform
2222
pub advisory_ids: Vec<String>,
2323
/// Time when the quote was attested
@@ -41,7 +41,7 @@ impl DCAPQuote {
4141
#[cfg(feature = "std")]
4242
pub fn report_data(&self) -> Result<crate::ReportData, Error> {
4343
use dcap_quote_verifier::types::quotes::version_3::QuoteV3;
44-
let quote = QuoteV3::from_bytes(&self.raw).map_err(Error::dcap_quote_verifier)?;
44+
let (quote, _) = QuoteV3::from_bytes(&self.raw).map_err(Error::dcap_quote_verifier)?;
4545
Ok(crate::ReportData(quote.isv_enclave_report.report_data))
4646
}
4747
}

modules/keymanager/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl TryFrom<SealedEnclaveKeyInfo> for ProtoEnclaveKeyInfo {
420420
quote: dcap.raw,
421421
fmspc: dcap.fmspc.to_vec(),
422422
attestation_time,
423-
tcb_status: dcap.tcb_status,
423+
tcb_status: dcap.status,
424424
advisory_ids: dcap.advisory_ids,
425425
collateral: Some(dcap.collateral),
426426
})),
@@ -436,7 +436,7 @@ impl TryFrom<SealedEnclaveKeyInfo> for ProtoEnclaveKeyInfo {
436436
quote: dcap.raw,
437437
fmspc: dcap.fmspc.to_vec(),
438438
attestation_time,
439-
tcb_status: dcap.tcb_status,
439+
tcb_status: dcap.status,
440440
advisory_ids: dcap.advisory_ids,
441441
collateral: Some(dcap.collateral),
442442
}),

modules/lcp-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ flex-error = { version = "0.4.4", default-features = false }
1111
tiny-keccak = { version = "2.0" }
1212
hex-literal = { version = "0.4.1" }
1313
alloy-sol-types = { version = "0.8", default-features = false }
14-
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "54ab01c04ca8738b8568b4a6c74a493715af9d2b" }
14+
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "ff61208c9c8e6019289bb2beb7a76cfbf94e801f" }
1515

1616
attestation-report = { path = "../attestation-report", default-features = false }
1717
remote-attestation = { path = "../remote-attestation", default-features = false }

modules/lcp-client/src/client_def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl LCPClient {
286286
.validate_time(ctx.host_timestamp().as_unix_timestamp_secs()),
287287
"invalid validity intersection"
288288
);
289-
let tcb_status = message.quote_verification_output.tcb_status.to_string();
289+
let tcb_status = message.quote_verification_output.status.to_string();
290290
assert!(
291291
tcb_status == "UpToDate" || client_state.allowed_quote_statuses.contains(&tcb_status),
292292
"unexpected tcb status"
@@ -302,7 +302,7 @@ impl LCPClient {
302302
verify_signature_address(
303303
compute_eip712_zkdcap_register_enclave_key(
304304
zkdcap_verifier_info,
305-
message.quote_verification_output.hash(),
305+
keccak256(&message.quote_verification_output.to_bytes()),
306306
)
307307
.as_ref(),
308308
operator_signature.as_ref(),

0 commit comments

Comments
 (0)