diff --git a/loader/src/platform/cramium/swap.rs b/loader/src/platform/cramium/swap.rs index 8f72bc01b..bb0a79a70 100644 --- a/loader/src/platform/cramium/swap.rs +++ b/loader/src/platform/cramium/swap.rs @@ -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 } } diff --git a/loader/src/platform/precursor/swap.rs b/loader/src/platform/precursor/swap.rs index e5252fbc5..82a5de6e9 100644 --- a/loader/src/platform/precursor/swap.rs +++ b/loader/src/platform/precursor/swap.rs @@ -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 } }