Fixes #1322 (@MatthewLM). We actually test that a 0 tweak is fine for all tweak_add functions.
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-
jonasnick commented at 6:36 PM on May 23, 2023: contributor
-
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).tweak_add: fix API doc for tweak=0 05873bb6b1jonasnick force-pushed on May 24, 2023real-or-random approvedreal-or-random commented at 1:51 PM on May 24, 2023: contributorACK 05873bb6b1041227f413626717b7af69fb6176ef
jonasnick merged this on Jul 3, 2023jonasnick closed this on Jul 3, 2023fanquake referenced this in commit 56c05c5ec4 on Jul 17, 2023fanquake referenced this in commit ff061fde18 on Jul 18, 2023hebasto referenced this in commit 270d2b37b8 on Jul 21, 2023jonasnick cross-referenced this on Jul 27, 2023 from issue Upstream PRs 1357, 1345, 1358, 1368, 1369, 1323, 1364, 1370, 1367, 1344, 1371, 1363, 1340, 1366, 1313, 1378, 1298, 1382, 1383, 1384, 1386 by jonasnick
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 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
More mirrored repositories can be found on mirror.b10c.me