fn bench_hmac_one_shot()

in aws-lc-rs-testing/benches/hmac_benchmark.rs [117:141]


fn bench_hmac_one_shot(c: &mut Criterion, config: &HMACConfig) {
    for &chunk_len in &G_CHUNK_LENGTHS {
        let chunk = vec![1u8; chunk_len];

        let bench_group_name = format!("HMAC-{:?}-one-shot-{}-bytes", config.algorithm, chunk_len);
        let mut group = c.benchmark_group(bench_group_name);

        group.bench_function("AWS-LC", |b| {
            b.iter(|| {
                let aws_key = aws_lc_rs_benchmarks::create_hmac_key(config);
                aws_lc_rs_benchmarks::run_hmac_one_shot(&aws_key, &chunk);
            });
        });

        #[cfg(feature = "ring-benchmarks")]
        {
            group.bench_function("Ring", |b| {
                b.iter(|| {
                    let ring_key = ring_benchmarks::create_hmac_key(config);
                    ring_benchmarks::run_hmac_one_shot(&ring_key, &chunk);
                });
            });
        }
    }
}