Skip to content

Commit

Permalink
k256: reject signatures which aren't low-S normalized (#914)
Browse files Browse the repository at this point in the history
Closes #908
  • Loading branch information
tarcieri authored Jul 22, 2023
1 parent dd656af commit 5c829a4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion k256/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,15 @@ impl SignPrimitive<Secp256k1> for Scalar {
}

#[cfg(feature = "ecdsa")]
impl VerifyPrimitive<Secp256k1> for AffinePoint {}
impl VerifyPrimitive<Secp256k1> for AffinePoint {
fn verify_prehashed(&self, z: &FieldBytes, sig: &Signature) -> Result<(), Error> {
if sig.s().is_high().into() {
return Err(Error::new());
}

hazmat::verify_prehashed(&self.into(), z, sig)
}
}

#[cfg(all(test, feature = "ecdsa", feature = "arithmetic"))]
mod tests {
Expand Down

0 comments on commit 5c829a4

Please sign in to comment.