Skip to content

Commit

Permalink
fixup some arch benchmark issues
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Oct 9, 2023
1 parent 7966fc0 commit e8474e8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions benchmarks/benches/aead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn comparisons_encrypt(c: &mut Criterion) {
},
);

#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_arch = "wasm32"), not(target_arch = "x86")))]
group.bench_with_input(
BenchmarkId::new("OpenSSL", fmt(*payload_size)),
payload_size,
Expand Down Expand Up @@ -203,7 +203,7 @@ fn comparisons_decrypt(c: &mut Criterion) {
},
);

#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_arch = "wasm32"), not(target_arch = "x86")))]
group.bench_with_input(
BenchmarkId::new("OpenSSL", fmt(*payload_size)),
payload_size,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benches/drbg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn generate(c: &mut Criterion) {
)
});

#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_arch = "wasm32"), not(target_arch = "x86")))]
group.bench_function("OpenSSL", |b| {
use openssl::rand::rand_bytes;

Expand Down
9 changes: 5 additions & 4 deletions benchmarks/benches/hpke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::{Duration, Instant};
use libcrux::hpke::aead::*;
use libcrux::hpke::kdf::KDF;
use libcrux::hpke::kem::{GenerateKeyPair, KEM};
use libcrux::hpke::*;
use libcrux::{aes_ni_support, hpke::*};
use rand::{rngs::OsRng, RngCore};

pub(crate) fn hex_str_to_bytes(val: &str) -> Vec<u8> {
Expand Down Expand Up @@ -41,9 +41,10 @@ const ITERATIONS: usize = 1_000;
fn benchmark() {
for hpke_mode in MODES {
for aead_mode in AEAD_IDS {
#[cfg(not(target_arch = "x86_64"))]
if aead_mode == AEAD::AES_128_GCM {
// Evercrypt AES only works on x64 (and there only with the necessary extensions)
if aead_mode == AEAD::AES_128_GCM
&& (cfg!(not(target_arch = "x86_64")) || !aes_ni_support())
{
// AES is not supported on all platforms yet.
continue;
}
for kdf_mode in KDF_IDS {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benches/sha2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ macro_rules! impl_comp {
},
);

#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_arch = "wasm32"), not(target_arch = "x86")))]
group.bench_with_input(
BenchmarkId::new("OpenSSL", fmt(*payload_size)),
payload_size,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benches/sha3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ macro_rules! impl_comp {
},
);

#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_arch = "wasm32"), not(target_arch = "x86")))]
group.bench_with_input(
BenchmarkId::new("OpenSSL", fmt(*payload_size)),
payload_size,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benches/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn derive(c: &mut Criterion) {
)
});

#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_arch = "wasm32"), not(target_arch = "x86")))]
group.bench_function("OpenSSL", |b| {
use openssl::derive::Deriver;
use openssl::pkey::{Id, PKey};
Expand Down

0 comments on commit e8474e8

Please sign in to comment.