silentpayments: add hash ctx (SHA256 compression override) test #1940

pull theStack wants to merge 1 commits into bitcoin-core:master from theStack:sp-add-hash_ctx-tests changing 1 files +78 −0
  1. theStack commented at 2:52 PM on September 21, 2026: contributor

    This PR adds a test to check that the ctx-provided SHA256 compression override takes effect for the following silentpayments module API functions:

    • secp256k1_silentpayments_label_create (hash result is used for calculating the label tweak)
    • secp256k1_silentpayments_sender_create_outputs (hash results are used for calculating the input hash and output tweak)
    • secp256k1_silentpayments_recipient_prevouts_summary_create (hash result is used for calculating the input hash)
    • secp256k1_silentpayments_recipient_scan_outputs (hash result is used for calculating the output tweak)

    With #1866 for musig and this PR, all public functions that take use of the SHA256 compression override should be covered by tests.

  2. silentpayments: add hash ctx (SHA256 compression override) test 35c5b99bd5
  3. in src/modules/silentpayments/tests_impl.h:938 in 35c5b99bd5
     931 | @@ -931,6 +932,82 @@ static void silentpayments_sha256_tag_test(void) {
     932 |      }
     933 |  }
     934 |  
     935 | +DEFINE_SHA256_TRANSFORM_PROBE(sha256_sp_label_create)
     936 | +DEFINE_SHA256_TRANSFORM_PROBE(sha256_sp_create_outputs)
     937 | +DEFINE_SHA256_TRANSFORM_PROBE(sha256_sp_prevouts_summary_create)
     938 | +DEFINE_SHA256_TRANSFORM_PROBE(sha256_sp_scan_outputs)
    


    theStack commented at 3:01 PM on September 21, 2026:

    self-nit: I was on the fence between adding multiple probes or a single one (that is set back repeatedly, leading to approximately the same LOC), but decided to reflect the style currently used in #1866. Happy with either style if reviewers have a preference.


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-09-22 01:15 UTC

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