Skip to content

Commit

Permalink
Switch Box<dyn Clock> to Arc<dyn Clock> in DiceAttestationVerifie…
Browse files Browse the repository at this point in the history
…r so that the same clock can be shared between sessions.

Change-Id: Ic8b96422cbba8ad1221283d5686f5b03b1d241ac
  • Loading branch information
rakshita-tandon committed Oct 16, 2024
1 parent 5614f77 commit 0564867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion oak_session/src/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

//! Trait for the time related functionality.

pub trait Clock: Send {
pub trait Clock: Sync + Send {
fn get_current_time_ms(&self) -> i64;
}
6 changes: 3 additions & 3 deletions oak_session/src/dice_attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! This module provides an implementation of the Attestation Verifier bases on
//! verifying the DICE chain.

use alloc::{boxed::Box, string::ToString};
use alloc::{string::ToString, sync::Arc};

use oak_attestation_verification::verifier::verify;
use oak_proto_rust::oak::attestation::v1::{
Expand All @@ -28,12 +28,12 @@ use crate::{attestation::AttestationVerifier, clock::Clock};

struct DiceAttestationVerifier {
ref_values: ReferenceValues,
clock: Box<dyn Clock>,
clock: Arc<dyn Clock>,
}

#[allow(dead_code)]
impl DiceAttestationVerifier {
pub fn create(ref_values: ReferenceValues, clock: Box<dyn Clock>) -> Self {
pub fn create(ref_values: ReferenceValues, clock: Arc<dyn Clock>) -> Self {
DiceAttestationVerifier { ref_values, clock }
}
}
Expand Down

0 comments on commit 0564867

Please sign in to comment.