Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions elliptic-curve/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ pub trait CurveArithmetic: Curve {
+ From<Self::AffinePoint>
+ From<NonIdentity<Self::ProjectivePoint>>
+ Into<Self::AffinePoint>
+ LinearCombination<[(Self::ProjectivePoint, Self::Scalar)]>
+ LinearCombination<[(Self::ProjectivePoint, Self::Scalar); 2]>
+ for<'a> LinearCombination<'a, [(Self::ProjectivePoint, Self::Scalar)]>
+ for<'a> LinearCombination<'a, [(Self::ProjectivePoint, Self::Scalar); 2]>
+ TryInto<NonIdentity<Self::ProjectivePoint>, Error = Error>
+ CurveGroup<AffineRepr = Self::AffinePoint>
+ Group<Scalar = Self::Scalar>;
Expand Down
4 changes: 2 additions & 2 deletions elliptic-curve/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,8 @@ impl CurveGroup for ProjectivePoint {
}
}

impl LinearCombination<[(ProjectivePoint, Scalar)]> for ProjectivePoint {}
impl<const N: usize> LinearCombination<[(ProjectivePoint, Scalar); N]> for ProjectivePoint {}
impl LinearCombination<'_, [(ProjectivePoint, Scalar)]> for ProjectivePoint {}
impl<const N: usize> LinearCombination<'_, [(ProjectivePoint, Scalar); N]> for ProjectivePoint {}

impl Add<ProjectivePoint> for ProjectivePoint {
type Output = ProjectivePoint;
Expand Down
10 changes: 5 additions & 5 deletions elliptic-curve/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ pub(crate) fn invert_batch_internal<T: Copy + Mul<Output = T> + MulAssign>(
///
/// It's generic around `PointsAndScalars` to allow overlapping impls. For example, const generic
/// impls can use the input size to determine the size needed to store temporary variables.
pub trait LinearCombination<PointsAndScalars>: CurveGroup
pub trait LinearCombination<'a, PointsAndScalars>: CurveGroup
where
PointsAndScalars: AsRef<[(Self, Self::Scalar)]> + ?Sized,
PointsAndScalars: ?Sized + 'a,
&'a PointsAndScalars: IntoIterator<Item = &'a (Self, Self::Scalar)>,
{
/// Calculates `x1 * k1 + ... + xn * kn`.
fn lincomb(points_and_scalars: &PointsAndScalars) -> Self {
fn lincomb(points_and_scalars: &'a PointsAndScalars) -> Self {
points_and_scalars
.as_ref()
.iter()
.into_iter()
.copied()
.map(|(point, scalar)| point * scalar)
.sum()
Expand Down