From 0564867a01e284f60c875dfda652064db4d69388 Mon Sep 17 00:00:00 2001 From: Rakshita Tandon Date: Wed, 16 Oct 2024 15:46:39 +0000 Subject: [PATCH] Switch `Box` to `Arc` in DiceAttestationVerifier so that the same clock can be shared between sessions. Change-Id: Ic8b96422cbba8ad1221283d5686f5b03b1d241ac --- oak_session/src/clock.rs | 2 +- oak_session/src/dice_attestation.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/oak_session/src/clock.rs b/oak_session/src/clock.rs index 6a915a055f..60afd85856 100644 --- a/oak_session/src/clock.rs +++ b/oak_session/src/clock.rs @@ -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; } diff --git a/oak_session/src/dice_attestation.rs b/oak_session/src/dice_attestation.rs index 5f687071d3..be8cccbeea 100644 --- a/oak_session/src/dice_attestation.rs +++ b/oak_session/src/dice_attestation.rs @@ -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::{ @@ -28,12 +28,12 @@ use crate::{attestation::AttestationVerifier, clock::Clock}; struct DiceAttestationVerifier { ref_values: ReferenceValues, - clock: Box, + clock: Arc, } #[allow(dead_code)] impl DiceAttestationVerifier { - pub fn create(ref_values: ReferenceValues, clock: Box) -> Self { + pub fn create(ref_values: ReferenceValues, clock: Arc) -> Self { DiceAttestationVerifier { ref_values, clock } } }