How to use curve APIs when built and installed? #1630

issue lightbulb128 openend this issue on November 4, 2024
  1. lightbulb128 commented at 2:24 am on November 4, 2024: none
    I want to use the curve api, e.g. struct secp256k1_scalar, secp256k1_gej, secp256k1_ecmult_gen, etc., in my code, but when the library is installed, it only produce high-level headers. Is there some extra flags I should give to CMake so that the headers like “field.h”, “group.h” will be installed?
  2. lightbulb128 commented at 3:10 am on November 4, 2024: none

    Plus, when I include “field.h” in my C++ code and compile, it gives an error:

    0.../secp256k1/util.h: In function int secp256k1_memcmp_var(const void*, const void*, size_t):
    1.../secp256k1/util.h:222:31: error: invalid conversion from const void* to const unsigned char* [-fpermissive]
    2  222 |     const unsigned char *p1 = s1, *p2 = s2;
    3      |                               ^~
    4      |                               |
    5      |                               const void*
    

    How can I use this library’s low-level curve code with C++?

  3. sipa commented at 3:42 am on November 4, 2024: contributor

    libsecp256k1 is a high-level library; it only exposes functions needed for ECDSA/ECDH/BIP340 and a few more protocols, not low-level scalar, field, or group operations.

    It is of course open-source, and you’re welcome to use the internals directly as you see fit. Note that it is written in C, not C++, so directly using the implementation code in C++ will likely not work.

  4. lightbulb128 commented at 3:47 am on November 4, 2024: none
    Thank you for the quick reply. I will try to figure out a way.
  5. lightbulb128 closed this on Nov 4, 2024


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

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