From cfb4e92217b413d5498d63736c348dd6e785c39d Mon Sep 17 00:00:00 2001 From: Alice Wang Date: Wed, 8 Feb 2023 09:26:46 +0000 Subject: [PATCH] [dice] Adjust the output type of make_sample_bcc_and_cdis() This is part of the project of merging the two existing dice wrapper libraries into the library libdiced_open_dice to improve maintainability. Bug: 267575445 Test: m android.hardware.security.dice-service.non-secure-software Test: atest VtsAidlDiceTargetTest VtsAidlDiceDemoteTargetTest Change-Id: If9ee66a320775897342f53d58ee11405a8e70c6f --- security/dice/aidl/default/service.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/security/dice/aidl/default/service.rs b/security/dice/aidl/default/service.rs index eebf3332a6..0197f2c71c 100644 --- a/security/dice/aidl/default/service.rs +++ b/security/dice/aidl/default/service.rs @@ -21,7 +21,6 @@ use diced::{ }; use diced_sample_inputs::make_sample_bcc_and_cdis; use serde::{Deserialize, Serialize}; -use std::convert::TryInto; use std::panic; use std::sync::Arc; @@ -76,7 +75,7 @@ fn main() { // Saying hi. log::info!("android.hardware.security.dice is starting."); - let (cdi_attest, cdi_seal, bcc) = + let dice_artifacts = make_sample_bcc_and_cdis().expect("Failed to construct sample dice chain."); let hal_impl = Arc::new( @@ -85,13 +84,9 @@ fn main() { // This service does not start a thread pool. The main thread is the only thread // joining the thread pool, thereby keeping the process single threaded. ResidentHal::new(InsecureSerializableArtifacts { - cdi_attest: cdi_attest[..] - .try_into() - .expect("Failed to convert cdi_attest to array reference."), - cdi_seal: cdi_seal[..] - .try_into() - .expect("Failed to convert cdi_seal to array reference."), - bcc, + cdi_attest: dice_artifacts.cdi_values.cdi_attest, + cdi_seal: dice_artifacts.cdi_values.cdi_seal, + bcc: dice_artifacts.bcc[..].to_vec(), }) } .expect("Failed to create ResidentHal implementation."),