Since we know the default nonce function does not modify the passed aux randomness, we can mark it const in the API.
Make aux_rand32 arg to secp256k1_schnorrsig_sign const #966
pull sipa wants to merge 1 commits into bitcoin-core:master from sipa:202107_const_aux changing 3 files +5 −4-
sipa commented at 6:05 PM on July 14, 2021: contributor
-
in src/modules/schnorrsig/main_impl.h:190 in b34ed4f7b5 outdated
184 | @@ -185,8 +185,8 @@ int secp256k1_schnorrsig_sign_internal(const secp256k1_context* ctx, unsigned ch 185 | return ret; 186 | } 187 | 188 | -int secp256k1_schnorrsig_sign(const secp256k1_context* ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, unsigned char *aux_rand32) { 189 | - return secp256k1_schnorrsig_sign_internal(ctx, sig64, msg32, 32, keypair, secp256k1_nonce_function_bip340, aux_rand32); 190 | +int secp256k1_schnorrsig_sign(const secp256k1_context* ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, const unsigned char *aux_rand32) { 191 | + return secp256k1_schnorrsig_sign_internal(ctx, sig64, msg32, 32, keypair, secp256k1_nonce_function_bip340, (unsigned char*)aux_rand32);
jonasnick commented at 8:42 PM on July 14, 2021:Perhaps add a comment here like
We cast away const from the passed aux_rand32 argument since we know the default nonce function does not modify it.
sipa commented at 2:07 PM on September 11, 2021:Done.
jonasnick commented at 8:44 PM on July 14, 2021: contributorYou can add
constto theaux_randargument oftest_schnorrsig_bip_vectors_check_signing. That way we will see a warning if this commit is reverted.real-or-random commented at 8:18 AM on September 6, 2021: contributorACK mod what Jonas said
Make aux_rand32 arg to secp256k1_schnorrsig_sign const db4667d5e0sipa force-pushed on Sep 11, 2021sipa commented at 2:07 PM on September 11, 2021: contributor@jonasnick Done.
jonasnick commented at 6:34 PM on September 11, 2021: contributorCI fails with
cat tests.log || true ./tests: error while loading shared libraries: libasan.so.6: cannot open shared object file: No such file or directoryI believe this was fixed in master, so a rebase is likely to fix this.
real-or-random approvedreal-or-random commented at 2:11 PM on October 15, 2021: contributorACK db4667d5e0e13d1359991379df3400f64918b4e8 diff looks good
real-or-random requested review from jonasnick on Oct 15, 2021jonasnick commented at 3:55 PM on October 15, 2021: contributorACK db4667d5e0e13d1359991379df3400f64918b4e8
jonasnick merged this on Oct 15, 2021jonasnick closed this on Oct 15, 2021elichai commented at 10:25 AM on October 17, 2021: contributorPost merge tACK db4667d
fanquake referenced this in commit 8f5cd5e893 on Oct 20, 2021sipa referenced this in commit f727914d7e on Oct 28, 2021sipa cross-referenced this on Oct 28, 2021 from issue Update libsecp256k1 subtree to current master by sipasipa referenced this in commit 440f7ec80e on Oct 31, 2021sipa referenced this in commit d057eae556 on Dec 2, 2021fanquake referenced this in commit c4a1e09a8c on Dec 3, 2021sipa referenced this in commit 86dbc4d075 on Dec 15, 2021fanquake referenced this in commit c06cda3e48 on Dec 18, 2021jonasnick cross-referenced this on Jan 2, 2022 from issue Sync Upstream by jonasnickreal-or-random referenced this in commit 21e2d65b79 on Jan 5, 2022gwillen referenced this in commit 35d6112a72 on May 25, 2022janus referenced this in commit 879a9a27b9 on Jul 10, 2022patricklodder referenced this in commit 21badcf9d2 on Jul 25, 2022patricklodder referenced this in commit 03002a9013 on Jul 28, 2022backpacker69 referenced this in commit 77186f4a04 on Jan 18, 2023str4d referenced this in commit 6de4698bf9 on Apr 21, 2023vmta referenced this in commit e1120c94a1 on Jun 4, 2023vmta referenced this in commit 8f03457eed on Jul 1, 2023Contributors
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-14 11: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-14 11: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