mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
helps to actually copy the data into the hash engine
This commit is contained in:
parent
f76b85c95e
commit
2f3cf06c16
2 changed files with 2 additions and 4 deletions
|
|
@ -29,14 +29,13 @@ fn compress(csr: &mut CSR<u32>, blocks: &[[u8; BLOCK_LEN]]) {
|
||||||
const BUF_BLOCKS: usize = utralib::HW_SEG_MSG_MEM_LEN / BLOCK_LEN;
|
const BUF_BLOCKS: usize = utralib::HW_SEG_MSG_MEM_LEN / BLOCK_LEN;
|
||||||
// safety: this is the actual location of the message buffer and its length according to the hardware
|
// safety: this is the actual location of the message buffer and its length according to the hardware
|
||||||
// spec. only safe because this is machine mode and no-std (no threads, no concurrency)
|
// spec. only safe because this is machine mode and no-std (no threads, no concurrency)
|
||||||
#[cfg(feature = "debug")]
|
|
||||||
let msg_blocks: &mut [[u8; BLOCK_LEN]; BUF_BLOCKS] =
|
let msg_blocks: &mut [[u8; BLOCK_LEN]; BUF_BLOCKS] =
|
||||||
unsafe { &mut *(utralib::HW_SEG_MSG_MEM as *mut [[u8; BLOCK_LEN]; BUF_BLOCKS]) };
|
unsafe { &mut *(utralib::HW_SEG_MSG_MEM as *mut [[u8; BLOCK_LEN]; BUF_BLOCKS]) };
|
||||||
|
|
||||||
for block_chunk in blocks.chunks(BUF_BLOCKS) {
|
for block_chunk in blocks.chunks(BUF_BLOCKS) {
|
||||||
// block_chunk has a length equal to or less than msg_buf due to .chunks() iterator above
|
// block_chunk has a length equal to or less than msg_buf due to .chunks() iterator above
|
||||||
#[cfg(feature = "debug")]
|
|
||||||
for (src, dst) in block_chunk.iter().zip(msg_blocks.iter_mut()) {
|
for (src, dst) in block_chunk.iter().zip(msg_blocks.iter_mut()) {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
crate::println!(" {:x?}", src);
|
crate::println!(" {:x?}", src);
|
||||||
dst.copy_from_slice(src);
|
dst.copy_from_slice(src);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,13 @@ fn compress(csr: &mut CSR<u32>, blocks: &[[u8; BLOCK_LEN]]) {
|
||||||
const BUF_BLOCKS: usize = utralib::HW_SEG_MSG_MEM_LEN / BLOCK_LEN;
|
const BUF_BLOCKS: usize = utralib::HW_SEG_MSG_MEM_LEN / BLOCK_LEN;
|
||||||
// safety: this is the actual location of the message buffer and its length according to the hardware
|
// safety: this is the actual location of the message buffer and its length according to the hardware
|
||||||
// spec. only safe because this is machine mode and no-std (no threads, no concurrency)
|
// spec. only safe because this is machine mode and no-std (no threads, no concurrency)
|
||||||
#[cfg(feature = "debug")]
|
|
||||||
let msg_blocks: &mut [[u8; BLOCK_LEN]; BUF_BLOCKS] =
|
let msg_blocks: &mut [[u8; BLOCK_LEN]; BUF_BLOCKS] =
|
||||||
unsafe { &mut *(utralib::HW_SEG_MSG_MEM as *mut [[u8; BLOCK_LEN]; BUF_BLOCKS]) };
|
unsafe { &mut *(utralib::HW_SEG_MSG_MEM as *mut [[u8; BLOCK_LEN]; BUF_BLOCKS]) };
|
||||||
|
|
||||||
for block_chunk in blocks.chunks(BUF_BLOCKS) {
|
for block_chunk in blocks.chunks(BUF_BLOCKS) {
|
||||||
// block_chunk has a length equal to or less than msg_buf due to .chunks() iterator above
|
// block_chunk has a length equal to or less than msg_buf due to .chunks() iterator above
|
||||||
#[cfg(feature = "debug")]
|
|
||||||
for (src, dst) in block_chunk.iter().zip(msg_blocks.iter_mut()) {
|
for (src, dst) in block_chunk.iter().zip(msg_blocks.iter_mut()) {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
crate::println!(" {:x?}", src);
|
crate::println!(" {:x?}", src);
|
||||||
dst.copy_from_slice(src);
|
dst.copy_from_slice(src);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue