diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d760d0..7d08677 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,26 @@ jobs: command: test args: --no-default-features --features ${{ matrix.backend_feature }} + benches: + name: cargo bench compilation + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Run cargo bench --no-run + uses: actions-rs/cargo@v1 + with: + command: bench + args: --features "bench" --no-run + clippy: name: cargo clippy runs-on: ubuntu-latest diff --git a/benches/oprf.rs b/benches/oprf.rs index eae2d67..13aa16f 100644 --- a/benches/oprf.rs +++ b/benches/oprf.rs @@ -15,6 +15,7 @@ use opaque_ke::{ oprf::{generate_oprf1_shim, generate_oprf2_shim, generate_oprf3_shim, OprfClientBytes}, }; use rand::{prelude::ThreadRng, thread_rng}; +use sha2::Sha256; fn oprf1(c: &mut Criterion) { let mut csprng: ThreadRng = thread_rng(); @@ -103,8 +104,8 @@ fn oprf3(c: &mut Criterion) { c.bench_function("generate_oprf3 with Ristretto", move |b| { b.iter(|| { - let _res = - generate_oprf3_shim::(input, beta, &blinding_factor).unwrap(); + let _res = generate_oprf3_shim::(input, beta, &blinding_factor) + .unwrap(); }) }); } @@ -126,7 +127,8 @@ fn oprf3_edwards(c: &mut Criterion) { c.bench_function("generate_oprf3 with Edwards", move |b| { b.iter(|| { - let _res = generate_oprf3_shim::(input, beta, &blinding_factor).unwrap(); + let _res = + generate_oprf3_shim::(input, beta, &blinding_factor).unwrap(); }) }); } diff --git a/src/oprf.rs b/src/oprf.rs index e3a4541..c00480c 100644 --- a/src/oprf.rs +++ b/src/oprf.rs @@ -78,12 +78,12 @@ pub fn generate_oprf2_shim( #[cfg(feature = "bench")] #[inline] -pub fn generate_oprf3_shim( +pub fn generate_oprf3_shim( input: &[u8], point: G, blinding_factor: &G::Scalar, -) -> Result, InternalPakeError> { - generate_oprf3(input, point, blinding_factor) +) -> Result::OutputSize>, InternalPakeError> { + generate_oprf3::(input, point, blinding_factor) } // Tests