Unnecessary call to secp256k1_sha256_initialize #26712

issue Coding-Enthusiast opened this issue on December 16, 2022
  1. Coding-Enthusiast commented at 2:45 PM on December 16, 2022: none

    When computing tagged-hashes for Schnorr sigs the 3 methods (challenge, aux, nonce) first call secp256k1_sha256_initialize that sets the hashstate (ie. s[0] to s[7] and bytes) to their default SHA256 values then they each immediately change all those values to the precomputed "midstate" values. The first call to secp256k1_sha256_initialize seems wasteful.

    https://github.com/bitcoin/bitcoin/blob/7386da7a0b08cd2df8ba88dae1fab9d36424b15c/src/secp256k1/src/modules/schnorrsig/main_impl.h#L16-L28

    https://github.com/bitcoin/bitcoin/blob/7386da7a0b08cd2df8ba88dae1fab9d36424b15c/src/secp256k1/src/hash_impl.h#L31-L41

  2. Coding-Enthusiast added the label Bug on Dec 16, 2022
  3. fanquake commented at 2:49 PM on December 16, 2022: member

    This issue would be better opened / reported upstream: https://github.com/bitcoin-core/secp256k1, as the code here is a (semi-regularly updated) subtree of that repository.

  4. fanquake removed the label Bug on Dec 16, 2022
  5. fanquake closed this on Dec 17, 2022

  6. fanquake locked this on Dec 28, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-26 09:14 UTC

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