Skip to content
This repository has been archived by the owner on Jun 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8 from sigp/infinity
Browse files Browse the repository at this point in the history
Remove checks against infinity for verification
  • Loading branch information
kirk-baird authored Feb 25, 2019
2 parents 5cf2eff + d4a285a commit ca5c7b0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bls-aggregates"
version = "0.5.2"
version = "0.5.3"
authors = ["Lovesh Harchandani <lovesh.bond@gmail.com>"]
description = "Various signature schemes. BLS, MuSig"
license = "MIT/Apache-2.0"
Expand Down
13 changes: 0 additions & 13 deletions src/aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ impl AggregateSignature {
/// All PublicKeys which signed across this AggregateSignature must be included in the
/// AggregatePublicKey, otherwise verification will fail.
pub fn verify(&self, msg: &[u8], d: u64, avk: &AggregatePublicKey) -> bool {
// Check points are valid
if self.point.is_infinity() || avk.point.is_infinity() {
return false;
}
let mut sig_point = self.point.clone();
let mut key_point = avk.point.clone();
sig_point.affine();
Expand All @@ -111,10 +107,6 @@ impl AggregateSignature {
/// All PublicKeys related to a Message should be aggregated into one AggregatePublicKey.
/// Each AggregatePublicKey has a 1:1 ratio with a 32 byte Message.
pub fn verify_multiple(&self, msg: &[u8], d: u64, avks: &[AggregatePublicKey]) -> bool {
// Check AggregateSignature point is valid
if self.point.is_infinity() {
return false;
}
let mut sig_point = self.point.clone();
sig_point.affine();

Expand All @@ -126,11 +118,6 @@ impl AggregateSignature {
// Aggregate each AggregatePublicKey with a Message
let mut lhs = FP12::new();
for (i, key) in avks.iter().enumerate() {
// Check point is valid
if key.point.is_infinity() {
return false;
}

let mut key_point = key.point.clone();
key_point.affine();
let mut hash_point = hash_on_g2(&msg[i * 32..(i + 1) * 32], d);
Expand Down
10 changes: 0 additions & 10 deletions src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ impl Signature {
/// In theory, should only return true if the PublicKey matches the SecretKey used to
/// instantiate the Signature.
pub fn verify(&self, msg: &[u8], d: u64, pk: &PublicKey) -> bool {
// Check points are valid
if self.point.is_infinity() || pk.point.is_infinity() {
return false;
}

let mut msg_hash_point = hash_on_g2(msg, d);
msg_hash_point.affine();
let mut lhs = ate_pairing(self.point.as_raw(), &GeneratorG1);
Expand All @@ -61,11 +56,6 @@ impl Signature {
msg_hash_imaginary: &[u8],
pk: &PublicKey,
) -> bool {
// Check points are valid
if self.point.is_infinity() || pk.point.is_infinity() {
return false;
}

let mut msg_hash_point = map_to_g2(msg_hash_real, msg_hash_imaginary);
msg_hash_point.affine();
let mut lhs = ate_pairing(self.point.as_raw(), &GeneratorG1);
Expand Down

0 comments on commit ca5c7b0

Please sign in to comment.