Skip to content

Commit 5f5f6ab

Browse files
authored
elliptic-curve: re-export group::Curve as CurveGroup (#1902)
This crate also defines a `Curve` trait, and while that trait is used to describe an elliptic curve, `group::Curve` is a `Group`, i.e. the elliptic curve group for a particular curve. See also: zkcrypto/group#51 To prevent this name clash, this commit re-exports `group::Curve` as `CurveGroup`. cc @daxpedda
1 parent 0eab8e2 commit 5f5f6ab

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

elliptic-curve/src/arithmetic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Elliptic curve arithmetic traits.
22
33
use crate::{
4-
Curve, Error, FieldBytes, NonZeroScalar, PrimeCurve, ScalarPrimitive,
4+
Curve, CurveGroup, Error, FieldBytes, Group, NonZeroScalar, PrimeCurve, ScalarPrimitive,
55
ops::{Invert, LinearCombination, Mul, Reduce, ShrAssign},
66
point::{AffineCoordinates, NonIdentity},
77
scalar::{FromUintUnchecked, IsHigh},
@@ -50,8 +50,8 @@ pub trait CurveArithmetic: Curve {
5050
+ LinearCombination<[(Self::ProjectivePoint, Self::Scalar)]>
5151
+ LinearCombination<[(Self::ProjectivePoint, Self::Scalar); 2]>
5252
+ TryInto<NonIdentity<Self::ProjectivePoint>, Error = Error>
53-
+ group::Curve<AffineRepr = Self::AffinePoint>
54-
+ group::Group<Scalar = Self::Scalar>;
53+
+ CurveGroup<AffineRepr = Self::AffinePoint>
54+
+ Group<Scalar = Self::Scalar>;
5555

5656
/// Scalar field modulo this curve's order.
5757
///

elliptic-curve/src/dev.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! the traits in this crate.
55
66
use crate::{
7-
BatchNormalize, Curve, CurveArithmetic, FieldBytesEncoding, PrimeCurve,
7+
BatchNormalize, Curve, CurveArithmetic, CurveGroup, FieldBytesEncoding, PrimeCurve,
88
array::typenum::U32,
99
bigint::{Limb, U256},
1010
error::{Error, Result},
@@ -651,7 +651,7 @@ impl From<NonIdentity<ProjectivePoint>> for ProjectivePoint {
651651

652652
impl From<ProjectivePoint> for AffinePoint {
653653
fn from(point: ProjectivePoint) -> AffinePoint {
654-
group::Curve::to_affine(&point)
654+
CurveGroup::to_affine(&point)
655655
}
656656
}
657657

@@ -736,11 +736,11 @@ impl group::GroupEncoding for ProjectivePoint {
736736
}
737737

738738
fn to_bytes(&self) -> Self::Repr {
739-
group::Curve::to_affine(self).to_bytes()
739+
CurveGroup::to_affine(self).to_bytes()
740740
}
741741
}
742742

743-
impl group::Curve for ProjectivePoint {
743+
impl CurveGroup for ProjectivePoint {
744744
type AffineRepr = AffinePoint;
745745

746746
fn to_affine(&self) -> AffinePoint {

elliptic-curve/src/ecdh.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@
2727
//! [SIGMA]: https://webee.technion.ac.il/~hugo/sigma-pdf.pdf
2828
2929
use crate::{
30-
AffinePoint, Curve, CurveArithmetic, FieldBytes, NonZeroScalar, ProjectivePoint, PublicKey,
31-
point::AffineCoordinates,
30+
AffinePoint, Curve, CurveArithmetic, CurveGroup, FieldBytes, NonZeroScalar, ProjectivePoint,
31+
PublicKey, point::AffineCoordinates,
3232
};
3333
use core::{borrow::Borrow, fmt};
3434
use digest::{Digest, crypto_common::BlockSizeUser};
35-
use group::Curve as _;
3635
use hkdf::{Hkdf, hmac::SimpleHmac};
3736
use rand_core::{CryptoRng, TryCryptoRng};
3837
use zeroize::{Zeroize, ZeroizeOnDrop};

elliptic-curve/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub use {
139139
scalar::{NonZeroScalar, Scalar},
140140
},
141141
ff::{self, Field, PrimeField},
142-
group::{self, Group},
142+
group::{self, Curve as CurveGroup, Group},
143143
};
144144

145145
#[cfg(feature = "jwk")]

elliptic-curve/src/ops.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! Traits for arithmetic operations on elliptic curve field elements.
22
3-
use core::iter;
43
pub use core::ops::{Add, AddAssign, Mul, MulAssign, Neg, Shr, ShrAssign, Sub, SubAssign};
54
pub use crypto_bigint::Invert;
65

6+
use crate::CurveGroup;
7+
use core::iter;
78
use crypto_bigint::Integer;
89
use ff::Field;
910
use subtle::{Choice, CtOption};
@@ -159,7 +160,7 @@ pub(crate) fn invert_batch_internal<T: Copy + Mul<Output = T> + MulAssign>(
159160
///
160161
/// It's generic around `PointsAndScalars` to allow overlapping impls. For example, const generic
161162
/// impls can use the input size to determine the size needed to store temporary variables.
162-
pub trait LinearCombination<PointsAndScalars>: group::Curve
163+
pub trait LinearCombination<PointsAndScalars>: CurveGroup
163164
where
164165
PointsAndScalars: AsRef<[(Self, Self::Scalar)]> + ?Sized,
165166
{

0 commit comments

Comments
 (0)