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
  1. sipa commented at 6:05 PM on July 14, 2021: contributor

    Since we know the default nonce function does not modify the passed aux randomness, we can mark it const in the API.

  2. 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.

  3. jonasnick commented at 8:44 PM on July 14, 2021: contributor

    You can add const to the aux_rand argument of test_schnorrsig_bip_vectors_check_signing. That way we will see a warning if this commit is reverted.

  4. real-or-random commented at 8:18 AM on September 6, 2021: contributor

    ACK mod what Jonas said

  5. Make aux_rand32 arg to secp256k1_schnorrsig_sign const db4667d5e0
  6. sipa force-pushed on Sep 11, 2021
  7. sipa commented at 2:07 PM on September 11, 2021: contributor

    @jonasnick Done.

  8. jonasnick commented at 6:34 PM on September 11, 2021: contributor

    CI fails with

    cat tests.log || true
    ./tests: error while loading shared libraries: libasan.so.6: cannot open shared object file: No such file or directory
    

    I believe this was fixed in master, so a rebase is likely to fix this.

  9. real-or-random approved
  10. real-or-random commented at 2:11 PM on October 15, 2021: contributor

    ACK db4667d5e0e13d1359991379df3400f64918b4e8 diff looks good

  11. real-or-random requested review from jonasnick on Oct 15, 2021
  12. jonasnick commented at 3:55 PM on October 15, 2021: contributor

    ACK db4667d5e0e13d1359991379df3400f64918b4e8

  13. jonasnick merged this on Oct 15, 2021
  14. jonasnick closed this on Oct 15, 2021

  15. elichai commented at 10:25 AM on October 17, 2021: contributor

    Post merge tACK db4667d

  16. fanquake referenced this in commit 8f5cd5e893 on Oct 20, 2021
  17. sipa referenced this in commit f727914d7e on Oct 28, 2021
  18. sipa cross-referenced this on Oct 28, 2021 from issue Update libsecp256k1 subtree to current master by sipa
  19. sipa referenced this in commit 440f7ec80e on Oct 31, 2021
  20. sipa referenced this in commit d057eae556 on Dec 2, 2021
  21. fanquake referenced this in commit c4a1e09a8c on Dec 3, 2021
  22. sipa referenced this in commit 86dbc4d075 on Dec 15, 2021
  23. fanquake referenced this in commit c06cda3e48 on Dec 18, 2021
  24. jonasnick cross-referenced this on Jan 2, 2022 from issue Sync Upstream by jonasnick
  25. real-or-random referenced this in commit 21e2d65b79 on Jan 5, 2022
  26. gwillen referenced this in commit 35d6112a72 on May 25, 2022
  27. janus referenced this in commit 879a9a27b9 on Jul 10, 2022
  28. patricklodder referenced this in commit 21badcf9d2 on Jul 25, 2022
  29. patricklodder referenced this in commit 03002a9013 on Jul 28, 2022
  30. backpacker69 referenced this in commit 77186f4a04 on Jan 18, 2023
  31. str4d referenced this in commit 6de4698bf9 on Apr 21, 2023
  32. vmta referenced this in commit e1120c94a1 on Jun 4, 2023
  33. vmta referenced this in commit 8f03457eed on Jul 1, 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-14 11:15 UTC

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