diff --git a/bip-DLEQ.mediawiki b/bip-DLEQ.mediawiki index 90c9cd18..12f2eb68 100644 --- a/bip-DLEQ.mediawiki +++ b/bip-DLEQ.mediawiki @@ -74,6 +74,7 @@ Input: * An optional message ''m'': a 32-byte array ''' Why include a message as an input?''' This could be useful for protocols that want to authorize on a compound statement, not just knowledge of a scalar. This allows the protocol to combine knowledge of the scalar and the statement. The algorithm ''VerifyProof(A, B, C, proof, G, m)'' is defined as: +* Fail if any of ''is_infinite(A)'', ''is_infinite(B)'', ''is_infinite(C)'', ''is_infinite(G)'' * Let ''e = int(proof[0:32])''. * Let ''s = int(proof[32:64])''; fail if ''s ≥ n''. * Let ''R1 = s⋅G - e⋅A''. diff --git a/bip-DLEQ/reference.py b/bip-DLEQ/reference.py index ac431985..f7e69c7b 100644 --- a/bip-DLEQ/reference.py +++ b/bip-DLEQ/reference.py @@ -75,6 +75,8 @@ def dleq_generate_proof( def dleq_verify_proof( A: GE, B: GE, C: GE, proof: bytes, G: GE = G, m: bytes | None = None ) -> bool: + if A.infinity or B.infinity or C.infinity or G.infinity: + return False assert len(proof) == 64 e = int.from_bytes(proof[:32], "big") s = int.from_bytes(proof[32:], "big")