[dice] Add trait DiceArtifacts to access BCC and CDI values

The added DiceArtifacts is implemented for both BccHandover and
OwnedDiceArtifacts. This allows us to access the dice artifacts in
an easy and uniform way.

[u8; CDI_SIZE] is used instead of the alias Cdi to facilitate a
future conversion from Cdi alias to Cdi type so that we can have
more controle over the memory security of CDI. More context in
b/268587826.

Bug: 267575445
Test: atest diced_utils_test diced_sample_inputs_test \
diced_vendor_test diced_open_dice_cbor_test \
libdiced_open_dice_nostd.integration_test \
libdiced_open_dice.integration_test diced_open_dice_cbor_test

Change-Id: Iabb87ad18f2f4a4d46283da045eb21a5776ad4b4
diff --git a/diced/src/diced_client_test.rs b/diced/src/diced_client_test.rs
index 054b2d1..29d7295 100644
--- a/diced/src/diced_client_test.rs
+++ b/diced/src/diced_client_test.rs
@@ -19,6 +19,7 @@
 use android_security_dice::aidl::android::security::dice::IDiceMaintenance::IDiceMaintenance;
 use android_security_dice::aidl::android::security::dice::IDiceNode::IDiceNode;
 use binder::Strong;
+use diced_open_dice::DiceArtifacts;
 use diced_open_dice_cbor as dice;
 use nix::libc::uid_t;
 use std::convert::TryInto;
@@ -54,11 +55,10 @@
             .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(),
-        cdi_seal[..].try_into().unwrap(),
-        &bcc,
+        artifacts.cdi_attest(),
+        artifacts.cdi_seal(),
+        artifacts.bcc().expect("bcc is none"),
     )
     .unwrap();
     // TODO when we have a parser/verifier, check equivalence rather
@@ -94,11 +94,10 @@
     .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(),
-        cdi_seal[..].try_into().unwrap(),
-        &bcc,
+        artifacts.cdi_attest(),
+        artifacts.cdi_seal(),
+        artifacts.bcc().expect("bcc is none"),
     )
     .unwrap();
     // TODO b/204938506 when we have a parser/verifier, check equivalence rather
@@ -156,11 +155,10 @@
     let client = [client];
 
     let artifacts = artifacts.execute_steps(input_values.iter().chain(client.iter())).unwrap();
-    let (cdi_attest, cdi_seal, bcc) = artifacts.into_tuple();
     let from_former = diced_utils::make_bcc_handover(
-        cdi_attest[..].try_into().unwrap(),
-        cdi_seal[..].try_into().unwrap(),
-        &bcc,
+        artifacts.cdi_attest(),
+        artifacts.cdi_seal(),
+        artifacts.bcc().expect("bcc is none"),
     )
     .unwrap();
     // TODO b/204938506 when we have a parser/verifier, check equivalence rather