fix verifyPairings implementation

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2022-04-12 14:17:30 +02:00
parent 9cc92f117f
commit ddb613249a
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
1 changed files with 4 additions and 3 deletions

View File

@ -134,7 +134,7 @@ proc ec_hash_to_g1*(dst: var ec_p1,
proc verifyPairings*(a1: ec_p1, a2: ec_p2, b1: ec_p1, b2: ec_p2) : bool =
when C.getEmbeddingDegree() == 12:
var gt {.noInit.}: Fp12[C]
var gt1, gt2 {.noInit.}: Fp12[C]
else:
{.error: "Not implemented: signature on k=" & $C.getEmbeddingDegree() & " for curve " & $$C.}
@ -144,8 +144,9 @@ proc verifyPairings*(a1: ec_p1, a2: ec_p2, b1: ec_p1, b2: ec_p2) : bool =
b1aff.affine(b1)
a2aff.affine(a2)
b2aff.affine(b2)
gt.pairing([a2aff, b2aff], [a1aff, b1aff])
return gt.isOne().bool()
gt1.pairing(a2aff, a1aff)
gt2.pairing(b2aff, b1aff)
return bool(gt1 == gt2)
func ec_from_bytes*(
dst: var Signature,