Skip to content

Commit 928a3ee

Browse files
committed
add tcb_evaulation_data_number option to zkdcap command
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent 1450b48 commit 928a3ee

File tree

9 files changed

+18
-37
lines changed

9 files changed

+18
-37
lines changed

Cargo.lock

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

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", features = ["dcap-quote-parser"] }
30-
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.2" }
30+
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53" }
3131

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

app/src/commands/attestation.rs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -248,36 +248,17 @@ pub struct SgxCollateralService {
248248
)]
249249
pub certs_service_url: Option<String>,
250250
#[clap(
251-
long = "update_policy",
252-
default_value = "early",
253-
help = "Update policy (early(default) or standard)"
251+
long = "tcb_evaluation_data_number",
252+
help = "TCB Evaluation Data Number for TCB Info and QE Identity (default: Latest TCB Evaluation Data Number)"
254253
)]
255-
pub update_policy: UpdatePolicy,
254+
pub tcb_evaluation_data_number: Option<u32>,
256255
#[clap(
257256
long = "expected_tcb_evaluation_data_number",
258257
help = "Expected TCB Evaluation Data Number for TCB Info and QE Identity"
259258
)]
260259
pub expected_tcb_evaluation_data_number: Option<u32>,
261260
}
262261

263-
#[derive(Clone, Debug, PartialEq)]
264-
pub enum UpdatePolicy {
265-
Early,
266-
Standard,
267-
}
268-
269-
impl FromStr for UpdatePolicy {
270-
type Err = anyhow::Error;
271-
272-
fn from_str(s: &str) -> Result<Self, Self::Err> {
273-
match s.to_lowercase().as_str() {
274-
"early" => Ok(Self::Early),
275-
"standard" => Ok(Self::Standard),
276-
_ => Err(anyhow!("invalid update policy: {}", s)),
277-
}
278-
}
279-
}
280-
281262
impl SgxCollateralService {
282263
pub fn get_pccs_url(&self) -> String {
283264
self.pccs_url
@@ -298,7 +279,7 @@ impl From<SgxCollateralService> for ValidatedPCSClient {
298279
PCSClient::new(
299280
service.get_pccs_url().as_str(),
300281
service.get_certs_service_url().as_str(),
301-
service.update_policy == UpdatePolicy::Early,
282+
service.tcb_evaluation_data_number,
302283
),
303284
service.expected_tcb_evaluation_data_number,
304285
)

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 = "v0.0.2", optional = true }
21+
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53", optional = true }
2222

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

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 = "v0.0.2" }
14+
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53" }
1515

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

modules/remote-attestation/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ serde_json = { version = "1.0", features = ["preserve_order"] }
2727
rsa = { version = "0.9.2", features = ["pem"], optional = true }
2828
chrono = { version = "0.4.38", features = ["now"], optional = true }
2929

30-
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.2" }
31-
dcap-pcs = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.2" }
32-
dcap-collaterals = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.2" }
30+
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53" }
31+
dcap-pcs = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53" }
32+
dcap-collaterals = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53" }
3333

3434
lcp-types = { path = "../types" }
3535
crypto = { path = "../crypto", default-features = false }

modules/remote-attestation/src/dcap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ mod tests {
144144
let pcs_client = PCSClient::new(
145145
"https://api.trustedservices.intel.com/",
146146
"https://certificates.trustedservices.intel.com/",
147-
false,
147+
None,
148148
);
149149
let collateral = pcs_client
150150
.get_collateral(true, &quote.signature.qe_cert_data)

tests/integration/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ attestation-report = { path = "../../modules/attestation-report" }
3535
keymanager = { path = "../../modules/keymanager" }
3636
remote-attestation = { path = "../../modules/remote-attestation" }
3737

38-
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.2" }
38+
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "49a2e9360db289c637732a60460f3d7d47f9fb53" }
3939

4040
[features]
4141
default = []

tests/integration/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ mod tests {
255255
PCSClient::new(
256256
"https://api.trustedservices.intel.com/",
257257
"https://certificates.trustedservices.intel.com/",
258-
false,
258+
None,
259259
),
260260
None,
261261
),

0 commit comments

Comments
 (0)