crypto: plug hardware optimized SHA256 into libsecp256k1's context #36188

pull furszy wants to merge 9 commits into bitcoin:master from furszy:2026_secp_pluggable_sha changing 36 files +286 −175
  1. furszy commented at 8:28 PM on September 7, 2026: member

    Since https://github.com/bitcoin-core/secp256k1/pull//1777 , libsecp256k1 allows an externally provided SHA256 compression function. This PR plug ours in, so it runs on our SHA-NI/ARMv8/SSE4 hardware optimized implementation instead of the libsecp bare internal one.

    The biggest gains are at the signing side, not at the verification side.

    Benchmarks at the bench introduction commit (43c9bdbf8ada1b581b5ab1f0a102517c243a60da) and at the tip:

    On ARM64, arm_shani implementation

    benchmark before after change
    ECDSASign 79.2 µs 69.3 µs -13%
    SchnorrSign 39.9 µs 37.1 µs -7%
    ECDSAVerify 27.4 µs 27.3 µs -0%
    SchnorrVerify 28.1 µs 27.8 µs -1%
    EllSwiftCreate 29.8 µs 28.8 µs -3%
    BIP324_ECDH 30.4 µs 30.1 µs -1%
  2. DrahtBot added the label Utils/log/libs on Sep 7, 2026
  3. DrahtBot commented at 8:28 PM on September 7, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK theStack
    Concept ACK sedited, ismaelsadeeq, hebasto, fjahr
    Stale ACK fametrano, w0xlt

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36808 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36808.svg"></sub> (iwyu: Fix warnings in src/test/fuzz and treat them as errors by hebasto)
    • #36743 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36743.svg"></sub> ([RFC] build: build with -Wmissing-declarations/prototypes by fanquake)
    • #36395 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36395.svg"></sub> (script: clarify implicit signature-cache input requirements by l0rinc)
    • #29491 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/29491.svg"></sub> ([EXPERIMENTAL] Schnorr batch verification for blocks by fjahr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • src/key.cpp: secp256k1_schnorrsig_verify(GetSecp256k1PublicContext(), sig.data(), hash.begin(), 32, &pubkey_verify)
    • src/pubkey.cpp: secp256k1_schnorrsig_verify(GetSecp256k1PublicContext(), sigbytes.data(), msg.begin(), 32, &pubkey)

    <sup>2026-11-02 15:39:36</sup>

  4. DrahtBot added the label CI failed on Sep 7, 2026
  5. DrahtBot commented at 9:39 PM on September 7, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/34159538723/job/101858273499</sub> <sub>LLM reason (✨ experimental): CI failed because the IWYU lint check detected missing/incorrect headers (generated “Failure generated from IWYU” for src/bench/ecc_sign_verify.cpp).</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  6. furszy force-pushed on Sep 7, 2026
  7. DrahtBot removed the label CI failed on Sep 8, 2026
  8. w0xlt commented at 7:00 AM on September 8, 2026: contributor

    Concept ACK

  9. fjahr commented at 7:23 AM on September 8, 2026: contributor

    Concept ACK

  10. sedited commented at 7:30 AM on September 8, 2026: contributor

    Finally! Concept ACK

  11. ismaelsadeeq commented at 9:32 AM on September 8, 2026: member

    Awesome Concept ACK

  12. theStack commented at 4:55 PM on September 8, 2026: contributor

    Splendid Concept ACK

  13. fanquake added this to the milestone 33.0 on Sep 9, 2026
  14. fanquake commented at 10:51 AM on September 9, 2026: member
  15. hebasto commented at 2:48 PM on September 10, 2026: member

    Concept ACK.

  16. DrahtBot added the label Needs rebase on Sep 24, 2026
  17. in src/pubkey.cpp:242 in e0d46a42e0 outdated
     240 |      assert(sigbytes.size() == 64);
     241 |      secp256k1_xonly_pubkey pubkey;
     242 | -    if (!secp256k1_xonly_pubkey_parse(secp256k1_context_static, &pubkey, m_keydata.data())) return false;
     243 | -    return secp256k1_schnorrsig_verify(secp256k1_context_static, sigbytes.data(), msg.begin(), 32, &pubkey);
     244 | +    if (!secp256k1_xonly_pubkey_parse(GetSecp256k1VerifyContext(), &pubkey, m_keydata.data())) return false;
     245 | +    return secp256k1_schnorrsig_verify(GetSecp256k1VerifyContext(), sigbytes.data(), msg.begin(), 32, &pubkey);
    


    theStack commented at 1:06 PM on September 24, 2026:

    minimal-diff nit: from all the secp function calls in this file, this (_schnorrsig_verify) is the only one that involves hashing and thus benefits from the SHA256 override, i.e. it would be fine if the others kept using the static context


    fjahr commented at 11:05 AM on November 19, 2026:

    I would add that secp256k1_context_static aborted on any call needing ecmult_gen while this ctx doesn't anymore. So that would be another argument aside from it being "minimal-diff" but it wouldn't prevent misuse, just may be make users of the function more cautious if it's not so widely used.

  18. in src/ecc_context.h:34 in 99a29f69fd outdated
      30 | @@ -27,9 +31,11 @@ class ECC_Context
      31 |      ~ECC_Context();
      32 |  
      33 |      secp256k1_context* SignContext() const { return m_sign_ctx; }
      34 | +    const secp256k1_context* VerifyContext() const { return m_verify_ctx; }
    


    theStack commented at 2:34 PM on September 30, 2026:

    An alternative to this split-up would be to keep having only one "full" (i.e. non-static) context and use it for both signing and verifying (and any other API calls that either involve a generator point multiplication or hashing). It's true that some functions don't take use of the blinding data generated with _context_randomize, but it also doesn't slow things down or hurt in another way. The only challenge might be to find a good name for that context, since it's not only used for signing anymore (FullContext, DynamicContext, ...?).


    furszy commented at 3:46 PM on September 30, 2026:

    An alternative to this split-up would be to keep having only one "full" (i.e. non-static) context and use it for both signing and verifying (and any other API calls that either involve a generator point multiplication or hashing). It's true that some functions don't take use of the blinding data generated with _context_randomize, but it also doesn't slow things down or hurt in another way.

    What if we ever want to re-seed the context rng? (secp256k1_context_randomize docs suggests doing it). By having two contexts, we avoid adding a mutex on the verification side and keep that context immutable and thread safe after construction.


    theStack commented at 4:27 PM on September 30, 2026:

    An alternative to this split-up would be to keep having only one "full" (i.e. non-static) context and use it for both signing and verifying (and any other API calls that either involve a generator point multiplication or hashing). It's true that some functions don't take use of the blinding data generated with _context_randomize, but it also doesn't slow things down or hurt in another way.

    What if we ever want to re-seed the context rng? (secp256k1_context_randomize docs suggests doing it). By having two contexts, we avoid adding a mutex on the verification side and keep that context immutable and thread safe after construction.

    Fair point, I didn't consider that there could be potential use-cases where the context needs any further modification after its initial setup in ECC_Start. Not sure how realistic plans of implementing re-seeding in Core currently are (and what the actual gain in security would really be by doing that), but I agree it's worth to take into account. No strong objection on the split-up, but wanted to bring the simpler option for discussion.


    real-or-random commented at 1:52 PM on October 1, 2026:

    Not sure how realistic plans of implementing re-seeding in Core currently are (and what the actual gain in security would really be by doing that),

    I suspect there's a real gain when it comes to certain types of side-channel attack (e.g., power analysis). There were many discussions in the past, and I wrote a libsecp256k1 issue a while ago. The problem is just that nobody is working on it. ;)

    The simplest thing we could do is to re-randomize the context after every operation that makes an ecmult_gen (pubkey generation and signing). This would be a ~100% hit in performance for these operations because rerandomizing also needs an ecmult_gen. 100% sounds huge but I'm not sure if anyone would really care here for these operations.

    If people do care, the next simplest thing is to it only after (every n operations). For example, if we set n=10, then the performance hit is only 10%.

    Anyway, this discussion belongs to a separate issue. But I agree that it's worth taking into account.


    furszy commented at 5:47 PM on October 1, 2026:

    Nice issue write-up.

    I think we shouldn't over-think this now. Most of the work in this PR is about structuring the code properly so that we don't continue expanding the technical debt (the transform callback plug could have been done in 2 commits max otherwise, but they would be built on top of a dirty base). Once this lands, any future decision should be simple to do and isolated.

  19. theStack commented at 2:38 PM on September 30, 2026: contributor

    LGTM, just left two organizational comments. The MuSig and BIP352 modules could also take use of the plugged in compression function, either here or in a follow-up PR.

  20. furszy force-pushed on Oct 15, 2026
  21. furszy commented at 4:47 AM on October 15, 2026: member

    conflicts solved, ready for review

  22. DrahtBot added the label CI failed on Oct 15, 2026
  23. DrahtBot commented at 5:47 AM on October 15, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/38682946486/job/116251332091</sub> <sub>LLM reason (✨ experimental): CI failed the IWYU lint check: it added/fixed includes in eight files, leaving a diff that caused the check to exit with an error.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  24. DrahtBot removed the label Needs rebase on Oct 15, 2026
  25. furszy force-pushed on Oct 15, 2026
  26. DrahtBot removed the label CI failed on Oct 15, 2026
  27. fametrano commented at 6:54 AM on October 25, 2026: none

    tACK ecf779fa06cef78ca668715cba21b30a1fda8a06

    On an Apple M5 (arm_shani), a differential harness compared a context using libsecp256k1's own compression with one using SHA256Transform, with both Core's arm_shani and portable transforms. It ran 20,000 random rounds of tagged hashes, BIP340 signing of 0- to 300-byte messages, ECDSA, ElligatorSwift XDH, MuSig2 and silent payments labels, plus the BIP340 vectors. All results matched, and a sample also matched the pure-Python code of a library I maintain. Unit tests and ctest pass.

    Medians of three interleaved bench_bitcoin runs against 7caaaca9d2, the commit before the plug: ECDSASign -11%, SchnorrSign -3.7%, EllSwiftCreate -3.7%, BIP324_ECDH -1.9%, SchnorrVerify -1.2%. The ConnectBlock benches stay within noise. With Core's portable transform forced, hashing and signing run at libsecp256k1's own speed, so a CPU that falls back to it loses nothing per operation.

    Non-blocking: ECCContextCreate goes from 13.5 µs to 176 µs. Almost all of it is the libsecp256k1 self-test of the plugged function, run once for each of the two contexts: 88 µs each here, about 0.5 ms each with the portable transform. Creating the verify context with secp256k1_context_clone before randomizing the sign context keeps the plugged function and skips the second test. From reading the code, not measuring, this matters mainly for the secp256k1_ecdsa_signature_parse_der_lax fuzz target, which builds a context for every input that parses. Happy to share the scripts as a gist.

  28. DrahtBot requested review from ismaelsadeeq on Oct 25, 2026
  29. DrahtBot requested review from sedited on Oct 25, 2026
  30. DrahtBot requested review from theStack on Oct 25, 2026
  31. DrahtBot requested review from hebasto on Oct 25, 2026
  32. DrahtBot requested review from fjahr on Oct 25, 2026
  33. in src/ecc_context.cpp:50 in ecf779fa06 outdated
      45 | +{
      46 | +    assert(g_ecc_context == nullptr);
      47 | +    m_sign_ctx = ECC_Start(rng_seed32);
      48 | +    m_verify_ctx = ECC_Start(/*rng_seed32=*/{});
      49 | +    g_ecc_context = this;
      50 | +}
    


    fametrano commented at 7:40 AM on October 25, 2026:

    Cloning the signing context before randomizing it would skip the second SHA256 self-test.

    secp256k1_context_clone copies the context, compression function included, and runs no self-test. Done before secp256k1_context_randomize, the verify context ends up in the same state as now and shares no blinding. In medians of three bench_bitcoin runs on an Apple M5, ECCContextCreate drops from 169 µs to 89 µs. The parse_der_lax fuzz target builds a context for every input that parses, so it saves the same time per input. Unit tests pass.

    /** Create an elliptic curve context that uses our SHA256 implementation */
    static secp256k1_context* ECC_Start() {
        secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);
        assert(ctx != nullptr);
    
        SHA256AutoDetect();
        secp256k1_context_set_sha256_compression(ctx, SHA256Transform);
    
        return ctx;
    }
    
    ECC_Context::ECC_Context(std::span<const unsigned char> rng_seed32)
    {
        assert(g_ecc_context == nullptr);
        assert(rng_seed32.empty() || rng_seed32.size() == 32);
        m_sign_ctx = ECC_Start();
        // Clone before randomizing: the copy keeps SHA256Transform without testing it again,
        // and does not share the blinding of the signing context.
        m_verify_ctx = secp256k1_context_clone(m_sign_ctx);
        assert(m_verify_ctx != nullptr);
        if (!rng_seed32.empty()) {
            // Pass in a random blinding seed to the signing context.
            bool ret = secp256k1_context_randomize(m_sign_ctx, rng_seed32.data());
            assert(ret);
        }
        g_ecc_context = this;
    }
    

    furszy commented at 3:42 PM on October 27, 2026:

    We can actually drop the ECC context creation from the parse_der_lax fuzz target, nothing there requires it. Other than that, the concept of the change seems good to me, the only thing I would try to do is decoupling the ECC function calls out of the ECC_Context constructor, so it stays clean.

  34. in src/ecc_context.cpp:32 in ecf779fa06 outdated
      27 | +    assert(rng_seed32.empty() || rng_seed32.size() == 32);
      28 | +
      29 | +    secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);
      30 | +    assert(ctx != nullptr);
      31 | +
      32 | +    SHA256AutoDetect();
    


    w0xlt commented at 11:34 PM on October 27, 2026:

    This call appears redundant. Both bitcoind.cpp and NodeImpl::baseInitialize() construct a kernel::Context, which already runs SHA256AutoDetect() before ECC initialization.


    furszy commented at 2:03 PM on October 28, 2026:

    This call appears redundant.

    Not for benchmarks, unit and fuzz tests. It doesn't harm to keep it.


    w0xlt commented at 6:23 PM on October 28, 2026:

    bench_bitcoin already calls it in main() at ecf779fa06, and tests using BasicTestingSetup initialize it through kernel::Context. It is redundant for those callers, although the extra overhead is negligible during normal startup.

  35. DrahtBot requested review from w0xlt on Oct 27, 2026
  36. w0xlt commented at 6:24 PM on October 28, 2026: contributor

    ACK ecf779fa06cef78ca668715cba21b30a1fda8a06

  37. sedited commented at 5:09 PM on October 31, 2026: contributor

    @theStack can you take another look here?

  38. theStack approved
  39. theStack commented at 8:45 AM on November 2, 2026: contributor

    ACK ecf779fa06cef78ca668715cba21b30a1fda8a06

    nit: I think the "signing/verification" context naming is a bit imprecise, as many secp function calls in other modules (in e.g. ecdh, ellswift, musig, silentpayments) involve neither of these operations but still need (or profit from) a non-static context, and it's not obvious which one should be picked. Dropping an alternative naming suggestion from my clanker that I think might work, could be picked up in a renaming follow-up if others feel strongly (enough) about this:

    /** secp256k1 context for operations involving secret data (secret keys, nonces,
     *  secret tweaks). Randomized for side-channel protection. Requires an ECC_Context. */
    secp256k1_context* GetSecp256k1SecretContext();
    
    /** secp256k1 context for operations on public data only (parsing, serialization,
     *  verification, public tweaks). Falls back to secp256k1_context_static without an ECC_Context. */
    const secp256k1_context* GetSecp256k1PublicContext();
    
  40. furszy force-pushed on Nov 2, 2026
  41. furszy commented at 3:43 PM on November 2, 2026: member

    Updated per @theStack feedback. Thanks! Applied the GetSecp256k1PublicContext renaming and the functions' doc improvement. Left the GetSecp256k1SecretContext one for a quick scripted-diff as otherwise it requires a rework of this branch from the second commit onwards.

  42. theStack approved
  43. theStack commented at 5:30 AM on November 3, 2026: contributor

    re-ACK 02b7b76c59eb5f65889ba4b1e506634864e130a2

  44. DrahtBot requested review from w0xlt on Nov 3, 2026
  45. DrahtBot requested review from fametrano on Nov 3, 2026
  46. sipa commented at 10:50 AM on November 3, 2026: member

    I think there is a simpler approach that just removes ECC_Context and uses secp contexts created on first use in static locals. Clankerbranch: https://github.com/sipa/bitcoin/commits/202611_ecc_static.

  47. key: create the signing context on first use
    Instead of requiring an ECC_Context to exist while signing, create the
    secp256k1 signing context in a function-local static, the first time
    GetSecp256k1SignContext() is called. It is never destroyed, so it stays
    valid for threads still running at exit.
    
    The RNG this depends on already initializes itself on first use, so no
    explicit initialization order is needed. The blinding seed is obtained
    through GetStrongRandBytes rather than GetRandBytes: the latter draws
    from the deterministic RNG in tests, and consuming from it at whatever
    point the context is first used would make test and fuzz results depend
    on whether an earlier test or input happened to sign. Blinding does not
    affect any outputs, so real randomness is harmless there. As a side
    effect, BasicTestingSetup no longer consumes 32 bytes of the
    deterministic RNG stream.
    
    The context is never modified after creation, so return it as const.
    
    ECC_Context is kept for now, merely creating the context eagerly. It is
    removed in the next commit.
    9bd0886958
  48. refactor: remove ECC_Context
    It is no longer needed, as the signing context is created on first use.
    
    The fuzz harness still creates the signing context up front, before the
    coverage counters are reset, so that its one-time setup is not counted
    as coverage of whichever input happens to sign first.
    ce0e7a8c81
  49. bench: ECDSA and Schnorr signing and verification
    Low-level signature creation and validation benchmarks.
    7a6ddc6160
  50. libsecp: plug our hardware optimized SHA256 into libsecp256k1 ctx
    libsecp256k1 lets a context use an external SHA256 compression
    function. With ours, ECDSA signing gets ~15% faster on CPUs with
    SHA extensions, Schnorr signing ~3%.
    
    SHA256Transform dispatches to whichever implementation is selected at
    the time of the call, so there is no need to run SHA256AutoDetect()
    before creating the context. Doing so lazily would race with other
    threads hashing, and override any explicitly selected implementation.
    
    Also use the signing context instead of the static one for the BIP324
    ECDH, which hashes inside libsecp256k1 too.
    df2e2b0223
  51. libsecp: introduce public verification context
    Verification uses secp256k1_context_static, which can't take our
    optimized SHA256 compression function. Rather than reusing the signing
    context, which blinds certain calculations, for no benefit to public
    data, verification gets its own context. Like the signing context, it
    is created on first use. As it needs no randomness, it lives next to
    the verification code in pubkey.cpp, so users of the kernel library get
    it without any setup.
    
    Around 1% faster Schnorr signature verification. ECDSA remains equal
    as hashing is done outside libsecp.
    
    Co-authored-by: Pieter Wuille <bitcoin-dev@wuille.net>
    9a0d109501
  52. scripted-diff: use public verification context in pubkey.cpp
    Every use of secp256k1_context_static in pubkey.cpp uses public
    data, so all of them can use the verification context, which
    contains our optimized SHA256 compression plugged in.
    
    -BEGIN VERIFY SCRIPT-
    sed -i -e '/\/\*/! s/secp256k1_context_static/GetSecp256k1PublicContext()/g' src/pubkey.cpp
    -END VERIFY SCRIPT-
    c39f543c69
  53. test: check that signing and verification use the expected secp256k1 contexts
    Temporarily install a call-counting SHA256 compression function in each
    context, to check that ECDSA signing goes through the signing context
    and Schnorr verification through the public one. Also check that both
    contexts are distinct from each other and from the static one, and stay
    the same across calls.
    a90742ea56
  54. use sign context for musig partial signing and bip352 scanning
    secp256k1_musig_partial_sign() and secp256k1_silentpayments_recipient_scan_outputs()
    take data that is not public, like the nonce or the scan key, so they should match
    the rule operations on private data should use the signing context.
    9c7f09ea7d
  55. scripted-diff: use libsecp public context in musig and bip352
    So all functions make use of our hardware optimized SHA256.
    
    -BEGIN VERIFY SCRIPT-
    sed -i -e '/\/\*/! s/secp256k1_context_static/GetSecp256k1PublicContext()/g' src/musig.cpp
    sed -i -e '/\/\*/! s/secp256k1_context_static/GetSecp256k1PublicContext()/g' src/common/bip352.cpp
    -END VERIFY SCRIPT-
    67ac80993d
  56. furszy force-pushed on Nov 5, 2026
  57. furszy commented at 5:06 AM on November 5, 2026: member

    I think there is a simpler approach that just removes ECC_Context and uses secp contexts created on first use in static locals. Clankerbranch: https://github.com/sipa/bitcoin/commits/202611_ecc_static.

    That's hidden magic, nice. Thanks! Went further while rebasing the branch on master and expanded it to cover silent payments as well.

  58. fanquake commented at 10:55 AM on November 5, 2026: member

    @furszy can you update the PR description, given the latest changes?

  59. furszy commented at 2:22 PM on November 5, 2026: member

    @furszy can you update the PR description, given the latest changes?

    Sure, thanks. Done.

  60. theStack approved
  61. theStack commented at 3:40 PM on November 5, 2026: contributor

    re-ACK 67ac80993df931040587bcebb623503216476767

    Very nice simplification! It felt a bit strange at first sight that the context cleanup part (secp256k1_context_destroy call) is now completely gone, but seems fine to rely on the OS handling that, if the object intentionally lives for the duration of the process.

  62. sedited requested review from sipa on Nov 5, 2026
  63. in src/key.h:361 in ce0e7a8c81 outdated
     353 | @@ -354,14 +354,4 @@ bool ECC_InitSanityCheck();
     354 |   *  created and randomized on first use. Thread-safe. */
     355 |  const secp256k1_context* GetSecp256k1SignContext();
     356 |  
     357 | -/**
     358 | - * Creates the secp256k1 signing context, if it does not exist yet. This is not
     359 | - * necessary anymore, as GetSecp256k1SignContext() creates it on first use.
     360 | - */
     361 | -class ECC_Context
    


    fjahr commented at 10:34 AM on November 19, 2026:

    There appears to be a silent merge conflict from this removal. #36475 added a new call site of ECC_Context which isn't removed here yet: https://github.com/bitcoin/bitcoin/pull/36475/files#diff-6bf59f47d71af9c1c3a2dd315228db6b820594f4a6009df7668696c310097637R38

  64. in src/test/key_tests.cpp:425 in a90742ea56 outdated
     420 | +
     421 | +    const CKey key{GenerateRandomKey()};
     422 | +    std::vector<unsigned char> sig(64);
     423 | +    BOOST_REQUIRE(key.SignSchnorr(uint256::ONE, sig, /*merkle_root=*/nullptr, uint256::ZERO));
     424 | +
     425 | +    // Check that both contexts use our SHA256 implementation, by temporarily wrapping it with a
    


    fjahr commented at 10:40 AM on November 19, 2026:

    Hm, I am not sure if this works or maybe I am understanding it but if the secp256k1_context_set_sha256_compression(ctx, SHA256Transform) lines are deleted from key.cpp or pubkey.cpp the test still passes.

  65. fjahr commented at 11:05 AM on November 19, 2026: contributor

    Looks good to me, saving the ACK for later since this seems to need a rebase because of the silent merge conflict I saw.


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-11-23 12:51 UTC

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