Skip to content

Commit

Permalink
cipher: fixup block_{encryptor,decryptor}_bench (#1512)
Browse files Browse the repository at this point in the history
Those benchmark macros are reused for both `block-ciphers` and
`block-modes`. We need to import both `BlockMode` and `BlockCipher` for
them to work.
  • Loading branch information
baloo committed Feb 21, 2024
1 parent e2ef02f commit cce3b05
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cipher/src/dev/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ macro_rules! block_encryptor_bench {
($init:block, $cipher:ty, $block_name:ident, $blocks_name:ident $(,)? ) => {
#[bench]
pub fn $block_name(bh: &mut test::Bencher) {
use cipher::BlockCipherEncrypt;
#[allow(unused)]
use cipher::{BlockCipherEncrypt, BlockModeEncrypt};

let mut cipher = $init;
let mut blocks = vec![Default::default(); 1024];
Expand All @@ -305,7 +306,8 @@ macro_rules! block_encryptor_bench {

#[bench]
pub fn $blocks_name(bh: &mut test::Bencher) {
use cipher::BlockCipherEncrypt;
#[allow(unused)]
use cipher::{BlockCipherEncrypt, BlockModeEncrypt};

let mut cipher = $init;
let mut blocks = vec![Default::default(); 1024];
Expand Down Expand Up @@ -350,7 +352,8 @@ macro_rules! block_decryptor_bench {
($init:block, $cipher:ty, $block_name:ident, $blocks_name:ident $(,)? ) => {
#[bench]
pub fn $block_name(bh: &mut test::Bencher) {
use cipher::BlockCipherDecrypt;
#[allow(unused)]
use cipher::{BlockCipherDecrypt, BlockModeDecrypt};

let mut cipher = $init;
let mut blocks = vec![Default::default(); 1024];
Expand All @@ -366,7 +369,8 @@ macro_rules! block_decryptor_bench {

#[bench]
pub fn $blocks_name(bh: &mut test::Bencher) {
use cipher::BlockCipherDecrypt;
#[allow(unused)]
use cipher::{BlockCipherDecrypt, BlockModeDecrypt};

let mut cipher = $init;
let mut blocks = vec![Default::default(); 1024];
Expand Down

0 comments on commit cce3b05

Please sign in to comment.