From a6b018fb0eb360ddc6d11919ef80d35e672b8b8f Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 4 Jun 2021 00:44:26 +0100 Subject: [PATCH 1/2] impl CofactorCurve for Pallas and Vesta They already implement CofactorGroup (trivially, with the prime-order subgroup being Self); this just enables Pallas and Vesta to be used in cofactor-aware protocols that also want to leverage the affine point representation. --- CHANGELOG.md | 4 ++++ src/curves.rs | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fea405..83c2583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to Rust's notion of [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## Added +- Implementations of `group::cofactor::{CofactorCurve, CofactorCurveAffine}` for + Pallas and Vesta, enabling them to be used in cofactor-aware protocols that + also want to leverage the affine point representation. ## [0.1.0] - 2021-06-01 Initial release! diff --git a/src/curves.rs b/src/curves.rs index 047c799..e784902 100644 --- a/src/curves.rs +++ b/src/curves.rs @@ -7,7 +7,7 @@ use core::iter::Sum; use core::ops::{Add, Mul, Neg, Sub}; use ff::Field; use group::{ - cofactor::CofactorGroup, + cofactor::{CofactorCurve, CofactorGroup}, prime::{PrimeCurve, PrimeCurveAffine, PrimeGroup}, Curve as _, Group as _, GroupEncoding, }; @@ -218,6 +218,10 @@ macro_rules! new_curve_impl { type Affine = $name_affine; } + impl CofactorCurve for $name { + type Affine = $name_affine; + } + impl GroupEncoding for $name { type Repr = [u8; 32]; @@ -594,6 +598,27 @@ macro_rules! new_curve_impl { } } + impl group::cofactor::CofactorCurveAffine for $name_affine { + type Curve = $name; + type Scalar = $scalar; + + fn identity() -> Self { + ::identity() + } + + fn generator() -> Self { + ::generator() + } + + fn is_identity(&self) -> Choice { + ::is_identity(self) + } + + fn to_curve(&self) -> Self::Curve { + ::to_curve(self) + } + } + impl GroupEncoding for $name_affine { type Repr = [u8; 32]; From 15e16839b30cb26905e9b3b7aa4998727f7c8c0e Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 4 Jun 2021 18:54:09 +0100 Subject: [PATCH 2/2] Release 0.1.1 --- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83c2583..7ce35d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to Rust's notion of [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.1.1] - 2021-06-04 ## Added - Implementations of `group::cofactor::{CofactorCurve, CofactorCurveAffine}` for Pallas and Vesta, enabling them to be used in cofactor-aware protocols that diff --git a/Cargo.toml b/Cargo.toml index 4f543de..18e8d57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pasta_curves" description = "Implementation of the Pallas and Vesta (Pasta) curve cycle" -version = "0.1.0" +version = "0.1.1" authors = [ "Sean Bowe ", "Ying Tong Lai ",