diff --git a/dpe/src/commands/certify_key.rs b/dpe/src/commands/certify_key.rs index 9bb09055..a2c23e76 100644 --- a/dpe/src/commands/certify_key.rs +++ b/dpe/src/commands/certify_key.rs @@ -773,7 +773,7 @@ mod tests { let second = parsed_tcb_infos.next().unwrap(); assert_eq!(first.tci_type.unwrap(), &[0, 0, 0, 0]); - assert_eq!(second.tci_type.unwrap(), &[0, 0, 0, 1]); + assert_eq!(second.tci_type.unwrap(), &[1, 0, 0, 0]); assert!(parsed_tcb_infos.next().is_none()); } } diff --git a/dpe/src/x509.rs b/dpe/src/x509.rs index e968a83e..3cde5053 100644 --- a/dpe/src/x509.rs +++ b/dpe/src/x509.rs @@ -17,6 +17,7 @@ use platform::CertValidity; #[cfg(not(feature = "disable_csr"))] use platform::SignerIdentifier; use platform::{OtherName, SubjectAltName, MAX_KEY_IDENTIFIER_SIZE}; +use zerocopy::AsBytes; pub enum DirectoryString<'a> { PrintableString(&'a [u8]), @@ -1246,7 +1247,7 @@ impl CertWriter<'_> { // IMPLICIT[9] Primitive bytes_written += self.encode_byte(Self::CONTEXT_SPECIFIC | 0x09)?; bytes_written += self.encode_size_field(core::mem::size_of::())?; - bytes_written += self.encode_bytes(&node.tci_type.to_be_bytes())?; + bytes_written += self.encode_bytes(node.tci_type.as_bytes())?; Ok(bytes_written) } @@ -2239,6 +2240,7 @@ pub(crate) mod tests { use x509_parser::nom::Parser; use x509_parser::oid_registry::asn1_rs::oid; use x509_parser::prelude::*; + use zerocopy::AsBytes; #[derive(asn1::Asn1Read)] pub struct Fwid<'a> { @@ -2396,10 +2398,7 @@ pub(crate) mod tests { assert_eq!(expected_current, node.tci_current.0); assert_eq!(expected_cumulative, node.tci_cumulative.0); - assert_eq!( - parsed_tcb_info.tci_type.unwrap(), - node.tci_type.to_be_bytes() - ); + assert_eq!(parsed_tcb_info.tci_type.unwrap(), node.tci_type.as_bytes()); assert_eq!( parsed_tcb_info.vendor_info.unwrap(), node.locality.to_be_bytes()