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 May 5, 2020
1 parent 61185bf commit 9b8b93d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ristretto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,18 @@ impl RistrettoPoint {
EdwardsPoint::vartime_double_scalar_mul_basepoint(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;

scalar_mul::abglsv_pornin::mul(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 9b8b93d

Please sign in to comment.