mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +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 {
|
||||
// If we built with AVX2, use the AVX2 backend.
|
||||
#[cfg(all(feature="avx2_backend", target_feature="avx2"))]
|
||||
{
|
||||
use backend::avx2::scalar_mul::vartime_double_base::mul;
|
||||
mul(a, A, b)
|
||||
}
|
||||
// Otherwise, proceed as normal:
|
||||
use backend::avx2::scalar_mul::vartime_double_base;
|
||||
// Otherwise, use the serial backend:
|
||||
#[cfg(not(all(feature="avx2_backend", target_feature="avx2")))]
|
||||
{
|
||||
use scalar_mul::vartime_double_base::mul;
|
||||
mul(a, A, b)
|
||||
}
|
||||
use scalar_mul::vartime_double_base;
|
||||
|
||||
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
|
||||
/// scalar multiplication.
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in a new issue