diff --git a/crosec/src/commands/fp_download.rs b/crosec/src/commands/fp_download.rs index bdd47d3..486711d 100644 --- a/crosec/src/commands/fp_download.rs +++ b/crosec/src/commands/fp_download.rs @@ -4,7 +4,7 @@ use bytemuck::{bytes_of, Pod, Zeroable}; use crate::ec_command::ec_command_with_dynamic_output_size; -use super::{CrosEcCmd, fp_info::EcResponseFpInfo, get_protocol_info::EcResponseGetProtocolInfo}; +use super::{fp_info::EcResponseFpInfo, get_protocol_info::EcResponseGetProtocolInfo, CrosEcCmd}; #[repr(C)] #[derive(Pod, Zeroable, Clone, Copy)] diff --git a/crosec/src/commands/fp_get_encryption_status.rs b/crosec/src/commands/fp_get_encryption_status.rs index 47ac684..ee57681 100644 --- a/crosec/src/commands/fp_get_encryption_status.rs +++ b/crosec/src/commands/fp_get_encryption_status.rs @@ -1,12 +1,12 @@ -use std::os::fd::AsRawFd; -use bytemuck::{Pod, Zeroable}; use crate::commands::CrosEcCmd; use crate::ec_command::ec_command_bytemuck; use crate::EcCmdResult; +use bytemuck::{Pod, Zeroable}; +use std::os::fd::AsRawFd; #[repr(u32)] pub enum FpEncryptionStatus { - SeedSet = 0b1 + SeedSet = 0b1, } #[derive(Pod, Zeroable, Copy, Clone)] @@ -16,6 +16,8 @@ pub struct EcResponseFpGetEncryptionStatus { pub status: u32, } -pub fn fp_get_encryption_status(file: &mut File) -> EcCmdResult { +pub fn fp_get_encryption_status( + file: &mut File, +) -> EcCmdResult { ec_command_bytemuck(CrosEcCmd::FpGetEncryptionStatus, 0, &(), file.as_raw_fd()) -} \ No newline at end of file +} diff --git a/crosec/src/commands/fp_info.rs b/crosec/src/commands/fp_info.rs index 4a49c44..14cd7a2 100644 --- a/crosec/src/commands/fp_info.rs +++ b/crosec/src/commands/fp_info.rs @@ -5,8 +5,8 @@ use bytemuck::{Pod, Zeroable}; use crate::{ec_command::ec_command_bytemuck, EcCmdResult}; use super::{ - CrosEcCmd, get_cmd_versions::{ec_cmd_get_cmd_versions, V1}, + CrosEcCmd, }; #[repr(C, align(4))] diff --git a/crosec/src/commands/fp_set_seed.rs b/crosec/src/commands/fp_set_seed.rs index fc35009..b582807 100644 --- a/crosec/src/commands/fp_set_seed.rs +++ b/crosec/src/commands/fp_set_seed.rs @@ -17,7 +17,10 @@ struct EcParamsFpSeed { pub seed: [u8; FP_CONTEXT_TPM_BYTES], } -pub fn fp_set_seed(file: &mut File, seed: [u8; FP_CONTEXT_TPM_BYTES]) -> EcCmdResult<()> { +pub fn fp_set_seed( + file: &mut File, + seed: [u8; FP_CONTEXT_TPM_BYTES], +) -> EcCmdResult<()> { ec_command_bytemuck( CrosEcCmd::FpSetSeed, 0, diff --git a/crosec/src/commands/fp_upload_template.rs b/crosec/src/commands/fp_upload_template.rs index 2c6a90c..679ce4e 100644 --- a/crosec/src/commands/fp_upload_template.rs +++ b/crosec/src/commands/fp_upload_template.rs @@ -5,8 +5,8 @@ use bytemuck::{bytes_of, Pod, Zeroable}; use crate::{ec_command::ec_command_with_dynamic_output_size, EcCmdResult}; use super::{ - CrosEcCmd, fp_download::FpTemplate, - fp_info::EcResponseFpInfo, get_protocol_info::EcResponseGetProtocolInfo, + fp_download::FpTemplate, fp_info::EcResponseFpInfo, + get_protocol_info::EcResponseGetProtocolInfo, CrosEcCmd, }; #[derive(Pod, Zeroable, Clone, Copy)] diff --git a/ectool/src/fp_get_encryption_status_command.rs b/ectool/src/fp_get_encryption_status_command.rs index 295f5ed..fc7bfe7 100644 --- a/ectool/src/fp_get_encryption_status_command.rs +++ b/ectool/src/fp_get_encryption_status_command.rs @@ -1,10 +1,15 @@ -use std::fs::File; -use crosec::commands::fp_get_encryption_status::{EcResponseFpGetEncryptionStatus, fp_get_encryption_status}; +use crosec::commands::fp_get_encryption_status::{ + fp_get_encryption_status, EcResponseFpGetEncryptionStatus, +}; use crosec::CROS_FP_PATH; +use std::fs::File; pub fn fp_get_encryption_status_command() -> color_eyre::Result<()> { let mut file = File::open(CROS_FP_PATH)?; - let EcResponseFpGetEncryptionStatus { status, valid_flags } = fp_get_encryption_status(&mut file)?; + let EcResponseFpGetEncryptionStatus { + status, + valid_flags, + } = fp_get_encryption_status(&mut file)?; println!("FPMCU encryption status: {status:#b}"); println!("Valid flags: {valid_flags:#b}"); Ok(())