mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
implement swap header length reference
This commit is contained in:
parent
2f5af89547
commit
d21e99a3f3
1 changed files with 6 additions and 4 deletions
|
|
@ -56,10 +56,9 @@ impl SwapHeader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns exactly a page of data with the header format serialized
|
/// Returns exactly a page of data with the header format serialized
|
||||||
/// Header format is in loader/src/swap.rs/SwapSourceHeader
|
pub fn serialize(&self) -> Result<[u8; bao1x_api::offsets::baosec::SWAP_HEADER_LEN]> {
|
||||||
pub fn serialize(&self) -> Result<[u8; 4096]> {
|
|
||||||
let mut data = Cursor::new(Vec::<u8>::new());
|
let mut data = Cursor::new(Vec::<u8>::new());
|
||||||
let mut output = [0u8; 4096];
|
let mut output = [0u8; bao1x_api::offsets::baosec::SWAP_HEADER_LEN];
|
||||||
|
|
||||||
let mut ssh = SwapSourceHeader::default();
|
let mut ssh = SwapSourceHeader::default();
|
||||||
ssh.version = SWAP_VERSION;
|
ssh.version = SWAP_VERSION;
|
||||||
|
|
@ -140,7 +139,10 @@ impl SwapWriter {
|
||||||
)
|
)
|
||||||
.map_err(|_| std::io::Error::new(std::io::ErrorKind::Other, "Can't sign swap image"))?;
|
.map_err(|_| std::io::Error::new(std::io::ErrorKind::Other, "Can't sign swap image"))?;
|
||||||
// write the header, less space for the signature
|
// write the header, less space for the signature
|
||||||
f.write(&unsigned_header[..4096 - bao1x_api::signatures::SIGBLOCK_LEN])?;
|
f.write(
|
||||||
|
&unsigned_header
|
||||||
|
[..bao1x_api::offsets::baosec::SWAP_HEADER_LEN - bao1x_api::signatures::SIGBLOCK_LEN],
|
||||||
|
)?;
|
||||||
|
|
||||||
f.write(&signed)
|
f.write(&signed)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue