From c4a9ba8bd341b46c1a2a011433b3cbf861c08933 Mon Sep 17 00:00:00 2001 From: Alice Wang Date: Thu, 2 Feb 2023 16:26:25 +0000 Subject: [PATCH] [dice] Pass InputValues to dice::execute_steps without conversion Test: atest VtsAidlDiceTargetTest VtsAidlDiceDemoteTargetTest Bug: 267575445 Change-Id: I14819bb8e1af10a2de4539077491de3fb7df9a83 --- .../dice/aidl/vts/functional/dice_demote_test.rs | 10 +--------- security/dice/aidl/vts/functional/dice_test.rs | 12 ++---------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/security/dice/aidl/vts/functional/dice_demote_test.rs b/security/dice/aidl/vts/functional/dice_demote_test.rs index 02ff2a455a..1a17ec7233 100644 --- a/security/dice/aidl/vts/functional/dice_demote_test.rs +++ b/security/dice/aidl/vts/functional/dice_demote_test.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use diced_open_dice_cbor as dice; use diced_sample_inputs; use diced_utils; use std::convert::TryInto; @@ -44,14 +43,7 @@ fn demote_test() { ) .unwrap(); - let input_values: Vec = input_values - .iter() - .map(|v| v.into()) - .collect(); - - let artifacts = artifacts - .execute_steps(input_values.iter().map(|v| v as &dyn dice::InputValues)) - .unwrap(); + let artifacts = artifacts.execute_steps(input_values.iter()).unwrap(); let (cdi_attest, cdi_seal, bcc) = artifacts.into_tuple(); let from_former = diced_utils::make_bcc_handover( cdi_attest[..].try_into().unwrap(), diff --git a/security/dice/aidl/vts/functional/dice_test.rs b/security/dice/aidl/vts/functional/dice_test.rs index 574b634d52..190f187050 100644 --- a/security/dice/aidl/vts/functional/dice_test.rs +++ b/security/dice/aidl/vts/functional/dice_test.rs @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -use diced_open_dice_cbor as dice; use diced_sample_inputs; use diced_utils; -use std::convert::{TryInto, Into}; +use std::convert::TryInto; mod utils; use utils::with_connection; @@ -44,14 +43,7 @@ fn equivalence_test() { ) .unwrap(); - let input_values: Vec = input_values - .iter() - .map(|v| v.into()) - .collect(); - - let artifacts = artifacts - .execute_steps(input_values.iter().map(|v| v as &dyn dice::InputValues)) - .unwrap(); + let artifacts = artifacts.execute_steps(input_values.iter()).unwrap(); let (cdi_attest, cdi_seal, bcc) = artifacts.into_tuple(); let from_former = diced_utils::make_bcc_handover( cdi_attest[..].try_into().unwrap(),