Connect double_scalar_mult_basepoint to AVX2 backend

This commit is contained in:
Henry de Valence 2017-12-04 11:05:24 -08:00
parent 2c29d9a2ad
commit 7d2d87441b

View file

@ -849,9 +849,19 @@ pub mod vartime {
/// \\(aA+bB\\), where \\(B\\) is the Ed25519 basepoint (i.e., \\(B = (x,4/5)\\) /// \\(aA+bB\\), where \\(B\\) is the Ed25519 basepoint (i.e., \\(B = (x,4/5)\\)
/// with x positive). /// with x positive).
#[cfg(feature="precomputed_tables")] #[cfg(feature="precomputed_tables")]
pub fn double_scalar_mult_basepoint(a: &Scalar, pub fn double_scalar_mult_basepoint(
a: &Scalar,
A: &ExtendedPoint, A: &ExtendedPoint,
b: &Scalar) -> ExtendedPoint { b: &Scalar,
) -> ExtendedPoint {
// If we built with AVX2, use the AVX2 backend.
#[cfg(all(target_feature = "avx2", feature = "avx2_backend"))] {
use backend::avx2::edwards as edwards_avx2;
edwards_avx2::vartime::double_scalar_mult_basepoint(a, A, b)
}
// Otherwise, proceed as normal:
#[cfg(not(all(target_feature = "avx2", feature = "avx2_backend")))] {
let a_naf = a.non_adjacent_form(); let a_naf = a.non_adjacent_form();
let b_naf = b.non_adjacent_form(); let b_naf = b.non_adjacent_form();
@ -893,6 +903,7 @@ pub mod vartime {
r.to_extended() r.to_extended()
} }
}
} }