Skip to content

Conversation

Forostovec
Copy link
Contributor

@Forostovec Forostovec commented Oct 19, 2025

Problem: In GenerateProof step 85 the self-check calls VerifyProof(A, B, C, proof) without G and m, but VerifyProof is defined as VerifyProof(A, B, C, proof, G, m). This omission breaks self-check when a non-empty message m is used or when a non-default generator G is passed.

Evidence:
Spec definition requires G and m:

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''.

Reference implementation passes G and m in the self-check:
bip-0374/reference.py

proof = e.to_bytes(32, \"big\") + s.to_bytes(32, \"big\")
if not dleq_verify_proof(A, B, C, proof, G=G, m=m):
    return None

GenerateProof includes m in challenge derivation and treats G as an input, so omitting them in VerifyProof recomputes a different challenge and will fail for non-empty m and non-default G.

@murchandamus murchandamus added Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified Bug fix labels Oct 21, 2025
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ACK, the change to the VerifyProof call here in GenerateProof seems to align with both VerifyProof in the BIP draft and how dleq_verify_proof is called from dleq_generate_proof in the reference.py code.

@murchandamus
Copy link
Contributor

cc: @andrewtoth

Copy link
Contributor

@andrewtoth andrewtoth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1bb1aee

Nice catch.

@jonatack jonatack removed the Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified label Oct 23, 2025
@jonatack jonatack merged commit 34c584d into bitcoin:master Oct 23, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants