Skip to content

Commit

Permalink
cipher: fix hybrid-array deprecations in macros
Browse files Browse the repository at this point in the history
The `block_cipher_test!` macro was using deprecated APIs in
`hybrid-array` (i.e. `clone_from_slice`)
  • Loading branch information
tarcieri committed Jul 26, 2024
1 parent 350a3b2 commit 234f737
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cipher/src/dev/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro_rules! block_cipher_test {
fn run_test(key: &[u8], pt: &[u8], ct: &[u8]) -> bool {
let mut state = <$cipher as KeyInit>::new_from_slice(key).unwrap();

let mut block = Array::clone_from_slice(pt);
let mut block = Array::try_from(pt).unwrap();
state.encrypt_block(&mut block);
if ct != block.as_slice() {
return false;
Expand All @@ -33,7 +33,7 @@ macro_rules! block_cipher_test {

let mut state = <$cipher as KeyInit>::new_from_slice(key).unwrap();

let block = Block::clone_from_slice(pt);
let block = Block::try_from(pt).unwrap();
let mut blocks1 = vec![block; 101];
for (i, b) in blocks1.iter_mut().enumerate() {
*b = block;
Expand Down

0 comments on commit 234f737

Please sign in to comment.