diff --git a/CHANGELOG.md b/CHANGELOG.md index a41e567..000b965 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.2 * Revert a commit which mistakenly removed support for `zeroize` traits @@ -37,7 +43,7 @@ major series. ### 3.0.2 -* Multiple documenation typo fixes. +* Multiple documentation typo fixes. * Fixes to make using `alloc`+`no_std` possible for stable Rust. ### 3.0.1 diff --git a/Cargo.toml b/Cargo.toml index 9251d78..b6ccc62 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.2" +version = "3.2.0" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" 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 diff --git a/src/lib.rs b/src/lib.rs index e3ba262..f33ffde 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.2")] +#![doc(html_root_url = "https://docs.rs/curve25519-dalek/3.2.0")] //! # 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) //! diff --git a/src/montgomery.rs b/src/montgomery.rs index d7a20d3..88afbd9 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,19 @@ 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] + fn identity_in_different_models() { + assert!(EdwardsPoint::identity().to_montgomery() == MontgomeryPoint::identity()); + } + #[test] #[cfg(feature = "serde")] fn serde_bincode_basepoint_roundtrip() {