BIP-327: Fix reduction sketch for infinity in nonce aggregation #2354

pull real-or-random wants to merge 1 commits into bitcoin:master from real-or-random:202611-bip327-infinity-reduction changing 1 files +39 −6
  1. real-or-random commented at 11:59 AM on November 13, 2026: contributor

    The section "Dealing with Infinity in Nonce Aggregation" sketches a reduction from the unforgeability of the modified scheme, which sets the final nonce R to G whenever it would be the point at infinity, to the unforgeability of the original MuSig2* scheme. The sketch let the reduction translate aggnonce' = bytes(33, 0) || bytes(33, 0) into aggnonce = cbytes_ext(G) || bytes(33, 0). But the nonce coefficient b is derived by hashing the aggregate nonce, so the adversary expects a b computed from aggnonce' while the original game computes b from aggnonce. The resulting partial signatures do not match, and the sketch does not work as a black-box reduction.

    Replace the sketch with a reduction that programs the random oracles. For each pair of aggregate public key and message, it maps the three aggregate nonces whose final nonce is G or -G in the modified scheme, namely bytes(33, 0) || bytes(33, 0), cbytes(G) || bytes(33, 0), and cbytes(-G) || bytes(33, 0), to three aggregate nonces of its own choice whose final nonce in the original game is a random W or -W, and it swaps xbytes(G) with xbytes(W) in the inputs of the challenge hash. The three values that the partial signature depends on, i.e., the nonce coefficient, the challenge, and the parity of the final nonce, then agree between the adversary's view and the original game. Since the reduction knows the discrete logarithms of all group elements it introduces, the argument also applies in the algebraic group model, in which the security proof of MuSig2* is given. The full argument is in a footnote. Bump the version to 1.0.6.

    The problem with the previous sketch was found by mllwchrry while reviewing the corresponding section of the FROST signing BIP draft, see https://github.com/siv2r/bip-frost-signing/issues/73.

    The reduction has been found and written down with the help of Claude Fable 5.1.

  2. real-or-random commented at 12:00 PM on November 13, 2026: contributor

    cc @mllwchrry , want to review this? :)

    (The version bump conflicts with #2351 at the moment.)

  3. jonatack added the label BIP Update by Owner on Nov 13, 2026
  4. mllwchrry commented at 2:10 PM on November 13, 2026: none

    The argument looks good to me! Just wondering: since the swapped hash inputs only contain ''xbytes(Q)'', wouldn't it be more precise to choose ''Y'' and ''W'' per ''xbytes(Q)'' rather than per ''Q''? For hash queries, the reduction doesn't see ''Q'' itself.

  5. real-or-random commented at 4:31 PM on November 17, 2026: contributor
  6. BIP-327: Fix reduction sketch for infinity in nonce aggregation
    The section "Dealing with Infinity in Nonce Aggregation" sketches a
    reduction from the unforgeability of the modified scheme, which sets the
    final nonce R to G whenever it would be the point at infinity, to the
    unforgeability of the original MuSig2* scheme. The sketch let the
    reduction translate aggnonce' = bytes(33, 0) || bytes(33, 0) into
    aggnonce = cbytes_ext(G) || bytes(33, 0). But the nonce coefficient b is
    derived by hashing the aggregate nonce, so the adversary expects a b
    computed from aggnonce' while the original game computes b from
    aggnonce. The resulting partial signatures do not match, and the sketch
    does not work as a black-box reduction.
    
    Replace the sketch with a reduction that programs the random oracles.
    For each pair of aggregate public key and message, it maps the three
    aggregate nonces whose final nonce is G or -G in the modified scheme,
    namely bytes(33, 0) || bytes(33, 0), cbytes(G) || bytes(33, 0), and
    cbytes(-G) || bytes(33, 0), to three aggregate nonces of its own choice
    whose final nonce in the original game is a random W or -W, and it swaps
    xbytes(G) with xbytes(W) in the inputs of the challenge hash. The three
    values that the partial signature depends on, i.e., the nonce
    coefficient, the challenge, and the parity of the final nonce, then
    agree between the adversary's view and the original game. Since the
    reduction knows the discrete logarithms of all group elements it
    introduces, the argument also applies in the algebraic group model, in
    which the security proof of MuSig2* is given. The full argument is in a
    footnote. Bump the version to 1.0.6.
    
    The problem with the previous sketch was found by mllwchrry while
    reviewing the corresponding section of the FROST signing BIP draft, see
    https://github.com/siv2r/bip-frost-signing/issues/73.
    
    The reduction has been found and written down with the help of Claude
    Fable 5.1.
    9854530ffc
  7. real-or-random force-pushed on Nov 17, 2026
  8. real-or-random commented at 4:41 PM on November 17, 2026: contributor

    The argument looks good to me! Just wondering: since the swapped hash inputs only contain ''xbytes(Q)'', wouldn't it be more precise to choose ''Y'' and ''W'' per ''xbytes(Q)'' rather than per ''Q''? For hash queries, the reduction doesn't see ''Q'' itself.

    Indeed. Force-pushed to address this.

  9. real-or-random commented at 12:03 AM on December 2, 2026: contributor

    @mllwchrry Want to re-review? :)

  10. mllwchrry commented at 1:12 PM on December 2, 2026: none

    ACK 9854530. Nit: the PR description still says "Bump the version to 1.0.5".

  11. jonatack commented at 2:42 PM on December 2, 2026: member

    Should this PR be brought out of draft?

    Nit: the PR description still says "Bump the version to 1.0.5".

    Updated.

  12. in bip-0327.mediawiki:778 in 9854530ffc
     778 | +For a session with any aggregate nonce other than these six, the reduction forwards the signing query unchanged, and the nonce coefficient and the challenge agree because the hash functions agree on the inputs involved, except in the negligible cases discussed below.<br />
     779 | +The simulation fails only if the adversary provides ''aggnonce<sub>Y</sub>'', ''aggnonce<sub>W</sub>'', or ''aggnonce<sub>-W</sub>'' in a signing query, or if it provides an aggregate nonce other than these six for which ''R' '' in ''GetSessionValues'' is the point at infinity, ''G'', ''-G'', ''W'', or ''-W''.
     780 | +The former requires guessing ''y<sub>1</sub>⋅G'' and ''y<sub>2</sub>⋅G'' or ''W'', which are random and hidden from the adversary.
     781 | +The latter requires ''R<sub>2</sub>'' not to be the point at infinity, because otherwise ''R' = R<sub>1</sub>'' and the aggregate nonce would be one of the six, and then it requires the uniformly random nonce coefficient to take one of at most five specific values.
     782 | +Hence, these cases happen only with negligible probability.<br />
     783 | +When the adversary outputs a forgery ''(R, s)'' for a message ''m'' that is valid in its view, i.e., ''has_even_y(R)'' and ''s⋅G = R + e'(R)⋅lift_x(xbytes(Q))'', the reduction outputs a forgery for the same message in the original game:
    


    jonatack commented at 3:01 PM on December 2, 2026:

    (2) s/lift_x(xbytes(Q))/lift_x(int(xbytes(Q)))/ to match the type in BIP 340

    When the adversary outputs a forgery ''(R, s)'' for a message ''m'' that is valid in its view, i.e., ''has_even_y(R)'' and ''s⋅G = R + e'(R)⋅lift_x(int(xbytes(Q)))'', the reduction outputs a forgery for the same message in the original game:
    
  13. in bip-0327.mediawiki:767 in 9854530ffc
     767 | +In the original game, both ''aggnonce<sub>Y</sub>'' and ''aggnonce<sub>W</sub>'' result in the final nonce ''R = W'', and ''aggnonce<sub>-W</sub>'' results in the final nonce ''R = -W''.
     768 | +The reduction answers the adversary's queries to ''hash<sub>MuSig/noncecoef</sub>'' and its signing queries after swapping ''aggnonce<sub>∞</sub>'' with ''aggnonce<sub>Y</sub>'', ''aggnonce<sub>G</sub>'' with ''aggnonce<sub>W</sub>'', and ''aggnonce<sub>-G</sub>'' with ''aggnonce<sub>-W</sub>'' in the query,
     769 | +and it answers the adversary's queries to ''hash<sub>BIP0340/challenge</sub>'' after swapping ''xbytes(G)'' with ''xbytes(W)'' in the query.
     770 | +Since these translations are permutations of the inputs, the hash functions in the adversary's view are random oracles, as in the unforgeability game for the modified scheme.
     771 | +(The swaps involving ''aggnonce<sub>W</sub>'' and ''aggnonce<sub>-W</sub>'' depend on the output of ''hash<sub>MuSig/noncecoef</sub>'' at ''aggnonce<sub>Y</sub>'', but conditioned on this output, the outputs at all other inputs remain uniformly random and independent, so the hash function in the adversary's view is still uniformly random.)<br />
     772 | +A session in which the adversary provides ''aggnonce<sub>∞</sub>'' has, in the adversary's view, the nonce coefficient ''b'(aggnonce<sub>∞</sub>) = b(aggnonce<sub>Y</sub>)'', the final nonce ''G'', and the challenge ''e'(G) = e(W)''.
    


    jonatack commented at 3:04 PM on December 2, 2026:

    Add missing case: signing queries with aggnonce_W and aggnonce_{-W} are answered correctly.

     A session in which the adversary provides ''aggnonce<sub>-G</sub>'' is answered with ''aggnonce<sub>-W</sub>'' in the same way, with ''-G'' and ''-W'' in place of ''G'' and ''W'', which both have an odd Y coordinate.
    +Conversely, a session in which the adversary provides ''aggnonce<sub>W</sub>'' or ''aggnonce<sub>-W</sub>'' is answered with ''aggnonce<sub>G</sub>'' or ''aggnonce<sub>-G</sub>'', respectively, and the three values agree in the same way with the roles of ''G'' and ''W'' exchanged.
    
  14. in bip-0327.mediawiki:775 in 9854530ffc
     775 | +and the reduction answers it with a session of the original game with aggregate nonce ''aggnonce<sub>W</sub>'', which has the nonce coefficient ''b(aggnonce<sub>W</sub>)'', the final nonce ''W'', and the challenge ''e(W)''.
     776 | +In both cases, the nonce coefficients and challenges agree, and ''G'' and ''W'' both have an even Y coordinate, so the original game returns exactly the partial signature that the adversary expects.
     777 | +A session in which the adversary provides ''aggnonce<sub>-G</sub>'' is answered with ''aggnonce<sub>-W</sub>'' in the same way, with ''-G'' and ''-W'' in place of ''G'' and ''W'', which both have an odd Y coordinate.
     778 | +For a session with any aggregate nonce other than these six, the reduction forwards the signing query unchanged, and the nonce coefficient and the challenge agree because the hash functions agree on the inputs involved, except in the negligible cases discussed below.<br />
     779 | +The simulation fails only if the adversary provides ''aggnonce<sub>Y</sub>'', ''aggnonce<sub>W</sub>'', or ''aggnonce<sub>-W</sub>'' in a signing query, or if it provides an aggregate nonce other than these six for which ''R' '' in ''GetSessionValues'' is the point at infinity, ''G'', ''-G'', ''W'', or ''-W''.
     780 | +The former requires guessing ''y<sub>1</sub>⋅G'' and ''y<sub>2</sub>⋅G'' or ''W'', which are random and hidden from the adversary.
    


    jonatack commented at 3:05 PM on December 2, 2026:

    Only aggnonce_Y breaks the simulation, and hiding W isn't needed. Also, at a rejected candidate the nonce coefficient isn't uniform, so the "five specific values" argument doesn't apply there.

    -The simulation fails only if the adversary provides ''aggnonce<sub>Y</sub>'', ''aggnonce<sub>W</sub>'', or ''aggnonce<sub>-W</sub>'' in a signing query, or if it provides an aggregate nonce other than these six for which ''R' '' in ''GetSessionValues'' is the point at infinity, ''G'', ''-G'', ''W'', or ''-W''.
    -The former requires guessing ''y<sub>1</sub>⋅G'' and ''y<sub>2</sub>⋅G'' or ''W'', which are random and hidden from the adversary.
    +The simulation fails only if the adversary provides ''aggnonce<sub>Y</sub>'' or a rejected candidate in a signing query, or if it provides an aggregate nonce other than these six and the rejected candidates for which ''R' '' in ''GetSessionValues'' is the point at infinity, ''G'', ''-G'', ''W'', or ''-W''.
    +The former requires guessing ''aggnonce<sub>Y</sub>'' or a rejected candidate, which are random and hidden from the adversary.
    
  15. in bip-0327.mediawiki:755 in 9854530ffc
     755 | +The adversary can check the partial signature using ''PartialSigVerify''.
     756 | +Therefore, the translation must ensure that these three values in the adversary's view agree with their counterparts in the original game.
     757 | +In the adversary's view, a session with ''aggnonce<sub>∞</sub> = bytes(33, 0) || bytes(33, 0)'' and a session with ''aggnonce<sub>G</sub> = cbytes(G) || bytes(33, 0)'' have the same final nonce ''G'' and thus the same challenge, but independent nonce coefficients.
     758 | +Since the challenge in the original game is determined by the final nonce and the nonce coefficient by the aggregate nonce, the reduction answers them with sessions of the original game that have the same final nonce ''W'' but are derived from two different aggregate nonces.
     759 | +Since the challenge depends only on ''xbytes(R)'', a session with ''aggnonce<sub>-G</sub> = cbytes(-G) || bytes(33, 0)'', whose final nonce is ''-G'', has the same challenge as well, and the reduction answers it with a session of the original game whose final nonce is ''-W''.<br />
     760 | +Concretely, the reduction treats each pair of X-only aggregate public key ''xbytes(Q)'' and message ''m'' separately as follows.
    


    jonatack commented at 3:06 PM on December 2, 2026:

    Lazy per-context setup

    Concretely, the reduction treats each pair of X-only aggregate public key ''xbytes(Q)'' and message ''m'' separately as follows, performing the setup below when the pair occurs for the first time in a hash query, a signing query, or the forgery.
    
  16. in bip-0327.mediawiki:748 in 9854530ffc
     748 | -Given a successful adversary against the unforgeability game (EUF-CMA) for the modified scheme, a reduction can win the unforgeability game for the original scheme by simulating the modification towards the adversary:
     749 | -When the adversary provides ''aggnonce' = bytes(33, 0) || bytes(33, 0)'', the reduction sets ''aggnonce = cbytes_ext(G) || bytes(33, 0)''.
     750 | -For any other ''aggnonce' '', the reduction sets ''aggnonce = aggnonce' ''.
     751 | -(The case that the adversary provides an ''aggnonce' ≠ bytes(33, 0) || bytes(33, 0) '' but nevertheless ''R' '' in ''GetSessionValues'' is the point at infinity happens only with negligible probability.)
     752 | +This modification to ''GetSessionValues'' does not affect the unforgeability of the scheme in the random oracle model.
     753 | +Given a successful adversary against the unforgeability game (EUF-CMA) for the modified scheme, a reduction can win the unforgeability game for the original scheme by simulating the modification towards the adversary.<ref>The reduction forwards the hash queries and signing queries of the adversary to the unforgeability game for the original scheme (the original game) but translates the inputs of hash queries and the aggregate nonce of signing queries.
    


    jonatack commented at 3:07 PM on December 2, 2026:

    Move the model from the security claim to the reduction, so it can't be read as "MuSig2* is unforgeable in the ROM alone":

    -This modification to ''GetSessionValues'' does not affect the unforgeability of the scheme in the random oracle model.
    -Given a successful adversary against the unforgeability game (EUF-CMA) for the modified scheme, a reduction can win the unforgeability game for the original scheme by simulating the modification towards the adversary.<ref>...
    +This modification to ''GetSessionValues'' does not affect the unforgeability of the scheme.
    +Given a successful adversary against the unforgeability game (EUF-CMA) for the modified scheme, a reduction in the random oracle model can win the unforgeability game for the original scheme by simulating the modification towards the adversary.<ref>...
    
  17. in bip-0327.mediawiki:765 in 9854530ffc
     765 | +* ''w = (y<sub>1</sub> + b(aggnonce<sub>Y</sub>)⋅y<sub>2</sub>) mod n'' and ''W = w⋅G'', repeating the choice of ''y<sub>1</sub>'' and ''y<sub>2</sub>'' until ''not is_infinite(W)'', ''W ≠ G'', and ''has_even_y(W)'',
     766 | +* ''aggnonce<sub>W</sub> = cbytes(W) || bytes(33, 0)'' and ''aggnonce<sub>-W</sub> = cbytes(-W) || bytes(33, 0)''.
     767 | +In the original game, both ''aggnonce<sub>Y</sub>'' and ''aggnonce<sub>W</sub>'' result in the final nonce ''R = W'', and ''aggnonce<sub>-W</sub>'' results in the final nonce ''R = -W''.
     768 | +The reduction answers the adversary's queries to ''hash<sub>MuSig/noncecoef</sub>'' and its signing queries after swapping ''aggnonce<sub>∞</sub>'' with ''aggnonce<sub>Y</sub>'', ''aggnonce<sub>G</sub>'' with ''aggnonce<sub>W</sub>'', and ''aggnonce<sub>-G</sub>'' with ''aggnonce<sub>-W</sub>'' in the query,
     769 | +and it answers the adversary's queries to ''hash<sub>BIP0340/challenge</sub>'' after swapping ''xbytes(G)'' with ''xbytes(W)'' in the query.
     770 | +Since these translations are permutations of the inputs, the hash functions in the adversary's view are random oracles, as in the unforgeability game for the modified scheme.
    


    jonatack commented at 3:14 PM on December 2, 2026:

    The claim that the hash in the adversary's view is "still uniformly random" (L765–766) is too strong because of rejection sampling. It is only statistically close. Perhaps state instead that the adversary's hash_noncecoef is statistically close to a random oracle, since rejected aggnonce_Y candidates keep conditioned outputs, and add "the adversary provides a rejected candidate" to the failure events (or draw y₁ from 0..n−1 and argue rejected candidates are hidden).

    -Since these translations are permutations of the inputs, the hash functions in the adversary's view are random oracles, as in the unforgeability game for the modified scheme.
    -(The swaps involving ''aggnonce<sub>W</sub>'' and ''aggnonce<sub>-W</sub>'' depend on the output of ''hash<sub>MuSig/noncecoef</sub>'' at ''aggnonce<sub>Y</sub>'', but conditioned on this output, the outputs at all other inputs remain uniformly random and independent, so the hash function in the adversary's view is still uniformly random.)<br />
    +Since these translations are permutations of the inputs, the hash functions in the adversary's view are statistically indistinguishable from random oracles, as in the unforgeability game for the modified scheme.
    +(The translations depend on the outputs of ''hash<sub>MuSig/noncecoef</sub>'' at ''aggnonce<sub>Y</sub>'' and at the rejected candidates, but conditioned on these outputs, the outputs at all other inputs remain uniformly random and independent.
    +The output at ''aggnonce<sub>Y</sub>'', which the adversary obtains as the output at ''aggnonce<sub>∞</sub>'', is uniformly random up to a negligible bias caused by the repeated choice of ''y<sub>1</sub>'' and ''y<sub>2</sub>''.
    +The outputs at the rejected candidates are biased, but the rejected candidates are random and hidden from the adversary.)<br />
    
  18. in bip-0327.mediawiki:761 in 9854530ffc
     761 | +Let ''b(aggnonce) = int(hash<sub>MuSig/noncecoef</sub>(aggnonce || xbytes(Q) || m)) mod n'' and ''e(R) = int(hash<sub>BIP0340/challenge</sub>(xbytes(R) || xbytes(Q) || m)) mod n'' denote the values computed in ''GetSessionValues'' with the hash functions of the original game,
     762 | +and let ''b'(aggnonce)'' and ''e'(R)'' denote the corresponding values computed with the hash functions that the reduction provides to the adversary.
     763 | +The reduction chooses ''y<sub>1</sub>'' and ''y<sub>2</sub>'' uniformly at random from ''1..n-1'' and sets
     764 | +* ''aggnonce<sub>Y</sub> = cbytes(y<sub>1</sub>⋅G) || cbytes(y<sub>2</sub>⋅G)'',
     765 | +* ''w = (y<sub>1</sub> + b(aggnonce<sub>Y</sub>)⋅y<sub>2</sub>) mod n'' and ''W = w⋅G'', repeating the choice of ''y<sub>1</sub>'' and ''y<sub>2</sub>'' until ''not is_infinite(W)'', ''W ≠ G'', and ''has_even_y(W)'',
     766 | +* ''aggnonce<sub>W</sub> = cbytes(W) || bytes(33, 0)'' and ''aggnonce<sub>-W</sub> = cbytes(-W) || bytes(33, 0)''.
    


    jonatack commented at 3:14 PM on December 2, 2026:
     * ''aggnonce<sub>W</sub> = cbytes(W) || bytes(33, 0)'' and ''aggnonce<sub>-W</sub> = cbytes(-W) || bytes(33, 0)''.
    +We call the values of ''aggnonce<sub>Y</sub>'' resulting from discarded choices of ''y<sub>1</sub>'' and ''y<sub>2</sub>'' the rejected candidates.
     In the original game, both ''aggnonce<sub>Y</sub>'' and ''aggnonce<sub>W</sub>'' result in the final nonce ''R = W'', ...
    
  19. jonatack commented at 3:18 PM on December 2, 2026: member

    Approach ACK

    Suggestions here and in code comments are by Gemini 4 Neon (high) and Claude Opus 5.5 (high), feel free to ignore:

    (1) say the adversary's hash_noncecoef is statistically close to a random oracle, since rejected aggnonce_Y candidates keep conditioned outputs, and add "the adversary provides a rejected candidate" to the failure events (or draw y₁ from 0..n−1 and argue rejected candidates are hidden)

    (2) s/lift_x(xbytes(Q))/lift_x(int(xbytes(Q)))/ to match the type in BIP 340

    (3) only aggnonce_Y breaks the simulation, so hiding W isn't needed

    (4) mention lazy per-context setup

    (5) clarify the "in the random oracle model" wording at L747.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-12-03 01:42 UTC