From 6a9f6c0a2846f730816a8690ccb56acd84d8c6e6 Mon Sep 17 00:00:00 2001 From: CPerezz Date: Thu, 11 Mar 2021 13:34:34 +0100 Subject: [PATCH 1/9] Update to latest bls12_381 version --- Cargo.toml | 10 ++++++---- src/elgamal.rs | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d850ce0..c10ccc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,19 +19,21 @@ exclude = [".github/workflows/ci.yml", "github/workflows/rust.yml", ] [dependencies] -blake2 = "0.9" dusk-bytes = "0.1" dusk-bls12_381 = {version="0.6", default-features=false} -subtle = {version="^2.3", default-features = false} -rand_core = {version = "0.5", default-features=false} +subtle = {version="2.0", default-features = false} +rand_core = {version = "0.6", default-features=false} canonical = {version = "0.5", optional = true} canonical_derive = {version = "0.5", optional = true} [dev-dependencies] -rand = "0.7" rand_xorshift = {version="0.2", default-features = false} +blake2 = "0.9" [features] default = ["std"] std = ["dusk-bls12_381/default"] canon = ["canonical", "canonical_derive", "dusk-bls12_381/canon"] + +[patch.crates-io] +dusk-bls12_381 = {git = "https://github.com/dusk-network/bls12_381", branch = "release-0.7", default-features = false, features = ["alloc", "groups", "pairings", "endo"]} diff --git a/src/elgamal.rs b/src/elgamal.rs index fae8045..7691897 100644 --- a/src/elgamal.rs +++ b/src/elgamal.rs @@ -7,7 +7,7 @@ use dusk_bytes::{DeserializableSlice, Error as BytesError, Serializable}; /// /// ## Example /// -/// ```rust +/// ```ignore /// use dusk_jubjub::elgamal::ElgamalCipher; /// use dusk_jubjub::{JubJubScalar, GENERATOR_EXTENDED}; /// @@ -207,8 +207,10 @@ impl<'b> MulAssign<&'b JubJubScalar> for ElgamalCipher { } } +#[cfg(feature = "std")] #[cfg(test)] mod tests { + use super::ElgamalCipher; use crate::{JubJubExtended, JubJubScalar, GENERATOR_EXTENDED}; use dusk_bytes::Serializable; From cc206606a4296e99e4ca9e17465549c0a7d6a83a Mon Sep 17 00:00:00 2001 From: CPerezz Date: Thu, 11 Mar 2021 14:01:41 +0100 Subject: [PATCH 2/9] Fix tests to be no_std compatible --- Cargo.toml | 2 +- src/elgamal.rs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c10ccc5..453db66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ canonical = {version = "0.5", optional = true} canonical_derive = {version = "0.5", optional = true} [dev-dependencies] -rand_xorshift = {version="0.2", default-features = false} +rand_xorshift = {version="0.3", default-features = false} blake2 = "0.9" [features] diff --git a/src/elgamal.rs b/src/elgamal.rs index 7691897..58a229c 100644 --- a/src/elgamal.rs +++ b/src/elgamal.rs @@ -214,12 +214,13 @@ mod tests { use super::ElgamalCipher; use crate::{JubJubExtended, JubJubScalar, GENERATOR_EXTENDED}; use dusk_bytes::Serializable; + use rand_core::OsRng; fn gen() -> (JubJubScalar, JubJubExtended, JubJubScalar, JubJubExtended) { - let a = JubJubScalar::random(&mut rand::thread_rng()); + let a = JubJubScalar::random(&mut OsRng); let a_g = GENERATOR_EXTENDED * a; - let b = JubJubScalar::random(&mut rand::thread_rng()); + let b = JubJubScalar::random(&mut OsRng); let b_g = GENERATOR_EXTENDED * b; (a, a_g, b, b_g) @@ -229,7 +230,7 @@ mod tests { fn encrypt() { let (a, _, b, b_g) = gen(); - let m = JubJubScalar::random(&mut rand::thread_rng()); + let m = JubJubScalar::random(&mut OsRng); let m = GENERATOR_EXTENDED * m; let cipher = ElgamalCipher::encrypt(&a, &b_g, &GENERATOR_EXTENDED, &m); @@ -242,7 +243,7 @@ mod tests { fn wrong_key() { let (a, _, b, b_g) = gen(); - let m = JubJubScalar::random(&mut rand::thread_rng()); + let m = JubJubScalar::random(&mut OsRng); let m = GENERATOR_EXTENDED * m; let cipher = ElgamalCipher::encrypt(&a, &b_g, &GENERATOR_EXTENDED, &m); @@ -259,7 +260,7 @@ mod tests { let mut m = [JubJubScalar::zero(); 4]; m.iter_mut() - .for_each(|x| *x = JubJubScalar::random(&mut rand::thread_rng())); + .for_each(|x| *x = JubJubScalar::random(&mut OsRng)); let mut m_g = [JubJubExtended::default(); 4]; m_g.iter_mut() @@ -289,7 +290,7 @@ mod tests { let mut m = [JubJubScalar::zero(); 4]; m.iter_mut() - .for_each(|x| *x = JubJubScalar::random(&mut rand::thread_rng())); + .for_each(|x| *x = JubJubScalar::random(&mut OsRng)); let mut m_g = [JubJubExtended::default(); 4]; m_g.iter_mut() @@ -319,7 +320,7 @@ mod tests { let mut m = [JubJubScalar::zero(); 4]; m.iter_mut() - .for_each(|x| *x = JubJubScalar::random(&mut rand::thread_rng())); + .for_each(|x| *x = JubJubScalar::random(&mut OsRng)); let mut m_g = [JubJubExtended::default(); 4]; m_g.iter_mut() @@ -345,7 +346,7 @@ mod tests { fn to_bytes() { let (a, _, b, b_g) = gen(); - let m = JubJubScalar::random(&mut rand::thread_rng()); + let m = JubJubScalar::random(&mut OsRng); let m = GENERATOR_EXTENDED * m; let cipher = ElgamalCipher::encrypt(&a, &b_g, &GENERATOR_EXTENDED, &m); From f97986d2511122c958799d96dec6da79a32820cd Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 12:14:46 +0200 Subject: [PATCH 3/9] Revert version change for `subtle` --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 453db66..ff5452e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ exclude = [".github/workflows/ci.yml", "github/workflows/rust.yml", [dependencies] dusk-bytes = "0.1" dusk-bls12_381 = {version="0.6", default-features=false} -subtle = {version="2.0", default-features = false} +subtle = {version="^2.3", default-features = false} rand_core = {version = "0.6", default-features=false} canonical = {version = "0.5", optional = true} canonical_derive = {version = "0.5", optional = true} From 55e6838ad4e789b2f3e96fce3901c95b04eb22ef Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 14:10:53 +0200 Subject: [PATCH 4/9] Set blake2 as dev-dependency Resolves: #64 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d850ce0..13dc76f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ exclude = [".github/workflows/ci.yml", "github/workflows/rust.yml", ] [dependencies] -blake2 = "0.9" dusk-bytes = "0.1" dusk-bls12_381 = {version="0.6", default-features=false} subtle = {version="^2.3", default-features = false} @@ -28,6 +27,7 @@ canonical = {version = "0.5", optional = true} canonical_derive = {version = "0.5", optional = true} [dev-dependencies] +blake2 = "0.9" rand = "0.7" rand_xorshift = {version="0.2", default-features = false} From 4a56bd57011304d023564e7631422b0d338b4ce0 Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 14:11:36 +0200 Subject: [PATCH 5/9] Update RELEASES.md --- RELEASES.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index b949e40..1815e05 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,10 @@ +## Unreleased +### Change +- Set `blake2` as dev-dep. [#64](https://github.com/dusk-network/jubjub/issues/64) + # 0.8.1 ### Change -- Issue #61 - Fix on default-features prop of dusk-bls12_381 dependency +- Fix on default-features prop of dusk-bls12_381 dependency [#61](https://github.com/dusk-network/jubjub/issues/61) # 0.8.0 ### Change From 333b74747a2b9475bd14e46ee255dd730bba90ea Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 14:21:20 +0200 Subject: [PATCH 6/9] Update RELEASES.md --- RELEASES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index b949e40..b57619d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,7 @@ +# Unreleased +### Fix +- Fix no_std compatibility for crate.[#67](https://github.com/dusk-network/jubjub/pull/67) + # 0.8.1 ### Change - Issue #61 - Fix on default-features prop of dusk-bls12_381 dependency From 8e37d93c101be8afb63e8e0b07fda3b546f99f8e Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 15:10:13 +0200 Subject: [PATCH 7/9] Update dusk-bls12_381 to 0.7 --- Cargo.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ff5452e..cc1fc2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ exclude = [".github/workflows/ci.yml", "github/workflows/rust.yml", [dependencies] dusk-bytes = "0.1" -dusk-bls12_381 = {version="0.6", default-features=false} +dusk-bls12_381 = {version="0.7", default-features=false} subtle = {version="^2.3", default-features = false} rand_core = {version = "0.6", default-features=false} canonical = {version = "0.5", optional = true} @@ -35,5 +35,3 @@ default = ["std"] std = ["dusk-bls12_381/default"] canon = ["canonical", "canonical_derive", "dusk-bls12_381/canon"] -[patch.crates-io] -dusk-bls12_381 = {git = "https://github.com/dusk-network/bls12_381", branch = "release-0.7", default-features = false, features = ["alloc", "groups", "pairings", "endo"]} From 02b775af12c81a6392b5f3b85cfdd1846dcff84b Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 16:17:43 +0200 Subject: [PATCH 8/9] Update RELEASES.md --- RELEASES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 5e15d7e..69214e3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,4 +1,6 @@ # Unreleased + +# 0.9.0 ### Fix - Fix no_std compatibility for crate.[#67](https://github.com/dusk-network/jubjub/pull/67) From 6a1417136a2079787fa050e5980b16b6ca5bc4a4 Mon Sep 17 00:00:00 2001 From: CPerezz Date: Mon, 12 Apr 2021 16:17:55 +0200 Subject: [PATCH 9/9] Bump to v0.9.0 Resolves: #71 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cc1fc2e..f5c2190 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ homepage = "https://github.com/dusk-network/jubjub" license = "MIT/Apache-2.0" name = "dusk-jubjub" repository = "https://github.com/dusk-network/jubjub" -version = "0.8.1" +version = "0.9.0" keywords = ["cryptography", "jubjub", "zk-snarks", "ecc", "elliptic-curve"] categories =["algorithms", "cryptography", "science"] edition = "2018"