Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DPE to the latest zerocopy. #397

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/commands/certify_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/commands/derive_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use platform::Platform;
zerocopy::Immutable,
zerocopy::KnownLayout,
)]
pub struct DeriveContextFlags(u32);
pub struct DeriveContextFlags(pub u32);

bitflags! {
impl DeriveContextFlags: u32 {
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/commands/initialize_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/commands/rotate_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/commands/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
6 changes: 3 additions & 3 deletions dpe/src/dpe_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const INTERNAL_INPUT_INFO_SIZE: usize = size_of::<GetProfileResp>() + size_of::<
)]
#[repr(C, align(1))]
pub struct U8Bool {
val: u8,
pub val: u8,
}

impl U8Bool {
Expand Down
2 changes: 1 addition & 1 deletion dpe/src/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down