Skip to content

Commit

Permalink
RistrettoPoint::vartime_check_double_scalar_mul_basepoint
Browse files Browse the repository at this point in the history
Checks whether [a]A + [b]B = C in variable time.
  • Loading branch information
str4d committed Mar 29, 2024
1 parent 2d30db9 commit 7685338
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions curve25519-dalek/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ major series.
### Unreleased

* Add `EdwardsPoint::vartime_check_double_scalar_mul_basepoint`.
* Add `RistrettoPoint::vartime_check_double_scalar_mul_basepoint`.

### 4.1.2

Expand Down
12 changes: 12 additions & 0 deletions curve25519-dalek/src/ristretto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,18 @@ impl RistrettoPoint {
a, &A.0, b,
))
}

/// Checks whether \\([a]A + [b]B = C\\) in variable time.
pub fn vartime_check_double_scalar_mul_basepoint(
a: &Scalar,
A: &RistrettoPoint,
b: &Scalar,
C: &RistrettoPoint,
) -> bool {
use crate::traits::IsIdentity;

crate::backend::scalar_mul_abglsv_pornin(a, &A.0, b, &C.0).is_identity()
}
}

/// A precomputed table of multiples of a basepoint, used to accelerate
Expand Down

0 comments on commit 7685338

Please sign in to comment.