-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This command can only be run once per reboot (I'm pretty sure) so it can be hard to debug. Luckily it worked 1st try for me.
- Loading branch information
1 parent
dfd6c93
commit 95d5fef
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::ffi::c_int; | ||
|
||
use bytemuck::{Pod, Zeroable}; | ||
|
||
use crate::{ec_command::ec_command_bytemuck, EcCmdResult}; | ||
|
||
use super::CrosEcCmd; | ||
|
||
pub const FP_CONTEXT_TPM_BYTES: usize = 32; | ||
const FP_TEMPLATE_FORMAT_VERSION: u16 = 4; | ||
|
||
#[repr(C, align(4))] | ||
#[derive(Pod, Zeroable, Clone, Copy)] | ||
struct EcParamsFpSeed { | ||
pub struct_version: u16, | ||
pub reserved: u16, | ||
pub seed: [u8; FP_CONTEXT_TPM_BYTES], | ||
} | ||
|
||
pub fn fp_set_seed(fd: c_int, seed: [u8; FP_CONTEXT_TPM_BYTES]) -> EcCmdResult<()> { | ||
ec_command_bytemuck( | ||
CrosEcCmd::FpSetSeed, | ||
0, | ||
&EcParamsFpSeed { | ||
struct_version: FP_TEMPLATE_FORMAT_VERSION, | ||
reserved: Default::default(), | ||
seed, | ||
}, | ||
fd, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters