From bdf139673894a1d4ec07d7856bc3921d8f720c91 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 21 May 2025 19:40:25 -0600 Subject: [PATCH] elliptic-curve: scalar `Mul` bounds Adds bounds on `CurveArithmetic::Scalar` that it has a `Mul

` impl for both `AffinePoint` and `ProjectivePoint` --- elliptic-curve/src/arithmetic.rs | 6 +++++- elliptic-curve/src/dev.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/elliptic-curve/src/arithmetic.rs b/elliptic-curve/src/arithmetic.rs index e1cc29987..d0d17bc4c 100644 --- a/elliptic-curve/src/arithmetic.rs +++ b/elliptic-curve/src/arithmetic.rs @@ -2,7 +2,7 @@ use crate::{ Curve, FieldBytes, NonZeroScalar, PrimeCurve, ScalarPrimitive, - ops::{Invert, LinearCombination, Reduce, ShrAssign}, + ops::{Invert, LinearCombination, Mul, Reduce, ShrAssign}, point::{AffineCoordinates, NonIdentity}, scalar::{FromUintUnchecked, IsHigh}, }; @@ -73,6 +73,10 @@ pub trait CurveArithmetic: Curve { + Into + Invert> + IsHigh + + Mul + + for<'a> Mul<&'a Self::AffinePoint, Output = Self::ProjectivePoint> + + Mul + + for<'a> Mul<&'a Self::ProjectivePoint, Output = Self::ProjectivePoint> + PartialOrd + Reduce> + ShrAssign diff --git a/elliptic-curve/src/dev.rs b/elliptic-curve/src/dev.rs index d9aaabbd3..862b678be 100644 --- a/elliptic-curve/src/dev.rs +++ b/elliptic-curve/src/dev.rs @@ -271,6 +271,38 @@ impl Mul<&Scalar> for Scalar { } } +impl Mul for Scalar { + type Output = ProjectivePoint; + + fn mul(self, _other: AffinePoint) -> ProjectivePoint { + unimplemented!(); + } +} + +impl Mul<&AffinePoint> for Scalar { + type Output = ProjectivePoint; + + fn mul(self, _other: &AffinePoint) -> ProjectivePoint { + unimplemented!(); + } +} + +impl Mul for Scalar { + type Output = ProjectivePoint; + + fn mul(self, _other: ProjectivePoint) -> ProjectivePoint { + unimplemented!(); + } +} + +impl Mul<&ProjectivePoint> for Scalar { + type Output = ProjectivePoint; + + fn mul(self, _other: &ProjectivePoint) -> ProjectivePoint { + unimplemented!(); + } +} + impl MulAssign for Scalar { fn mul_assign(&mut self, _rhs: Scalar) { unimplemented!();