From 5d61ba71d5682ded1011784ad110882012ca7ec1 Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Sat, 15 Jan 2022 14:54:49 -0800 Subject: [PATCH] Use the new nonzero scalar * nonzero scalar implementation in elliptic-curve 0.10.7 --- umbral-pre/Cargo.toml | 2 +- umbral-pre/src/curve.rs | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/umbral-pre/Cargo.toml b/umbral-pre/Cargo.toml index 720435d3..36d56d45 100644 --- a/umbral-pre/Cargo.toml +++ b/umbral-pre/Cargo.toml @@ -21,7 +21,7 @@ pyo3 = { version = "0.15", optional = true } # These packages are among the dependencies of the packages above. # Their versions should be updated when the main packages above are updated. -elliptic-curve = { version = "0.11" } +elliptic-curve = { version = "0.11.7" } digest = "0.9" generic-array = "0.14" aead = { version = "0.4", default-features = false } diff --git a/umbral-pre/src/curve.rs b/umbral-pre/src/curve.rs index a73a780c..c33f1cfc 100644 --- a/umbral-pre/src/curve.rs +++ b/umbral-pre/src/curve.rs @@ -285,17 +285,7 @@ impl Mul<&NonZeroCurveScalar> for &NonZeroCurveScalar { type Output = NonZeroCurveScalar; fn mul(self, other: &NonZeroCurveScalar) -> NonZeroCurveScalar { - let scalar: BackendScalar = self.0.mul(&(*other.0)); - - // Converting from CtOption - let maybe_nz_scalar: Option = - BackendNonZeroScalar::new(scalar).into(); - - // RustCrypto does not support multiplying non-zero scalars preserving the invariant. - // But we know it always results in a non-zero scalar, so we can safely unwrap. - NonZeroCurveScalar::from_backend_scalar( - maybe_nz_scalar.expect("The product of two non-zero scalars must be non-zero"), - ) + NonZeroCurveScalar(self.0.mul(other.0)) } }