Skip to content

Commit 6752ba4

Browse files
authored
ecdsa: use mul_by_generator_and_mul_add_vartime for verification (#1302)
This high-level method can plug into various strategies for efficiently implementing `aG + bP`, including using basepoint tables, wNAF, or linear combinations, depending on what crate features are enabled and what curve-specific optimizations have been implemented.
1 parent ecaf359 commit 6752ba4

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ rfc6979 = { path = "./rfc6979" }
2929
slh-dsa = { path = "./slh-dsa" }
3030
xmss = { path = "./xmss" }
3131
bign-genk = { path = "./bign-genk" }
32+
33+
elliptic-curve = { git = "https://github.com/RustCrypto/traits" }

ecdsa/src/hazmat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use {
2424
CurveArithmetic, NonZeroScalar, ProjectivePoint, Scalar,
2525
ff::PrimeField,
2626
group::{Curve as _, Group},
27-
ops::{Invert, LinearCombination, Reduce},
27+
ops::{Invert, MulByGeneratorVartime, Reduce},
2828
point::AffineCoordinates,
2929
scalar::IsHigh,
3030
},
@@ -213,7 +213,7 @@ where
213213
let s_inv = *s.invert_vartime();
214214
let u1 = z * s_inv;
215215
let u2 = *r * s_inv;
216-
let x = ProjectivePoint::<C>::lincomb(&[(ProjectivePoint::<C>::generator(), u1), (*q, u2)])
216+
let x = ProjectivePoint::<C>::mul_by_generator_and_mul_add_vartime(&u1, &u2, q)
217217
.to_affine()
218218
.x();
219219

0 commit comments

Comments
 (0)