tweak_add: fix API doc for tweak=0 #1323

pull jonasnick wants to merge 1 commits into bitcoin-core:master from jonasnick:fix-doc changing 2 files +16 −16
  1. jonasnick commented at 6:36 PM on May 23, 2023: contributor

    Fixes #1322 (@MatthewLM). We actually test that a 0 tweak is fine for all tweak_add functions.

  2. in include/secp256k1.h:740 in 92f7c19093 outdated
     739 | - *                  is negligible (around 1 in 2^128).
     740 | + *  In:    tweak32: pointer to a 32-byte tweak. For non-zero tweaks, the function
     741 | + *                  returns 0 if the tweak is invalid according to
     742 | + *                  secp256k1_ec_seckey_verify. For uniformly random 32-byte
     743 | + *                  tweaks, the chance of being invalid is negligible (around 1
     744 | + *                  in 2^128).
    


    real-or-random commented at 7:32 PM on May 23, 2023:

    Your suggestion is correct. I had to read it a few times to catch the "For non-zero". Perhaps that's just me, but the following (or a variant thereof) is simpler and more direct:

     *  In:    tweak32: pointer to a 32-byte tweak, which must be valid according to
     *                  secp256k1_ec_seckey_verify or 32 zero bytes. For uniformly
     *                  random 32-byte tweaks, the chance of being invalid is
     *                  negligible (around 1 in 2^128).
    
  3. tweak_add: fix API doc for tweak=0 05873bb6b1
  4. jonasnick force-pushed on May 24, 2023
  5. real-or-random approved
  6. real-or-random commented at 1:51 PM on May 24, 2023: contributor

    ACK 05873bb6b1041227f413626717b7af69fb6176ef

  7. jonasnick merged this on Jul 3, 2023
  8. jonasnick closed this on Jul 3, 2023

  9. fanquake referenced this in commit 56c05c5ec4 on Jul 17, 2023
  10. fanquake referenced this in commit ff061fde18 on Jul 18, 2023
  11. hebasto referenced this in commit 270d2b37b8 on Jul 21, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 19:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me