From 49422d391cbae851591fda6f8851e088df7cab96 Mon Sep 17 00:00:00 2001 From: Carl Lundin Date: Tue, 11 Feb 2025 15:31:40 -0800 Subject: [PATCH] Update DPE to the latest zerocopy. --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- dpe/src/commands/certify_key.rs | 2 +- dpe/src/commands/derive_context.rs | 2 +- dpe/src/commands/initialize_context.rs | 2 +- dpe/src/commands/rotate_context.rs | 2 +- dpe/src/commands/sign.rs | 2 +- dpe/src/dpe_instance.rs | 6 +++--- dpe/src/lib.rs | 2 +- dpe/src/support.rs | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a87ab5a..32172f49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1379,18 +1379,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.8" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a4e33e6dce36f2adba29746927f8e848ba70989fdb61c772773bbdda8b5d6a7" +checksum = "aa91407dacce3a68c56de03abe2760159582b846c6a4acd2f456618087f12713" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.8" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd137b4cc21bde6ecce3bbbb3350130872cda0be2c6888874279ea76e17d4c1" +checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 523cc05c..41264eca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ members = [ [workspace.dependencies] caliptra-cfi-lib-git = { git = "https://github.com/chipsalliance/caliptra-cfi.git", package = "caliptra-cfi-lib-git", rev = "a98e499d279e81ae85881991b1e9eee354151189", default-features = false, features = ["cfi", "cfi-counter" ] } caliptra-cfi-derive-git = { git = "https://github.com/chipsalliance/caliptra-cfi.git", package = "caliptra-cfi-derive-git", rev = "a98e499d279e81ae85881991b1e9eee354151189"} -zerocopy = { version = "0.8.8", features = ["derive"] } +zerocopy = { version = "0.8.17", features = ["derive"] } openssl = "0.10.64" [profile.firmware] diff --git a/dpe/src/commands/certify_key.rs b/dpe/src/commands/certify_key.rs index 16042e78..981b2a02 100644 --- a/dpe/src/commands/certify_key.rs +++ b/dpe/src/commands/certify_key.rs @@ -24,7 +24,7 @@ use cfg_if::cfg_if; zerocopy::Immutable, zerocopy::KnownLayout, )] -pub struct CertifyKeyFlags(u32); +pub struct CertifyKeyFlags(pub u32); bitflags! { impl CertifyKeyFlags: u32 {} diff --git a/dpe/src/commands/derive_context.rs b/dpe/src/commands/derive_context.rs index 585747f6..a89faa24 100644 --- a/dpe/src/commands/derive_context.rs +++ b/dpe/src/commands/derive_context.rs @@ -29,7 +29,7 @@ use platform::Platform; zerocopy::Immutable, zerocopy::KnownLayout, )] -pub struct DeriveContextFlags(u32); +pub struct DeriveContextFlags(pub u32); bitflags! { impl DeriveContextFlags: u32 { diff --git a/dpe/src/commands/initialize_context.rs b/dpe/src/commands/initialize_context.rs index b78806af..7cf929bb 100644 --- a/dpe/src/commands/initialize_context.rs +++ b/dpe/src/commands/initialize_context.rs @@ -22,7 +22,7 @@ use cfg_if::cfg_if; zerocopy::Immutable, zerocopy::KnownLayout, )] -pub struct InitCtxCmd(u32); +pub struct InitCtxCmd(pub u32); bitflags! { impl InitCtxCmd: u32 { diff --git a/dpe/src/commands/rotate_context.rs b/dpe/src/commands/rotate_context.rs index 54091a22..fb4c70c5 100644 --- a/dpe/src/commands/rotate_context.rs +++ b/dpe/src/commands/rotate_context.rs @@ -22,7 +22,7 @@ use caliptra_cfi_lib_git::{cfi_assert, cfi_assert_eq}; zerocopy::Immutable, zerocopy::KnownLayout, )] -pub struct RotateCtxFlags(u32); +pub struct RotateCtxFlags(pub u32); bitflags! { impl RotateCtxFlags: u32 { diff --git a/dpe/src/commands/sign.rs b/dpe/src/commands/sign.rs index cca0e2e4..849242f5 100644 --- a/dpe/src/commands/sign.rs +++ b/dpe/src/commands/sign.rs @@ -25,7 +25,7 @@ use crypto::{Crypto, Digest, EcdsaSig}; zerocopy::Immutable, zerocopy::KnownLayout, )] -pub struct SignFlags(u32); +pub struct SignFlags(pub u32); bitflags! { impl SignFlags: u32 {} diff --git a/dpe/src/dpe_instance.rs b/dpe/src/dpe_instance.rs index db4e2118..41757e78 100644 --- a/dpe/src/dpe_instance.rs +++ b/dpe/src/dpe_instance.rs @@ -45,14 +45,14 @@ pub struct DpeEnv<'a, T: DpeTypes + 'a> { #[derive(IntoBytes, TryFromBytes, KnownLayout, Immutable, Zeroize)] pub struct DpeInstance { pub contexts: [Context; MAX_HANDLES], - pub(crate) support: Support, + pub support: Support, /// Can only successfully execute the initialize context command for non-simulation (i.e. /// `InitializeContext(simulation=false)`) once per reset cycle. - pub(crate) has_initialized: U8Bool, + pub has_initialized: U8Bool, // unused buffer added to make DpeInstance word aligned and remove padding - reserved: [u8; 3], + pub reserved: [u8; 3], } impl DpeInstance { diff --git a/dpe/src/lib.rs b/dpe/src/lib.rs index 64456f3c..d26d9923 100644 --- a/dpe/src/lib.rs +++ b/dpe/src/lib.rs @@ -48,7 +48,7 @@ const INTERNAL_INPUT_INFO_SIZE: usize = size_of::() + size_of::< )] #[repr(C, align(1))] pub struct U8Bool { - val: u8, + pub val: u8, } impl U8Bool { diff --git a/dpe/src/support.rs b/dpe/src/support.rs index 5a31d31f..d1f943ca 100644 --- a/dpe/src/support.rs +++ b/dpe/src/support.rs @@ -5,7 +5,7 @@ use zeroize::Zeroize; #[derive(Default, IntoBytes, FromBytes, KnownLayout, Immutable, Zeroize, Copy, Clone)] #[repr(C)] -pub struct Support(u32); +pub struct Support(pub u32); bitflags! { impl Support: u32 {