mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-08 21:00:40 +00:00
Connect double_scalar_mult_basepoint to AVX2 backend
This commit is contained in:
parent
2c29d9a2ad
commit
7d2d87441b
1 changed files with 46 additions and 35 deletions
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue