[dice] derive Debug for OwnedDiceArtifacts and BccHandover
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: I55bfe4e881aec9835667bacf719e964b43a3d81f
diff --git a/diced/open_dice/src/bcc.rs b/diced/open_dice/src/bcc.rs
index 0698e40..f343bc5 100644
--- a/diced/open_dice/src/bcc.rs
+++ b/diced/open_dice/src/bcc.rs
@@ -124,6 +124,7 @@
/// A BCC handover combines the BCC and CDIs in a single CBOR object.
/// This struct is used as return of the function `bcc_handover_parse`, its lifetime is tied
/// to the lifetime of the raw BCC handover slice.
+#[derive(Debug)]
pub struct BccHandover<'a> {
/// Attestation CDI.
pub cdi_attest: &'a Cdi,
@@ -173,6 +174,5 @@
let start: usize = unsafe {
addr.offset_from(buffer.as_ptr()).try_into().map_err(|_| DiceError::PlatformError)?
};
- let end = start.checked_add(len).ok_or(DiceError::PlatformError)?;
- buffer.get(start..end).ok_or(DiceError::PlatformError)
+ start.checked_add(len).and_then(|end| buffer.get(start..end)).ok_or(DiceError::PlatformError)
}
diff --git a/diced/open_dice/src/dice.rs b/diced/open_dice/src/dice.rs
index c87bbfd..350237d 100644
--- a/diced/open_dice/src/dice.rs
+++ b/diced/open_dice/src/dice.rs
@@ -63,7 +63,7 @@
pub type DiceId = [u8; ID_SIZE];
/// CDI Values.
-#[derive(Zeroize, ZeroizeOnDrop, Default)]
+#[derive(Debug, Zeroize, ZeroizeOnDrop, Default)]
pub struct CdiValues {
/// Attestation CDI.
pub cdi_attest: Cdi,
diff --git a/diced/open_dice/src/retry.rs b/diced/open_dice/src/retry.rs
index c28b691..b7c1a71 100644
--- a/diced/open_dice/src/retry.rs
+++ b/diced/open_dice/src/retry.rs
@@ -27,6 +27,7 @@
/// and the BCC formatted attestation certificate chain.
/// As we align with the DICE standards today, this is the certificate chain
/// is also called DICE certificate chain.
+#[derive(Debug)]
pub struct OwnedDiceArtifacts {
/// CDI Values.
pub cdi_values: CdiValues,