-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to retrieve IDevID CSR from persistent storage.
* This resolves #1687, for ROM.
- Loading branch information
Showing
12 changed files
with
249 additions
and
41 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
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,32 @@ | ||
use core::mem::size_of; | ||
use zerocopy::{AsBytes, FromBytes}; | ||
use zeroize::Zeroize; | ||
|
||
use crate::memory_layout; | ||
|
||
pub const MAX_CSR_SIZE: usize = 512; | ||
|
||
#[derive(FromBytes, AsBytes, Zeroize)] | ||
#[repr(C)] | ||
pub struct IDevIDCsr { | ||
pub csr: [u8; MAX_CSR_SIZE], | ||
pub csr_len: u32, | ||
} | ||
|
||
impl Default for IDevIDCsr { | ||
fn default() -> Self { | ||
Self { | ||
csr: [0; MAX_CSR_SIZE], | ||
csr_len: 0, | ||
} | ||
} | ||
} | ||
|
||
impl IDevIDCsr { | ||
/// Get the CSR buffer | ||
pub fn get(&self) -> Option<&[u8]> { | ||
self.csr.get(..self.csr_len as usize) | ||
} | ||
} | ||
|
||
const _: () = assert!(size_of::<IDevIDCsr>() < memory_layout::IDEVID_CSR_SIZE as usize); |
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
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
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
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
Oops, something went wrong.