diff --git a/aws-lc-rs/Cargo.toml b/aws-lc-rs/Cargo.toml index 9b110e9eb7b..b58c39ed9a9 100644 --- a/aws-lc-rs/Cargo.toml +++ b/aws-lc-rs/Cargo.toml @@ -28,6 +28,7 @@ default = ["aws-lc-sys", "alloc", "ring-io", "ring-sig-verify"] ring-io = ["dep:untrusted"] ring-sig-verify = ["dep:untrusted"] ring-benchmarks = [] +openssl-benchmarks = [] bindgen = ["aws-lc-sys?/bindgen", "aws-lc-fips-sys?/bindgen"] asan = ["aws-lc-sys?/asan", "aws-lc-fips-sys?/asan"] diff --git a/aws-lc-rs/benches/cipher_benchmark.rs b/aws-lc-rs/benches/cipher_benchmark.rs index ee9d1075c04..c50d1986206 100644 --- a/aws-lc-rs/benches/cipher_benchmark.rs +++ b/aws-lc-rs/benches/cipher_benchmark.rs @@ -4,8 +4,10 @@ use aws_lc_rs::cipher::{ }; use aws_lc_rs::{test, test_file}; use criterion::{criterion_group, criterion_main, Criterion}; +#[cfg(feature = "openssl-benchmarks")] use openssl::symm::Cipher; +#[cfg(feature = "openssl-benchmarks")] macro_rules! openssl_bench { ($group:ident, $openssl: expr, $key:ident, $iv:ident, $data:ident) => { $group.bench_function("OpenSSL", |b| { @@ -18,6 +20,13 @@ macro_rules! openssl_bench { }; } +#[cfg(not(feature = "openssl-benchmarks"))] +macro_rules! openssl_bench { + ($group:ident, $openssl: expr, $key:ident, $iv:ident, $data:ident) => { + // NO-OP + }; +} + macro_rules! benchmark_padded { ($fn:ident, $test:literal, $file:literal, $awslc:expr, $mode:expr, $openssl:expr) => { fn $fn(c: &mut Criterion) {