Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikbhargavan committed Jun 26, 2024
1 parent df8b66e commit 719ee5c
Showing 1 changed file with 32 additions and 15 deletions.
47 changes: 32 additions & 15 deletions libcrux-ml-kem/benches/ml-kem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pub fn comparisons_pk_validation(c: &mut Criterion) {
BatchSize::SmallInput,
)
});

}

pub fn comparisons_encapsulation(c: &mut Criterion) {
Expand Down Expand Up @@ -96,8 +95,11 @@ pub fn comparisons_encapsulation(c: &mut Criterion) {
b.iter_batched(
|| mlkem768::portable::generate_key_pair_unpacked(seed1),
|keypair| {
let (_shared_secret, _ciphertext) =
mlkem768::portable::encapsulate_unpacked(&keypair.public_key, &keypair.public_key_hash, seed2);
let (_shared_secret, _ciphertext) = mlkem768::portable::encapsulate_unpacked(
&keypair.public_key,
&keypair.public_key_hash,
seed2,
);
},
BatchSize::SmallInput,
)
Expand All @@ -112,8 +114,11 @@ pub fn comparisons_encapsulation(c: &mut Criterion) {
b.iter_batched(
|| mlkem768::neon::generate_key_pair_unpacked(seed1),
|keypair| {
let (_shared_secret, _ciphertext) =
mlkem768::neon::encapsulate_unpacked(&keypair.public_key, &keypair.public_key_hash, seed2);
let (_shared_secret, _ciphertext) = mlkem768::neon::encapsulate_unpacked(
&keypair.public_key,
&keypair.public_key_hash,
seed2,
);
},
BatchSize::SmallInput,
)
Expand All @@ -128,8 +133,11 @@ pub fn comparisons_encapsulation(c: &mut Criterion) {
b.iter_batched(
|| mlkem768::avx2::generate_key_pair_unpacked(seed1),
|keypair| {
let (_shared_secret, _ciphertext) =
mlkem768::avx2::encapsulate_unpacked(&keypair.public_key, &keypair.public_key_hash, seed2);
let (_shared_secret, _ciphertext) = mlkem768::avx2::encapsulate_unpacked(
&keypair.public_key,
&keypair.public_key_hash,
seed2,
);
},
BatchSize::SmallInput,
)
Expand Down Expand Up @@ -167,12 +175,16 @@ pub fn comparisons_decapsulation(c: &mut Criterion) {
b.iter_batched(
|| {
let keypair = mlkem768::portable::generate_key_pair_unpacked(seed1);
let (ciphertext, _shared_secret) =
mlkem768::portable::encapsulate_unpacked(&keypair.public_key, &keypair.public_key_hash, seed2);
let (ciphertext, _shared_secret) = mlkem768::portable::encapsulate_unpacked(
&keypair.public_key,
&keypair.public_key_hash,
seed2,
);
(keypair, ciphertext)
},
|(keypair, ciphertext)| {
let _shared_secret = mlkem768::portable::decapsulate_unpacked(&keypair, &ciphertext);
let _shared_secret =
mlkem768::portable::decapsulate_unpacked(&keypair, &ciphertext);
},
BatchSize::SmallInput,
)
Expand All @@ -187,8 +199,11 @@ pub fn comparisons_decapsulation(c: &mut Criterion) {
b.iter_batched(
|| {
let keypair = mlkem768::neon::generate_key_pair_unpacked(seed1);
let (ciphertext, _shared_secret) =
mlkem768::neon::encapsulate_unpacked(&keypair.public_key, &keypair.public_key_hash, seed2);
let (ciphertext, _shared_secret) = mlkem768::neon::encapsulate_unpacked(
&keypair.public_key,
&keypair.public_key_hash,
seed2,
);
(keypair, ciphertext)
},
|(keypair, ciphertext)| {
Expand All @@ -207,8 +222,11 @@ pub fn comparisons_decapsulation(c: &mut Criterion) {
b.iter_batched(
|| {
let keypair = mlkem768::avx2::generate_key_pair_unpacked(seed1);
let (ciphertext, _shared_secret) =
mlkem768::avx2::encapsulate_unpacked(&keypair.public_key, &keypair.public_key_hash, seed2);
let (ciphertext, _shared_secret) = mlkem768::avx2::encapsulate_unpacked(
&keypair.public_key,
&keypair.public_key_hash,
seed2,
);
(keypair, ciphertext)
},
|(keypair, ciphertext)| {
Expand All @@ -217,7 +235,6 @@ pub fn comparisons_decapsulation(c: &mut Criterion) {
BatchSize::SmallInput,
)
});

}

pub fn comparisons(c: &mut Criterion) {
Expand Down

0 comments on commit 719ee5c

Please sign in to comment.