tests: call the exported ecdh and ellswift hash functions #1984

pull nniiovoo wants to merge 1 commits into bitcoin-core:master from nniiovoo:tests-exported-hash-functions changing 2 files +45 −0
  1. nniiovoo commented at 5:11 PM on November 2, 2026: none

    secp256k1_ecdh and secp256k1_ellswift_xdh check whether hashfp is one of the library's own hash functions and, if it is, call an internal version that uses the context's SHA256 (#1777, #1900). So secp256k1_ecdh_hash_function_sha256, secp256k1_ellswift_xdh_hash_function_bip324 and secp256k1_ellswift_xdh_hash_function_prefix themselves only run when user code calls them directly, and no test does that. Making all three return 0 without hashing still passes the tests.

    This calls each of them from a small custom hash function and checks the result against the expected values the tests already use. For the prefix function, the test uses the BIP324 prefix described in the header, so the BIP324 vectors apply to it as well.

  2. tests: call the exported ecdh and ellswift hash functions
    secp256k1_ecdh and secp256k1_ellswift_xdh notice when they are passed
    secp256k1_ecdh_hash_function_sha256, secp256k1_ellswift_xdh_hash_function_bip324
    or secp256k1_ellswift_xdh_hash_function_prefix and call internal versions
    instead, so the bodies of these exported functions never ran in the tests.
    
    Call them from custom hash functions and check the results against the
    existing expected values. For the prefix function, use the BIP324 prefix
    so the BIP324 test vectors apply.
    8516079120
  3. theStack added the label assurance on Nov 4, 2026

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-11-12 07:15 UTC

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