Skip to content

Commit

Permalink
Update Cargo.lock and improve mgm benches (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Aug 26, 2021
1 parent 5709f1b commit e470a51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 117 deletions.
119 changes: 6 additions & 113 deletions Cargo.lock

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

9 changes: 5 additions & 4 deletions mgm/benches/mod.rs
Expand Up @@ -53,9 +53,9 @@ fn encrypt_msg_only_16kb(b: &mut Bencher) {
fn decrypt_aad_only_16kb(b: &mut Bencher) {
let c = Mgm::<Kuznyechik>::new(GenericArray::from_slice(&KEY));
let nonce = GenericArray::from_slice(&NONCE);
let tag = GenericArray::default();
let aad = vec![0; 16 * 1024];
let mut buf = [];
let tag = c.encrypt_in_place_detached(nonce, &aad, &mut []).unwrap();

#[allow(unused_must_use)]
b.iter(|| {
Expand All @@ -71,13 +71,14 @@ fn decrypt_aad_only_16kb(b: &mut Bencher) {
fn decrypt_msg_only_16kb(b: &mut Bencher) {
let c = Mgm::<Kuznyechik>::new(GenericArray::from_slice(&KEY));
let nonce = GenericArray::from_slice(&NONCE);
let tag = GenericArray::default();
let aad = [];
let mut buf = vec![0; 16 * 1024];
let mut buf = vec![0u8; 16 * 1024];
let tag = c.encrypt_in_place_detached(nonce, &aad, &mut buf).unwrap();

#[allow(unused_must_use)]
b.iter(|| {
let (aad, buf, tag) = test::black_box((&aad, &mut buf, &tag));
let mut buf_cpy = buf.clone();
let (aad, buf, tag) = test::black_box((&aad, &mut buf_cpy, &tag));
let res = c.decrypt_in_place_detached(nonce, aad, buf, tag);
test::black_box(res);
});
Expand Down

0 comments on commit e470a51

Please sign in to comment.