Make it impossible to build without SECP256K1_BUILD defined #927

issue gmaxwell openend this issue on April 28, 2021
  1. gmaxwell commented at 7:27 pm on April 28, 2021: contributor

    If the library itself is compiled without -DSECP256K1_BUILD then it will be (minorly) miscompiled: all the nullness checks on the interfaces which specify that their arguments be non-null will get optimized out (the exported symbols also won’t get flagged for windows, but presumably where that matters it’ll get noticed).

    Is there any reason to not just have secp256k1.c #define SECP256K1_BUILD before including any headers and then drop any requirement for the build system?

    If that can’t be done, it should probably check and #error if it isn’t defined. But making it configuration-free seems much better to me.

  2. real-or-random commented at 10:33 am on April 29, 2021: contributor

    Is there any reason to not just have secp256k1.c #define SECP256K1_BUILD before including any headers and then drop any requirement for the build system?

    I always wondered why it’s not set in the .c file. I don’t think there’s a reason. We should do it (and see if it breaks anything). As you point out, this is a pitfall currently.

  3. elichai commented at 11:17 am on April 29, 2021: contributor
    Related, for a while rust-secp256k1 didn’t define this: https://github.com/rust-bitcoin/rust-secp256k1/pull/35
  4. sipa commented at 4:42 pm on May 1, 2021: contributor
    I don’t think there is a reason not to set it in secp256k1.c directly.
  5. gmaxwell cross-referenced this on May 1, 2021 from issue Define SECP256K1_BUILD in secp256k1.c directly. by gmaxwell
  6. real-or-random closed this on May 2, 2021

  7. real-or-random cross-referenced this on Jul 6, 2022 from issue SECP256K1_BUILD sanity checking and USE_FIELD_INV_BUILTIN/USE_SCALAR_INV_BUILTIN simplification. by gmaxwell

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

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