From ee0c6baa45f8ae531102cc79f54ec72f845ca38f Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 23 Sep 2021 21:13:26 +0000 Subject: [PATCH 01/40] Add Github action to test with nightly compilers. --- .github/workflows/rust.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index db237a8..2214f4b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -85,6 +85,35 @@ jobs: command: test args: --lib --no-default-features --features "alloc u32_backend" + nightly: + name: Test nightly compiler + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --features "nightly" + + msrv: + name: Current MSRV is 1.41 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.41 + override: true + - uses: actions-rs/cargo@v1 + with: + command: build + bench: name: Check that benchmarks compile runs-on: ubuntu-latest From 6ffc8ddefd84a74dd1b0b1844288e322b3127dfc Mon Sep 17 00:00:00 2001 From: Markus Zoppelt Date: Wed, 30 Sep 2020 12:59:10 +0200 Subject: [PATCH 02/40] bumped packed_simd to 0.3.4. resolves #333 (cherry picked from commit c2e394dd045e27ea4f26585d1b57e9b780aee6b8) Signed-off-by: Isis Lovecruft --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d73a932..bd5a157 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ byteorder = { version = "^1.2.3", default-features = false, features = ["i128"] digest = { version = "0.8", default-features = false } subtle = { version = "^2.2.1", default-features = false } serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] } -packed_simd = { version = "0.3", features = ["into_bits"], optional = true } +packed_simd = { package = "packed_simd_2", version = "*", git = "https://github.com/rust-lang/packed_simd", features = ["into_bits"], optional = true } zeroize = { version = "1", default-features = false } [features] From dd71df6ea03b04bcf3de09f72347b78b258e630c Mon Sep 17 00:00:00 2001 From: Markus Zoppelt Date: Wed, 30 Sep 2020 15:17:18 +0200 Subject: [PATCH 03/40] adjusted dependency entry like to pick up latest pick up the latest packed_simd crate under an alternative name. see also: https://github.com/rust-lang/packed_simd/issues/303#issuecomment-701361161 (cherry picked from commit f27923bf8c1cf696063f92aee06217c3fd861ea1) Signed-off-by: Isis Lovecruft --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bd5a157..d7c09ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ byteorder = { version = "^1.2.3", default-features = false, features = ["i128"] digest = { version = "0.8", default-features = false } subtle = { version = "^2.2.1", default-features = false } serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] } -packed_simd = { package = "packed_simd_2", version = "*", git = "https://github.com/rust-lang/packed_simd", features = ["into_bits"], optional = true } +packed_simd = { version = "0.3.4", package = "packed_simd_2", features = ["into_bits"], optional = true } zeroize = { version = "1", default-features = false } [features] From e6d8afc352b6547bccd51c51e717432add564bd9 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Wed, 30 Sep 2020 12:01:43 -0700 Subject: [PATCH 04/40] Add link to Cargo.toml with explanation of packed_simd renaming (cherry picked from commit 45f3f53351102ba8c7a8b062b4306fe93b7d169a) Signed-off-by: Isis Lovecruft --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d7c09ba..ae34e6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,8 @@ byteorder = { version = "^1.2.3", default-features = false, features = ["i128"] digest = { version = "0.8", default-features = false } subtle = { version = "^2.2.1", default-features = false } serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] } +# The original packed_simd package was orphaned, see +# https://github.com/rust-lang/packed_simd/issues/303#issuecomment-701361161 packed_simd = { version = "0.3.4", package = "packed_simd_2", features = ["into_bits"], optional = true } zeroize = { version = "1", default-features = false } From d00d4a5a9ad3aecea0d0c5dbab671e6cbc1d7412 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 7 Jan 2021 21:31:57 +0000 Subject: [PATCH 05/40] Fix CHANGELOG so that we can note backported patches. (cherry picked from commit 64099e9adfb2a8749910bd7fdc98aada112b7f91) Signed-off-by: Isis Lovecruft --- CHANGELOG.md | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a84de2c..d1828e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,15 @@ # Changelog -Entries are listed in reverse chronological order. +Entries are listed in reverse chronological order per undeprecated +major series. -## 2.1.0 +## 2.x series + +### 2.1.0 * Make `Scalar::from_bits` a `const fn`, allowing its use in `const` contexts. -## 2.0.0 +### 2.0.0 * Fix a data modeling error in the `serde` feature pointed out by Trevor Perrin which caused points and scalars to be serialized with length fields rather @@ -25,7 +28,15 @@ Entries are listed in reverse chronological order. The only significant change is the data model change to the `serde` feature; besides the `rand_core` version bump, there are no other user-visible changes. -## 1.2.3 +## 1.x series + +### 1.2.4 + +* Specify a semver bound for `clear_on_drop` rather than an exact version, + addressing an issue where changes to inline assembly in rustc prevented + `clear_on_drop` from working without an update. + +### 1.2.3 * Fix an issue identified by a Quarkslab audit (and Jack Grigg), where manually constructing unreduced `Scalar` values, as needed for X/Ed25519, and then @@ -39,14 +50,14 @@ besides the `rand_core` version bump, there are no other user-visible changes. * Fix compilation on nightly broken due to changes to the `#[doc(include)]` path root (not quite correctly done in 1.2.2). -## 1.2.2 +### 1.2.2 * Fix a typo in an internal doc-comment. * Add the "crypto" tag to crate metadata. * Fix compilation on nightly broken due to changes to the `#[doc(include)]` path root. -## 1.2.1 +### 1.2.1 * Fix a bug in bucket index calculations in the Pippenger multiscalar algorithm for very large input sizes. @@ -55,7 +66,7 @@ besides the `rand_core` version bump, there are no other user-visible changes. * Ensure that that multiscalar and NAF computations work correctly on extremal `Scalar` values constructed via `from_bits`. -## 1.2.0 +### 1.2.0 * New multiscalar multiplication algorithm with better performance for large problem sizes. The backend algorithm is selected @@ -64,16 +75,16 @@ besides the `rand_core` version bump, there are no other user-visible changes. * Equality of Edwards points is now checked in projective coordinates. * Serde can now be used with `no_std`. -## 1.1.4 +### 1.1.4 * Fix typos in documentation comments. * Remove unnecessary `Default` bound on `Scalar::from_hash`. -## 1.1.3 +### 1.1.3 * Reverts the change in 1.1.0 to allow owned and borrowed RNGs, which caused a breakage due to a subtle interaction with ownership rules. (The `RngCore` change is retained). -## 1.1.2 +### 1.1.2 * Disabled KaTeX on `docs.rs` pending proper [support upstream](https://github.com/rust-lang/docs.rs/issues/302). @@ -81,7 +92,7 @@ besides the `rand_core` version bump, there are no other user-visible changes. * Fixed an issue related to `#[cfg(rustdoc)]` which prevented documenting multiple backends. -## 1.1.0 +### 1.1.0 * Adds support for precomputation for multiscalar multiplication. * Restructures the internal source tree into `serial` and `vector` backends (no change to external API). @@ -90,19 +101,19 @@ besides the `rand_core` version bump, there are no other user-visible changes. * Replaces the `rand` dependency with `rand_core`. * Generalizes trait bounds on `RistrettoPoint::random()` and `Scalar::random()` to allow owned and borrowed RNGs and to allow `RngCore` instead of `Rng`. -## 1.0.3 +### 1.0.3 * Adds `ConstantTimeEq` implementation for compressed points. -## 1.0.2 +### 1.0.2 * Fixes a typo in the naming of variables in Ristretto formulas (no change to functionality). -## 1.0.1 +### 1.0.1 * Depends on the stable `2.0` version of `subtle` instead of `2.0.0-pre.0`. -## 1.0.0 +### 1.0.0 Initial stable release. Yanked due to a dependency mistake (see above). From bb889e478d6c90f60fb0b31d3b3c71f012575af9 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 7 Jan 2021 21:33:06 +0000 Subject: [PATCH 06/40] Remove deprecated feature flags from .travis.yml. (cherry picked from commit 7e320cd1d95bd9a1ea3c370e917ce0efcde63740) Signed-off-by: Isis Lovecruft --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc5f2dc..4b61db3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ env: - TEST_COMMAND=test EXTRA_FLAGS='--no-default-features' FEATURES='std u32_backend' # Tests the u64 backend - TEST_COMMAND=test EXTRA_FLAGS='--no-default-features' FEATURES='std u64_backend' - # Tests the avx2 backend - - TEST_COMMAND=test EXTRA_FLAGS='--no-default-features' FEATURES='std avx2_backend' + # Tests the simd backend + - TEST_COMMAND=test EXTRA_FLAGS='--no-default-features' FEATURES='std simd_backend' # Tests serde support and default feature selection - TEST_COMMAND=test EXTRA_FLAGS='' FEATURES='serde' # Tests building without std. We have to select a backend, so we select the one @@ -21,9 +21,9 @@ env: matrix: exclude: - # Test the avx2 backend only on nightly + # Test the simd backend only on nightly - rust: stable - env: TEST_COMMAND=test EXTRA_FLAGS='--no-default-features' FEATURES='std avx2_backend' + env: TEST_COMMAND=test EXTRA_FLAGS='--no-default-features' FEATURES='std simd_backend' # Test no_std+alloc only on nightly - rust: stable env: TEST_COMMAND=test EXTRA_FLAGS='--lib --no-default-features' FEATURES='alloc u32_backend' From 0f07443c2d6c915bcb44417cfd2ec03aa53f0539 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 7 Jan 2021 22:21:37 +0000 Subject: [PATCH 07/40] Bump curve25519-dalek to 2.1.1. --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1828e8..ffa081f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 2.x series +### 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. diff --git a/Cargo.toml b/Cargo.toml index ae34e6a..c5be1f3 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 = "2.1.0" +version = "2.1.1" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index e1409a2..aecce3c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,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/2.1.0")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/2.1.1")] //! Note that docs will only build on nightly Rust until //! [RFC 1990 stabilizes](https://github.com/rust-lang/rust/issues/44732). From 4269b39f133aadd7da1c19a40cb4c2e0039f7a97 Mon Sep 17 00:00:00 2001 From: Stephane Raux Date: Tue, 20 Oct 2020 17:54:06 -0700 Subject: [PATCH 08/40] Make crate feature alloc work with stable Rust `println!` was removed in the test as the corresponding test for `u32` does not have it. (cherry picked from commit 608f8cd594433e26179fafd587a3b0138b4afcdb) Signed-off-by: Isis Lovecruft --- 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 aecce3c..f8384b1 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 3b79d0fbc43bf9a49d08fd7c326dd2041c12d9c4 Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Mon, 2 Sep 2019 11:26:11 +0800 Subject: [PATCH 09/40] errata for vpmuludq (cherry picked from commit fa849e014c0497ea4651473e80bf089c87468e32) Signed-off-by: Isis Lovecruft --- 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 87a5ed78b737a80d639cfb7bd6c72b9487477eba Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Tue, 3 Sep 2019 10:38:23 +0800 Subject: [PATCH 10/40] errata for comment (cherry picked from commit f6015c66c2493e0d50acf945430d9bf7accbbc83) Signed-off-by: Isis Lovecruft --- 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 8465720..8aadcc8 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 4b268a9d7e10fa5f6f20515e7276513dbad4fa8c Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Wed, 4 Sep 2019 12:38:02 +0800 Subject: [PATCH 11/40] errata and basepoint_odd_lookup_table test for better understanding (cherry picked from commit 8da05f7e90b59b6dea6f72c4d4cad238647b1b60) Signed-off-by: Isis Lovecruft --- docs/parallel-formulas.md | 2 +- src/backend/vector/avx2/edwards.rs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 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 8aadcc8..b8826d7 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]); + } + } } From 5ba95b13e4727ce9cb3f9675a4ad911d69f42c7d Mon Sep 17 00:00:00 2001 From: root <287494524@qq.com> Date: Wed, 4 Sep 2019 13:15:09 +0800 Subject: [PATCH 12/40] errata and basepoint_odd_lookup_table test for better understanding (cherry picked from commit 2d0c5323cbabc9a09473013411beec5da7aedcbe) Signed-off-by: Isis Lovecruft --- 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 b8826d7..b25a557 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 ab5af2e47c57e846c614e8dc70599c2064431849 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Fri, 8 Jan 2021 00:33:37 +0000 Subject: [PATCH 13/40] Whitespace fixes for 3267a5d merge. (cherry picked from commit 77ec9742120c7d2fec7003b992ab346fc6660c49) Signed-off-by: Isis Lovecruft --- 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 e852e97d2d3f0bffde3f595592a6388414fe7d70 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Fri, 8 Jan 2021 03:25:44 +0000 Subject: [PATCH 14/40] Bump curve25519-dalek version to 2.1.2. --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c5be1f3..3b9f538 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 = "2.1.1" +version = "2.1.2" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index f8384b1..a682ef0 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/2.1.1")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/2.1.2")] //! Note that docs will only build on nightly Rust until //! [RFC 1990 stabilizes](https://github.com/rust-lang/rust/issues/44732). From 032a14cfa50e62fa4568bfcc4e127387232f9773 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 14 Apr 2021 03:05:51 +0000 Subject: [PATCH 15/40] Update README to thank more contributors. --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 19679f9..2600cce 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,13 @@ optimised batch inversion was contributed by Sean Bowe and Daira Hopwood. The `no_std` and `zeroize` support was contributed by Tony Arcieri. -Thanks also to Ashley Hauck, Lucas Salibian, and Manish Goregaokar for their +The formally verified backends, `fiat_u32_backend` and `fiat_u64_backend`, which +integrate with the Rust generated by the +[Fiat Crypto project](https://github.com/mit-plv/fiat-crypto) were contributed +by François Garillot. + +Thanks also to Ashley Hauck, Lucas Salibian, Manish Goregaokar, Jack Grigg, +Pratyush Mishra, Michael Rosenberg, and countless others for their contributions. [ed25519-dalek]: https://github.com/dalek-cryptography/ed25519-dalek From 0d8f33153c144632e97b5a49cefe1e66a292463a Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Apr 2021 23:58:29 +0000 Subject: [PATCH 16/40] Implement Identity for MontgomeryPoint. This can be used in checks for non-contributory behaviour in protocols where that is a concern. --- src/montgomery.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/montgomery.rs b/src/montgomery.rs index de0f8b7..867496c 100644 --- a/src/montgomery.rs +++ b/src/montgomery.rs @@ -94,6 +94,13 @@ impl PartialEq for MontgomeryPoint { impl Eq for MontgomeryPoint {} +impl Identity for MontgomeryPoint { + /// Return the group identity element, which has order 4. + fn identity() -> MontgomeryPoint { + MontgomeryPoint([0u8; 32]) + } +} + impl Zeroize for MontgomeryPoint { fn zeroize(&mut self) { self.0.zeroize(); @@ -351,6 +358,14 @@ mod test { use rand_core::OsRng; + #[test] + fn identity_in_different_coordinates() { + let id_projective = ProjectivePoint::identity(); + let id_montgomery = id_projective.to_affine(); + + assert!(id_montgomery == MontgomeryPoint::identity()); + } + #[test] #[cfg(feature = "serde")] fn serde_bincode_basepoint_roundtrip() { From d7c2a1394f6b1ba2aaa8152b563cb221f7d4c710 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 21 Apr 2021 00:06:44 +0000 Subject: [PATCH 17/40] Add another test for equivalence with the Edwards identity. --- src/montgomery.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/montgomery.rs b/src/montgomery.rs index 867496c..ef4d0f5 100644 --- a/src/montgomery.rs +++ b/src/montgomery.rs @@ -366,6 +366,11 @@ mod test { assert!(id_montgomery == MontgomeryPoint::identity()); } + #[test] + fn identity_in_different_models() { + assert!(EdwardsPoint::identity().to_montgomery() == MontgomeryPoint::identity()); + } + #[test] #[cfg(feature = "serde")] fn serde_bincode_basepoint_roundtrip() { From 1ee5c4defb3a9501a93c91d2f0b3e42bfc814039 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 13 Jul 2021 05:28:35 +0000 Subject: [PATCH 18/40] Update CHANGELOG and bump version to 3.2. --- CHANGELOG.md | 6 ++++++ Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d42492..9492167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ major series. ## 3.x series +### 3.2.0 + +* Add support for getting the identity element for the Montgomery + form of curve25519, which is useful in certain protocols for + checking contributory behaviour in derivation of shared secrets. + ### 3.1.0 * Add support for the Elligator2 encoding for Edwards points. diff --git a/Cargo.toml b/Cargo.toml index fb6f627..e777056 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.1.0" +version = "3.2.0" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 13f9393..0b00360 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,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.1.0")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.2.0")] //! Note that docs will only build on nightly Rust until //! [RFC 1990 stabilizes](https://github.com/rust-lang/rust/issues/44732). From 43e454ce1db9c3ab8621f8347f1019d43afd3b1a Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 13 Jul 2021 05:40:28 +0000 Subject: [PATCH 19/40] Fix documentation build errors due to doc(inlude) on nightly. --- src/lib.rs | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 228 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a682ef0..19a0b6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,21 +10,240 @@ #![no_std] #![cfg_attr(feature = "nightly", feature(test))] -#![cfg_attr(feature = "nightly", feature(external_doc))] #![cfg_attr(feature = "nightly", feature(doc_cfg))] #![cfg_attr(feature = "simd_backend", feature(stdsimd))] -// Refuse to compile if documentation is missing, but only on nightly. -// -// This means that missing docs will still fail CI, but means we can use -// README.md as the crate documentation. -#![cfg_attr(feature = "nightly", deny(missing_docs))] -#![cfg_attr(feature = "nightly", doc(include = "../README.md"))] +// Refuse to compile if documentation is missing. +#![deny(missing_docs)] + #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] #![doc(html_root_url = "https://docs.rs/curve25519-dalek/2.1.2")] -//! Note that docs will only build on nightly Rust until -//! [RFC 1990 stabilizes](https://github.com/rust-lang/rust/issues/44732). +//! # curve25519-dalek [![](https://img.shields.io/crates/v/curve25519-dalek.svg)](https://crates.io/crates/curve25519-dalek) [![](https://img.shields.io/badge/dynamic/json.svg?label=docs&uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fcurve25519-dalek%2Fversions&query=%24.versions%5B0%5D.num&colorB=4F74A6)](https://doc.dalek.rs) [![](https://travis-ci.org/dalek-cryptography/curve25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/curve25519-dalek) +//! +//! +//! +//! **A pure-Rust implementation of group operations on Ristretto and Curve25519.** +//! +//! `curve25519-dalek` is a library providing group operations on the Edwards and +//! Montgomery forms of Curve25519, and on the prime-order Ristretto group. +//! +//! `curve25519-dalek` is not intended to provide implementations of any particular +//! crypto protocol. Rather, implementations of those protocols (such as +//! [`x25519-dalek`][x25519-dalek] and [`ed25519-dalek`][ed25519-dalek]) should use +//! `curve25519-dalek` as a library. +//! +//! `curve25519-dalek` is intended to provide a clean and safe _mid-level_ API for use +//! implementing a wide range of ECC-based crypto protocols, such as key agreement, +//! signatures, anonymous credentials, rangeproofs, and zero-knowledge proof +//! systems. +//! +//! In particular, `curve25519-dalek` implements Ristretto, which constructs a +//! prime-order group from a non-prime-order Edwards curve. This provides the +//! speed and safety benefits of Edwards curve arithmetic, without the pitfalls of +//! cofactor-related abstraction mismatches. +//! +//! # Documentation +//! +//! The semver-stable, public-facing `curve25519-dalek` API is documented +//! [here][docs-external]. In addition, the unstable internal implementation +//! details are documented [here][docs-internal]. +//! +//! The `curve25519-dalek` documentation requires a custom HTML header to include +//! KaTeX for math support. Unfortunately `cargo doc` does not currently support +//! this, but docs can be built using +//! ```sh +//! make doc +//! make doc-internal +//! ``` +//! +//! # Use +//! +//! To import `curve25519-dalek`, add the following to the dependencies section of +//! your project's `Cargo.toml`: +//! ```toml +//! curve25519-dalek = "3" +//! ``` +//! +//! The sole breaking change in the `3.x` series was an update to the `digest` +//! version, and in terms of non-breaking changes it includes: +//! +//! * support for using `alloc` instead of `std` on stable Rust, +//! * the Elligator2 encoding for Edwards points, +//! * a fix to use `packed_simd2`, +//! * various documentation fixes and improvements, +//! * support for configurably-sized, precomputed lookup tables for basepoint scalar +//! multiplication, +//! * two new formally-verified field arithmetic backends which use the Fiat Crypto +//! Rust code, which is generated from proofs of functional correctness checked by +//! the Coq theorem proving system, and +//! * support for explicitly calling the `zeroize` traits for all point types. +//! +//! The `2.x` series has API almost entirely unchanged from the `1.x` series, +//! except that: +//! +//! * an error in the data modeling for the (optional) `serde` feature was +//! corrected, so that when the `2.x`-series `serde` implementation is used +//! with `serde-bincode`, the derived serialization matches the usual X/Ed25519 +//! formats; +//! * the `rand` version was updated. +//! +//! See `CHANGELOG.md` for more details. +//! +//! # Backends and Features +//! +//! The `nightly` feature enables features available only when using a Rust nightly +//! compiler. In particular, it is required for rendering documentation and for +//! the SIMD backends. +//! +//! Curve arithmetic is implemented using one of the following backends: +//! +//! * a `u32` backend using serial formulas and `u64` products; +//! * a `u64` backend using serial formulas and `u128` products; +//! * an `avx2` backend using [parallel formulas][parallel_doc] and `avx2` instructions (sets speed records); +//! * an `ifma` backend using [parallel formulas][parallel_doc] and `ifma` instructions (sets speed records); +//! +//! By default the `u64` backend is selected. To select a specific backend, use: +//! ```sh +//! cargo build --no-default-features --features "std u32_backend" +//! cargo build --no-default-features --features "std u64_backend" +//! # Requires nightly, RUSTFLAGS="-C target_feature=+avx2" to use avx2 +//! cargo build --no-default-features --features "std simd_backend" +//! # Requires nightly, RUSTFLAGS="-C target_feature=+avx512ifma" to use ifma +//! cargo build --no-default-features --features "std simd_backend" +//! ``` +//! Crates using `curve25519-dalek` can either select a backend on behalf of their +//! users, or expose feature flags that control the `curve25519-dalek` backend. +//! +//! The `std` feature is enabled by default, but it can be disabled for no-`std` +//! builds using `--no-default-features`. Note that this requires explicitly +//! selecting an arithmetic backend using one of the `_backend` features. +//! If no backend is selected, compilation will fail. +//! +//! # Safety +//! +//! The `curve25519-dalek` types are designed to make illegal states +//! unrepresentable. For example, any instance of an `EdwardsPoint` is +//! guaranteed to hold a point on the Edwards curve, and any instance of a +//! `RistrettoPoint` is guaranteed to hold a valid point in the Ristretto +//! group. +//! +//! All operations are implemented using constant-time logic (no +//! secret-dependent branches, no secret-dependent memory accesses), +//! unless specifically marked as being variable-time code. +//! We believe that our constant-time logic is lowered to constant-time +//! assembly, at least on `x86_64` targets. +//! +//! As an additional guard against possible future compiler optimizations, +//! the `subtle` crate places an optimization barrier before every +//! conditional move or assignment. More details can be found in [the +//! documentation for the `subtle` crate][subtle_doc]. +//! +//! Some functionality (e.g., multiscalar multiplication or batch +//! inversion) requires heap allocation for temporary buffers. All +//! heap-allocated buffers of potentially secret data are explicitly +//! zeroed before release. +//! +//! However, we do not attempt to zero stack data, for two reasons. +//! First, it's not possible to do so correctly: we don't have control +//! over stack allocations, so there's no way to know how much data to +//! wipe. Second, because `curve25519-dalek` provides a mid-level API, +//! the correct place to start zeroing stack data is likely not at the +//! entrypoints of `curve25519-dalek` functions, but at the entrypoints of +//! functions in other crates. +//! +//! The implementation is memory-safe, and contains no significant +//! `unsafe` code. The SIMD backend uses `unsafe` internally to call SIMD +//! intrinsics. These are marked `unsafe` only because invoking them on an +//! inappropriate CPU would cause `SIGILL`, but the entire backend is only +//! compiled with appropriate `target_feature`s, so this cannot occur. +//! +//! # Performance +//! +//! Benchmarks are run using [`criterion.rs`][criterion]: +//! +//! ```sh +//! cargo bench --no-default-features --features "std u32_backend" +//! cargo bench --no-default-features --features "std u64_backend" +//! # Uses avx2 or ifma only if compiled for an appropriate target. +//! export RUSTFLAGS="-C target_cpu=native" +//! cargo bench --no-default-features --features "std simd_backend" +//! ``` +//! +//! Performance is a secondary goal behind correctness, safety, and +//! clarity, but we aim to be competitive with other implementations. +//! +//! # FFI +//! +//! Unfortunately, we have no plans to add FFI to `curve25519-dalek` directly. The +//! reason is that we use Rust features to provide an API that maintains safety +//! invariants, which are not possible to maintain across an FFI boundary. For +//! instance, as described in the _Safety_ section above, invalid points are +//! impossible to construct, and this would not be the case if we exposed point +//! operations over FFI. +//! +//! However, `curve25519-dalek` is designed as a *mid-level* API, aimed at +//! implementing other, higher-level primitives. Instead of providing FFI at the +//! mid-level, our suggestion is to implement the higher-level primitive (a +//! signature, PAKE, ZKP, etc) in Rust, using `curve25519-dalek` as a dependency, +//! and have that crate provide a minimal, byte-buffer-oriented FFI specific to +//! that primitive. +//! +//! # Contributing +//! +//! Please see [CONTRIBUTING.md][contributing]. +//! +//! Patches and pull requests should be make against the `develop` +//! branch, **not** `master`. +//! +//! # About +//! +//! **SPOILER ALERT:** *The Twelfth Doctor's first encounter with the Daleks is in +//! his second full episode, "Into the Dalek". A beleaguered ship of the "Combined +//! Galactic Resistance" has discovered a broken Dalek that has turned "good", +//! desiring to kill all other Daleks. The Doctor, Clara and a team of soldiers +//! are miniaturized and enter the Dalek, which the Doctor names Rusty. They +//! repair the damage, but accidentally restore it to its original nature, causing +//! it to go on the rampage and alert the Dalek fleet to the whereabouts of the +//! rebel ship. However, the Doctor manages to return Rusty to its previous state +//! by linking his mind with the Dalek's: Rusty shares the Doctor's view of the +//! universe's beauty, but also his deep hatred of the Daleks. Rusty destroys the +//! other Daleks and departs the ship, determined to track down and bring an end +//! to the Dalek race.* +//! +//! `curve25519-dalek` is authored by Isis Agora Lovecruft and Henry de Valence. +//! +//! Portions of this library were originally a port of [Adam Langley's +//! Golang ed25519 library](https://!github.com/agl/ed25519), which was in +//! turn a port of the reference `ref10` implementation. Most of this code, +//! including the 32-bit field arithmetic, has since been rewritten. +//! +//! The fast `u32` and `u64` scalar arithmetic was implemented by Andrew Moon, and +//! the addition chain for scalar inversion was provided by Brian Smith. The +//! optimised batch inversion was contributed by Sean Bowe and Daira Hopwood. +//! +//! The `no_std` and `zeroize` support was contributed by Tony Arcieri. +//! +//! The formally verified backends, `fiat_u32_backend` and `fiat_u64_backend`, which +//! integrate with the Rust generated by the +//! [Fiat Crypto project](https://github.com/mit-plv/fiat-crypto) were contributed +//! by François Garillot. +//! +//! Thanks also to Ashley Hauck, Lucas Salibian, Manish Goregaokar, Jack Grigg, +//! Pratyush Mishra, Michael Rosenberg, and countless others for their +//! contributions. +//! +//! [ed25519-dalek]: https://github.com/dalek-cryptography/ed25519-dalek +//! [x25519-dalek]: https://github.com/dalek-cryptography/x25519-dalek +//! [contributing]: https://github.com/dalek-cryptography/curve25519-dalek/blob/master/CONTRIBUTING.md +//! [docs-external]: https://doc.dalek.rs/curve25519_dalek/ +//! [docs-internal]: https://doc-internal.dalek.rs/curve25519_dalek/ +//! [criterion]: https://github.com/japaric/criterion.rs +//! [parallel_doc]: https://doc-internal.dalek.rs/curve25519_dalek/backend/vector/avx2/index.html +//! [subtle_doc]: https://doc.dalek.rs/subtle/ //------------------------------------------------------------------------ // External dependencies: From 1bacc6f95f9c0040598002b960d1b2051350e26e Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 13 Jul 2021 05:47:26 +0000 Subject: [PATCH 20/40] Update CHANGELOG for 2.1.2. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa081f..fad16d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 2.x series +### 2.1.2 + +* Multiple documenation typo fixes. +* Fix `alloc` feature working with stable rust. + ### 2.1.1 * Update the optional `packed-simd` dependency to rely on a newer, From 233130c55baddb9eb679397bab54d3efe12229e3 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 13 Jul 2021 05:49:53 +0000 Subject: [PATCH 21/40] Update README with changes for 2.1.3. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fad16d6..96cf5d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 2.x series +### 2.1.3 + +* Fix documentation builds on nightly due to syntax changes to + `#![fg_attr(feature = "nightly", doc = include_str!("../README.md"))]`. + ### 2.1.2 * Multiple documenation typo fixes. From ff25109f25e2c1a62d5c86dd21f303f2365158c2 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 13 Jul 2021 05:57:44 +0000 Subject: [PATCH 22/40] Bump curve25519-dalek version to 2.1.3. --- Cargo.toml | 3 ++- src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3b9f538..eab4639 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ name = "curve25519-dalek" # - update CHANGELOG # - update html_root_url # - update README if required by semver -version = "2.1.2" +# - if README was updated, also update module documenation in src/lib.rs +version = "2.1.3" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 19a0b6d..696f55d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ #![deny(missing_docs)] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] -#![doc(html_root_url = "https://docs.rs/curve25519-dalek/2.1.2")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/2.1.3")] //! # curve25519-dalek [![](https://img.shields.io/crates/v/curve25519-dalek.svg)](https://crates.io/crates/curve25519-dalek) [![](https://img.shields.io/badge/dynamic/json.svg?label=docs&uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fcurve25519-dalek%2Fversions&query=%24.versions%5B0%5D.num&colorB=4F74A6)](https://doc.dalek.rs) [![](https://travis-ci.org/dalek-cryptography/curve25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/curve25519-dalek) //! From 6ea874cb314fa939c030831d6683134c09b3ae83 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 13 Jul 2021 06:44:49 +0000 Subject: [PATCH 23/40] Bump curve25519-dalek version to 3.0.3. --- Cargo.toml | 3 ++- src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b58f3f8..68dc725 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ name = "curve25519-dalek" # - update CHANGELOG # - update html_root_url # - update README if required by semver -version = "3.0.1" +# - if README was updated, also update module documenation in src/lib.rs +version = "3.0.3" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index af795a1..8a28814 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ #![deny(missing_docs)] #![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.3")] //! # curve25519-dalek [![](https://img.shields.io/crates/v/curve25519-dalek.svg)](https://crates.io/crates/curve25519-dalek) [![](https://img.shields.io/badge/dynamic/json.svg?label=docs&uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fcurve25519-dalek%2Fversions&query=%24.versions%5B0%5D.num&colorB=4F74A6)](https://doc.dalek.rs) [![](https://travis-ci.org/dalek-cryptography/curve25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/curve25519-dalek) //! From b0abd7a84b68cbdd66f013768720a7e2a19de9d5 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Jul 2021 01:49:10 +0000 Subject: [PATCH 24/40] Add missing CHANGELOG entry for 3.0.2. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62a24e6..d750259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 3.x series +### 3.0.2 + +* Multiple documenation typo fixes. +* 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, From dc19aa2aaf5bd097e861c7b5350f74d6ead65c96 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Jul 2021 01:50:30 +0000 Subject: [PATCH 25/40] Add CHANGELOG entry for 3.0.3. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d750259..da98649 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 3.x series +### 3.0.3 + +* Fix documentation builds on nightly due to syntax changes to + `#![fg_attr(feature = "nightly", doc = include_str!("../README.md"))]`. + ### 3.0.2 * Multiple documenation typo fixes. From 1391211f0626b6e9ccadca361cd0ee047801cebc Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Jul 2021 02:56:07 +0000 Subject: [PATCH 26/40] Update CHANGELOG for 3.1.1. --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6433bc6..5dcd252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 3.x series +### 3.1.1 + +* Fix documentation builds on nightly due to syntax changes to + `#![cfg_attr(feature = "nightly", doc = include_str!("../README.md"))]`. + ### 3.1.0 * Add support for the Elligator2 encoding for Edwards points. @@ -23,7 +28,7 @@ major series. ### 3.0.3 * Fix documentation builds on nightly due to syntax changes to - `#![fg_attr(feature = "nightly", doc = include_str!("../README.md"))]`. + `#![cfg_attr(feature = "nightly", doc = include_str!("../README.md"))]`. ### 3.0.2 From 49146274dba2cdd628232a8a0933d60e078c0fcd Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Jul 2021 02:56:28 +0000 Subject: [PATCH 27/40] Fix a typo in Cargo.toml documentation. --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a299de..92adefb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ name = "curve25519-dalek" # - update CHANGELOG # - update html_root_url # - update README if required by semver -# - if README was updated, also update module documenation in src/lib.rs -version = "3.1.0" +# - if README was updated, also update module documentation in src/lib.rs +version = "3.1.1" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" From fccc5d54f833057ed2a60a2bc35ab0c333eff79e Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Jul 2021 02:56:44 +0000 Subject: [PATCH 28/40] Bump version for html_root_url. --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7961baf..4baa4c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,7 @@ #![deny(missing_docs)] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] -#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.1.0")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.1.1")] //! # curve25519-dalek [![](https://img.shields.io/crates/v/curve25519-dalek.svg)](https://crates.io/crates/curve25519-dalek) [![](https://img.shields.io/badge/dynamic/json.svg?label=docs&uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fcurve25519-dalek%2Fversions&query=%24.versions%5B0%5D.num&colorB=4F74A6)](https://doc.dalek.rs) [![](https://travis-ci.org/dalek-cryptography/curve25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/curve25519-dalek) //! From f8cb7197f9a1a94294a5fc1f66c0e92de445fbd6 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 20 Jul 2021 03:02:09 +0000 Subject: [PATCH 29/40] Fix error introduced in 59a8616 merge. --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 4baa4c2..00d6126 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,6 @@ #![no_std] #![cfg_attr(feature = "nightly", feature(test))] -#![cfg_attr(feature = "nightly", feature(external_doc))] #![cfg_attr(feature = "nightly", feature(doc_cfg))] #![cfg_attr(feature = "simd_backend", feature(stdsimd))] From b9710d59f268db0631fc117cc42c0c54c2fc0a6b Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 3 Aug 2021 22:49:09 +0000 Subject: [PATCH 30/40] Minor documentation fixes. --- Makefile | 2 +- src/backend/serial/scalar_mul/pippenger.rs | 2 +- src/montgomery.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e447175..7d87057 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -FEATURES := nightly yolocrypto avx2_backend +FEATURES := nightly simd_backend doc: cargo rustdoc --features "$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html diff --git a/src/backend/serial/scalar_mul/pippenger.rs b/src/backend/serial/scalar_mul/pippenger.rs index bffe140..575291d 100644 --- a/src/backend/serial/scalar_mul/pippenger.rs +++ b/src/backend/serial/scalar_mul/pippenger.rs @@ -58,7 +58,7 @@ use prelude::*; /// However, if `w` is too big and `n` is not too big, then `(2^w/2)*A` could dominate. /// Therefore, the optimal choice of `w` grows slowly as `n` grows. /// -/// This algorithm is adapted from section 4 of https://eprint.iacr.org/2012/549.pdf. +/// This algorithm is adapted from section 4 of . pub struct Pippenger; #[cfg(any(feature = "alloc", feature = "std"))] diff --git a/src/montgomery.rs b/src/montgomery.rs index de0f8b7..d7a20d3 100644 --- a/src/montgomery.rs +++ b/src/montgomery.rs @@ -159,7 +159,7 @@ impl MontgomeryPoint { /// Perform the Elligator2 mapping to a Montgomery point. /// -/// See https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-10#section-6.7.1 +/// See // // TODO Determine how much of the hash-to-group API should be exposed after the CFRG // draft gets into a more polished/accepted state. From 52986bc3ec5805c2f4e860b7e627a003069c267b Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 3 Aug 2021 23:10:35 +0000 Subject: [PATCH 31/40] Revert "Update copyright years." This reverts commit 1491f0db364f8d8fc1072caff88967248c555ef5. This is due to code which was erroneously deleted during the commit, due to being based off the wrong version, see https://github.com/dalek-cryptography/curve25519-dalek/pull/361. --- LICENSE | 3 +- src/backend/mod.rs | 5 +- src/backend/serial/curve_models/mod.rs | 5 +- src/backend/serial/mod.rs | 5 +- src/backend/serial/scalar_mul/mod.rs | 5 +- src/backend/serial/scalar_mul/straus.rs | 5 +- .../serial/scalar_mul/vartime_double_base.rs | 5 +- src/backend/serial/u32/constants.rs | 5 +- src/backend/serial/u32/field.rs | 7 +- src/backend/serial/u32/mod.rs | 5 +- src/backend/serial/u64/constants.rs | 5 +- src/backend/serial/u64/field.rs | 7 +- src/backend/serial/u64/mod.rs | 5 +- src/backend/vector/avx2/constants.rs | 5 +- src/backend/vector/avx2/edwards.rs | 5 +- src/backend/vector/avx2/field.rs | 7 +- src/backend/vector/avx2/mod.rs | 5 +- src/backend/vector/ifma/field.rs | 6 +- src/backend/vector/mod.rs | 5 +- src/backend/vector/scalar_mul/mod.rs | 5 +- src/backend/vector/scalar_mul/straus.rs | 5 +- .../vector/scalar_mul/vartime_double_base.rs | 6 +- src/constants.rs | 5 +- src/edwards.rs | 111 ++++++++++++++++++ src/field.rs | 3 +- src/lib.rs | 5 +- src/macros.rs | 5 +- src/prelude.rs | 11 -- src/ristretto.rs | 18 +++ src/scalar.rs | 3 +- src/traits.rs | 5 +- src/window.rs | 5 +- 32 files changed, 187 insertions(+), 100 deletions(-) diff --git a/LICENSE b/LICENSE index ff34757..2501697 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,4 @@ -Copyright (c) 2016-2021 isis agora lovecruft. All rights reserved. -Copyright (c) 2016-2021 Henry de Valence. All rights reserved. +Copyright (c) 2016-2019 Isis Agora Lovecruft, Henry de Valence. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 18f8af7..2eef774 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Pluggable implementations for different architectures. diff --git a/src/backend/serial/curve_models/mod.rs b/src/backend/serial/curve_models/mod.rs index 9d10d92..5d5850f 100644 --- a/src/backend/serial/curve_models/mod.rs +++ b/src/backend/serial/curve_models/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Internal curve representations which are not part of the public API. diff --git a/src/backend/serial/mod.rs b/src/backend/serial/mod.rs index 971afe9..a01d4a3 100644 --- a/src/backend/serial/mod.rs +++ b/src/backend/serial/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Serial implementations of field, scalar, point arithmetic. diff --git a/src/backend/serial/scalar_mul/mod.rs b/src/backend/serial/scalar_mul/mod.rs index 8bdad1f..544725a 100644 --- a/src/backend/serial/scalar_mul/mod.rs +++ b/src/backend/serial/scalar_mul/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Implementations of various scalar multiplication algorithms. diff --git a/src/backend/serial/scalar_mul/straus.rs b/src/backend/serial/scalar_mul/straus.rs index a361df5..b63e162 100644 --- a/src/backend/serial/scalar_mul/straus.rs +++ b/src/backend/serial/scalar_mul/straus.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Implementation of the interleaved window method, also known as Straus' method. diff --git a/src/backend/serial/scalar_mul/vartime_double_base.rs b/src/backend/serial/scalar_mul/vartime_double_base.rs index 03517f9..ef8c0ca 100644 --- a/src/backend/serial/scalar_mul/vartime_double_base.rs +++ b/src/backend/serial/scalar_mul/vartime_double_base.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence #![allow(non_snake_case)] diff --git a/src/backend/serial/u32/constants.rs b/src/backend/serial/u32/constants.rs index af509cf..29abf88 100644 --- a/src/backend/serial/u32/constants.rs +++ b/src/backend/serial/u32/constants.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! This module contains various constants (such as curve parameters diff --git a/src/backend/serial/u32/field.rs b/src/backend/serial/u32/field.rs index c8f3e5e..603ed3f 100644 --- a/src/backend/serial/u32/field.rs +++ b/src/backend/serial/u32/field.rs @@ -1,12 +1,11 @@ -// -*- mode: rust; -*- +// -*- mode: rust; coding: utf-8; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Field arithmetic modulo \\(p = 2\^{255} - 19\\), using \\(32\\)-bit diff --git a/src/backend/serial/u32/mod.rs b/src/backend/serial/u32/mod.rs index 401ce74..e0f344f 100644 --- a/src/backend/serial/u32/mod.rs +++ b/src/backend/serial/u32/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! The `u32` backend uses `u32`s and a `(u32, u32) -> u64` multiplier. diff --git a/src/backend/serial/u64/constants.rs b/src/backend/serial/u64/constants.rs index 6cbc0b5..18d07eb 100644 --- a/src/backend/serial/u64/constants.rs +++ b/src/backend/serial/u64/constants.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! This module contains backend-specific constant values, such as the 64-bit limbs of curve constants. diff --git a/src/backend/serial/u64/field.rs b/src/backend/serial/u64/field.rs index a73d4b5..1cb7778 100644 --- a/src/backend/serial/u64/field.rs +++ b/src/backend/serial/u64/field.rs @@ -1,12 +1,11 @@ -// -*- mode: rust; -*- +// -*- mode: rust; coding: utf-8; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Field arithmetic modulo \\(p = 2\^{255} - 19\\), using \\(64\\)-bit diff --git a/src/backend/serial/u64/mod.rs b/src/backend/serial/u64/mod.rs index aa29eb6..d329a89 100644 --- a/src/backend/serial/u64/mod.rs +++ b/src/backend/serial/u64/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2018 Henry de Valence +// Copyright (c) 2016-2018 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! The `u64` backend uses `u64`s and a `(u64, u64) -> u128` multiplier. diff --git a/src/backend/vector/avx2/constants.rs b/src/backend/vector/avx2/constants.rs index 122068e..73e5ba3 100644 --- a/src/backend/vector/avx2/constants.rs +++ b/src/backend/vector/avx2/constants.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! This module contains constants used by the AVX2 backend. diff --git a/src/backend/vector/avx2/edwards.rs b/src/backend/vector/avx2/edwards.rs index 821d516..77af176 100644 --- a/src/backend/vector/avx2/edwards.rs +++ b/src/backend/vector/avx2/edwards.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Parallel Edwards Arithmetic for Curve25519. diff --git a/src/backend/vector/avx2/field.rs b/src/backend/vector/avx2/field.rs index 94a06ee..edd1fa6 100644 --- a/src/backend/vector/avx2/field.rs +++ b/src/backend/vector/avx2/field.rs @@ -1,12 +1,11 @@ -// -*- mode: rust; -*- +// -*- mode: rust; coding: utf-8; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! An implementation of 4-way vectorized 32bit field arithmetic using diff --git a/src/backend/vector/avx2/mod.rs b/src/backend/vector/avx2/mod.rs index 527fdc1..175b7eb 100644 --- a/src/backend/vector/avx2/mod.rs +++ b/src/backend/vector/avx2/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence #![cfg_attr( diff --git a/src/backend/vector/ifma/field.rs b/src/backend/vector/ifma/field.rs index a393b22..5b7c092 100644 --- a/src/backend/vector/ifma/field.rs +++ b/src/backend/vector/ifma/field.rs @@ -1,12 +1,10 @@ -// -*- mode: rust; -*- +// -*- mode: rust; coding: utf-8; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2018-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft // - Henry de Valence #![allow(non_snake_case)] diff --git a/src/backend/vector/mod.rs b/src/backend/vector/mod.rs index 29a6f65..9726c71 100644 --- a/src/backend/vector/mod.rs +++ b/src/backend/vector/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence // Conditionally include the notes if we're on nightly (so we can include docs at all). diff --git a/src/backend/vector/scalar_mul/mod.rs b/src/backend/vector/scalar_mul/mod.rs index 36a7047..2fc1b18 100644 --- a/src/backend/vector/scalar_mul/mod.rs +++ b/src/backend/vector/scalar_mul/mod.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence pub mod variable_base; diff --git a/src/backend/vector/scalar_mul/straus.rs b/src/backend/vector/scalar_mul/straus.rs index b6c02f9..7206cf3 100644 --- a/src/backend/vector/scalar_mul/straus.rs +++ b/src/backend/vector/scalar_mul/straus.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence #![allow(non_snake_case)] diff --git a/src/backend/vector/scalar_mul/vartime_double_base.rs b/src/backend/vector/scalar_mul/vartime_double_base.rs index 3f7cc3e..d78e46d 100644 --- a/src/backend/vector/scalar_mul/vartime_double_base.rs +++ b/src/backend/vector/scalar_mul/vartime_double_base.rs @@ -1,14 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence - #![allow(non_snake_case)] use backend::vector::BASEPOINT_ODD_LOOKUP_TABLE; diff --git a/src/constants.rs b/src/constants.rs index 19c46e5..8831dda 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Various constants, such as the Ristretto and Ed25519 basepoints. diff --git a/src/edwards.rs b/src/edwards.rs index 7c97ca4..f33df95 100644 --- a/src/edwards.rs +++ b/src/edwards.rs @@ -101,11 +101,14 @@ use core::ops::{Add, Neg, Sub}; use core::ops::{AddAssign, SubAssign}; use core::ops::{Mul, MulAssign}; +use digest::{generic_array::typenum::U64, Digest}; use subtle::Choice; use subtle::ConditionallyNegatable; use subtle::ConditionallySelectable; use subtle::ConstantTimeEq; +use zeroize::Zeroize; + use constants; use field::FieldElement; @@ -374,6 +377,28 @@ impl Default for EdwardsPoint { } } +// ------------------------------------------------------------------------ +// Zeroize implementations for wiping points from memory +// ------------------------------------------------------------------------ + +impl Zeroize for CompressedEdwardsY { + /// Reset this `CompressedEdwardsY` to the compressed form of the identity element. + fn zeroize(&mut self) { + self.0.zeroize(); + self.0[0] = 1; + } +} + +impl Zeroize for EdwardsPoint { + /// Reset this `CompressedEdwardsPoint` to the identity element. + fn zeroize(&mut self) { + self.X.zeroize(); + self.Y = FieldElement::one(); + self.Z = FieldElement::one(); + self.T.zeroize(); + } +} + // ------------------------------------------------------------------------ // Validity checks (for debugging, not CT) // ------------------------------------------------------------------------ @@ -500,6 +525,31 @@ impl EdwardsPoint { s[31] ^= x.is_negative().unwrap_u8() << 7; CompressedEdwardsY(s) } + + /// Perform hashing to the group using the Elligator2 map + /// + /// See https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-10#section-6.7.1 + pub fn hash_from_bytes(bytes: &[u8]) -> EdwardsPoint + where + D: Digest + Default, + { + let mut hash = D::new(); + hash.update(bytes); + let h = hash.finalize(); + let mut res = [0u8; 32]; + res.copy_from_slice(&h[..32]); + + let sign_bit = (res[31] & 0x80) >> 7; + + let fe = FieldElement::from_bytes(&res); + + let M1 = crate::montgomery::elligator_encode(&fe); + let E1_opt = M1.to_edwards(sign_bit); + + E1_opt + .expect("Montgomery conversion to Edwards point in Elligator failed") + .mul_by_cofactor() + } } // ------------------------------------------------------------------------ @@ -1696,4 +1746,65 @@ mod test { let bp: EdwardsPoint = bincode::deserialize(raw_bytes).unwrap(); assert_eq!(bp, constants::ED25519_BASEPOINT_POINT); } + + //////////////////////////////////////////////////////////// + // Signal tests from // + // https://github.com/signalapp/libsignal-protocol-c/ // + //////////////////////////////////////////////////////////// + + fn test_vectors() -> Vec> { + vec![ + vec![ + "214f306e1576f5a7577636fe303ca2c625b533319f52442b22a9fa3b7ede809f", + "c95becf0f93595174633b9d4d6bbbeb88e16fa257176f877ce426e1424626052", + ], + vec![ + "2eb10d432702ea7f79207da95d206f82d5a3b374f5f89f17a199531f78d3bea6", + "d8f8b508edffbb8b6dab0f602f86a9dd759f800fe18f782fdcac47c234883e7f", + ], + vec![ + "84cbe9accdd32b46f4a8ef51c85fd39d028711f77fb00e204a613fc235fd68b9", + "93c73e0289afd1d1fc9e4e78a505d5d1b2642fbdf91a1eff7d281930654b1453", + ], + vec![ + "c85165952490dc1839cb69012a3d9f2cc4b02343613263ab93a26dc89fd58267", + "43cbe8685fd3c90665b91835debb89ff1477f906f5170f38a192f6a199556537", + ], + vec![ + "26e7fc4a78d863b1a4ccb2ce0951fbcd021e106350730ee4157bacb4502e1b76", + "b6fc3d738c2c40719479b2f23818180cdafa72a14254d4016bbed8f0b788a835", + ], + vec![ + "1618c08ef0233f94f0f163f9435ec7457cd7a8cd4bb6b160315d15818c30f7a2", + "da0b703593b29dbcd28ebd6e7baea17b6f61971f3641cae774f6a5137a12294c", + ], + vec![ + "48b73039db6fcdcb6030c4a38e8be80b6390d8ae46890e77e623f87254ef149c", + "ca11b25acbc80566603eabeb9364ebd50e0306424c61049e1ce9385d9f349966", + ], + vec![ + "a744d582b3a34d14d311b7629da06d003045ae77cebceeb4e0e72734d63bd07d", + "fad25a5ea15d4541258af8785acaf697a886c1b872c793790e60a6837b1adbc0", + ], + vec![ + "80a6ff33494c471c5eff7efb9febfbcf30a946fe6535b3451cda79f2154a7095", + "57ac03913309b3f8cd3c3d4c49d878bb21f4d97dc74a1eaccbe5c601f7f06f47", + ], + vec![ + "f06fc939bc10551a0fd415aebf107ef0b9c4ee1ef9a164157bdd089127782617", + "785b2a6a00a5579cc9da1ff997ce8339b6f9fb46c6f10cf7a12ff2986341a6e0", + ], + ] + } + + #[test] + fn elligator_signal_test_vectors() { + for vector in test_vectors().iter() { + let input = hex::decode(vector[0]).unwrap(); + let output = hex::decode(vector[1]).unwrap(); + + let point = EdwardsPoint::hash_from_bytes::(&input); + assert_eq!(point.compress().to_bytes(), output[..]); + } + } } diff --git a/src/field.rs b/src/field.rs index 109cff2..40dcf70 100644 --- a/src/field.rs +++ b/src/field.rs @@ -1,8 +1,7 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis agora lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: diff --git a/src/lib.rs b/src/lib.rs index 00d6126..dfc7194 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence #![no_std] diff --git a/src/macros.rs b/src/macros.rs index 84a2ce1..5985a5f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis agora lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Internal macros. diff --git a/src/prelude.rs b/src/prelude.rs index 5c0a611..be2f600 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,14 +1,3 @@ -// -*- mode: rust; -*- -// -// This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence -// See LICENSE for licensing information. -// -// Authors: -// - isis agora lovecruft -// - Henry de Valence - //! Crate-local prelude (for alloc-dependent features like `Vec`) // TODO: switch to alloc::prelude diff --git a/src/ristretto.rs b/src/ristretto.rs index d284b5b..b9e3734 100644 --- a/src/ristretto.rs +++ b/src/ristretto.rs @@ -178,6 +178,8 @@ use subtle::ConditionallySelectable; use subtle::ConditionallyNegatable; use subtle::ConstantTimeEq; +use zeroize::Zeroize; + use edwards::EdwardsBasepointTable; use edwards::EdwardsPoint; @@ -1079,6 +1081,22 @@ impl Debug for RistrettoPoint { } } +// ------------------------------------------------------------------------ +// Zeroize traits +// ------------------------------------------------------------------------ + +impl Zeroize for CompressedRistretto { + fn zeroize(&mut self) { + self.0.zeroize(); + } +} + +impl Zeroize for RistrettoPoint { + fn zeroize(&mut self) { + self.0.zeroize(); + } +} + // ------------------------------------------------------------------------ // Tests // ------------------------------------------------------------------------ diff --git a/src/scalar.rs b/src/scalar.rs index 00de740..8ae29c5 100644 --- a/src/scalar.rs +++ b/src/scalar.rs @@ -1,8 +1,7 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // Portions Copyright 2017 Brian Smith // See LICENSE for licensing information. // diff --git a/src/traits.rs b/src/traits.rs index d127b3e..7fa269c 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Module for common traits. diff --git a/src/window.rs b/src/window.rs index 2cf1fbe..adedac9 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1,12 +1,11 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2021 isis lovecruft -// Copyright (c) 2016-2019 Henry de Valence +// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence // See LICENSE for licensing information. // // Authors: -// - isis agora lovecruft +// - Isis Agora Lovecruft // - Henry de Valence //! Code for fixed- and sliding-window functionality From 74210d28fceae6491c18c7cb094d9fa64033c9ee Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 3 Aug 2021 23:13:45 +0000 Subject: [PATCH 32/40] Update copyright years. --- LICENSE | 3 ++- src/backend/mod.rs | 5 +++-- src/backend/serial/curve_models/mod.rs | 5 +++-- src/backend/serial/mod.rs | 5 +++-- src/backend/serial/scalar_mul/mod.rs | 5 +++-- src/backend/serial/scalar_mul/straus.rs | 5 +++-- src/backend/serial/scalar_mul/vartime_double_base.rs | 5 +++-- src/backend/serial/u32/constants.rs | 5 +++-- src/backend/serial/u32/field.rs | 7 ++++--- src/backend/serial/u32/mod.rs | 5 +++-- src/backend/serial/u64/constants.rs | 5 +++-- src/backend/serial/u64/field.rs | 7 ++++--- src/backend/serial/u64/mod.rs | 5 +++-- src/backend/vector/avx2/constants.rs | 5 +++-- src/backend/vector/avx2/edwards.rs | 5 +++-- src/backend/vector/avx2/field.rs | 7 ++++--- src/backend/vector/avx2/mod.rs | 5 +++-- src/backend/vector/ifma/field.rs | 6 ++++-- src/backend/vector/mod.rs | 5 +++-- src/backend/vector/scalar_mul/mod.rs | 5 +++-- src/backend/vector/scalar_mul/straus.rs | 5 +++-- src/backend/vector/scalar_mul/vartime_double_base.rs | 6 ++++-- src/constants.rs | 5 +++-- src/field.rs | 3 ++- src/lib.rs | 5 +++-- src/macros.rs | 5 +++-- src/prelude.rs | 11 +++++++++++ src/scalar.rs | 3 ++- src/traits.rs | 5 +++-- src/window.rs | 5 +++-- 30 files changed, 100 insertions(+), 58 deletions(-) diff --git a/LICENSE b/LICENSE index 2501697..ff34757 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,5 @@ -Copyright (c) 2016-2019 Isis Agora Lovecruft, Henry de Valence. All rights reserved. +Copyright (c) 2016-2021 isis agora lovecruft. All rights reserved. +Copyright (c) 2016-2021 Henry de Valence. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 2eef774..18f8af7 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Pluggable implementations for different architectures. diff --git a/src/backend/serial/curve_models/mod.rs b/src/backend/serial/curve_models/mod.rs index 5d5850f..9d10d92 100644 --- a/src/backend/serial/curve_models/mod.rs +++ b/src/backend/serial/curve_models/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Internal curve representations which are not part of the public API. diff --git a/src/backend/serial/mod.rs b/src/backend/serial/mod.rs index a01d4a3..971afe9 100644 --- a/src/backend/serial/mod.rs +++ b/src/backend/serial/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Serial implementations of field, scalar, point arithmetic. diff --git a/src/backend/serial/scalar_mul/mod.rs b/src/backend/serial/scalar_mul/mod.rs index 544725a..8bdad1f 100644 --- a/src/backend/serial/scalar_mul/mod.rs +++ b/src/backend/serial/scalar_mul/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Implementations of various scalar multiplication algorithms. diff --git a/src/backend/serial/scalar_mul/straus.rs b/src/backend/serial/scalar_mul/straus.rs index b63e162..a361df5 100644 --- a/src/backend/serial/scalar_mul/straus.rs +++ b/src/backend/serial/scalar_mul/straus.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Implementation of the interleaved window method, also known as Straus' method. diff --git a/src/backend/serial/scalar_mul/vartime_double_base.rs b/src/backend/serial/scalar_mul/vartime_double_base.rs index ef8c0ca..03517f9 100644 --- a/src/backend/serial/scalar_mul/vartime_double_base.rs +++ b/src/backend/serial/scalar_mul/vartime_double_base.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence #![allow(non_snake_case)] diff --git a/src/backend/serial/u32/constants.rs b/src/backend/serial/u32/constants.rs index 29abf88..af509cf 100644 --- a/src/backend/serial/u32/constants.rs +++ b/src/backend/serial/u32/constants.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! This module contains various constants (such as curve parameters diff --git a/src/backend/serial/u32/field.rs b/src/backend/serial/u32/field.rs index 603ed3f..c8f3e5e 100644 --- a/src/backend/serial/u32/field.rs +++ b/src/backend/serial/u32/field.rs @@ -1,11 +1,12 @@ -// -*- mode: rust; coding: utf-8; -*- +// -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Field arithmetic modulo \\(p = 2\^{255} - 19\\), using \\(32\\)-bit diff --git a/src/backend/serial/u32/mod.rs b/src/backend/serial/u32/mod.rs index e0f344f..401ce74 100644 --- a/src/backend/serial/u32/mod.rs +++ b/src/backend/serial/u32/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! The `u32` backend uses `u32`s and a `(u32, u32) -> u64` multiplier. diff --git a/src/backend/serial/u64/constants.rs b/src/backend/serial/u64/constants.rs index 18d07eb..6cbc0b5 100644 --- a/src/backend/serial/u64/constants.rs +++ b/src/backend/serial/u64/constants.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! This module contains backend-specific constant values, such as the 64-bit limbs of curve constants. diff --git a/src/backend/serial/u64/field.rs b/src/backend/serial/u64/field.rs index 1cb7778..a73d4b5 100644 --- a/src/backend/serial/u64/field.rs +++ b/src/backend/serial/u64/field.rs @@ -1,11 +1,12 @@ -// -*- mode: rust; coding: utf-8; -*- +// -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Field arithmetic modulo \\(p = 2\^{255} - 19\\), using \\(64\\)-bit diff --git a/src/backend/serial/u64/mod.rs b/src/backend/serial/u64/mod.rs index d329a89..aa29eb6 100644 --- a/src/backend/serial/u64/mod.rs +++ b/src/backend/serial/u64/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2018 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2018 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! The `u64` backend uses `u64`s and a `(u64, u64) -> u128` multiplier. diff --git a/src/backend/vector/avx2/constants.rs b/src/backend/vector/avx2/constants.rs index 73e5ba3..122068e 100644 --- a/src/backend/vector/avx2/constants.rs +++ b/src/backend/vector/avx2/constants.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! This module contains constants used by the AVX2 backend. diff --git a/src/backend/vector/avx2/edwards.rs b/src/backend/vector/avx2/edwards.rs index 77af176..821d516 100644 --- a/src/backend/vector/avx2/edwards.rs +++ b/src/backend/vector/avx2/edwards.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Parallel Edwards Arithmetic for Curve25519. diff --git a/src/backend/vector/avx2/field.rs b/src/backend/vector/avx2/field.rs index edd1fa6..94a06ee 100644 --- a/src/backend/vector/avx2/field.rs +++ b/src/backend/vector/avx2/field.rs @@ -1,11 +1,12 @@ -// -*- mode: rust; coding: utf-8; -*- +// -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! An implementation of 4-way vectorized 32bit field arithmetic using diff --git a/src/backend/vector/avx2/mod.rs b/src/backend/vector/avx2/mod.rs index 175b7eb..527fdc1 100644 --- a/src/backend/vector/avx2/mod.rs +++ b/src/backend/vector/avx2/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence #![cfg_attr( diff --git a/src/backend/vector/ifma/field.rs b/src/backend/vector/ifma/field.rs index 5b7c092..a393b22 100644 --- a/src/backend/vector/ifma/field.rs +++ b/src/backend/vector/ifma/field.rs @@ -1,10 +1,12 @@ -// -*- mode: rust; coding: utf-8; -*- +// -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2018-2019 Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: +// - isis agora lovecruft // - Henry de Valence #![allow(non_snake_case)] diff --git a/src/backend/vector/mod.rs b/src/backend/vector/mod.rs index 9726c71..29a6f65 100644 --- a/src/backend/vector/mod.rs +++ b/src/backend/vector/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence // Conditionally include the notes if we're on nightly (so we can include docs at all). diff --git a/src/backend/vector/scalar_mul/mod.rs b/src/backend/vector/scalar_mul/mod.rs index 2fc1b18..36a7047 100644 --- a/src/backend/vector/scalar_mul/mod.rs +++ b/src/backend/vector/scalar_mul/mod.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence pub mod variable_base; diff --git a/src/backend/vector/scalar_mul/straus.rs b/src/backend/vector/scalar_mul/straus.rs index 7206cf3..b6c02f9 100644 --- a/src/backend/vector/scalar_mul/straus.rs +++ b/src/backend/vector/scalar_mul/straus.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence #![allow(non_snake_case)] diff --git a/src/backend/vector/scalar_mul/vartime_double_base.rs b/src/backend/vector/scalar_mul/vartime_double_base.rs index d78e46d..3f7cc3e 100644 --- a/src/backend/vector/scalar_mul/vartime_double_base.rs +++ b/src/backend/vector/scalar_mul/vartime_double_base.rs @@ -1,12 +1,14 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence + #![allow(non_snake_case)] use backend::vector::BASEPOINT_ODD_LOOKUP_TABLE; diff --git a/src/constants.rs b/src/constants.rs index 8831dda..19c46e5 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Various constants, such as the Ristretto and Ed25519 basepoints. diff --git a/src/field.rs b/src/field.rs index 40dcf70..109cff2 100644 --- a/src/field.rs +++ b/src/field.rs @@ -1,7 +1,8 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis agora lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: diff --git a/src/lib.rs b/src/lib.rs index dfc7194..00d6126 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence #![no_std] diff --git a/src/macros.rs b/src/macros.rs index 5985a5f..84a2ce1 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis agora lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Internal macros. diff --git a/src/prelude.rs b/src/prelude.rs index be2f600..5c0a611 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,3 +1,14 @@ +// -*- mode: rust; -*- +// +// This file is part of curve25519-dalek. +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence +// See LICENSE for licensing information. +// +// Authors: +// - isis agora lovecruft +// - Henry de Valence + //! Crate-local prelude (for alloc-dependent features like `Vec`) // TODO: switch to alloc::prelude diff --git a/src/scalar.rs b/src/scalar.rs index 8ae29c5..00de740 100644 --- a/src/scalar.rs +++ b/src/scalar.rs @@ -1,7 +1,8 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // Portions Copyright 2017 Brian Smith // See LICENSE for licensing information. // diff --git a/src/traits.rs b/src/traits.rs index 7fa269c..d127b3e 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Module for common traits. diff --git a/src/window.rs b/src/window.rs index adedac9..2cf1fbe 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1,11 +1,12 @@ // -*- mode: rust; -*- // // This file is part of curve25519-dalek. -// Copyright (c) 2016-2019 Isis Lovecruft, Henry de Valence +// Copyright (c) 2016-2021 isis lovecruft +// Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. // // Authors: -// - Isis Agora Lovecruft +// - isis agora lovecruft // - Henry de Valence //! Code for fixed- and sliding-window functionality From 90aab8423c0e31536357bf776e7f4a9787372ed6 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 3 Aug 2021 23:33:33 +0000 Subject: [PATCH 33/40] Update CHANGELOG and bump version to 3.1.2. --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dcd252..a41e567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ major series. ## 3.x series +### 3.1.2 + +* Revert a commit which mistakenly removed support for `zeroize` traits + for some point types, as well as elligator2 support for Edwards points. + ### 3.1.1 * Fix documentation builds on nightly due to syntax changes to diff --git a/Cargo.toml b/Cargo.toml index 92adefb..9251d78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ name = "curve25519-dalek" # - update html_root_url # - update README if required by semver # - if README was updated, also update module documentation in src/lib.rs -version = "3.1.1" +version = "3.1.2" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 00d6126..e3ba262 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ #![deny(missing_docs)] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] -#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.1.1")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.1.2")] //! # curve25519-dalek [![](https://img.shields.io/crates/v/curve25519-dalek.svg)](https://crates.io/crates/curve25519-dalek) [![](https://img.shields.io/badge/dynamic/json.svg?label=docs&uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fcurve25519-dalek%2Fversions&query=%24.versions%5B0%5D.num&colorB=4F74A6)](https://doc.dalek.rs) [![](https://travis-ci.org/dalek-cryptography/curve25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/curve25519-dalek) //! From 6b37b255636117d0ba85232fbcb2c82cd7bd7bc7 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Thu, 28 Jan 2021 11:20:20 -0800 Subject: [PATCH 34/40] Add Github Actions This replaces the Travis CI workflows. (cherry picked from commit d66a5a81f87dae29d0bb1a41bec26c57e6909c28) Signed-off-by: Isis Lovecruft I discarded the portion of the original commit which removed TravisCI. --- .github/workflows/rust.yml | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..09708d3 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,102 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + test-u32: + name: Test u32 backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features "std u32_backend" + + test-u64: + name: Test u64 backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features "std u64_backend" + + test-simd: + name: Test simd backend (nightly) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features "std simd_backend" + + test-defaults-serde: + name: Test default feature selection and serde + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --features "serde" + + test-alloc-u32: + name: Test no_std+alloc with u32 backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --lib --no-default-features --features "alloc u32_backend" + + bench: + name: Check that benchmarks compile + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: bench + # This filter selects no benchmarks, so we don't run any, only build them. + args: "DONTRUNBENCHMARKS" From 897f526d42a1f55e56e412cc824771cd484b786d Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 4 Aug 2021 01:20:15 +0000 Subject: [PATCH 35/40] Run Github actions on any push, and PRs to main and develop. --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 09708d3..db237a8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: Rust on: push: - branches: [ main ] + branches: [ '*' ] pull_request: - branches: [ main ] + branches: [ main, develop ] env: CARGO_TERM_COLOR: always From 076cf347bad857c4b237dc9ebbe38ed144ec5af9 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 17 Aug 2021 00:14:00 +0000 Subject: [PATCH 36/40] Fix non-unique benchmark IDs for newer criterion versions. --- Cargo.toml | 2 +- benches/dalek_benchmarks.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b6ccc62..cd0a4f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ travis-ci = { repository = "dalek-cryptography/curve25519-dalek", branch = "mast [dev-dependencies] sha2 = { version = "0.9", default-features = false } bincode = "1" -criterion = "0.3.0" +criterion = { version = "0.3.0", features = ["html_reports"] } hex = "0.4.2" rand = "0.7" diff --git a/benches/dalek_benchmarks.rs b/benches/dalek_benchmarks.rs index 136d0e7..308545c 100644 --- a/benches/dalek_benchmarks.rs +++ b/benches/dalek_benchmarks.rs @@ -180,12 +180,12 @@ mod multiscalar_benches { dynamic_fraction: f64, ) { for multiscalar_size in &MULTISCALAR_SIZES { - c.bench_with_input( - BenchmarkId::new( - "Variable-time mixed-base multiscalar multiplication ({:.0}pct dyn)", - format!("({:.0}pct dyn)", 100.0 * dynamic_fraction), - ), - &multiscalar_size, + let bench_id = BenchmarkId::new( + "Variable-time mixed-base", + format!("(size: {:?}), ({:.0}pct dyn)", multiscalar_size, 100.0 * dynamic_fraction), + ); + + c.bench_with_input(bench_id, &multiscalar_size, move |b, &&total_size| { let dynamic_size = ((total_size as f64) * dynamic_fraction) as usize; let static_size = total_size - dynamic_size; @@ -221,16 +221,18 @@ mod multiscalar_benches { } fn multiscalar_multiplications(c: &mut Criterion) { - let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar muls"); + let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar multiplications"); consttime_multiscalar_mul(&mut group); vartime_multiscalar_mul(&mut group); vartime_precomputed_pure_static(&mut group); let dynamic_fracs = [0.0, 0.2, 0.5]; + for frac in dynamic_fracs.iter() { vartime_precomputed_helper(&mut group, *frac); } + group.finish(); } From b06df0376ca48a9cac2c70fcadae176f0a3e1eb6 Mon Sep 17 00:00:00 2001 From: bitmold Date: Tue, 1 Feb 2022 02:15:31 -0500 Subject: [PATCH 37/40] Update README.md master -> main --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2600cce..acad0f9 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ that primitive. Please see [CONTRIBUTING.md][contributing]. Patches and pull requests should be make against the `develop` -branch, **not** `master`. +branch, **not** `main`. # About From b6a7406c7340d8236be449fa0372c0373a2f7876 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Fri, 7 Feb 2020 11:31:41 +0000 Subject: [PATCH 38/40] Pin zeroize dependency to =1.3.0 to maintain MSRV 1.41. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cd0a4f9..86ff6c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ serde = { version = "1.0", default-features = false, optional = true, features = # The original packed_simd package was orphaned, see # https://github.com/rust-lang/packed_simd/issues/303#issuecomment-701361161 packed_simd = { version = "0.3.4", package = "packed_simd_2", features = ["into_bits"], optional = true } -zeroize = { version = "1", default-features = false } +zeroize = { version = "=1.3.0", default-features = false } fiat-crypto = { version = "0.1.6", optional = true} [features] From f7381ac64cd8439c7131de99ac5e1f1867dd9c93 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 16 Feb 2022 20:44:04 +0000 Subject: [PATCH 39/40] Pin zeroize dependency to >=1, <1.4 to relax bounds for downstreams. As suggested by @tarcieri in #362. See also commit b6a7406. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 86ff6c4..f32957c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ serde = { version = "1.0", default-features = false, optional = true, features = # The original packed_simd package was orphaned, see # https://github.com/rust-lang/packed_simd/issues/303#issuecomment-701361161 packed_simd = { version = "0.3.4", package = "packed_simd_2", features = ["into_bits"], optional = true } -zeroize = { version = "=1.3.0", default-features = false } +zeroize = { version = ">=1, <1.4", default-features = false } fiat-crypto = { version = "0.1.6", optional = true} [features] From 29e5c29b0e5c6821e4586af58b0d0891dd2ec639 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 16 Feb 2022 21:21:05 +0000 Subject: [PATCH 40/40] Bump curve25519-dalek version to 3.2.1. --- Cargo.toml | 2 +- src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f32957c..56a38b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ name = "curve25519-dalek" # - update html_root_url # - update README if required by semver # - if README was updated, also update module documentation in src/lib.rs -version = "3.2.0" +version = "3.2.1" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index f33ffde..8f99a78 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ #![deny(missing_docs)] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] -#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.2.0")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.2.1")] //! # curve25519-dalek [![](https://img.shields.io/crates/v/curve25519-dalek.svg)](https://crates.io/crates/curve25519-dalek) [![](https://img.shields.io/badge/dynamic/json.svg?label=docs&uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fcurve25519-dalek%2Fversions&query=%24.versions%5B0%5D.num&colorB=4F74A6)](https://doc.dalek.rs) [![](https://travis-ci.org/dalek-cryptography/curve25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/curve25519-dalek) //! @@ -198,7 +198,7 @@ //! Please see [CONTRIBUTING.md][contributing]. //! //! Patches and pull requests should be make against the `develop` -//! branch, **not** `master`. +//! branch, **not** `main`. //! //! # About //!