Skip to content

Commit

Permalink
Don't reject small-order verification keys
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Sep 6, 2021
1 parent d5d8c5f commit 67905b0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/verification_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ impl<T: SigType> TryFrom<VerificationKeyBytes<T>> for VerificationKey<T> {
let maybe_point = T::Point::from_bytes(&repr);
if maybe_point.is_some().into() {
let point = maybe_point.unwrap();
// This checks that the verification key is not of small order.
if <bool>::from(point.is_small_order()) == false {
Ok(VerificationKey { point, bytes })
} else {
Err(Error::MalformedVerificationKey)
}
// Note that small-order verification keys (including the identity) are not
// rejected here. Previously they were rejected, but this was a bug as the
// RedDSA specification allows them. Zcash Sapling rejects small-order points
// for the RedJubjub spend authorization key rk; this now occurs separately.
// Meanwhile, Zcash Orchard uses a prime-order group, so the only small-order
// point would be the identity, which is allowed in Orchard.
Ok(VerificationKey { point, bytes })
} else {
Err(Error::MalformedVerificationKey)
}
Expand Down

0 comments on commit 67905b0

Please sign in to comment.