Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ecdsa: make SignPrimitive's ephemeral scalar generic
...and remove masking scalar.

This API allows the inversion masking process to be handled outside of
the ECDSA implementation itself (potentially generically in a way that
can work across elliptic curves).
  • Loading branch information
tarcieri committed Jul 28, 2020
commit 98e25631631059ded2d8f36c115167a8f54a28b6
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions ecdsa/src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
//! FULL PRIVATE KEY RECOVERY!

use crate::{Signature, SignatureSize};
use elliptic_curve::{generic_array::ArrayLength, weierstrass::Curve, Arithmetic, ScalarBytes};
use elliptic_curve::{
generic_array::ArrayLength, ops::Invert, weierstrass::Curve, Arithmetic, ScalarBytes,
};
use signature::Error;

#[cfg(feature = "digest")]
Expand All @@ -33,12 +35,10 @@ where
/// Accepts the following arguments:
///
/// - `ephemeral_scalar`: ECDSA `k` value (MUST BE UNIFORMLY RANDOM!!!)
/// - `masking_scalar`: optional blinding factor for sidechannel resistance
/// - `hashed_msg`: prehashed message to be signed
fn try_sign_prehashed(
fn try_sign_prehashed<K: Into<C::Scalar> + Invert<Output = C::Scalar>>(
&self,
ephemeral_scalar: &C::Scalar,
masking_scalar: Option<&C::Scalar>,
ephemeral_scalar: &K,
hashed_msg: &ScalarBytes<C>,
) -> Result<Signature<C>, Error>;
}
Expand Down