Skip to content

Commit

Permalink
fix zeroize test after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
oconnor663 committed Jul 16, 2023
1 parent 64abf7c commit c30d039
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 72 deletions.
59 changes: 0 additions & 59 deletions b3sum/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 7 additions & 13 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,49 +565,43 @@ fn test_zeroize() {

let mut hasher = crate::Hasher {
chunk_state: crate::ChunkState {
cv: [42; 8],
cv: [42; 32],
chunk_counter: 42,
buf: [42; 64],
buf_len: 42,
blocks_compressed: 42,
flags: 42,
platform: crate::Platform::Portable,
},
key: [42; 8],
key: [42; 32],
cv_stack: [[42; 32]; { crate::MAX_DEPTH + 1 }].into(),
};
hasher.zeroize();
assert_eq!(hasher.chunk_state.cv, [0; 8]);
assert_eq!(hasher.chunk_state.cv, [0; 32]);
assert_eq!(hasher.chunk_state.chunk_counter, 0);
assert_eq!(hasher.chunk_state.buf, [0; 64]);
assert_eq!(hasher.chunk_state.buf_len, 0);
assert_eq!(hasher.chunk_state.blocks_compressed, 0);
assert_eq!(hasher.chunk_state.flags, 0);
assert!(matches!(hasher.chunk_state.platform, crate::Platform::Portable));
assert_eq!(hasher.key, [0; 8]);
assert_eq!(hasher.key, [0; 32]);
assert_eq!(&*hasher.cv_stack, &[[0u8; 32]; 0]);


let mut output_reader = crate::OutputReader {
inner: crate::Output {
input_chaining_value: [42; 8],
input_chaining_value: [42; 32],
block: [42; 64],
counter: 42,
block_len: 42,
flags: 42,
platform: crate::Platform::Portable,
},
position_within_block: 42,
};


output_reader.zeroize();
assert_eq!(output_reader.inner.input_chaining_value, [0; 8]);
assert_eq!(output_reader.inner.input_chaining_value, [0; 32]);
assert_eq!(output_reader.inner.block, [0; 64]);
assert_eq!(output_reader.inner.counter, 0);
assert_eq!(output_reader.inner.block_len, 0);
assert_eq!(output_reader.inner.flags, 0);
assert!(matches!(output_reader.inner.platform, crate::Platform::Portable));
assert_eq!(output_reader.position_within_block, 0);
}

}

0 comments on commit c30d039

Please sign in to comment.