diff --git a/benchmarks/benches/aead.rs b/benchmarks/benches/aead.rs index f760afcd8..94994baf3 100644 --- a/benchmarks/benches/aead.rs +++ b/benchmarks/benches/aead.rs @@ -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, @@ -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, diff --git a/benchmarks/benches/drbg.rs b/benchmarks/benches/drbg.rs index a30c63655..a632ee9bb 100644 --- a/benchmarks/benches/drbg.rs +++ b/benchmarks/benches/drbg.rs @@ -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; diff --git a/benchmarks/benches/hpke.rs b/benchmarks/benches/hpke.rs index c4b7f000f..dc6436a0b 100644 --- a/benchmarks/benches/hpke.rs +++ b/benchmarks/benches/hpke.rs @@ -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 { @@ -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 { diff --git a/benchmarks/benches/sha2.rs b/benchmarks/benches/sha2.rs index 14b03556e..297dee805 100644 --- a/benchmarks/benches/sha2.rs +++ b/benchmarks/benches/sha2.rs @@ -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, diff --git a/benchmarks/benches/sha3.rs b/benchmarks/benches/sha3.rs index a33d130a9..ca9deb998 100644 --- a/benchmarks/benches/sha3.rs +++ b/benchmarks/benches/sha3.rs @@ -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, diff --git a/benchmarks/benches/x25519.rs b/benchmarks/benches/x25519.rs index 0bcf91a38..69d4a666b 100644 --- a/benchmarks/benches/x25519.rs +++ b/benchmarks/benches/x25519.rs @@ -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};