Skip to content

Commit f1005a3

Browse files
authored
cipher: fix hybrid-array deprecations in macros (#1624)
The `block_cipher_test!` macro was using deprecated APIs in `hybrid-array` (i.e. `clone_from_slice`)
1 parent 350a3b2 commit f1005a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cipher/src/dev/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ macro_rules! block_cipher_test {
1414
fn run_test(key: &[u8], pt: &[u8], ct: &[u8]) -> bool {
1515
let mut state = <$cipher as KeyInit>::new_from_slice(key).unwrap();
1616

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

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

36-
let block = Block::clone_from_slice(pt);
36+
let block = Block::try_from(pt).unwrap();
3737
let mut blocks1 = vec![block; 101];
3838
for (i, b) in blocks1.iter_mut().enumerate() {
3939
*b = block;

0 commit comments

Comments
 (0)