From f6cd96b023f1b403c04653077b58beea3c397b7c Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 4 Dec 2021 12:01:35 -0700 Subject: [PATCH] ecdsa: use revised `LinearCombination` trait (#419) See RustCrypto/traits#835 --- Cargo.lock | 6 +++--- ecdsa/Cargo.toml | 4 ++-- ecdsa/src/hazmat.rs | 10 +++++----- ecdsa/src/verify.rs | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53be5c70..d5a341ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,7 +161,7 @@ name = "ecdsa" version = "0.13.2" dependencies = [ "der 0.5.1", - "elliptic-curve 0.11.4", + "elliptic-curve 0.11.5", "hex-literal", "rfc6979", "sha2", @@ -221,9 +221,9 @@ dependencies = [ [[package]] name = "elliptic-curve" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9be7b065e66163fd97787a4cadc56625f948e22e914a0deab1d22b1f48fde25" +checksum = "1f01ff20862362c34074072c8be2de97399633d6b1d2114afa56bf77a8b7f0a4" dependencies = [ "crypto-bigint 0.3.2", "der 0.5.1", diff --git a/ecdsa/Cargo.toml b/ecdsa/Cargo.toml index 17a31f89..3aca3c3f 100644 --- a/ecdsa/Cargo.toml +++ b/ecdsa/Cargo.toml @@ -15,7 +15,7 @@ edition = "2021" rust-version = "1.56" [dependencies] -elliptic-curve = { version = "0.11.4", default-features = false, features = ["sec1"] } +elliptic-curve = { version = "0.11.5", default-features = false, features = ["sec1"] } signature = { version = ">= 1.3.1, <1.5", default-features = false, features = ["rand-preview"] } # optional dependencies @@ -23,7 +23,7 @@ der = { version = "0.5", optional = true } rfc6979 = { version = "0.1", optional = true, path = "../rfc6979" } [dev-dependencies] -elliptic-curve = { version = "0.11", default-features = false, features = ["dev"] } +elliptic-curve = { version = "0.11.5", default-features = false, features = ["dev"] } hex-literal = "0.3" sha2 = { version = "0.9", default-features = false } diff --git a/ecdsa/src/hazmat.rs b/ecdsa/src/hazmat.rs index 2db9b5a7..706a70ce 100644 --- a/ecdsa/src/hazmat.rs +++ b/ecdsa/src/hazmat.rs @@ -18,7 +18,7 @@ use { group::Curve as _, ops::{Invert, LinearCombination, Reduce}, AffineArithmetic, AffineXCoordinate, Field, FieldBytes, Group, ProjectiveArithmetic, - Scalar, ScalarArithmetic, + ProjectivePoint, Scalar, ScalarArithmetic, }, }; @@ -112,7 +112,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "arithmetic")))] pub trait VerifyPrimitive: AffineXCoordinate + Copy + Sized where - C: PrimeCurve + AffineArithmetic + LinearCombination + ProjectiveArithmetic, + C: PrimeCurve + AffineArithmetic + ProjectiveArithmetic, Scalar: Reduce, SignatureSize: ArrayLength, { @@ -127,10 +127,10 @@ where let s_inv = Option::>::from(s.invert()).ok_or_else(Error::new)?; let u1 = z * s_inv; let u2 = *r * s_inv; - let x = C::lincomb( - &C::ProjectivePoint::generator(), + let x = ProjectivePoint::::lincomb( + &ProjectivePoint::::generator(), &u1, - &C::ProjectivePoint::from(*self), + &ProjectivePoint::::from(*self), &u2, ) .to_affine() diff --git a/ecdsa/src/verify.rs b/ecdsa/src/verify.rs index 16c67915..fd05b9ef 100644 --- a/ecdsa/src/verify.rs +++ b/ecdsa/src/verify.rs @@ -7,7 +7,7 @@ use crate::{ use core::{cmp::Ordering, fmt::Debug}; use elliptic_curve::{ generic_array::ArrayLength, - ops::{LinearCombination, Reduce}, + ops::Reduce, sec1::{self, EncodedPoint, FromEncodedPoint, ToEncodedPoint}, AffinePoint, FieldSize, PointCompression, PrimeCurve, ProjectiveArithmetic, PublicKey, Scalar, }; @@ -79,7 +79,7 @@ impl Copy for VerifyingKey where C: PrimeCurve + ProjectiveArithmetic {} impl DigestVerifier> for VerifyingKey where - C: PrimeCurve + ProjectiveArithmetic + LinearCombination, + C: PrimeCurve + ProjectiveArithmetic, D: Digest>, AffinePoint: VerifyPrimitive, Scalar: Reduce, @@ -93,7 +93,7 @@ where impl Verifier> for VerifyingKey where - C: PrimeCurve + ProjectiveArithmetic + DigestPrimitive + LinearCombination, + C: PrimeCurve + ProjectiveArithmetic + DigestPrimitive, C::Digest: Digest>, AffinePoint: VerifyPrimitive, Scalar: Reduce,