Skip to content

Commit 48a97b7

Browse files
authored
Merge pull request #212 from MegaManSec/throw
try-catch pairingBatch in bls12_381.verify()
2 parents 270e5d6 + 0cdef32 commit 48a97b7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/abstract/bls.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,12 @@ function createBlsSig<P, S>(
424424
// Before it was G.negate() in G2, now it's always pubKey.negate
425425
// e(P, -Q)===e(-P, Q)==e(P, Q)^-1. Negate can be done anywhere (as long it is done once per pair).
426426
// We just moving sign, but since pairing is multiplicative, we doing X * X^-1 = 1
427-
const exp = pairingBatch([pair(P, Hm), pair(G, S)]);
428-
return Fp12.eql(exp, Fp12.ONE);
427+
try {
428+
const exp = pairingBatch([pair(P, Hm), pair(G, S)]);
429+
return Fp12.eql(exp, Fp12.ONE);
430+
} catch {
431+
return false;
432+
}
429433
},
430434
// https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407
431435
// e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))

0 commit comments

Comments
 (0)