From d6b04d6b332b5d540ec56ea5ccf513edf4c219de Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 16 Dec 2020 20:56:05 -0800 Subject: [PATCH] Bump `elliptic-curve` dependency to v0.8; `ecdsa` to v0.10 (#260) --- Cargo.lock | 67 +++++++---------------------------- k256/Cargo.toml | 6 ++-- k256/src/arithmetic/affine.rs | 16 +++++---- p256/Cargo.toml | 6 ++-- p256/src/arithmetic/affine.rs | 16 +++++---- p384/Cargo.toml | 4 +-- 6 files changed, 39 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2840e411..ed141c6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,12 +121,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "const-oid" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9718eb58510ebba591b25cb8b2327050138fbbef581990944317097cf8a4198f" - [[package]] name = "const-oid" version = "0.4.0" @@ -270,21 +264,11 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f488ad19df443921d9fa5b9ce13a282b552709c511d2d90b1fd635e0204d74d5" -dependencies = [ - "elliptic-curve 0.7.1", - "signature", -] - -[[package]] -name = "ecdsa" -version = "0.10.0-pre" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc040dc428ef356114ad01a845a1b30f247091becd43944ffcf7c852b2944bcb" +checksum = "4fa9459c0f3be75c1ede60e02e9cd69ed1279a1421a5c2fe4d23e829adc43d36" dependencies = [ - "elliptic-curve 0.8.0-pre", + "elliptic-curve", "hmac", "signature", ] @@ -297,30 +281,16 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elliptic-curve" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d02ac72d4e61713e291a2ae644c1bd82be82c21b9a0de2271e0aa6886b7e0b4" -dependencies = [ - "digest", - "generic-array", - "pkcs8 0.1.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "elliptic-curve" -version = "0.8.0-pre" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2a632802ad67bc4add37bd464f597bd3dba143e414c0e750a8de399ae14226" +checksum = "b4cf86631e1e5cf5fa77372d1d4d7bcaa26eba12d695012e93ef980a50dc5250" dependencies = [ "bitvec", "digest", "ff", "generic-array", "group", - "pkcs8 0.3.2", + "pkcs8", "rand_core", "subtle", "zeroize", @@ -442,8 +412,8 @@ version = "0.6.0" dependencies = [ "cfg-if 1.0.0", "criterion", - "ecdsa 0.10.0-pre", - "elliptic-curve 0.8.0-pre", + "ecdsa", + "elliptic-curve", "hex-literal", "num-bigint", "num-traits", @@ -551,8 +521,8 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" name = "p256" version = "0.6.0" dependencies = [ - "ecdsa 0.10.0-pre", - "elliptic-curve 0.8.0-pre", + "ecdsa", + "elliptic-curve", "hex-literal", "proptest", "rand_core", @@ -563,29 +533,18 @@ dependencies = [ name = "p384" version = "0.5.0" dependencies = [ - "ecdsa 0.9.0", - "elliptic-curve 0.7.1", + "ecdsa", + "elliptic-curve", "sha2", ] -[[package]] -name = "pkcs8" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2298039b56d6be1d9bf341c9ba6aa0936bd508152c2829c8cab6d3f57675f4" -dependencies = [ - "const-oid 0.3.3", - "subtle-encoding", - "zeroize", -] - [[package]] name = "pkcs8" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9911ed9965aeee333588f226ad2baeabda478bf5ec151550735ed1760df759ba" dependencies = [ - "const-oid 0.4.0", + "const-oid", "subtle-encoding", "zeroize", ] diff --git a/k256/Cargo.toml b/k256/Cargo.toml index 8a422593..4f75a1d2 100644 --- a/k256/Cargo.toml +++ b/k256/Cargo.toml @@ -18,15 +18,15 @@ keywords = ["bitcoin", "crypto", "ecc", "ethereum", "secp256k1"] [dependencies] cfg-if = "1.0" -ecdsa-core = { version = "0.10.0-pre", package = "ecdsa", optional = true, default-features = false } -elliptic-curve = { version = "=0.8.0-pre", default-features = false } +ecdsa-core = { version = "0.10", package = "ecdsa", optional = true, default-features = false } +elliptic-curve = { version = "0.8", default-features = false } hex-literal = { version = "0.3", optional = true } sha2 = { version = "0.9", optional = true, default-features = false } sha3 = { version = "0.9", optional = true, default-features = false } [dev-dependencies] criterion = "0.3" -ecdsa-core = { version = "=0.10.0-pre", package = "ecdsa", default-features = false, features = ["dev"] } +ecdsa-core = { version = "0.10", package = "ecdsa", default-features = false, features = ["dev"] } hex-literal = "0.3" num-bigint = "0.3" num-traits = "0.2" diff --git a/k256/src/arithmetic/affine.rs b/k256/src/arithmetic/affine.rs index 9cda1b53..02f9637d 100644 --- a/k256/src/arithmetic/affine.rs +++ b/k256/src/arithmetic/affine.rs @@ -152,13 +152,15 @@ impl FromEncodedPoint for AffinePoint { impl ToEncodedPoint for AffinePoint { fn to_encoded_point(&self, compress: bool) -> EncodedPoint { - // TODO(tarcieri): use `EncodedPoint::conditional_select` when available - if self.infinity.into() { - // TODO(tarcieri): use `EncodedPoint::identity` when available - EncodedPoint::from_bytes(&[0]).unwrap() - } else { - EncodedPoint::from_affine_coordinates(&self.x.to_bytes(), &self.y.to_bytes(), compress) - } + EncodedPoint::conditional_select( + &EncodedPoint::from_affine_coordinates( + &self.x.to_bytes(), + &self.y.to_bytes(), + compress, + ), + &EncodedPoint::identity(), + self.infinity, + ) } } diff --git a/p256/Cargo.toml b/p256/Cargo.toml index 2c6df9e6..491dea05 100644 --- a/p256/Cargo.toml +++ b/p256/Cargo.toml @@ -16,13 +16,13 @@ categories = ["cryptography", "no-std"] keywords = ["crypto", "ecc", "nist", "prime256v1", "secp256r1"] [dependencies] -ecdsa-core = { version = "=0.10.0-pre", package = "ecdsa", optional = true, default-features = false } -elliptic-curve = { version = "=0.8.0-pre", default-features = false } +ecdsa-core = { version = "0.10", package = "ecdsa", optional = true, default-features = false } +elliptic-curve = { version = "0.8", default-features = false } hex-literal = { version = "0.3", optional = true } sha2 = { version = "0.9", optional = true, default-features = false } [dev-dependencies] -ecdsa-core = { version = "=0.10.0-pre", package = "ecdsa", default-features = false, features = ["dev"] } +ecdsa-core = { version = "0.10", package = "ecdsa", default-features = false, features = ["dev"] } hex-literal = "0.3" proptest = "0.10" rand_core = { version = "0.5", features = ["getrandom"] } diff --git a/p256/src/arithmetic/affine.rs b/p256/src/arithmetic/affine.rs index f781f802..fa27d9e0 100644 --- a/p256/src/arithmetic/affine.rs +++ b/p256/src/arithmetic/affine.rs @@ -150,13 +150,15 @@ impl FromEncodedPoint for AffinePoint { impl ToEncodedPoint for AffinePoint { fn to_encoded_point(&self, compress: bool) -> EncodedPoint { - // TODO(tarcieri): use `EncodedPoint::conditional_select` when available - if self.infinity.into() { - // TODO(tarcieri): use `EncodedPoint::identity` when available - EncodedPoint::from_bytes(&[0]).unwrap() - } else { - EncodedPoint::from_affine_coordinates(&self.x.to_bytes(), &self.y.to_bytes(), compress) - } + EncodedPoint::conditional_select( + &EncodedPoint::from_affine_coordinates( + &self.x.to_bytes(), + &self.y.to_bytes(), + compress, + ), + &EncodedPoint::identity(), + self.infinity, + ) } } diff --git a/p384/Cargo.toml b/p384/Cargo.toml index 547a4034..f046ccc4 100644 --- a/p384/Cargo.toml +++ b/p384/Cargo.toml @@ -12,8 +12,8 @@ categories = ["cryptography", "no-std"] keywords = ["crypto", "ecc", "nist", "secp384r1"] [dependencies] -ecdsa = { version = "0.9", optional = true, default-features = false } -elliptic-curve = { version = "0.7", default-features = false } +ecdsa = { version = "0.10", optional = true, default-features = false } +elliptic-curve = { version = "0.8", default-features = false } sha2 = { version = "0.9", optional = true, default-features = false } [features]