Verify non-null data arg in ellswift xdh_hash_function_prefix #1806

pull furszy wants to merge 1 commits into bitcoin-core:master from furszy:2026_ellswift_xdh_verify_data_arg changing 1 files +1 −0
  1. furszy commented at 8:14 pm on January 23, 2026: member

    The secp256k1_ellswift_xdh API has a data arg that is optional for one of the hash functions (unused) but required for the other.

    This adds a simple check to provide a clear error instead of crashing due to an out-of-bounds memory access when the user mistakenly provides data=NULL and selects the xdh_hash_function_prefix() function.

    Note: Open to improving the arg description in the API as well. I’m just adding this check because a better error would have saved me a few minutes.

  2. Verify non-null data arg in ellswift xdh_hash_function_prefix
    The secp256k1_ellswift_xdh API has a `data` arg that is optional
    for one of the hash functions (unused) but required for the other.
    
    This adds a simple check to provide a clear error instead of crashing
    due to an out-of-bounds memory access when the user mistakenly provides
    data=NULL and selects the `xdh_hash_function_prefix()` function.
    f4708d24d2
  3. sipa commented at 8:19 pm on January 23, 2026: contributor
    ACK f4708d24d21c252279cd865d0e64799ab2159f90
  4. real-or-random added the label assurance on Jan 23, 2026
  5. real-or-random added the label tweak/refactor on Jan 23, 2026
  6. real-or-random commented at 8:23 pm on January 23, 2026: contributor

    when the user mistakenly provides data=NULL

    Note that VERIFY_CHECKs are only active in the tests.

  7. furszy commented at 8:26 pm on January 23, 2026: member

    when the user mistakenly provides data=NULL

    Note that VERIFY_CHECKs are only active in the tests.

    We can’t use ARG_CHECK because ellswift_xdh_hash_function_prefix() doesn’t receive the context (for now). #1777 will solve that and let us add the proper arg check.

    Update: We probably could leave this open until the other PR gets merged.


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-01-27 08:15 UTC

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