[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)
}