Skip to content

Commit 28aa518

Browse files
committed
bench: Don't depend on FieldElement and elligator_ristretto_flavor
An Elligator benchmark was added for the "lizard" extensions, and it made sure it was only measuring the Elligator part of the work by expanding a set of bytes into a FieldElement ahead of time. However, this requires the FieldElement alias to be pub, and depends on the elligator_ristretto_flavor helper function being pub as well. Changing it to test the lizard-based entry point means we're diverging less from upstream, and it's more realistic anyway.
1 parent f737f2d commit 28aa518

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

curve25519-dalek/benches/dalek_benchmarks.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use criterion::{
77
};
88

99
use curve25519_dalek::constants;
10-
use curve25519_dalek::field::FieldElement;
1110
use curve25519_dalek::scalar::Scalar;
1211

1312
static BATCH_SIZES: [usize; 5] = [1, 2, 4, 8, 16];
@@ -245,11 +244,8 @@ mod ristretto_benches {
245244
}
246245

247246
fn elligator<M: Measurement>(c: &mut BenchmarkGroup<M>) {
248-
let fe_bytes = [0u8; 32];
249-
let fe = FieldElement::from_bytes(&fe_bytes);
250-
251247
c.bench_function("RistrettoPoint Elligator", |b| {
252-
b.iter(|| RistrettoPoint::elligator_ristretto_flavor(&fe));
248+
b.iter(|| RistrettoPoint::from_uniform_bytes_single_elligator(&[0u8; 32]));
253249
});
254250
}
255251

curve25519-dalek/src/ristretto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl RistrettoPoint {
653653
///
654654
/// This method is not public because it's just used for hashing
655655
/// to a point -- proper elligator support is deferred for now.
656-
pub fn elligator_ristretto_flavor(r_0: &FieldElement) -> RistrettoPoint {
656+
pub(crate) fn elligator_ristretto_flavor(r_0: &FieldElement) -> RistrettoPoint {
657657
let i = &constants::SQRT_M1;
658658
let d = &constants::EDWARDS_D;
659659
let one_minus_d_sq = &constants::ONE_MINUS_EDWARDS_D_SQUARED;

0 commit comments

Comments
 (0)