Skip to content

Commit

Permalink
Merge pull request #90 from fjarri/nonzero-mul
Browse files Browse the repository at this point in the history
Use the new nonzero scalar * nonzero scalar implementation in elliptic-curve 0.10.7
  • Loading branch information
fjarri authored Jan 15, 2022
2 parents c752d02 + 5d61ba7 commit cd3266b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion umbral-pre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
12 changes: 1 addition & 11 deletions umbral-pre/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> =
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))
}
}

Expand Down

0 comments on commit cd3266b

Please sign in to comment.