Missing method to add 2 points #13

issue genjix openend this issue on May 8, 2014
  1. genjix commented at 4:43 pm on May 8, 2014: none

    What is the recommended way to add 2 points?

    I see:

    Create point: void static secp256k1_gej_set_xy(secp256k1_gej_t *r, const secp256k1_fe_t *x, const secp256k1_fe_t *y);

    Add both points: void static secp256k1_gej_add(secp256k1_gej_t *r, const secp256k1_gej_t *a, const secp256k1_gej_t *b);

    And then finally convert the jacobian point back into a cartesian value (0x04, x, y) as used in Bitcoin.

    (using x/z^2 and y/z^3 as it says in group.h)

  2. sipa commented at 4:54 pm on May 8, 2014: contributor

    There’s currently no public API call to do so.

    It could easily be added the way you say (you could keep one of both point affine even), unless the point you’re adding is a known multiple of the generator (in which case tweak_add should suffice). If so, pull requests welcome.

  3. sipa added the label question on Jun 15, 2014
  4. apoelstra commented at 11:30 am on July 6, 2016: contributor

    Closing. It’s been a few years and (a) we haven’t encountered a use case for this; (b) we’ve formed a policy of not exposing arbitrary EC math functionality, at risk of people using them to create novel cryptosystems in inefficient/insecure ways.

    If you need to add points, the right way to do it is to encapsulate whatever you’re really doing into a module, fork the lib to add it under src/modules, and give a safe public API. If it’s generally useful, PRs are welcome.

  5. apoelstra closed this on Jul 6, 2016

  6. voisine commented at 6:46 pm on July 6, 2016: contributor
    @apoelstra in breadwallet we are using point addition and multiplication, and scalar addition directly to implement BIP32 and BIP38. What’s the recommended best practice to do this using libsecp? Should we make a libsecp module for it?
  7. sipa commented at 6:50 pm on July 6, 2016: contributor
    I believe the secp256k1_ec_{priv,pub}key_tweak_* functions sufice for BIP32 and BIP38.

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

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