add a function to nab the decrypt buffer

HIGHLY unsafe, but saves us a decryption operation as we
interleave between the various states of the loader.
This commit is contained in:
bunnie 2024-04-07 14:28:31 +08:00
parent 35082c4688
commit 999cb320ed
2 changed files with 10 additions and 0 deletions

View file

@ -269,4 +269,9 @@ impl SwapHal {
Err(e) => panic!("Decryption error in swap: {:?}", e),
}
}
/// Grabs a slice of the internal buffer. Useful for re-using the decrypted page
/// between elements of the bootloader (saving us from redundant decrypt ops),
/// but extremely unsafe because we have to track the use of this buffer manually.
pub unsafe fn get_decrypt(&self) -> &[u8] { &self.buf.data }
}

View file

@ -71,4 +71,9 @@ impl SwapHal {
Err(e) => panic!("Decryption error in swap: {:?}", e),
}
}
/// Grabs a slice of the internal buffer. Useful for re-using the decrypted page
/// between elements of the bootloader (saving us from redundant decrypt ops),
/// but extremely unsafe because we have to track the use of this buffer manually.
pub unsafe fn get_decrypt(&self) -> &[u8] { &self.buf.data }
}