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
  12. delta1 referenced this in commit 3f32c20932 on Aug 8, 2023
  13. delta1 referenced this in commit 31ac0c1081 on Aug 31, 2023
  14. janus referenced this in commit 476a2176e7 on Sep 11, 2023
  15. div72 referenced this in commit af627d47c3 on Apr 12, 2025
  16. str4d referenced this in commit 3b49801869 on Jun 4, 2025

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-05-19 06:52 UTC