From 53f65f7e6de71abf72ec15bc2a48036842f92d4b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 3 Jan 2022 13:51:04 +0000 Subject: [PATCH 1/3] Changelog and comment cleanups --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- src/curves.rs | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56142bf..b8c059b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to Rust's notion of ## [Unreleased] ### Added +- Support for `no-std` builds, via two new (default-enabled) feature flags: + - `alloc` enables the `pasta_curves::arithmetic::{CurveAffine, CurveExt}` + traits, as well as implementations of traits like `group::WnafGroup`. + - `sqrt-table` depends on `alloc`, and enables the large precomputed tables + (stored on the heap) that speed up square root computation. - `pasta_curves::arithmetic::SqrtRatio` trait, extending `ff::PrimeField` with square roots of ratios. This trait is likely to be moved into the `ff` crate in a future release (once we're satisfied with it). diff --git a/Cargo.toml b/Cargo.toml index b5f27ee..c906b3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ rand = { version = "0.8", default-features = false } static_assertions = "1.1.0" subtle = { version = "2.3", default-features = false } -# std dependencies +# sqrt-table dependencies lazy_static = { version = "1.4.0", optional = true } [features] diff --git a/src/curves.rs b/src/curves.rs index 91c489c..7c16ead 100644 --- a/src/curves.rs +++ b/src/curves.rs @@ -474,7 +474,12 @@ macro_rules! new_curve_impl { // multiplication, moving from most significant to least // significant bit of the scalar. // - // NOTE: We skip the leading bit because it's always unset. + // We don't use `PrimeFieldBits::.to_le_bits` here, because that would + // force users of this crate to depend on `bitvec` where they otherwise + // might not need to. + // + // NOTE: We skip the leading bit because it's always unset (we are turning + // the 32-byte repr into 256 bits, and $scalar::NUM_BITS = 255). for bit in other .to_repr() .iter() @@ -585,7 +590,12 @@ macro_rules! new_curve_impl { // multiplication, moving from most significant to least // significant bit of the scalar. // - // NOTE: We skip the leading bit because it's always unset. + // We don't use `PrimeFieldBits::.to_le_bits` here, because that would + // force users of this crate to depend on `bitvec` where they otherwise + // might not need to. + // + // NOTE: We skip the leading bit because it's always unset (we are turning + // the 32-byte repr into 256 bits, and $scalar::NUM_BITS = 255). for bit in other .to_repr() .iter() From 61fac8a5afdf04ac28dcec420b2cc27c21f775fb Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 3 Jan 2022 13:53:32 +0000 Subject: [PATCH 2/3] `blake2b_simd 1` We also move this dependency behind the `alloc` feature flag, as it is only required for `crate::hashtocurve`. --- Cargo.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c906b3c..23b42ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,18 +41,20 @@ harness = false required-features = ["alloc"] [dependencies] -blake2b_simd = { version = "0.5", default-features = false } ff = { version = "0.11", default-features = false } group = { version = "0.11", default-features = false } rand = { version = "0.8", default-features = false } static_assertions = "1.1.0" subtle = { version = "2.3", default-features = false } +# alloc dependencies +blake2b_simd = { version = "1", optional = true, default-features = false } + # sqrt-table dependencies lazy_static = { version = "1.4.0", optional = true } [features] default = ["bits", "sqrt-table"] -alloc = ["group/alloc"] +alloc = ["group/alloc", "blake2b_simd"] bits = ["ff/bits"] sqrt-table = ["alloc", "lazy_static"] From 6b2090ff2c862bc33a1afbc2afad47660ecf5e5e Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 3 Jan 2022 13:57:42 +0000 Subject: [PATCH 3/3] `pasta_curves 0.3.0` --- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8c059b..b723ca3 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.3.0] - 2022-01-03 ### Added - Support for `no-std` builds, via two new (default-enabled) feature flags: - `alloc` enables the `pasta_curves::arithmetic::{CurveAffine, CurveExt}` diff --git a/Cargo.toml b/Cargo.toml index 23b42ff..6b1429f 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.2.1" +version = "0.3.0" authors = [ "Sean Bowe ", "Ying Tong Lai ",