mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-06 20:41:14 +00:00
Add missing Ristretto vartime-double-base fn
This commit is contained in:
parent
5bb6cd42a2
commit
f7f3f79da8
2 changed files with 20 additions and 9 deletions
|
|
@ -587,16 +587,12 @@ impl EdwardsPoint {
|
||||||
pub fn vartime_double_scalar_mul_basepoint(a: &Scalar, A: &EdwardsPoint, b: &Scalar) -> EdwardsPoint {
|
pub fn vartime_double_scalar_mul_basepoint(a: &Scalar, A: &EdwardsPoint, b: &Scalar) -> EdwardsPoint {
|
||||||
// If we built with AVX2, use the AVX2 backend.
|
// If we built with AVX2, use the AVX2 backend.
|
||||||
#[cfg(all(feature="avx2_backend", target_feature="avx2"))]
|
#[cfg(all(feature="avx2_backend", target_feature="avx2"))]
|
||||||
{
|
use backend::avx2::scalar_mul::vartime_double_base;
|
||||||
use backend::avx2::scalar_mul::vartime_double_base::mul;
|
// Otherwise, use the serial backend:
|
||||||
mul(a, A, b)
|
|
||||||
}
|
|
||||||
// Otherwise, proceed as normal:
|
|
||||||
#[cfg(not(all(feature="avx2_backend", target_feature="avx2")))]
|
#[cfg(not(all(feature="avx2_backend", target_feature="avx2")))]
|
||||||
{
|
use scalar_mul::vartime_double_base;
|
||||||
use scalar_mul::vartime_double_base::mul;
|
|
||||||
mul(a, A, b)
|
vartime_double_base::mul(a, A, b)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -830,6 +830,21 @@ impl VartimeMultiscalarMul for RistrettoPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RistrettoPoint {
|
||||||
|
/// Compute \\(aA + bB\\) in variable time, where \\(B\\) is the
|
||||||
|
/// Ristretto basepoint.
|
||||||
|
#[cfg(feature = "stage2_build")]
|
||||||
|
pub fn vartime_double_scalar_mul_basepoint(
|
||||||
|
a: &Scalar,
|
||||||
|
A: &RistrettoPoint,
|
||||||
|
b: &Scalar,
|
||||||
|
) -> RistrettoPoint {
|
||||||
|
RistrettoPoint(
|
||||||
|
EdwardsPoint::vartime_double_scalar_mul_basepoint(a, &A.0, b)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A precomputed table of multiples of a basepoint, used to accelerate
|
/// A precomputed table of multiples of a basepoint, used to accelerate
|
||||||
/// scalar multiplication.
|
/// scalar multiplication.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue