From fa849e014c0497ea4651473e80bf089c87468e32 Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Mon, 2 Sep 2019 11:26:11 +0800 Subject: [PATCH 1/7] errata for vpmuludq --- docs/avx2-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/avx2-notes.md b/docs/avx2-notes.md index 87992b3..ccb5022 100644 --- a/docs/avx2-notes.md +++ b/docs/avx2-notes.md @@ -12,7 +12,7 @@ representation (which uses radix \\(2^{51}\\)) amounts to regrouping digits. The field element representation is oriented around the AVX2 -`vpmuluqdq` instruction, which multiplies the low 32 bits of each +`vpmuludq` instruction, which multiplies the low 32 bits of each 64-bit lane of each operand to produce a 64-bit result. ```text,no_run From f6015c66c2493e0d50acf945430d9bf7accbbc83 Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Tue, 3 Sep 2019 10:38:23 +0800 Subject: [PATCH 2/7] errata for comment --- src/backend/vector/avx2/edwards.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/vector/avx2/edwards.rs b/src/backend/vector/avx2/edwards.rs index 675797d..274dc62 100644 --- a/src/backend/vector/avx2/edwards.rs +++ b/src/backend/vector/avx2/edwards.rs @@ -153,7 +153,7 @@ impl ExtendedPoint { // Set tmp1 = ( S_9, S_6, S_6, S_9) // b < ( 1.6, 1.6, 1.6, 1.6) tmp1 = tmp0.shuffle(Shuffle::DBBD); - // Set tmp1 = ( S_8, S_5, S_8, S_5) + // Set tmp0 = ( S_8, S_5, S_8, S_5) // b < (2.33, 1.01, 2.33, 1.01) tmp0 = tmp0.shuffle(Shuffle::CACA); From 8da05f7e90b59b6dea6f72c4d4cad238647b1b60 Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Wed, 4 Sep 2019 12:38:02 +0800 Subject: [PATCH 3/7] errata and basepoint_odd_lookup_table test for better understanding --- docs/parallel-formulas.md | 2 +- src/backend/vector/avx2/edwards.rs | 22 +++++++++++++++++++++- src/backend/vector/avx2/mod.rs | 2 +- src/backend/vector/mod.rs | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/parallel-formulas.md b/docs/parallel-formulas.md index 22f59cd..7f1e1c1 100644 --- a/docs/parallel-formulas.md +++ b/docs/parallel-formulas.md @@ -327,7 +327,7 @@ There are several directions for future improvement: [sandy2x]: https://eprint.iacr.org/2015/943.pdf [avx2trac]: https://trac.torproject.org/projects/tor/ticket/8897#comment:28 [hwcd08]: https://www.iacr.org/archive/asiacrypt2008/53500329/53500329.pdf -[curve_models]: https://doc-internal.dalek.rs/curve25519_dalek/curve_models/index.html +[curve_models]: https://doc-internal.dalek.rs/curve25519_dalek/backend/serial/curve_models/index.html [bbjlp08]: https://eprint.iacr.org/2008/013 [cmo98]: https://link.springer.com/content/pdf/10.1007%2F3-540-49649-1_6.pdf [intel]: https://software.intel.com/sites/default/files/managed/9e/bc/64-ia-32-architectures-optimization-manual.pdf diff --git a/src/backend/vector/avx2/edwards.rs b/src/backend/vector/avx2/edwards.rs index 274dc62..7e7ad7a 100644 --- a/src/backend/vector/avx2/edwards.rs +++ b/src/backend/vector/avx2/edwards.rs @@ -47,6 +47,7 @@ use traits::Identity; use super::constants; use super::field::{FieldElement2625x4, Lanes, Shuffle}; +use backend::vector::avx2::constants::{BASEPOINT_ODD_LOOKUP_TABLE}; /// A point on Curve25519, using parallel Edwards formulas for curve /// operations. @@ -188,7 +189,7 @@ impl From for CachedPoint { let mut x = P.0; x = x.blend(x.diff_sum(), Lanes::AB); - // x = (X1 - Y1, X2 + Y2, Z2, T2) = (S2 S3 Z2 T2) + // x = (Y2 - X2, Y2 + X2, Z2, T2) = (S2 S3 Z2 T2) x = x * (121666, 121666, 2 * 121666, 2 * 121665); // x = (121666*S2 121666*S3 2*121666*Z2 2*121665*T2) @@ -521,4 +522,23 @@ mod test { let P = &constants::ED25519_BASEPOINT_TABLE * &Scalar::from(8475983829u64); doubling_test_helper(P); } + + #[test] + fn basepoint_odd_lookup_table_verify() { + use constants; + + let basepoint_odd_table = NafLookupTable8::::from(&constants::ED25519_BASEPOINT_POINT); + println!("basepoint_odd_lookup_table = {:?}", basepoint_odd_table); + + let table_B = &BASEPOINT_ODD_LOOKUP_TABLE; + for (b_vec, base_vec) in table_B.0.iter().zip(basepoint_odd_table.0.iter()) { + let b_splits = b_vec.0.split(); + let base_splits = base_vec.0.split(); + + assert_eq!(base_splits[0], b_splits[0]); + assert_eq!(base_splits[1], b_splits[1]); + assert_eq!(base_splits[2], b_splits[2]); + assert_eq!(base_splits[3], b_splits[3]); + } + } } diff --git a/src/backend/vector/avx2/mod.rs b/src/backend/vector/avx2/mod.rs index 0b30085..a1a21eb 100644 --- a/src/backend/vector/avx2/mod.rs +++ b/src/backend/vector/avx2/mod.rs @@ -19,7 +19,7 @@ // missing). #![cfg_attr( all(feature = "nightly", feature = "stage2_build"), - doc(include = "../docs/avx2-notes.md") + doc(include = "../../../../docs/avx2-notes.md") )] pub(crate) mod field; diff --git a/src/backend/vector/mod.rs b/src/backend/vector/mod.rs index 76d36ab..95b5446 100644 --- a/src/backend/vector/mod.rs +++ b/src/backend/vector/mod.rs @@ -19,7 +19,7 @@ // missing). #![cfg_attr( all(feature = "nightly", feature = "stage2_build"), - doc(include = "../docs/parallel-formulas.md") + doc(include = "../../../docs/parallel-formulas.md") )] #[cfg(not(any(target_feature = "avx2", target_feature = "avx512ifma", rustdoc)))] From 2d0c5323cbabc9a09473013411beec5da7aedcbe Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Wed, 4 Sep 2019 13:15:09 +0800 Subject: [PATCH 4/7] errata and basepoint_odd_lookup_table test for better understanding --- src/backend/vector/avx2/edwards.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/vector/avx2/edwards.rs b/src/backend/vector/avx2/edwards.rs index 7e7ad7a..b2a3ba9 100644 --- a/src/backend/vector/avx2/edwards.rs +++ b/src/backend/vector/avx2/edwards.rs @@ -47,7 +47,6 @@ use traits::Identity; use super::constants; use super::field::{FieldElement2625x4, Lanes, Shuffle}; -use backend::vector::avx2::constants::{BASEPOINT_ODD_LOOKUP_TABLE}; /// A point on Curve25519, using parallel Edwards formulas for curve /// operations. @@ -526,6 +525,7 @@ mod test { #[test] fn basepoint_odd_lookup_table_verify() { use constants; + use backend::vector::avx2::constants::{BASEPOINT_ODD_LOOKUP_TABLE}; let basepoint_odd_table = NafLookupTable8::::from(&constants::ED25519_BASEPOINT_POINT); println!("basepoint_odd_lookup_table = {:?}", basepoint_odd_table); From 608f8cd594433e26179fafd587a3b0138b4afcdb Mon Sep 17 00:00:00 2001 From: Stephane Raux Date: Tue, 20 Oct 2020 17:54:06 -0700 Subject: [PATCH 5/7] Make crate feature alloc work with stable Rust `println!` was removed in the test as the corresponding test for `u32` does not have it. --- src/backend/serial/u64/scalar.rs | 1 - src/lib.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/backend/serial/u64/scalar.rs b/src/backend/serial/u64/scalar.rs index 97069ad..cee69da 100644 --- a/src/backend/serial/u64/scalar.rs +++ b/src/backend/serial/u64/scalar.rs @@ -443,7 +443,6 @@ mod test { fn from_bytes_wide() { let bignum = [255u8; 64]; // 2^512 - 1 let reduced = Scalar52::from_bytes_wide(&bignum); - println!("{:?}", reduced); for i in 0..5 { assert!(reduced[i] == C[i]); } diff --git a/src/lib.rs b/src/lib.rs index 3d68c58..179e70a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ #![no_std] #![cfg_attr(feature = "nightly", feature(test))] -#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))] #![cfg_attr(feature = "nightly", feature(external_doc))] #![cfg_attr(feature = "nightly", feature(doc_cfg))] #![cfg_attr(feature = "simd_backend", feature(stdsimd))] From 77ec9742120c7d2fec7003b992ab346fc6660c49 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Fri, 8 Jan 2021 00:33:37 +0000 Subject: [PATCH 6/7] Whitespace fixes for 3267a5d merge. --- docs/parallel-formulas.md | 2 +- src/backend/vector/avx2/edwards.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/parallel-formulas.md b/docs/parallel-formulas.md index 7f1e1c1..f84d1cc 100644 --- a/docs/parallel-formulas.md +++ b/docs/parallel-formulas.md @@ -327,7 +327,7 @@ There are several directions for future improvement: [sandy2x]: https://eprint.iacr.org/2015/943.pdf [avx2trac]: https://trac.torproject.org/projects/tor/ticket/8897#comment:28 [hwcd08]: https://www.iacr.org/archive/asiacrypt2008/53500329/53500329.pdf -[curve_models]: https://doc-internal.dalek.rs/curve25519_dalek/backend/serial/curve_models/index.html +[curve_models]: https://doc-internal.dalek.rs/curve25519_dalek/backend/serial/curve_models/index.html [bbjlp08]: https://eprint.iacr.org/2008/013 [cmo98]: https://link.springer.com/content/pdf/10.1007%2F3-540-49649-1_6.pdf [intel]: https://software.intel.com/sites/default/files/managed/9e/bc/64-ia-32-architectures-optimization-manual.pdf diff --git a/src/backend/vector/avx2/edwards.rs b/src/backend/vector/avx2/edwards.rs index b25a557..77af176 100644 --- a/src/backend/vector/avx2/edwards.rs +++ b/src/backend/vector/avx2/edwards.rs @@ -526,8 +526,8 @@ mod test { fn basepoint_odd_lookup_table_verify() { use constants; use backend::vector::avx2::constants::{BASEPOINT_ODD_LOOKUP_TABLE}; - - let basepoint_odd_table = NafLookupTable8::::from(&constants::ED25519_BASEPOINT_POINT); + + let basepoint_odd_table = NafLookupTable8::::from(&constants::ED25519_BASEPOINT_POINT); println!("basepoint_odd_lookup_table = {:?}", basepoint_odd_table); let table_B = &BASEPOINT_ODD_LOOKUP_TABLE; From 55e0db7cf625b54d67a503b485d19abd85738cf2 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Fri, 8 Jan 2021 03:32:42 +0000 Subject: [PATCH 7/7] Bump curve25519-dalek version to 3.0.2. --- CHANGELOG.md | 22 ++++++++++++++++++++++ Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f97d7e1..90ac99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ major series. ## 3.x series +### 3.0.2 + +* Fixes to make using alloc+no_std possible for stable Rust. + ### 3.0.1 * Update the optional `packed-simd` dependency to rely on a newer, @@ -18,6 +22,15 @@ major series. ## 2.x series +### 2.1.2 + +* Fixes to make using alloc+no_std possible for stable Rust. + +### 2.1.1 + +* Update the optional `packed-simd` dependency to rely on a newer, + maintained version of the `packed-simd-2` crate. + ### 2.1.0 * Make `Scalar::from_bits` a `const fn`, allowing its use in `const` contexts. @@ -43,6 +56,15 @@ besides the `rand_core` version bump, there are no other user-visible changes. ## 1.x series +### 1.2.6 + +* Fixes to make using alloc+no_std possible for stable Rust. + +### 1.2.5 + +* Update the optional `packed-simd` dependency to rely on a newer, + maintained version of the `packed-simd-2` crate. + ### 1.2.4 * Specify a semver bound for `clear_on_drop` rather than an exact version, diff --git a/Cargo.toml b/Cargo.toml index b58f3f8..3426071 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ name = "curve25519-dalek" # - update CHANGELOG # - update html_root_url # - update README if required by semver -version = "3.0.1" +version = "3.0.2" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 179e70a..912b62a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ #![cfg_attr(feature = "nightly", doc(include = "../README.md"))] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] -#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.0.0")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.0.2")] //! Note that docs will only build on nightly Rust until //! [RFC 1990 stabilizes](https://github.com/rust-lang/rust/issues/44732).