Skip to content

Commit 3ac0ac5

Browse files
committed
fix attested_at for DCAP/zkDCAP quote
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent 220d39c commit 3ac0ac5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

modules/remote-attestation/src/dcap.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn run_dcap_ra(
4242
)?;
4343

4444
key_manager
45-
.save_ra_quote(target_enclave_key, result.get_quote().into())
45+
.save_ra_quote(target_enclave_key, result.get_ra_quote(current_time).into())
4646
.map_err(|e| {
4747
Error::key_manager(format!("cannot save DCAP quote: {}", target_enclave_key), e)
4848
})?;
@@ -62,7 +62,9 @@ pub(crate) fn dcap_ra(
6262
e,
6363
)
6464
})?;
65-
let raw_quote = rsgx_qe_get_quote(&ek_info.report).unwrap();
65+
let raw_quote = rsgx_qe_get_quote(&ek_info.report)
66+
.map_err(|status| Error::sgx_qe3_error(status, "failed to get quote".into()))?;
67+
6668
info!("Successfully get the quote: {}", hex::encode(&raw_quote));
6769

6870
let quote = QuoteV3::from_bytes(&raw_quote).map_err(Error::dcap_quote_verifier)?;
@@ -91,13 +93,13 @@ pub struct DCAPRemoteAttestationResult {
9193
}
9294

9395
impl DCAPRemoteAttestationResult {
94-
pub fn get_quote(&self) -> DCAPQuote {
96+
pub fn get_ra_quote(&self, attested_at: Time) -> DCAPQuote {
9597
DCAPQuote::new(
9698
self.raw_quote.clone(),
9799
self.output.fmspc,
98100
self.output.tcb_status.to_string(),
99101
self.output.advisory_ids.clone(),
100-
Time::now(),
102+
attested_at,
101103
DcapCollateral {
102104
tcbinfo_bytes: self.collateral.tcbinfo_bytes.clone(),
103105
qeidentity_bytes: self.collateral.qeidentity_bytes.clone(),

modules/remote-attestation/src/zkdcap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn run_zkdcap_ra(
9595
);
9696
}
9797

98-
let quote = res.get_quote();
98+
let quote = res.get_ra_quote(current_time);
9999
key_manager
100100
.save_ra_quote(
101101
target_enclave_key,

0 commit comments

Comments
 (0)